akhauriyash/Code-Regression huggingface dataset:
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/22/2019 11:08:25 PM
*************************************************************************/
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
#define ull unsigned long long
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double clf = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
ostream& operator <<(ostream &out, pii &p){
	return out<<p.first<<" "<<p.second;
}
istream& operator >>(istream &in, pii &p){
	return in>>p.first>>p.second;
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//ifstream cin("C:\\Users\\LENOVO\\Desktop\\in.txt");
	//ofstream cout("C:\\Users\\LENOVO\\Desktop\\out.txt");
	ll a,b;cin>>a>>b;cout<<a*b/__gcd(a,b)<<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 {
	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		int h = fs.nextInt();
		int w = fs.nextInt();
		int n = fs.nextInt();
		
		int max = Math.max(h, w);
		if(n % max == 0) {
			System.out.println(n/max);
		}else {
			System.out.println(n/max + 1);
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}


}


Measured memory_bytes: 21076
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CBeTogether solver = new CBeTogether();
        solver.solve(1, in, out);
        out.close();
    }

    static class CBeTogether {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int n = s.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = s.nextInt();
            long res = Long.MAX_VALUE;
            for (int v = -100; v <= 100; v++) {
                long can = 0;
                for (int i = 0; i < n; i++) {
                    can += (a[i] - v) * (a[i] - v);
                }
                res = Math.min(can, res);
            }
            w.println(res);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

int main(){
 string n;

  int r,b,c;
  cin>>c>>n;
  r=0;
  b=0;
  for(int i=0;i<c;i++){
    if(n[i]=='R'){
      r++;
    }
    else{
      b++;
        }
  }
  if(r>b){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        
        Map<Integer, Integer> map1 = new HashMap<Integer, Integer>();
        Map<Integer, Integer> map2 = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            int a = (i+1) - num;
            
            if (!map1.containsKey(a)) {
                map1.put(a, 1);
            } else {
                int val = map1.get(a);
                map1.put(a, val + 1);
            }
            
            int b = num + (i+1);
            if (!map2.containsKey(b)) {
                map2.put(b, 1);
            } else {
                int val = map2.get(b);
                map2.put(b, val + 1);
            }
        }
        
        long count = 0;
        for (Integer key : map2.keySet()) {
            // System.out.println(key);
            if (!map1.containsKey(key)) continue;
            
            int val1 = map1.get(key);
            int val2 = map2.get(key);
            
            count += (long)val1 * val2;
        }
        System.out.println(count);
    }
}


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

#ifdef _WIN32
#define scanfll(x) scanf("%I64d", x)
#define printfll(x) printf("%I64d", x)
#else
#define scanfll(x) scanf("%lld", x)
#define printfll(x) printf("%lld", x)
#endif
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>;
static const long long INF = 1e18;

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, m; 
    while (cin >> n >> m && n && m) {
        vvll dl(n, vll(n, INF)), ds(n, vll(n, INF));
        rep(i, n) dl[i][i] = ds[i][i] = 0;

        rep(i, m) {
            ll x, y, t; char sl; cin >> x >> y >> t >> sl; x--; y--;
            (sl == 'L' ? dl : ds)[x][y] = (sl == 'L' ? dl : ds)[y][x] = t;
        }
        rep(k, n) rep(i, n) rep(j, n) 
            chmin(dl[i][j], dl[i][k]+dl[k][j]), chmin(ds[i][j], ds[i][k]+ds[k][j]);

        ll r; cin >> r;
        vll z(r); rep(i, r) { cin >> z[i]; z[i]--; } 

        // ??????j???????????????i?????????????????????????????????????????????
        vvll dp(r+1, vll(n, INF));
        dp[0][z[0]] = 0;
        rep(i, r) rep(j, n) { // j?????????
            if (dp[i][j] == INF) continue;
            rep(k, n) { // k???j?????????????????????, k????????????z[i]?????????
                if (ds[j][k] == INF) continue;
                ll tmp = (dp[i][j]/*????????§????????£????????????*/ + 
                        dl[i?z[i-1]:z[0]][j]/*j?????????????????????*/ +
                        ds[j][k]/*j??????k????§????*/ + 
                        dl[k][z[i]]/*k??????????????´???????§????*/);
                chmin(dp[i+1][k], tmp);
            }
            if (dl[i?z[i-1]:z[0]][z[i]] != INF)
                chmin(dp[i+1][j], 
                        dp[i][j]/*????????§????????£????????????*/ + 
                        dl[i?z[i-1]:z[0]][z[i]]/*????????´???????§????*/);
        }

        ll ret = INF;
        rep(j, n) 
            chmin(ret, dp[r][j]);
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 5196
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>

using namespace std;

typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

int N;

int main()
{
        cin >> N;
        if (N == 1){
            cout << 1 << endl;
            return 0;
        }
        int maxTime, maxCnt = 0;
        for (int i = 1; i <= N; ++i) {
            int cnt = 0, num = i;
            while (num % 2 == 0) {
                cnt++;
                num /= 2;
            }
            if (maxCnt < cnt){
                maxTime = i;
                maxCnt = cnt;
            }
        }
        cout << maxTime << endl;

        return 0;
}

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

int main() {
  string S;
  cin >> S;

  if (S.substr(0, 1) == S.substr(1, 1) && S.substr(2, 1) == S.substr(3, 1) &&
      S.substr(0, 1) != S.substr(2, 1)) {
    cout << "Yes" << endl;
  } else if (S.substr(0, 1) == S.substr(2, 1) &&
             S.substr(1, 1) == S.substr(3, 1) &&
             S.substr(0, 1) != S.substr(1, 1)) {
    cout << "Yes" << endl;
  } else if (S.substr(0, 1) == S.substr(3, 1) &&
             S.substr(1, 1) == S.substr(2, 1) &&
             S.substr(0, 1) != S.substr(1, 1)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()
const ll MOD = 1e9 + 7;

ll power(int x, int y) {
    if (y == 0) return 0;
    if (y == 1) return x;
    ll p = power(x, y >> 1);
    if (y & 1) return p * p % MOD * x % MOD;
    else return p * p % MOD;
}

ll inv(ll n) {
    return power(n, MOD - 2);
}

ll N, K, A[200000];

int main() {
    cin >> N >> K;
    bool all_minus = true;
    REP(i, N) {
        cin >> A[i];
        if (A[i] > 0) all_minus = false;
    }
    sort(A, A + N, [](auto const& lhs, auto const& rhs) { return abs(lhs) > abs(rhs); });
    bool minus = false;
    ll last_minus = -1, last_plus = -1;
    ll ans = 1;
    REP(i, K) {
        if (A[i] < 0) {
            ans = ans * -A[i] % MOD;
            minus = !minus;
            last_minus = i;
        } else if (A[i] > 0) {
            ans = ans * A[i] % MOD;
            last_plus = i;
        } else {
            ans = 0;
        }
    }
    if (ans == 0) {
        cout << ans << endl;
        return 0;
    }
    if (!minus) {
        cout << ans << endl;
        return 0;
    }
    if (all_minus) {
        ans = 1;
        REP(i, K) ans = ans * -A[N - i - 1] % MOD;
        cout << (MOD - ans) % MOD << endl;
        return 0;
    }

    ll next_minus = -1, next_plus = -1;
    FOR(i, K, N) {
        if (A[i] < 0 && next_minus == -1) next_minus = i;
        if (A[i] > 0 && next_plus == -1) next_plus = i;
    }

    if (next_plus != -1 && next_minus != -1 && last_plus != -1) {
        if (A[next_plus] * A[last_plus] >= -A[next_minus] * -A[last_minus]) {
            cout << ans * inv(-A[last_minus]) % MOD * A[next_plus] % MOD << endl;
        } else {
            cout << ans * inv(A[last_plus]) % MOD * -A[next_minus] % MOD << endl;
        }
    } else if (next_plus != -1) {
        cout << ans * inv(-A[last_minus]) % MOD * A[next_plus] % MOD << endl;
    } else if (next_minus != -1 && last_plus != -1) {
        cout << ans * inv(A[last_plus]) % MOD * -A[next_minus] % MOD << endl;
    } else {
        if (N == K) cout << (MOD - ans) % MOD << endl;
        else cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 5168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    int sum = 0;
    vector<int> a(N+2, 0);
    for(int i=1; i<=N; i++) cin >> a[i];
    for(int i=1; i<=N+1; i++) sum += abs(a[i]-a[i-1]);
    

    int ans = 0;
    for(int i=1; i<=N; i++){
        cout << sum - abs(a[i]-a[i-1]) - abs(a[i+1]-a[i]) + abs(a[i+1]-a[i-1]) << endl;
    }
}

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


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";

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



template <class T> inline T biton(T n, T pos)
{
    return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
    return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
    return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
    while (b)
    {
        a = a % b;
        swap(a, b);
    }
    return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
};

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif



void solve()
{
    long long a,b,k;
    cin>>a>>b>>k;

    if(a>=k)
    {
        cout<<a-k<<" "<<b<<endl;
        return;
    }

    if(a+b<=k){
        cout<<0<<" "<<0<<endl;
        return;
    }

    k=k-a;

    cout<<0<<" "<<b-k<<endl;

}

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


    int t = 1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int a, b, k;
	vector<int>ans;
	cin>> a >> b >> k;
	lp(k) {
		if (a + i <= b)
			ans.push_back(a + i);
		if (b - i >= a)
			ans.push_back(b - i);
	}
	sort(ans.begin(), ans.end());
	ans.erase(unique(ans.begin(), ans.end()), ans.end());
	lp(ans.size())
		cout << ans[i] << endl;
	return 0;
}

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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}


const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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

const int N = 1e5 + 5;
const long long INF = 1e18;




int main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string str;
    cin >> str;
    vector<string>lst;
    lst.push_back("");
    for(int i = 0; i <str.size(); ++i){

            int j = i,cnt = 1;
            while(j < str.size()){
                if(str.substr(i,cnt) != lst.back()){
                    lst.push_back(str.substr(i,cnt));
                    i = j;
                    break;
                }
                j++;
                cnt++;
            }
           // error(i,j);

    }
    cout << lst.size()-1 <<'\n';
    //for(auto i : lst)cout << i << ' ';

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef map<int,int> mapii;
typedef map<int,bool> mapib;
typedef map<char,int> mapci;

#define small 1e-9
#define big5 1000000005
#define big7 1000000007
#define big 1000000
#define pi 3.1415926

#define inp(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define cum(arr,n,cumm) cumm[0]=0;for(int i=0;i<n;i++)cumm[i+1]=cumm[i]+arr[i];
#define bsdk ios_base::sync_with_stdio(false);cin.tie(NULL);
#define disp(arr) for(auto i:arr)cout<<i<<" ";cout<<"\n"
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define m1 cout<<"-1\n"
#define nl <<endl
#define hs cout<<"#"

#define fori(a, b, c) for (a = (b); (a) <= (c); ++(a))
#define ford(a, b, c) for (a = (b); (a) >= (c); --(a))
#define rep(i,n) fori(i,0,n-1)
#define rep1(i,n) fori(i,1,n)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define ub upper_bound
#define lb lower_bound
#define allv(v) v.begin(), v.end()
#define sorti(v) sort(allv(v))
bool isprime[big+1];
vector<int> primes;
void makesieve()
{
    ll i,j;
    rep(i,1000001)
        isprime[i]=false;
    isprime[2]=true;
    for(i=3;i<=big;i+=2)
        isprime[i]=true;
    for(i=3;i<=big;i+=2)
    {
        if(isprime[i])
            for(j=i*i;j<=big;j+=i)
            isprime[j]=false;
    }
    rep(i,big+1)
    {
        if(isprime[i])
            primes.pb(i);
    }
}
ll poww(ll n,ll m){
    if(m==0)return 1;
    if(m==1)return n;
    ll ans = poww(n,m/2);
    if(m%2==1) return (ans*ans)*n;
    else return (ans*ans);
}
int dp[100001];
int reach(int n,int arr[],int k)
{
    if(n<=1)
        return 0;
    if(dp[n]!=-1)
        return dp[n];
    int ans=INT_MAX,i;
    for(i=1;i<=k;i++)
        if(n-i >=1)
        ans=min( ans,reach(n-i,arr,k)+abs(arr[n-1]-arr[n-i-1]) );
    dp[n]=ans;
    return ans;
}
void solve()
{
    int n,i,k;
    cin>>n>>k;
    int arr[n];
    inp(arr,n);
    fill(dp,dp+100002,-1);
    cout<<reach(n,arr,k);
}
int main()
{
    bsdk
    int t;
    //cin>>t;
    t=1;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 8832
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
k,n = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)

md = k - a.last + a.first
(a.size-1).times do |i|
  d = a[i+1] - a[i]
  md = d if md < d
end

puts k - md


Measured memory_bytes: 17084
<?php


fscanf(STDIN, "%d %d %d %d %d", $a, $b, $c, $d, $e);

$arr = [$a, $b, $c, $d, $e];

for ($i = 0; $i < count($arr); $i++) {
  if($arr[$i] === 0) {
      echo $i + 1;
      break;
  }
}



?>


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

const ll mod = 1e9 + 7;
const ll inf = 1e9 + 9;

ll power(ll a, ll b, ll m = mod) {
    ll x = 1;
    while (b) {
        if (b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}

const int N = 2e5 + 9;
long long dp[N], a[N], sum[N];

signed main() {
    int n;
    cin >> n;
    n++;
    a[1] = 2e5 + 1;
    for (int i = 2; i <= n; i++) {
        cin >> a[i];
    }

    dp[1] = 1;
    
    for (int i = 2; i <= n; i++) {
        dp[i] = dp[i - 1];
        if (a[i] == a[i - 1]) {
            continue;
        }
        dp[i] += sum[a[i]];
        if (dp[i] >= mod) dp[i] -= mod;
        sum[a[i]] += dp[i - 1];
        if (sum[a[i]] >= mod) sum[a[i]] -= mod;
    }
    cout << dp[n] << "\n";
}


Measured memory_bytes: 4992
/*  ex7_3
    B30095    */
#include <stdio.h>
#include <stdlib.h>

void print_compressed(char ** grid, int rows, int cols);

int main(void){
    int rows, cols, isRowEmpty, isColEmpty, i, j;
    char ** grid;
    
    scanf("%d %d", &rows, &cols);
    
    // memory allocation
    grid = (char **)malloc(rows * sizeof(char *));
    for(i = 0; i < rows; i++){
        grid[i] = (char *)malloc(cols * sizeof(char));
    }

    // input grid
    for(i = 0; i < rows; i++){
        for(j = 0; j < cols; j++){
            scanf(" %c", &(grid[i][j]));
        }
    }

    print_compressed(grid, rows, cols);

    return 0;
}


void print_compressed(char ** grid, int rows, int cols){
    int isRowEmpty, isColEmpty, i, j;

        // substitue empty rows with whitespaces
    for(i = 0; i < rows; i ++){
        isRowEmpty = 1;
        
        // check if the row is empty
        for(j = 0; j < cols; j++){
            if(grid[i][j] == '#') {
                isRowEmpty = 0;
            }
        }

        // fill in empty rows with whitespaces
        if(isRowEmpty){
            for(j = 0; j < cols; j++){
                grid[i][j] = ' ';
            }
        }
    }

    // substitue empty columns with whitespaces
    for(j = 0; j < cols; j ++){
        isColEmpty = 1;
        
        // check if the column is empty
        for(i = 0; i < rows; i++){
            if(grid[i][j] == '#') {
                isColEmpty = 0;
            }
        }

        // fill in empty columns with whitespaces
        if(isColEmpty){
            for(i = 0; i < rows; i++){
                grid[i][j] = ' ';
            }
        }
    }


    // print compressed result
    for(i = 0; i < rows; i++){
        isRowEmpty = 1;

        for(j = 0; j < cols; j++){
            if(grid[i][j] == '#') isRowEmpty = 0;
            if(grid[i][j] != ' ') printf("%c", grid[i][j]);
            
        }

        if(!isRowEmpty) printf("\n");  // new line should not be printed when the row is empty
    }
}

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

int main(int argc, const char * argv[]) {
    int N, M;
    cin >> N;
    cin >> M;
    
    if (M == 0) {
        int ans = 0;
        //if (N == 1) { ans = 0;}
        if (N == 2) { ans = 10;}
        if (N == 3) { ans = 100;}
        cout << ans << endl;
        return 0;
    }
    
    map<int, int> mp;
    for (int i = 0; i < M; i++) {
        int s, c;
        cin >> s;
        cin >> c;
        if (N != 1 && s == 1 && c == 0) {
            cout << "-1" << endl;
            return 0;
        }
        
        if (mp.find(s) == mp.end()){
            mp[s] = c;
        }else {
            if (mp[s] != c) {
                cout << "-1" << endl;
                return 0;
            }
        }
    }
    
    int ans = 0;
    int c = 1;
    for (int i = N; i >= 1; i--) {
        if (i == 1 && mp.find(i) == mp.end()) {
            ans += c * 1;
        }
        if(mp.find(i) != mp.end()) {
            ans += c * mp[i];
        }
        c *= 10;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int result = 0;
        for (int i = 111; i <= 999 && result == 0; i += 111) {
            if (n <= i) {
                result = i;
            }
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21716
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int> > G(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(auto x:G[0]){
        for(auto y:G[x]){
            if(y==n-1){
                cout << "POSSIBLE" <<endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0; 
}

Measured memory_bytes: 12016
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Stack;
 

public class Main{
          
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{ String line;
             while((line=br.readLine())!=null){if(line.isEmpty())break;
                String spl[]=line.split(" ");
                int n=Integer.parseInt(spl[0]),q=Integer.parseInt(spl[1]);
                int[] parent=new int[n];for(int i=0;i<n;i++)parent[i]=i;
                for(int i=0;i<q;i++){
                    line=br.readLine();spl=line.split(" "); int[] ns=new int[3];
                    for(int j=0;j<3;j++) ns[j]=Integer.parseInt(spl[j]);
                    if(ns[0]==0){//UNITE
                        if(parent[ns[1]]!=parent[ns[2]]){int tmp=parent[ns[1]];
                            for(int k=0;k<n;k++){
                                if(parent[k]==tmp)
                                    parent[k]=parent[ns[2]];
                            }
                        }
                       // System.out.println(Arrays.toString(parent));
                    }else{//Print
                        if(parent[ns[1]]==parent[ns[2]])System.out.println("1");
                        else System.out.println("0");
                    }
                }
                
             }
         }catch(Exception e){e.printStackTrace();}         
     }  
     
     
}

Measured memory_bytes: 63916
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	long long N;
	cin >> N;
	vector<long long> a(5);
	for (auto &x : a) {
		cin >> x;
	}
	long long mn = *min_element(a.begin(), a.end());

	long long ans = (N + mn - 1) / mn + 4;
	cout << ans << endl;
}


Measured memory_bytes: 256
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)
 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define repp(i, a, b) for(int i = a; i <= b; i++)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, b, a) for(int i = b; i >= a; i--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in_edges(m) repp(i, 1, m){ll a, b; cin >> a >> b; v[a].pb(b), v[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define endl "\n"
#define bitsf(n) __builtin_popcount(n)
ll power(ll x, ll y); 

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll n, m;
	cin >> n >> m;
	vector<double> arr(n);
	rep(i, 0, n) cin >> arr[i];
	sort(rall(arr));
	double tot = 0;
	rep(i, 0, n) tot += arr[i];
	tot /= 4;
	tot /= m;

	ll c = 0;
	rep(i, 0, n){
		
		if(arr[i] >= tot) c++;
	}

	if(c >= m) cout << "Yes";
	else cout <<"No";
}
 
ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

if A >= B:
    print((N - 1) * B)
    exit()

# x -----> x ----> x            y ----> y                z ----> z

# テレポートとテレポートの間を１グループとすると、各グループは独立している
# 行った道を引き返すことはない。基本的に左から右への移動で十分。

dp = [-1] * (N + 1)
dp[0], dp[1] = 0, 0

for i in range(1, N):
    dp[i + 1] = min(dp[i] + A * (X[i] - X[i - 1]), dp[i] + B)

# print('dp', dp)
print(dp[-1])


Measured memory_bytes: 14224
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>
#include <complex>
#include <bitset>

#define rep(i,n) for (int i = 0; i < (n); ++i)

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

const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

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


int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n); rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    // 単調性が成り立つことを示す。
    // k - a[i] <= S < k となるSが存在するとすると、
    // a[j] > a[i] を満たす任意のa[j]について、k - a[j] <= S' < k が成り立つようなS'が存在することが示せる。
    // (Sに a[j]が含まれる場合と、a[j]が含まれない場合に分けると示せた。)

    // bitset高速化を付け加えてみた。

    int left = -1;
    int right = n;
    int mid;
    while (right - left > 1) {
        mid = (left + right) / 2;
        bitset<5010> dp;
        dp[0] = 1;

        rep(i, n) {
            if (i != mid) {
                dp = dp | (dp << a[i]);
            }
        }

        bool flag = 0;
        for (int j = max(0, k - a[mid]); j < k; j++) {
            flag |= dp[j];
        }
        if (flag) right = mid;
        else left = mid;
    }

    cout << left + 1 << endl;

    return 0;
}


    

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()

    return

#B
def B():
    n = I()

    return

#C
def C():
    n = I()

    return

#D
def D():
    def factorize(n):
        if n < 4:
            return [1,n]
        res = []
        for i in range(1,int(n**0.5)+1):
            if n%i == 0:
                res.append(i)
                if n//i != i:
                    res.append(n//i)
        res.sort()
        return res
    n = I()
    if n <= 2:
        print(0)
        quit()
    f = factorize(n)
    ans = 0
    for i in f:
        m = max(0,n//i-1)
        if i<m:
            ans += m
    print(ans)
    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#G
def G():
    n = I()

    return

#H
def H():
    n = I()

    return

#I
def I_():
    n = I()

    return

#J
def J():
    n = I()

    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 39536
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int main() {
	int n;
	scanf("%d", &n);
	ll ans[2] = {-1,-1};
	REP(i, n) {
		ll a,b;
		scanf("%lld %lld", &a, &b);
		ll minby = LLONG_MAX;
		if (ans[0] > a) {
			ll by = (ans[0] / a) + (bool)(ans[0]%a);
			if (b * by >= ans[1])
				minby = min(minby, by);
		}
		if (ans[1] > b) {
			ll by = (ans[1] / b) + (bool) (ans[1] % b);
			if (a * by >= ans[0])
				minby = min(minby, by);
		}
		if (minby == LLONG_MAX) minby = 1;
		a *= minby;
		b *= minby;
		ans[0] = a;
		ans[1] = b;
	}
	printf("%lld\n", ans[0] + ans[1]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,mod=1e9+7;
ll dp[N][4],n,ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;cin>>s;
    n=s.size();
    dp[n][3]=1;
    for(ll i=n-1;i>=0;i--){
        for(ll j=3;j>=0;j--){
            dp[i][j] = dp[i+1][j]*(s[i]=='?'?3ll:1ll);
            if(j<3 && (s[i]=='?' || s[i]=="ABC"[j]))dp[i][j]+=dp[i+1][j+1];
            dp[i][j]%=mod;
        }
    }
    cout<<dp[0][0];
}

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

ll ceil(ll a, ll b){
    if(a >= 0){
        return (a+b-1)/b;
    }else{
        return a/b;
    }
}

ll floor(ll a, ll b){
    if(a < 0){
        return (a-b+1)/b;
    }else{
        return a/b;
    }
}

int main(){
    ll N, K;  cin >> N >> K;
    vector<ll> A(N);
    for(ll i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    ll low = -1e18-1, high = 1e18;
    while(high - low > 1){
        ll mid = (high + low) / 2;
        ll cnt = 0;
        for(ll i=0; i<N; i++){
            ll a = A[i];
            if(a == 0){
                if(mid >= 0) cnt += i;
            }else if(a > 0){
                ll t = floor(mid, a);
                cnt += upper_bound(A.begin(), A.begin() + i, t) - A.begin();
            }else{
                ll t = ceil(-mid, -a);
                cnt += A.begin() + i - lower_bound(A.begin(), A.begin() + i, t);
            }
        }

        if(cnt >= K){
            high = mid;
        }else{
            low = mid;
        }
    }
    cout << high << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,HP;
   cin >> N;
  vector<int>kosu(N);
  
  for(int i=0; i<N; i++){
    cin>>kosu.at(i);
  }
  
  for(int a=0; a<N; a++){
       for(int i=0; i<N; i++){
         HP = HP + kosu.at(a)*kosu.at(i);
       }
  }
  
  for(int i=0; i<N; i++){
    HP = HP - kosu.at(i)*kosu.at(i);
  }
  HP = HP /2;
  
  cout << HP << endl;
}
  

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

int main() {
  int N, K; cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  vector<bool> dp(K+1, false);
  for (int i = 0; i <= K; i++) {
    if (dp.at(i)) continue;
    for (int j = 0; j < N; j++) {
      if (i + A.at(j) > K) continue;
      dp.at(i + A.at(j)) = true; 
    }
  }
  if (dp.at(K)) cout << "First" << endl;
  else cout << "Second" << endl;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HashMap<Integer,Integer> mem = new HashMap<>();
        String[]s = in.next().split(",");
        for (String v: s){
            System.out.print(v+" ");
        }
    }
}


Measured memory_bytes: 23636
import java.util.Arrays;
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        int[] sxx = {sx,sx+1,sx-1,sx};
        int[] syy = {sy+1,sy,sy,sy-1};
        int[] txx = {tx-1,tx,tx,tx+1};
        int[] tyy = {ty,ty-1,ty+1,ty};
        StringBuilder d = new StringBuilder();
        for(int i = 0;i < 4;i++){
            if(i == 0){
                d.append("U");
                for(int j = syy[i];j < tyy[i];j++){
                    d.append("U");
                }
                for(int j = sxx[i];j < txx[i];j++){
                    d.append("R");
                }
                d.append("R");
            }
            if(i == 1){
                d.append("D");
                for(int j = syy[i];j < tyy[i];j++){
                    d.append("D");
                }
                for(int j = sxx[i];j < txx[i];j++){
                    d.append("L");
                }
                d.append("L");
            }
            if(i == 2){
                d.append("L");
                for(int j = syy[i];j < tyy[i];j++){
                    d.append("U");
                }
                for(int j = sxx[i];j < txx[i];j++){
                    d.append("R");
                }
                d.append("D");
            }
            if(i == 3){
                d.append("R");
                for(int j = syy[i];j < tyy[i];j++){
                    d.append("D");
                }
                for(int j = sxx[i];j < txx[i];j++){
                    d.append("L");
                }
                d.append("U");
            }
        }
        System.out.println(d);
    }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main()
{
    long long fin=0;
    long long n;
    cin>>n;
    string s;
    cin>>s;
    long long r=0, g=0, b=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='R'){
            r++;
        }
        else if(s[i]=='G'){
            g++;
        }
        else{
            b++;
        }
    }
    fin=r*g*b;
    for(int i=0;i<s.size();i++){
        for(int j=i+1;j<s.size();j++){
            if(2*j-i<s.size() && s[2*j-i]!=s[i] && s[2*j-i]!=s[j] && s[i]!=s[j]){
                fin--;
            }
        }
    }
    cout<<fin;
    return 0;
}


Measured memory_bytes: 3624
// tested on node version 0.10.36
var fs = require("fs");
function gcd(a, b) {
    // make sure a > b
    var t = a;
    if(b > a) {
        a = b;
        b = t;
    }
    while(b != 0) {
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}

var input = fs.readFileSync('/dev/stdin').toString();
var lines = input.split("\n");
for(var i = 0; i < lines.length; i++) {
    var parts = lines[i].split(" ");
    var a = parseInt(parts.shift());
    var b = parseInt(parts.shift());
    if(!isNaN(a + b)) {
        var g = gcd(a, b);
        var lcm = (a * b) / g;
        console.log(g, lcm);
    }
}

Measured memory_bytes: 15672
def binary_search(key):
    left = 0; right = n
    cnt = 0
    while left < right:
        mid = (left + right) // 2
        if key == S[mid]:
            cnt += 1
            break
        elif key < S[mid]:
            right = mid
        else:
            left = mid + 1
    return cnt

n = int(input())
S = [int(e) for e in input().split()]
q = int(input())
T = [int(e) for e in input().split()]
cnt = 0
for key in T:
    cnt += binary_search(key)
print(cnt)



Measured memory_bytes: 16892
#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); }


int n;
int ans[200];

int get_ans() {
  string ans; cin >> ans;
  if (ans == "-1") exit(0);
  return ans == "Red" ? 0 : 1;
}

int ask1(int i, int j) {
  cout << "? ";
  for (int k = i; k <= j; k++)
    cout << k << " ";
  cout << endl;
  return get_ans();
}

int ask2(int i, int j, int k) {
  cout << "? " << i << " ";
  for (int i = j; i <= k; i++)
    cout << i << " ";
  cout << endl;
  return get_ans();
}

int ask3(int i, int j, int k) {
  cout << "? " << i << " ";
  for (int i = 1; i <= j; i++)
    cout << i << " ";
  for (int i = k; i <= 2*n; i++) {
    cout << i << " ";
  }
  cout << endl;
  return get_ans();
}

int main()
{
  fastio();

  cin >> n;

  int a1 = ask1(1,n);

  int l = 1, r = n+1;
  while (r - l > 1) {
    int m = (r + l) / 2;
    int ans = ask1(m,m+n-1);
    if (ans == a1)
      l = m;
    else
      r = m;
  }

  //cout << l << " " << r << endl;

  for (int i = 1; i <= 2*n; i++) {
    if (r <= i && i < r+n-1) continue;
    ans[i] = ask2(i,r,r+n-2);
  }

  for (int i = r; i < r+n-1; i++) {
    ans[i] = ask3(i,l-1,r+n);
  }

  cout << "! ";
  for (int i = 1; i <= 2*n; i++) {
    cout << (ans[i] ? 'B' : 'R');
  }
  cout << endl;


  return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 200010;

int N, M;
int A[MN];
int num[MN];
int cv[MN];

int main() {
	scanf("%d %d", &N, &M);

	rep(i, N) {
		scanf("%d", &A[i]);
		++num[A[i]];
	}

	for (int i = 1; i <= N; ++i) {
		++cv[max(i - num[i], 0)];
		--cv[i];
	}

	rep(i, N) {
		cv[i + 1] += cv[i];
	}

	int cur = 0;
	for (int i = 0; i < N; ++i) {
		if (!cv[i]) {
			++cur;
		}
	}


	rep(i, M) {
		int x, y;
		scanf("%d %d", &x, &y);
		--x;

		int _y = A[x];

		if (_y - num[_y] >= 0) {
			int p = max(0, _y - num[_y]);

			if (--cv[p] == 0) {
				++cur;
			}
		}

		--num[_y];
		++num[y];

		if (y - num[y] >= 0) {
			int p = max(0, y - num[y]);

			if (cv[p]++ == 0) {
				--cur;
			}
		}

		A[x] = y;
		printf("%d\n", cur);
	}

	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n,m;cin >> n;
    vl v(n);
    rep(i,n)cin >> v[i];
    cin >> m;
    ll cnt=0;
    rep(i,m){
        ll x;cin >> x;
        if(binary_search(all(v),x))cnt++;
    }
    cout << cnt <<endl;
}



Measured memory_bytes: 3568
#include<stdio.h>
#define nil -1
int FIB(int);
int fib[45];

int main(){
  int n,i;
  
  for(i=0;i<45;i++)fib[i] = nil;
  fib[0]=fib[1]=1;
  
  scanf("%d",&n);

  printf("%d\n",FIB(n));
}

int FIB(int a){
  
  if (fib[a]!=nil)return fib[a];

  else{
    fib[a] = FIB(a-1) + FIB(a-2);
    return fib[a];
  }
}



Measured memory_bytes: 2112
a,b,c,k = map(int, input().split())
if (k - a) <= 0:
    print(k)
elif (k - a - b) <= 0:
    print(k - b)
elif (k - a - b - c) == 0:
    print(a - c)
else:
    print(a - ( k - a - b))

Measured memory_bytes: 9180