akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll num = 0;
vvl dat;//l, r, h
vvl G = VV(101, 0, 0, ll);
vll h;
ll INF = 10000000000;
void f(ll par, ll l, ll r){
  ll minnum = INF;
  ll L = l;
  for(int i=l;i<r;i++){
    if(h[i]==0){
      if(minnum!=INF){
        if(par!=-1) G[par].push_back(num);
        dat.push_back(vll{L, i, minnum});
        num++;
        for(int j=L;j<i;j++) h[j] -= minnum;
        f(num-1, L, i);
      }
      L = i+1;
      minnum = INF;
      continue;
    }else{
      minnum = min(minnum, h[i]);
    }

    if(h[i]!=0&&i==r-1){
      if(minnum!=INF){
        if(par!=-1) G[par].push_back(num);
        dat.push_back(vll{L, i+1, minnum});
        num++;
        for(int j=L;j<=i;j++) h[j] -= minnum;
        f(num-1, L, i+1);
      }
    }
  }
}
ll P = 1000000007;
ll mpow(ll a, ll b, ll p = -1){
  ll ret = 1, num = a;
  if(p==-1){
    while(b>0){
      if(b%2) ret *= num;
      num = num * num;
      b /= 2;
    }
  }else{
    while(b>0){
      if(b%2) ret = (ret*num)%p;
      num = (num*num)%p;
      b /= 2;
    }
  }
  return ret;
}
vll dp1(101, 0);
vll dp2(101, 0);

void dfs(ll now, ll from){
  ll cnt = 0;
  for(auto to:G[now]){
    if(to==from) continue;
    cnt++;
  }
  if(!cnt){
    dp1[now] = mpow(2, dat[now][2], P);
    dp2[now] =
    (mpow(2, dat[now][1]-dat[now][0], P) + (dp1[now] - 2) + P)%P;
    return;
  }

  ll W = dat[now][1] - dat[now][0];
  dp1[now] = 1, dp2[now] = 1;

  ll s = 1, t = 1;
  for(auto to:G[now]){
    if(to==from) continue;
    dfs(to, now);
    //子全てが1のとき1になれる
    W -= dat[to][1] - dat[to][0];
    dp1[now] = (dp1[now] * dp1[to])%P;
    s = (s * (dp1[to] + dp2[to])%P)%P;
    t = (t * dp1[to])%P;
  }

  dp1[now] = (dp1[now] * mpow(2, dat[now][2], P))%P;
  ll a = ((mpow(2, dat[now][2], P)-2+P)%P *t)%P;
  ll b =(mpow(2, W, P)*s)%P;
  dp2[now] = (a + b)%P;
}

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  h = vll(n);
  re(i, n) std::cin >> h[i];
  f(-1, 0, n);
  dfs(0, -1);
  std::cout << dp2[0] << '\n';
  return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum;
 
  vector<int> vec (N); 
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  for(int i = 0; i < N-1; i++){
  	for(int j=i+1; j<N ; j++){
  	 sum += vec.at(i)*vec.at(j);
  	}
  	
  }
  
  cout << sum << endl;

  }

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

int main(){
  int N,M;
  cin>>N>>M;
  int l;
  int gcm;
  l=M/N;
  for (int i=l;i>=1;i--){
    if (M%i==0){
      gcm=i;
      break;
    }
  }
  cout<<gcm;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#define MAX_VIL_NUM 10

using namespace std;

int main(void){
	int n, a, b, c, i, j, con[MAX_VIL_NUM][MAX_VIL_NUM], used[MAX_VIL_NUM], distance[MAX_VIL_NUM], sum, ans_time, ans_vil, vil_num;
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		vil_num = 0;
		memset(con,-1,sizeof(con));
		for(i = 0;i < n;i++){
			scanf("%d%d%d",&a,&b,&c);
			con[a][b] = c;
			con[b][a] = c;
			vil_num = max(vil_num,a + 1);
			vil_num = max(vil_num,b + 1);
		}
		ans_time = -1;
		for(i = 0;i < vil_num;i++){
			memset(used,0,sizeof(used));
			memset(distance,-1,sizeof(distance));
			distance[i] = 0;
			while(1){
				int min_el = -1;
				for(j = 0;j < vil_num;j++){
					if(used[j] == 0 && distance[j] != -1 && (min_el == -1 || distance[min_el] > distance[j])){
						min_el = j;
					}
				}
				if(min_el == -1){
					break;
				}
				for(j = 0;j < vil_num;j++){
					if(con[min_el][j] != -1 && (distance[j] == -1 || distance[min_el] + con[min_el][j] < distance[j])){
						distance[j] = distance[min_el] + con[min_el][j];
					}
				}
				used[min_el] = 1;
			}
			sum = 0;
			for(j = 0;j < vil_num;j++){
				if(distance[j] != -1){
					sum += distance[j];
				}
			}
			if(ans_time == -1 || ans_time > sum){
				ans_time = sum;
				ans_vil = i;
			}
		}
		printf("%d %d\n",ans_vil,ans_time);
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll n, t;
    cin >> n >> t;
    ll a[n];
    rep(i, 0, n) cin >> a[i];
    ll ans = t;
    rep(i, 1, n) {
        if (a[i] < a[i - 1] + t) {
            ans += a[i] - a[i - 1];
        } else {
            ans += t;
        }
    }
    cout << ans << endl;
    return 0;
}


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

signed main()
{
    int a,b,c; cin >> a >> b >> c;
    int sum = a + b + c;
    if (sum & 1) { puts("No"); return 0; }

    int half = sum / 2;
    if ((a == half) || (b == half) || (c == half))
        puts("Yes");
    else
        puts("No");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

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

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

int main() {
    int n;
    cin>>n;
    vector<int>h(n);
    for(int i=0;i<n;i++){
        cin>>h.at(i);
    }
    vector<int>dp(n,INF);
    dp[0]=0;
    dp[1]=abs(h.at(1)-h.at(0));
    for(int i=2;i<n;i++){
        chmin(dp[i],dp[i-1]+abs(h.at(i)-h.at(i-1)));
        chmin(dp[i],dp[i-2]+abs(h.at(i)-h.at(i-2)));
    }
    cout<<dp[n-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int a,b;
	cin>>a>>b;
	if(b%a==0) cout<<a+b;
	else cout<<abs(a-b);
	return 0;
}


Measured memory_bytes: 3532
def solve():
  c = list(map(int, input().split(' ')))
  if c[0] >= 3 and c[1] >= 3:
    return (c[0] - 2) * (c[1] - 2)
  if c[0] == 1 or c[1] == 1:
    if c[0] == 1 and c[1] == 1:
      return 1
    else:
      return max(max(c) - 2, 0)
  return 0

print(solve())

Measured memory_bytes: 3060
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

const int MAX = 2000010;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long 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] % MOD) % MOD;
}

int main() {
  init();

  COMinit();

  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  ll ans = COM(r2 + c2 + 2, c2 + 1) - COM(r1 + c2 + 1, c2 + 1) - COM(r2 + c1 + 1, c1) + COM(r1 + c1, c1);

  out((ans+MOD) % MOD);
}


Measured memory_bytes: 47104
#ABC072C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
TGS=[0]*(max_A+1)
ans=0
for i in range(N):
    TGS[A[i]]+=1
for i in range(max_A-1):
    if ans<TGS[i]+TGS[i+1]+TGS[i+2]:
        ans=TGS[i]+TGS[i+1]+TGS[i+2]
if max_A<2:
    ans=N
print(ans)

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

int main(){
    int N;
    cin>>N;
    vector<int> P(N);
    for(auto &p:P) cin>>p;
    vector<int> D(N,1000000);
    queue<int> Q;
    D[0]=0;
    Q.push(0);
    while(!Q.empty()){
        int x = Q.front(); Q.pop();
        if(P[x]==0){
            for(int d=1;d<=6&&x+d<N;d++){
                if(D[x+d]>D[x]+1){
                    D[x+d]=D[x]+1;
                    Q.push(x+d);
                }
            }
        }else{
            while(P[x]!=0){
                if(D[x+P[x]]>D[x]){
                    D[x+P[x]]=D[x];
                    Q.push(x+P[x]);
                    x+=P[x];
                }else{
                    break;
                }
            }
        }
    }
    cout<<D[N-1]<<endl;
    return 0;
}


Measured memory_bytes: 4028
import java.util.*;

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

	public Main() {
		while(true){
			int w = in.nextInt(),h = in.nextInt(),c = in.nextInt();
			if(w+h+c==0)break;
			new AOJ1174().doIt(w, h, c);
		}
	}
	
	class AOJ1174{
		int max = 0;
		int[][] map;
		int h,w,c;
		int sx[] = {0,1,-1,0};
		int sy[] = {1,0,0,-1};
		boolean sw[][],flg[][];
		void dfs_2(int x,int y){
			sw[y][x] = true;
			for(int i=0;i<4;i++){
				int nx = x+sx[i];
				int ny = y+sy[i];
				if(nx<0||nx>=w||ny<0||ny>=h||sw[ny][nx]||map[ny][nx]!=c)continue;
				dfs_2(nx,ny);
			}
		}
		
		void set(){
			if(map[0][0]!=c)return;
			sw = new boolean[h][w];
			int cnt = 0;
			dfs_2(0, 0);
			for(int i=0;i<h;i++)for(int s=0;s<w;s++)if(sw[i][s])cnt++;
			max = Math.max(max, cnt);
		}
		
		void color_change(int x,int y,int color,int from){
			flg[y][x] = true;
			map[y][x] = color;
			for(int i=0;i<4;i++){
				int nx = sx[i]+x;
				int ny = sy[i]+y;
				if(nx<0||nx>=w||ny<0||ny>=h||flg[ny][nx]||map[ny][nx]!=from)continue;
				color_change(nx, ny, color,from);
			}
		}
		
		void dfs(int fase){
			if(fase==5){
				set();return;
			}
			int memo[][] = new int[h][w];
			for(int i=0;i<h;i++)for(int s=0;s<w;s++)memo[i][s] = map[i][s];
			for(int j=1;j<=6;j++){
				if(j==map[0][0])continue;
				flg = new boolean[h][w];
				color_change(0, 0, j,map[0][0]);
				dfs(fase+1);
				for(int i=0;i<h;i++)for(int s=0;s<w;s++)map[i][s] = memo[i][s];
			}
		}
		
		void print(int[][] m){// deba
			for(int i=0;i<h;i++){
				for(int s=0;s<w;s++)System.out.print(m[i][s]+" ");
				System.out.println();
			}
		}
		
		void doIt(int h,int w,int c){
			map = new int[h][w];
			this.h = h;this.w = w;this.c = c;
			for(int i=0;i<h;i++)for(int s=0;s<w;s++)map[i][s] = in.nextInt();
			dfs(0);
			System.out.println(max);
		}
	}
	
}

Measured memory_bytes: 160612
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N, M;
	cin >> N >> M;
	vector<int>v(N);
	vector<vector<int>>data(M);
	rep(i, N) {
		int A, B;
		cin >> A >> B;
		v[i] = B;
		A--;
		if (A < M)data[A].push_back(i);
	}
	int ans = 0;
	priority_queue<int>q;
	rep(i, M) {
		rep(j, data[i].size())q.push(v[data[i][j]]);
		if (q.size()) {
			ans += q.top();
			q.pop();
		}
	}
	cout << ans << endl;
}

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

int main() {
  int n; // number of lines for input
  unordered_set <string> A;
  string command; // either insert or find
  string word; // string to insert
  cin >> n;
  for (int i=0; i<n; ++i) {
    cin >> command;
    if (command == "insert") {
      cin >> word;
      if (word.size() > 12) break;
      A.insert(word);
    }
    else if (command == "find") {
      cin >> word;
      if (A.count(word) == 1) cout << "yes" << endl;
      else cout << "no" << endl;
    }
    else break;
  }
}

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

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

  string s, t;
  cin >> s >> t;

  for (int i = 0; i < s.size(); i++)
  {
    if(s.at(i) != t.at(i))
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3644
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program{
  static void Main(){
    var input = ReadLine().Split(' ').Select(int.Parse).ToArray();
    var x = input[0];
    var y = input[1];
    
	var xc = (x*(x-1))/2;
    var yc = (y*(y-1))/2;
    
	Write(xc+yc);
    
  }
}

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

using namespace std;
const int N=1e6+100;
const int mod=1e9+7;
typedef long long ll;
ll num[N],a[N];

ll qpow(ll x,ll n)
{
    ll sum=1;
    while(n){
        if(n&1) sum=sum*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return sum;
}
ll maxx=0;
int main()
{
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%lld",&a[i]);
        maxx=max(maxx,a[i]);
    }
  //  cout<<maxx<<endl;
    for(int i=1;i<=n;i++){
            int z=a[i];
            int zz=a[i];
        for(int j=2;j<=sqrt(zz);j++){
                ll cnt=0;
            while(z%j==0) {
                cnt++;
                z/=j;
            }
            num[j]=max(num[j],cnt);
//            cout<<j<<" "<<num[j]<<endl;
        }
      if(z!=1)  num[z]=max(1ll,num[z]);
    }
//    for(int i=1;i<=maxx;i++)
//         cout<<i<<" "<<num[i]<<endl;
    ll sum=1;
    for(int i=2;i<=maxx;i++){
        sum=(sum%mod*qpow(i,num[i])%mod)%mod;
    }
  //  cout<<sum<<endl;
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans=(ans+sum*qpow(a[i],mod-2))%mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
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 (b<a) {a=b; return 1;} return 0;}
const int INF = INT_MAX;
const int MOD = 1000000007;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

int main() {
    int N, K;
    cin >> N >> K;
    vi h(N);
    rep(i, N) cin >> h[i];

    vll dp(100500, INF);
    dp[0] = 0;
    FOR(i, 0, N-2) {
        reps(j, K) {
            chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]));
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1408
def airport_bus():
	n, c, k = map(int, raw_input().split(" "))
	t = []
	for i in range(n):
		t.append(int(raw_input()))
	t.sort()
	dic_busno_sate = {}
	current_bus = 1
	for x in t:
		c_state = dic_busno_sate.get(current_bus)
		if c_state is None:
			dic_busno_sate[current_bus] = ([x, x+k], 1)
		else:
			time_range = c_state[0]
			p_num = c_state[1]
			if p_num>=c:
				current_bus+=1
				dic_busno_sate[current_bus] = ([x, x + k], 1)
			else:
				left_max = max(time_range[0], x)
				right_min = min(time_range[1], x+k)
				if left_max<=right_min:
					_p_num = p_num+1
					_time_range = [left_max, right_min]
					dic_busno_sate[current_bus] = (_time_range, _p_num)
				else:
					current_bus += 1
					dic_busno_sate[current_bus] = ([x, x + k], 1)
	print current_bus

if __name__ == "__main__":
	airport_bus()

Measured memory_bytes: 34416
# include <bits/stdc++.h>
# define ll long long
# define pb push_back
# define mk make_pair
# define fr first
# define sc second

using namespace std;
int a,b,c,n,z=1,i;
int main(){
	cin>>a>>b>>c;
	
	cout<<c-min(a,b+c)+b;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<list>
#include<queue>
#include<string.h>
#include<functional>
#include<stack>
#include<deque>
#include<string>
#include<limits.h>
#include<map>
#include<set>
#include<unordered_map>
#include<cmath>
#include<unordered_set>
using namespace std;

vector<int>r[200000];
int a[200000];
bool U[200000];
bool i[200000];//ループの中にあるか？
int g[200000];//grundy数
int c[200000];//copy
int DFS(int a) {
	if (g[a] != -1)return g[a];
	unordered_map<int, int>U;
	for (int b : r[a]) {
		U[DFS(b)] = true;
	}
	int i = -1;
	while (i++, 1) {
		if (!U[i]) {
			return g[a] = i;
		}
	}
	return 0;
}
signed main() {
	memset(g, -1, sizeof(g));
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i]; a[i]--;
		r[a[i]].push_back(i);
	}
	int S = 0;//サイクルに含まれる
	while (1) {
		if (i[S]) {
			break;
		}
		if (U[S]) {
			i[S] = true;
		}
		U[S] = true;
		S = a[S];
	}
	for (int k = 0; k < n; k++) {
		if (!i[k]) {
			DFS(k);
		}
	}
	//Sから伸びるループに含まれない頂点に含まれない最小値と二番目を求める
	int N = -1, M = 0;
	if (1) {
		unordered_map<int, int>U;
		for (int b : r[S]) {
			if(!i[b])U[DFS(b)] = true;
		}
		int i = -1;
		while (i++, 1) {
			if (!U[i]) {
				if (N == -1) {
					N = i;
				}
				else {
					M = i;
					break;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		c[i] = g[i];
	}
	g[S] = N; c[S] = M;
	int now = a[S];
	while (1) {
		unordered_map<int, int>U;
		for (int b : r[now]) {
			U[g[b]] = true;
		}
		int i = -1;
		int ans = 0;
		while (i++, 1) {
			if (!U[i]) {
				ans = i;
				break;
			}
		}
		if (now == S) {
			if (g[S] == ans) { puts("POSSIBLE"); return 0; }
			break;
		}
		g[now] = ans;
		now = a[now];
	}
	now = a[S];
	while (1) {
		unordered_map<int, int>U;
		for (int b : r[now]) {
			U[c[b]] = true;
		}
		int i = -1;
		int ans = 0;
		while (i++, 1) {
			if (!U[i]) {
				ans = i;
				break;
			}
		}
		if (now == S) {
			if (c[S] == ans) { puts("POSSIBLE"); return 0; }
			break;
		}
		c[now] = ans;
		now = a[now];
	}
	puts("IMPOSSIBLE");
}

Measured memory_bytes: 12928
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int m, f, r;
	int s;

	while (1) {
		scanf("%d%d%d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) break;

		if (m < 0 || f < 0) puts("F");
		else {
			s = m + f;
			if (s >= 80) puts("A");
			else if (s >= 65) puts("B");
			else if (s >= 50) puts("C");
			else if (s < 30) puts("F");
			else puts(r >= 50 ? "C" : "D");
		}
	}
	return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  while(1){
  cin>>a>>b>>c;
  if(a==b&&b==c&&c==0)break;
  int m[b][3];
  for(int i=0;i<b;i++)cin>>m[i][0]>>m[i][1]>>m[i][2];
  for(int i=1000;i>0;i--){for(int j=0;j<b;j++){
    if(i==m[j][0]&&c==m[j][1])c=m[j][2];
    else if(i==m[j][0]&&c==m[j][2])c=m[j][1];
  }
  }
  cout<<c<<endl;
}
   return 0;
}

Measured memory_bytes: 1168
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <list>
using namespace std;

vector<int> igets(int N) {
	vector<int> A;
	int temp;
	for (int i = 0; i < N; ++i) {
		cin >> temp;
		A.push_back(temp);
	}
	return A;
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	int N,Q,ANS=0;
	cin >> N;
	vector<int> DATA = igets(N);
	DATA.push_back(0);
	cin >> Q;
	vector<int> Search = igets(Q);
	for (int i = 0; i < Q; i++)
	{
		DATA[N] = Search[i];
		int c = 0;
		while (true)
		{
			if(Search[i]!=DATA[c])
				c++;
			else break;
		}
		if (c != N)++ANS;
	}
	cout << ANS <<endl;
}


Measured memory_bytes: 3252
N,M = map(int,input().split())
L = []
des = [0]
ans = 0
for i in range(M):
  L.append(list(map(int,input().split())))
L = sorted(L,key = lambda x:x[1])
for i in range(M):
  if des[len(des)-1] < L[i][0]:
    ans += 1
    des.append(L[i][1]-1)
print(ans)

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	int a, b;
	cin >> a >> b;
	if (b <= 0) {
		if ((b - a + 1) % 2 == 0) {
			cout << "Positive" << endl;
		} else {
			cout << "Negative" << endl;
		}
	} else if (a <= 0 && b >= 0){
		cout << "Zero" << endl;
	} else if (a > 0) {
		cout << "Positive" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])

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

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

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

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

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

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

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

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

int main(){
    int a, b;
    cin >> a >> b;
    int t8s = ceil(a * 100 / 8.0);
    int t8f = ceil((a + 1) * 100 / 8.0) - 1;
    int t10s = ceil(b * 100 / 10.0);
    int t10f = ceil((b + 1) * 100 / 10.0) - 1;
    if (t8s <= t10s and t10s <= t8f) {
        cout << t10s << endl;
        return 0;
    }
    else if (t10s <= t8s and t8s <= t10f) {
        cout << t8s << endl;
        return 0;
    }
    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,m,a,sum=0;
	cin>>n>>m;
	for (int i = 0; i < m; ++i)
		{
			cin>>a;
			sum+=a;
		}	
		int ans = n-sum;
		if(ans<0) cout<<-1; else cout<<ans;

   return 0;
}


Measured memory_bytes: 3656
N = int(input())
S = [None] * N
for i in range(N):
    S[i] = input()

ans = 0
endswith_a = 0
startswith_b = 0
both_ab = 0
for s in S:
    ans += s.count('AB')
    a = s.endswith('A')
    b = s.startswith('B')
    endswith_a += 1 if a else 0
    startswith_b += 1 if b else 0
    both_ab += 1 if a and b else 0

if both_ab == endswith_a or both_ab == startswith_b:
    if endswith_a == startswith_b and both_ab > 0:
        ans += both_ab - 1
    else:
        ans += both_ab
else:
    ans += min(endswith_a, startswith_b)

print(ans)


Measured memory_bytes: 3700
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(){
    int M,N;
    vector< string> As,Bs;
    string A,B;
    cin>>N>>M;
    REP(i,N){
        cin>>A;
        As.push_back(A);
    }
    REP(i,M){
        cin>>B;
        Bs.push_back(B);
    }

    REP(k,As.size()-Bs.size()+1){//縦の開始点
        REP(j,As[0].size()-Bs[0].size()+1){//横の開始点
            cerr<<"開始点;"<<k<<" "<<j<<endl;
            REP(i,M){
                string sub=As[k+i].substr(j,Bs[0].size());
                debug(sub);
                if(sub!=Bs[i]){
                    goto NEXT;
                }
            } 

            cout<<"Yes"<<endl;
            exit(0);
            NEXT:;
        }
    }
    cout<<"No"<<endl;





}


Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N, K = reads()
A = reads()

freq = defaultdict(lambda: 0)
for a in A:
  freq[a] += 1
ans = N - sum(sorted(freq.values())[-K:])
print(ans)

Measured memory_bytes: 32500
#include <iostream>
// #include<algorithm>
using namespace std;

int main(){
  int n,minj,N[100],swapnumber=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>N[i];
  for(int i=0;i<n;i++){
    minj=i;
    for(int j=i;j<n;j++)if(N[j]<N[minj])minj=j;
    if(i!=minj){
      swap(N[i],N[minj]);
      swapnumber++;
    }
  }
  for(int i=0;i<n;i++){
    if(i!=n-1)cout<<N[i]<<" ";
    else cout<<N[i]<<endl;
  }
  cout<<swapnumber<<endl;
return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
using namespace std;
const int inf = 1001001001;
int n, a, dp[100000];
int main() {
	scanf("%d",&n);
	fill(dp, dp+n, inf);
	for (int i = 0; i < n; i++) {
		scanf("%d",&a);
		*lower_bound(dp, dp+n, a) = a;
	}
	printf("%d\n", (int)(lower_bound(dp, dp+n, inf)-dp));
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
const int MAX_M = 201;
const int INF = 1<<24;
map<string, int> id;
int G[MAX_M][MAX_M];
int M;

int getId(string s) {
  if(id.find(s) == id.end()) {
    id[s] = M++;
  }
  return id[s];
}

bool solve() {
  for(int k = 0; k < M; ++k) {
    for(int s = 0; s < M; ++s) {
      for(int d = 0; d < M; ++d) {
	if(G[s][k] == INF || G[k][d] == INF) continue;
	if(G[s][d] == INF) {
	  G[s][d] = G[s][k] + G[k][d];
	} else if(G[s][d] != G[s][k] + G[k][d]) {
	  return false;
	}
      }
    }
  }
  return true;
}

int main() {
  int N;
  while(cin >> N && N) {
    M = 0;
    id.clear();
    fill(G[0], G[MAX_M], INF);
    for(int i = 0; i < N; ++i) {
      string in[5];
      for(int j = 0; j < 5; ++j) cin >> in[j];
      int a = getId(in[1]);
      int b = getId(in[4]);
      int cost = atoi((in[3].substr(3)).c_str());
      G[a][b] = cost;
      G[b][a] = -cost;
    }
    cout << (solve() ? "Yes" : "No") << endl;
  }
  return 0;
}

Measured memory_bytes: 1092
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long cnt=0;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int z=0;z<=c;z++){
				if((z*50)+(j*100)+(i*500)==d){
					cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
//By: Luogu@rui_er(122461)
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;

int n, m;
int fa[N], cnt[N], ans;
int find(int x) {return x == fa[x] ? x : fa[x] = find(fa[x]);}
bool merge(int x, int y) {
	int f1 = find(x), f2 = find(y);
	if(f1 == f2) return false;
	fa[f1] = f2;
	return true;
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=n;i++) fa[i] = i;
	for(int i=1;i<=m;i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		merge(a, b);
	}
	for(int i=1;i<=n;i++) ++cnt[find(i)];
	for(int i=1;i<=n;i++) ans = max(ans, cnt[i]);
	printf("%d\n", ans);
	return 0;
}

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

bool func(string a,string b)
{
    return a<b;
}

int main()
{
    vector<string>v;
    int n,l;
    cin>>n>>l;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(),v.end(),func);
    for(auto m: v)
        cout<<m;

}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    int n, m, x; cin >> n >> m >> x;
    ll ans = INF;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    rep(i, (1<<n)) {
        ll tmp = 0;
        ll sum[m] = {0};
        rep(j, n) {
            if(i & (1<<j)) {
                tmp += c[j];
                rep(k, m) sum[k] += a[j][k];
            }
        }
        bool fl = 0;
        rep(j, m) if(sum[j] < x) fl = 1;
        if(fl) continue;
        chmin(ans, tmp);
    }
    cout << (ans == INF ? -1 : ans) << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    if (N == 1) cout << "Hello World" << endl;
    else {
        int A, B; cin >> A >> B;
        cout << A+B << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	/* ----- 変数宣言 ----- */
	int a, b, c, d, ans;

	/* ----- 入力 ----- */
	cin >> a >> b >> c >> d;

	/* ----- 計算 ----- */

	if (a < b)	ans = a;
	else		ans = b;

	if (c < d)	ans += c;
	else		ans += d;

	/* ----- 出力 ----- */
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll W,H,x,y;
    cin >> W >> H >> x >> y;
    cout << ((double) H)*((double) W)/2.0 << " " << ((W==x+x && H==y+y)?1:0); 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> pl;
const int INF=100000001;
int main(){
  int n,m;cin>>n>>m;

  vector<pl> p;
  rep(i,m){
    int a,b;cin>>a>>b;
    int s=0;
    rep(j,b){
      int c;cin>>c;
      c--;
      s|=1<<c;
    }
    p.emplace_back(s,a);
  }

 vector<int> dp(1<<n,INF);
  dp[0]=0;
  rep(i,1<<n){
    rep(j,m){
      int s=i|p[j].first;
      dp[s]=min(dp[s],dp[i]+p[j].second);
    }
  }
  int ans=dp[(1<<n)-1];
  if(ans==INF) ans=-1;
  cout<<ans<<endl;

  // rep(i,m){
  //   cout<<"i "<<i<<" p "<<bitset<8>(p[i].first)<<endl;
  // }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
constexpr const int INF=1<<30,MOD=1000000007;constexpr const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int p,q,r;
    cin>p>q>r;
    cout<p+q+r-max({p,q,r})<endl;
    return 0;
}


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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>
#include <vector>
#define rep(i,n) for(int i = 0; i< (n);i++)

#define sort(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> p;

int main(){
int a,b;
cin >>a >>b;
if(a>=b){
	cout<<a-b<<endl;
  }
  else{
	  cout<<0<<endl;
	}

}

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

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}

	float lim;
	float sum;
	sum = accumulate(a.begin(),a.end(),0);
        lim = sum/(4*m);

	sort(a.begin(),a.end(),greater<int>());

	if(a[m-1] >= lim){
		cout << "Yes" << endl;
	}
	else{
	       	cout << "No" << endl;
	}

}

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

using namespace std;

#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define Endl '\n'
#define cont continue
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define pb push_back
#define mp make_pair
#define mem(x) memset(x, 0, sizeof(x))

const ll inf=1e18;
const int mod=1e9+7;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
const int mxn = 2e5+10;

//ll fact[mxn];
//ll in_fact[mxn];
//fact[0] = 1;
//for(ll i = 1; i < mxn; i++) {
	//fact[i] = (i*fact[i-1])%mod;
//}
//in_fact[mxn-1] = bigmod(fact[mxn-1],mod-2);
//for(ll i = mxn-2; i >= 0; i--) {
	//in_fact[i] = (in_fact[i+1] * (i+1))%mod;
//}
//ll c(ll n,ll r) {
	//ll ans = (fact[n] * (in_fact[r] * in_fact[n-r]%mod))%mod;
	//return ans;
//}


int main(){
    fast;
	//freopen ("input.txt", "r", stdin);
	//freopen ("output.txt", "w", stdout);
    int tt = 1;
    //cin>>tt;
    for(int tc = 1; tc <= tt; tc++) {
        int n;
        cin>>n;
        int ip[n],ans =0;
        for(int i = 0; i < n;i++) cin>>ip[i];
        sort(ip,ip+n);
        for(int i = 0; i< n;i++) {
			int f = ip[i];
			for(int j = i+1; j < n; j++) {
				int s = ip[j];
				for(int k = j+1; k < n; k++) {
					int t = ip[k];
					if(f == s || s == t || f == t) cont;
					else if(f + s <= t) cont;
					else ans++;
				}
			}
		}
		cout<<ans<<endl;
        
        
    }



return 0;
}


Measured memory_bytes: 3652
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let n_k_q: Vec<u64> = read_vec();
    let mut a: Vec<usize> = Vec::new();
    let mut point: Vec<u64> = vec![0; n_k_q[0] as usize];

    for _ in 0..n_k_q[2] as usize
    {
        let ai: usize = read();
        a.push(ai);
    }

    for ai in a
    {
        // 正解数を加算
        point[ai - 1] += 1;
    }

    for p in point
    {
        if (n_k_q[2] - p) < n_k_q[1] { println!("Yes"); } else { println!("No"); }
    }
}


Measured memory_bytes: 6780
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int main() {
    string s;
    cin >> s;
    if ((s[2] == s[3])&&(s[4] == s[5])){
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)





if (n-1)%(k-1)==0:
    res = (n-1)//(k-1)
else:
    res = (n-1)//(k-1) + 1

print(res)


Measured memory_bytes: 10420
import java.util.*;
import java.io.*;
public class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                 int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
                 int n = sc.nextInt();
                 System.out.println(a[n-1]);
}
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#define LL long long
const int M=4000005;
const int N=2005;
using namespace std;

int n,a;

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

Measured memory_bytes: 256
A, B, m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
minp = min(a) + min(b)
for i in range(m):
    x, y, c = map(int,input().split())
    minp = min(minp, a[x-1] + b[y-1] -c)
print(minp)

Measured memory_bytes: 24724
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

map<int,int> mp;
int n;
int f(int i) {
  i %= n;
  if (mp.count(i)) return mp[i];
  cout<<i<<endl;
  string res;
  cin>>res;
  if (res[0] == 'V') exit(0);
  return mp[i] = (res[0] == 'M');
}
 
int g(int i, int j) { return (j-i+n)%n;}
 
int main() {
  scanf("%d",&n);
  int l = 0, r = n/2;
  int a = f(l);
  int b = f(r);
  if ((a^b) == g(l,r)%2) {
    swap(l,r); r += n;
  }
  while (1) {
    int c = (l+r)>>1;
    if ((f(l)^f(c)) == g(l,c)%2) l = c;
    else r = c;
  }
  return 0;
}

Measured memory_bytes: 852
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  string S;
  cin >>S;
  ll x=S.size();
  ll y=S.size()-1; //number of plus
  
  ll sum=0;
  
for (ll bit = 0; bit <(1<<y); ++bit) { 
 ll a=x;
  ll b=x; 
  
 rep(i,y) {
if (bit & (1 << i))  {

  a=y-i;
  repl(j,a,b) {
    ll ps=S.at(j)-'0';
    ll PS=pow(10, b-j-1);
    sum +=ps*PS;
    //cout<<ps*PS<<" "<<a<<" "<<b<<'C'<<endl;
    
    

  }
b=a;

}
 }
  
  
  
  
  
  
  
  
  
  
  
  repl(m,0,a) {
    ll fumo=S.at(m)-'0';
    ll Fumo=pow(10, a-m-1);
    sum +=fumo*Fumo;
    //cout<<fumo*Fumo<<" "<<a<<" "<<b<<'D'<<endl;
  }


}
  
  
  
  cout<<sum<<endl;
}
    
 

Measured memory_bytes: 512
N, Y = map(int,input().split())
x, y, z = -1, -1, -1
k = 0
for i in range(N+1):
    for j in range(0,N-i+1):
        k = N - i - j
        if 10000*i + 5000*j + 1000*k == Y :
            x, y, z = i, j, k
            break
print(x, y, z)        

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

int main(){
	int k,a,b;
	cin>>k>>a>>b;
	int flag=0;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			flag=1;
			break;
		}
	}
	if(flag==1){
		cout<<"OK"<<endl;
	}
	else{
		cout<<"NG"<<endl;
	}
	return 0;
}



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

using namespace std;

int main(){
  int N;
  cin >> N;
  int sum = 0;
  int tmp = N;
  while(tmp!= 0){
    sum += tmp % 10;
    tmp /= 10;
  }
  if(N%sum == 0) cout << "Yes" << endl;
  else           cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring> 
#include<cstdio>
#include<set>
#define MN 100000
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
multiset<int>s[MN+5];
multiset<int>::iterator it;
int n,f[MN+5],head[MN+5],cnt,ans,flag,mid,rt,d[MN+5];
struct edge{int to,next;}e[MN*2+5];
inline void ins(int f,int t){
	e[++cnt]=(edge){t,head[f]};head[f]=cnt;++d[f];
	e[++cnt]=(edge){f,head[t]};head[t]=cnt;++d[t];
}
void dfs(int x,int fa){
	s[x].clear();f[x]=0;
	for(int i=head[x];i;i=e[i].next)
		if(e[i].to!=fa)dfs(e[i].to,x),s[x].insert(f[e[i].to]+1);
	int has=0,has2=0,size=s[x].size();
	if(!size)ans++;ans-=(size-1)/2;
	if(s[x].size()&&(*(--(it=s[x].end())))>mid) return(void)(flag=0);
	while(!s[x].empty()){
		it=s[x].end();--it;
		int v=*it;s[x].erase(it);
		it=s[x].upper_bound(mid-v);
		if(it==s[x].begin())
			if(!has) has=v,f[x]=has;
			else if(~size&1)
				if(!has2)has2=v,f[x]=has2;
				else return(void)(flag=0);
			else return (void)(flag=0);
		else s[x].erase(--it);
	}
}
int main(){
	n=read();
	for(int i=1;i<n;i++)ins(read(),read());
	int l=1,r=n,res,Ans;
	for(rt=1;~d[rt]&1;rt++);
	while(l<=r){
		mid=l+r>>1;ans=0;flag=1;
		dfs(rt,0);
		if(flag)res=mid,r=mid-1,Ans=ans;
		else l=mid+1;
	}
	printf("%d %d\n",Ans,res);
	return 0;
}

Measured memory_bytes: 17024