akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

#define gcd __gcd

void solve()
{
	int n;
	cin >> n;

	vector<ll> a(n);

	for(auto& el: a)
		cin >> el;

	vector<ll> prefgcd(n), suffgcd(n);

	prefgcd[0] = a[0];

	for(int i = 1; i < n; ++i)
		prefgcd[i] = gcd(prefgcd[i - 1], a[i]);

	suffgcd[n - 1] = a[n - 1];

	for(int i = n - 2; i >= 0; --i)
		suffgcd[i] = gcd(suffgcd[i + 1], a[i]);

	ll answ = prefgcd[n - 1];

	if(1 < n)
		answ = max(answ, suffgcd[1]);

	if(n - 2 >= 0)
		answ = max(answ, prefgcd[n - 2]);

	for(int i = 1; i + 1 < n; ++i)
		answ = max(answ, gcd(prefgcd[i - 1], suffgcd[i + 1]));

	cout << answ << endl;
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] s = new char[h][w];
        for (int i = 0; i < h; i++) {
            String sa = sc.next();
            for (int j = 0; j < w; j++) {
                s[i][j] = sa.charAt(j);
            }
        }
        int[][] hc = new int[h][w];
        for (int i = 0; i < h; i++) {
            Arrays.fill(hc[i], 0);
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (s[i][j] == '.') {
                    if (j == 0) {
                        hc[i][j] = 1;
                    } else {
                        hc[i][j] = hc[i][j - 1] + 1;
                    }
                }
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = w - 1; j >= 0; j--) {
                if (s[i][j] == '.') {
                    if (j < w - 1) {
                        if (hc[i][j] < hc[i][j + 1]) {
                            hc[i][j] = hc[i][j + 1];
                        }
                    }
                }
            }
        }
        int[][] wc = new int[w][h];
        for (int i = 0; i < w; i++) {
            Arrays.fill(wc[i], 0);
        }
        for (int i = 0; i < w; i++) {
            for (int j = 0; j < h; j++) {
                if (s[j][i] == '.') {
                    if (j == 0) {
                        wc[i][j] = 1;
                    } else {
                        wc[i][j] = wc[i][j - 1] + 1;
                    }
                }
            }
        }
        for (int i = 0; i < w; i++) {
            for (int j = h - 1; j >= 0; j--) {
                if (s[j][i] == '.') {
                    if (j < h - 1) {
                        if (wc[i][j] < wc[i][j + 1]) {
                            wc[i][j] = wc[i][j + 1];
                        }
                    }
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ans = Math.max(ans, hc[i][j] + wc[j][i] - 1);
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 66792
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long 
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    SYNC
    ll n,a,b,c,ans=0; in(n);
    ll dp[n+1][3];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    l(i,1,n+1)
    {
        in(a)>>b>>c;
        dp[i][0] = a + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = b + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = c + max(dp[i-1][1],dp[i-1][0]);
    }
    ans=max(dp[n][0],max(dp[n][1],dp[n][2]));
    o(ans)<<endl;
    
    
    
    
    

}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, q;
	cin >> a >> b >> q;
	vll s(a), t(b);
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	s.pb(1e11);
	s.insert(s.begin(), -1e11);
	t.pb(1e11);
	t.insert(t.begin(), -1e11);
	rep(i, q){
		ll ans = LONG_LONG_MAX;
		ll x; cin>>x;
		ll left=0, right=s.size()-1;
		ll S[2], T[2];
		while(right-left > 1){
			ll mid = (left+right)/2;
			if (s[mid] > x)
				right = mid;
			else{
				left = mid;
			}
		}
		S[0] = s[left], S[1] = s[right];
		//----------------------------------
		left = 0, right = t.size()-1;
		while(right-left > 1){
			ll mid = (left+right)/2;
			if (t[mid] > x)
				right = mid;
			else{
				left = mid;
			}
		}
		T[0] = t[left], T[1] = t[right];
		//----------------------------------
		rep(j, 2){
			rep(k, 2){
				ll mini, sum=0;
				mini = min(abs(x-S[j]), abs(x-T[k]));
				sum = mini + abs(S[j]-T[k]);
				ans = min(ans, sum);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2912
#include <stdio.h>
int main (){
int k,a[21],i,n=0;
  scanf ("%d",&k);
  for (i=0;i<k;i++){
  scanf ("%d",&a[i]);
  }
  for (i=0;i<k-2;i++){
  if (a[i]>a[i+1] && a[i+1]>a[i+2]){
  n++;
  }
  else if (a[i]<a[i+1] && a[i+1]<a[i+2]){
  n++;
  }
  }
  printf ("%d",n);
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}
const int INF = 1000000000;

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

    int k = x / 100;
    if(k*105 < x){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
      long long q(1);//cin>>q;
  while(q--){
    long long n,m,k(0),tot(0);string s,p;cin>>s;
   // int arr[n];
    if(s[0]=='R' and s[1]=='R' and s[2]=='R')
      cout<<3<<endl;
    else if(s[1]=='R' and s[0]=='R'){
      cout<<2<<endl;
    }
    else if(s[1]=='R' and s[2]=='R')
      cout<<2<<endl;
    else if(s[0]=='R' or s[1]=='R' or s[2]=='R')
      cout<<1<<endl;
    else
      cout<<0<<endl;
  }
}


Measured memory_bytes: 3648
#include <iostream>
#include <fstream>
#include <sstream>
#include <random>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <iostream>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <set>
#include <iomanip>

#define ll long long
#define mod 1000000007
#define max_limit 1000005
using namespace std;

string N;
int k;

int DP[110][4][2];

int solve(int index, int nonZero, int tightBound, vector<int> &digits) {
    if (nonZero > k) {
        return 0;
    }

    if(index == digits.size()) {
        if (nonZero == k) {
            return 1;
        }
        else {
            return 0;
        }
    }

    if(DP[index][nonZero][tightBound] != -1) {
        return DP[index][nonZero][tightBound];
    }

    int ans = 0;
    int upperLimit = (tightBound) ? digits[index] : 9;
    for(int i = 0; i <= upperLimit; i++) {
        int newNonZero = (i != 0) ? nonZero + 1 : nonZero;
        int newBound = (i == digits[index]) ? tightBound : 0;

        ans += solve(index + 1, newNonZero, newBound, digits);

    }
    DP[index][nonZero][tightBound] = ans;
    return ans;
}


int main() {

    cin>>N>>k;

    vector<int> digits;
    for(unsigned int i = 0; i < N.size(); i++) {
        digits.push_back(N[i] - '0');
    }
    memset(DP, -1, sizeof(DP));
    int ans = solve(0, 0, 1, digits);
    cout<<ans<<'\n';



    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(a + b + c - Math.max(Math.max(a, b), c));
	}
}

Measured memory_bytes: 22732
n = int(input())
 
testimony = [[] for _ in range(n)]
for i in range(n):
    tmp = int(input())
    for j in range(tmp):
        person, state = map(int, input().split())
        testimony[i].append([person-1, state])
#print(testimony)

from itertools import product
s = [0,1]
ptns = list(product(s, repeat=n))
ptns = list(reversed(ptns))
#print(ptns)

for i in range(len(ptns)):
    error = 0
    for j in range(n):
        if ptns[i][j] == 1: 
            for k in testimony[j]:
                if ptns[i][k[0]] != k[1]:
                    error = 1

    if error == 0:
        print(sum(ptns[i]))
        exit()


Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// diverta2019 Programming Contest2 A
// 2020.05.26

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K; cin >> N >> K;
  int ans;
  if(K != 1){
    ans = N-K;
  }else{
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#include <functional>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

#ifndef LOCAL
#define cerr _cer
struct _cert
{
    template <typename T> _cert& operator << (T) { return *this; }
};
_cert _cer;
#endif

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
ll a[3];

int main() {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    int cnt = 0;
    while (true) {
        if (a[0] % 2 == 1 || a[1] % 2 == 1 || a[2] % 2 == 1) {
            cout << cnt << "\n";
            return 0;
        }
        if (a[0] == a[1] && a[1] == a[2]) {
            cout << -1 << "\n";
            return 0;
        }
        ll x = a[0] + a[1] + a[2];
        for (int i = 0; i < 2; ++i)
            a[i] = (x - a[i]) / 2;
        ++cnt;
    }
    return 0;
}




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

int main(){
    int N, left=0, right=0, ans = 2e9;
    cin >> N;
    vector<int> w(1000);

    for(int i=0; i<N; i++){
	cin >> w[i];
	right+=w[i];
    }

    for(int i=0; i<N; i++){
	left += w[i];
	right -= w[i];
	ans = min(ans, abs(right-left));
    }
    
    cout << ans << endl;    
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int a, b;
	cin>>a>>b;
	cout<<a*b<<" "<<2 * (a + b)<<endl;
}

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int k = sc.nextInt();
    char[] c = s.toCharArray();
    for(int i = 0; i < c.length; i++) {
      if(i < c.length - 1) {
        if(c[i] != 'a') {
          int d = 'z' - c[i] + 1;
          if(k >= d) {
            c[i] = 'a';
            k -= d;
          }
        }
      } else {
        k = (k % 26);
        int d = 'z' - c[i] + 1;
        if(k >= d) {
          k -= d;
          c[i] = (char)('a' + k);
        } else {
          c[i] = (char)(c[i] + k);
        }
      }
    }
    System.out.println(new String(c));
  }
}

Measured memory_bytes: 26272
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int a,b=-1;
int main(){
	vector<int> train;
	while(cin>>a){
		if(a==0){
			cout<<train[b]<<endl;
			train.pop_back();
			b--;
		}
		else{
			train.push_back(a);
			b++;
		}
	}
	return 0;
}		



Measured memory_bytes: 3080
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../bits/stdc++.h"
#endif

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

using namespace std;

typedef pair<int, int> P;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

int N;
bool S[102];

void input(){
  cin>>N;
  char c[3];
  REP(i, N) {
    cin>>c;
    S[i] = (c[0]=='A');
  }
}

void solve(){
  int ca=0, cb=0;
  REP(i, N) {
    if(S[i])ca++;
    else cb++;
    if(cb>ca) {
      cout<<"NO"<<endl;
      return ;
    }
  }
  if(ca==cb)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

int main(){
  cin.tie(0);
  
  input();
  solve();
  
  return 0;
}

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

int main() {
  int N, n, nx = 0;
  cin >> N;
  n = N;
  for ( int i = 100000000; i > 0; i /= 10 ) {
    nx += n / i;
    n = N % i;
  }
  if( N % nx == 0 )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;  
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using namespace std;
long long n;
vector<int> x(200005);
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	vector<int> y = x;
	sort(x.begin(), x.begin() + n);
	int more = x[n / 2];
	int less = x[n / 2 - 1];
	for (int i = 0; i < n; i++) {
		if (y[i] <= less) {
			cout << more << endl;
		}
		else {
			cout << less << endl;

		}
	}
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<math.h>
#define PI 3.14159265358979
using namespace std;
int main(void){
    double d,a,x=0,y=0,degree=90;
    char c;
    while(cin >> d >> c >> a){
        if(d==0 && a==0)  break;
        x=x+cos(PI*degree/180)*d;
        y=y+sin(PI*degree/180)*d;
        degree=degree-a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
}


Measured memory_bytes: 3456
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

// #define DEBUG 1

int main() {
  string *a;
  int **b;
  int h, w;
  int x, y, z;
  cin >> h >> w;
  a = new string[h];
  b = new int *[h + 2];
  for (y = 0; y < h + 2; y++) {
    if (y < h) {
      cin >> a[y];
    }
    b[y] = new int[w + 2];
  }
  for (y = 0; y < h + 2; y++) {
    for (x = 0; x < w + 2; x++) {
      if (0 < x && x < w + 1 && 0 < y && y < h + 1 && a[y - 1][x - 1] == '#') {
        b[y][x] = 0;
      } else {
        b[y][x] = -1;
      }
    }
  }
#ifdef DEBUG
  cout << 0 << ":" << endl;
  for (y = 1; y <= h; y++) {
    for (x = 1; x <= w; x++) {
      cout << b[y][x];
    }
    cout << endl;
  }
#endif
  for (y = 1; y <= h; y++) {
    for (x = 1; x <= w; x++) {
      int c1 = 10000;
      int c2 = 10000;
      int c3 = 10000;
      int c4 = 10000;
      if (b[y + 1][x] >= 0) {
        c1 = b[y + 1][x];
      }
      if (b[y - 1][x] >= 0) {
        c2 = b[y - 1][x];
      }
      if (b[y][x + 1] >= 0) {
        c3 = b[y][x + 1];
      }
      if (b[y][x - 1] >= 0) {
        c4 = b[y][x - 1];
      }
      c1 = min(min(c1, c2), min(c3, c4));
      if (c1 < 10000) {
        if (b[y][x] < 0 || c1 + 1 < b[y][x]) b[y][x] = c1 + 1;
      }
    }
  }
#ifdef DEBUG
  cout << 1 << ":" << endl;
  for (y = 1; y <= h; y++) {
    for (x = 1; x <= w; x++) {
      cout << b[y][x];
    }
    cout << endl;
  }
#endif
  for (y = h; 1 <= y; y--) {
    for (x = w; 1 <= x; x--) {
      int c1 = 10000;
      int c2 = 10000;
      int c3 = 10000;
      int c4 = 10000;
      if (b[y + 1][x] >= 0) {
        c1 = b[y + 1][x];
      }
      if (b[y - 1][x] >= 0) {
        c2 = b[y - 1][x];
      }
      if (b[y][x + 1] >= 0) {
        c3 = b[y][x + 1];
      }
      if (b[y][x - 1] >= 0) {
        c4 = b[y][x - 1];
      }
      c1 = min(min(c1, c2), min(c3, c4));
      if (c1 < 10000) {
        if (b[y][x] < 0 || c1 + 1 < b[y][x]) b[y][x] = c1 + 1;
      }
    }
  }
#ifdef DEBUG
  cout << 2 << ":" << endl;
  for (y = 1; y <= h; y++) {
    for (x = 1; x <= w; x++) {
      cout << b[y][x];
    }
    cout << endl;
  }
#endif
  int m = 0;
  for (y = 1; y <= h; y++) {
    for (x = 1; x <= w; x++) {
      m = max(m, b[y][x]);
    }
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 5248
n = int(input())
a_list = list(map(int,input().split()))
a_list.sort()
a_max = a_list.pop()
result = []
import math
for a in a_list:
  result.append(abs(math.ceil(a_max /2) - a))

print(a_max,a_list[result.index(min(result))])


Measured memory_bytes: 68588
N, X = map(int,input().split())
L = list(map(int,input().split()))

ans = 0
D = 0
for i in range(N + 1):
  if i == 0:
    ans += 1
  else:
    D += L[i - 1]
    if D <= X:
      ans += 1
    else:
      break

print(ans)


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数　
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define INTINF 1000000000
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000  //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

#define N_MAX 100
#define W_MAX 1000000000
#define v_MAX 1000

int main()
{
    int X;
    int A;
    int B;
    int C;
    int ans = 0;
    int tmpsum;

    cin >> A >> B >> C >> X;

    REP(i, A + 1)
    {
        REP(j, B + 1)
        {
            tmpsum = 500 * i + 100 * j;
            if (tmpsum >= X - C * 50 && tmpsum <= X)
            {
                ans++;
            }
        }
    }
    cout << ans;
}

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

int main(){
  int a, b;
  cin >> a >> b;

  string win;

  if(a == 1){
    if(b == 1) win = "Draw";
    else win = "Alice";
  }
  else {
    if(b == 1) win = "Bob";
    else if(b < a) win = "Alice";
    else if(b == a) win = "Draw";
    else if(a < b) win = "Bob";
  }

  cout << win << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

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

    cout << (1 << (int)log2(n)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#define ll long long
#define N 200005
using namespace std;
int n,x,y;
struct pi{
	ll a,b;
	pi(){};
	pi(ll _a,ll _b){
		a=_a;b=_b;
	}
}tmp[N];
vector<pi>h[N];
struct pl{int l,r,lv,rv;}s[N];
void add(int a,int b,int c){
	if(s[a].l==0) s[a].l=b,s[a].lv=c;
	else s[a].r=b,s[a].rv=c;
}
bool cmp(const pi &A,const pi &B){return A.a<B.a||A.a==B.a&&A.b<B.b;} 
void dfs(int a,int fa,ll v,int w){
	if(s[a].l==0){h[a].push_back(pi(w,w));return;}
	else dfs(s[a].l,a,v,s[a].lv),dfs(s[a].r,a,v,s[a].rv);
	if(h[s[a].l].size()>h[s[a].r].size()) swap(s[a].l,s[a].r),swap(s[a].lv,s[a].rv);
	if(h[s[a].l].size()==0) return;
	int l=0,top=0;
	for(int i=0;i<h[s[a].l].size();i++){
		while(l<h[s[a].r].size()&&h[s[a].r][l].a+h[s[a].l][i].b<=v) l++;
		if(l!=0) top++,tmp[top]=pi(h[s[a].l][i].a+w,h[s[a].r][l-1].b+w);
	}
	int tip=top;
	for(int i=1;i<=tip;i++)
		if(tmp[i].a!=tmp[i].b) top++,tmp[top]=pi(tmp[i].b,tmp[i].a);
	sort(tmp+1,tmp+1+top,cmp);
	if(top!=0) h[a].push_back(tmp[1]);
	for(int i=2;i<=top;i++)
		if(tmp[i].b<h[a][h[a].size()-1].b) h[a].push_back(tmp[i]);
}
int main()
{
	//freopen("cc.in","r",stdin);
	//freopen("cc.out","w",stdout);
	scanf("%d",&n);
	for(int i=2;i<=n;i++) scanf("%d%d",&x,&y),add(x,i,y);
	ll l=0,r=1e10;
	while(l+1<r){
		ll mid=(l+r)/2;
		for(int i=1;i<=n;i++) h[i].clear();
		dfs(1,0,mid,0);
		if(h[1].size()!=0) r=mid;else l=mid;
	}
	for(int i=1;i<=n;i++) h[i].clear();
	dfs(1,0,l,0);if(h[1].size()!=0) r--;else l++;
	printf("%lld\n",l);
	return 0;
}

Measured memory_bytes: 32888
#include <stdio.h>
int main(void){
    // Your code here!
    int N, res = 0;
    char A[101],B[101],C[101];
    scanf("%d",&N);
    scanf("%s",A);
    scanf("%s",B);
    scanf("%s",C);
    for(int i = 0; i < N; i++)
    {
        if(A[i] == B[i] && B[i] == C[i])
        {
        
        }
        else if(A[i] != B[i] && B[i] != C[i] && C[i] != A[i])
        {
            res += 2;
        }
        else
        {
            res += 1;
        }
    }
    printf("%d\n",res);
}


Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#include<time.h>
#include<assert.h>
#define MAX 1000000
int cnt,A[MAX];
void insertionSort(int *A,int n,int G){
  int i,j,v;
  for(i=G;i<n;i++){
    v=A[i];
    j = i - G;
    while( j >= 0 && A[j] > v ){
      A[j+G] = A[j];
      j = j - G;
      cnt++;
    }
    A[j+G] = v;
  }
}

void shellSort(int *A,int n){
  int i,m;
  cnt=0;
  m = pow(n,1.25);
  if(m>=100) m=100;
  int G[m];
  G[0]=1;
  for(i=1;i<m;i++){
    if((G[i]=3*G[i-1]+1)>n) break;
  }
  m=i;
  for(i=m-1;i>=0;i--){
    insertionSort(A,n,G[i]);
  }
  assert(cnt<=pow(n,1.5));
    printf("%d\n",m);
    for(i=m-1;i>0;i--) printf("%d ",G[i]);
    printf("%d\n",G[i]);
    printf("%d\n",cnt);
    for(i=0;i<n;i++) printf("%d\n",A[i]);
}

int main(){
  srand((unsigned int)time(NULL));
  int i,n,A[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  shellSort(A,n);
  return 0;
}

Measured memory_bytes: 4552
//Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<vector>
#include<cmath>
#include<queue>
#include<ctime>
#include<set>
#define For(i,a,b) for(register int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(register int i=(a);i>=(b);i--)
#define Formylove return 0
const int N=2e5+7;
typedef long long LL;
typedef double db;
using namespace std;
int n,a[N];

template<typename T> void read(T &x) {
    char ch=getchar(); T f=1; x=0;
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') f=-1,ch=getchar();
    for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; x*=f;
}

struct node {
	int l,r,v;
	node(int l,int r,int v):l(l),r(r),v(v){}
	friend bool operator <(const node&A,const node&B) {
		return A.l<B.l;
	}
};
set<node>s;

int ck(int M) {
	s.clear();
	if(M>1) s.insert(node(1,a[1],1));	
	int rs=1;
	For(i,2,n) {
		if(a[i]>a[i-1]) { if(M>1) s.insert(node(a[i-1]+1,a[i],1)); }
		else {
			if(a[i]<a[i-1]) {
				while(s.size()) {
					node x=*s.rbegin();
					if(x.r<=a[i]) break;
					s.erase(x);
					if(x.l<=a[i]) {
						x.r=a[i];
						s.insert(x);
						break;
					}
				}
			}
			if(!s.size()) return 0;
			node x=*s.rbegin();
			s.erase(x);
			if(x.r-1>=x.l) s.insert(node(x.l,x.r-1,x.v));
			if(x.v+1<M) s.insert(node(x.r,x.r,x.v+1));
			if(x.r+1<=a[i]&&M>1) s.insert(node(x.r+1,a[i],1));
		}
	}
	return 1;
}

int main() {
	//freopen("rand.txt","r",stdin);
	read(n);
	For(i,1,n) read(a[i]);
	int l=1,r=n,ans=n;
	while(l<=r) {
		int mid=((l+r)>>1);
		if(ck(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
   	Formylove;
}

Measured memory_bytes: 13568
using System;
using System.Linq;

namespace ABC103B
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();

            string cur = S;
            for (int i = 0; i < S.Length; i++)
            {
                if (cur == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }

                string n = "";
                for (int j = 0; j < S.Length-1; j++)
                {
                    n += cur[j + 1];
                }

                n += cur[0];
                cur = n;
            }
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
fn getline() -> String {
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn main() {
    let s = getline();
    let vec: Vec<&str> = s.trim().split(' ').collect();
    let mut num_vec: Vec<i32> = Vec::new();
    for i in 0..vec.len() {
        let n: i32 = vec[i].parse().unwrap();
        num_vec.push(n);
    }

    let max: &i32 = num_vec.iter().max().unwrap();
    let sum: i32 = num_vec.iter().sum();

    println!("{}", sum - max);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define invrep(i,n) for(int i = (int)(n); i > 0; i++)
using ll = long long;

int main() {
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;

    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}

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

template<typename T>
void fin (T a){
    cout<<a<<endl;
    exit(0);
}
template<typename S>
void print(S a){
    cout<<a<<endl;
}

int main(){
    int a;
    rep(i,5){
        cin>>a;
        if(a==0){
            fin(i+1);
        }
    }

}


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair

#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;

    string s,ans;
    int w;
    cin>>s>>w;

    rep(i,s.length()){
        ans.pb(s[i]);
        i += w-1;
    }

    cout<<ans<<endl;
    //cout <<fixed<<setprecision(16)<< << endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    try(Scanner sc = new Scanner(System.in)){
      while(true){
        int n = sc.nextInt();
        if(n==0)break;
        int [] s = new int[n];
        int max = 0;
        int min = 1000;
        int sum = 0;
        for(int i=0;i<n;i++){
          s[i] = sc.nextInt();
          if(s[i]>max)max=s[i];
          if(s[i]<min)min=s[i];
          sum += s[i];
        }
        sum = sum - min - max;
        int score = sum / (n - 2);
        System.out.println(score);
      }
    }
  }
}



Measured memory_bytes: 28840
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

ll L,n;

vector<ll>x;
ll dr(int a,int b){
    return x[b]-x[a];
}
ll dl(int a,int b){
    return L-(x[b]-x[a]);
}

int main(){
    cin >> L >> n;
    x.resize(n);
    rep(i,n)cin >> x[i];
    ll mx = max(x[n-1],L-x[0]);
    
    ll tmp = x[0];
    ll st  = x[0];
    int id = 0;
    int id2 = n-1;
    while(id<id2){
        tmp += dl(id,id2);
        id++;
        if(id>=id2)break;
        tmp += dl(id,id2);
        id2--;
    }
    mx = max(mx,tmp);
    if(n%2==0){
        id = n/2;
        id2 = 0;
        for(int i=1;i<=n-2;i++){
            if(i%2==1){    
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id];
                id2++;
            }else{
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id+1];
                id2++;
                id++;
            }
            mx = max(mx,tmp);
        }
    }else{
        id = n/2;
        id2 = 0;
        for(int i=1;i<=n-2;i++){
            
            if(i%2==1){   
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id+1]; 
                id2++;
                id++;
            }else{
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id];
                id2++;
            }
            mx = max(mx,tmp);
        }

    }

    reverse(x.begin(),x.end());
    rep(i,n)x[i] = L-x[i];
    tmp = x[0];
    id = 0;
    id2 = n-1;
    while(id<id2){
        tmp += dl(id,id2);
        id++;
        if(id>=id2)break;
        tmp += dl(id,id2);
        id2--;
    }
    mx = max(mx,tmp);
    if(n%2==0){
        id = n/2;
        id2 = 0;
        for(int i=1;i<=n-2;i++){
            if(i%2==1){    
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id];
                id2++;
            }else{
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id+1];
                id2++;
                id++;
            }
            mx = max(mx,tmp);
        }
    }else{
        id = n/2;
        id2 = 0;
        for(int i=1;i<=n-2;i++){
            
            if(i%2==1){   
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id+1]; 
                id2++;
                id++;
            }else{
                tmp +=x[id]-x[id2];
                tmp -= x[id2];
                tmp -= L-x[id];
                id2++;
            }
            mx = max(mx,tmp);
        }

    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	char c;
	cin >> a >> c >> b;
	if (c == '+') dunk(a + b);
	else dunk(a - b);
	return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(W,n)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {REP(aaa,i){REP(bbb,j)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int main(){

	ll n;cin >> n;
	while(1){
		if(n % 111 == 0){
			cout << n << endl;
			return 0;
		}
		n++;
	}
	return 0;
}


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(),x.end()
auto& errStream=cerr;
#ifdef LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%"  SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read(),h=read(),w=read();
	print((n-h+1)*(n-w+1));
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
int main(void)
{
	long long a,x;
	int bb,len;
	char b[5];
	scanf("%lld %s",&a,b);
	len=strlen(b);
	bb=(b[0]-'0');
	if(len>=3)	bb=bb*100+(b[2]-'0')*10;
	if(len>=4)	bb=bb+(b[3]-'0');
	x=a*bb;
	x/=100;
	printf("%lld\n",x);
	return 0;
}

Measured memory_bytes: 1704
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll n; cin >> n;
  vector<ll> A(n+1), B(n);
  loop(i,0,n+1) cin >> A[i];
  loop(i,0,n) cin >> B[i];
  ll cnt = 0;
  loop(i,0,n) {
    ll &b = B[i];
    ll &a = A[i];
    ll d = min(b, a);
    a -= d;
    b -= d;
    
    ll &a2 = A[i+1];
    ll d2 = min(b, a2);
    a2 -= d2;
    b -= d2;
    cnt += d + d2;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 4672
#include<bits/stdc++.h>
using namespace std;
const int MAX_N=100;
int N,K;
int X[MAX_N];
int main(){
	cin>>N>>K;
	for(int i=0;i<N;++i) cin>>X[i];
	int ans=0;
	for(int i=0;i<N;++i){
		int tmp=min(X[i],K-X[i]);
		ans+=tmp;
	}
	cout<<ans*2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B && B==C && !(A%2)){
    puts("-1");
    return 0;
  }
  int cnt=0;
  for(;!(A%2) && !(B%2) && !(C%2);cnt++){
    int a=(B+C)/2,b=(C+A)/2,c=(A+B)/2;
    A=a,B=b,C=c;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3520
N = int(raw_input())
Names = []
n_M, n_A, n_R, n_C, n_H = 0,0,0,0,0
for i in range(N):
	Name = raw_input()
	if Name[0] == "M":
		n_M += 1
	if Name[0] == "A":
		n_A += 1
	if Name[0] == "R":
		n_R += 1
	if Name[0] == "C":
		n_C += 1
	if Name[0] == "H":
		n_H += 1

C = (n_M * n_A * n_R + 
	n_M * n_A * n_C +
	n_M * n_A * n_H +
	n_M * n_R * n_C +
	n_M * n_R * n_H +
	n_M * n_C * n_H +
	n_A * n_R * n_C +
	n_A * n_R * n_H +
	n_A * n_C * n_H +
	n_R * n_C * n_H
	)

print C

Measured memory_bytes: 5764
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int a,b,c,x;
  cin>>a>>b>>c>>x;
  Int ans=0;
  for(Int i=0;i<=a;i++)
    for(Int j=0;j<=b;j++)
      for(Int k=0;k<=c;k++)
	ans+=i*500+j*100+k*50==x;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

int main(){
    string s;
    cin >> s;
    
    vector<int> v;
    int cnt=1;
    rep(i,1,sz(s)-1){
        if(s[i]!=s[i-1]){
            v.push_back(cnt);
            cnt=1;
        }else{
            cnt++;
        }
    }
    v.push_back(cnt);
    //vecprint(v);
    int d;
    rep(i,0,sz(v)-1){
        if(s[0]=='<')d=1;
        else d=0;
        if(i%2==d){
            if(i!=0 || d!=0){
                if(v[i-1]<v[i]){
                    v[i-1]--;
                }else{
                    v[i]--;
                }
            }
        }
    }
  //vecprint(v);
    long long ans=0;
    rep(i,0,sz(v)-1){
        ans += 0.5*v[i]*(v[i]+1);
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 2048
#include <stdio.h>

int main()
{
  int i,j,A[100],N,v,h;
  scanf("%d",&N);
  if( N >= 1 ){
    for( i = 0 ; i < N ; i++ ){
      scanf("%d",&A[i]);
    } 

    for( h = 0 ; h < N ; h++ ){
       if( h > 0 ) printf(" ");
       printf("%d",A[h]);
    }
     printf("\n"); 
    
    for( i = 1 ; i < N ; i++ ){
      v = A[i];
      j = i - 1;
      while( j >= 0 && A[j] > v ){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
     for( h = 0 ; h < N ; h++ ){
       if( h > 0 ) printf(" ");
       printf("%d",A[h]);
    }
     printf("\n"); 
    }
    
    
  }
  return 0;
}



Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define prin(a) cout<<a<<"\n"
#define kaigyo cout<<"\n"
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define SORT(V) sort(ALL(V))
#define REV(V) reverse(ALL(V))
#define RSORT(V) SORT(V);REV(V)

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<string> vst;
typedef vector<char> vc;
typedef vector<long double> vd;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
typedef vector<vector<int>> vint2;
ll mod=1e9+7;

const double pi=acos(-1.0);
const ll inf=1LL<<60;
ll gcd(ll p,ll q){if(q==0)return p;return gcd(q,p%q);}  
ll lcm(ll p,ll q){return (p*q)/gcd(p,q);}
ll kaizyo(ll k){ll sum=1;rep1(i,k){sum*=i;sum%=mod;}return sum;}
ll ncr(ll n,ll r){return kaizyo(n)/(kaizyo(r)*kaizyo(n-r));}


int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
cout.precision(20);
int k;cin>>k;
int a[1000003];
a[1]=7;
rep1(i,k){
    if(a[i]%k==0){
        prin(i);return(0);
}
else{
    a[i+1]=(a[i]*10+7)%k;
}
}
prin(-1);
}



Measured memory_bytes: 3624
n = int(input())
a = list(map(int, input().split()))
a_suseki = 1
a_nukewa = 0

for i in range(n):
  a_suseki = a_suseki * a[i]

for i in range(n):
  a_nukewa = a_nukewa + (a_suseki/a[i])

print(a_suseki / a_nukewa)

Measured memory_bytes: 8844
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

typedef long long ll;
#define fi first
#define se second

using namespace std;

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

int A;
int B;
int C;
int nA;
int nB;
int nC;
int cnt = 0;

int main(){
  
  cin>>A>>B>>C;
  
  if( A == B && B == C ){
    if( !(A%2) && !(B%2) && !(C%2) ){
      puts("-1");
    }
    else{
      puts("0");
    }
  }
  else{
    while( !(A%2) && !(B%2) && !(C%2) ){
      nA = B/2 + C/2;
      nB = C/2 + A/2;
      nC = A/2 + B/2;      
      cnt++;
      A = nA;
      B = nB;
      C = nC;
    }
    cout<<cnt<<endl;
  }
  
  return 0;
}

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

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

  if(a+b > c+d){
    cout << "Left" << endl;
  }
  else if(a+b == c+d){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#define ll long long
using namespace std;
int main()
{
	string s;
	cin>>s;
	int count = 0;
	int len = s.length();
	for(int i=0;i<len/2;i++)
	{
		if(s[i]!=s[len-1-i]) count++;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_V = 310;  // デフォルトで頂点数の最大値は300
  
int main() {
    ll n, m, L;
    cin >> n >> m >> L;
    
    vvl dist1(MAX_V, vl(MAX_V));
    vvl dist2(MAX_V, vl(MAX_V));
    rep(i, n) {
        rep(j, n) {
            if(i != j) {
                dist1[i][j] = INF;
                dist2[i][j] = INF;
            }
        }
    }
    
    rep(i, m) {
        ll a, b, cost;
        cin >> a >> b >> cost;
        a--;  b--;
        if(dist1[a][b] > cost) {
            dist1[a][b] = dist1[b][a] = cost;
        }
    }
 
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
 
    rep(i, n) {
        rep(j, n) {
            if(i == j) {
                continue;
            }
            if(dist1[i][j] <= L) {
                dist2[i][j] = dist1[j][i] = 1;
            }
        }
    }
 
    rep(k, n) {
        rep(i, n) {
            rep(j, n) {
                dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
            }
        }
    }
 
    ll Q;
    cin >> Q;
    vl ans(Q);
    rep(i, Q) {
        ll s, t;
        cin >> s >> t;
        s--;  t--;
        if(dist2[s][t] == INF) {
            ans[i] = -1;
        } 
        else {
            ans[i] = dist2[s][t] - 1;
        }
    }
 
    rep(i, Q) {
        out(ans[i]);
    }
 
    re0;
}

Measured memory_bytes: 2816
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int n, y;
    int a, b, c;
    scanf("%d %d", &n, &y);
    y = y / 1000;
    for (a = 0; a <= n; ++a)
        for (b = 0; b <= n - a; ++b)
        {
            if (10 * a + 5 * b + (n - a - b) == y)
            {
                printf("%d %d %d\n", a, b, n - a - b);
                return 0;
            }
        }
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 128
/* You can't hack me! */
#pragma warning(disable : 4996)
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vch;
typedef set<ll> sll;
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(auto i=a; i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define sc scanf
#define pr printf
#define in(x) sc("%lld", &(x))
#define id(x) sc("%Lf", &(x))
#define os(x) pr("%lld ", x)
#define on(x) pr("%lld\n", x)
#define nl cout<<"\n"
const ll P=998244353;
const ll N=200010;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll t=1;
    //cin>>(t);
    while(t--)
    {
        ll x, p=100;
        cin>>x;
        ll ans=0;
        while(p<x)
        {
            p+=p/100;
            ans++;
        }
        cout<<ans;
        nl;
    }
    cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3792
n,m,q_=map(int,input().split())
lr=[list(map(int,input().split())) for _ in range(m)]
pq=[list(map(int,input().split())) for _ in range(q_)]
from collections import defaultdict
dmap=defaultdict(int)
smap=defaultdict(int)
ssmap=defaultdict(int)
for l,r in lr:
  if (l,r) in dmap:
    dmap[(l,r)]+=1
  else:
    dmap[(l,r)]=1
for i in range(1,n+1):
  tmp=0
  for j in range(i,n+1):
    if (i,j) in dmap:
      tmp+=dmap[(i,j)]
    smap[(i,j)]=tmp
for i in range(1,n+1):
  tmp=0
  for j in range(1,i+1):
    tmp+=smap[(j,i)]
    ssmap[(j,i)]=tmp

for p,q in pq:
  ans=ssmap[(q,q)]-ssmap[(p-1,q)]
  print(ans)


Measured memory_bytes: 106124