akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define pp pair<ll,ll>
#define maxn 100005
#define db double
#define mod 1000000007
using namespace std;
ll modInverse(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y;
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0;   
    return x; 
}
vector<string> vect;
void fun(ll len,string s)
{
	if(len == 0)
	{
		vect.pb(s);
		return;
	}
	char x=s[s.size()-1];
	for(ll i=max('0',(char)(x-1));i<=min((char)(x+1),'9');i++)
	{
		string temp =s;
		temp +=i;
		fun(len-1,temp);
		if(vect.size() >= maxn)
			break;
	}
}
void solve()
{
	ll n;
	cin >> n;
	while(1)
	{
		for(ll l=1;l<=maxn;l++){
			for(ll j='1';j<='9';j++)
			{
				string s;
				s += j;
				fun(l-1,s);
				if(vect.size()>=maxn)
					break;
			}
			if(vect.size()>=maxn)
					break;
		}
		if(vect.size()>=maxn)
					break;
	}
	cout << vect[n-1];
}
int main()
{
	ll t=1,i=1;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
    std::cout.precision(10);
    std::cout.setf( std::ios::fixed, std:: ios::floatfield ); 
	//cin >> t;
	//cin >> n;
	while(i<=t)
	{
		solve();
		i++;
	}
	return 0;
}

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

int palindrome(string str,int s,int e)
{
	
	int check=1;
	for(int i=s;i<e/2;i++)
		{
			if(str[i]==str[(e-s)-i-1])
			{
			}
			else
			{
				check=0;
				break;
			}
		}
		return check;
}
int main()
{
	string str;
	cin>>str;
	int l1=str.size();
	int l2=(l1 - 1)/2;
	int l3=(l1+3)/2;
	int res=palindrome(str,0,l1)*palindrome(str,0,l2)*palindrome(str,l3,l1);
	if(res==1)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}

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

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n, a[max], cnt=0, i;
    
    scanf("%d", &n);
    for (i=1; i<=n; i++) {
        scanf("%d", &a[i]);
        if (i%2!=0&&a[i]%2!=0) {
            cnt++;
        }
    }
    
    printf("%d", cnt);
    
    return 0;
}



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

int main(void) {
    int A, B, C;
    cin >> A >> B >> C;
    if ((A <= C && C <= B) || (B <= C && C <= A))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int n, k, m;
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        if (1 + i * (k - 1) >= n){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
program c
  integer :: N,i,mx,mx1
  integer,allocatable :: A(:),left(:,:)
  read(*,*) N
  allocate(A(N))
  do i=1,N
  read(*,*) A(i)
  enddo
  allocate(left(N,2))
  mx=maxval(A)
  left(1,1)=A(1)
  left(1,2)=A(N)
  do i=2,N
     left(i,1)=max(left(i-1,1),A(i))
     left(i,2)=max(left(i-1,2),A(N-i+1))
  enddo

  do i=1,N
     if(mx.eq.A(i)) then
        if(i.eq.1) then
           write(*,'(i0)') left(N-1,2)
        elseif(i.eq.N) then
           write(*,'(i0)') left(N-1,1)
        else
           write(*,'(i0)') max(left(i-1,1),left(N-i,2))
        endif
     else
        write(*,'(i0)') mx
     endif
  enddo

end program c

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

const int maxN = 2e5 + 100;

struct Node
{
	int to, next;
}edge[maxN * 2 + 1];

int tot, head[maxN + 1];
int f[maxN + 1], g[maxN + 1], fa[maxN + 1];
int n, ans[maxN + 1], last[maxN + 1];
bool flag[maxN + 1];

inline int read()
{
	int num = 0, f = 1;
	char ch = getchar();
	while( !isdigit( ch ) ) { if(ch == '-') f = -1; ch = getchar(); }
	while( isdigit( ch ) ) num = (num << 3) + (num << 1) + (ch ^ 48), ch = getchar();
	return num * f; 
}

inline void add(int x, int y)
{
	tot ++;
	edge[tot].to = y;
	edge[tot].next = head[x];
	head[x] = tot;
}

inline void dfs1(int u, int pa, int mx)
{
	fa[u] = pa;
	if(u > mx)
	{
		flag[u] = true;
		last[u] = mx;
		mx = u;
	}
	for(int i = head[u]; i; i = edge[i].next)
	{
		int v = edge[i].to;
		if(v == pa) continue;
		dfs1(v, u, mx);
	}
}

inline void dfs2(int u, int mx, int *f)
{
	f[u] = 1;
	for(int i = head[u]; i; i = edge[i].next)
	{
		int v = edge[i].to;
		if(v == fa[u] || v > mx) continue;
		dfs2(v, mx, f);
		f[u] += f[v];
	}
}

inline void calc(int u)
{
	if(u != 1)
	{
		ans[u] = ans[ fa[u] ];
		if(flag[u]) ans[u] += g[u];
		else if(flag[ fa[u] ]) ans[u] += f[u] - g[u];
	}
	for(int i = head[u]; i; i = edge[i].next)
	{
		int v = edge[i].to;
		if(v == fa[u]) continue;
		calc(v);
	}
}

inline void print(int x)
{
	if(x < 10) { putchar(x + '0'); return; }
	print(x / 10);
	putchar(x % 10 + '0');
}

int main()
{
	n = read();
	for(int i = 1; i < n; i++)
	{
		int x = read(), y = read();
		add(x, y); add(y, x);
	}
	dfs1(1, 0, 1);
	for(int i = 2; i <= n; i++)
		if(flag[i]) dfs2(i, i, f), dfs2(i, last[i], g);
	calc(1);
	for(int i = 2; i <= n; i++) print(ans[i]), putchar(' ');
	return 0;
}

Measured memory_bytes: 14208
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll ans[100005]={0};
int main(){
  ll n;
  cin>>n;
  ll ans=0;
  for(ll i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0) ans+=i;
  }
  cout<<ans<<endl;
}


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



int main(){
    int n,ans=0;
    cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    rep(i,n-2){
        if(p[i]<p[i+1] && p[i+1]<p[i+2] || p[i]>p[i+1] && p[i+1]>p[i+2]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

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

    int a, b;
    cin >> a >> b;
    cout << (b - a) * (1 + b - a) / 2 - b<< endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int a[100000];
int main() {
	int n;
	scanf("%d", &n);
	fup(i, 0, n - 1, 1)scanf("%d", a + i);
	sort(a, a + n);
	printf("%d ", a[n - 1]);
	int temp = 0;
	fup(i, 1, n - 2, 1)
	{
		if (abs(2*a[temp] - a[n - 1]) > abs(2*a[i] - a[n - 1]))temp = i;
	}
	printf("%d", a[temp]);
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <set>
using namespace std;
#define rep(x,to) for(int x=0; x<(to); (x)++)


int main() {
	int n;
	char s[5];
	string t;
	set<string> Set;
	cin >> n;
	rep(i,n) {
		scanf("%s", s);
		if(s[0] == 'i') {
			cin >> t;
			Set.insert(t);
		} else {
			cin >> t;
			if(Set.find(t) == Set.end()) printf("no\n");
			else printf("yes\n");
		}
	}
	return 0;
}

Measured memory_bytes: 30636
/*
 * main.c
 *
 *  Created on: 2020/02/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}


int main()
{
    int N = 0, ans = 0;
    scanf("%d", &N);
    ans = (N/2) + (N%2);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int min(int a,int b){
  if(a > b){
    return b;
  }
  return a;
}

int main(){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  printf("%d\n",min(a,b) + min(c,d));
  return 0;
}

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

bool f(int x) {
	int keta = 0;
	while (x) {
		keta++;
		x /= 10;
	}
	return keta % 2 == 1;
}

int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (f(i)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
R, G, B, N = map(int, input().split())

c = 0
for r in range(0, N + 1, R):
	for g in range(0, N + 1, G):
		if N < r + g:
			break
		d = N - r - g
		if not d % B:
			c += 1
	
"""
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not (x % B) and (0 <= (x // B)):
			#print(r, g, b)
			c += 1
"""
print(c)


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int V, E;
vector<int> g[100010];
bool used[100010];
vector<int> ans;

void dfs(int u) {
    if (used[u]) return;
    used[u] = true;
    for (int i : g[u]) dfs(i);
    ans.pb(u);
}

void tsort() {
    rep(i, V) dfs(i);
    reverse(all(ans));
}

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

    cin >> V >> E;
    rep(i, E) {
        int s, t;
        cin >> s >> t;
        g[s].pb(t);
    }

    tsort();

    for (int i : ans) cout << i << endl;
    return 0;
}


Measured memory_bytes: 5844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		long[] list = new long[n];
		long max = 0;
		long sum = 0;
		
		for(int i = 0; i < n; i++) {
			list[i] = scan.nextLong();
		}
		
		for(int i = 0; i < n; i++) {
			if(max < list[i]) {
				max = list[i];
			}
			else {
				sum += max - list[i];
			}
		}
		System.out.print(sum);
	}

}


Measured memory_bytes: 60980
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val list = List.fill(10)(sc.nextInt) // nextInt???n????????°??????
    list.sorted.reverse match {
      case a1 :: a2 :: a3 :: any =>
        println(a1)
        println(a2)
        println(a3)
      case _ =>
    }
  }
}

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

#pragma warning(disable:4996)
using namespace std;


int main() {
	int N,K;cin>>N>>K;
	int ans=0;
	int sum=0;
	while (true) {
		int next=(sum-1)/K+1;
		if(ans==0)next=1;
		if (N < sum + next) {
			break;
		}
		else {
			sum+=next;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007



void comb(vector<vector<long long>> &v,int N) {
    for(int i = 0;i <= N;i++) {
        v[i][0] = 1;
        v[i][i] = 1;
    }

    for(int k = 1;k <= N;k++) {
        for(int j = 1;j < k;j++) {
            v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]) % MOD;
        }
    }
}

int main() {
    
   int N,K;
   cin >> N >> K;

   vector<vector<long long>> v(N + 1,vector<long long>(N + 1,0));

    comb(v,N);

   for(int i = 1;i <= K;i++) {
    cout << v[N - K + 1][i] * v[K - 1][i - 1] % MOD << endl;
   }

//    for(int i = 0;i < N;i++) {
//        for(int j = 0;j < N;j++) {
//            cout << v[i][j] << " ";
//        }
//        cout << endl;
//    }
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int H,W; cin >> H >> W;
    char a[H][W]; REP(i,H)REP(j,W) cin >> a[i][j];

    vector<vector<char>> ans;

    REP(i,H){
        bool flag = false;
        REP(j,W){
            if(a[i][j] == '#'){
                flag = true;
                break;
            }
        }
        if(flag){
            vector<char> add(W);
            REP(j,W) add[j] = a[i][j];
            ans.push_back(add);
        }
    }

    vector<vector<char>> ans2(ans.size());
    REP(j,W){
        bool flag = false;
        REP(i,ans.size()){
            if(ans[i][j] == '#'){
                flag = true;
                break;
            }
        }
        if(flag){
            REP(i,ans.size()) ans2[i].push_back(ans[i][j]);
        }
    }
    swap(ans,ans2);
    REP(i,ans.size()){
        for(char c : ans[i]) cout << c;
        cout << endl;
    }
    return 0;
}

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

int main() {
	string S;
	cin >> S;

	while (true) {
		if (S.size() == 1) {
			cout << "No";
			break;
		}

		for (size_t i = 0; i < S.size(); i++)
		{
			if (S.size() % 2 == 0) {


				if (S.at(2 * i) != 'h' || S.at(2 * i + 1) != 'i') {
					cout << "No";
					break;
				}

				if (i == (S.size() / 2) - 1) {
					cout << "Yes";
					break;
				}

			}

			else {
				cout << "No";
				break;

			}
		}
		break;
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll N;
  cin >> N;
  vll P(N);
  rep(i, N) {
    cin >> P[i];
  }

  ll sum = 0;
  ll m = 0;
  rep(i, N) {
    sum += P[i];
    if (m < P[i]) {
      m = P[i];
    }
  }
  COUT(sum - m / 2);
  return 0;
}

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

fun arc082d() {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map { it.toInt() }.toIntArray()

    var answer = 0
    for (i in 0 until n - 1) {
        if (pList[i] == i + 1) {
            val temp = pList[i]
            pList[i] = pList[i + 1]
            pList[i + 1] = temp
            answer++
        }
    }
    if (pList.lastIndex + 1 == pList.last()) answer++

    println(answer)
}


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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	#endif
	int n;
	cin>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++)cin>>a[i];
	b = a;
	sort(a.begin(),a.end());
	for(int i=0;i<n;i++){
		if(b[i] <= a[n/2-1])cout << a[n/2] << '\n';
		else cout << a[n/2-1] << '\n';
	}
}

Measured memory_bytes: 3840
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  cout << s.substr(0, 4) << " " << s.substr(4) << endl;
  return 0;
}

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

int main()
{
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if(e - a <= k){
      cout << "Yay!" << endl;
  }else{
      cout << ":(" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;
const int N = 2e3 + 5;
const int A = 4e6 + 6;
const int Mod = 1e9 + 7;
int n, m, Ax, g[N][N], fac[A], Ifac[A];
inline int pow(int x, int k) {
	ll res = 1, r = x;
	for (; k; k >>= 1, (r *= r) %= Mod)
		if (k & 1) (res *= r) %= Mod;
	return res;
}
inline int calc(int n, int m) {
	return (ll)fac[n] * Ifac[m] % Mod * Ifac[n - m] % Mod;
}
int main() {
	scanf("%d%d", &n, &m);
	if (m == 1) {
		puts("1");
		return 0;
	}
	
	Ax = n * m, fac[0] = 1;
	for (int i = 1; i <= Ax; ++i) fac[i] = (ll)fac[i - 1] * i % Mod;
	
	Ifac[Ax] = pow(fac[Ax], Mod - 2);
	for (int i = Ax; i; --i) Ifac[i - 1] = (ll)Ifac[i] * i % Mod;
			
	g[0][0] = 1;
	for (int k = 1; k <= n; ++k) {
		g[k][0] = (g[k - 1][0] + g[k - 1][1]) % Mod;
		for (int i = 1; i + k <= n; ++i) (g[k][i] = g[k][i - 1] + g[k - 1][i + 1]) %= Mod;
		
		for (int i = 0; i + k <= n; ++i) {
			int ret = Ax - (k - 1) * m - i - 2;
			g[k][i] = (ll)g[k][i] * calc(ret, m - 2) % Mod;
		}
	}
	printf("%lld\n", (ll)g[n][0] * fac[n] % Mod);
}

Measured memory_bytes: 46208
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#include <cassert>
#include <iomanip>
#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()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
int getDigit(ll i)
{
    int dig = 0;
    while (i != 0) {
        i /= ll(10);
        dig++;
    }
    return dig;
}
int main()
{
    /*string s; cin >> s;
    int ans = 0;
    if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') ans = 3;
    else if (s[0] == 'R' && s[1] == 'R') ans = 2;
    else if (s[2] == 'R' && s[1] == 'R') ans = 2;
    else {
        if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') ans = 1;
    }
    cout << ans << endl;
    */

    /*int n; cin >> n;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    ll ans = 0;
    rep(i, n) {
        for(int j = i + 1; j < n; ++j) {
            for(int k = j + 1; k < n; ++k) {
                if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i]) continue;
                ll mx = max(l[i], l[j]);
                mx = max(mx, l[k]);
                ll others = 0;
                if (mx != l[i]) others += l[i];
                if (mx != l[j]) others += l[j];
                if (mx != l[k]) others += l[k];
                if (mx < others) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;*/

    ll x, k, d; cin >> x >> k >> d;
    ll ans = 0;
    if (k <= abs(x) / d) {
        if (0 < x) ans = x - k * d;
        else ans = x + k * d;
        cout << abs(ans) << endl;
        return 0;
    }
    if (0 < x) {
        ll m = x % d;
        if (((x - m) / d) % 2 == k % 2) ans = m;
        else ans = m - d;
    }
    else if (x < 0) {
        ll m = x % d;
        if ((abs(x - m) / d) % 2 == k % 2) ans = m;
        else ans = m + d;
    }
    else { // x == 0
        if (k % 2 == 0) ans = 0;
        else ans = d;
    }
    cout << abs(ans) << endl;
    return 0;
}

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

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

typedef pair<int, int>pi;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll INF = 9e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int n, m, q, l[200010], r[200010], a;
bool b[200010];

int main() {
	cin >> n >> m >> q;
	for (int i = 0;i < n;i++) {
		l[i] = (i - 1 + n) % n, r[i] = (i + 1) % n;
	}
	int now = 0;
	for (int i = 0;i < m;i++) {
		cin >> a;
		if (a % 2 == 0) {
			for (int j = 0;j < a;j++) {
				now = r[now];
			}
			r[l[now]] = r[now];
			l[r[now]] = l[now];
			b[now] = 1;
			now = r[now];
		}
		else {
			for (int j = 0;j < a;j++) {
				now = l[now];
			}
			r[l[now]] = r[now];
			l[r[now]] = l[now];
			b[now] = 1;
			now = r[now];
		}
	}
	for (int i = 0;i < q;i++) {
		cin >> a;
		if (b[a])cout << 0 << endl;
		else cout << 1 << endl;
	}
	return 0;
}



Measured memory_bytes: 4844
list1 = [i for i in input()]
h1=int(list1[0]+list1[1])
t1=int(list1[2]+list1[3])


y1="YYMM"
m1="MMYY"
u1="AMBIGUOUS"
n1="NA"


if h1 == 0 :
    if t1 == 0:
        print(n1)
    elif (1<=t1 and t1 <=12):
        print(y1)
    elif t1 >= 13:
        print(n1)
elif (h1>=1 and h1<=12):
    if t1 ==0:
        print(m1)
    elif (1<=t1 and t1 <=12):
        print(u1)
    elif t1 >= 13:
        print(m1)
elif h1>=13:
    if t1 ==0:
        print(n1)
    elif (1<=t1 and t1 <=12):
        print(y1)
    elif t1 >= 13:
        print(n1)


Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
int main(){
  int N;
  std::cin >> N;
  std::vector<int> two_three;
  two_three.reserve(20000);
  for(int i = 2; i <= 30000; ++i){
    if(i%2==0 || i%3==0) two_three.push_back(i);
  }
  int two = 0, three = 0;
  std::vector<int>::iterator it = two_three.begin();
  for(int i = 0; i < N-1; ++i,++it){
    two += (*it)%2;
    three += (*it)%3;
    two = two%2;
    three = three%3;
  }
  int answer = 0;
  if(two == 0 && three == 0 || (N%16 == 3 && N != 3) || N%16 == 6 || N%16 == 11 || N%16 == 14){
    for(int i = two_three.size()-1; i >= 0; --i){
      if(two_three[i]%6==0){
	answer = two_three[i];
	break;
      }
    }
  }
 else if(two == 0 && three == 2){
    for(int i = two_three.size()-1; i >= 0; --i){
      if(two_three[i]%3==1 && two_three[i]%2==0){
	answer = two_three[i];
	break;
      }
    }
  }
  else if(two == 1 && three == 0){
    for(int i = two_three.size()-1; i >= 0; --i){
      if(two_three[i]%2==1 && two_three[i]%3 == 0){
	answer = two_three[i];
	break;
      }
    }
  }
  else if(two == 1 && three == 2){
    if(N == 3) answer = 25;
  }
  for(int i = 0; i < N-2; ++i){
    std::cout << two_three[i] << " ";
  }
  if((N%16 == 3 && N!=3) || N%16 == 6 || N%16 == 11 || N%16 == 14) std::cout << two_three[N-1] << " ";
  else std::cout << two_three[N-2] << " " ;
  std::cout << answer << std::endl;  
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int a, b, h, m;
    double adeg, bdeg, diff;
    double ans;
    double radiff;
    cin >> a >> b >> h >> m;
    adeg = m * 6;            //aの角度
    bdeg = h * 30 + m * 0.5; //bの角度
    diff = abs(adeg - bdeg);
    if (diff > 180)
    {
        diff = 360 - diff;
    }
    radiff = (double)((diff * PI) / 180);
    ans = (double)(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(radiff));
    ans = sqrt(ans);

    cout << setprecision(11) << ans << endl;

    return 0;
}


Measured memory_bytes: 4088
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,C; cin>>N>>C;
  vi A(N+1),B(N+1),D(N+1),E(N+1),G(N+1),H(N+1);
  vector<pii> F(N);
  rep(i,0,N) cin>>F[i].first>>F[i].second;
  REP(i,1,N){
    A[i]=A[i-1]+F[i-1].second;
    B[i]=max(B[i-1],A[i]-F[i-1].first);
    G[i]=max(G[i-1],A[i]-F[i-1].first*2);
  }
  REP(i,1,N){
    D[i]=D[i-1]+F[N-i].second;
    E[i]=max(E[i-1],D[i]-(C-F[N-i].first));
    H[i]=max(H[i-1],D[i]-(C-F[N-i].first)*2);
  }
  int ans=0;
  REP(i,0,N){
    ans=max(B[i]+H[N-i],ans);
    ans=max(G[i]+E[N-i],ans);
  }
  cout<<ans<<endl;
  }



Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int[] nums = new int[a];
		
		for(int i = a-1; i >= 0; i--){
			nums[i] = sc.nextInt();
		}
		
		StringBuilder str = new StringBuilder();
		for(int i = 0; i < nums.length; i++){
			if(i != nums.length-1) str.append(nums[i] + " ");
			else str.append(nums[i]);
		}
		
		System.out.println(str);
		
	}

}

Measured memory_bytes: 18132
#include <iostream>
#include <math.h>

using namespace std;


int main()
{
	int i,n;
	cin >> n;
	
	int gaku = 100;

	for( i = 0; i < n; i++ ) {
		gaku = ceil(gaku * 1.05);
	}
	
	cout << gaku * 1000 << endl;
	return 0;
}

Measured memory_bytes: 0
// 2019年08月14日 (水曜日) 17:24:02
#include <bits/stdc++.h>
using namespace std;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
// #define SORT(v, n) stable_sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    int n;
    cin >> n;

    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        sort(all(s));  // 入力された文字列単位でソートする
        mp[s]++;       // mapのvalueに＋１する。
    }

    ll ans = 0;
    for (auto& p : mp) {
        int s = p.second;
        ans += (ll)s * (s - 1) / 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11264
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

long long int A[100000];
long long int tempA[100000];
char C[100000];
char tempC[100000];

int Partition(int p, int r)
{
	long long int x = A[r];
	int i = p - 1;
	for (int j = p; j < r; j++)
	{
		if (A[j] <= x)
		{
			i++;
			long long int tempi = A[i];
			char tempc = C[i];
			A[i] = A[j];
			C[i] = C[j];
			A[j] = tempi;
			C[j] = tempc;
		}
	}

	long long int tempi = A[i + 1];
	char tempc = C[i + 1];
	A[i + 1] = A[r];
	C[i + 1] = C[r];
	A[r] = tempi;
	C[r] = tempc;
	return i + 1;
}

void QuickSort(int p, int r)
{
	if (p < r)
	{
		int q = Partition(p, r);
		QuickSort(p, q - 1);
		QuickSort(q + 1, r);
	}
}

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

	for (int i = 0; i < N; i++)
	{
		cin >> C[i] >> A[i];
		//scanf("%c", &C[i]);
		//scanf("%d", &A[i]);
		tempC[i] = C[i];
		tempA[i] = A[i];
	}

	QuickSort(0, N - 1);
	
	bool isStable = true;

	int offset = 0;
	int temp = -1;
	for (int i = 0; i < N&&isStable; i++)
	{
		if (temp != A[i])
		{
			offset = 0;
		}
		while (offset < N)
		{
			if (A[i] == tempA[offset])
			{
				if (C[i] != tempC[offset])
				{
					isStable = false;
				}
				offset++;
				break;
			}
			offset++;
		}
		temp = A[i];
	}

	if (isStable)
	{
		printf("Stable\n");
	}
	else
	{
		printf("Not stable\n");
	}

	for (int i = 0; i < N; i++)
	{
		printf("%c %d\n", C[i], A[i]);
	}

	return 0;
}


Measured memory_bytes: 4940
// Do you knOW what it feels like?

		// To be TorTured by your own MinD?
	
	// I don't wanna feel the PAIN.

// I BeG you to KILL me, pleASE...

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, lg=22, mod=1e9+7, inf=1e18;

ll n,m,q;
ll vt[maxn],d[maxn],c[maxn],dp[maxn],col[maxn];
vector<ll> g[maxn];
void dfs(ll v,ll d,ll c){
	if(!col[v]) col[v]=c;
	if(dp[v]>=d || d==0) return;
	dp[v]=d;
	for(auto x:g[v]) dfs(x,d-1,c);
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n>>m;
	for(int i=0;i<m;++i){
		ll v,u;	cin>>v>>u;
		g[u].pb(v), g[v].pb(u);
	}
	cin>>q;
	for(int i=0;i<q;++i)    cin>>vt[i]>>d[i]>>c[i];
	for(int i=q-1;i>=0;--i) dfs(vt[i],d[i],c[i]);
	for(int i=1;i<=n;++i)   cout<<col[i]<<endl;

	return 0;
}


















Measured memory_bytes: 10868
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

LLI gcd(LLI a, LLI b) { return b ? gcd(b, a % b) : a; }
LLI lcm(LLI a, LLI b) { return a * b / gcd(a, b); }

int main()
{
	cout << fixed << setprecision(10);
	LLI a, b;
	cin >> a >> b;
	cout << lcm(a, b);
	return 0;
}

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

ll x_s,y_s,x_t,y_t;
ll n;
struct point {
    ll x,y,r;
};

point p[1010];

struct edge {
    ll to;
    double cost;
};

unordered_map <ll,vector<edge> > edges;

int main(){
    std::cin >> x_s>>y_s>>x_t>>y_t;
    std::cin >> n;
    
    for (int i = 1; i <= n; i++) {
        std::cin >> p[i].x>>p[i].y>>p[i].r;
    }
    // 視点と終点も
    p[0].x = x_s;
    p[0].y = y_s;
    p[n+1].x = x_t;
    p[n+1].y = y_t;
    
    for (int i = 0; i <= n+1; i++) {
        for (int j = i+1; j <= n+1; j++) {
            if(i==j) continue;
            double cost = max(sqrt(pow((p[i].x - p[j].x),2)+pow((p[i].y - p[j].y),2)) - (p[i].r + p[j].r), (double)0);
            edges[i].push_back({j,cost});
            edges[j].push_back({i,cost});
            // std::cout << i<<" " <<j<<" "<<cost << std::endl;
        }
    }
    
    priority_queue<pair<double,ll>, vector<pair<double,ll>>, greater<pair<double,ll>> > que;
    double d[1010];
    const ll INF = 1e11;
    for (int i = 0; i <= n+1; i++) {
        d[i]=INF;
    }
    d[0]=0;
    
    que.push({0,0});
    
    while(!que.empty()){
        double cost = que.top().first;
        ll node = que.top().second;
        que.pop();
        
        if(d[node] < cost) continue;
        
        for (auto e : edges[node]) {
            if(d[e.to] > cost + e.cost){
                d[e.to] = cost + e.cost;
                que.push({d[e.to],e.to});
            }
        }
    }
    
    std::cout <<setprecision(13) <<d[n+1] << std::endl;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);

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

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	ll center_a, center_b;

	if(n % 2 == 0)
	{
		center_a = ( a[n / 2 - 1] + a[n / 2] );
		center_b = ( b[n / 2 - 1] + b[n / 2] );
		if (center_a > center_b)
		{
			swap(center_a, center_b);
		}
		cout << center_b - center_a + 1;
	}
	else
	{
		center_a = a[n / 2];
		center_b = b[n / 2];
		if (center_a > center_b)
		{
			swap(center_a, center_b);
		}
		cout << center_b - center_a + 1;
	}
	


}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 6320
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	Set<Integer> set;

	void doIt() {
		int n = sc.nextInt();
		ArrayList<Edge> e[] = new ArrayList[n];
		for(int i = 0; i < n; i++) {
			e[i] = new ArrayList<>();
		}
		for(int i = 1; i < n; i++) {
			int v = sc.nextInt() -1;
			int u = sc.nextInt() -1;
			int w = sc.nextInt();
			e[v].add(new Edge(u, w));
			e[u].add(new Edge(v, w));
		}
		int col[] = new int[n];
		Arrays.fill(col, -1);
		col[0] = 0;
		search(0, e, n, col);
		for(int i = 0; i < n; i++) {
			System.out.println(col[i]);
		}
	}

	void search(int idx, ArrayList<Edge>[] e, int n ,int col[]) {
		for(Edge i : e[idx]) {
			if(col[i.t] >= 0) continue;
			if(i.w % 2 == 0) {
				col[i.t] = col[idx];
				search(i.t, e, n, col);
			}
			else {
				col[i.t] = col[idx] ^ 1;
				search(i.t, e, n, col);
			}

		}
	}
	
	class Edge{
		int t, w;
		Edge(int to, int weight){
			t = to; w = weight;
		}
	}

	public static void main(String[] args) {
		new Main().doIt();
	}
}


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

a1 = abs(a[0] - a[1])
a2 = abs(a[1] - a[2])
a3 = abs(a[2] - a[0])

m = max(a1, a2, a3)
#print(m)
print(a1 + a2 + a3 - m)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define se second
#define mp make_pair
#define fi first
#define del(a,vec) vec.erase(std::remove(vec.begin(), vec.end(), a), vec.end());
#define search(f,l,v) binary_search(f,l,v)
#define iter(a,b) vector<int>::iterator a,b
#define lower(v,num) lower_bound (v.begin(), v.end(), num);
#define upper(v,num) upper_bound (v.begin(), v.end(), num); 
#define removecopy(a) unique(a.begin(), a.end()); 
#define ll long long int
namespace Rahul{
    bool isPrime(int n) 
    {if (n <= 1)  return false; if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; }
    ll pow (ll x, ll n,ll mod) {//calculate x^n
    if (n == 0) return 1;

    ll res = pow (x, n / 2,mod);

    res = (res * res) % mod;
    if (n % 2) res = (res * x ) % mod;

    return res;
    }
    ll _gcd(ll a,ll b)
    {
        if(a==0)
            return b;
        else    
            return _gcd(b%a,a);
    }
    //s.erase(s.find(2)) where s={1,2,3,3,2}; 
};

using namespace Rahul;
vector< int >v[10];
double distance(int x1, int y1, int x2, int y2) 
{ 
    // Calculating distance 
    return sqrt(pow(x2 - x1, 2) +  
                pow(y2 - y1, 2) * 1.0); 
} 
double ans=0;
void heapPermutation(int a[], int size, int n) 
{ 
    // if size becomes 1 then prints the obtained 
    // permutation 
    if (size == 1) 
    { 
        
        for(int i=0;i<n-1;i++)
            {
                int x1=v[a[i]-1][0];
                int x2=v[a[i+1]-1][0];
                int y2=v[a[i+1]-1][1];
                
                int y1=v[a[i]-1][1];
                ans+=distance(x1,y1,x2,y2);
                
            }
        
        
        return; 
    } 
  
    for (int i=0; i<size; i++) 
    { 
        heapPermutation(a,size-1,n); 
  
        if (size%2==1) 
            swap(a[0], a[size-1]); 
  
        // If size is even, swap ith and last 
        // element 
        else
            swap(a[i], a[size-1]); 
    } 
} 
int main()
{
     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
     int n;
     cin>>n;
    //  vector<pair<int,int> >v[n+1];
    // for(int i=0;i<10;i++)
    //     v[i].clear();
     for(int i=0;i<n;i++)
         {
             int x,y;
             cin>>x>>y;
             v[i].pb(x);
             v[i].pb(y);
        }
    // int     
    // vector<int>pre[];
    int arr[n+1];
    for(int i=0;i<n;i++)
        arr[i]=i+1;
        
    heapPermutation(arr,n,n);  
    double fact=1;
    for(int i=1;i<=n;i++)
    fact*=i;
    
    
    ans=ans/fact;
    
    printf("%0.9f",ans);
    // cout<<ans<<endl;
     
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

ll sum(ll x, ll b) {
	ll r = 0;
	while (x >= b) {
		r+=x%b;
		x/=b;
	}
	return r+x;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, s;
	cin >> n >> s;
	
	if (n == s) {
		cout << n+1 << "\n";
		return 0;
	}
	
	for (ll i = 2; i*i<=n; i++){
		if (sum(n,i) == s) {
			cout << i << "\n";
			return 0;
		}
	}
	
	for (ll i = (ll)sqrtl(n-s); i>=1; i--){
		if ( (n-s)%i == 0 && sum(n,(n-s)/i+1)==s ) {
			cout << ((n-s)/i+1) << "\n";
			return 0;
		}
	}
	
	cout << "-1\n";
	

}


Measured memory_bytes: 3668
#include <iostream>
#include <iomanip>
using namespace std; 
int main(){
    int a,b;
    int d,r;
    double f;
    cin >> a >> b;
    d = a/b;
    r = a%b;
    f = (double)a/b;
    cout << d << " " << r << " " << fixed << setprecision(5) << f << endl;
    return 0;
}


Measured memory_bytes: 3272
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll n,m;
    cin >> n >> m;

    vector<bool> stair(n+1,false);

    for(int i = 0; i < m; i++){
        ll x;
        cin >> x;
        stair[x] = true;
    }

    vector<ll> dp(n+1,0);
    dp[0] = 1;

    for(int i = 0; i < n+1; i++){
        if(i+1 <= n && !stair[i+1] && !stair[i]){
            dp[i+1] += dp[i];
            dp[i+1] %= MOD;
        }
        if(i+2 <= n && !stair[i+2] && !stair[i]){
            dp[i+2] += dp[i];
            dp[i+2] %= MOD;
        }
    }

    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>                                      
                                                         
int num_div(int n){                                      
        int num = 0;                                     
                                                         
        for (int i = 1; i <= n; i++){                    
                if (n % i == 0)                          
                        num++;                           
        }                                                
                                                         
        return num;                                      
}                                                        
                                                         
                                                         
using namespace std;                                     
                                                         
int main(void){                                          
        int n, num = 0;                                  
                                                         
        cin >> n;                                        
                                                         
        for (int i = 1; i <= n; i++){                    
                if (num_div(i) == 8 && i & 1)            
                        num++;                           
        }                                                
                                                         
        cout << num << endl;                             
                                                         
}                                                        

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 mini = INFINITY;
  for(int i=1; i<N; i++) {
    int a=0, b=0;
    int j = N-i;
    int x=i, y=j;
    while(x>0) {
      a += x%10;
      x /= 10;
    }
    while(y>0) {
      b += y%10;
      y /= 10;
    }
    mini = min(mini,a+b);
  }
  cout << mini << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
int a[500000],tada[500000];
int main() {
    int i,j;
    int n,k,q;
    
    cin >> n >> k >> q;
    for(int i=0; i<q; i++)
    {
      cin >>a[i];
      tada[i]=0;
    }

for(i=0; i<q; i++)
{
  tada[a[i]-1]+=1;
}

for(i=0; i<n; i++)
{
  if(tada[i]>q-k){
    cout << "Yes" << endl;
// cout << tada[i]<< endl;
  }else
  {
        cout << "No" << endl;

// cout<< tada[i]<<endl;
  }
}
}


Measured memory_bytes: 1408
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
	int a,b;
	while( scanf("%d %d",&a,&b) != EOF )
	{
		int sum = a + b;
		double c = (double)sum/2;
		int d = (a + b) / 2;
		if( c - d > 0.4 )
			printf("%d\n",d+1);
		else
			printf("%d\n",d);
	}
}

Measured memory_bytes: 128