akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
   long long int i,c=0;
    string a;
    cin>>a;
    for(i=0;i<a.size()-1;i++)
    {
        if(a[i]==a[i+1]&&a[i+1]=='1')
        {
            a[i+1]='0';
            c++;
        }
       if(a[i]==a[i+1]&&a[i+1]=='0')
        {
            a[i+1]='1';
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


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

const int NV = 305;
const int NE = 45000;

struct ISAP {
    int n, size;
    int head[NV];
    int dis[NV], gap[NV], pre[NV], cur[NV];
    int maxflow;

    struct Edge {
        int v, w, next;
        Edge () {}
        Edge (int V, int NEXT, int W = 0) : v(V), next(NEXT), w(W) { }
    }E[NE];

    void init(int x) {
        n = x, size = 0;
        for (int i = 0; i <= n; i++) {
            head[i] = -1;
        }
    }

    inline void insert(int u, int v, int w = 0) {
        E[size] = Edge(v, head[u], w);
        head[u] = size++;
        E[size] = Edge(u, head[v], w); //豬??蜿榊髄蟒コ霎ケ
        head[v] = size++;
    }

    int MaxFlow(int src, int des) {
        maxflow = 0;
        gap[0] = n;
        for (int i = 0; i <= n; i++) {
            dis[i] = gap[i] = 0;
        }
        for (int i = 0; i <= n; i++) {
            cur[i] = head[i];
        }
        int u = pre[src] = src;
        int aug = -1;
        while (dis[src] < n) {//扈捺據譚。莉カ1
loop:
            for (int &i = cur[u]; i != -1; i = E[i].next) {
                int v = E[i].v;
                if (E[i].w && dis[u] == dis[v] + 1) {
                    aug = min(aug, E[i].w);
                    pre[v] = u;
                    u = v;
                    if (v == des) {//謇セ蛻ー荳?擅蠅槫ケソ霍ッ?梧峩譁ー
                        maxflow += aug;
                        // //菫ョ謾ケ谿倶ス咏ス醍サ?
                        for (u = pre[u]; v != src; v = u, u = pre[u]) {
                            E[cur[u]].w -= aug;//豁」蜷題セケ
                            E[cur[u]^1].w += aug;//蜿榊髄霎ケ
                        }
                        aug = INT_MAX;
                    }//if
                    goto loop;
                }//for
            }//for
            //蟇サ謇セ譛?ー冗噪霍晉ヲサ譬?捷?悟ケカ菫ョ謾ケ蠖灘燕轤ケ    荳コ譛?ー冗噪譬?捷+1
            int mdis = n;
            for (int i = head[u]; i != -1; i = E[i].next) {
                int v = E[i].v;
                if (E[i].w && mdis > dis[v]) {
                    cur[u] = i;
                    mdis = dis[v];
                }
            }//for

            //GAP 莨伜喧 譁ュ螻ょ?霍ウ蜃コ 扈捺據譚。莉カ2
            if ((--gap[dis[u]]) == 0) {
                break;
            }
            gap[dis[u] = mdis + 1]++;//蟆?凶譛芽ッ・譬?捷逧?焚驥丞刈1
            u = pre[u];//蠖灘燕闃らせ 霑∫ァサ荳?クェ
        }//while
        return maxflow;
    }//ISAP
}G;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
	G.init(n);
	while (m--) {
		int u, v;
		scanf("%d%d", &u, &v);
		if (u == v) {
			continue;
		}
		G.insert(u, v, 1);
	}
	int s, t;
	scanf("%d%d", &s, &t);
	printf("%d\n", G.MaxFlow(s, t));
	
	int total = 0, ans[10005];

	for (int i = 0; i < G.size; i++) {
		if (G.E[i].w > 1) //螯よ棡闃らせ霑俶怏谿倶ス呻シ域イ。豬∬ソ?シ?
			if (i % 2 == 0)
				ans[total++] = i/2+1; //螳樣刔霎ケ莉?蠑?ァ区?隶ー
	}

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

	return 0;
}

Measured memory_bytes: 0
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    

    ll t;
    cin >> t;
    t = t%10;
    if(t==2 || t==4 | t==5 || t==7 || t==9) {
        cout << "hon\n";
    }
    else if(t==0 || t==1||t==6||t==8) {
        cout << "pon";
    }
    else {
        cout << "bon";
    }
    //cout << t << endl;
    
    return 0;
}

Measured memory_bytes: 3600
import sys
sys.setrecursionlimit(1000000)
 
def dfs(l,d,k):
  for i in l[k]:
    if d[i[0]]==-1:
      d[i[0]]=d[k]+i[1]
      dfs(l,d,i[0])

n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]
connection=[[] for i in range(n)]
for i in range(n-1):
  connection[l[i][0]-1].append([l[i][1]-1,l[i][2]])
  connection[l[i][1]-1].append([l[i][0]-1,l[i][2]])
distance=[-1 for i in range(n)]
x=-1
for i in range(n-1):
  if len(connection[i])==1:
    x=i
    break
distance[x]=0
dfs(connection,distance,x)
for i in range(n):
  print(distance[i]%2)

Measured memory_bytes: 159832
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

long P = 10^^9+7;
long[10^^5+50] F, RF;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

long inv(long x)
{
    return pow(x, P-2);
}

void init()
{
    F[0] = F[1] = 1;
    foreach (i, ref x; F[2..$]) x = (F[i+1] * (i+2)) % P;

    {
        RF[$-1] = 1;
        auto x = F[$-1];
        auto k = P-2;
        while (k) {
            if (k%2 == 1) RF[$-1] = (RF[$-1] * x) % P;
            x = x^^2 % P;
            k /= 2;
        }
    }
    foreach_reverse(i, ref x; RF[0..$-1]) x = (RF[i+1] * (i+1)) % P;
}

void main()
{
    init();
    auto N = readln.chomp.to!long;
    auto xs = readln.split.to!(long[]);

    long r, x = 1;
    foreach (i; 0..N-1) {
        r = ((((xs[i+1] - xs[i]) * x) % P * F[N-1]) % P + r) % P;
        x = (x + inv(i+2)) % P;
    }
    writeln(r);
}

Measured memory_bytes: 5512
#include<iostream>
#include<string>
#include<cmath>
#include <algorithm>
#include <stdio.h>



using namespace std;

long long N,W,K,v[300],w[300];
long long dp[1000][10100];

int main()
{

  cin>>N>>W;


  for(int i=1;i<=N;i++){
    cin>>v[i]>>w[i];
  }

  for(int i=1;i<=W;i++)dp[N+1][i]=0;

  for(int i=N;i>=1;i--){
    for(int j=0;j<=W;j++){
      if(j<w[i])
	dp[i][j]=dp[i+1][j];
      else 
	dp[i][j]=max(dp[i+1][j],dp[i+1][j-w[i]]+v[i]);
    }
  }

  /*
  for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
      printf("%4d",dp[i][j]);
    }
    cout<<endl;
  }
*/


  cout<<dp[1][W]<<endl;

  }
  



Measured memory_bytes: 11048
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define REPS(i,n) for(int i=1;i<=(n);i++)
#define RREPS(i,n) for(int i=(n);i>0;i--)
#define mp make_pair
#define pb(a) push_back(a)
#define VSORT(v) sort(v.begin(), v.end());
typedef long long ll;
int main(){
    int N,D,X;
    int A;
    cin >> N >> D >> X;
    int ans = 0;
    REP(i,N){
        cin >> A;
        ans += (D-1)/A + 1;
    }
    cout << ans + X << endl;
    return 0;
}


Measured memory_bytes: 256
n, q = map(int, input().split())

ct = [0] * (n + 1)
e = [[] for _ in range(n + 1)]

for _ in range(n - 1):
    a, b = map(int, input().split())
    e[a].append(b)

qs = [0] * (n + 1)
for _ in range(q):
    p, q = map(int, input().split())
    qs[p] += q

target = [1]
while len(target):
    t = target.pop()
    ct[t] += qs[t]
    for nt in e[t]:
        target.append(nt)
        ct[nt] += ct[t]

print(*ct[1:])

Measured memory_bytes: 91520
import sys

while True:
	n, x = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 == n and 0 == x:
		break
		
	cnt = 0
	for i in range( 1, n-1 ):
		if  x < 3*(i+1):
			break
		for j in range( i+1, n ):
			if  x <= ( i+j ):
				break
			for k in range( j+1, n+1 ):
				s = ( i + j + k )
				if x == s:
					cnt += 1
					break
				elif   x < s:
					break
	
	print( cnt )

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

int main() {
  int N;
  cin >> N;
  vector<bool> a(1000000000, false);
  ll ina=0;
  for (int i=0; i<N; i++) {
    cin >> ina;
    a.at(ina-1) = !a.at(ina-1);
  }
  ll total=0;
  for (int i=0; i<a.size(); i++) {
    if (a.at(i)) total++;
  }
  cout << total << endl;
}

Measured memory_bytes: 122368
import java.util.Scanner;
class Main 
{
  public static void main(String[] args) 
  {
    Scanner input=new Scanner(System.in);
    int a=input.nextInt();
    int b=input.nextInt();
    if(a>=1 && b>=1 && a<=10000 && b<=10000)
    {
      a=a*b;
      if(a%2==0)
      {
        System.out.println("Even");
      }else
      System.out.println("Odd");
    }
  }
}

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

using namespace std;

mt19937 rng(time(NULL));

int D;
int c[27];
int s[410][27];
const int MAX = 26;

int ans[410];

int last[27];
long long dc = 0, score = 0, sum = 0;

vector<int> candidate;

set<int> position[27];

double prob = 0;

long long f(long long x){
	if(x < 0) return 0;
	return x * (x + 1) / 2;
}

const int PMAX = 1000000000;

double dice(){
	return (double) (rng() % PMAX) / (PMAX - 1);
}

long long calc(vector<int> &a){
	long long score = 0;

	memset(last, 0, sizeof(last));
	for(int i = 1; i < (int) a.size(); i++){
		score += s[i][a[i]];

		last[a[i]] = i;
		for(int j = 1; j <= MAX; j++){
			score -= 1LL * c[j] * (i - last[j]);
		}
	}

	return score;
}

void Randomize(){
	for(int i = 1; i <= MAX; i++) position[i].insert(-1);
	for(int i = 1; i <= MAX; i++) position[i].insert(D + 1);

	int id = 1;
	for(auto &k : candidate) position[k].insert(id++);

	// for(int i = 1; i <= MAX; i++){
	// 	int pre = -1;
	// 	for(auto &k : position[i]){
	// 		score -= 1LL * f(k - pre - 1) * c[i];
	// 		pre = k;
	// 	}
	// }

	for(int asd = 0; asd <= 1000; asd++){
		int pos, contestNxt;
		pos = rng() % D + 1; contestNxt = rng() % 26 + 1;
		
		// int contestNow = candidate[pos];

		// int lfNow = *position[contestNow].lower_bound(pos - 1);
		// int rgNow = *position[contestNow].upper_bound(pos);

		// int rgNxt = *position[contestNxt].lower_bound(pos);
		// int lfNxt = *prev(position[contestNxt].lower_bound(pos));

		// long long paramNow = s[pos][contestNow] - f(rgNxt - lfNxt - 1) * c[contestNxt] - f(rgNow - pos - 1) * c[contestNow] - f(pos - lfNow - 1) * c[contestNow];
		// long long paramNxt = s[pos][contestNxt] - f(rgNxt - pos - 1) * c[contestNxt] - f(pos - lfNxt - 1) * c[contestNxt] - f(rgNow - lfNow - 1) * c[contestNow];

		vector<int> nxt = candidate;

		nxt[pos] = contestNxt;

		long long paramNow = calc(candidate);
		long long paramNxt = calc(nxt);

		if(paramNow < paramNxt){
			//Change

			swap(candidate, nxt);
			// position[contestNow].erase(pos);
			// position[contestNxt].insert(pos);
		}
	}
}

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

	for(int i = 1; i <= MAX; i++) cin >> c[i], sum += c[i];

	for(int i = 1; i <= D; i++){
		for(int j = 1; j <= MAX; j++){
			cin >> s[i][j];
		}
	}

	candidate.emplace_back(0);

	for(int i = 1; i <= D; i++){
		int opt = -1; long long inc = -1e18;

		for(int j = 1; j <= MAX; j++){
			if(inc < s[i][j] - (dc + sum) + c[j] * (i - last[j])){
				opt = j;
				inc = s[i][j] - (dc + sum) + c[j] * (i - last[j]);
			}
		}

		candidate.emplace_back(opt);
		// cout << opt << "\n";

		dc += sum;
		dc -= c[opt] * (i - last[opt]);
		last[opt] = i;

		// score += inc;
		score += s[i][opt];
		// cout << (i % MAX) + 1 << "\n";
	}

	Randomize();

	for(int i = 1; i < (int) candidate.size(); i++){
		cout << candidate[i] << "\n";
	}

	// cerr << score << "\n";

	return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int mx=1e5+123;
#define mem(a,b) memset(a,b,sizeof(a));


int a[mx]; int dp[mx];

int solve(int i,int n){

    if(i==n) return 0;

    if(dp[i]!=-1)
         return dp[i];
     int left=0,right=mx;
        left=abs(a[i+1]-a[i])+solve(i+1,n);

        if(i+2<=n)
         right=abs(a[i+2]-a[i])+solve(i+2,n);

    return dp[i] = min(left, right);

}

int main() {

    int n; cin>>n;

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

     mem(dp,-1);
       cout<<solve(1,n)<<endl;

    return 0;
}


Measured memory_bytes: 10528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int n;ll a[N],b[N],c[N],d[N],ans;
int cal(ll L,ll R){
	int i,l,r,res=0;
	for(i=l=1,r=0;i<=n;++i){
		for(;r<n&&c[i]+d[r+1]>=L;++r);
		for(;l<=n&&c[i]+d[l]>R;++l);
		res^=(max(r-l+1,0)&1);
	}
	return res;
}
int main(){	
	//freopen("aa.in","r",stdin);
	int i,j,k;
	scanf("%d",&n);
	for(i=1;i<=n;++i)cin>>a[i];
	for(i=1;i<=n;++i)cin>>b[i];
	for(k=0;k<=28;++k){
		ll t=1LL<<k;
		for(i=1;i<=n;++i)c[i]=a[i]%(t*2),d[i]=b[i]%(t*2);
		sort(c+1,c+1+n);
		sort(d+1,d+1+n);
		reverse(d+1,d+1+n);
		int x=cal(t,t*2-1);
		x^=cal(t*3,t*4-1);
		if(x)ans|=t;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6528
#include <cstdio>

int n,m;
int mass[1000];
int dise[1000];

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

  if(n==0 && m==0) return 0;

  for(int i=0;i<n;i++){
    scanf("%d", mass+i);
  }

  for(int i=0;i<m;i++){
    scanf("%d", dise+i);
  }

  int p = 0;
  for(int i=0;i<m;i++){
    p+=dise[i];

    if(p >= n-1) {
      printf("%d\n", i+1);
      break;
    }

    p+=mass[p];

    if(p >= n-1){
      printf("%d\n", i+1);
      break;
    }
  }

  main();
}
    

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<ll, ll>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  string s, t;
  cin >> s >> t;
  sort(ALL(s));
  sort(rALL(t));
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n;
	cin>>n;
	int ans = 0;
	for(int i=1;i<=n;i++){
		if(i%3!=0 and i%5!=0) ans+=i;
	}
	cout<<ans;
}

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

int main(){
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    --k;
    cout << a[k] << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long 
signed main(){
    int n,t;
    cin >> n >> t;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
    cin >> a[i];
    int sum = 0;
    for(int i = 1; i < n; i++){
       if(a[i] - a[i - 1] <= t) 
       sum += (a[i] - a[i - 1]);
       else 
       sum += t;
    }
    sum += t;
    cout << sum << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>

#define N 100

void MatrixCnainOrder(int P[]);

int n;

int main(){
	int A[N][2];
	int P[N];
	int i;

	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&A[i][0],&A[i][1]);
		P[i-1]=A[i][0];
		if(i==n)P[i]=A[i][1];
	}

	MatrixCnainOrder(P);



	return 0;
}

void MatrixCnainOrder(int P[]){
	int m[N][N];
	int i,j,k,l,q;

	for(i=1;i<=n;i++){
		m[i][i]=0;
	}

	for(l=2;l<=n;l++){
		for(i=1;i<=n-l+1;i++){
			j=i+l-1;
			m[i][j]=999999;
			for(k=i;k<=j-1;k++){
				q=m[i][k]+m[k+1][j]+P[i-1]*P[k]*P[j];
				if(m[i][j]>q)m[i][j]=q;
			}
		}
	}
printf("%d\n",m[1][n]);
}

Measured memory_bytes: 632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		string[] args = Console.ReadLine().Split(' ');
		int aMin = Int32.MaxValue;
		int aMax = 0;
		for(int i = 0; i < N; i++)
		{
			int a = Int32.Parse(args[i]);
			aMin = Math.Min(aMin, a);
			aMax = Math.Max(aMax, a);
		}

		Console.WriteLine(aMax - aMin);
	}	
}





Measured memory_bytes: 11092
//B I S M I L L A H I R  R A H M A N I R  R A H I M
#include<bits/stdc++.h>
using namespace std;
typedef double dd;
typedef unsigned long long int ull ;
typedef long long int ll ;
typedef unsigned long ul ;
typedef long il ;
typedef int li ;
typedef bool bl;
#define wt ll t; cin>>t; while(t--)
#define lp(i, a, b) for(ll i=a; i<b; i++)
#define rlp(i, a, b) for(ll i=a; i>=b; i--)
#define nl cout<<endl;
#define sp cout<<" ";
#define qe ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
li n,c=0;
int main()
{
    //file();
    qe;
    cin>>n;
    map<long long,li>m;
    lp(i,0,n)
    {
        long long  x; cin>>x;
        m[x]++;
    }
    for(auto u:m)
    {
        if(u.first>u.second)
            c=u.second+c;
        else if(u.first==u.second)
            c=c+0;
        else
            c=c+u.second-u.first;
    }
    cout<<c;
}
// R A S H E D //

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double eps = 1e-15;

    long double a,b,c;
    cin >> a>>b>>c;

    if(sqrtl(a)+sqrtl(b)+eps<sqrtl(c))cout << "Yes";
    else cout << "No";
    }


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
struct str {
	int a, b, cost;
	bool operator < (const str&A)const {
		return cost < A.cost;
	}
};
int X[4] = { 0,0,1,-1 };
int Y[4] = { 1,-1,0,0 };
int n, m, k, a[30010],b[30100];
priority_queue<str> que;
int main() {
	int c,ans = 0;
	scanf("%d %d %d", &n, &m,&c);
	for (int i = 0; i < m; i++)scanf("%d", &b[i]);
	for (int i = 0; i < n; i++) {
		ll temp = 0;
		for (int j = 0; j < m; j++) {
			scanf("%d", &a[j]);
			temp += (a[j] * b[j]);
		}
		if (temp + c > 0)ans++;

	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, t = 0;
    cin >> n;
    vector<pair<ll, ll>> sch(n);
    rep(i, n) cin >> sch[i].second >> sch[i].first;
    sort(all(sch));
    bool ans = true;
    rep(i, n){
        t += sch[i].second;
        if(t > sch[i].first) ans = false;
    }
    (ans) ? Yes() : No();
}

Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
	"sort"
)

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	k := sc.NextInt()

	arr := make([]int, n)

	for i := 0; i < n; i++ {
		arr[i] = sc.NextInt()
	}
	sort.Ints(arr)

	min := 1000000000
	for i := k - 1; i < n; i++ {
		tmp := arr[i] - arr[i-k+1]
		if tmp < min {
			min = tmp
		}
	}
	fmt.Printf("%v\n", min)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 4608
#include <stdio.h>
#define DIV 1000000007

int main(){
  int N,M;
  int a;
  int now=0;
  int here=1, before=0;

  scanf("%d %d",&N,&M);

  for(int i=0;i<M;i++){
    scanf("%d",&a);
    while(now<a){
      int tmp = (here+before)%DIV;
      now += 1;
      before = here;
      here = tmp;
    }
    here = 0;
  }

  while(now<N){
    int tmp = (here+before)%DIV;
    now += 1;
    before = here;
    here = tmp;
  }
    
  printf("%d\n",here);
  
  
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        Integer n = Integer.parseInt(sc.next());
        Integer k = Integer.parseInt(sc.next());
        
        String num = Integer.toString(n, k);
        int result = num.length();
        
        System.out.println(result);
    }
}


Measured memory_bytes: 21972
import java.util.*;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
 
        int n = stdIn.nextInt();
        int m = stdIn.nextInt();
        
        int sum1 = 0;
        int sum2 = 0;
        
        if(n > 1){
            for(int i = n - 1; i > 0; i--){
                sum1 += i;
            }
        }
        
        if(m > 1){
            for(int i = m - 1; i > 0; i--){
                sum2 += i;
            }
        }
        

        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        
        int sum = sum1 + sum2;
        
        
        // for(int i = 0; i < s.length(); i++){
        //     a[i] = c[i] - 48;
        //     System.out.println(a[i]);
        // }
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
 
        System.out.println(sum);
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 23124
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt(), h = sc.nextInt();
        String c = sc.next();

        System.out.print("+");
        for(int i = 1; i < w - 1; i++) {
            System.out.print("-");
        }
        System.out.println("+");

        for(int i = 0; i < h - 2; i++) {
            System.out.print("|");
            for(int j = 0; j < w - 2; j++) {
                System.out.print((i == h / 2 - 1 && j == w / 2 - 1) ? c : ".");
            }
            System.out.println("|");
        }

        System.out.print("+");
        for(int i = 1; i < w - 1; i++) {
            System.out.print("-");
        }
        System.out.println("+");
    }
}

Measured memory_bytes: 26252
import sys

H, W = (raw_input()).split()
H = int(H)
W = int(W)

grid = []
for i in range(H):
    grid.append(raw_input())

new_grid = []
for i in range(H):
    if ('.'*W) != grid[i]:
        new_grid.append(grid[i])

for j in range(W):
    all_blanks = True
    for i in range(len(new_grid)):
        if new_grid[i][j] != '.':
            all_blanks = False
            break

    if all_blanks:
        for i in range(len(new_grid)):
            new_grid[i] = new_grid[i][:j] + 'b' + new_grid[i][j+1:]


for i in range(len(new_grid)):
    for j in range(W):
        if new_grid[i][j] != 'b':
            sys.stdout.write(new_grid[i][j])
    print


Measured memory_bytes: 2696
#include <iostream>
#include <vector>

using namespace std;

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

    int n, min;
    string s;
    cin >> n;
    vector<int> csum(n + 10);
    cin >> s;

    csum[0] = 0;
    for (int i = 0; i < n; i++)
        csum[i + 1] = csum[i] + (s[i] == 'E');

    for (int i = 0; i < n; i++)
    {
        const int num[] = {n - i - 1, i};
        const int num_east[] = {csum[n] - csum[i + 1], csum[i] - csum[0]};
        const int num_west[] = {num[0] - num_east[0], num[1] - num_east[1]};
        const int n_change = num_east[0] + num_west[1];
        if (n_change < min || i <= 0)
            min = n_change;
    }

    cout << min << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<set<int>> is(26);
    for (int i=0; i<n; i++) is[s[i]-'a'].insert(i);
    for (int qi=0; qi<q; qi++) {
        int ty;
        cin >> ty;
        if (ty == 1) {
            int i;
            char c;
            cin >> i >> c;
            --i;
            is[s[i]-'a'].erase(i);
            s[i] = c;
            is[s[i]-'a'].insert(i);
        }
        else {
            int l, r;
            cin >> l >> r;
            --l;
            int ans = 0;
            for (int i=0; i<26; i++) {
                auto it = is[i].lower_bound(l);
                if (it != is[i].end() && *it < r) ++ans;
            }
            
            cout << ans << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 26244
def main():
    k = int(input())
    a = 7
    c = 1
    b = 7
    if k == 2 or k == 5:
        print(-1)
        exit()
    while True:
        if a%k== 0:
            print(c)
            break
        else:
            b = (b*10)%k
            a = b+a
            a = a %k
            c += 1
            if c > k:
                print(-1)
                exit()

main()

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define mod 1000000007
#define PI 3.1415926535
using namespace std;
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
ll modExpo(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return modExpo((x*x)%mod,n/2);
    else                            
        return (x*modExpo((x*x)%mod,(n-1)/2))%mod;
 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    auto start_time = clock();
    cerr << setprecision(3) << fixed;
#endif
    string s,t;
    cin>>s>>t;
    ll l1=s.length(),l2=t.length();
    ll dp[l1+1][l2+1];
    for(ll i=0;i<=l1;i++)
    {
        for(ll j=0;j<=l2;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    ll ind=dp[l1][l2];
    string ans="";
    ll i=l1,j=l2;
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans=s[i-1]+ans;
            i--;
            j--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;
    }
    cout<<ans;
#ifdef LOCAL
    auto end_time = clock();
    cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
}

Measured memory_bytes: 73980
// https://atcoder.jp/contests/arc067/tasks/arc067_b
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define int int64_t
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    int sum = 0;
    REP(i, n - 1) sum += min((v[i + 1] - v[i]) * a, b);
    cout << sum << endl;

    return 0;
}


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

#define ll long long int
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define nl '\n'
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define all(a) a.begin(),a.end()
#define F first
#define S second
const ll N=3e3+9;
const ll mod=1e9+7;

double dp[N][N] , p[N];

void solve()
{
	ll n,m;
	cin>>n;
	rep(i,1,n)
	cin>>p[i];
	cout<<fixed<<setprecision(10);

	dp[0][0]=1.00;
	rep(i,1,n)
	{
		dp[i][0]= dp[i-1][0]*(1-p[i]); 
	//	cout<<dp[i][0]<<" ";
		rep(j,1,n)
		{
			dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
	//		cout<<dp[i][j]<<" ";
		}
	//	cout<<nl;
	}
	double sum=0;
	rep(i,(n+1)/2,n)
	sum+=dp[n][i];

	cout<<sum;

}



int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t=1;
    //pre();
    //cin>>t;
    //if(t^1)exit(0);
    while(t--)
       solve();
}

Measured memory_bytes: 70784
def dijkstra():
    d[0] = 0
    color[0] = GRAY

    while True:
        minv = INF
        u = -1
        for i in range(N):
            if minv > d[i] and color[i] != BLACK:
                u = i
                minv = d[i]
        if u == -1:
            break
        color[u] = BLACK
        for i in range(N):
            if color[i] != BLACK and M[u][i] != INF:
                if d[i] > d[u] + M[u][i]:
                    d[i] = d[u] + M[u][i]
                    color[i] = GRAY

INF = 10 ** 18
WHITH = 0
GRAY = 1
BLACK = 2
N = int(input())
M = [[INF for _ in range(N)] for _ in range(N)]
d = [INF] * N
color = [WHITH] * N

for i in range(N):
    lst = list(map(int, input().split()))
    for j in range(lst[1]):
        M[lst[0]][lst[2 + (j * 2)]] = lst[3 + (j * 2)]

dijkstra()
for i in range(N):
    v = d[i]
    if v == INF:
        v = -1
    print(i, v)


Measured memory_bytes: 5724
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

a,b,c = LI()
if len(set([a,b,c]))==2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 5688
s = str(input())
k = int(input())

t = 0
  
for i in range(len(s)):
  temp = s[i]
  if temp == '1':
    t += 1
  else:
    break

if t == 0:
  print(s[0])
else:
  if k <= t:
    print('1')
  else:
    print(temp)
    
 

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define FI first
#define SE second
using namespace std;

long long a,b;
int n,m;
pair<long long,long long> arr[100005];
long long ans;

int main(){
	scanf("%d%d",&n,&m);
	for(int i =0;i<n;i++){
		scanf("%d%d",&a,&b);
		arr[i] = {a,b};
	}
	sort(arr,arr+n);
	for(int i = 0;i<n;i++){
		ans += arr[i].FI*(min((long long)m,arr[i].SE));
		m -= min((long long)m,arr[i].SE);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(void){
  int a=0;
  scanf("%d",&a);
  char s[999]="";
  scanf("%s",s);
  int y = strlen(s);
  //printf("a is %d\n",a);
  //printf("len is %d\n",y);
  if (y<=a){
    printf("%s",s);
  }else{
    char t[999]=" ";
    strncpy(t,s,a);
    printf("%s",t);
    printf("...");
  }
  return 0;
}


Measured memory_bytes: 1692
object Main extends App {
  val target = io.StdIn.readLine()
  
  val (former, latter) = if (target.length % 2 == 0)
  	target.splitAt(target.length / 2)
  else
  	(target.substring(0, target.length / 2), target.substring(target.length / 2 + 1))
  
  val answer = former.zip(latter.reverse).count(pair => pair._1 != pair._2)
  
  println(answer)
}

Measured memory_bytes: 27076
#include<bits/stdc++.h>
using namespace std;
int n,i,j,a,b,c,k;
string s;
int main()
{
  cin>>a>>b>>k;if(a>b)swap(a,b);
  for(i=a;i>0&&c<k;i--)if(a%i==0&&b%i==0)c++;
  cout<<i+1;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1; 
    for(int T = 0; T < t ; T++){
        ll n, ans = 0;
        cin >> n;
        ll a[n];
        for(int i = 0 ; i < n ; i++){
            cin >> a[i];
        }
        ll cost[n + 1];
        cost[0] = 0;
        cost[1] = 0;
        cost[2] = abs(a[0] - a[1]);
        for(int i = 3; i <= n; i++){
            cost[i] = min(cost[i - 1] + abs(a[i - 2] - a[i -1]),cost[i -2] + abs(a[i - 3] - a[i - 1]));
           // cout << cost[i] << endl;
        }
        cout << cost[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 5144
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string left="qwertasdfgzxcvb";
	string in;
	while(cin>>in,in!="#") 
	{
		int ans=0;
		int pos=0;
		for(int i = 0; i < left.size(); ++i)
		{
			if(in[0]==left[i]) pos=1;
		}
		if(pos==0) pos=2;

		for(int i = 1; i < in.size(); ++i)
		{
			bool up=false;
			for(int j = 0; j < left.size(); ++j)
			{
				if(in[i]==left[j])
				{
					if(pos==2) ans++;
					pos=1;
					up=true;
					break;
				}
			}	
			if(!up)
			{
				if(pos==1) ans++;
				pos=2;
			}
		}
		cout<<ans<<endl;
	}

  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename Iter, typename T> int gt(Iter L, Iter R, T v) { return upper_bound(L, R, v) - L; }
template <typename Iter, typename T> int ge(Iter L, Iter R, T v) { return lower_bound(L, R, v) - L; }
template <typename Iter, typename T> int lt(Iter L, Iter R, T v) { return lower_bound(L, R, v) - L - 1; }
template <typename Iter, typename T> int le(Iter L, Iter R, T v) { return upper_bound(L, R, v) - L - 1; }
template <typename Bst, typename T> typename Bst::iterator gt(const Bst& bst, T v) { return bst.upper_bound(v); }
template <typename Bst, typename T> typename Bst::iterator ge(const Bst& bst, T v) { return bst.lower_bound(v); }
template <typename Bst, typename T> typename Bst::iterator lt(const Bst& bst, T v) { return bst.lower_bound(v) == bst.begin() ? bst.end() : --bst.lower_bound(v); }
template <typename Bst, typename T> typename Bst::iterator le(const Bst& bst, T v) { return bst.upper_bound(v) == bst.begin() ? bst.end() : --bst.upper_bound(v); }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> close(n + 1);
    for(int i = 0; i < m; i++) {
        int L, R;
        cin >> L >> R;
        close[L].push_back(R);
    }
    for(auto& v : close) {
        sort(v.begin(), v.end());
    }
    for(int i = 0; i < q; i++) {
        int p, q;
        cin >> p >> q;
        int ans = 0;
        for(int j = p; j <= q; j++) {
            ans += le(close[j].begin(), close[j].end(), q) + 1;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2176
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/), cid = 0;
function next(a) { return a ? cin[cid++] : +cin[cid++]; }
function nexts(n, a) { return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a); }
function nextm(h, w, a) { var r = [], i = 0; if (a) for (; i < h; i++)r.push(cin.slice(cid, cid += w)); else for (; i < h; i++)r.push(cin.slice(cid, cid += w).map(a => +a)); return r; }
function xArray(v) { var a = arguments, l = a.length, r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})"; while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")"; return eval(r); }

var myOut = main();
if (myOut !== undefined) console.log(myOut);

function main() {
    //console.log(cin);
    cin = cin.map(i => +i);
    let n = cin.shift();
    let m = cin.shift();
    let h = cin.slice(0, n); cin = cin.slice(n);
    h.unshift(0);
    let a;
    let b;
    let good = Array(n + 1).fill(1);
    good[0] = 0;
    for (let i = 0; i < m; i++) {
        // A.push(cin[2 * i]);
        // B.push(cin[2 * i + 1]);
        a = cin[2 * i];
        b = cin[2 * i + 1];
        if (h[a] >= h[b]) {
            good[b] = 0;
        }
        if (h[b] >= h[a]) {
            good[a] = 0;
        }
    }
    // console.log("n", n);
    // console.log("m", m);
    // console.log("h", h);
    // console.log("A", A);
    // console.log("B", B);
    let ans = 0;
    good.forEach(i => { ans += i; });

    return ans;
}

Measured memory_bytes: 60656
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	string s; cin>>s;
	(s[2]==s[3] && s[4]==s[5])?cout<<"Yes\n":cout<<"No\n";
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.1415926535
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

double solve(vector<pair<double,double>> v)
{
	int n=sz(v);
	double ans=0;
	ffor(i,1,n)
	{
		ans += sqrt((v[i].ff-v[i-1].ff)*(v[i].ff-v[i-1].ff) + (v[i].ss-v[i-1].ss)*(v[i].ss-v[i-1].ss));
	}
	return ans;
}

int main()
{
    int n;
    cin>>n;
    vector<pair<double,double>> v;
    ffor(i,0,n)
    {
    	double x,y;
    	cin>>x>>y;
    	v.pb({x,y});
    }
    sort(all(v));
    double ans=0,c=0;
    do
    {
    	c++;
    	ans+=solve(v);
    }
    while(next_permutation(all(v)));
    cout<<SP(20)<<ans/c;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int n,k;
mint ans=1;
vector<int> to[100005];
void dfs(int v,int p = -1){
    int num_child = to[v].size();
    if(p!=-1){
        num_child--;
        rep(i,num_child){
            ans *= (k-i-2);
        }
    }else{
        ans *= k;
        rep(i,num_child){
            ans *= (k-i-1);
        }
    }
    for(int u:to[v]){
        if(u==p)continue;
        dfs(u,v);
    }    
}

int main(){
    cin >> n >> k;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        a--,b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    dfs(0);
    cout << ans.x << endl;
}

Measured memory_bytes: 9216
//#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;

public class Test
{
    public static void Main()
    {
        var line1 = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        long N = line1[0];
        long M = line1[1];
        long total = 0;

        long temp = Math.Min(N, M / 2);

        total += temp;
        N -= temp;
        M -= temp * 2;

        long temp2 = M / 4;

        total += temp2;
        M -= temp2 * 4;

        Console.WriteLine(total);
    }
}

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

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;
    
    std::vector<int> vec{a, b, c};
    std::sort(vec.begin(), vec.end());
    
    std::cout << vec[0] << " " << vec[1] << " " << vec[2] << std::endl;
    
    return 0;
}


Measured memory_bytes: 3148
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    string a,b;
    cin >> a >> b;
    a += b;
    int n = stoi(a);
    int k = sqrt(n);
    if(k * k == n){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 256