akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}

void mainsolve(){

	ll k,x;
	cin >> k >> x;
	if(500*k >= x) cout << "Yes" << endl;
	else cout << "No" << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int m,f,b;
    cin >> m >> f >> b;
    
    if(b<m){
        cout << 0 << endl;
    }else if(m<b){
        if((m+f)>=b){
            cout << b-m << endl;
        }else{
            cout << "NA" << endl;
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

double sum[252521];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(10)<<fixed;
  int n, k;
  double p[252521];
  cin>>n>>k;
  sum[0]=0;
  REP(i, n){
    cin>>p[i];
    sum[i+1]=sum[i]+(p[i]+1)/2;
  }
  double ans=0;
  REP(i, n-k+1){
    CHMAX(ans, sum[i+k]-sum[i]);
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 3456
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

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


#define U_TYPE ll

U_TYPE gcd(U_TYPE a, U_TYPE b){
    return b != 0 ? gcd(b, a % b) : a;
}

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

    ll C = gcd(A, B);
    ll i;
    ll ans = 1;
    for(i = 2; i * i <= C; i++){
        if(C % i == 0){
            ans++;
        }
        while(C % i == 0){
            C /= i;
        }
    }
    if(C != 1){
        ans++;
    }

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 3640
import sys
from collections import defaultdict

def get_rect_pos(a, b):
    pos = []
    for i in range(3):
        for j in range(3):
            pos.append((a-i, b-j))

    return pos


def main():
    input = sys.stdin.readline
    H, W, N = map(int, input().split())
    d = defaultdict(lambda: 0)
    for _ in range(N):
        a, b = map(int, input().split())
        pos = get_rect_pos(a, b)
        for p in pos:
            if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:
                continue

            d[p] += 1

    ans = [0 for _ in range(10)]
    for key in d.keys():
        i = d[key]
        ans[i] += 1

    ans[0] = (H - 2) * (W - 2) - sum(ans)

    for i in ans:
        print(i)


if __name__ == '__main__':
    main()


Measured memory_bytes: 166880
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////




int main() {

	string s;
	cin >> s;
	ll n = s.size();

	ll ans = 0;

	rep(i, n / 2) {
		if (s[i] != s[n-1 - i]) { ans++; }
	}

	cout << ans;
	
	
	system("PAUSE");
}

Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;

namespace ARC059_D___アンバランス
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver());
        }

        static string solver()
        {
            var s = Console.ReadLine();
            var alphabetIndexes = new List<int>[26];
            if (s.Length == 2 && s[0] == s[1]) return "1 2";
            for (int i = 2; i < s.Length; i++)
            {
                if (s[i - 2] == s[i] || s[i - 1] == s[i])
                {
                    return ($"{i - 1} {i + 1}");
                }
            }
            return "-1 -1";
        }
    }
}


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

#define fi first 
#define se second

const int maxn = 1e5+1;

vector<pair<int,int> > g[maxn];
int ans[maxn];

void dfs(int cur,int par){
    if(cur==par) ans[cur] = 0;
    for(auto it:g[cur]){
        if(it.fi==par) continue;
        if(it.se%2){
            ans[it.fi] = !ans[cur];
        }
        else{
            ans[it.fi] = ans[cur];
        }
        dfs(it.fi,cur);
    }
}

int main(){

    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif

    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int x,y,z;
        cin>>x>>y>>z;
        g[x].push_back(make_pair(y,z));
        g[y].push_back(make_pair(x,z));
    }
    dfs(1,1);
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#define reg(i,a,b) for(int i=a;i<=b;++i)
typedef long long ll;
using namespace std;
const int mx=1e5+10;
int ans;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>b){
		ans=a;
		--a;
	}else{
		ans=b;
		--b;
	}
	if(a>b){
		ans+=a;		
	}else{
		ans+=b;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  string fir = ""s + S.at(0) + S.at(1);
  string sec = ""s + S.at(2) + S.at(3);
  int top = stoi(fir); int last = stoi(sec);
  bool a = false; // topがMMの可能性
  bool b = false; // lastがMMの可能性
  for (int i = 1; i < 13; i++) {
    if (i == top) a = true;
    if (i == last) b = true;
  }
  if(a) {
    if(b) cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  }
  else {
    if(b) cout << "YYMM" << endl;
    else cout << "NA" << endl;
  }
}


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

int main()
{
    string S;
    cin >> S;
    int num[3] = { 0 };
    for (char c : S) {
        num[c - 'a']++;
    }
    int max_num = INT_MIN, min_num = INT_MAX;
    for (int i = 0; i < 3; i++) {
        max_num = max(max_num, num[i]);
        min_num = min(min_num, num[i]);
    }
    if (max_num - min_num >= 2) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}


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

int main(void) {
    int N,M,X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector< vector<int> > A(N, vector<int>(M));

    int sumn = 0;
    for(int i=0;i<N;i++) {
        cin >> C[i];
        sumn += C[i];
        for(int j=0;j<M;j++) {
            cin >> A[i][j];
        }
    }

    int ans = sumn;
    bool find = false;
    for(int i=0;i<(1<<N);i++) {
        vector<int> S(M,0);
        int sum = 0;
        for(int j=0;j<N;j++) {
            if ((i&(1<<j))==0) continue;
            for(int k=0;k<M;k++) {
                S[k]+=A[j][k];
            }
            sum += C[j];
        }
        int cnt = 0;
        for(int j=0;j<M;j++) {
            if (S[j]>=X) cnt++;
        }
        if (cnt==M) {
            find = true;
            if (sum < ans) ans = sum;
        }
    }

    if (find)
        cout << ans << endl;
    else
        cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
    set<char>odd={'R', 'U', 'D'};
    set<char>even={'L', 'U', 'D'};
    string S;
    cin>>S;
    bool yes=true;
    REP(i,0,S.length()){
        char c= S[i];
        if((i%2+1)==1){//odd
            if(odd.find(c)==odd.end()){
                yes=false;
                break;
            }
        }else{
            if(even.find(c)==even.end()){
                yes=false;
                break;
            }
        }
    }
    Yes(yes);

  return 0;
}


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

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

ll memo[101010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, K;
    cin >> N >> K;
    ll R, S, P;
    cin >> R >> S >> P;
    string t; cin >> t;

    ll ans = 0;
    rep(i, N) {
        if (t[i] == 'r') ans += P;
        else if (t[i] == 's') ans += R;
        else if (t[i] == 'p') ans += S;
        if (i+K < N && t[i] == t[i+K]) t[i+K] = '.';
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(true){
    C -= B;
    if(C <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    
    A -= D;
    if(A <= 0){
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3604
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>

using namespace std;

int main() {

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

	while (1) {

		int N, m[4] = { 202,202,202,202 }, box[405][405],n[205],d[205];

		cin >> N;
		if (N==0) break;
		for (int i = 1; i < N; i++) {
			cin >> n[i] >> d[i];
		}

		for (int i = 0; i < 405; i++) {
			for (int j = 0; j < 405; j++) {
				box[i][j] = -1;
			}
		}
		box[202][202] = 0;

		for (int i = 1; i < N; i++) {
			
			int x, y;		
			for (int k = 0; k < 405; k++) {
				for (int l = 0; l < 405; l++) {
					if (box[k][l] == n[i]) {
						x = l;
						y = k;
					}
				}
			}

			for (int k = 0; k < 4; k++) {
				if (d[i] == k) {
					box[y+dy[k]][x + dx[k]] = i;
					if (d[i] == 0) m[0] = min(m[0], x + dx[k]);
					if (d[i] == 2) m[2] = max(m[2], x + dx[k]);
					if (d[i] == 1) m[1] = max(m[1], y + dy[k]);
					if (d[i] == 3) m[3] = min(m[3], y + dy[k]);
					break;
				}
			}

		}

		int tate, yoko;
		tate = m[1] - m[3];
		yoko = m[0] - m[2];
		if (tate < 0) tate *= (-1);
		if (yoko < 0) yoko *= (-1);

		cout << yoko+1 << " " << tate+1 << endl;

	}

	return 0;
}

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


int main(){
  ll n,m,d;
  cin >> n >> m >> d;
  double ans;
  if(d==0){
    ans=(1.0)/(double)n;
    ans*=(m-1);
  }else{
    ans=(double)(2.0*(n-d))/(double)(n*n);
    ans*=(m-1);
  }
  printf("%.10lf\n",ans);
  return 0;
}


Measured memory_bytes: 3716
#include <stdio.h>
#pragma warning (disable:4996)

int main() {
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	if (A + B >= C)
		printf("%d\n", B + C);
	else
		printf("%d\n", A + (2*B) + 1);
}

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

const int N = (int) 2e5 + 5;

int n, k;
long long a[N];
map <long long, long long> remain;

int main() {
	ios_base :: sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> k;
	remain[0]++;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i]; a[i] += a[i - 1];
		if (i - k >= 0) remain[(a[i - k] - (i - k)) % k]--;
		ans += remain[(a[i] - i) % k]++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 14336
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),t=Number(r[0]),n=r[1].split(" ").map(function(e){return Number(e)}),o={},u=0;u<t;u++){var i=n[u];o[i]?1==o[i]?o[i]=2:o[i]=1:o[i]=1}var f=0,l=0;for(var c in o)o[c]%2==0?(f+=2,l+=1):f+=1;f-=2*Math.floor(l/2),l%2!=0&&(f-=2),console.log(f)}},function(e,r){e.exports=require("fs")}]);

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

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

    int dp[3][100001];
    dp[0][1] = a[1];
    dp[1][1] = b[1];
    dp[2][1] = c[1];
    for (int i = 2; i <= n; i++)
    {
        dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a[i];
        dp[1][i] = max(dp[0][i - 1], dp[2][i - 1]) + b[i];
        dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]) + c[i];
    }
    cout << max(dp[0][n], max(dp[1][n], dp[2][n])) << endl;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <map>
#include <string>
using namespace std;

int main(){
  map<string,int> B;
  int s;
  char b[2];
  string str;
  while(scanf("%d,%s",&s,b)>0){
    str=b;
    B[str]++;
  }
  printf("%d\n%d\n%d\n%d\n",B["A"],B["B"],B["AB"],B["O"]);
  return 0;
}

Measured memory_bytes: 1076
n, m, l = map(int, input().split())

nm = []
ml = []

for _ in range(n):
	lista = list(map(int, input().split()))
	nm.append(lista)

for _ in range(m):
	lista = list(map(int, input().split()))
	ml.append(lista)
	
matrix = []

for i in range(n):
	lista = []
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += nm[i][k]*ml[k][j]
		lista.append(sum)
	matrix.append(lista)

for i in range(n):
	text = ""
	for j in range(l):
		text += str(matrix[i][j]) + " "
	print(text[:-1])

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

int main() 
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
  ll n,p,count=0;cin>>n;
  ll q=1;
  //q.push(n);
  while(q<=n)
  q<<=1;
  q--;
  cout<<q;
 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int sum[n];
  int num[n][3];
  memset(sum,0,sizeof(sum));
  
  for(int i=0;i<n;i++)
    {
      cin>>num[i][0]>>num[i][1]>>num[i][2];
    }
  for(int x=0;x<3;x++)
    {
      for(int i=0;i<n;i++)
	{	
	  int count=0;
	  for(int j=0;j<n;j++)
	    if(num[i][x]==num[j][x])
	      count++;
	  if(count==1)
	    sum[i]+=num[i][x];
	}
    }
  for(int j=0;j<n;j++)
    cout<<sum[j]<<endl;

}

Measured memory_bytes: 1172
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

int edit_distance(string s, string t){
    int n = (int)s.length(), m = (int)t.length();
    vector< vector<int> > dp(n+1, vector<int>(m+1, 1000000));
    dp[0][0] = 0;
    rep(n) dp[i+1][0] = i+1;
    rep(m) dp[0][i+1] = i+1;
    rep(n){
        repp(j, m){
            // replace
            if(s[i] == t[j]){
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]);
            }else{
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + 1);
            }
            // insert
            dp[i+1][j+1] = min(dp[i+1][j+1], dp[i+1][j] + 1);
            // delete
            dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j+1] + 1);
        }   
    }
    return dp[n][m];
}

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

    string s,t;
    cin >> s >> t;
    cout << edit_distance(s, t) << endl;
}

Measured memory_bytes: 6776
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long
#define pb push_back 
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<ll>
#define vll vector<long long>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl;
#define cno cout << "No" << endl;
#define mod 1000000007
#define mod2 998244353
#define INT_MAX1 900000000
//////////////////////////////////////////////////////////////////////////////////////////////


int n;
vector<vi> q;
int dp[100001][2];
bool v[100001][2];

int s1(int i, bool s, int p)
{

    if(q[i].size()==1 and p!=-1)
    {
        return 1;
    }
    if(q[i].size()==0)
        return 1;
    if(v[i][s])
        return dp[i][s];

    v[i][s] = 1;
    dp[i][s] = 1;
    loop(q[i])
    {
        if(it==p)
            continue;
        if(!s)
            dp[i][s] *= (s1(it,s,i)+s1(it,!s,i))%mod;
        else
            dp[i][s] *= s1(it,!s,i);
        dp[i][s] %= mod;
    }

    dp[i][s]%=mod;
    return dp[i][s];
}

void solve()
{
    cin >> n;
    q.rs(n+1);
    rep(i,0,n-2)
    {
        int l,r;
        cin >> l >> r;
        q[l].pb(r);
        q[r].pb(l);
    }

    cout << (s1(1,0,-1) + s1(1,1,-1))%mod;
    
}

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

Measured memory_bytes: 15872
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;


#define mk make_pair
#define pb push_back

typedef long long lld;
typedef pair<lld,lld> pr;
typedef priority_queue <lld> max_heap;
typedef priority_queue <lld, vector<lld>, greater<lld> > min_heap;
lld const mod = 1e9+7;
lld const N = 1e5+5;
#define ordered_set tree<lld, null_type,less<lld>, rb_tree_tag,tree_order_statistics_node_update>

lld fact[N], ifact[N];

lld power(lld x, lld y)
{
    lld res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}

lld power_mod(lld base, lld y)
{
    lld t = 1;
    while (y > 0)
    {

        if (y % 2 != 0)
            t = (t * base) % mod;
        base = (base * base) % mod;
        y /= 2;
    }
    return t % mod;
}

void findFact() {
    fact[0] = 1;
    for(lld i = 1; i <= N; i++)
        fact[i] = 1ll * fact[i - 1] * i % mod;
    ifact[N] = power_mod(fact[N], mod - 2);
    for(lld i = N - 1; i >= 0; i--)
        ifact[i] = 1ll * ifact[i + 1] * (i + 1) % mod;
}

lld comb(lld n, lld r) {
    return 1ll * fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}


lld gcd(lld a, lld b)
{
  if(b==0)
    return a;
  return gcd(b,a%b);
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld d,t,s;
  cin>>d>>t>>s;
  if(t*s>=d)
  {
    cout<<"Yes\n";
  }
  else
  {
    cout<<"No\n";
  }
}


Measured memory_bytes: 3648
type blood = {mutable a: int; mutable b: int; mutable ab: int; mutable o: int}

let count br bs =
  if bs = "A" then br.a <- br.a + 1
  else if bs = "B" then br.b <- br.b + 1
  else if bs = "AB" then br.ab <- br.ab + 1
  else br.o <- br.o + 1

let _ =
  let c = {a=0; b=0; ab=0; o=0} in
  try
    while true do
      let bt = Scanf.scanf "%d,%s\n" (fun x y -> y) in
      count c bt
    done
  with
    End_of_file -> Printf.printf "%d\n%d\n%d\n%d\n" c.a c.b c.ab c.o

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

#define MAX 100002

int n;
int q;

vector<long long int> v;

map<long long int, long long int> mp;
map<long long int, long long int> nex;

long long int im[MAX];

int main(){
	cin >> n;
	cin >> q;
	v.push_back(n);
	for (int i = 0; i < q; i++){
		long long int a;
		scanf("%lld", &a);
		v.push_back(a);
	}
	long long int cur_len = v.back();
	mp[-cur_len] = 1;
	for (int i = v.size() - 1; i > 0; i--){
		nex.clear();
		long long int pr = v[i - 1];
		vector<long long int> del;
		for (auto it = mp.begin(); it != mp.end(); it++){
			long long int val = -(*it).first;
			if (val <= pr){
				break;
			}
			long long int se = (*it).second;
			long long int sa = val / pr;
			nex[pr] += sa*se;
			sa = val%pr;
			if (sa){
				nex[sa] += se;
			}
			del.push_back((*it).first);
		}
		for (int j = 0; j < del.size(); j++){
			mp.erase(del[j]);
		}
		for (auto it = nex.begin(); it != nex.end(); it++){
			mp[-(*it).first] += (*it).second;
		}
	}
	for (auto it = mp.begin(); it != mp.end(); it++){
		im[-(*it).first] += (*it).second;
	}
	for (int i = n-1; i >= 1; i--){
		im[i] += im[i + 1];
	}
	for (int i = 1; i <= n; i++){
		printf("%lld\n", im[i]);
	}
	return 0;
}

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

int main(){
    int x;
    int i = 1;
    while (1){
        cin >> x;
        if (x == 0){
            break;
        } else{
            cout << "Case" << ' ' << i << ':' << ' ' << x << endl;
        }
        i++;
    }
    return 0;
}


Measured memory_bytes: 2992
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream,getline
#include <numeric>	//gcd
#include <deque>	//deque

using namespace std;

int main() {

	int A, B, C;
	cin >> A >> B >> C;

	int ans = C - (A - B);
	if (ans < 0) {
		ans = 0;
	}

	cout << ans << endl;

	return 0;

}

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

typedef long long ll;

const int Maxn = 100005;

int n, m;
int a[Maxn];

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

int main()
{
    scanf("%d %d", &n, &m);
    ll cur = 1;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]); a[i] /= 2;
        cur = cur / gcd(cur, a[i]) * a[i];
        if (cur > m) { printf("0\n"); return 0; }
    }
    for (int i = 1; i <= n; i++)
        if (cur / a[i] % 2 == 0) { printf("0\n"); return 0; }
    cout << 1 + (m - cur) / (2 * cur) << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

ll a[5],ans=1e18;

int main(void){
	rep(i,5)cin>>a[i];
	const int N = 5;
	vector<int> v(N);
	iota(v.begin(), v.end(), 0);
	// rep(i,N)cout<<v[i]<<endl;
	do{
		ll tmp=0;
		for(auto x : v){
			if(tmp%10!=0){
				tmp+=(10-tmp%10);
			}
			tmp+=a[x];
		}
		ans=min(ans,tmp);
	}while( next_permutation(v.begin(), v.end()) );
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e15;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 1e5 + 100;
const int LOG = 20;
const int mod = 1e9 + 7;
const int MX = 1e6 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;


vector<int> g[MAXN];
ll dp[MAXN][2];
void dfs(int v,int p){
    int sum = 0;
    for(int to:g[v]){
        if(to==p)
            continue;
        dfs(to,v);
        sum++;
    }
    dp[v][0] = dp[v][1] = 1;
    for(int to:g[v]){
        if(to==p)
            continue;
        dp[v][1] = (dp[v][1] * dp[to][0] )%mod;

        dp[v][0] = (dp[v][0] * (dp[to][0] + dp[to][1]))%mod;
    }

    dout << v <<" "<<dp[v][0] <<" "<<dp[v][1]<<"\n";

}

void solve() {
    int n;
    cin >> n;
    for(int i=1;i<=n-1;++i){
        int a,b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(1,-1);
    ll ans = (dp[1][1] + dp[1][0])%mod;
    cout << ans;


}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;

    while (t--)
        solve();
    dout << endl << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 14208
#include <stdio.h>

int main(void)
{
	int N,i;
	scanf("%d",&N);
	if(N%10==7){
		printf("Yes");
	}else{
		i=N%10;
		N=N-i;
		if(N%100==70)printf("Yes");
		else{
			i=N%100;
			N=N-i;
			if(N%1000==700)printf("Yes");
			else printf("No");
		}
	}
	return 0;
}

Measured memory_bytes: 1732
using System;
class ProgramC
    {
        static void Main(string[] args)
        {
            
            //入力
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int[] right = new int[n];

            for(int i = 0;i < n;i++)
                right[i] = 0;

            int[] wrong = new int[n];

            for(int i = 0;i < m;i++)
            {
                string[] temp = Console.ReadLine().Split(' ');
                int p = int.Parse(temp[0]);
                string s = temp[1];

                if(right[p-1] == 1)
                    continue;
                
                if(s == "WA")
                {
                    wrong[p-1]++;
                }
                else
                {
                    right[p-1] = 1;
                }
            }

            //答え出力
            int ans1 = 0;
            int ans2 = 0;
            for(int i = 0;i < n; i++)
            {
                ans1 += right[i];
                if(right[i] == 1)
                    ans2 += wrong[i];

            }
            Console.WriteLine(ans1 + " " + ans2);
          
        } 
    }

Measured memory_bytes: 15712
#include <iostream>
#include <string>
#include <numeric>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n;
	vector<int> num;
	do
	{
		cin >> n;
		num.push_back(n);
	}while (n != 0);
	num.pop_back();

	int dp[30];
	dp[0] = 1;
	dp[1] = 2;
	dp[2] = 4;

	for (int i = 3; i < 30; i++)
	{
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	}

	for (auto it = num.begin(); it != num.end(); it++)
	{
		cout << dp[*it - 1]/3650 + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
#include <stdio.h>

int lot[100000];

int main(void) {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &lot[i]);

	long long max = 0;
	for (long long c = 1; c < n-1; c++) {
		long long sum = 0;
		for (long long k = 1; (k+1)*c < n-1; k++) {
			if ((n-1)%c == 0 && n-1 <= 2*k*c) break;
			sum += lot[n-1 - k*c] + lot[k*c];
			if (max < sum) max = sum;
		}
	}
	printf("%lld\n", max);
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>


int main(void){
    int a;
    char s[50];
    char ss;
    scanf("%s", s);
    a = strlen(s);
    if(a == 3){
        ss = s[0];
        s[0] = s[2];
        s[2] = ss;
    }
    printf("%s\n", s);
    return 0;
}

Measured memory_bytes: 128
import java.io.PrintStream;
import java.math.BigDecimal;
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        doit(args, new Scanner(System.in), System.out);
    }

    static void doit(String[] args, Scanner scanner, PrintStream out) {
        while (scanner.hasNext()) {
            double a = scanner.nextDouble();
            double b = scanner.nextDouble();
            double c = scanner.nextDouble();
            double d = scanner.nextDouble();
            double e = scanner.nextDouble();
            double f = scanner.nextDouble();
            double x = (c * e - b * f) / (a * e - b * d);
            double y = (c * d - a * f) / (b * d - a * e);
            out.println(String.format("%.3f %.3f", new BigDecimal(x).setScale(
                    3, BigDecimal.ROUND_HALF_UP), new BigDecimal(y).setScale(3,
                    BigDecimal.ROUND_HALF_UP)));
        }
    }
}

Measured memory_bytes: 12000
while True:
	n, x = map(int, input().split())
	if n == 0 and x == 0:
		break
	ans = 0
	for i in range(1, n + 1):
		for j in range(i+1, n+1):
			for k in range(j+1, n+1):
				if i + j + k == x:
					ans += 1
	print(ans)



Measured memory_bytes: 5596
#include <stdio.h>
#include <string.h>

int main(void){
    char S[20];
    char T[20];

    int i,j;

    scanf("%s%s", S, T);
 /* 文字数をカウント */
    for(i=0; S[i]!='\0'; ++i);
    for(j=0; T[j]!='\0'; ++j);

    if (strncmp(S, T, i) == 0 && i+1 == j){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
		
    return 0;
}

Measured memory_bytes: 1680
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>
#define Matd vector<vector<ld>>
#define Arrd vector<ld>

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    const ll MX = 1000000000LL;
#define out(a, b, c, d, e, f) cout << a << ' '             \
                                   << b << ' ' << c        \
                                   << ' ' << d << ' ' << e \
                                   << ' ' << f << endl
    ll n;
    cin >> n;
    if (n <= MX)
    {
        out(0, 0, n, 0, n, 1);
        return 0;
    }
    pair<ll, ll> x = {MX, MX}, y = {0, 0};
    n = MX * MX - n;
    x.fi -= n / (ll)MX;
    y.se += n % (ll)MX;
    if(y.se > 0) y.fi++;
    out(0, 0, y.fi, x.se, x.fi, y.se);
    return 0;
}

Measured memory_bytes: 256
def main():
    from collections import defaultdict
    from heapq import heappush, heappop
    _, m, *ab = map(int, open(0).read().split())
    works = defaultdict(list)
    for a, b in zip(ab[0::2], ab[1::2]):
        works[a].append(-b)

    candidates, pay = [], 0
    for day in range(1, m+1):
        for x in works[day]:
            heappush(candidates, x)
        if candidates:
            pay += heappop(candidates)
    print(-pay)

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 35552
def ST_string_2():
	x = str(raw_input())
	stack = ['#']
	for c in x:
		if c=="S":
			stack.append(c)
		else:
			if stack[-1]=="S":
				stack.pop()
			else:
				stack.append(c)
	print len(stack)-1

if __name__ == "__main__":
	ST_string_2()

Measured memory_bytes: 4480
import java.util.Scanner;

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

		// 入力値の取得
		int X = sc.nextInt();
		
		// 結果の出力
		System.out.println(X >= 30? "Yes" : "No");
		
		sc.close();
	}
}


Measured memory_bytes: 27100
#ABC118D-MatchMatching.py

import sys
from functools import lru_cache

sys.setrecursionlimit(10000)

input = sys.stdin.readline

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

A = list(map(int, input().split()))
A.sort(reverse=True)

B = [2,5,5,4,5,6,3,7,6]

def num(n):
    return B[n-1]

@lru_cache(maxsize=None)
def dp(i):
    if i == 0:
        return 0
    elif i < 0:
        return -float('inf')
    else:
        C = []
        for j in range(M):
            C.append(dp(i-num(A[j]))+1)
        return max(C)

s = ''
n = dp(N)
K = N

for i in range(n):
    for j in range(M):
        if dp(K-num(A[j])) == dp(K)-1:
            s += str(A[j])
            K -= B[A[j]-1]
            break

print(int(s))


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

using namespace std;

typedef long long ll;

const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T>
inline void chkmin(T&a, T b) { a = a < b ? a : b; }

const int MAXN = 100010;

struct UFS {
	int fa[MAXN];

	inline void init(int n) { for(int i = 1; i <= n; i++) fa[i] = i; }
	inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
	inline int Merge(int u, int v) {
		int fu = find(u), fv = find(v);
		if(fu == fv) return 0;
		return fa[fu] = fv, 1;
	}
}ufs;

int tot;
int fi[MAXN];
int to[MAXN << 1];
int ne[MAXN << 1];

inline void Link(int u, int v) {
	tot++;
	to[tot] = v;
	ne[tot] = fi[u];
	fi[u] = tot;
}

int N;
int st[MAXN];
int col[MAXN];
int fa[MAXN];

inline ll Dfs(int x, int la, int d) {
	ll res = 0; col[x] = d, fa[x] = la;
	for(int i = fi[x]; i; i = ne[i]) {
		int u = to[i];
		if(u == la) continue;
		res += Dfs(u, x, -d), col[x] += col[u];
	} return !la && col[x] ? -1 : res + abs(col[x]);
}

int main() {
	int n = ri, m = ri, rt = 1, rem = -1;

	ufs.init(n);
	for(int i = 1; i <= m; i++) {
		int u = ri, v = ri;
		if(ufs.Merge(u, v)) Link(u, v), Link(v, u);
		else rt = u, rem = v;
	}

	Dfs(rt, 0, 1);

	if(~rem) {
		for(int i = rem; i; i = fa[i]) st[++N] = col[i];
		if(N & 1) {
			if(abs(col[rt]) & 1) return puts("-1"), 0;
			for(int i = rem; i; i = fa[i]) col[i] -= col[rt] >> 1;
		} else {
			if(col[rt]) return puts("-1"), 0;
			sort(st + 1, st + 1 + N);
			for(int i = rem; i; i = fa[i]) col[i] -= st[N >> 1];
		}
	} else if(col[rt]) return puts("-1"), 0;
	ll res = 0;
	for(int i = 1; i <= n; i++) res += abs(col[i]);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll N, M, K;
const ll mod = 1e9 + 7;
ll kai[300010];
ll F[300010];
ll ans;

ll fer(ll x, ll y){
    ll add=(kai[x]*F[y])%mod;
    add*=F[x - y];
    add%=mod;
    return add;
}

ll fermat(ll x, int y) {
	if (y == 0)return 1;
	if (y == 1)return x;
	ll F = fermat(x, y / 2);
	F *= F;
	F %= mod;
	if (y % 2)return(F*x) % mod;
	else return F;
}

void init(int n){
    kai[0] = 0;
    kai[1]=1;
    for(int i=2;i<=n;i++){
        kai[i]=kai[i-1]*i%mod;
    }
    F[n]=fermat(kai[n],mod-2);
    for(int i=n;i>0;i--){
        F[i-1]=(F[i]*i)%mod;
    }
    F[0] = 1;
}

int main(){
    cin >> N >> M >> K;
    ll ok = 0;
    init(N * M);
    ll sum = 0;
    for(ll i = 1; i <= N; i++){
        sum += i * (i - 1) * M * M / 2;
        sum %= mod;
    }
    for(ll i = 1; i <= M; i++){
        sum += i * (i - 1) * N * N / 2;
        sum %= mod;
    }
    sum *= fer(N * M - 2, K - 2);
    sum %= mod;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3840
import java.util.Map.Entry;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		long ans = 0;
		
		if(A + B >= C) ans = C + B;
		else{
			ans += B;
			ans += B + A + 1;
		}
		
		System.out.println(ans);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int p = 0;
    rep(i, 1, n + 1)
    {
        if (i % 2 == 1)
        {
            p++;
        }
    }
    printf("%.10f\n", (double)p / (double)n);
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a,b=0,0
flag=0
for i in range(n):
    p,x=map(str,input().split())
    if p=="(":a+=int(x)
    else:b+=int(x)
    if a<b:
        flag=1
        break
if flag==1 or a!=b:print("NO")
else:print("YES")



Measured memory_bytes: 5612
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>

#define LL  long long
using namespace std;
int N;

int main()
{
    scanf("%d", &N);
    LL sum = 0;
    for(int i=1; i<=N; i++) {
        if(i%3 == 0 || i%5 == 0) continue;
        sum += i;
    }
    cout << sum <<endl;
    return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    int a,b,c;cin >> a >> b >> c;
    if((c>a&&c<b)||(c<a&&c>b))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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, D1, D2 = reads()
NN = 2 * N

def deg(x):
  return next(i for i in count() if x >> i & 1 == 1)

def group(x, y, d):
  p = deg(d)
  hp = p >> 1
  if p & 1 == 0:
    return (x >> hp & 1) ^ (y >> hp & 1)
  else:
    return x >> hp & 1

pts = [(x, y) for x in range(NN) for y in range(NN) if group(x, y, D1) == 0 and group(x, y, D2) == 0]
for x, y in pts[:N**2]:
  print(x, y)


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

using namespace std;
const int mod = 924844033;
const int maxn = 4000 + 10;
typedef long long int lli;

int link[maxn];
lli x[maxn];
lli dp[maxn][maxn][2];

int main() {
    int n, k, tot = 0;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= k; i++) {//i枚举链的起点
        for (int p = 0; p < 2; p++) {//因为p=0时,起点为第i个点,p=1时,为第i个坑
            for (int j = i; j <= n; j += k) {
                tot++;
                if (j != i) link[tot] = 1;//link[i]代表第i条边是否与上一条边相连
            }
        }
    }
    x[1] = 1;
    x[0] = 1;
    for (int i = 2; i <= n; i++) {
        x[i] = x[i - 1] * i % mod;
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n * 2; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i + 1][j][0] = (dp[i][j][0] + dp[i][j][1]) % mod;
            if (link[i + 1]) dp[i + 1][j + 1][1] = dp[i][j][0];
        }
    }
    lli sum = 0, t = 1;
    for (int i = 0; i <= n; i++) {
        lli tmp = (dp[n * 2][i][0] + dp[n * 2][i][1]) % mod * x[n - i] % mod;
        sum = (sum + (tmp * t + mod) % mod) % mod;
        t *= -1;
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 249728
#include <iostream>
using namespace std;
int main(void){
int i,o,l,p,s,k,a,b,c,d;
cin>>i>>o>>l>>p>>a>>b>>c>>d;
k=(i*a+o*b)+c*(i/10)+d*(o/20);
s=(l*a+p*b)+c*(l/10)+d*(p/20);
if(k<s){
    cout<<"kenjiro"<<endl;
}
if(k>s){
    cout<<"hiroshi"<<endl;
}
if(k==s){
    cout<<"even"<<endl;
}
}



Measured memory_bytes: 3100
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int[] pos = new int[1000005];
		for (int i = 0; i < N; i++) {
			int x = input.nextInt();
			if (x>0) pos[x-1]++;
			pos[x]++;
			pos[x+1]++;
		}
		Arrays.sort(pos);
		System.out.println(pos[pos.length-1]);
	}
}

Measured memory_bytes: 63536
n = int(input())
ans = ''
for i in range(1, n+1):
 if i%3 == 0:
  ans += " " + str(i)
 elif i%10 == 3:
  ans += " " + str(i)
 else:
  div = i
  while div//10:
   div = div//10
   if div%10 == 3:
    ans += " " + str(i)
    div = 0
print(ans)

Measured memory_bytes: 7724
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    // 360/x
    int y = 1;
    while((y * 360) % x){
        y++;
    }
    cout << (y*360)/x << '\n';
}

Measured memory_bytes: 3512
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

int *S;
int n;
int cnt = 0;
stack<int> pattern,patterncopy;

void insertsort(int g){
	int a,b,c;
	for(int i = g;i < n;i++){
		a = S[i];
		b = i - g;
		while(b >= 0 && S[b] > a){
				S[b+g] = S[b];
				b -= g;
				cnt++;
		}
		S[b+g] = a;
	}
}

void makeprogression(){
	for(int m = 1;;){

		if(m > n) break;

		pattern.push(m);
		patterncopy.push(m);
		m = 3*m + 1;

	}
}

int main(){
	cin >> n;
	S = new int[n];
	for(int i = 0;i < n;i++){
		cin >> S[i];
	}
	makeprogression();
	cout << pattern.size() << endl;
	while(true){
		cout << patterncopy.top();
		patterncopy.pop();
		if(!patterncopy.empty()){
			cout << " ";
		}else{
			cout << "" << endl;
			break;
		}
	}
	while(!pattern.empty()){
		insertsort(pattern.top());
		pattern.pop();
	}
	cout << cnt << endl;
	for(int j = 0;j < n;j++){
		cout << S[j] << endl;
	}
	return 0;
}

Measured memory_bytes: 5112