akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int main(){
  int N;
  cin >> N;
  cout << pow(N,3) << endl;
}




Measured memory_bytes: 384
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int N = 3;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		HashSet<Integer> c = new HashSet<>();
		for (i = 0; i < N; i++) {
			c.add(parseInt(sc.next()));
		}
		sc.close();
		out.println(c.size());
	}
}


Measured memory_bytes: 21716
#n=int(input())
n,k=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

dic={}

for i in range(k):
    d=int(input())
    al=list(map(int,input().split()))
    for a in al:
        dic[a]=True
ans=0
for i in range(1,n+1):
    if dic.get(i,0)==0:
        ans+=1
print(ans)



Measured memory_bytes: 9072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    long double ans = 0.0;
    rep(i,N){
        string u;
        long double x;
        cin>>x>>u;
        if(u == "JPY"){
            ans += x;
        }else{
            ans += x*380000.0 ;
        }
    }
    cout << fixed << setprecision(15) << ans << endl;


    return 0;
    

}

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


void solve(ll N, ll M)
{
    cout << N*(N-1)/2 + M*(M-1)/2<<endl;
}


int main()
{
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string C;
  cin >> C;
  if (C == "a" || C == "e" || C == "i" || C == "o" || C == "u") {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}
  

Measured memory_bytes: 256
N, M = map(int, input().split())
As = map(int, input().split())
xs = []
for _ in range(M):
    b, c = map(int, input().split())
    xs.append((c, b))
for a in As:
    xs.append((a, 1))
xs.sort()
c = 0
r = 0
for x in xs[::-1]:
    c += x[1]
    if c >= N:
        r += x[0] * (N - (c-x[1]))
        break
    else:
        r += x[0] * x[1]
print(r)


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

double dp[301][301][301];



double solve(int cnt1,int cnt2,int cnt3,int N){
    if(cnt1<0||cnt2<0||cnt3<0){
        return 0;
    }
    if(cnt1==0 and cnt2==0 and cnt3==0){
        return 0;
    }
    if(dp[cnt1][cnt2][cnt3]>-0.9){
        return dp[cnt1][cnt2][cnt3];
    }
    
    double expected_v=N+cnt1*solve(cnt1-1,cnt2,cnt3,N)+cnt2*solve(cnt1+1,cnt2-1,cnt3,N)+cnt3*solve(cnt1,cnt2+1,cnt3-1,N); //this is a simplified recurrence for more insight please remember to take a note of the recurrence somewhere.

    dp[cnt1][cnt2][cnt3]=expected_v/(cnt1+cnt2+cnt3);
    return  dp[cnt1][cnt2][cnt3];
}






int main(){
    int N, cnt1=0,cnt2=0,cnt3=0,x;
    cin>>N;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<N;i++){
        cin>>x;
        if(x==1){
            cnt1++;
        }
        if(x==2){
            cnt2++;
        }
        if(x==3){
            cnt3++;
        }
    }
    //cout<<cnt1<<" "<<cnt2;
    cout<<fixed<<setprecision(10)<<solve(cnt1,cnt2,cnt3,N);
}


Measured memory_bytes: 213376
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int h,w,a,b,c;
    cin>>h>>w;
    a=h*w;
    if(h==1 || w==1)
    {
        cout<<1<<endl;
        return 0;
    }
    if(h%2==0)
    {
        b=h/2;
        c=w*b;
        cout<<a-c<<endl;
    }
    else
    {
        b=h/2;
        c=b*w+w/2;
        cout<<a-c<<endl;
    }
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

x = input()
lst = list(x)
pt = []
rst = []
k = 0

# point get
cnt = 0
tmp = ""
for s in lst:
    if s == "/":
        if tmp == "_" or tmp == "/":
            cnt += 1
    elif s == "\\":
        if tmp == "\\":
            cnt -= 1
    else:
        if tmp == "\\":
            cnt -= 1

    pt += [cnt]
    tmp = s

#メンセキ
i,xs,m2 = 0,0,0
for s in lst:
    if s == "/":
        if i == xs and xs > 0:
            rst += [m2]
            k += 1
            xs,m2 = 0,0
    elif s == "_":
        pass
    else:
        try:
            x = pt[i+1:].index(pt[i])+i+1
            m2 += x-i
            if xs < x:
                xs = x
        except:
            pass
    i += 1
           
print(sum(rst))
print(k,*rst)



Measured memory_bytes: 6732
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)
using namespace std;

int main() {
    int h, n;
    cin >> h >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    rep(i, 0, n) {
        h -= a[i];
        if(h <= 0) {
            cout << "Yes" << endl;
            return 0;
        }   
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 640
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 100000;
int n, m;
bool ac[MAX_N + 1];
int wa[MAX_N + 1];

int main() {
    fastio();

    cin >> n >> m;
    int sub = 0, pen = 0;
    forn(i, m) {
        int p;
        string s;
        cin >> p >> s;
        if (s == "WA" && !ac[p]) {
            wa[p]++;
        }
        if (s == "AC") {
            ac[p] = true;
        }
    }

    for (int i = 1; i <= n; i++) {
        if (ac[i]) {
            sub++;
            pen += wa[i];
        }
    }

    cout << sub << ' ' << pen << endl;

    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	string s,t;
	cin >> s >> t;
	int ans=0;
	rep(i,3){
		if(s[i] == t[i]){
			ans++;
		}else{
			continue;
		}
	}
	cout <<ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> n >> s;
	ll dp[n][n];
	ll ans = 0;
	rep(i, 1, n){
		if(s[0] == s[i]){
			dp[0][i] = 1;
			ans = 1;
		}
		else{
			dp[0][i] = 0;
		}
	}
	
	rep(i, 1, n){
		rep(j, i+1, n){
			ll m = dp[i-1][j-1];
			//cout << i << j << m << endl;
			if(s[i] == s[j] && i+m < j){
				dp[i][j] = m+1;
				ans = max(m+1, ans);
				//print(i)
				//print(j)
				//print(m)
			}
			else{
				dp[i][j] = 0;
			}
		}
	}
	
	print(ans)
	return 0;
}

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

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

    vector<int> res;
    int a, b;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        res.push_back(max(0, n-a));
    }

    sort(res.begin(), res.end());

    cout << accumulate(res.begin(), res.end(), 0) - res[m-1] << endl;

    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
set<pi> S;

void solve() {
	cin >> N;
	rep(i, 1, N + 1) {
		rep(j, i + 1, N + 1) {
			S.insert(pi(i, j));
		}
	}
	if(N % 2 == 0) {
		rep(i, 1, N + 1) {
			S.erase(pi(i, N + 1 - i));
		}
	}
	else {
		rep(i, 1, N + 1) {
			S.erase(pi(i, N - i));
		}
	}
	cout << sz(S) << "\n";
	for(auto p: S) {
		cout << p.fst << " " << p.sec << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

using namespace std;

int v[200010];
char s[200010];
int N;
int f[200010];
int mi[1<<26];

int main()
{
	scanf("%s",s + 1);	
	N = strlen(s + 1);
	v[0] = 0;
	for (int i=1;i<=N;i++)
		v[i] = v[i-1] ^ (1 << (s[i] - 'a'));
	f[0] = 0;
	mi[0] = 0;
	for (int i=1;i<(1<<26);i++)mi[i] = 10000000;
	for (int i=1;i<=N;i++)
	{
		f[i] = mi[v[i]] + 1;
		for (int j=0;j<26;j++)
			f[i] = min(f[i],mi[v[i] ^ (1<<j)] + 1);
		//printf("%d\n",f[i]);
		mi[v[i]] = min(mi[v[i]],f[i]);
	}
	printf("%d\n",f[N]);
}

Measured memory_bytes: 264192
#include <stdio.h>
 
int main(void){

  int a,b,c,d;
  
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  if(a * b >= c * d){
  printf("%d\n",a * b);
  } else {
  printf("%d\n",c * d);
  }
  
  return 0;
}

Measured memory_bytes: 128
from scipy.misc import comb

div_num = 10**9 + 7

def main():
    n,k = map(int,input().split(" "))

    blue = comb(k-1, 0, exact=True)
    red = comb(n-k-1 ,1, exact=True) + 2 * comb(n-k-1, 0, exact=True)
    ret = (blue * red) % div_num
    if (n == k):
        print("1")
    else:
        print(ret)
    for i in range(1,k):
        blue = comb(k-1, i, exact=True)
        red = comb(n-k-1 ,i+1, exact=True) + 2 * comb(n-k-1, i, exact=True) + comb(n-k-1, i-1, exact=True) 
        ret = (blue * red) % div_num
        print(ret)
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 15292
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    int N,K;    cin>>N>>K;
    vector<int> x(N,0);
    for(int i=0;i<N;i++){
        cin>>x[i];
    }
    int ans=999999999;
    for(int i=0;i+K<=N;i++){
        int l=x[i];
        int r=x[i+K-1];
        ans=min(ans,r-l+min(abs(l),abs(r)));
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
import heapq


n = int(input())
a = list(map(int, input().split()))

d = {}
for i, a_ in enumerate(a):
    d[a_] = i


h = []
right = [n-1] * n

for i in range(n):
    while h and -h[0] > a[i]:
        v = -heapq.heappop(h)
        right[d[v]] = i - 1
    heapq.heappush(h, -a[i])

h = []
left = [0] * n

for i in reversed(range(n)):
    while h and -h[0] > a[i]:
        v = -heapq.heappop(h)
        left[d[v]] = i + 1
    heapq.heappush(h, -a[i])

ans = 0
for i in range(n):
    ans += a[i] * (i - left[i] + 1) * (right[i] - i + 1)

print(ans)





Measured memory_bytes: 47028
#include <iostream>
#include <set>
#include <vector>

using namespace std;

void solve()
{
	int N, M;
	cin >> N;
	set<int> timeTable;
	for (int i = 0; i < N; ++i)
	{
		int h, m;
		cin >> h >> m;
		timeTable.insert(60 * h + m);
	}
	cin >> M;
	for (int i = 0; i < M; ++i)
	{
		int h, m;
		cin >> h >> m;
		timeTable.insert(60 * h + m);
	}
	set<int>::iterator it = timeTable.begin();
	bool isFirst = true;
	while (it != timeTable.end())
	{
		if (!isFirst)
		{
			cout << " ";
		}
		isFirst = false;
		cout << *it / 60 << ":";
		if (*it % 60 >= 10)
		{
			cout << *it % 60;
		}
		else
		{
			cout << 0 << *it % 60;
		}
		++it;
	}
	cout << endl;
}

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

Measured memory_bytes: 1204
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int a, b;
	cin >> a >> b;
	if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	return 0;
}

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

public class Main {
    long a, b, c;
    long k;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextLong();
        b = sc.nextLong();
        c = sc.nextLong();
        k = sc.nextLong();
        solve();
    }

    void solve() {
        if (k % 2 == 1) {
            System.out.println(b - a);
        } else {
            System.out.println(a - b);
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 22992
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=int(input())
        l=[list(map(int,input().split())) for i in range(n)]
        l.insert(0,[0,0,0])
        for j in range(n):
            t,x,y=l[j+1][0]-l[j][0],l[j+1][1]-l[j][1],l[j+1][2]-l[j][2]
            if t<(abs(x)+abs(y)):
                return 'No'
            elif t%2!=(abs(x)+abs(y))%2:
                return 'No'
        return 'Yes'
    print(main())
resolve()

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

int main(){
 int n,h,w,i,a,b,ans;
  cin>>n>>h>>w;
  ans=0;
  for(i=0;i<n;i++){
   cin>>a>>b;
   if((a>=h) && (b>=w)){ans++;}
  }
  cout << ans <<endl;
 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define EPS 0.0001

int main(void)
{
	double a, b, c;
	double d, e, f;
	double x, y;
	
	while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF){
		x = (c * e - b * f) / (e * a - b * d) + EPS;
		y = (d * c - a * f) / (d * b - e * a) + EPS;
		
		printf("%.3f %.3f\n", x, y);
	}
	
	return (0);
}

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    map <int, int> F;
    for(int i = 0; i < n; i++){
        int num;
        cin >> num;
        F[num]++;
    }
    if(F.size() == n){
        cout << "YES";
    }
    else cout << "NO";
    cout << endl;

}

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

int main() {
   int N;
   string s;
   cin >> N >> s;
  int count = 0;
 for(int i = 0; i < N-2; i++){
   if(s.at(i) == 'A' && s.at(i+1) == 'B' && s.at(i+2) == 'C' ){
     count++;
   }
 }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}




#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


   


int main() {
   ll n;
   cin >> n;
  vector<pair <ll,ll>> v;
  ll a,b,ma = -1;
   rep (i,n){
     cin >> a >> b;
     v.push_back(make_pair(b,a));
     //v[i]=make_pair(b,a);
     //ma = max(ma,v.first) 
   }
   sort(v.begin(),v.end());
   ll cnt=0;
   bool ok = true;
   rep (i,n){
     cnt += v[i].second;
     if (cnt > v[i].first){
       ok = false;
       break;
     }
   }
   if (ok) cout << "Yes" << endl;
   else cout << "No" << endl;
}



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

using namespace std;

#define vi vector<int>
#define pb push_back
#define lli long long int
#define INF 99999999
#define endl "\n"

void solve() {
	int n;
	cin >> n;
	cout << n + n*n + n*n*n << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--) {
	solve();

	// }



	return 0;

}

Measured memory_bytes: 3564
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_B
// Dynamic Programming - Matrix Chain Multiplication
// TODO: review

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 100;
// dp[i][j] [i, j]までの行列をかけたときの最小コスト
int dp[MAX_N + 1][MAX_N + 1];
int p[MAX_N + 1];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> p[i] >> p[i + 1];

    // initialization
    for (int i = 1; i <= n; ++i) dp[i][i] = 0;

    for (int l = 2; l <= n; ++l) {
        for (int i = 1; i <= n - l + 1; ++i) {
            auto j = i + l - 1;
            dp[i][j] = 1 << 21;
            for (int k = i; k <= j - 1; ++k) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + p[i - 1] * p[k] * p[j]);
        }
    }

    cout << dp[1][n] << endl;
    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

const long long M = 1e9+7;

int main()
{
    int n;
    cin >> n;
    vector<string> shina(n);
    string s;
    int count = 1;
    REP(i, 0, n){
        cin >> s;
        shina[i] = s;
    }
    sort(shina.begin(), shina.end());
    REP(i, 0, n-1){
        if(shina[i] != shina[i+1]){
            count++;
        }
    }


    p(count);
}

Measured memory_bytes: 7644
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    int n;
    cin >> n;
    int c[n],s[n],f[n];
    REP(i,n-1){
        cin >> c[i] >> s[i] >> f[i];
    }
    ll ans[n];
    REP(i,n) ans[i] = 0;

    REP(i,n-1){
        int time = 0;
        for(int j=i; j<n-1; ++j){
            if(time%f[j]!=0) time += f[j]-time%f[j];
            if(time<s[j]) time= s[j];
            time += c[j];
        }
        ans[i] = time;
    }
    
    
    
    
    
    REP(i,n) cout << ans[i] << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
ll n,a,b,c,d;

int main(){
	cin >> a >> b >> c >> d >> n;
	a=min(a*4, min(2*b, c));
	b=d;
	
	cout << min(n*a, (n/2)*b+(n%2)*a) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean[] prime = new boolean[1300000];
		prime[0] = false;
		prime[1] = false;
		for (int i = 2; i < prime.length; i++)
			prime[i] = true;

		for (int i = 0; i < prime.length; i++)
			if (prime[i])
				for (int j = i * 2; j < prime.length; j += i)
					prime[j] = false;

		while (true) {
			int k = sc.nextInt();
			if (k == 0)
				break;
			int l = 0, r = 0;
			for (int i = k; i > 0; i--)
				if (prime[i]) {
					l = i;
					break;
				}
			for (int i = k; i < prime.length; i++)
				if (prime[i]) {
					r = i;
					break;
				}
			int n = r - l;
			System.out.println(n);
		}
		sc.close();
	}
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  	string s;
    cin >> s;
    for(int i=0; i<3; i++){
      cout<<s[i];
    }
    cout<<endl;

    
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);

    ll move = min(k, x/d);
    k -= move;
    x -= move * d;
    if (k % 2 == 0)
        cout << x;
    else 
        cout << d-x;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,eps=1e-6,pi=acos(-1.0),maxn=1000010;
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],c[maxn];
string s; 
signed main()
{
	ios::sync_with_stdio(0);
	int a,v,b,w,t;
	cin >> a >> v >> b >> w >> t;
	int flag= 0;
	if(a==b)
	{
		cout << "YES";
		return 0;
	}
	if(v == w)
	{
		if(a==b)
			cout << "YES";
		else
			cout <<"NO";
		return 0;
	}
	else if(v < w)
	{
		cout << "NO";
		return 0;
	}
	int dis = (v-w)*t;
	int k = abs(a-b);
	if(dis >= k)
		cout << "YES";
	else
		cout <<"NO";
	
	return 0;
}

Measured memory_bytes: 3640
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, const vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
    os<<endl;
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, map<T,S> const&M){
    for(auto e:M){
        os<<e;
    }
    os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;



int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N,T;
    cin >> N >> T;
    const int MAX_X = 1e5;
    vector<int> imos(MAX_X+1);
    REP(i,N){
        int l,r; cin >> l >> r;
        imos[l]++; imos[r]--;
    }
    REP(i,MAX_X) imos[i+1] += imos[i];
    cout << *max_element(ALL(imos)) << endl;
}


Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// x^y≡x^(y%(p-1))mod p
// but there is a condition that x needs to be coprime to p
///assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set; */
typedef long long int ll;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
#define  pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define tests() int test_cases ; cin >> test_cases ; while(test_cases--)
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define MAXN 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define sp " "
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define debug(x) cerr << (#x) << " is " << (x) << endl;

#ifndef ONLINE_JUDGE
#define cerr if(true)cerr
#endif

template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
static_assert(D >= 1, "Vector dimension must be greater than zero!");
template<typename... Args>
	Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
	}
};
template<typename T>
struct Vec<1, T> : public vector<T> {
	Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
	}
};

ll power(ll x, ll y,ll p)
{
    ll res = 1;     // Initialize result
    x = x % p;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;  // Change x to x^2
    }
    return res;
}
int gcd(int a, int b) { if (a == 0)return b;return gcd(b % a, a);}

ll modinv(ll a,ll p){return power(a,p-2,p);}


void solve(){
    ll n;
    cin>>n;
    Vec<1,ll> dp(101);
    dp[1] = 1;
    fo(i,2,n){

    }
    ll ans = 0;
    fo(i,2,sqrt(n)){
        ll cnt = 0;
        while(n%i==0){
            cnt++;
            n/=i;
        }
        ll x = 1;
        if (cnt>0)
        {
            // deb(cnt)
            while(x*(x+1)/2<=cnt){
                x++;
            }
            x--;
            ans+=x;
        }
    }
    // deb(n)
    if (n>1)
    {
        ans++;
    }
    cout<<ans<<endl;
    return ;
}
int main()

{
    IO;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // #endif
    int T=1;
	// cin >> T;
	f(c,0,T){
		solve();
	}
    return 0;
}// make_pair make_tuple  tuple<int,int,int> continue resize insert count size else true isValid second first false erase double priority_queue


Measured memory_bytes: 3644
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,k;
    cin >> a >> b >> k;
    if(k<=a){
        cout << a-k << " " << b << endl;
    }else{
        cout << 0 << " " << max(0LL, b-(k-a)) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
<?php
$arr = explode(' ', trim(fgets(STDIN)));

$n = $arr[0];
$m = $arr[1];

$h_arr = explode(' ', trim(fgets(STDIN)));

for ($i=1; $i <= $n; $i++) { 
    $h_nums[] = $i;
}

for ($i=0; $i < $m; $i++) { 
    $arr2 = explode(' ', trim(fgets(STDIN)));
    $a = $arr2[0];
    $b = $arr2[1];

    // echo "anum =".$a.PHP_EOL;
    // echo "bnum =".$b.PHP_EOL;
    // echo "a =".$h_arr[$a - 1].PHP_EOL;
    // echo "b =".$h_arr[$b - 1].PHP_EOL;

    if($h_arr[$a - 1] > $h_arr[$b - 1]) {
        $ng_nums[] = $b;
    } elseif($h_arr[$a - 1] == $h_arr[$b - 1]) {
        $ng_nums[] = $a;
        $ng_nums[] = $b;
    } else
    {
        $ng_nums[] = $a;
    }
}
$ng_nums = array_unique($ng_nums);
// for ($i=0; $i < count($ng_nums); $i++) { 
//     echo "ng_nums = ".$ng_nums[$i].PHP_EOL;
// }

$h_nums = array_diff($h_nums, $ng_nums);
$h_nums = array_values($h_nums);
// for ($i=0; $i < count($h_nums); $i++) { 
//     echo "h_nums = ". $h_nums[$i].PHP_EOL;
// }

echo count($h_nums);

return;
?>


Measured memory_bytes: 39300
// dictionary

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(
			new InputStreamReader(System.in));
		String[] l = br.readLine().split(" ");
		int n = Integer.parseInt(l[0]);
		int k = Integer.parseInt(l[1]);
		int[] w = new int[n];
		int max = 0, sum = 0;
		for (int i = 0; i < n; i++) {
			w[i] = Integer.parseInt(br.readLine());
			sum += w[i];
			if (max < w[i]) {
				max = w[i];
			}
		}
		int lower = max - 1, upper = sum;
		while (upper - lower != 1) {
			int middle = (lower + upper) / 2;
			int sumWeight = 0;
			int trackCount = 1;
			for (int i = 0; i < n; i++) {
				if (sumWeight + w[i] > middle) {
					trackCount++;
					sumWeight = w[i];
				} else {
					sumWeight += w[i];
				}
			}
			if (trackCount <= k) {
				upper = middle;
			} else {
				lower = middle;
			}
		}
		System.out.println(upper);
	}
}

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

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

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

  for( int j = n - 1; j >= 0; j-- ) {
    cout << buf[ j ];
    if( j != 0 ) {
      cout << " ";
    }
  }

  cout << endl;

  return 0;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 1e2 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dp[MAXN][100010];
ll a[MAXN];
ll ps[100010];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, k;
	cin >> n >> k;
	for(int i = 1;i <= n; i++) cin >> a[i];
	
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++){
		ps[0] = 0;
		for(int j = 1; j <= k + 1; j++) ps[j] = (ps[j - 1] + dp[i - 1][j - 1]) % MOD;
		for(int j = 0; j <= k; j++){
			dp[i][j] = ps[j + 1] - ps[ max(0ll, j - a[i])];
			dp[i][j] %= MOD;
			//debug(dp[i][j]);
		}
	}
	
	cout << (((dp[n][k]%MOD)+MOD)%MOD);
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) {cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;}

ll dp[11][10]; //i桁のjで始まるルンルン数の数
ll runsum[11] = {}; //i桁以下の合計

ll solve(ll k, ll keta, ll b, ll e){
  // printf("%lld %lld %lld %lld\n", k, keta, b, e);
  if(keta == 0) return 0;
  if(k > runsum[keta]) return solve(k, keta+1, b, e);
  ll sum = 0;
  if(b == 1 && e == 9) sum += runsum[keta-1];
  ll pow10 = 1;
  rep(_, keta-1) pow10 *= 10;
  repi(j, b, e+1){
    if(j < 0 || j >= 10) continue;
    sum += dp[keta][j];
    if(sum >= k) return j * pow10 + solve(k - sum + dp[keta][j], keta-1, j-1, j+1);
  }
  return -1;
}

int main(){
  ll K;
  cin >> K;

  rep(i, 11) rep(j, 10) dp[i][j] = 0;
  rep(j, 10) dp[1][j] = 1;
  runsum[1] = 9;

  repi(i, 2, 11){
    runsum[i] = runsum[i-1];
    rep(j, 10){
      dp[i][j] += dp[i-1][j];
      if(j+1 < 10) dp[i][j] += dp[i-1][j+1];
      if(j-1 >= 0) dp[i][j] += dp[i-1][j-1];
      if(j > 0) runsum[i] += dp[i][j];
    }
  } 
  // rep(i, 11) debug(dp[i])
  // debug(runsum)
  ll ans = solve(K, 1, 1, 9);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stdlib.h>
using namespace std;
typedef long long int ll;
#define INF (1e9)
#define distance(x1,y1,x2,y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
#define rep(i,N) for(ll i=0;i<N;i++)
using vvl=vector<vector<ll>>;
using vl=vector<ll>;
using vs=vector<string>;
using vvs=vector<vector<string>>;

bool func(vl s,vl t){
    return s[1]<t[1];
}

/*void printvl(vl v){
    rep(i,v.size()){
        cout<<i<<": "<<v[i]<<endl;}
}

void printvl2(vvl v){
    rep(i,v.size()){
        cout<<i<<": "<<v[i][0]<<" ,"<<v[i][1]<<endl;}
}*/

ll A,B,C;

int main(){
    cin>>A>>B>>C;
    if(A+B>=C)
        cout<<B+C<<endl;
    else
        cout<<A+2*B+1<<endl;   
    
    return 0;}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N,ans = 0;
    cin >> N;
    for(int i = 1;i < N;i++){
        for(int j = 1;j < N;j++){
            if(i * j >= N){break;}
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N,M=LI()
ans=0
if N<M//2:
	ans += N
	M-=N*2
	ans += M//4
else:
	ans+=M//2

print(ans)



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

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];
  sort(a.begin(),a.end());
  int ai=*(--a.end());
  int aj=*(a.begin());
  int diff=1000000000;
  for(int i=0; i<n; i++){
    if(diff>abs(ai/2.-a[i])){
      diff=abs(ai/2.-a[i]);
      aj=a[i];
    }
  }
  cout << ai << " " << aj << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int n, ax[100], ay[100], bx[100], by[100];
vector<int>X, Y; long long p[150][150]; bool used[150][150];
int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
int main() {
	while (true) {
		X.clear(); Y.clear(); cin >> n; if (n == 0)break;
		for (int i = 0; i < 22500; i++) { p[i / 150][i % 150] = 0; used[i / 150][i % 150] = false; }
		for (int i = 0; i < n; i++) {
			cin >> ax[i] >> ay[i] >> bx[i] >> by[i];
			if (ax[i] > bx[i])swap(ax[i], bx[i]);
			if (ay[i] > by[i])swap(ay[i], by[i]);
			X.push_back(ax[i]); X.push_back(bx[i]);
			Y.push_back(ay[i]); Y.push_back(by[i]);
		}
		sort(X.begin(), X.end()); sort(Y.begin(), Y.end());
		X.erase(unique(X.begin(), X.end()), X.end());
		Y.erase(unique(Y.begin(), Y.end()), Y.end());
		for (int i = 0; i < n; i++) {
			int pos1 = lower_bound(X.begin(), X.end(), ax[i]) - X.begin(), pos2 = lower_bound(Y.begin(), Y.end(), ay[i]) - Y.begin();
			int pos3 = lower_bound(X.begin(), X.end(), bx[i]) - X.begin(), pos4 = lower_bound(Y.begin(), Y.end(), by[i]) - Y.begin();
			pos1 += 5; pos2 += 5; pos3 += 5; pos4 += 5;
			for (int j = pos1; j < pos3; j++) {
				for (int k = pos2; k < pos4; k++)p[j][k] += (1LL << i);
			}
		}
		int cnts = 0;
		for (int i = 0; i < 150; i++) {
			for (int j = 0; j < 150; j++) {
				if (used[i][j] == true)continue;
				queue<pair<int, int> >Q; cnts++; Q.push(make_pair(i, j)); used[i][j] = true;
				while (!Q.empty()) {
					int a1 = Q.front().first, a2 = Q.front().second; Q.pop();
					for (int k = 0; k < 4; k++) {
						int cx = a1 + dx[k], cy = a2 + dy[k];
						if (cx < 0 || cy < 0 || cx >= 150 || cy >= 150)continue;
						if (used[cx][cy] == true || p[a1][a2] != p[cx][cy])continue;
						Q.push(make_pair(cx, cy)); used[cx][cy] = true;
					}
				}
			}
		}
		cout << cnts << endl;
	}
	return 0;
}

Measured memory_bytes: 3268
#include<stdio.h>
#include<math.h>

#define GRAVITY_ACC 9.8
#define GRAVITY_AC 4.9

main()
{
	double velocity = 0; //入力される速度
	double time = 0, distance = 0, result = 0; //t, y, nに対応
	int n = 0;
	while(scanf("%lf", &velocity) != EOF)
	{
		time = velocity / GRAVITY_ACC; //tの計算
		distance = GRAVITY_AC * pow(time , 2);
		result = (distance + 5) / 5;
		n = result + 1;
		printf("%d\n", n);
	}
	return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
 
int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
 
  ll cnt = ceil((double)n / min({a, b, c, d, e}));
  cout << cnt + 4 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
#include <numeric>
#include <cstdint>

using llint = long long int;
using u64 = std::uint_fast64_t;

void solve(void){

  int x;
  std::cin >> x;

  if(x >= 30) std::cout << "Yes" << std::endl;
  else        std::cout << "No"  << std::endl;
}
int main(void){
  solve();
  return 0;
}





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

int main()
{
	int n;
	cin>>n;
	vector<ll> a;
	for(int i=0;i<n;++i){
		ll val;
		cin>>val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i=1;i<n;++i){
		if(a[i]==a[i-1]){
			cout<<"NO"<<'\n';
			return 0;
		}
	}
	cout<<"YES"<<'\n';
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int X;
    cin>>X;
    if(X>=30){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(){
    int k,n,i,mark,ans,ans1,ans2;

    scanf("%d %d",&n,&k);

    int a[n];

    for(i=0; i<n-1; i++){
        scanf("%d ",&a[i]);
        if(a[i] == 1)mark = i;
        }

    ans1 = i / (k-1); 
    if(i % (k-1) != 0)ans1++;
    ans2 = (n-1-i) / (k-1);
    if((n-1-i) % (k-1) != 0)ans2++;
    ans = ans1 + ans2;
    printf("%d\n",ans);
}

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

int main(){
    ll N;
    cin >> N;
    ll ans = 1e18;
    for(ll i = 1; i*i <= N; i++){
        if(N%i != 0) continue;
        ll j = N/i;
        ans = min(i+j-2, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {
    int N; 
    cin >> N;
    int now = -1;
    int k = 2;
    int ans = 0;
    
    rep(i, N) {
        int a;
        cin >> a;
        if (a > now) {
            if (k == 2) {
                ans++;
                k = 0;
            }
            else if (k == 0) {
                k = 1;
            }
        }
        if (a < now) {
            if (k == 1) {
                ans++;
                k = 0;
            }
            else if (k == 0) {
                k = 2;
            }
        }
        now = a;
    }
    cout << ans;

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<string> s(n);
	rep(i, n) {
		cin >> s[i];
	}
	long long ans = 0;
	rep(i, n) {
		vector<vector<char>> t(n, vector<char> (n));
		rep(y, n) {
			rep(x, n) {
				t[y][x] = s[y][(x + i) % n];
			}
		}
		bool ok = true;
		rep(y, n) {
			rep(x, n) {
				if (t[y][x] != t[x][y]) {
					ok = false;
				}
			}
		}
		if (ok) {
			ans ++;
		}
	}
	printf("%lld\n", ans * n);
        return 0;
}


Measured memory_bytes: 512