akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)

int main(int argc, const char * argv[]) {
    
    int N;
    cin >> N;
    
    int last = 0;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        if (last > h) {
            cout << "No";
            return 0;
        } else if (last < h) {
            last = h - 1;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {  
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  int kotae=0;
  vector<int> num(N);
  for(int i=0;i<N;i++){
    num.at(i)=i+1;
  }
  int j=0;
  bool hantei=false;
  for(int i=0;i<N;i++){
    if(A.at(i)==num.at(j)){
      j++;
      hantei=true;
    } else {
      kotae++;
    }
  }
  if(hantei==true){
    cout<<kotae<<endl;
  }else {
    cout<<"-1"<<endl;
  }
  return 0;
}

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

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

typedef long long ll;


using namespace std;

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


long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>x;
      rep(i,n)cin>>a[i];
      rep(i,n-1){
        pos=a[i]+a[i+1];
        if(pos>x){
          ans+=pos-x;
          a[i+1]-=pos-x;
          if(a[i+1]<0){
            a[i+1]=0;
            cmp=a[i+1];
            ans+=-cmp;
            a[i]+=cmp;
          }
        }
      }
     Cout(ans);

       
return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
    ll A , B , C;
    cin >> A >> B >> C;
    ll K;
    cin >> K;
    if(K % 2 == 0){
        cout << A - B << endl;
    }
    else{
        cout << B - A << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a, b;
	double a1, b1;
	cin >> a >> b;
	a1 = a; b1 = b;
	printf("%d %d %.7f\n", a / b, a%b, a1 / b1);
	return 0;
}

Measured memory_bytes: 3196
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;
#define SORTVL(v) sort(v.begin(), v.end());
#define SORTVL_GR(v) sort(v.begin(), v.end(), greater<LL>());

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a % b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }
// 末尾数字で切り上げ
LL CeilLastNumber(LL n) { return ((n + (10 - 1)) / 10) * 10; }
//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p % i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	cin >> N;

	O(N * N * N);

	return 0;
}

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

int main() {
 
    int n,k;
    cin >> n >> k;
    
   vector<int> a(n);
    rep(i,n) {
    cin >> a.at(i);
    }
    
    int count = 0;
    
    rep(i,n) {
    if(a.at(i) >= k){
    count++;
    }
    }
    
    cout << count;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
typedef long long ll;
using namespace std;
int main(){
	ll L, R;
	cin >> L >> R;
 
	int mod_min = 2018;
  R=min(R,L+2019);
 
	for (ll i = L; i <R; i++){
		for (ll j = i + 1; j <= R; j++){
			int mod = i*j % 2019;
			mod_min = min(mod_min, mod);
		}
	}
	cout << mod_min;
	
	return 0;
}

Measured memory_bytes: 256
import heapq
n,m=map(int, input().split())
jobs=[[] for i in range(m)]
for i in range(n):
    a,b=map(int, input().split())
    if a > m:
        continue
    jobs[m-a].append(b)
q=[]
ans=0
for i in range(m,0,-1):
    for job in jobs[i-1]:
        heapq.heappush(q, -job)
    if len(q) > 0:
        ans += (-heapq.heappop(q))
print(ans)

Measured memory_bytes: 18468
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        var t = 1;
        while (true)
        {
            if (t > n) { Console.WriteLine(t / 2); return; }
            else if (t == n) { Console.WriteLine(t); return; }
            t *= 2;
        }
    }
}



Measured memory_bytes: 17928
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(min(b/a, c))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1772
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=1;i<=n;i++)
using namespace std;

int main(){
    ll n; cin >> n;
    ll ans = 1001001001001;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0) ans = min(ans,i+n/i);
    }
    cout << ans-2 << endl;
}


Measured memory_bytes: 256
object Main extends App {
  var i = 0
  val sb = StringBuilder.newBuilder
  for(x <- io.Source.stdin.getLines() if x != "0") {
    i += 1
    // sb.append("Case ").append(i).append(": ")
    //   .append(x).append('\n')
    sb.append(s"Case $i: $x\n")
  }
  print(sb.toString())
}


Measured memory_bytes: 55780
#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
int N;
int K;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<int> p(N);
 
    for (int i=0; i<N; i++) {
        cin >> p[i];
    }
    
    double answer = 0.0;
    for (int j=0; j<K; j++) {
        answer += (double)(1+p[j])/2;
    }
    
    double maxd = answer;
    for (int i=K; i<N; i++) {
        double left = (double) (1+p[i-K])/2;
        double right = (double)(1+p[i])/2;
        answer += right;
        answer -= left;
        maxd = max(maxd, answer);
    }
    
    cout << setprecision(12) << maxd << endl;
    
    return 0;
}


Measured memory_bytes: 1024
//
//  main.cpp
//  binary_search
//
//  Created by ???????????? on 2017/10/06.
//  Copyright ?? 2017 ????????????. All rights reserved.
//

#include <iostream>
#include <stdio.h>

using namespace std;

bool binary_search(int A[], int n, int key){
    int left, mid, right;
    left = 0;
    right = n;
    while(left < right){
        mid = (left + right)/2;
        if(A[mid] == key){
            return true;
        }
        else if(key < A[mid]){
            right = mid;
        }
        else if(key > A[mid]){
            left = mid+1;
        }
    }
    return false;
}

int main(int argc, const char * argv[]) {
    int n, i, ct, q, key;
    
    scanf("%d", &n);
    int S[n];
    for(i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    
    ct = 0;
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &key);
        bool found = binary_search(S, n, key);
        if(found) ct ++;
    }
    cout << ct << endl;;
    return 0;
}

Measured memory_bytes: 3396
#include <bits/stdc++.h>
#define SZ(a) int((a).size())
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
using namespace std;
using LL = long long;
using PII = pair<int, int>;

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



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


int main()
{
	int N;
	int A;
	cin>>N;
	cin>>A;
	N%=500;
	if(N<=A) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define x first
#define y second
#define pb push_back
#define all(x) x.begin(), x.end()

#define MAXN 200005

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

	ll N, M, K;
	cin >> N >> M >> K;
	ll A[MAXN] = {0};
	ll B[MAXN] = {0};
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		A[i] += A[i-1];
	}
	for (int i = 1; i <= M; i++) {
		cin >> B[i];
		B[i] += B[i-1];
	}

	// for (int i = 0; i < N; i++) cout << A[i] << " "; cout << endl;
	// for (int i = 0; i < M; i++) cout << B[i] << " "; cout << endl;

	int best = 0;
	int j = M;
	for (int i = 0; i <= N && A[i] <= K; i++) {
		while (j >= 0 && A[i] + B[j] > K) {
			j--;
		}
		// printf("%d %d\n", i, j);
		best = max(best, i + j);
	}
	// if (B[M-1] <= K) best = max(best, M);
	cout << best << endl;
}


Measured memory_bytes: 6780
#include <stdio.h>
int main(){
    int a,b,c,X;
    scanf("%d %d %d",&a,&b,&c);

    if(a>b){
        X=a;
        a=b;
        b=X;
    }
    if(b>c){
        X=b;
        b=c;
        c=X;
    }
    if(a>b){
        X=a;
        a=b;
        b=X;
    }
    printf("%d %d %d\n",a,b,c);





    return 0;
}

Measured memory_bytes: 596
def main():
    N,M=map(int,input().split())
    graph=[[] for _ in range(N)]
    for _ in range(M):
        A,B=map(int,input().split())
        graph[A-1].append([A-1,B-1])
        graph[B-1].append([B-1,A-1])
    #print(graph)
    ans=[-1]*N
    Q=graph[0]
    while Q!=[]:
        tmp=[]
        for q in Q:
            ind,val=q
            if ans[val]!=-1:
                continue
            ans[val]=ind
            tmp+=graph[val]
        Q=tmp
    for w in ans:
        if w==-1:
            print("No")
            break
    print("Yes")
    for w in ans[1:]:
        print(w+1)
main()

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

int main()
{
    ll n;
    cin >> n;
    ll sum = 0;
    sum = n * (n - 1) / 2;
    cout << sum << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi pair<int, int>
#define M 1000000007

// pi.first is the no. of ways if root is white
// pi.second is the no. of ways if root is black
pi dfs(vector<int> edges[], int sv, int parent){

    // We have 2 options: make the current 'sv' as black or white
    // If we make it black, then all of its children should be white
    // If we make it white, then either all children are white or
    // some children are black

    // Take example of tree
    //           1
    //         / | \
    //        2  3  4
    // B1 = W2*W3*W4
    // W1 = W2*W3*W4 + B2*W3*W4 + W2*B3*W4 + W2*W3*B4 + B2*B3*W4 + B2*W3*B4 +
    //      W2*B3*B4 + B2*B3*B4

    // Suppose we are at the third child (4)
    // We already have these values
    // B1 = W2*W3
    // W1 = W2*W3 + B2*W3 + W2*B3 + B2*B3
    // Now we get B4 and W4 from the recursion for the third child
    // Then B1 = B1*W4
    //      W1 = W1*(W4 + B4)
    // (If the current node is to be black, then child must be black)
    // (If the current node is to be white, then child can be either black or white)
    // On expanding, we get the above values

    ll w = 1, b = 1;

    for(int child: edges[sv]){
        if(child == parent)
            continue;
        pi childAns = dfs(edges, child, sv);
        ll childW = childAns.first, childB = childAns.second;
        b = (b*childW)%M;
        w = (w*((childW + childB)%M))%M;
    }

    pi ans = {w, b};
    return ans;
}

int independentSet(vector<int> edges[], int n){

    pi rootAns = dfs(edges, 0, -1);
    ll ans = (rootAns.first + rootAns.second)%M;
    return ans;
}

int main()
{
 int n;
 cin>>n;
 vector<int> edges[n];
 int u, v;
 for(int i=0; i<n-1; i++){
    cin>>u>>v;
    edges[u-1].push_back(v-1);
    edges[v-1].push_back(u-1);
 }
 int ans = independentSet(edges, n);
 cout<<ans;
 return 0;
}

Measured memory_bytes: 16048
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    set<int> d;
    rep(i, n){
        int x;
        cin >> x;
        d.insert(x);
    }
    cout << (int)d.size() << endl;
}

Measured memory_bytes: 256
import sys
import collections


def main():
    n, m = [int(s) for s in sys.stdin.readline().strip().split()]
    graph = collections.defaultdict(set)
    for _ in range(m):
        u, v = [int(s) for s in sys.stdin.readline().strip().split()]
        graph[u].add(v)
    s, t = [int(s) for s in sys.stdin.readline().strip().split()]

    shortest = dict()
    shortest[s] = 0
    q = collections.deque()
    q.append((0, s, 0))
    seen = dict()
    while q:
        level, loc, turn = q.popleft()
        children = graph[loc]
        child_turn = turn + 1
        child_level = (level+1) % 3
        for child in children:
            if (child_level, child) not in seen:
                if child_level == 0 and child == t:
                    print(child_turn // 3)
                    return
                seen[(child_level, child)] = child_turn
                q.append((child_level, child, child_turn))

    print(-1)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 106716
from functools import lru_cache
import sys
mod=1000000007

n,k=[int(i) for i in input().split(" ")]

facts=[1 for i in range(k+1)]

for i in range(1,k+1):
    facts[i]=i*facts[i-1]



if n>k:
    print(0)
    sys.exit()

print((facts[k]//facts[k-n])%mod)



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

int main (){
    int N, M;
    cin >> N >> M;
    int count[30] = {};
    int ans = 0;
    for (int i = 0; i < N; i++){
        int K;
        cin >> K;
        int A[K];
        for (int j = 0; j < K; j++){
            cin >> A[j];
        }
        for (int j = 0; j < K; j++){
            count[A[j]-1]++;
        }
    }
    for (int l = 0; l < M; l++){
        if (count[l] == N){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

signed main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n + 1,0);
    int c = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];

        b[i + 1] = b[i] + a[i];
    }
    int e = 2e9 + 1;
    for(int i = 1; i < n; i++){
        e = min(abs(b[n] - 2 * b[i]),e);
    }
    cout << e << endl;
}

Measured memory_bytes: 3328
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
#include <limits>
using namespace std;

int main(){
  int n,k;
  double l = 0.0, sum = 0.0;
  cin >> n >> k;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p.at(i);
  }

  for(int i = 0; i < k; i++){
      sum+=(p.at(i)+1)/2.0;
  }
  l = sum;

  for(int i = 0; i < n-k; i++){
    sum-=((p.at(i)+1.0)/2.0);
    sum+=((p.at(i+k)+1.0)/2.0);
    if(l < sum) l = sum;
  }
  cout << fixed << setprecision(7);
  cout << l << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int h,w;
	while(cin>>h>>w,h){
		int mi_h = 1e8,mi_w = 1e8,mi = 1e8;
		int norm2 = h*h+w*w;
		for(int i = 1;i < 160;i++){
			for(int j = i+1;j < 160;j++){
				int sc2 = i*i+j*j;
				if(sc2 < norm2)continue;
				if(sc2 == norm2 && i <= h)continue;
				int diff = abs(norm2 - sc2);
				if(mi == diff ? mi_h > i : mi > diff){
					mi_h = i,mi_w = j;
					mi = diff;
				}
			}
		}
		cout<<mi_h<<" "<<mi_w<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int a, b, c, x, ans;
int main() {
    cin >> a >> b >> c;
    for (int i = 1; i <= a; ++i)
    {
        cin >> x;
        ans += (x < b || x >= c);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

ll C(ll n){
	return(n*(n-1)/2);
}
	
int main()
{
	int n;
	int a;
	int odd = 0;
	cin >> n;
	for (int i = 1; i < n+1; i++){
		if (i % 2) odd++;
	}
	cout << (float)odd / (float)n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

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

  int N,X,a,x=0,count=1;
  cin>>N>>X;
  rep(i, N) {
    cin>>a;
    x+=a;
    if(x>X) break;
    count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
# AOJ 0023 Circles Intersection

n = gets.to_i
n.times do
  xa, ya, ra, xb, yb, rb = gets.split.map {|v| v.to_f}

  dxab = xb - xa
  dyab = yb - ya
  rab2 = dxab * dxab + dyab * dyab

  if rab2 > (ra + rb) * (ra + rb)
    # do not overlap
    puts 0
  elsif rab2 < (rb - ra) * (rb - ra)
    if ra > rb
      # B is in A
      puts 2
    else
      # A is in B
      puts -2
    end
  elsif rab2 == 0 && ra == rb
    # A is B
  else
    # circumference of A and B intersect
    puts 1
  end
end

Measured memory_bytes: 6124
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

j = 0
for z in range(X+1, Y+1):
	if max(x) < z and z <= min(y):
		j = 1
		break
if j == 1:
	print("No War")
else:
	print("War")

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

int main()
{
	int n;
	cin >> n;

	int qt;
	cin >> qt;

	int t = 0;

	queue<pair<string, int>> q;
	for (; n--; )
	{
		int t;
		string s;
		cin >> s >> t;

		q.push(make_pair(s, t));
	}

	for (; !q.empty();)
	{
		pair<string, int> pr;

		pr = q.front();
		q.pop();
		
		int x = min(qt, pr.second);
		t += x;

		if (pr.second - x <= 0)
		{
			cout << pr.first << " " << t << endl;
		}
		else
		{
			q.push(make_pair(pr.first, pr.second - x));
		}
	}
}


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

int a,b,c;
int main(){
    cin>>a>>b>>c;
    for(int i=1;i<=b;i++)
    {
        if((a*i)%b==c){
		cout<<"YES"<<endl;return 0;
	}
}
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
 
using namespace std;
 
typedef long long ll;
 
#define limit int(1e5 + 99)
ll wei[ limit ], val[ limit ];
ll dp[ limit ];
 
int main() {
	ll n, w;
	scanf("%lld%lld", &n, &w);
 
	for(ll i = 0; i < n; i++) {
		scanf("%lld%lld", &wei[ i ], &val[ i ]);
	}

        
	for(int i = 0; i < n; i++) {
		for(int j = w; j >= wei[ i ]; j--) {
			//printf("%i ? %i\n", dp[ j ], dp[ j - wei[ i ] ] + val[ i ]);
			dp[ j ] = max(dp[ j ], dp[ j - wei[ i ] ] + val[ i ]);
		}
	}

	printf("%lld", dp[ w ]);
}

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

int main() {
  int A, B, C;
  cin >>A >>B >>C;

  if (B == C) 
    cout << A << endl;
  else if (A == C)
    cout << B << endl;
  else if (A == B)
    cout << C << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  std::string s,t;
  std::cin>>s>>t;

  ll a,b;
  std::cin>>a>>b;

  std::string u;
  std::cin>>u;

  if(s==u){
    std::cout<<a-1<<" "<<b<<"\n";
  }else{
    std::cout<<a<<" "<<b-1<<"\n";
  }

  return 0;
}


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

max_h = H[0]
for h in H:
    if h >= max_h:
        viewable.append(1)
    else:
        viewable.append(0)
    max_h = max(max_h, h)

ans = sum(viewable)
print(ans)

Measured memory_bytes: 38512
//
// Rewrite main.js in C++
//

#include <cstdio>
#include <vector>
#include <iostream>

using ll = int64_t;
using namespace std;

ll fastExp(ll base, ll exp, ll modulo) {
  ll result = 1;
  ll be = base;
  while (exp > 0) {
    if (exp & 1) {
      result = (result * be) % modulo;
    }
    be = (be * be) % modulo;
    exp >>= 1;
  }
  return result;
}

void makeFactorials(ll n, ll modulo, vector<ll>& a, vector<ll>& a_inv) {
  ll k = 1;
  ll k_inv = 1;
  a[0] = 1;
  a_inv[0] = 1;
  for (ll i = 1; i <= n; i++) {
    ll i_inv = fastExp(i, modulo - 2, modulo);
    k = (k * i) % modulo;
    k_inv = (k_inv * i_inv) % modulo;
    a[i] = k;
    a_inv[i] = k_inv;
  }
}

ll solve(ll N, ll M, int debug = 0) {
  ll modulo = 1000'000'000 + 7; // Prime < 2^32
  auto MUL = [&](ll x, ll y) { return (x * y) % modulo; };
  vector<ll> f;
  vector<ll> f_inv;
  f.resize(M + 1);
  f_inv.resize(M + 1);
  makeFactorials(M, modulo, f, f_inv);

  if (debug) {
    for (int i = 0; i <= M; i++) {
      printf("%d: %ld %ld %ld\n", i, f[i], f_inv[i], MUL(f[i], f_inv[i]));
    }
  }

  ll result = 0;
  for (ll k = 0; k <= N; k++) {
    ll x = MUL(f[N], MUL(f_inv[N - k], f_inv[k]));
    ll y = MUL(f[M], f_inv[M - k]);
    ll z = MUL(f[M - k], f_inv[M - N]);
    ll w = MUL(z, z);
    ll xyw = MUL(x, MUL(y, w));
    if (k % 2) {
      result += modulo - xyw;
    } else {
      result += xyw;
    }
    result %= modulo;
  }
  return result;
}

void _main(std::istream& istr, std::ostream& ostr) {
  ll N, M;
  istr >> N >> M;
  ostr << solve(N, M) << std::endl;
}

int main() {
  _main(std::cin, std::cout);
  return 0;
}


Measured memory_bytes: 10684
s = input()
c1 = s.count('R')
if c1 == 3:
  print(3)
elif c1 == 2:
  if s[1] == 'S':
    print(1)
  else:
    print(2)
elif c1 == 1:
  print(1)
else:
  print(0)

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n;cin>>n;
  vector<ll> c(n);
  rep(i, n)cin>>c[i];
  c.erase( unique(c.begin(), c.end()), c.end() );
  n = c.size();

  map<ll,ll>lim;
  ll result = 1;
  rep(i,n){
    result += lim[c[i]];
    result %= MOD;
    lim[c[i]]=result;
//cout<<c[i]<<' '<<result<<endl;
  }

  cout<<result;

  return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b==c || b+c==a || c+a==b){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
#define REP(i,a,b) \
for(int i=int(a);i<=int(b);i++)
#define DEP(i,a,b) \
for(int i=int(a);i>=int(b);i--)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int T,i,f=0;
	cin>>T;
	if(T%10==7)
		f=1;
	T=T/10;
	if(T%10==7)
		f=1;
	T=T/10;
	if(T%10==7)
		f=1;
	if(f)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>void p(T x){cout << x << endl;}
template<class T>void pvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << 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; }

typedef pair<int, int> P;

int main()
{
    int v, e; cin >> v >> e;
    vector<P> G[v];

    int from, to, cost;
    rep(i, e){
        cin >> from >> to >> cost;
        G[from].push_back(P(-cost, to));
        G[to].push_back(P(-cost, from));
    }

    int ans=0;
    priority_queue<P> que;
    vector<int> X;
    vector<bool> in(v, false);
    X.push_back(0); in[0] = true;
    for(P ed: G[0]) que.push(ed);

    while(X.size()!=v){
        P ed = que.top(); que.pop();
        cost = -ed.first; to = ed.second;
        // p(cost);
        if(in[to]) continue;

        ans += cost;
        in[to] = true; X.push_back(to);
        for(P e: G[to]) que.push(e);
    }

    p(ans);
    return 0;
}


Measured memory_bytes: 7828
INF = float("inf")

N, M = map(int, input().split())

dp = [INF] * (2 ** N)
dp[0] = 0

for _ in range(M):
    a, b = map(int, input().split())
    C = [int(i) for i in input().split()]
    mask = sum(1 << (c - 1) for c in C)
    for i in range(len(dp)):
        if dp[i | mask] > dp[i] + a:
            dp[i | mask] = dp[i] + a

ans = dp[-1]
print(-1 if ans == INF else ans)


Measured memory_bytes: 3188
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        int N = int.Parse(Console.ReadLine());
        
        double sum = 0;
        for(int i = 0; i < N; i++)
        {
            string[] a = Console.ReadLine().Split(' ');
        
            if(a[1] == "JPY") 
            {
                sum += double.Parse(a[0]);
            }
            else
            {
                sum += double.Parse(a[0]) * 380000;
            }
           
            
            
        }
        Console.WriteLine(sum);
       
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(){
  int a;
  scanf("%d", &a);
  for(int i = 1; i <=9; ++i){
    for(int j = 1; j <= 9; ++j){
      if(a == i*j){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef unsigned long long LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long double a;
    long double b;
    cin >> a >> b;
    //  c=b*100;
    // LL s=a*c;
    // s/=100;
    cout << (LL)(a*b) << '\n';
    return 0;
}

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

using namespace std;

int main(){
 int n; 
  cin >>  n;
  
  vector<int> a(n+1);
  for(int i=1;i<=n;i++){
   cin >> a[i];
  }
  
  int res=0;
  for(int i=1;i<=n;i++){
   if(a[a[i]]==i) res++;
  }
   cout << res/2 << endl;
}


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

const int nmax = 100010;
int deg[nmax],dp[nmax];
bool fix[nmax];
vector < int > graph[nmax];
int N,u;
bool check2(int x,int B, vector<int>& kids)
{
	int l = 0, r = kids.size() - 1;
	if((kids[x]+1) > B) return false;
	while( l < r)
	{
		if(l == x) l++;
		if(r == x) r--;
		if(l >= r  || r < 0) return true;
		if((kids[l] + kids[r]+2 )> B) return false;
		l++,r--;
	}
	return true;
}
bool dfs(int u, int x)
{
	fix[u] = true;
	bool ret = true;
	//cout << "in vertex " << u << " trying " << x << endl;
	vector< int > kids;
	for(int i = 0; i < graph[u].size(); ++i)
	{
		if(fix[graph[u][i]]) continue;
		ret&=dfs(graph[u][i],x);
		kids.push_back(dp[graph[u][i]]);
	}
	if(!ret) return ret;
	bool isfake = false;
	if((kids.size()&1)==0){ isfake = true; kids.push_back(-1);}
	sort(kids.begin(), kids.end());
	int l = 0, r = kids.size() - 1;
	
	//cout << "out to " << u;
	//cout << "\n\t";
	//for(int i = 0 ; i < kids.size(); ++i)
	//	cout << kids[i] << ' ';
	//cout << endl;
	bool isGood = check2(r, x, kids);
	while((r - l) > 1)
	{
		int mid = (r+l) >> 1;
		if(check2(mid, x, kids))
			r = mid;
		else
			l = mid;
	
	}
	if(check2(l, x, kids)) r = l;
	if(!isGood) return false;
	//cout << "\tchose" << kids[r] << endl;
	dp[u] = kids[r]+1;
	return true;
}
bool check(int x)
{
	for(int i = 1;i<=N;++i)dp[i]=N,fix[i]=false;
	return dfs(u,x);
}
int bs()
{
	int l = 1, r = N-1;
	while((r-l) > 1)
	{
		int mid = (l+r) >> 1;
		if(check(mid))
			r = mid;
		else
			l = mid;
		//cout << l << ' ' << r << ' ' << mid << endl;
	}
	if(check(l))
		return l;
	return r;

}
int main()
{
	cin >> N;
	for(int i = 0 ;i < N-1;++i)
	{
		int x,y;
		cin >> x >> y;
		graph[x].push_back(y);
		graph[y].push_back(x);
		deg[x]++;
		deg[y]++;
	}
	int A=0,B=0;
	for(int i = 1;i<=N;++i)
	{
		if(deg[i]&1) A++;
		if(deg[i] == 1) u = i;
	}
	A = (A+1)/2;
	cout << A << ' ' << bs() << endl;
}

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


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

  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }

  // dp[i] = 足場iまでの最適コスト
  vector<int> dp(N+2,INT_MAX); // 余分に2個確保しておく
  dp[0] = 0;
  for(int i=0; i<N; i++){
    dp[i+1] = min(dp[i+1], dp[i]+abs(h[i]-h[i+1]));
    dp[i+2] = min(dp[i+2], dp[i]+abs(h[i]-h[i+2]));
  }

  cout << dp[N-1] << endl;
  
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
const double pi=4*atan(1.0);
const int mod=1e9+7;
ll a[200005];
int main()
{    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        a[i]=i;a[i]+=a[i-1];
    }
    ll ans=1;
    if(k<=n)
    {
        for(int i=k;i<=n;i++)
        {
            ans+=a[n]-a[n-i]-a[i-1]+1;
            ans=ans%mod;
        }
        printf("%lld\n",ans);
    }else printf("1\n");
    return 0;
}



Measured memory_bytes: 5312
/*input
1 2
3 3
3
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
void solve()
{
	lld a,v,b,w;
	cin >> a >> v >> b >> w;
	lld tm;
	cin >> tm;
	lld rel=abs(a-b);
	if(w>v){
		cout << "NO" << endl;
		return;
	}
	lld diff=(v-w)*tm;
	if(diff>=rel){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 3636
def get(S):
    return list(map(S, input().split()))

N, M, X = get(int)
A = get(int)

cost = [0 for _ in range(0, N + 2)]

for i in A:
    cost[i] = 1

L = sum(cost[0 : X + 1])
R = sum(cost[X : N + 1])
print(min(L, R))


Measured memory_bytes: 3060
require 'set'
io = STDIN
def expand(current_pool,cnt)
  pool=Set.new
  current_pool.each do |n|
    pool.add(n+cnt)
    pool.add(n-cnt)
  end
  pool
end
s=io.gets.chomp
top=s.slice!(/^F*/)
acts=s.chars
      .chunk_while{|x,y|x==y}
      .map{|str|[str[0],str.size]}
x,y=io.gets.split.map(&:to_i)
ct=1
xpool=Set[top.size]
ypool=Set[0]
acts.each do |act|
  id,cnt=act
  if id=="F"
    if ct.odd?
      xpool=expand(xpool,cnt)
    else
      ypool=expand(ypool,cnt)
    end
  else
    ct+=cnt
  end
end
puts xpool.include?(x) && ypool.include?(y) ? 'Yes' : 'No'


Measured memory_bytes: 89160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,p;
  cin >> N;
  int flag=0;
  for(int i=1;i<N+1;i++){
  	cin >> p;
    if(i!=p) flag++;
  }
  if(flag==0 || flag==2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int[] input = new int[3];
            for(int i = 0; i < input.length; i++) input[i] = sc.nextInt();

            Arrays.sort(input);
            int answer = 0;
            int max_mod = input[2] % 2;
            if(input[0] % 2 == max_mod && input[1] % 2 == max_mod) {
                // Nothing to do
            } else if(input[0] % 2 != max_mod && input[1] % 2 != max_mod) {
                answer++;
            } else {
                answer += 2;
                //System.out.println("mod");
            }

            int max = input[2];
            for(int i = 0 ; i < 2; i++) {
                //System.out.println((max - input[i]) / 2);
                answer += (max - input[i]) / 2;
            }
            System.out.println(answer);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <complex>
using namespace std;

#define EPS (1e-10)

typedef complex<double> P;

double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

int is_intersected_ls(P a1, P a2, P b1, P b2) {
	return
		( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
		( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

P intersection_ls(P a1, P a2, P b1, P b2) {
	P b = b2-b1;
	double d1 = abs(cross(b, a1-b1));
	double d2 = abs(cross(b, a2-b1));
	double t = d1 / (d1 + d2);

	return a1 + (a2-a1) * t;
}

double area(vector<P> v){
	int n = v.size();
	double res = 0.0;

	for(int i=0;i<n;i++){
		res += cross(v[i],v[(i+1)%n]);
	}
	return fabs(res)/2;
}

int main(void){
	P s[3],g[3];

	while(1){
		for(int i=0;i<3;i++){
			cin>>s[i].real()>>s[i].imag()>>g[i].real()>>g[i].imag();
			if(s[i] == P(0,0) && g[i] == P(0,0)) return 0;
		}

		if(!is_intersected_ls(s[0],g[0],s[1],g[1]) ||
			 !is_intersected_ls(s[1],g[1],s[2],g[2]) ||
			 !is_intersected_ls(s[2],g[2],s[0],g[0]))
			cout<<"kyo\n";
		else{
			vector<P> v;
			v.push_back(intersection_ls(s[0],g[0],s[1],g[1]));
			v.push_back(intersection_ls(s[1],g[1],s[2],g[2]));
			v.push_back(intersection_ls(s[2],g[2],s[0],g[0]));

			double a = area(v);
			if(a >= 1900000) cout<<"dai-kichi\n";
			else if(a >= 1000000) cout<<"chu-kichi\n";
			else if(a >= 100000) cout<<"kichi\n";
			else if(a > 0) cout<<"syo-kichi\n";
			else cout<<"kyo\n";
		}
	}

	return 0;
}

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

int main() {
string we;
cin >> we;
if (we == "SUN") {
    cout << 7 <<endl;
}
if (we == "MON") {
    cout << 6 <<endl;
}
if (we == "TUE") {
    cout << 5 <<endl;
}
if (we == "WED") {
    cout << 4 <<endl;
}
if (we == "THU") {
    cout << 3 <<endl;
}
if (we == "FRI") {
    cout << 2 <<endl;
}
if (we == "SAT") {
    cout << 1 <<endl;
}
}

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

using namespace std;

int main (){
	int n;
  	double t=0.0;
  
  	cin>>n;
  
  	vector<double> v(n);
   
  	for(int i=0;i<n;i++){
    	cin>>v.at(i);
     }
	sort(v.begin(), v.end());
  	
  	for(int i=0;i<n-1;i++){
    	t=(v.at(i)+v.at(i+1))/2.0;
      	v.at(i+1)=t;
    	
    }
  	 cout << fixed << setprecision(10);
  	 cout<<t<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
int main(){
	ll n;
	cin>>n;
	ll a[n],b[n];
	rep(i,0,n){
		cin>>a[i];
	}
	rep(i,0,n)cin>>b[i];
	rep(i,0,n)a[i]-=b[i];
	ll ans=0;
	rep(i,0,n){
		if(a[i]>0)ans+=a[i];
		else continue;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
 
int main() {
    int n, t, a;
    cin >> n >> t;
    int cur = 1;
    int rez = cur;
    for (int ctr1 = 1; ctr1 < n; ++ctr1) {
        cin >> a;
        if (t >= a)
            ++cur;
        else cur = 1;
        rez = max(rez, cur);
        t = a;
    }
    cout << rez - 1 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define H 250

typedef struct{
  int k;
  int l;
  int r;
  int p;
}Node;

Node A[H];

int left(int i){return i*2;}
int right(int i){return (i*2)+1;}

int main(){
  int n,i;

  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    scanf("%d",&A[i].k);
  }

  for(i=1;i<=n;i++){
    if(i/2>=1){
      A[i].p=A[i/2].k;
    }
    if(left(i)<=n){
      A[i].l=A[left(i)].k;
    }
    if(right(i)<=n){
      A[i].r=A[right(i)].k;
    }

    printf("node %d: key = %d, ",i,A[i].k);

    if(A[i].p){
      printf("parent key = %d, ",A[i].p);
    }
    if(A[i].l){
      printf("left key = %d, ",A[i].l);
    }
    if(A[i].r){
      printf("right key = %d, ",A[i].r);
    }

    printf("\n");
  }
  
  return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int a[3];
int main(){
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    if((a[0]==a[1] && a[1]!=a[2]) || (a[1]==a[2] && a[0]!=a[1]))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, ans=0, i, j, k, tmp;
    vector<long long> l;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> tmp;
        l.push_back(tmp);
    }
    sort(l.begin(), l.end());
    for(i=0;i<n-2;i++){
        for(j=i+1;j<n-1;j++){
            for(k=j+1;k<n;k++){
                if(l[i]<l[j]+l[k] && l[j]<l[i]+l[k] && l[k]<l[i]+l[j]) ans++;
            }
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
 private static Map<Integer, String> map = new HashMap<Integer, String>();
 static {
	map.put(771, "A");
	map.put(16843009, "B");
	map.put(15, "C");
	map.put(33153, "D");
	map.put(1539, "E");
	map.put(131841, "F");
	map.put(387, "G");
 }

 public static void main(String[] args) {
	Scanner in = new Scanner(System.in).useRadix(2);
	int i = 0;
	while (in.hasNext()) {
	 i <<= 8;
	 i |= in.nextInt();
	 if (Integer.bitCount(i) == 4) {
		i >>>= Integer.numberOfTrailingZeros(i);
		System.out.println(map.get(i));
		i = 0;
	 }
	}
 }
}

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

int N,A,B,C;
vector<int> ls(8);

int mps(int n,int a,int b, int c){
  if(n==N){
    if (a!=0&&b!=0&&c!=0) return abs(a-A)+abs(b-B)+abs(c-C)-30;
    else return pow(10,9);
  }
  int no_add=mps(n+1,a,b,c);
  int add_a =mps(n+1,a+ls.at(n),b,c)+10;
  int add_b =mps(n+1,a,b+ls.at(n),c)+10;
  int add_c =mps(n+1,a,b,c+ls.at(n))+10;
  return min(min(no_add,add_a),min(add_b,add_c));
}

int main() {
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){cin>>ls.at(i);}
  int min_mps=mps(0,0,0,0);
  cout<<min_mps<<endl;
}

Measured memory_bytes: 256