akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

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

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

    for (int i = 2; i < 10; i++) {
        if (n / i < 10 && n % i == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
typedef pair<int,int> pii;
#define mp make_pair
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=1000010;
int h,w,n,ans,mx[N<<1],tag[N<<1];
struct node
{
	int x,y;
	bool operator<(const node &b)const{return x<b.x||(x==b.x&&y<b.y);}
}p[N];
void puttag(int o,int x){tag[o]+=x;mx[o]+=x;}
void pushdown(int o){puttag(o<<1,tag[o]);puttag(o<<1|1,tag[o]);tag[o]=0;}
void pushup(int o){mx[o]=max(mx[o<<1],mx[o<<1|1]);}
void modify(int o,int l,int r,int posl,int posr,int v)
{
	if(posl<=l&&r<=posr){puttag(o,v);return;}
	int mid=(l+r)>>1;pushdown(o);
	if(posl<=mid)modify(o<<1,l,mid,posl,posr,v);
	if(mid<posr)modify(o<<1|1,mid+1,r,posl,posr,v);
	pushup(o);
}
pii a[N],b[N];
//a是单调减，b是单调增。
void solve()
{
	memset(tag,0,sizeof(tag));memset(mx,0,sizeof(mx));
	sort(p+1,p+n+1);int l=0,r=0;
	for(int i=1;i<n;i++)
	{
		if(p[i].y<=h/2)
		{
			int lst=i-1;
			while(l&&p[i].y>a[l].second)
			{
				modify(1,1,n,a[l].first,lst,a[l].second-p[i].y);
				lst=a[l].first-1;l--;
			}
			if(lst!=i-1)a[++l]=mp(lst+1,p[i].y);
		}
		else
		{
			int lst=i-1;
			while(r&&p[i].y<b[r].second)
			{
				modify(1,1,n,b[r].first,lst,p[i].y-b[r].second);
				lst=b[r].first-1;r--;
			}
			if(lst!=i-1)b[++r]=mp(lst+1,p[i].y);
		}
		modify(1,1,n,i,i,h-p[i].x);
		a[++l]=mp(i,0);b[++r]=mp(i,h);
		ans=max(ans,p[i+1].x+mx[1]);
	}
}
int main()
{
	w=gi();h=gi();n=gi();
	for(int i=1;i<=n;i++)p[i].x=gi(),p[i].y=gi();
	p[++n]=(node){0,0};p[++n]=(node){w,h};
	solve();
	for(int i=1;i<=n;i++)swap(p[i].x,p[i].y);swap(h,w);
	solve();
	printf("%d\n",ans*2);
	return 0;
}


Measured memory_bytes: 25984
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

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

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

	ll ans = L;
	rep(i, N)
	{
		if (abs(ans) > abs(L + i))
		{
			ans = L + i;
		}

	}

	bool f = false;
	int sum = 0;
	int val = 0;
	rep(i, N)
	{
		val = L + i;

		if (!f && val == ans)
		{
			f = true;
			continue;
		}

		sum += val;
	}

	cout << sum << endl;

	return 0;
}

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

int main(){
    int h,n;
    cin >> h >> n;
    while(n-- > 0){
        int a;
        cin >> a;
        h -= a;
        if(h <= 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#define M1 1000000007
#define M2 1000000009
#define ll long long 
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define f0(i, n) for (int i = 0; i < (int)(n); ++i)
#define f1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fc0(i,l,r) for(int i = (int)(l); i<(int)(r); ++i)
#define fc1(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define fr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
 
void init()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      freopen("error.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
}
 
signed main()
{
    init();
    
    int n,k,t;
    cin>>n>>k;
    priority_queue<int,vector<int>,greater<int>> v;
    f0(i,n){cin>>t;v.push(t);}
    int s=0,i=0;
    while(i<k)
    {
      s=s+v.top();
      v.pop();
      i++;
    }
    cout<<s<<endl;

    cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;
#define P 1000000007
#define N_MAX 2000000
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}

int main(int argc, char const *argv[]) {
  init();
  ll N, K;
  std::cin >> N >> K;
  for(int i=1;i<=K;i++){
    ll kk=K-i;
    ll blue=comb(kk+i-1, kk)%1000000007;
    ll rr=N-K-(i-1);
    if(rr<0){
      std::cout << 0 << '\n';
      continue;
    }
    ll red=comb(rr+i, rr);
    std::cout << (blue*red)%1000000007 << '\n';
  }
  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> v(8);
  rep(i, 8) v[i] = 0;
  int m;
  int cnt = 0;
  int mi = 101, ma = -1;
  rep(i, n){
    cin >> m;
    if(m >= 3200) cnt++;
    else if(m >= 2800) {
      mi = min(mi, ++v[7]);
      ma = max(ma, ++v[7]);
    }
    else if(m >= 2400) {
      mi = min(mi, ++v[6]);
      ma = max(ma, ++v[6]);
    }
    else if(m >= 2000) {
      mi = min(mi, ++v[5]);
      ma = max(ma, ++v[5]);
    }
    else if(m >= 1600) {
      mi = min(mi, ++v[4]);
      ma = max(ma, ++v[4]);
    }
    else if(m >= 1200) {
      mi = min(mi, ++v[3]);
      ma = max(ma, ++v[3]);
    }
    else if(m >= 800) {
      mi = min(mi, ++v[2]);
      ma = max(ma, ++v[2]);
    }
    else if(m >= 400) {
      mi = min(mi, ++v[1]);
      ma = max(ma, ++v[1]);
    }
    else{
      mi = min(mi, ++v[0]);
      ma = max(ma, ++v[0]);
    }
  }
  int ans = 0;
  rep(i, 8){
    if(v[i]) ans++;
  }
  cout << (ans > 0 ? ans : 1) << " ";
  ans += cnt;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	int K, N; cin >> K >> N;
	vector<int> A(N); rep(i, 0, N)cin >> A[i];
	int ans = abs(K + A[0] - A[N - 1]);
	rep(i, 1, N)
		ans = more(ans, abs(A[i] - A[i - 1]));
	ans = K - ans;
	cout << ans << endl;

	return 0;
}


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

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];

  sort(ALL(h));

  rep(i, k) {
    if(h.size() == 0) break;
    h.pop_back();
  }

  cout << SUM(h) << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	string str;
	while(cin>>str,str!="0"){
		int i;
		int a,b;
		a=b=0;
		for(i=1;i<str.size();i++){
			if(str[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		cout<<a<<" "<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
//const int INF=0x3f3f3f3f,maxn=;
//vector<int>v[maxn];
//map<int,string>mp[maxn];
//queue<int>q[maxn];/
//int a[naxm],n,m;
int main()
{
	int i,j,k,ans=0;
	long long x,y;
	cin>>x;
	cout<<(1000-x%1000)%1000<<endl;
	return 0;
}


Measured memory_bytes: 3540
#include <iostream>
using namespace std;
int main(void){
   int K,S,cnt=0;
   cin >> K>>S;
   int flag=0;
   for(int x=0;x<=K;x++){
       for(int y=0;y<=K;y++){
           int z = S -x-y;
            if(x+y<=S){
                if(z<=K && z>=0){
                    cnt++;
                }
            }
           
       }
   }
    cout<<cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;


int main(int argc, char const *argv[]) {
	string str;
	std::cin >> str;
	if (str.length() >= 4 && str[0] == 'Y' && str[1] == 'A' && str[2] == 'K' && str[3] == 'I') {
		std::cout << "Yes" << '\n';
	}
	else {
		std::cout << "No" << '\n';
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<climits>
#include<set>
#include<map>
#include<stack>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin >> n;
	string s = "";
	stack<string>st;
	vector<char>c = { '3','5','7' };
	st.push("3");
	st.push("5");
	st.push("7");
	int ans = 0;
	while (!st.empty()) {
		string a = st.top(); st.pop();
		if (a.size() == 10) {
			continue;
		}

		ll check = stoll(a);
		bool anscheck = true;
		if (check > n) {
			anscheck = false;
		}
		for (ll j = 0; j < c.size(); j++) {
			bool flag = false;
			for (ll i = 0; i < a.size(); i++) {
				if (a[i] == c[j]) {
					flag = true;
				}
			}
			if (flag) {

			}
			else {
				anscheck = false;
			}
		}
		if (anscheck) {
			//cout << a << endl;
			ans++;
		}

		for (ll i = 0; i < c.size(); i++) {
			st.push(a + c[i]);
		}



	}

	cout << ans << endl;

	//while (1);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int n; cin>>n;
	map<int,int> mp;
	rep(i,0,n){
		int a; cin>>a;
		mp[a]++;
	}
	if(mp.size()==n)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 13004
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        long sum = 0;
        for(int a=1; a<=N; a++){
            for(int b=1; b<=N; b++){
                for(int c=1; c<=N; c++){
                    sum += gcd(gcd(a,b), c);
                }
            }
        }
        println(sum);
    }

    static long gcd (long a, long b) {
        long temp;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return b;
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
int N; 
long long L; 
string S[100010]; 
vector<int> E[200010]; 
long long depth[200010]; 
long long G(long long l){
	long long prod = 1LL; 
	long long tmp = l; 
	while(!(tmp & 1)){
		prod <<= 1; tmp >>= 1; 
	}
	return prod; 
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> L; 
	for(int i = 0; i < N; i++) cin >> S[i]; 
	int v0 = 1; int v1 = 100001; 
	for(int i = 0; i < N; i++){
		int now = 0; 
		for(int j = 0; j < S[i].size(); j++){
			int num = S[i].at(j) - '0'; 
			bool exist = false; 
			for(int k = 0; k < E[now].size(); k++){
				if(num == 0 && E[now].at(k) <= 100000){
					now = E[now].at(k); exist = true; break; 
				}else if(num == 1 && E[now].at(k) > 100000){
					now = E[now].at(k); exist = true; break; 
				}
			}
			if(exist) continue;
			if(num == 0){
				E[now].push_back(v0); 
				depth[v0] = depth[now] + 1; 
				now = v0++; 
			}else if(num == 1){
				E[now].push_back(v1); 
				depth[v1] = depth[now] + 1; 
				now = v1++; 
			}
		}
	}
	long long grundy = 0LL; 
	for(int i = 0; i <= 200005; i++){
		if(E[i].size() == 1){
			grundy ^= G(L - depth[i]); 
		}
	}
	cout << (grundy ? "Alice" : "Bob") << "\n";
}

Measured memory_bytes: 9808
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

#include <queue>
#include <cstdio>

#include <list>
#include <set>
#include <map>


#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DIV_NUM (1000000007)

using namespace std;


bool seen[501][501];

int N, W;
int X, Y, Z;
int A, B, C;

int con;
//    string S;


char field[501][501];
int  dist[501][501];

typedef pair<int, int> P;
queue<P> que;


//typedef vector<vector<int>> v;
vector<double> vi;
vector<double> wi;


set<int> s1;
map<string, int> m1;
map<string, int> m2;

int weight[110], value[110];
int dp[110][10010];


int main(){
  
  
    // input data
    string ss ;


    cin >> X >> Y >> Z;

  
    //        std::cout << m1[ss] << ss  << "\n";



    
    std::cout << Z << " " <<  X << " " << Y << "\n";

        return 0;

}


Measured memory_bytes: 256
/*
      author : Nishikawa
      created: 07.08.2020 21:15:51
*/

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


int main(){
    int K;
    cin >> K;
    string S;
    cin >> S;
    if((int)S.size()<=K){
        cout << S << endl;
        return 0;
    }      
    S.erase(S.begin()+K,S.end());
    string dots("...");
    S=S+dots;
    cout << S << endl;
    return 0;
}

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


void solve(long long N, std::vector<long long> H){
    ll ans=0;
    ll temp=0;
    rep(i,N-1){
        if(H[i]>=H[i+1])temp++;
        else {
        ans=max(temp,ans);
        temp=0;
        }
    }
    ans=max(temp,ans);

    cout<<ans<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::cout<<std::fixed<<std::setprecision(10);//誤差小数10桁まで
    long long N;
    scanf("%lld",&N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, std::move(H));
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int cnt_even = 0, cnt_odd = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a & 1)
      cnt_odd++;
    else
      cnt_even++;
  }

  ll all_case = (ll)pow(3, n);
  ll odd_case = (ll)pow(2, cnt_even);
  ll ans;
  cout << all_case - odd_case << endl;
}

Measured memory_bytes: 640
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

sys.setrecursionlimit(1000000)

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    K, N = LI()
    A = LI()

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

    print(K - res[-1])

if __name__ == '__main__':
    main()

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


int main(){
  int n,m,i,j;
  char Kim[2][1000000],Jong[1000000];
  for(i=0;i<1000000;i++){
    Jong[i]=0;
    Kim[0][i]=0;
    Kim[1][i]=0;
  }

  while(1){

  cin >> n;
  if(n == 0)break;

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

  cin >> m;

  for(i=0;i<m;i++){
    cin >> Jong[i];
  }


  for(i=0;i<m;i++){
    for(j=0;j<n;j++){
      if(Jong[i] == Kim[0][j]){Jong[i]=Kim[1][j];
	break;
    }
      }
  }

  for(i=0;i<m;i++){
    cout << Jong[i];
    }
  cout<< endl;
  }
}

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

using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    int ans = 0;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
           // cout << "i = " << i << " j = " << j <<"\n";
            ans += v[i] * v[j];
           // cout << ans << "\n";
        }
    }
    cout << ans << "\n";
}















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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int a, b; cin >> a >> b;
	if (b % a == 0) cout << a + b << '\n';
	else cout << b - a << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace::std;

long int N, a[100000],A,ans[2];

int min(int x, int y) {
	if (x > y)return y;
	return x;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	A = 0;
	//偶数番目が+
	for (int i = 0; i < N; i++) {
		A += a[i];
		if (A >= 0&&i%2==0) {
			ans[0] += A + 1;
			A = -1;
		}
		if (A <= 0 && i % 2 == 1) {
			ans[0] += -A + 1;
			A = 1;
		}
	}
	A = 0;
	//紀数番目が+
	for (int i = 0; i < N; i++) {
		A += a[i];
		if (A >= 0 && i % 2 == 1) {
			ans[1] += A + 1;
			A = -1;
		}
		if (A <= 0 && i % 2 == 0) {
			ans[1] += -A + 1;
			A = 1;
		}
	}

	cout << min(ans[0],ans[1]);
	return 0;
		}


	


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

int main() {
	string n;
	cin >> n;
	string ans = "No";
	for (int i = 0; i < 4-2; i++) {
		if(n.at(i) == n.at(i+1) && n.at(i+1) == n.at(i+2)) {
			ans = "Yes";
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
int main(){
    long long n, s, ans=0, check;
    cin >> n;
    vector<long long> S;
    for(int i=0;i<n;i++){
        cin >> s;
        S.push_back(s);
        ans += s;
    }
    sort(S.begin(), S.end());
    if(ans%10==0){
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                check = ans - S[j];
                if(check%10!=0){
                    ans = check;
                    break;
                }
            }
            if(ans%10!=0){
                break;
            }
          	ans -= S[i];
        }
    }
    
    cout << ans << endl;
    return 0;
 
}


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

int main() {
    int A,B;
    cin >>A>>B;
    if(B==1){
        cout << 0 <<endl;
    return 0;
    }
    int count =A;
    int num=1;
    while(B-count>0){
        count += A-1;
        num++;
    }
    
    cout <<num <<endl;
}

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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define forall(it, c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

template <typename T> inline void read(T &x) {
	x = 0; bool f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	for (;  isdigit(c); c = getchar()) x = x * 10 + (c & 15);
	if (!f) x = -x;
}

const ll INF = 5e18;

ll mul(ll x, ll y) {
	if (y && x >= INF / y) return INF;
	return x * y;
}

ll add(ll x, ll y) {
	if (x >= INF - y) return INF;
	return x + y;
}

const int coef[] = {2, 3, 5};
ll cost[3], d;
map <ll, ll> mem;

ll f(ll n) {
	if (!n) return 0;
	if (mem.count(n)) return mem[n];
	ll ans = mul(d, n);
	rep(i, 3) {
		ans = min(ans, f(n / coef[i]) + cost[i] + mul((n % coef[i]), d));
		if (n / coef[i] + 1 != n)
			ans = min(ans, f(n / coef[i] + 1) + cost[i] + mul(coef[i] - (n % coef[i]), d));
	}
	mem[n] = ans;
	return ans;
}

void Main() {
	ll n; read(n);
	read(cost[0]); read(cost[1]); read(cost[2]); read(d);
	mem.clear();
	printf("%lld\n", f(n));
}

int main() {
	int t; read(t);
	while (t --) Main();
	return 0;
}


Measured memory_bytes: 5000
//
// Created by 10034 on 2020/7/27.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long n,m,k;
long long a[200010],b[200010];
vector<long long > v;
int main(){
    cin>>n>>m>>k;
    for(int i=1;i<=n;++i) cin>>a[i],a[i]=a[i]+a[i-1];
    for(int i=1;i<=m;++i) cin>>b[i],b[i]=b[i]+b[i-1];
    for(int i=0;i<=m;++i){
        v.push_back(b[i]);
    }
    long long  ans=0;
    for(int i=0;i<=n;++i){
        if(a[i]<=k){
            int t=upper_bound(v.begin(),v.end(),k-a[i])-v.begin();
            t--;
            ans=max(ans,1ll*i+t);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8080
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)>abs(x-b))
		cout<<"B"<<endl;
	else
		cout<<"A"<<endl;

	return 0;

}


Measured memory_bytes: 256
/*
 * Created by KeigoOgawa
 */


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <cmath>

#define INF (int)1e8
#define EPS 1e-10
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)
#define debug(x) cout << #x << ": " << x << endl
#define all(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;

string s;
ll ans = 0;


// 残りの+を入れる数
bool dfs(int n, ll tmp, string ss) {
  if (n == 0) {
    ans += tmp + atoi(ss.c_str());
    return true;
  }
  if (ss.size() < 2 && n > 0) {
    return false;
  }
  REP(i, ss.size() - 1) {
    string tt = ss.substr(0, i + 1);
    dfs(n - 1, tmp + atoi(tt.c_str()), ss.substr(i + 1));
  }
  return true;
}

void solve() {
  REP(i, s.size() - 1) {
    dfs(i + 1, 0, s);
  }

  cout << ans + stol(s) << endl;
}

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

  cin >> s;
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

//[a,b]の区間でn個の乱数を生成
vector<int> Rand(int l,int r,int n) {
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand(l,r);
    vector<int> res;
    for(int i = 0;i < n;i++) {
        res.push_back(rand(mt));
    }
    return res;
}

int D = 365;
vector<int> c(26);
vector<vector<int>> s(D,vector<int>(26));

int score(vector<int> res) {
    int ret = 0;
    vector<int> last(26,-1);
    for(int i = 0;i < D;i++) {
        ret += s.at(i).at(res.at(i) - 1);
        last.at(res.at(i) - 1) = i;
        for(int j = 0;j < 26;j++) {
            ret -= c.at(j) * (i - last.at(j));
        }
        cout << ret << endl;
    }
    return ret;
}

int main() {
    cin >> D;
    for(int i = 0;i < 26;i++) {
        cin >> c.at(i);
    }
    for(int i = 0;i < D;i++) {
        for(int j = 0;j < 26;j++) {
            cin >> s.at(i).at(j);
        }
    }
    vector<int> cnt(D);
    for(int i = 0;i < D;i++) {
        cin >> cnt.at(i);
    }
    score(cnt);
}

Measured memory_bytes: 3656
n,a,b=map(int,input().split())
mod=10**9+7

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result%=mod

    return result


allp=pow(2,n,mod)-1
ans=(allp-cmb(n,a)%mod-cmb(n,b)%mod+mod)%mod
if n==2:
    ans=0

print(ans)

Measured memory_bytes: 108236
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

ll lcm(ll u, ll v) {
  return u*v/gcd(u,v);
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

ll n,a[11000],b[11000],c[11000],p[11000],ans=0;
ll rop[11000]={},k=0;
vector<vector<ll>>d(11000,vector<ll>());

void mon(ll x)
{
  if(rop[x]==1)return;
  rop[x]=1;
  p[x]=c[k];
  k++;
  rep(i,d[x].size())mon(d[x][i]);
}

int main()
{

  cin >> n;
  rep(i,n-1){
    cin >> a[i] >> b[i];
    d[a[i]-1].push_back(b[i]-1);
    d[b[i]-1].push_back(a[i]-1);
  }
  rep(i,n)cin >> c[i];
  SORT(c,n);
  ROF(i,1,n)ans+=c[i];
  printf("%lld\n",ans);
  mon(0);
  rep(i,n)printf("%lld ",p[i]);
}

Measured memory_bytes: 1536
#include <stdio.h>

int abs(int x){
  if(x > 0) return x;
  else return -x;
}

int main(){
  int s[10];
  char c;
  int ret,num = 0;
  while(1){
    ret = scanf("%c",&c);
    if(ret == EOF || c == '\n') break;
    s[num] = c - '0';
    num++;
  }
  int min = 1000,bin;
  for(int i = 0; i < num - 2; ++i){
    bin = abs(100*s[i] + 10*s[i+1] + s[i+2] - 753);
    if(min > bin) min = bin;
  }
  printf("%d\n",min);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int MAX = 999999999;

int main(){
    int h, w;
    cin >> h >> w;

    int dx[] = {0, 1, 0, -1};
    int dy[] = {-1, 0, 1, 0};

    vector<vector<char>> picture(h, vector<char>(w));
    rep(i, h){
        rep(j, w) cin >> picture[i][j];
    }

    bool success = true;
    rep(i, h){
        rep(j, w){
            if(picture[i][j] != '#') continue;
            bool isSharp = false;
            rep(k, 4){
                if(0 <= i+dy[k] && i+dy[k] < h && 0 <= j+dx[k] && j+dx[k] < w &&  picture[i+dy[k]][j+dx[k]] == '#') isSharp = true;
            }
            if(!isSharp) success = false;
        }
    }

    if(success){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

L = I()
len_edge = L/3
print(len_edge**3)

Measured memory_bytes: 9324
#!/usr/bin/env ruby

if __FILE__ == $0
	loop do
		h, w = gets.split.map { |x| x.to_i }
		if h == 0 and w == 0 then
			break
		end

		ht = "#"*w+"\n"
		md = "#"+"."*(w-2)+"#\n"
		puts ht + md*(h-2) + ht + "\n"
	end
end



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

int main(void) {
  int a,b;
  cin >> a >> b;

  if(a%2==0 || b%2==0){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,m,k = map(int,input().split())
mod = 998244353

fact = [1,1]
finv = [1,1]
inv = [0,1]

for i in range(2,n+5):
    fact.append((fact[-1]*i)%mod)
    inv.append((inv[mod%i]*(mod-mod//i))%mod)
    finv.append((finv[-1]*inv[-1])%mod)
f = pow(m-1,mod-2,mod) 
def nCr(n,r,mod):
    if r > n:
        return 0
    else: 
        return fact[n]*finv[r]*finv[n-r]%mod

ans = 0
for i in range(k+1):
    ans += nCr(n-1,i,mod)*m*pow(m-1,n-1-i,mod)%mod
    ans %= mod
print(ans%mod)


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

#define int long long
#define all(x) x.begin(), x.end()
#define rev(x) x.rbegin(), x.rend()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pi 3.141592653589793238
#define mp make_pair
#define pb push_back
#define precise cout<<fixed<<setprecision(20)
#define ff first
#define ss second
#define T int t;cin>>t;rep(mmm,0,t)
#define uniq(v) v.resize(distance(v.begin(),unique(all(v))))

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;

const int N=1e18;
int mod=1000000007;
//mod=998244353;

int min(int a,int b){if(a<b) return a; else return b;}
int max(int a,int b){if(a>b) return a; else return b;}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int p, int q){if(p%q==0) return q; else{return gcd(q,p%q);}} 
int mul(int a,int b){return ((a%mod)*(b%mod))%mod;}
int sub(int a,int b){return (((a-b)%mod)+mod)%mod;}

void solve()
{
	int n,W;
	cin>>n>>W;
	vi v(n),w(n);
	rep(i,0,n)
	cin>>w[i]>>v[i];
	int sum=0;
	for(auto it:v)
	sum+=it;
	vi dp(sum+1,N);
	dp[0]=0;
	rep(i,0,n)
	{
		repr(value,sum-v[i],0)
		{
			dp[value+v[i]]=min(dp[value+v[i]],dp[value]+w[i]);
		}
	}
	int ans=0;
	rep(i,0,sum+1)
	{
		if(dp[i]<=W)
		ans=max(ans,i);
	}
	cout<<ans<<endl;
}

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

Measured memory_bytes: 3972
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			int C = in.nextInt();
			if(A + B >= C) {
				out.println("Yes");
			}else {
				out.println("No");
			}
		}
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


Measured memory_bytes: 22612
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class Pair
{
	public int X { get; private set; }
	public int Y { get; private set; }

	public Pair(int x, int y)
	{
		X = x;
		Y = y;
	}
}


public class C
{
	public static void Main()
	{
		int N = GetInt();

		List<Pair> reds = new List<Pair>(N);
		for(int i = 0; i < N; i++)
			reds.Add(new Pair(GetInt(), GetInt()));
		reds.Sort((a, b) => b.Y - a.Y);

		List<Pair> blues = new List<Pair>(N);
		for(int i = 0; i < N; i++)
			blues.Add(new Pair(GetInt(), GetInt()));
		blues.Sort((a,b) => a.X - b.X);

		int ans = 0;
		bool[] usedRed = new bool[N];
		for(int i = 0; i < N; i++)
		{
			Pair blue = blues[i];
			for(int j = 0; j < N; j++)
			{
				if(usedRed[j])
					continue;
				Pair red = reds[j];
				if((blue.X < red.X) || (blue.Y < red.Y))
					continue;
				ans++;
				usedRed[j] = true;
				break;
			}
		}

		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 11220
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
	}

	public void run() {
		Scanner sc = new Scanner();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long x = Math.max(a, Math.max(b, c));
		if (x % 2 != (a + b + c) % 2)
			++x;
		System.out.println((3 * x - a - b - c) / 2);
	}

	class Scanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[ptr++];
			else
				return -1;
		}

		private boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 22996
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << 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()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N;
    in1(N);

    if (N <= 111) outl(111);
    else if (N <= 222) outl(222);
    else if (N <= 333) outl(333);
    else if (N <= 444) outl(444);
    else if (N <= 555) outl(555);
    else if (N <= 666) outl(666);
    else if (N <= 777) outl(777);
    else if (N <= 888) outl(888);
    else if (N <= 999) outl(999);

    return 0;
}


Measured memory_bytes: 3680
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>

int main(void)
{
    int n,m;
    cin>>n>>m;
    int maxi = 100006;
    int mini = -1;
    rep(i,m)
    {
        int a,b;
        cin>>a>>b;
        maxi = min(maxi,b);
        mini = max(mini,a);

    }

    if(maxi<mini)
    {
        cout<<0<<endl;
        return 0;
    }
    cout<<maxi-mini+1<<endl;
}

Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000;
int N, M;
int a[MAX_N], b[MAX_N];

vector<int> G[MAX_N];

void add_edge(int v, int u) {
    G[v].push_back(u); G[u].push_back(v);
}


bool rec(int a, int b, int par, int v) {
    if (v == b) return false;
    if (v == a) return true;

    for (int i = 0; i < G[v].size(); ++i) {
        if (G[v][i] != par) {
            return rec(a, b, v, G[v][i]);
        }
    }
}

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

  cin >> N >> M;
  rep(i, M) cin >> a[i] >> b[i];
  rep(i, M) {--a[i]; --b[i];}

  rep(i, M) add_edge(a[i], b[i]);

  int c6 = 0, c4 = 0;
  vector<int> vc4;
  for (int v = 0; v < N; ++v) {
      if (G[v].size()%2 == 1) {
          cout << "No" << endl;
          return 0;
      }
      if (G[v].size() >= 6) {
          ++c6;
      } else if (G[v].size() >= 4) {
          ++c4;
          vc4.push_back(v);
      }
  }

  if (c6 > 0) {
      cout << "Yes" << endl;
      return 0;
  }

  if (c4 > 2) {
      cout << "Yes" << endl;
      return 0;
  }

  
  if (c4 == 2) {
      int a = vc4[0], b = vc4[1];
      for (int i = 0; i < G[a].size(); ++i) {
          if (rec(a, b, a, G[a][i])) {
              cout << "Yes" << endl;
              return 0;
          }
      }
  }

  cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 20;

int w, h, cnt;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
vs m(N);

void dfs(pii);

int main(void){
    for(; cin >> w >> h, w; cout << cnt << endl){
        cnt = 0;
        pii p;

        rep(y, h){
            cin >> m[y];
            rep(x, w) if(m[y][x] == '@') m[y][x] = '.', p = mp(x, y);
        }
        
        dfs(p);
    }

    return 0;
}

void dfs(pii p){
    if(p.X < 0 || w <= p.X ||
       p.Y < 0 || h <= p.Y || m[p.Y][p.X] == '#') return;

    cnt++;
    m[p.Y][p.X] = '#';
    
    rep(i, 4) dfs(mp(p.X + dx[i], p.Y + dy[i]));
}

Measured memory_bytes: 1228