akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

       cin >> n;
       Cout(800*n-n/15*200);
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<iomanip>
#include<vector>
#include<deque>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<bitset>
#include<string>
#include<numeric>
#include<algorithm>
#include<functional>
#include<iterator>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<complex>
#include<ctime>

typedef long long ll;
using namespace std;


int main()
{
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int a=k/60;
    int b=k%60;
    //H1+=a;
    //M1+=b;
    h2-=a;
    m2-=b;
    //if(M1>59)
    //{
       // M1-=60;
       // H1+=1；
   // }
    if(m2<0)
    {
        m2=60+m2;
        h2=h2-1;
    }
    int h,m;
    h=h2-h1;
    m=m2-m1;
    if(h2<h1)
        cout<<"0"<<endl;
    else
    {int q=(h2-h1)*60+(m2-m1);
    cout<<q<<endl;}
    return 0;
}

Measured memory_bytes: 3596
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val a = (0 until n).map { readLine()!! }
    val b = (0 until m).map { readLine()!! }
    var ans = false
    for (i in 0..n - m) {
        for (j in 0..n - m) {
            var flag = true
            for (bi in 0 until m) {
                for (bj in 0 until m) {
                    if (a[i + bi][j + bj] != b[bi][bj]) {
                        flag = false
                    }
                }
            }
            if (flag) ans = true
        }
    }
    println(if (ans) "Yes" else "No")
}


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

int main() {
	string s;
	cin >> s;
	vector<char> vec (s.size());
	for(int i = 0;i < s.size();i++){
		vec.at(i) = s.at(i);
	}
	sort(vec.begin(),vec.end());
	for(int i = 0;i < s.size()-1;i++){
		if(vec.at(i) == vec.at(i+1)){
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    lateinit var dfs: (v: Int, p: Int) -> Unit

    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val K = sc.next().toInt()
        val x = Array(N) { sc.next().toLong() }
        val xl = listOf(0L) + x.filter { it < 0 }.map { -it }.sorted().take(K)
        val xr = listOf(0L) + x.filter { it >= 0 }.take(K)
        val ans = mutableListOf<Long>()
        for (i in 0..K) {
            if (i < xr.count() && K - i < xl.count()) {
                val a1 = xl[K - i]
                val a2 = xr[i]
                ans += a1 * 2 + a2
                ans += a1 + a2 * 2
            }
        }
        pw.println(ans.min()!!)
    }
}


Measured memory_bytes: 52056
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	int a[n],b[n],c[n],a1[n]={0},b1[n]={0},c1[n]={0};
	for(i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	a1[0]=a[0];
	b1[0]=b[0];
	c1[0]=c[0];
	for(i=1;i<n;i++)
	{
		a1[i]=a[i]+max(b1[i-1],c1[i-1]);
		b1[i]=b[i]+max(a1[i-1],c1[i-1]);
		c1[i]=c[i]+max(a1[i-1],b1[i-1]);
	}
	cout<<max(a1[n-1],max(b1[n-1],c1[n-1]));
}

Measured memory_bytes: 2560
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

vector<int> calcmp(const vector<int> &v){
	int n = v.size();
	vector<int> ret(n + 1);
	ret[0] = -1;
	int k = -1;
	for(int i = 0; i < n; ++i){
		while(k >= 0 && v[k] != v[i]){ k = ret[k]; }
		ret[i + 1] = ++k;
	}
	return ret;
}

vector<int> input(int n){
	vector<int> v(n);
	for(int i = 0; i < n; ++i){
		scanf("%d", &v[i]);
	}
	return v;
}

vector<int> diff(const vector<int> &v){
	int n = v.size();
	vector<int> w(n);
	for(int i = 0; i < n; ++i){
		w[i] = v[i] ^ v[(i + 1) % n];
	}
	return w;
}

void mainmain(){
	int n;
	scanf("%d", &n);
	vector<int> as = input(n);
	vector<int> bs = input(n);
	vector<int> da = diff(as);
	vector<int> db = diff(bs);
	da.resize(2 * n - 1);
	for(int i = 0; i < n - 1; ++i){ da[i + n] = da[i]; }
	vector<int> mp = calcmp(db);
	int k = 0;
	for(int i = 0; i < 2 * n - 1; ++i){
		while(k == n || (k >= 0 && db[k] != da[i])){ k = mp[k]; }
		++k;
		if(k == n){
			printf("%d %d\n", i - n + 1, as[i - n + 1] ^ bs[0]);
		}
	}
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 8176
#include <iostream>

using namespace std;

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long result[4];

    result[0] = a * c;
    result[1] = a * d;
    result[2] = b * c;
    result[3] = b * d;

    long long max = result[0];
    for (int i = 1; i < 4; i++) {
        if (result[i] > max) {
            max = result[i];
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>

int main()
{
	int n;
	int zoro;
	int d1,d2;

	zoro = 0;
	scanf("%d", &n);
	while (n)
	{
		scanf("%d %d", &d1,&d2);
		if (d1 == d2)
			zoro++;
		else
			zoro = 0;
		if (zoro == 3)
			break;
		n--;
	}
	if (zoro == 3)
		printf("Yes\n");
	else
		printf("No\n");
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,ans;
string a,b,c;
void solve(){
    cin>>n>>a>>b>>c;
    rep(i,0,n){
        set<char> st;
        st.insert(a[i]);
        st.insert(b[i]);
        st.insert(c[i]);
        if(sz(st)==1);
        else if(sz(st)==2) ans++;
        else ans+=2;
    }
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	long long n,i,j;
	string x;
    cin>>x;
    n=x.size();
    for(i=0;i<n;i++)
    {
        if(x[i]=='C')
        {
            for(j=i+1;j<n;j++)
            {
                if(x[j]=='F')
                {
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int b,n;
	cin>>n;
	char a[20];
	cin>>a;
	cin>>b;
	for(int i=0;i<n;i++){
		if(a[i]!=a[b-1]){
			cout<<"*";
		}else cout<<a[i];
	}cout<<endl;
	
}

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

using namespace std;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if (B <= C) cout << 0 << endl;
    else if (A <= C && C < B && B <= D) cout << B - C << endl;
    else if (A <= C && D < B) cout << D - C << endl;
    else if (C < A && B <= D) cout << B - A << endl;
    else if (C < A && A < D && D < B) cout << D - A << endl;
    else if (D <= A) cout << 0 << endl;



    return 0;
}

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

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

struct RectangleSum{
    vector<vector<i64>> sum;
    i64 h, w;
    RectangleSum(vector<vector<i64>>& v) :
        h(v.size()),
        w(v[0].size())
    {
        sum.assign(h + 1, vector<i64>(w + 1, 0));
        for(i64 i = 0; i < h; ++i)
            for(i64 j = 0; j < w; ++j)
                sum[i + 1][j + 1] = v[i][j];

        for(i64 i = 0; i < h + 1; ++i)
            for(i64 j = 0; j < w; ++j)
                sum[i][j + 1] += sum[i][j];
        for(i64 j = 0; j < w + 1; ++j)
            for(i64 i = 0; i < h; ++i)
                sum[i + 1][j] += sum[i][j];
    }
    i64 getSum(i64 sx, i64 sy, i64 ex, i64 ey){
        return sum[ex][ey] + sum[sx][sy] - sum[sx][ey] - sum[ex][sy];
    }

};

signed main(){
    i64 w, h;
    cin >> w >> h;
    vector<vector<i64>> v(h, vector<i64>(w));
    for(auto& x : v)
        for(auto& y : x)
            cin >> y;

    RectangleSum r(v);

    vector<vector<i64>> dp(h + 1, vector<i64>(w + 1, -INF));
    dp[h][w] = 0;
    function<i64(i64,i64)> f = [&](i64 x, i64 y){
        if(dp[x][y] != -INF)
            return dp[x][y];
        i64 res_1 = (x == h ? -INF : -f(x + 1, y) + ((x + y) % 2 == 1 ? 1 : -1) * r.getSum(x, 0, x + 1, y));
        i64 res_2 = (y == w ? -INF : -f(x, y + 1) + ((x + y) % 2 == 0 ? 1 : -1) * r.getSum(0, y, x, y + 1));
        return dp[x][y] = max(res_1, res_2);
    };
    f(0, 0);
    cout << abs(dp[0][0]) << endl;
}



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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string w = Console.ReadLine();

            Console.WriteLine(CheckWord(w));
        }

        static string CheckWord(string w)
        {
            int[] memo = new int[26];

            for (int i = 0; i < w.Length; i++)
            {
                int idx = w[i] - 'a';
                memo[idx]++;
            }

            for (int i = 0; i < memo.Length; i++)
            {
                if (memo[i] % 2 == 1) return "No";
            }
            return "Yes";
        }
    }
}

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

int k, s;

void solve()
{
	int c = 0;
	for (int x = 0; x <= k; ++x)
	{
		for (int y = 0; y <= k; ++y)
		{
			int z = s - x - y;
			if (0 <= z && z <= k)
				c++;
		}
	}
	cout << c << endl;
}

int main()
{
	cin >> k >> s;
	solve();
}


Measured memory_bytes: 3636
import fractions

# least common multiple
def lcm(a,b):
  f = fractions.gcd(a,b)
  return a*b // f

N,m = list(map(int, input().split()))
A = list(map(int,input().split()))
l = A[0]

# a -> a`
for i in range(N):
  if A[i]%2==1:
    print(0)
    exit(0)
  A[i] //= 2

def F(x):
  res = 0
  while x%2==0:
    x //= 2
    res += 1

  return res

t = F(A[0])
for i in range(N):
  if F(A[i]) != t:
    print(0)
    exit(0)
  A[i] >>= t # a[i] /= 2^t
m >>= t

l = 1
for i in range(N):
  l = lcm(l, A[i])
  if l > m:
    print(0)
    exit(0)

m /= l
print(int((m+1) // 2))


Measured memory_bytes: 16292
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    
    int a = 0;
    for(int i = 0; i < N;i++){
        string S; cin >> S;
        if(S == "A"){
            a++;
        }else{
            if(!a){
                cout << "NO" << endl;
                return 0;
            }
            a--;
        }
    }
    if(a) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}



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

string c[100];

int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> c[i];
	}

	for (int i = 0; i < h; i++) {
		cout << c[i] << "\n" << c[i] << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		while(true) {
			int H=in.nextInt(),W=in.nextInt();
			if(H==0)break;
			for(int i=1;i<=H;i++) {
				for(int j=1;j<=W;j++) {
					if((i%2==1 && j%2==1) || (i%2==0 && j%2==0))out.print("#");
					else out.print(".");
				}
				out.println();
			}
			out.println();
		}
		
		out.flush();
	}

}



Measured memory_bytes: 28444
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int a, b, c;

  cin >> a >> b >> c;

  int dai, syou;
  if (a > b){
    dai = a;
    syou = b;
  }else{
    dai = b;
    syou = a;
  }
  if((dai> c) && (syou < c)){
    cout << "Yes"<<endl;
  }else{
        cout << "No"<<endl;

  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  //入力
  int N,M;
  cin>>N>>M;
  vector<vector<int>> G(N,vector<int>());//グラフ
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  
  queue<int> seen;
  int dist[N];//距離
  bool judge[N];//通ったか否か
  for(int i=0;i<N;i++){
    dist[i]=0;
    judge[i]=false;
  }
  
  judge[0]=true;
  seen.push(0);
  //dfs
  while(!(seen.empty())){
    int S=seen.front();//Sは目印とする洞窟の番号
    //目印確認
    for(int i=0;i<G.at(S).size();i++){
      int nv=G.at(S).at(i);
      if(judge[nv]){
        continue;
      }
      dist[nv]=S;
      seen.push(nv);
      judge[nv]=true;
    }
    seen.pop();
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<N;i++){
    cout<<dist[i]+1<<endl;
  }
}


Measured memory_bytes: 10360
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int h,w;
    cin>>h>>w;
    int n;
    cin>>n;
    vector<int> v;
    int temp;
    rep(i,0,n){
        cin>>temp;
        rep(j,0,temp) v.push_back(i);
    }
    rep(i,0,h){
        rep(j,(i%2==0?0:w),(i%2==0?w:0)){
            cout<<v[i*w+j]+1<<" ";
        }
        cout<<endl;
    }
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 512
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1

cnt = [0] * n

dist = []
for i in range(n):
    dist.append([-1] * n)
for i in range(n):
    dist[i][x] = abs(i-x)
    dist[i][y] = abs(i-y)
    dist[x][i] = abs(i-x)
    dist[y][i] = abs(i-y)

for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dis = min(j - i, dist[i][x] + 1 + dist[y][j])
        cnt[dis] += 1
for i in range(1, n):
    print(cnt[i])


Measured memory_bytes: 76124
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

m,k=MI()
if m==1 and k==1:
    print(-1)
    sys.exit()
if m==1 and k==0:
    lis=[0,0,1,1]
    print(*lis)
    sys.exit()
if k>=2**m:
    print(-1)
    sys.exit()
else:
    pre_lis=[]
    for i in range(2**m):
        if i==k:
            continue
        pre_lis.append(i)
    #print(pre_lis)
    ans=[0 for i in range(2**(m+1))]
    ans[0]=k
    for i in range(len(pre_lis)):
        ans[i+1]=pre_lis[i]
        ans[2**(m+1)-i-1]=pre_lis[i]
    ans[len(pre_lis)+1]=k
print(*ans)
        

    
            
        
        
    

    
        
    
    
    

Measured memory_bytes: 103756
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    LL N,d[5];
    R(N);
    LL mi=1e18;
    REP(i,5){
        R(d[i]);
        mi=min(mi,d[i]);
    }
    W((mi+N-1)/mi+4);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define get(i,x) get<i>(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

bool check(int id,string &s,vector<pair<char,int>> &qry,int tar)
{
	for(auto i:qry)
	{
		if(s[id]==i.F) id+=i.S;
		if(id==tar) return true;
		if(id<0 || id>=sz(s)) return false;
	}
	return false;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,q; cin>>n>>q;
	string s; cin>>s;
	vector<pair<char,int>> qry;
	char id,dir;
	For(i,0,q-1)
	{
		cin>>id>>dir;
		if(dir=='R') qry.emplace_back(id,1);
		else qry.emplace_back(id,-1);
	}
	int hi,lo,cnt=0;
	//bs left
	hi=sz(s)+1; lo=-1;
	while(hi-lo>1)
	{
		int m=(hi+lo)/2;
		if(check(m,s,qry,-1)) lo=m;
		else hi=m;
	}
	if(check(lo,s,qry,-1)) cnt+=lo+1;
	//cout<<hi<<" "<<lo<<"  "<<cnt<<"\n";
	//bs right
	hi=sz(s)+1; lo=-1;
	while(hi-lo>1)
	{
		int m=(hi+lo)/2;
		if(check(m,s,qry,sz(s))) hi=m;
		else lo=m;
	}
	if(check(hi,s,qry,sz(s))) cnt+=sz(s)-hi;
	//cout<<hi<<" "<<lo<<"  "<<cnt<<"\n";
	cout<<sz(s)-cnt<<"\n";
	return 0;
}









Measured memory_bytes: 2700
#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 INF (1LL<<59)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	string s;
	cin>>s;
	if(s[1] == 'B')
	s[1] = 'R';
	else s[1] = 'B';
	cout<<s<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(exp, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = 51;
int N;


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    int A, B;
    cin >> A >> B;
    cout << max(A+B, max(A-B, A*B));
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

main = do
    a:b:c:_ <- map read .words <$> getLine ::IO[Int]
    let g = if a * b < 0 then "F"
                         else case a+b of
                                s | s >= 80 -> "A"
                                s | s >= 65 -> "B"
                                s | s >= 50 -> "C"
                                s | s >= 30 && c >= 50 -> "C"
                                s | s >= 30 -> "D"
                                _ -> "F"
    if (a >= 0 || b >= 0 || c >= 0) 
      then do 
        putStrLn $ g
        main
      else return()

Measured memory_bytes: 3996
N=int(input())
s=input()
R=s.count("R")
G=s.count("G")
B=s.count("B")
ans=R*G*B
 
#全探索する
for i in range(N-2):
  a=s[i]
  for j in range(i+1,N-1):
    if a==s[j]:
      continue
    b=s[j]
    k=2*j-i
    if k>=N:
      continue
    if s[k]!=a and s[k]!=b:
      ans-=1
print(ans)


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

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int main() {
    COMinit();
    ll n, m; cin >> n >> m;
    if(abs(n-m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = fac[n] * fac[m] % MOD;
    if(n == m) ans = ans * 2 % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 15516
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int a[55],mn,mx,mxid,mnid;
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        cin>>a[i];
        if(i==1)mx=a[i],mn=a[i];
        mx=max(mx,a[i]);
        mn=min(mn,a[i]);
    }
    f(i,1,n)
    {
        if(a[i]==mx)mxid=i;
        if(a[i]==mn)mnid=i;
    }
    vector<pi>vec;
    if(mx+mn>=0)
    {
       f(i,1,n)
       {
           if(i!=mxid)vec.pb(mp(mxid,i));
       }
       f(i,1,n-1)
       {
           vec.pb(mp(i,i+1));
       }
    }
    else
    {
         f(i,1,n)
         {
             if(i!=mnid)vec.pb(mp(mnid,i));
         }
         rf(i,n,2)
         {
             vec.pb(mp(i,i-1));
         }
    }
    cout<<vec.size()<<endl;
    for(auto x:vec)
    {
        cout<<x.fi<<" "<<x.si<<endl;
    }
    return 0;

}





































Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
char fh[20], sh[20];
map<string, ll> amount[20];
ll ans;
int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf(" %c", &fh[i]);
	for (int i = n-1; i >= 0; i--) scanf(" %c", &sh[i]);
	for (int i = 0; i < (1 << n); i++)
	{
		string s;
		int am = 0;
		for (int j = 0; j < n; j++)
		{
			if (i & (1 << j)) s.push_back(fh[j]), am++;
		}
		for (int j = n-1; j >= 0; j--)
		{
			if (!(i & (1 << j))) s.push_back(fh[j]);
		}
	//	cout << s << " " << am << "\n";
		amount[am][s]++;
	}
	for (int i = 0; i < (1 << n); i++)
	{
		int am = 0;
		string s;
		for (int j = 0; j < n; j++)
		{
			if (!(i & (1 << j))) s.push_back(sh[j]), am++;
		}
		for (int j = n-1; j >= 0; j--)
		{
			if (i & (1 << j)) s.push_back(sh[j]);
		}
	//	cout << s << " " << am;
	//	printf(" %lld\n", amount[am][s]);
		ans += amount[am][s];
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 73984
#include<bits//stdc++.h>
using namespace std;
int main(){
	int n,p;
	while(cin>>n>>p&&n!=0&&p!=0){
		int a[50];
		fill(a,a+n,0);
		int m=0,p2=p;
		while(true){
			if(p==0){
				p+=a[m];
				a[m]=0;
			}
			else{
				p--;
				a[m]++;
			}
			if(p==0&&a[m]==p2) break;
			m++;
			if(m==n) m=0;
		}
		cout<<m<<endl;
	}
}

Measured memory_bytes: 3096
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/trie_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) begin(x),end(x)
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7;
constexpr int mod2 = 998244353;
 
template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}
 
    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};
 
template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
template <class T> using Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class K, class V> using Umap = gp_hash_table<K, V>;
using Trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>;
 
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n;
    cin >> n;

    vector<vector<int> > dp(n+1, vector<int>(4));

    int res = 0;

    dp[0][0] = 8;
    dp[0][1] = 1;
    dp[0][2] = 1;
    dp[0][3] = 0;

    rep(i,n){
        (dp[i+1][0] = dp[i][0] * 8) %= mod1;
        (dp[i+1][1] = dp[i][1] * 9 + dp[i][0]) %= mod1;
        (dp[i+1][2] = dp[i][2] * 9 + dp[i][0]) %= mod1;
        (dp[i+1][3] = dp[i][3] * 10 + dp[i][1] + dp[i][2]) %= mod1;
    }

    cout << dp[n-1][3] << '\n';

    return 0;
}

Measured memory_bytes: 73308
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
 
using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
 
typedef long long ll;
 
long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}
 
int main() {
    string s; cin >> s;
 
    string S = "";
    repp(i, 0, (int)s.size()) {
        if (s[i] == 'A') S += "A";
        else if (i < (int)s.size() - 1 && s[i] == 'B' && s[i+1] == 'C') {
            S += "D";
            ++i;
        }
        else S += s[i];
    }
 
    ll res = 0;
    ll countA = 0;
    repp(i, 0, (int)S.size()) {
        if (S[i] == 'B' || S[i] == 'C') {
            countA = 0;
        } else if (S[i] == 'A') {
            ++countA;
        } else if (S[i] == 'D'){
            res += countA;
        }
    }
    cout << res << endl;
}

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

const int x_max = 2e5;

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

  vector<bool> is_prime(x_max, true);
  for(int i = 2; i < x_max; i++){
    if(is_prime[i]){
      for(int j = 2; i * j < x_max; j++){
        is_prime[i * j] = false;
      }
    }
  }

  for(int x = X; x < x_max; x++){
    if(is_prime[x]){
      cout << x << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
ll n, m, x, y, ans;
priority_queue<int>pq;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 0;i < n;++i)
        cin >> x, pq.push(x);
    while(m--)
        y = pq.top(), pq.pop(), y /= 2, pq.push(y);
    while(pq.size())
        ans += pq.top(), pq.pop();
    cout << ans;
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	rep(i,10000){
		if(i*(i+1)==n*2){
			vvl v(i+1);
			int cur=1;
			rrep(j,i){
				rep(k,j+1){
					v[i-j-1].push_back(cur);
					cur++;
				}
			}
			cur=1;
			rrep(j,i){
				rep(k,j+1){
					v[i-j+k].push_back(cur);
					cur++;
				}
			}
			cout<<"Yes"<<endl<<i+1<<endl;
			rep(j,i+1){
				cout<<v[j].size();
				rep(k,v[j].size())cout<<" "<<v[j][k];
				cout<<endl;
			}
			return 0;
		}
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 3200
#include <iostream>

using namespace std;

int main(){
  long Ap,Bp,p;
  cin>>Ap;
  cin>>Bp;
  cin>>p;
  
  int ans = Bp;
  int not_eat_p = p - (Bp+Ap + 1);
  if(not_eat_p < 0){ans += p;}else{
   ans += p - not_eat_p; 
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x; // 親を設定
    if(z->key < x->key) x = x->left; // 左の子へ移動
    else x = x->right; 
    }// 右の子へ移動
    z->parent = y;
    if(y == NIL) root = z;// T が空の場合
    else if(z->key < y->key) y->left = z; // z を y の左の子にする
    else y->right = z; // z を y の右の子にする
  }


void inParse(Node x){
  if(x->left != NIL) inParse(x->left);
  printf(" %d",x->key);
  if(x->right != NIL) inParse(x->right);
}
void preParse(Node x){
  printf(" %d",x->key);
  if(x->left != NIL) preParse(x->left);
  if(x->right != NIL) preParse(x->right);
}


Node treeSearch(Node u, int k){
  if( u == NIL || k == u->key ) return u;
  if( u->key < k ) treeSearch(u->right,k);
  else treeSearch(u->left,k);
}

int main(){

  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
    if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
     else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inParse(root);
      printf("\n");
      preParse(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 20440
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int m,int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(m,n / 2);
	x *= x;
	if (n % 2 == 1)x *= m;
	return x;
}
ll max(ll a, ll b) {
	if (a < b)return b;
	else return a;
}

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

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

using namespace std;


int main(){
	int N, K; cin >> N; cin >> K;
	vector<int> arr(N,0);
	vector<long long> dp(N,0);
	for(int i = 0; i < N; i++) cin >> arr[i];

	dp[0] = 0;

	for(int i = 1; i < N; i++){
		long long ans = 1e9+5;
		for(int j = 1; j <= K; j++){
			if(i-j >= 0){
				ans = min(ans, dp[i-j] + abs(arr[i] - arr[i-j]));
			}
			dp[i] = ans;
		}
	}
	cout << dp[N-1] << endl;
}

Measured memory_bytes: 1408
program main
	implicit none
    integer::a,b,c,d
    read(*,*)a,b,c,d
    if(a>=d)then
    	write(*,*) d
    else if(a+b>=d)then
    	write(*,*) a
    else
    	write(*,*) a-(d-a-b)
    end if
    stop
end program main

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

int main(){
	std::string A, B, C;
	std::cin>>A>>B>>C;

	if( A[A.size() - 1 ] == B[0] && B[B.size() - 1 ] == C[0] ){
		std::cout<<"YES"<<std::endl;
	}else{
		std::cout<<"NO"<<std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 500050
#define MO 
struct node {
	ll x,h;
	bool operator < (const node & a)const {
		return x<a.x;
	}
}A[N];
ll n,d,a,O[N],g[N],h[N],Ans,D;
inline void _Sol_()
{
	read(n);read(a);a<<=1;read(d);
	F(i,1,n)read(A[i].x),read(A[i].h),A[i].h=(A[i].h+d-1)/d;
	sort(A+1,A+n+1); //x
	F(i,1,n)O[i]=A[i].x;
	F(i,1,n){
		if(A[n].x-a<=A[i].x){  //
			g[i]=n; continue;
		}
		g[i]=upper_bound(O+i,O+n+1,A[i].x+a)-O-1;
	}
	F(i,1,n)++g[i];
	F(i,1,n){
		D-=h[i];
		if(D>=A[i].h)continue;
		Ans+=A[i].h-D;
		h[g[i]]+=A[i].h-D;
		D=A[i].h;
	}
	priE(Ans);
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll x;
	ll ans = 0;

	rep(i, 5){
		cin >> x;
		if (x == 0) ans = i;
	}
	co(ans + 1);

	return 0;
}


Measured memory_bytes: 3596