akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (ll)c.size()
#define fr first
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for(ll i=a ; i<n ; i++)
#define ld long double
const ll INF = __LONG_LONG_MAX__;
#define rall(a) (a).rbegin(),(a).rend()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

ll power(ll b,ll e,ll m)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(b==0) return 0;
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}  
bool isPowerOfTwo(ll x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
}

void solve()
{
 string s,t,p;
 cin>>s;
 int n=s.size();
 // cout<<n<<"\n";
 t=s.substr(0,n/2);
 p=s.substr((n+1)/2,n/2);
 reverse(all(p));
 int ans=0;
 int i;
 // cout<<t<<" "<<p<<"\n";
 rep(i,0,n/2)
 {
  if(t[i]!=p[i])
    ans++;
  }
  cout<<ans;
}

int main()
{
  fastio
  ll tt=1;
  // cin>>tt;
  while(tt--)
  {
      solve();
      cout<<"\n";
  }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e10;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 




////////////////////////////////////////////////////////////////////
template<typename T>
struct edge {
  int to, from;T cost;
  edge(int to) : from(-1), to(to), cost(-1) {}
  edge(int to, T cost) : from(-1), to(to), cost(cost) {}
  edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};
template<typename T>
using edges = vector<edge<T>>;
template<typename T>
using graph = vector<edges<T>>;
template<typename T>
using matrix = vector<vector<T>>;

template<typename T>
bool compByCost(const edge<T>& left, const edge<T>& right){
  return left.cost < right.cost; 
}


int n,m,s,t;graph<int> g(110000);
vector<int> toNode[110000];bool visited[110000][4];
void dfs(int node, int start, int depth){
  if(depth == 0 && toNode[node].size() > 0)return;
  if(depth == 3){
    toNode[start].push_back(node);
    return;
  }
  rep(i,g[node].size()){
    if(!visited[g[node][i].to][depth]){
      dfs(g[node][i].to, start, depth+1);visited[g[node][i].to][depth] = true;
    }
  }
}

template<typename T>
vector<T> dijkstra(int s, graph<T> &g){
  vector<T> dist(g.size(), INF);dist[s] = 0;
  priority_queue<P, vector<P>, greater<P>> que;que.push(P(0,s));
  while(!que.empty()){
    P p = que.top();que.pop();
    int v = p.second;
    if(dist[v] < p.first)continue;
    dfs(v, v, 0);
    rep(i,toNode[v].size()){
      int to = toNode[v][i];
      if(dist[to] > dist[v] + 1){
        dist[to] = dist[v] + 1;
        que.push(P(dist[to], to));
      }
    }
  }
  return dist;
}

#define dijkstra dijkstra<int>


////////////////////////////////////////////////////////////////////
vector<int> dist;
signed main(){
  cin>>n>>m;
  rep(i,m){
    int u,vv;cin>>u>>vv;u--;vv--;
    g[u].push_back(edge<int>(vv));
  }
  cin>>s>>t;s--;t--;
  dist = dijkstra(s, g);
  cout << (dist[t] == INF ? -1 : dist[t]) << endl;
}


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

	int func(int x){
      if(x<10){
        return x;
      }else{
        return x%10+func(x/10);
      }
    }

int main () {
  int n;
  cin >> n;
  int s=func(n);
  
  if(n%s==0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

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

using namespace std;
#define BUF (200005)
#define ll long long 
#define INF 1e15
int n;
ll a[BUF];
ll s[BUF];
ll total;
int main(void){
	cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a[i];
    a[i]-=i;
  }

  sort(a+1,a+n+1);

  for(int i=1;i<=n;i++){
    s[i]=s[i-1]+a[i];
  }

  ll ans = INF;
  for(int i=1;i<n;i++){
    if(a[i]==a[i+1]) continue;

    ll tmp = s[n]-2*s[i]; 
    if(2*i-n>0) tmp+= (2*i-n)*a[i];
    else tmp+= (2*i-n)*a[i+1];

    ans = min(ans,tmp);
  }

  if(ans==INF) {
    cout << 0 << endl;
    return 0;
  }

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


Measured memory_bytes: 3328
#include <stdio.h>
#include <stdbool.h>

int main(void)
{
	int i;
	int west_num = 0;
	int south_num = 0;
	int north_num = 0;
	int east_num = 0;
	bool south_and_north_flg = false;
	bool west_and_east_flg = false;
	char input_string[ 1002 ];

	scanf("%s", input_string);

	for(i = 0; input_string[ i ] != '\0'; i++ ){
		switch( input_string[ i ] ){
			case 'N':
				north_num++;
				break;
			case 'W':
				west_num++;
				break;
			case 'S':
				south_num++;
				break;
			case 'E':
				east_num++;
				break;
			default:
				break;
		}
	}

	if( 0 < north_num && 0 < south_num ||
	 	north_num == 0&& south_num == 0 ){
		south_and_north_flg = true;
	}
	if( ( 0 < west_num && 0 < east_num ) ||
	 	( west_num == 0 && east_num == 0 ) ){
		west_and_east_flg = true;
	}

	if( south_and_north_flg && west_and_east_flg ){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 128
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
#define TSUKASA_DIARY_S_TEMPLATE
// define
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) int((a).size())
#define cauto const auto
// typedef
typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;
template< typename T > using Vec = vector< T >;
template< typename T > using Matrix = Vec< Vec< T > >;
template< typename T > using USet = unordered_set< T >;
template< typename T, class C > using MyUSet = unordered_set< T, C >;
template< typename T, typename F > using UMap = unordered_map< T, F >;
template< typename T, typename F, class C > using MyUMap = unordered_map< T, F, C >;
// hash
class PiiHash { public: size_t operator () (const pii& p) const { return (p.first << 16) | p.second; } };
// popcount
inline int POPCNT(int x) { return __builtin_popcount(x); }
inline int POPCNT(lint x) { return __builtin_popcount(x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
const Double EPS = 1e-9;
const Double PI = acos(-1);
// inrange
template< typename T >
inline bool in_range(T v, T mi, T mx) { return mi <= v && v < mx; }
template< typename T >
inline bool in_range(T x, T y, T W, T H) { return in_range(x,0,W) && in_range(y,0,H); }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
template< typename T > inline void modAdd(T& a, T b, T mod) { a = (a + b) % mod; }
template< typename T > inline void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > inline void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > inline void maxUpdate(T& a, T b) { a = max(a, b); }
// converter
template< typename F, typename T >
inline void convert(F& from, T& to) {
	stringstream ss;
	ss << from; ss >> to;
}


int N;

bool able(int x) {
	int n = N;
	while (n) {
		if (n >= x) n -= x;
		--x;
		if (x == 0) break;
	}
	return n == 0;
}

void output(int x) {
	int n = N;
	Vec< int > ans;
	while (n) {
		if (n >= x) {
			n -= x;
			ans.push_back(x);
		}
		--x;
	}
	sort(allof(ans));
	for (int x : ans) cout << x << endl;
}

void solve() {
	int lb = 0, ub = N + 1;
	while (ub - lb > 1) {
		int med = (ub + lb) / 2;
		if (able(med)) ub = med;
		else lb = med;
	}
	output(ub);
}

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






Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#if 1
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif


int main(){
	int a;
	string s;
	cin >> a >> s;

	if( a >= 3200 ){
		cout << s << endl;
	}
	else{
		cout << "red" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
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;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
	int a,b,c;
	cin>>a>>b>>c;
	if((b-a)==(c-b)) out("YES");
	else out("NO");
}

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


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

vll a;
ll n,k; 

bool isOk(ll mid){
  ll cnt=0;
  rep(i,n){
    if(a[i]>mid) cnt+=(a[i]/mid);
  }
  
  return cnt<=k;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>n>>k;
  a.resize(n);
  rep(i,n){
    cin>>a[i];
  }
  
  sort(a.rbegin(),a.rend());
  
  if(k==0){
    cout<<a[0]<<endl;
    return 0;
  }
  
  ll ok=1e9, ng=0;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    if(isOk(mid)) ok=mid;
    else ng=mid;
  }
  
  if(ok>a[0]) cout<<a[0]<<endl;
  else cout<<ok<<endl;
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
#define modulo M
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000001

int N,M;

template <typename T,typename F0,typename F1>
struct rerooting{
	F0 func0;
	F1 func1;
	T init_value;
	
	vector<T> v;
	vector<T> ans;
	vector<bool> visited;
	
	rerooting(vector<vector<int>> &E,F0 f0,F1 f1,T iv):func0(f0),func1(f1){
		init_value = iv;
		v.resize(E.size());
		ans.resize(E.size());
		visited.resize(E.size(),false);
		for(int i=0;i<E.size();i++){
			if(visited[i])continue;
			dfs(E,i,-1);
			redfs(E,i,-1,init_value);
		}
	}
	
	void dfs(vector<vector<int>> &E,int now,int p){
		v[now] = init_value;
		for(int i=0;i<E[now].size();i++){
			int to = E[now][i];
			if(to==p)continue;
			dfs(E,to,now);
			v[now] = func0(v[now],v[to]);
		}
		v[now] = func1(v[now],now);
		visited[now]=true;
	}
	
	void redfs(vector<vector<int>> &E,int now,int p,T pv){
		vector<T> S(E[now].size(),init_value);
		if(S.size()>1){
			for(int i=S.size()-2;i>=0;i--){
				int to = E[now][i+1];
				T x = v[to];
				if(to==p)x = pv;
				S[i] = func0(x,S[i+1]);
			}
		}
		
		T temp = init_value;
		for(int i=0;i<E[now].size();i++){
			int to = E[now][i];
			if(to!=p){
				redfs(E,to,now,func1(func0(temp,S[i]),now));
				temp = func0(temp,v[to]);
			}
			else{
				temp = func0(temp,pv);
			}
		}
		ans[now] = func1(temp,now);
	}
	
};

int main(){
	
	cin>>N>>M;
	
	vector<vector<int>> E(N,vector<int>());
	
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	
	auto f0 = [](pair<int,int> a,pair<int,int> b){
		return make_pair(mod((a.first+a.second)*(b.first+b.second)),0);
	};
	
	auto f1 = [](pair<int,int> a,int ind){
		return make_pair(a.first,1);
	};
	
	rerooting<pair<int,int>,decltype(f0),decltype(f1)> rr(E,f0,f1,{1,0});
	
	for(int i=0;i<N;i++){
		cout<<rr.ans[i].first<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 15744
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())), reverse=True)

    res = 0
    que = deque([A[0]])
    for i in range(1, n):
        a = que.popleft()
        res += a
        que.append(A[i])
        que.append(A[i])
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 32484
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define D 365
#define INF 1001001001
typedef long long ll;
ll calcSat(int *tmpt, int s[][26], int *c) {
	int last[26] = {0};
	ll tmpSat = 0;
	for (int i = 0; i < D; i++) {
		tmpSat += s[i][tmpt[i] - 1];
		last[tmpt[i] - 1] = i + 1;
		for (int j = 0; j < 26; j++) {
			tmpSat -= (c[j] * (i + 1 - last[j]));
		}
		/**
		printf("%lld\n", tmpSat);
		/**/
	}
	return tmpSat;
}
int main() {
	clock_t start = clock(), now = clock();
	srand(628);
	scanf("%*d");
	int c[26], s[D][26];
	int t[D] = {0};
	ll bestSat = 0;
	for (int i = 0; i < 26; i++) {
		scanf("%d", &c[i]);
	}
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			scanf("%d", &s[i][j]);
		}
	}
	/**/
	int last[26] = {0};
	for (int i = 0; i < D; i++) {
		ll bestNowSat = -INF;
		int bestType = 0;
		for (int j = 0; j < 26; j++) {
			ll tmpSat = 0;
			tmpSat += s[i][j];
			for (int k = 0; k < 26; k++) {
				if (k != j) {
					tmpSat -= (c[k] * (i + 1 - last[k]));
				}
			}
			if (bestNowSat < tmpSat) {
				bestNowSat = tmpSat;
				bestType = j;
			}
		}
		bestSat += bestNowSat;
		t[i] = bestType + 1;
		last[bestType] = i + 1;
	}

	while ((double)(now - start) / CLOCKS_PER_SEC < 1.95) {
		int pos = rand() % D;
		int oldt = t[pos];
		t[pos] = rand() % 26 + 1;
		ll tmpSat = calcSat(t, s, c);
		if (tmpSat > bestSat) {
			bestSat = tmpSat;
		} else {
			t[pos] = oldt;
		}
		now = clock();
	}
	// printf("%lld\n", bestSat);

	for (int i = 0; i < D; i++) {
		printf("%d\n", t[i]);
	}
	return 0;
}


Measured memory_bytes: 1840
require "prime"

a, b = gets.split.map(&:to_i)
small, large = [a, b].sort

def gcd_of_two(a, b)
  small, large = [a, b].sort
  if small == 0
    return large
  else
    gcd_of_two(small, large % small)
  end
end
gcd = gcd_of_two(small, large)

def func2(num)
  # p_divisors = []
  count = 0
  1.step((num**(1/2.to_f)).floor) do |i|
    if num % i == 0
      # p_divisors << i if i == 1 || i.prime?
      count += 1 if i == 1 || i.prime?
      j = num/i
      # p_divisors << j if i != j && j.prime?
      count += 1 if i != j && j.prime?
    end
  end
  # p_divisors.count
  count
end
puts func2(gcd)


Measured memory_bytes: 2044
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in xrange(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            else:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        else:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,raw_input().strip().split())
ices = [int(raw_input().strip()) for _ in xrange(N)]

orderN(N,L,ices)

Measured memory_bytes: 12504
//Atcoder Begineer Contest050
//A - Addition and Subtraction Easy
//2018/06/25 18:50

#include<stdio.h>
#define INF 1000000000

int main(void){

  int A,B;
  int res;
  char op;

  scanf("%d %c %d",&A,&op,&B);

  if(op == '+'){
    res = A + B;
    printf("%d\n",res);
  }
  else{
    res = A - B;
    printf("%d\n",res);
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){                                                                     
  int s;                                                                        
  cin >> s;                                                                     
  int s1 = s/100;                                                               
  int s2 = (s%100)/10;                                                          
  int s3 = (s%100)%10;                                                          
  int sum = s1+s2+s3;                                                           
  switch(sum){                                                                  
  case 0 :                                                                      
    cout << "0" << endl;                                                        
    break;                                                                      
  case 1 :                                                                      
    cout << "1" << endl;                                                        
    break;                                                                      
  case 2 :                                                                      
    cout << "2" << endl;                                                        
    break;                                                                      
  case 3 :                                                                      
    cout << "3" << endl;                                                        
    break;                                                                      
  default :                                                                     
    break;                                                                      
  }                                                                             
}

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

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

vector<unsigned long long> make_divisors(const unsigned long long n) {
	vector<unsigned long long> ans;
	for (unsigned long long i = 1; i*i <= n; i++)
		if (n%i == 0)
			ans.emplace_back(i);
	vector<unsigned long long> latter;
	const auto rit_b = ans.crbegin();
	const bool is_square = (*rit_b * *rit_b == n);
	for (auto rit = rit_b + (is_square ? 1 : 0), rit_e = ans.crend(); rit != rit_e; rit++)
		latter.emplace_back(n / *rit);
	ans.insert(ans.end(), latter.begin(), latter.end());
	return ans;
}

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

	vector<unsigned long long> divisors = make_divisors(N);
	ll ans = 0;
	for (const auto &d : divisors) {
		const ll m = N / d - 1;
		if (m > 0 and d <= m - 1)
			ans+=m;
	}

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


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

using namespace std;

int main(){
    int a, b, res = 0;
    cin >> a >> b;
    if((a + b) == 15){
        cout << "+" << endl;
    }
    else if((a*b) == 15){
        cout << "*" <<endl;
    }
    else{
        cout << "x" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a;
    cin>>a;
    a^=1;
    cout<<a<<endl;

    return 0;
}


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

using namespace std;

int main() {
	// your code goes here
    char str[101];
    int hugs=0;
    int i;
    scanf("%s",str);
    
    for(i=0; i<strlen(str)/2;i++){
        if(str[i]!=str[strlen(str)-1-i])
            hugs++;
    }
    printf("%d\n",hugs);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
int main()
{
    int n;
    cin >> n;
    vector<pair<ll, ll>> p(n);
    rep(i, n)
    {
        cin >> p[i].first;
        p[i].second = i;
    }
    sort(ALL(p), greater<PII>());
    VVL dp(n + 1, VL(n + 1, -1));
    dp[0][0] = 0;
    //dp[0][1] = abs(n - p[0].second) * p[0].first;
    //dp[1][0] = abs(p[0].second) * p[0].first;
    rep(i, n)
    {

        dp[i + 1][0] = dp[i][0] + llabs(p[i].second - i) * p[i].first;
        dp[0][i + 1] = dp[0][i] + llabs(n - 1 - i - p[i].second) * p[i].first;
    }
    cerr << dp[n][0] << endl;
    //    cerr << dp[0][n] << endl;
    rep(i, 1, n)
    {
        rep(j, 1, n)
        {
            if (i + j > n)
            {
                continue;
            }
            //assert(dp[i][j] != -1);

            //dp[i + 1][j] = max(dp[i][j] + abs(p[i + j].second - i) * p[i + j].first, dp[i + 1][j - 1] + abs(n - j - p[i + j].second) * p[i + j].first);
            //dp[i][j + 1] = max(dp[i][j] + abs(p[i + j].second - j) * p[i + j].first, dp[i - 1][j + 1] + abs(n - i - p[i + j].second) * p[i + j].first);
            dp[i][j] = max(dp[i - 1][j] + llabs(p[i + j - 1].second - (i - 1)) * p[i + j - 1].first, dp[i][j - 1] + llabs(n - 1 - (j - 1) - p[i + j - 1].second) * p[i + j - 1].first);
        }
    }
    ll ans = 0;
    rep(i, n + 1)
    {
        chmax(ans, dp[i][n - i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34676
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void q1(){
	int a,b;
	cin>>a>>b;
	a-=2*b;
	if(a<0)
	a=0;
	cout<<a;
}
void q2(){
	int n;	cin>>n;
	int arr[n];	int s=0;
	for(int i=0;i<n;++i){
		cin>>arr[i];	s+=arr[i];
	}
	int ans=0;
	for(int i=0;i<n;++i)
		ans+=((s-arr[i])*arr[i]);
	cout<<ans/2;
}
void q3(){
	int n;	cin>>n;
	string s;	cin>>s;
	int a=0;
	for(int i=1;i<n;++i)
	if(s[i]==s[i-1])
	a++;
	cout<<n-a;
}
void q4(){
	int n;	cin>>n;
	int arr[n];
	for(int i=0;i<n;++i)
	cin>>arr[i];
	sort(arr,arr+n);
	int ans=0;
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<i;++j){
			int idx=j+1;
			while(idx<i && (arr[j]+arr[idx]<=arr[i]))
			idx++;
			ans+=(i-idx);
		}
	}
	cout<<ans;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t=1;
	while(t--)
	q4();
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
  int n; cin>>n;
  vector<int> v;
  int w[n];

  for(int i=0;i<n;i++){
    int a; cin>>a;
    v.push_back(a);
    w[i]=v[i];
  }
  sort(v.begin(),v.end());

  for(int i=0;i<n;i++){
    if(w[i]>=v[n/2] ) cout<<v[n/2-1]<<endl;
    else cout<<v[n/2]<<endl;
  }
}


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

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()

#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>

#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;

ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

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

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}

void solve()
{
	ll n,m;
	cin>>m>>n;

	ll arr[n];
	ll sum=0;
	For(i,0,n)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	//cout<<sum<<endl

	if(sum>m)
		cout<<-1<<endl;
	else
		cout<<m-sum<<endl;
}

signed main() 
{
    fast_cin();
    // #ifndef ONLINE_JUDGE
    // freopen("C:/IO/in.txt", "r", stdin);
    // freopen("C:/IO/out.txt", "w", stdout);
    // #endif
    
    int t=1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
    
    
    return 0;    
}

Measured memory_bytes: 3628
<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$seki = $s[0] * $s[1];

if (($seki % 2) != 0) {
    echo "Odd";
} else {
    echo "Even";
}


Measured memory_bytes: 16024
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

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

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

int main(){
  int n;cin >> n;
  int h[n];rep(i,n)cin >> h[i];
  int dp[n];
  dp[0] = 0;
  for(int i=1;i<n;++i){
    if(i>=2)dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),dp[i-2] + abs(h[i]-h[i-2]));
    else dp[i] = dp[i-1] + abs(h[i]-h[i-1]);
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
N = int(input())
S = input()
S1 = set([])
S2 = set([])
S3 = set([])
for i in S:
    for s3 in S2:
        S3.add(s3+i)
    for s2 in S1:
        S2.add(s2+i)
    S1.add(i)
print(len(S3))

Measured memory_bytes: 8964
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np

def main():
	n=int(input())
	A=list(map(int,input().split()))
	cnt=1
	
	for i in A:
		if i==cnt:
			cnt+=1
	cnt-=1
	
	ans=len(A)-cnt
	
	if cnt==0:
		ans=-1
	print(ans)
	
	




	
if __name__ == "__main__":
	main()


Measured memory_bytes: 71024
/*
   AtCoder Submission
*/

#include<bits/stdc++.h>

using namespace std;

/* typedefs */
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int x;
    cin >> x;

    int y = x;

    int sum = 0;

    while(x){
        sum += x % 10;
        x /= 10;       
    }

    if(y % sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;




    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <vector>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> W(N);
	for (int i = 0; i < N; i++)
	{
		cin >> W[i];
	}
	
	int answer = INT_MAX;
	for (int T = 1; T < N; T++)
	{
		int S1 = 0;
		int S2 = 0;
		
		for (int i = 0; i < N; i++)
		{
			if (T >= i + 1)
			{
				S1 += W[i];
			}
			else {
				S2 += W[i];
			}
		}
		
		answer = min(abs(S1 - S2), answer);
	}
	
	cout << answer << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
    int N,A,B;
    scanf("%d",&N);
    scanf("%d",&A);
    scanf("%d",&B);
    if((B-A-1)%2==0)
    {
        puts("Borys");
    }else{
        puts("Alice");
    }
    
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
vector<int> vi;
#define _for(i,j,N) for(int i = (j); i < (N);i++)
 
int main()
{
    vi.push_back(0);
    int N;
    scanf("%d",&N);
    _for(i,0,N){
        int a;scanf("%d",&a);
        vi.push_back(a);
    }
    vi.push_back(0);
    int sum = 0;
    _for(i,1,vi.size()){
        sum += abs(vi[i]-vi[i-1]);
    }
    _for(i,1,vi.size()-1){
        int bef = abs(vi[i]-vi[i-1]) + abs(vi[i+1] - vi[i]);
        int after = abs(vi[i+1] - vi[i-1]);
        printf("%d\n",sum-bef+after);
    }
 
    return 0;
}

Measured memory_bytes: 1784
unittest
{
	assert( [ "3", "011" ].solve == "2\n1\n1" );
	assert( [ "23", "00110111001011011001110" ].solve == "2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3" );
	
	assert( [ "3", "000" ].solve == "1\n1\n1" );		// 追加ケース
	assert( [ "3", "100" ].solve == "0\n1\n2" );		// 追加ケース
	assert( [ "3", "111" ].solve == "2\n2\n1" );		// 追加ケース
}



import core.bitop;
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;

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

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto x = input.front.to!( dchar[] );
	
	auto px = x.count( '1' );
	auto pm = px - 1;
	auto pp = px + 1;
	auto rm = 0L;
	auto rp = 0L;
	foreach( i, b; x )
	{
		if( b != '1' ) continue;
		if( 0 < pm ) rm = ( rm + remainder( 1, n - 1 - i, pm ) ) % pm;
		rp = ( rp + remainder( 1, n - 1 - i, pp ) ) % pp;
	}
	
	auto anss = new long[ n ];
	foreach( i, ref ans, b; lockstep( anss, x ) )
	{
		auto p = ( b == '1' ) ? pm : pp;
		if( p <= 0 ) continue;
		auto r = ( b == '1' ) ? rm : rp;
		if( b == '1' ) r = ( r - remainder( 1, n - 1 - i, p ) + p ) % p;
		else           r = ( r + remainder( 1, n - 1 - i, p ) ) % p;
		ans++;
		for( ; 0 < r; p = r._popcnt, r %= p )
		{
			ans++;
		}
	}
	return anss.to!( string[] ).join( "\n" );
}

// ( n << x ) % m を計算
auto remainder( long n, long x, long m )
{
	static long[][] memo;
	if( memo.length <= m ) memo.length = m + 1;
	if( memo[ m ].empty ) memo[ m ] = [ 1L ];
	if( memo[ m ].length <= x )
	{
		auto i = memo[ m ].length.signed;
		memo[ m ].length = x + 1;
		for( ; i <= x; i++ )
		{
			memo[ m ][ i ] = ( memo[ m ][ i - 1 ] << 1 ) % m;
		}
	}
	return ( memo[ m ][ x ] * n ) % m;
}


Measured memory_bytes: 17280
# # -*- coding: utf-8 -*-
K, N = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

diff = [A[i+1] - A[i] for i in range(N-1)]
diff.append(A[0] + K - A[-1])

diff.sort()
ans = K - diff[-1]
print(ans)




Measured memory_bytes: 86876
var x:array[0..100]of Qword;
    i,n:longint;
 begin
  x[0]:=2;
  x[1]:=1;
  readln(n);
  for i:=2 to n do 
   x[i]:=x[i-1]+x[i-2];
  writeln(x[n]);
 end.

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX_V 100000
using namespace std;
int m,w[100001];
vector<int> vv[100001];
unordered_set<int> st[100001];
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];
int C[100001],F[100001],U[100001],ans;
bool UU[100001];


void DFS(int p){
  for(int i=0;i<vv[p].size();i++){
    int mn=min(vv[p][i],p),mx=max(vv[p][i],p);
    if(st[mn].find(mx)==st[mn].end()){
      st[mn].insert(mx);
      G[p].push_back(vv[p][i]);
      rG[vv[p][i]].push_back(p);
      DFS(vv[p][i]);
    }
  }
}

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

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

int scc(){
  for(int v=0;v<V;v++)if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}

bool DFS1(int p){
  if(U[p])return 0;
  U[p]=1;
  bool f=F[cmp[p]]>=2;
  for(int i=0;i<G[p].size();i++)
    f|=DFS1(G[p][i]);
  ans+=w[p]*f;
  return UU[p]=f;
}
bool UUU[100001];
int DFS2(int p){
  if(UUU[p])return 0;
  UUU[p]=1;
  int res=0;
  
  for(int i=0;i<G[p].size();i++)
    res=max(res,DFS2(G[p][i]));  
  return res+(UU[p]?0:w[p]);
}

int main(){
  cin>>V>>m;
  for(int i=0;i<V;i++)cin>>w[i];
  for(int j=0,a,b;j<m;j++){
    cin>>a>>b;a--,b--;
    vv[a].push_back(b),vv[b].push_back(a);
  }
  DFS(0);
  int t=0;
  for(int i=0;i<V;i++)t+=w[i];
  scc();
  for(int i=0;i<V;i++)F[cmp[i]]++;
  DFS1(0);
  cout<<ans+DFS2(0)<<endl;
  return 0;
}

Measured memory_bytes: 42780
#include <iostream>

using namespace std;

int main()
{
    char a,b,c;
    cin >> a >> b >> c;
    if(a=='A'&&b=='A'&&c=='A')
        cout << "No" << endl;
    else if(a=='B'&&b=='B'&&c=='B')
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
int a,b;
do{
scanf("%d %d",&a,&b);
}while(a<-1000 || a>1000 || b<-1000 || b>1000);
if(a>b){printf("a > b\n");}
if(a<b){printf("a < b\n");}
if(a==b){printf("a == b\n");}
return 0;
}

Measured memory_bytes: 580
n,m=map(int,input().split())
ka= [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    ka[i].pop(0)
ans = ka[0]
for i in range(1,n):
    ans = set(ans) & set(ka[i])
print(len(ans))

Measured memory_bytes: 3060
N, M = map(int, input().split())
D = [[] for i in range(N)]
for i in range(M):
    a = [int(j) for j in input().split()]
    for v in a[1:]:
        D[v - 1].append(i)

P = [int(i) for i in input().split()]
ans = 0
for i in range(1 << N):
    S = [0] * M #各電球が何回スイッチ入ってるか
    for k in range(N):
        if ((i >> k) & 1) == 1:
            for d in D[k]:
                S[d] += 1

    if all([(s % 2) == p for  s,p in zip(S, P)]):
        ans += 1

print(ans)



Measured memory_bytes: 43612
import java.util.*

fun main(args : Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val edges = Array<MutableSet<Int>>(n) { mutableSetOf() }

    repeat(m) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt()-1 }
        edges[a].add(b)
        edges[b].add(a)
    }

    val bfs = ArrayDeque<Pair<Int, Int>>(n)
    bfs.addLast(Pair(0, 0))
    val seen = Array(n) {false}
    seen[0] = true

    while(bfs.isNotEmpty()) {
        val node = bfs.removeFirst()

        if (node.first == n-1) {
            println(if (node.second == 2) "POSSIBLE" else "IMPOSSIBLE")
            return
        }

        edges[node.first].forEach {
            if (!seen[it]) {
                seen[it] = true
                bfs.addLast(Pair(it, node.second+1))
            }
        }
    }

    println("IMPOSSIBLE")
}



Measured memory_bytes: 160092
import sys
input = sys.stdin.readline

n, k = map(int,input().split())
A = list(map(int,input().split()))
mod = 10**9 + 7

D = [[0] * (k+2) for i in range(n+1)]
D[0][k] = 1
for i in range(1, n+1):
    for j in range(k+1):
        D[i][max(0, j-A[i-1])] = (D[i][max(0, j-A[i-1])] + D[i-1][j]) % mod
        D[i][j+1] = (D[i][j+1] - D[i-1][j]) % mod
    for j in range(1, k+2):
        D[i][j] = (D[i][j] + D[i][j-1]) % mod
print(D[-1][0])

Measured memory_bytes: 152620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
int main() {
    int n, m;
    cin >> n;
    cin >> m;
    vector<int> x(m);
    for(int i = 0; i < m; i++) cin >> x[i];
    if (n >= m) cout << 0 << endl;
    else {
        sort(x.begin(), x.end());
        int dist = x[x.size() - 1] - x[0];
        int delta = 0;
        vector<int> line(m-1);
        for (int i = 0; i < line.size(); i++) {
            line[i] = x[i+1] - x[i];
        }

        sort(line.begin(), line.end());
        reverse(line.begin(), line.end());

        for(int i = 0; i < n - 1; i ++) {
            delta += line[i];
        }

        cout << dist - delta << endl;
    }
}

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

int main() {
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        if(A[i]%2==0){
            if(A[i]%6!=0&&A[i]%10!=0){
                cout<<"DENIED"<<endl;
                break;
            }
            else {
                
            }
        }
        if(i==N-1){
            cout<<"APPROVED"<<endl;
        }
    }
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    abc088c()
}

fun abc088c() {
    val cList = (1..3).map { readLine()!!.split(" ").map { it.toInt() } }

    // a1を0とする
    val b1 = cList[0][0]
    val b2 = cList[0][1]
    val b3 = cList[0][2]

    val a2 = cList[1][0] - b1
    val a3 = cList[2][0] - b1

    val answer =
        if (cList[1][1] == a2 + b2 && cList[1][2] == a2 + b3 && cList[2][1] == a3 + b2 && cList[2][2] == a3 + b3)
            "Yes" else "No"

    println(answer)
}


Measured memory_bytes: 36112
import java.util.Scanner;

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

		int n = sc.nextInt();
		double x[]=new double[n];
		double y[]=new double[n];

		for(int i=0;i<n;i++){
			x[i]=sc.nextDouble();
			y[i]=sc.nextDouble();
		}
		double ans=0;
for(int i=0;i<n-1;i++){
	for(int o=i+1;o<n;o++){
		ans+=dist(x[i],y[i],x[o],y[o])/n;

	}
}
System.out.println(2*ans);

	}

static public double dist(double a,double b,double c,double d){
double ans=(a-c)*(a-c)+(b-d)*(b-d);
ans=Math.sqrt(ans);
return ans;
}
}

Measured memory_bytes: 23124
/* ex4_2
    fmuacshai */

#include<stdio.h>
#include<math.h>
int main (void){
    //時針の長さをh_hand、分針の長さをm_hand、○時をhour、×分をminと定義する
    double h_hand,m_hand,hour,min;
    //時針と分針の角度をangle、求める長さの2乗をlenth2、求める長さをans
    double angle,ans,lenth2;
    //h_handを入力
    scanf("%lf",&h_hand);
    //m_handを入力
    scanf("%lf",&m_hand);
    //hourを入力
    scanf("%lf",&hour);
    //minを入力
    scanf("%lf",&min);
    //angleを計算（ラジアン）
    angle=fabs(30.0*hour-11.0*min/2)/180.0*M_PI;
    //lenth2を予言定理で求める
    lenth2=pow(h_hand,2.0)+pow(m_hand,2.0)-2.0*h_hand*m_hand*cos(angle);
    //ansを求める
    ans=sqrt(lenth2);
    //ansを出力
    printf("%.9f\n",ans);
    return 0;
}


Measured memory_bytes: 2484
(* O(1) *)
let solve a b = max a b * 2 - if a = b then 0 else 1

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [a; b] -> solve a b |> string_of_int |> print_endline
  | _ -> ()

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

int main() {
  char O[64], E[64];
  int i, osize, esize, ssize;
  
  scanf("%s %s", O, E);
  ssize = strlen(O) + strlen(E);
  for(i = 0; i < ssize; i++) {
    if(i%2 == 0) {
      printf("%c", O[i/2]);
    } else {
      printf("%c", E[i/2]);
    }
  }
  printf("\n");
  
  return 0;
}

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

int main()
{
   long long area;
   std::cin >> area;
   long long a = static_cast<long long>(std::sqrt(area));
   long long b, c, d;
   if (a * a == area) {
      b = 0;
      c = 0;
      d = a;
   } else {
      a++;
      d = a;
      b = a * d - area;
      c = 1;
   }
   std::cout << 0 << " " << 0 << " " << a << " " << b << " " << c << " " << d << std::endl;
   
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#define ll long long
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1.0),eps=1e-8;
const int maxn=1e5+10;
const ll mod=1e9+7;
int main()
{
    int n;
    ll d;
    scanf("%d%lld",&n,&d);
    ll a,b;
    d *= d;
    int x = 0;

    while (n --) {
        scanf("%lld%lld",&a,&b);
        if (a * a + b * b <= d) x ++;
    }
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 3824
N, M = map(int, input().split())
x_list = list(map(int, input().split()))

x_list = sorted(x_list, reverse = True)
diff_list = [0] * (M - 1)

ans = 0
if M > N:
    for i in range(M-1):
        diff_list[i] = x_list[i] - x_list[i+1]

    diff_list = sorted(diff_list, reverse = True)
    ans = sum(diff_list[N-1:])
print(ans)


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

#define int long long

#define pii pair<int, int>

#define x1 x1228
#define y1 y1228

#define left left228
#define right right228

#define pb push_back
#define eb emplace_back

#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   

#define matr vector<vector<int> > 

#define all(x) x.begin(), x.end()


using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;
const double eps = 1e-9;                                                                    
const ll inf = 1e18;
mt19937 rnd(time(0));
int n, a, b; 

void solve() {        
    cin >> n >> a >> b; 
    if ((b - a) % 2 == 0) {
        cout << (b - a) / 2; 
        return; 
    }
    int add = min(b - 1, n - a); 
    add = min(add, a + (b - a - 1) / 2);
    a = n - a + 1;  
    b = n - b + 1; 
    swap(a, b); 
    add = min(add, a + (b - a - 1) / 2);
    cout << add; 
}                                
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
}  

Measured memory_bytes: 256
X=10**6+1
E=[1 for i in range(X)]
E[0]=0
N=int(input())
A=list(map(int,input().split()))

import copy
B=copy.deepcopy(A)
B.sort()

D={}
for i in range(N):
    if A[i] not in D:
        D[A[i]]=1
    else:
        D[A[i]]=2
ANS=0
for i in range(N):
    if D[B[i]]==2 and E[B[i]]==1:
        for j in range(1,10**7):
            if B[i]*j>=len(E):
                break
            else:
                E[B[i]*j]=0
    elif D[B[i]]==2 and E[B[i]]==0:
        continue
    else:
        if E[B[i]]!=0:
            ANS+=1
            for j in range(1,10**7):
                if B[i]*j>=len(E):
                    break
                else:
                    E[B[i]*j]=0
print(ANS)
                

Measured memory_bytes: 142520
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;

int main() {
	// your code goes here
	char str1[200001];
	cin>>str1;
	
	int len = strlen(str1);
	
	int i,j=0, k=0;
	for(i=0;i<len;i++){
	    if(str1[i]=='A' || str1[i]=='a'){
	        break;
	    }j++;
	}
	for(i=len-1;i>=0;i--){
	    if(str1[i]=='Z' || str1[i]=='z'){
	        break;
	    }k++;
	}
	cout<<(len-j-k);
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
	int n, i;
	int r = 0;
	int b = 0;
	char s[100];
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (i = 0; i < n; i++) {
		if (s[i] == 'R') {
			r++;
		}
		else {
			b++;
		}
	}
	if (r > b){
		cout<<"Yes"<<endl;
	}
	else {
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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

int main(int argc, char **argv)
{
    int n, k;
    scanf("%d %d", &n, &k);
    if (n <= k) {
        printf("0\n");
        return EXIT_SUCCESS;
    }
    int h[n];
    for (int i = 0; i < n; i++) scanf("%d", h + i);
    qsort(h, n, sizeof(int), cmp);
    long sum = 0;
    for (int i = k; i < n; i++) sum += h[i];
    printf("%ld\n", sum);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 1788