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

int main()
{
	int n,x,e = 100000;
	cin >> n;

	for(int i=0;i<n;++i){
		e *= 1.05;
		x = e % 1000;

		if(x != 0){
			e += (1000-x);
		}
	}

	cout << e << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);


static int cntdiv[10000005];

void cntdivisors(int n){
 //int div[n];
  cntdiv[0] = 0;
  for(int i = 1; i <= n; i++ ){
    cntdiv[i] = 1;
  }

  for(int i = 2; i <= n; ++i){
    int j = i;
    while(j <= n){
      ++cntdiv[j];
      j = j + i;
    }
  }
  ll sum = 0;
  REP(i,n){
    //cout << i << " " << div[i] << endl;
    sum += (ll)i*cntdiv[i];
  }
  cout << sum << endl;
}

int main(){
  int n;
  cin >> n;
  cntdivisors(n+1);

  return 0;
}

Measured memory_bytes: 42688
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	char d;
	vector<int>in(10);
	while(cin>>in[0]){
		in[0]*=10000;
		int sum=in[0];
		rep(i,9){
			cin>>d>>in[i+1];
			in[i+1]*=10000;
			sum+=in[i+1];
		}
		int v1,v2;
		cin>>d>>v1>>d>>v2;
		int dis=sum/(v1+v2)*v1;
		bool h=false;
		if(sum%(v1+v2)==0)h=true;
		int sum2=0;
		rep(i,10){
			sum2+=in[i];
			if(sum2>=dis){
				cout<<i+1<<endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1192
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

string s[100];
pair<int, char> p[100];
int n;
int add(int&, int);
int mul(int&, int);

int add(int& idx, int par) {
  // cout << idx << " " << p[idx].second << " add" << endl;
  int ret = 0;
  while(idx < n) {
    // cout << idx << " " << p[idx].first << " " << p[idx-1].first << endl;
    if(p[idx].first <= par) {
      break;
    } else if(p[idx].second == '+') {
      idx++;
      ret += add(idx, p[idx-1].first);
    } else if(p[idx].second == '*') {
      idx++;
      ret += mul(idx, p[idx-1].first);
    } else {
      ret += p[idx].second - '0';
      idx++;
    }
    // cout << idx << " " << ret << " add" << endl;
  }
  return ret;
}

int mul(int &idx, int par) {
  // cout << idx << " " << p[idx].second << " mul" << endl;
  int ret = 1;
  while(idx < n) {
    // cout << idx << " " << p[idx].first << " " << p[idx-1].first << endl;
    if(p[idx].first <= par) {
      break;
    } else if(p[idx].second == '+') {
      idx++;
      ret *= add(idx, p[idx-1].first);
    } else if(p[idx].second == '*') {
      idx++;
      ret *= mul(idx, p[idx-1].first);
    } else {
      ret *= p[idx].second - '0';
      idx++;
    }
    // cout << idx << " " << ret << " mul" << endl;
  }
  return ret;
}

signed main(void)
{
  while(true) {
    cin >> n;
    if(!n) break;
    REP(i, n) cin >> s[i];

    REP(i, n) p[i].first = 0;
    REP(i, n) {
      REP(j, s[i].size()) {
        if(s[i][j] == '.') p[i].first++;
        else p[i].second = s[i][j];
      }
    }
    if(n == 1) {
      cout << p[0].second << endl;
      continue;
    }

    int ret;
    if(p[0].second == '+') {
      int st = 1;
      ret = add(st, 0);
    } else {
      int st = 1;
      ret = mul(st, 0);
    }

    cout << ret << endl;
  }

  return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

typedef long long ll;
typedef pair<int, int> ii;

int main() {

	int n;
	while(cin >> n, n){
		map<int, int> mp;
		vector<int> v(n);
		rep(i, n){
			string s;
			cin >> s;
			v[i] = s[0] - 'A';
		}

		int num;
		int ans = n + 1;
		rep(i, n){
			mp[v[i]]++;
			int fst = 0;
			int snd = 0;
			for(auto it : mp){
				if(fst < it.second){
					num = it.first;
					snd = fst;
					fst = it.second;
				}
				else if(snd < it.second){
					snd = it.second;
				}
			}

			if(fst > snd + (n - i - 1)){
				ans = i + 1;
				break;
			}
		}

		if(ans == n + 1) cout << "TIE" << endl;
		else cout << (char)(num + 'A') << " " << ans << endl;

	}

}



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

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

    string N; cin >> N;
    cout << "ABC" + N << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	if(a==b){
		cout<<1;
		return 0;
	}
	int aaaaa=a%100000/10000,bbbbb=b%100000/10000;
	int aaaa=a%10000/1000,bbbb=b%10000/1000;
	int aaa=a%1000/100,bbb=b%1000/100;
	int c=aaaaa+aaaa*10+aaa*100+aaaa*1000+10000*aaaaa;
	int d=bbbbb+bbbb*10+bbb*100+bbbb*1000+10000*bbbbb;
	int sum=b/100-a/100;
	if(a<=c) sum++;
	if(b<d) sum--;
	
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int A, B, now=1, res=0;
  rd(A);
  rd(B);
  while(now < B){
    now += A-1;
    res++;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190830-1

// --- original code ---
// {
//   int A, B, now = 1, res = 0;
//   rd(A,B);
//   while(now < B) now += A-1, res++;
//   wt(res);
// }


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, M, Q = MAP()
LR = [LIST() for _ in range(M)]
pq = [LIST() for _ in range(Q)]

x = [[0]*(N+1) for _ in range(N+1)]

for L, R in LR:
	x[L][R] += 1

for l in range(N+1):
	x[l] = list(accumulate(x[l]))

for l in range(1, N+1):
	for r in range(N+1):
		x[l][r] += x[l-1][r]
		
for p, q in pq:
	print(x[q][q] - x[q][p-1] - x[p-1][q] + x[p-1][p-1])




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

using namespace std;

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

	string s;cin>>s;
	bitset<32> bs(0);
	int len=s.length();
	vector<int> v(len+1,1);
	vector<vector<int>> p(26);
	for(int i=0;i<len;i++){
		int idx=s[i]-'a';
		p[idx].push_back(i);
	}
	for(int i=len-1;i>=0;i--){
		int idx=s[i]-'a';
		bs.set(idx);
		if(bs.count()==26){
			v[i]=v[i+1]+1;
			bs.reset();
		}
		else{
			v[i]=v[i+1];
		}
	}
	string res="";
	int cnt=v[0],pos=-1;
	for(int i=0;i<cnt;i++){
        char tmp='z'+1;
		int ptmp=pos;
		for(int j=0;j<26;j++){
			auto itr=upper_bound(p[j].begin(),p[j].end(),pos);
			if(itr==p[j].end()){
				tmp = (char)('a'+j);
				break;
			}
			int idx=*itr;
            //cout<<v[idx]<<" "<<cnt
			if(v[idx+1]==cnt-i-1){
				if(tmp>'z'){
					ptmp=idx;
					tmp = (char)('a'+j);
				}
			}
			continue;
		}
		pos=ptmp;
		res += tmp;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 2196
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define leng(n) (int)(log10(n)+1)


typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
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;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];
    reverse(ALL(a));

    int l=2,r=2;
    REP(i,0,n){
        if(l/a[i]==r/a[i] && l%a[i]!=0 && r%a[i]!=0){
            cout<<-1<<endl;
            return 0;
        }
        l=RUP(l,a[i])*a[i];
        r=(r/a[i])*a[i]+a[i]-1;
//        cout<<l<<" "<<r<<endl;
    }
    cout<<l<<" "<<r<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i <= n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

int main(){
  set<int> sunuke;
  int n,k;
  cin >> n >> k;
  rep(i, 1, k){
    int d;
    cin >> d;
    rep(j,1,d){
      int temp;
      cin >> temp;
      sunuke.insert(temp); 
    }
  }
  cout << n-sunuke.size() << endl;
  return 0;
}


Measured memory_bytes: 3632
s = int(input())
a = s//100
b = s%100
if 0 < b and b < 13 and 0 < a and a < 13:
    print("AMBIGUOUS")
elif 0 < b and b < 13:
    print("YYMM")
elif 0 < a and a < 13:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 9152
N, K = map(int, input().split())
user_have_sweets = []
for i in range(K):
    __sweets_number = input()
    li = list(map(int, input().split()))
    user_have_sweets.extend(li)

counta = 0
for i in range(1, N+1):
    if i in user_have_sweets:
        pass
    else:
        counta += 1

print(counta)


Measured memory_bytes: 9176
while True:
  n,r = map(int,input().split())
  if n*r==0:
    break
  yama = [i+1 for i in range(n)]
  for i in range(r):
    p,c = map(int,input().split())
    s_p = yama[n-(p-1):n]
    s_c = yama[n-(p-1)-c:n-(p-1)]
    yama = yama[:n-(p-1)-c]+s_p+s_c
  print(yama[n-1])


Measured memory_bytes: 5620
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if (b<=a&&a<=c)
 cout << b << " " << a << " " << c << endl;
     else if (b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
            else if (c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
        else if (c<=b&&b<=a)
        
        cout << c << " " << b << " " << a << endl;
 

}


Measured memory_bytes: 3116
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        long[] ints=new long[N];
        for(int i=0;i<N;i++){
            ints[i]= scanner.nextLong();
        }
        long[] longs=new long[N+1];
        longs[0]=0;
        for(int i=1;i<N+1;i++){
            longs[i]=longs[i-1]+ints[i-1];
        }
        Arrays.sort(longs);
        long result=0;
        long count=0;
        for(int i=1;i<N+1;i++){
            if(longs[i-1]==longs[i]){
                count++;
            }else{
                if(count>0){
                    result+=count*(count+1)/2;
                    count=0;
                }
            }
        }
        if(count>0){
            result+=count*(count+1)/2;
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 85484
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,l,n,m;
    string a;
    string ans;
    cin>>a;
    string  b;
    cin>>b;
    long long lcs[3005][3005];
    for(i=0;i<=a.length();i++){
        for(j=0;j<=b.length();j++){ 
            if(i==0||j==0)
                lcs[i][j]=0;
            else if(a[i-1]==b[j-1]){
                lcs[i][j]=lcs[i-1][j-1]+1;
                
            }
            else
                lcs[i][j]=max(lcs[i-1][j], lcs[i][j-1]);
        }
    }
    
    i=a.length();j=b.length(); 
    while (i > 0 && j > 0) 
    { 
        
      if (a[i-1] == b[j-1]) 
      { 
          ans+=a[i-1]; 
          i--;j--;
      } 
  
  
      else if (lcs[i-1][j] > lcs[i][j-1]) 
         i--; 
      else
         j--; 
   } 
   reverse(ans.begin(),ans.end());
   cout<<ans;
}


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

int main(){
  int N;
  cin >> N;
  
  int64_t L0=2;
  int64_t L1=1;
  int64_t buf;
  switch(N){
    case 1:
      break;
    default:
      for(int i = 2;i<N+1;i++){
        buf=L0+L1;
        L0=L1;
        L1=buf;
      }
      break;
  }
  cout << L1 << endl;
}
  

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

using namespace std;

int main(){
  int N,i,k;
  cin >> N;
  for(i=N;;i++)
    for(k=2;;k++){
      if(k*k > i) goto END;
      if(i % k == 0) break;
      }
  END:;
  cout << i << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

static class Program
{
    class Rate
    {
        public readonly int g;
        public readonly int s;
        public readonly int b;

        public Rate(int[] args)
        {
            g = args[0];
            s = args[1];
            b = args[2];
        }
    }

    static long Search(long N, Rate A, Rate B)
    {
        var dp = new long[N + 1];
        for (int i = 1; i <= N; ++i)
        {
            dp[i] = i;
            if (i >= A.g) { dp[i] = Math.Max(dp[i - A.g] + B.g, dp[i]); }
            if (i >= A.s) { dp[i] = Math.Max(dp[i - A.s] + B.s, dp[i]); }
            if (i >= A.b) { dp[i] = Math.Max(dp[i - A.b] + B.b, dp[i]); }
        }
        return dp[N];
    }

    static long Solve(int N, Rate A, Rate B)
    {
        long X = Search(N, A, B);
        long Y = Search(X, B, A);
        return Y;
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var A = new Rate(Array.ConvertAll(Console.ReadLine().Split(), int.Parse));
        var B = new Rate(Array.ConvertAll(Console.ReadLine().Split(), int.Parse));
        Console.WriteLine(Solve(N, A, B));
    }
}


Measured memory_bytes: 204256
# coding: utf-8

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

c = [map(int, raw_input().split()) for _ in xrange(10)]
A = [map(int, raw_input().split()) for _ in xrange(H)]
d = [float('inf')] * 10

d[1] = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            if d[j] != float('inf') and d[k] > d[j] + c[k][j]:
                d[k] = d[j] + c[k][j]

print sum(sum(d[a] if a != -1 else 0 for a in aa) for aa in A)


Measured memory_bytes: 2948
#include<stdio.h>

    typedef struct { char suit, value;} Card;

void bubble(Card A[], int N){
    int i,j;
    Card t;
    for(i=0;i<N;i++){
        for(j=N-1;j>=i;j--){
            if(A[j].value < A[j-1].value){
                 t= A[j];
                 A[j] = A[j-1];
                 A[j-1] =t;
            }
        }
    }
}

void selection(Card A[], int N){
    int i,j,minj;
    Card t;
    for(i=0;i<N;i++){
        minj = i;
        for(j=i;j<N;j++){
            if(A[j].value < A[minj].value){
                minj = j;
            }
         }
         t= A[i];
         A[i] = A[minj];
         A[minj] =t;
    }
}

void print(Card A[], int N){
    int i;
    for(i=0;i<N;i++){
        if(i>0) printf(" ");
        printf("%c%d",A[i].suit,A[i].value);
    }
    printf("\n");
}

int isStable(Card c1[], Card c2[], int N){
    int i;
    for(i=0;i<N;i++){
        if(c1[i].suit != c2[i].suit){
            return 0;
        }
    }
    return 1;
}

void str2Card(Card *t,char str[]){
    t->suit = str[0];
    t->value = str[1] - '0';
}

int main(void){
    Card c1[100], c2[100];
    int N,i;
    char str[3];

    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%s",str);
        str2Card(&c1[i],str);
    }

    for(i=0;i<N;i++){
        c2[i]=c1[i];
    }
    bubble(c1,N);
    selection(c2,N);

    print(c1,N);
    printf("Stable\n");
    print(c2,N);
    if(isStable(c1,c2,N)){
        printf("Stable\n");
    } else{
        printf("Not stable\n");
    }
    return 0;
}


Measured memory_bytes: 2044
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * 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;
        FasterScanner in = new FasterScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FasterScanner in, PrintWriter out) {
            int[] abc = new int[3];
            abc[0] = in.nextInt();
            abc[1] = in.nextInt();
            abc[2] = in.nextInt();
            Arrays.sort(abc);

            int ans = 0;
            ans += abc[2] - abc[1];
            ans += ((abc[2] - abc[0] - ans) % 2 == 0) ? (abc[2] - abc[0] - ans) / 2 : 2 + (abc[2] - abc[0] - ans) / 2;
            out.println(ans);
        }

    }

    static class FasterScanner {
        private InputStream in;
        private byte[] buffer;
        private int bufPointer;
        private int bufLength;

        public FasterScanner(InputStream in) {
            this.in = in;
            buffer = new byte[1024];
        }

        private boolean hasNextByte() {
            if (bufPointer < bufLength) return true;
            bufPointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (bufLength > 0);
        }

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

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

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

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

        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' || b > '9') throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 21460
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

int idx[3];
string a[3];

int main(){
    for(int i = 0 ; i < 3 ; ++i)
        cin >> a[i];
    int nw = 0;
    while(true){
        if(idx[nw] == a[nw].size())
            return cout << char(nw + 'A'), 0;
        int nxt = a[nw][idx[nw]] - 'a';
        ++idx[nw];
        nw = nxt;
    }
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, K;
string S = "";

int main() {
	scanf("%lld %lld", &N, &K);
	cin >> S;
	ll cnt = 0;
	
	for(int i = 0; i < S.size() - 1; i++) {
		if(S[i] == S[i + 1]) {
			cnt++;
		}
	}

	ll X = K;
	ll cntR = 0;
	ll Y = K;
	ll cntL = 0;

	if(S[0] == 'R') {
		int flag = 0;
		for(int i = 1; i < S.size(); i++) {
			if(S[i] == 'L' && !flag && X > 0) {
				if(i == S.size() - 1) {
					cntR += 1;
				}
				else {
					cntR += 2;
				}
				X--;
				flag = 1;
			}
			if(S[i] == 'R') {
				flag = 0;
			}
		}
	}
	else {
		int flag = 0;
		for(int i = 1; i < S.size(); i++) {
			if(S[i] == 'R' && !flag && Y > 0) {
				// cout << "hey\n";
				if(i == S.size() - 1) {
					cntL += 1;
				}
				else {
					cntL += 2;
				}
				Y--;
				flag = 1;
			}
			if(S[i] == 'L') {
				flag = 0;
			}
		}
	}


	ll ans = N - 1;
	ans = min(ans, max(cnt + cntL, cnt + cntR));
	printf("%lld\n", ans);



	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 512
#include <cstring>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int dp[100000];
vector<int> g[100000];
int col[100000];

int main(){
  const int n = getInt();
  const int m = getInt();

  REP(i,m){
    const int a = getInt() - 1;
    const int b = getInt() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  const int q = getInt();
  vector<int> vs(q);
  vector<int> ds(q);
  vector<int> cs(q);

  REP(i,q){
    vs[i] = getInt() - 1;
    ds[i] = getInt();
    cs[i] = getInt();
  }

  memset(dp, -1, sizeof(dp));

  REP(qq,q){
    const int v = vs[q - 1 - qq];
    const int d = ds[q - 1 - qq];
    const int c = cs[q - 1 - qq];

    if(dp[v] >= d) continue;

    queue<int> q;
    dp[v] = d;
    if(col[v] == 0) col[v] = c;
    q.push(v);
    while(q.size()){
      const int pos = q.front(); q.pop();

      for(const int next : g[pos]){
        if(dp[next] >= dp[pos] - 1) continue;

        dp[next] = dp[pos] - 1;
        if(col[next] == 0) col[next] = c;
        if(dp[next] > 0) q.push(next);
      }
    }
  }

  REP(i,n) printf("%d\n", col[i]);

  return 0;
}


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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    vector<ll> a(n);
    rep(i,0,n)scanf("%lld",&a[i]);
    ll s=0;
    rep(i,0,n)s^=a[i];
    ll ans=s;
    rep(i,0,n)a[i]&=(~s);
    ll basis[61]={};
    rep(i,0,n){
        rrep(j,60,-1){
            if(a[i]>>j&1){
                if(!basis[j]){
                    basis[j]=a[i]; break;
                }
                else a[i]^=basis[j];
            }
        }
    }
    ll add=0;
    rrep(i,60,-1)chmax(add,add^basis[i]);
    ans+=2LL*add;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class FDivisionOrSubtraction {
public:
    vector<int> get(int n) {
        vector<int> ret;
        for (int i = 2; i * i <= n; ++i) {
            if (n % i == 0) {
                ret.push_back(i);
                if (i != 1 && i * i != n) {
                    ret.push_back(n / i);
                }
            }
        }
        return ret;
    }

    bool check(int n, int k) {
        if (n < k) return n == 1;
        if (n % k == 0) return check(n / k, k);
        return (n % k) == 1;
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;

        set<int> res;
        res.insert(N);
        if (N > 2) res.insert(N - 1);
        auto v1 = get(N - 1);
        for (auto n : v1) {
            res.insert(n);
        }

        auto v2 = get(N);
        for (auto k : v2) {
            if (check(N, k)) {
                res.insert(k);
            }
        }

        cout << res.size() << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    FDivisionOrSubtraction solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int a,b;cin>>a>>b;
    int d=a/b; int r=a%b; double f=(double)a/(double)b;
    printf("%d %d %f\n",d,r,f);
    return 0;
}


Measured memory_bytes: 3232
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn gcd(a: u64, b: u64) -> u64{

    if b == 0{
        return a;
    }

    return gcd(b, a%b);
}


fn main(){
    let n: usize = read_as_vec()[0];
    let a: Vec<usize> = read_as_vec();

    if a.iter().filter(|x| **x == 1).count() < 1{
        println!("-1");
        return;
    }


    let mut target = 1;

    for &elem in &a{
        if elem == target{
            target += 1;
        }
    }

    println!("{}", n+1 - target);
}


Measured memory_bytes: 10492
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>

typedef long long ll;
using namespace std;

int main()
{
  int n, sum=0, ai;

  cin >> n;

  while(n--){
    cin >> ai;
    sum += ai - 1;
  }
  
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();

      	int[] six = new int[10];
      	int[] nine = new int[10];

      	six[0] = 6;
      	nine[0] = 9;
      	for(int i = 1 ; i < 10 ; i++){
      		six[i] = six[i-1]*6;
      		nine[i] = nine[i-1]*9;
      	}

      	int[] dp = new int[n+1];
      	int INIT = (int)1e8;
      	for(int i = 1 ; i <= n ; i++){
      		dp[i] = INIT;
      	}
      	for(int i = 0 ; i < n ; i++){
      		dp[i+1] = Math.min(dp[i]+1, dp[i+1]);
      		for(int k = 0 ; i + six[k] <= n ; k++){
      			dp[i+six[k]] = Math.min(dp[i]+1, dp[i+six[k]]);
      		}
      		for(int k = 0 ; i + nine[k] <= n ; k++){
      			dp[i+nine[k]] = Math.min(dp[i]+1, dp[i+nine[k]]);
      		}
      	}

      	System.out.println(dp[n]);
    }
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
int main () {
  int X, A, B;
  cin >> X >> A >> B;
  string ans;
  if(B - A <= 0) ans = "delicious";
  else if (B - A <= X) ans = "safe";
  else ans = "dangerous";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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; }
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    string s;
    cin >> s;
    if (s=="ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
using P = pair<int, int>;
vector<vector<int>> mindist(vector<vector<char>> S, P start)
{
    const char ok = '.', ng = '#';
    const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

    int H = S.size(), W = S[0].size();
    vector<vector<int>> dist(H, vector<int>(W, -1));

    queue<P> q;
    q.emplace(start);
    int sx = start.second, sy = start.first;
    dist[sy][sx] = 0;
    while (!q.empty())
    {
        int x = q.front().second, y = q.front().first;

        q.pop();
        for (int i = 0; i < 4; i++)
        {
            int nx = x + dx[i], ny = y + dy[i];
            if (0 <= nx and nx < W and 0 <= ny and ny < H and S[ny][nx] == ok and dist[ny][nx] == -1)
            {
                dist[ny][nx] = dist[y][x] + 1;
                q.emplace(ny, nx);
            }
        }
    }
    return dist;
}
int main()
{
    int H, W;
    cin >> H >> W;
    auto S = make_v<char>(H, W);
    rep(i, H) rep(j, W) cin >> S[i][j];
    int ans = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(S[i][j]=='.')
            {
            auto dist = mindist(S, P(i, j));
            for (int x = 0; x < W; x++)
            {
                for (int y = 0; y < H; y++)
                {
                    chmax(ans, dist[y][x]);
                }
            }
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

long long int max(long long int a, long long int b){
    if(a > b){
        return a;
    }
    else{
        return b;
    }
}

int main(){
    int N, i, T, A;
    long long int t = 1, a = 1, k,ans;
    scanf("%d", &N);
    for(i = 0; i < N; i++){
        scanf("%d%d", &T, &A);
        k = max((t + T - 1)/T, (a + A - 1)/A);
        t = T * k;
        a = A * k;
    }
    ans=t+a;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int n;
int c[maxn], siz[maxn];
stack<int> stk[maxn]; 
vector<int> E[maxn];
ll val[maxn];
ll calc(ll x) { return x * (x - 1) / 2 + x;}
void dfs(int x, int fa)
{
	siz[x] = 1;
	stk[c[x]].push(x);
	for(auto v : E[x])
		if(v != fa)
		{
			dfs(v, x);
			siz[x] += siz[v];
			int ret = siz[v];
			while(stk[c[x]].top() != x)
			{
				ret -= siz[stk[c[x]].top()];
				stk[c[x]].pop();
			}
			val[c[x]] -= calc(ret);	
		}
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
		scanf("%d", &c[i]);
	for(int i = 1; i < n; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	for(int i = 1; i <= n; ++i) val[i] = calc(n);
	dfs(1, 0);
	for(int i = 1; i <= n; ++i)
	{
		int ret = n;
		while(!stk[i].empty())
		{
			ret -= siz[stk[i].top()];
			stk[i].pop();
		}
		val[i] -= calc(ret);
		cout << val[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 168532
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
  int N;
  cin >> N;
  vector<ll>A(N+1),B(N);
  rep(i,N+1)cin >> A[i];
  rep(i,N)cin >> B[i];
  ll ans=0;
  rep(i,N){
    if(B[i]<=A[i]){
      ans+=B[i];
    }
    else{
      ans+=A[i];
      B[i]-=A[i];

      ll nx=min(A[i+1],B[i]);
      A[i+1]-=nx;
      ans+=nx;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e5 + 7;
int n;
int pos[maxx];
bool vis[maxx];
int seq[maxx];
LL k;

int main() {
	scanf("%d %lld", &n , &k);
	for(int i = 1; i <= n; i++) scanf("%d", &pos[i]);
	int nxt = 1;
	int t = -1;
	seq[++t] = nxt;
	int i = 1;
	while(!vis[i]) {
		vis[nxt] = 1; //先打标记
		nxt = pos[i]; //更新nxt
		seq[++t] = nxt;
		i = nxt; //替换
	}
	//seq[t]是第一次重复的数字
	//定位第一次出现时的位置fir
	int x = 0;
	for(int j = 0; j < t; j++) {
		if(seq[j] == seq[t]) {
			x = j;
			break;
		}
	}
	//cout << x << endl;
	if(k <= x) printf("%d\n", seq[k]);
	else { 
		k -= (LL)x;
		LL id = k % ((LL)t - (LL)x);
		printf("%d\n", seq[x + id]);
	}
	return 0;
}

Measured memory_bytes: 5472
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <deque>
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };
 
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, n);
    deque<int> b;
    bool f = true;
    Rep(n){
        Cin(int, a);
        if(f) b.push_back(a); else b.push_front(a);
        f ^= true;
    }
    if(!f) Reverse(b);
    Couts(b);
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int n,m,i,d[1000005],u,v,ans,head[1000005],Next[2000005],adj[2000005],k,s;
bool flag=true;
void Push(int u,int v)
{
	Next[++k]=head[u];
	head[u]=k;
	adj[k]=v;
}
void dfs(int i,int fa)
{
	if((i==u&&fa!=0)||i==v)
	{
		if(i==v)
			++s;
		return;
	}
	int j;
	for(j=head[i];j!=0;j=Next[j])
		if(adj[j]!=fa)
			dfs(adj[j],i);
}
int main()
{
	scanf("%d %d",&n,&m);
	for(i=1;i<=m;++i)
	{
		scanf("%d %d",&u,&v);
		++d[u];
		++d[v];
		Push(u,v);
		Push(v,u);
	}
	for(i=1;i<=n;++i)
	{
		ans+=d[i]/2-1;
		if(d[i]&1)
			flag=false;
	}
	u=v=0;
	for(i=1;i<=n;++i)
		if(d[i]==4)
			if(u==0)
				u=i;
			else
				v=i;
	if(ans==2&&v!=0&&flag)
	{
		dfs(u,0);
		if(s>2)
			flag=false;
	}
	puts(ans>=2&&flag?"Yes":"No");
}


Measured memory_bytes: 9984
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator

void solve() {
    int n,k;cin>>n>>k;
    int res=0;
    for(int i=0;i<n;i++) {
        int x;cin>>x;
        res += 2*min(x,k-x);
    }
    cout<<res<<endl;
}

int main() {
    solve();
    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<string> s(N);
    vector<int> t(N);
    for (int i=0; i<N; i++) cin >> s[i] >> t[i];
    string x; cin >> x;
    int ans = 0;
    bool sleep = false;
    for (int i=0; i<N; i++) {
        if (sleep) ans += t[i];
        else if (x == s[i]) sleep = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	string s,t;cin>>s>>t;
	int a,b;cin>>a>>b;
	string y;cin>>y;
	if(y==s){
		a--;
	}
	else{
		b--;
	}
	cout<<a<<" "<<b;
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int NMAX = 100000 + 5;

int N;
int A[NMAX];

int main()
{
    ios_base :: sync_with_stdio(false);

    cin >> N;
    for (int i = 1; i <= N; ++ i)
        cin >> A[i];

    int ans = 0;
    for (int i = 1; i <= N; ++ i) {
        ++ ans;
        bool jos = false;
        bool sus = false;

        int j;
        for (j = i + 1; j <= N; ++ j)
            if (A[j] != A[j - 1]) {
                if (A[j] < A[j - 1]) {
                    sus = true;
                    if (jos)
                        break;
                }
                else {
                    jos = true;
                    if (sus)
                        break;
                }
            }

        i = j - 1;
    }

    cout << ans << '\n';
    return 0;
}


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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
#define gcd(x, y) __gcd((x), (y))

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vii;

const ld EPS = 1e-9, PI = acos(-1.);
const ll LINF = 0x3f3f3f3f3f3f3f3f, LMOD = 1011112131415161719ll;
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

ll n, k, a[N], dp[N];

int main () {
    scanf("%lld%lld", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    cl(dp, 63);
    dp[1] = 0;
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j <= k and i-j >= 1; j++) {
            dp[i] = min(dp[i], dp[i-j] + abs(a[i]-a[i-j]));
        }
    }
    printf("%lld\n", dp[n]);
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<62)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(auto _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa

using namespace std;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll a, b, c, d; cin >> a >> b >> c >> d;
  ll ans = -infl;
  if ((a <= 0 && b >= 0) || (c <= 0 && d >= 0)) ans = 0;
  ans = max(ans, b*d);
  ans = max(ans, b*c);
  ans = max(ans, a*d);
  ans = max(ans, a*c);
  cout << ans;
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	int n = S.size();
	bool d=true;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
	            if(S[i] == S[j]) d = false;		
		}
	}
	if(d) cout <<"yes" << endl;
	else cout << "no" << endl;
}

Measured memory_bytes: 256