akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define debug(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}


// #ifndef BOOST_TEST_MAIN
// int main(int const argc, char const** argv){
//   ll H, W;

//   cin >> H >> W;
//   vector<vector<int>> s;
//   s.resize(H + 2);
//   rep(i, H + 2){
//     s[i].resize(W + 2);
//   }
//   rep(x, W + 2){
//     s[x][0] = 0;
//     s[x][H + 2] = 0;
//   }
//   rep(y, H + 2){
//     s[0][y] = 0;
//     s[W + 2][y] = 0;
//   }
//   rep1(x, W + 1){
//     rep1(y, H + 1){
//       char c;
//       cin >> c;
//       // cout << c << endl;
//       if(c == '#'){
//         s[x][y] = 1;
//       }else{
//         s[x][y] = 0;
//       }
//     }
//   }
//   cout << s;
//   bool res = true;
//   rep(x, W){
//     rep(y, H){
//       // cout << x << " " << y << endl;

//       bool a = false;
//       if(s[x][y]){
//         if(0 != x && s[x - 1][y] == 1){
//           a = true;
//         }
//         if(0 != y && s[x][y - 1] == 1){
//           a = true;
//         }
//         if(W - 1 != x && s[x + 1][y] == 1){
//           a = true;
//         }
//         if(H - 1 != y && s[x][y + 1] == 1){
//           a = true;
//         }
//         // if(!(a || b || c || d)){
//         //   cout << x << " " << y << endl;
//         // }
//         res = res && a;
//       }
//     }
//   }
  
//   if(res){
//     cout << "Yes";
//   }else{
//     cout << "No";
//   }
// }
// #endif


#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  ll H, W;

  cin >> H >> W;
  vector<vector<int>> s;
  s.resize(H);
  rep(i, H){
    s[i].resize(W);
  }
  
  rep(x, W){
    rep(y, H){
      char c;
      cin >> c;
      // cout << c << endl;
      if(c == '#'){
        s[y][x] = 1;
      }else{
        s[y][x] = 0;
      }
    }
  }
  // cout << s;
  bool res = true;
  rep(x, W){
    rep(y, H){
      // cout << x << " " << y << endl;

      bool a = false;
      if(s[y][x]){
        if(0 != x && s[y][x - 1] == 1){
          a = true;
        }
        if(0 != y && s[y - 1][x] == 1){
          a = true;
        }
        if(W - 1 != x && s[y][x + 1] == 1){
          a = true;
        }
        if(H - 1 != y && s[y + 1][x] == 1){
          a = true;
        }
        // if(!(a || b || c || d)){
        //   cout << x << " " << y << endl;
        // }
        res = res && a;
      }
    }
  }
  
  if(res){
    cout << "Yes";
  }else{
    cout << "No";
  }
}
#endif


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

/**
 * The Number of Island
 */
public class Main {

	final static int LAND = 1;
	final static int VISITED = -1;

	final static int[] V = { 1, -1, 0, 0 };
	final static int[] H = { 0, 0, 1, -1 };

	static Queue<Integer> xs, ys;
	static int count;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		StringBuilder sb = new StringBuilder();
		while (true) {

			// load map
			int[][] map = new int[14][14];
			xs = new ArrayDeque<Integer>();
			ys = new ArrayDeque<Integer>();

			for (int i = 1; i < 13; i++) {
				line = br.readLine();
				for (int j = 1; j < 13; j++) {
					map[i][j] = line.charAt(j - 1) - '0';
				}
			}

			// solve
			count = 0;
			for (int i = 1; i < 13; i++) {
				for (int j = 1; j < 13; j++) {
					if (map[i][j] == LAND) {
						xs.add(i);
						ys.add(j);
						while (!xs.isEmpty() && !ys.isEmpty()) {
							visit(map);
						}
						count++;
					}
				}
			}
			sb.append(count + "\n");

			// next map
			line = br.readLine();
			if (line == null) {
				break;
			} else {
				continue;
			}
		}
		// output
		System.out.print(sb.toString());
	}

	public static void visit(int[][] map) {

		int x, y;
		x = xs.remove();
		y = ys.remove();

		if (map[x][y] == LAND) {
			map[x][y] = VISITED;

			// next choices
			for (int i = 0; i < 4; i++) {
				int xv, yh;
				xv = x + V[i];
				yh = y + H[i];
				if (map[xv][yh] == LAND) {
					xs.add(xv);
					ys.add(yh);
				}
			}
		}
	}
}

Measured memory_bytes: 16872
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <assert.h>
#include <queue>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define fi first
#define sc second
#define mp make_pair
typedef pair<int,int> P;
typedef pair<int,P> Q;
typedef pair<int,Q> R;
int dist[105][105][2];
int f[105][105];
int n,m;
int main(){
	while(1){
		cin>>m>>n;
		if(n ==0 )return 0;
		rep(i,n){
			rep(j,m){
				string sd; cin >> sd;
				char s = sd[0];
				if(s == 'S'){
					f[i][j] = 0;
				}
				else if(s == 'T'){
					f[i][j] = 0;
				}
				else if('0'<=s&&s<='9') f[i][j] = s-'0';
				else f[i][j] = 1e8;
			}
		}
		rep(i,105)rep(j,105)rep(k,2) dist[i][j][k] = 1e8;
		priority_queue<R,vector<R>,greater<R> >que;
		rep(j,m){
			if(f[n-1][j] == 0){
				dist[n-1][j][0] = 0;
				que.push(mp(0,mp(0,mp(n-1,j))));
				dist[n-1][j][1] = 0;
				que.push(mp(0,mp(1,mp(n-1,j))));
			//	cout << j << " " <<m << " " << n << endl;
			}
		}
		while(!que.empty()){
			R r = que.top(); que.pop();
			int d = r.sc.fi , x = r.sc.sc.fi , y = r.sc.sc.sc;
			if(dist[x][y][d] != r.fi) continue;
			if(d == 0){
				for(int i=-2;i<=2;i++) for(int j=1;j<=3;j++){
					if(abs(i)+abs(j) > 3) continue;
					if(0<=x+i&&x+i<n&&0<=y+j&&y+j<m){
						//dist[x+i][y+j][1]
						if(dist[x+i][y+j][1] > dist[x][y][0]+f[x+i][y+j]){
							dist[x+i][y+j][1] = dist[x][y][0]+f[x+i][y+j];
							que.push(mp(dist[x+i][y+j][1],mp(1,mp(x+i,y+j))));
						}
					}
				}
			}
			else{
				for(int i=-2;i<=2;i++) for(int j=-3;j<=-1;j++){
					if(abs(i)+abs(j) > 3) continue;
					if(0<=x+i&&x+i<n&&0<=y+j&&y+j<m){
						//dist[x+i][y+j][0]
						if(dist[x+i][y+j][0] > dist[x][y][1]+f[x+i][y+j]){
							dist[x+i][y+j][0] = dist[x][y][1]+f[x+i][y+j];
							que.push(mp(dist[x+i][y+j][0],mp(0,mp(x+i,y+j))));
						}
					}
				}
			}
		}
		int ans = 1e8;
		rep(j,m){
			if(f[0][j] == 0){ ans = min(ans,min(dist[0][j][0],dist[0][j][1])); }
		}
		if(ans > 5e7) ans = -1;cout<<ans<<endl;
	}
}



Measured memory_bytes: 3144
import sys
input = sys.stdin.readline
from collections import deque


def read():
    R, G, B, N = map(int, input().strip().split())
    return R, G, B, N


def solve(R, G, B, N):
    count = 0
    for r in range(N+1):
        for g in range(N+1):
            x = N - R * r - G * g
            if x >= 0 and x % B == 0:
                count += 1
    return count


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


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


int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans=0;
	ans = a;
	if (a > k) {
		cout << k;
		return 0;
	}
	if (a + b > k) {
		cout << a;
		return 0;
	}
	else {
		cout << a+a+b-k;
		return 0;
	}
}

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

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

    vector<long long> A(n-1);
    vector<long long> B(n,0);
    for(int i=0; i<n-1; i++){
        cin >> A.at(i);
        B.at(A.at(i)-1)++;
    }

    for(int i=0; i<n; i++){
        cout << B.at(i) << endl;
    }
}


Measured memory_bytes: 6428
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <iomanip>
#include <map>
#include <stack>
#include <sstream>


using namespace std;
//const int MAX = 1e6;

int main()
{

	long long int t, k; cin >> t >> k;
	long long int qanak = 0;
	while (t--)
	{
		long long int  a, b;
		cin >> a >> b;
		if (sqrt(a *a + b * b) <= k) {
			qanak++;
		
		}
	}
	cout << qanak;
	return 0;

}
	


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

int main()
{
	int n,k; //n：人数 k: 多少种类零食
	cin>>n>>k; //3 2
	int a[n+1];
	for(int i=1;i<=n;i++)	a[i]=0;
	
	int renshu,x;
	for(int i=1;i<=k;i++)
	{
		cin>>renshu;
		for(int j=1;j<=renshu;j++)
		{
			cin>>x;
			a[x]=1;
		}
	 } 
	 
	 int num=0;
	 for(int i=1;i<=n;i++)
	 {
	 	if(a[i]==0)
	 		num++;
	 }
	 
	 cout<<num<<endl;
	 
	 return 0;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.length(); ++i){
    char c = s[i];
    if(c == 'U' || c == 'D') continue;
    if(i % 2 == 0){
      if(c != 'R'){
        cout << "No" << endl;
        return 0;
      }
    }
    else{
      if(c != 'L'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main() {
	int N;
	cin >> N;
	int candy_sum = 0;
	if (N % 2 == 1){
		for (int i = 0; i < N/2; i++){
			candy_sum += 1 + N;
		}
		candy_sum += N/2 + 1;
	}else{
		for (int i = 0; i < N/2; i++){
			candy_sum += 1 + N;
		}
	}
	cout << candy_sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <numeric> 
#include <vector> 
#include <algorithm>
#include <cstring>
#include <map>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int sz = 1e5 + 10;
int n;

int main() {

    while (cin >> n) {
        int ans = (n / 500 )* 1000;
        n %= 500;
        ans += (n / 5) * 5;
        cout << ans << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
from collections import deque
n = int(input())
a = list(map(int,input().split()))
ans = deque()
for k in range(n):
    if k%2 == 0:
        ans.append(a[k])
    else:
        ans.appendleft(a[k])

if n%2 == 1:
    ans = list(ans)[::-1]
print(*ans)


Measured memory_bytes: 107292
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
ll mod = 1000000007;

int solve(string s, int k) {
	int ans = 0;
	int n = s.size();
	int c = s[0] - '0';
	if (k == 1) {
		if (n == 0) return 0;
		ans += 9 * (n - 1);
		ans += c;
		return ans;
	}
	if (k == 2) {
		if (n <= 1) return 0;
		ans += 81 * (n - 1)*(n - 2) / 2;
		ans += (c - 1)*(n - 1) * 9;
		int pl = n;
		for (int i = 1; i < n; i++) {
			if (s[i] != '0') {
				pl = i;
				break;
			}
		}
		string t = "";
		for (int i = pl; i < n; i++) t += s[i];
		ans += solve(t, 1);
		return ans;
	}
	if (k == 3) {
		if (n <= 2) return 0;
		ans += 729 * (n - 1)*(n - 2)*(n - 3) / 6;
		ans += (c - 1) * 81 * (n - 1)*(n - 2) / 2;
		int pl = n;
		for (int i = 1; i < n; i++) {
			if (s[i] != '0') {
				pl = i;
				break;
			}
		}
		string t = "";
		for (int i = pl; i < n; i++) t += s[i];
		ans += solve(t, 2);
		return ans;
	}
}

int main() {
	string s;
	int k;
	cin >> s >> k;
	cout << solve(s, k) << endl;
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b;
  ans = LINF;
  if (b - a <= 5000) {
    rrep(i, a, b + 1) {
      rrep(j, a, b + 1) {
        if (i >= j) continue;
        ans = min(ans, (i * j) % 2019);
      }
    }
  } else
    ans = 0;
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

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

	int size = s.size() - 2;
	cout << s[0] << size << s[s.size() - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<n-2;i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
    }
    cout<<ans;
    return 0;
}

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl


int main(){
    int n,m,t;
    cin >> n >> m;
    map<int,ll,greater<ll>>map1;
    REP(i,n){
        cin >> t;
        map1[t]++;
    }
    int b,c;
    REP(i,m){
        cin >> b >> c;
        map1[c]+=b;
    }
    ll ans = 0;
    int count=n;
    for(const auto &x:map1){
        ll y = x.first;
        ll z = x.second;
        if(count>=z){
            ans+=y*z;
            count-=z;
        }
        else{
            ans += y*count;
            break;
        }
    }
    COUT(ans);
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  in(int, k);
  out(v[k - 1]);
}


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

int ans[3][3] =
        {
                {1, 2, 3},
                {4, 5, 6},
                {7, 8, 0}
        };
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

bool match(int f[3][3]){
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            if (f[i][j] != ans[i][j])
                return false;
        }
    }
    return true;
}

int dfs(int f[3][3], int x, int y, int v, int d, int l){
    if (match(f))
        return d;
    if (d > l)
        return -1;
    for (int i = 0, res; i < 4; ++i){
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (nx < 0 || nx > 2 || ny < 0 || ny > 2 || (i + 2) % 4 == v)
            continue;
        f[y][x] = f[ny][nx];
        f[ny][nx] = 0;
        if ((res = dfs(f, nx, ny, i, d + 1, l)) > 0)
            return res;
        f[ny][nx] = f[y][x];
        f[y][x] = 0;
    }
    return -1;
}

int main() {
    int f[3][3], x, y;
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            cin >> f[i][j];
            if (f[i][j] == 0){
                y = i;
                x = j;
            }
        }
    }

    int res;
    for (int i = 1; i < 50; i++){
        if ((res = dfs(f, x, y, -1, 0, i)) >= 0){
            break;
        }
    }
    cout << res << endl;

    return 0;
}




Measured memory_bytes: 3088
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n,a,b;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >>a>>b;
    for(int i=1;i<=100000;i++){
        //cout<<i*0.08<<" "<<i*0.1<<"\n";
        if(floor(i*0.08)==a&&floor(i*0.1)==b)return cout<<i<<"\n",0;
    }
    cout<<-1<<"\n";
}


Measured memory_bytes: 256
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = LIST()

ma = mb = 0
for i in range(n):
    if a[i] < b[i]:
        if ( b[i] - a[i] ) % 2 == 0:
            ma += ( b[i] - a[i] ) // 2
        else:
            ma += ( b[i] - a[i] ) // 2 + 1
            mb += 1
    else:
        mb += a[i] - b[i]

if ma >= mb:
    print("Yes")
else:
    print("No")

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

int main() {
  string S, str2;
  int N,M;
  cin>>S;
  N=S.size();
  int a=1;
  for(int i=0;i<N/2;i++)
    if(S.at(i)!=S.at(N-1-i))
      a=0;

  for(int i=0;i<N/4;i++)
    if(S.at(i)!=S.at(N/2-1-i))
      a=0;

  for(int i=(N+3)/2+1;i<N;i++)
    if(S.at(i)!=S.at(N-1-i))
      a=0;
  if(a==1)
  cout <<"Yes" << endl;
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << 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) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  if (n < 1200) {
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n,*a=map(int,open(0).read().split())
s,*l=[0]*100002
for i in a[:n]: s+=i; l[i]+=1
for b,c in zip(*[iter(a[n+1:])]*2): s+=(c-b)*l[b]; l[c]+=l[b]; l[b]=0; print(s)

Measured memory_bytes: 44100
n = int(input())
H = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]  # 最小化問題なのでinfで初期化
dp[0] = 0  # 初期条件
dp[1] = dp[0] + abs(H[1]-H[0])  #　初期条件2

for i in range(2, n):
    dp[i] = min(dp[i], dp[i-1] + abs(H[i]-H[i-1]))
    dp[i] = min(dp[i], dp[i-2] + abs(H[i]-H[i-2]))
print(dp[n-1])

Measured memory_bytes: 13928
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll N;
int tmp,val,maxc;
vi As;
vi colors;

void solve(){
    for(int i = N-1; i >=0; --i){
        val = As[i];
        if(i == N-1){
            colors.push_back(val);
            continue;
        }

        auto itr = upper_bound(colors.begin(), colors.end(), val);
        int id = itr - colors.begin();
        // cout << id << endl;
        if(id == colors.size()) colors.push_back(val);
        else{
            colors[id] = val;
        }
    }

    cout << colors.size() << endl;
}

int main(){
    cin >> N;
    As.resize(N);

    rep(i,N){
        cin >> As[i];
    }

    solve();
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<pair<int,int>>p(n);
    rep(i,n){
        int a,b; cin>>a>>b;
        p[i]=make_pair(a,b);
    }
    sort(p.begin(),p.end());
    ll cnt=0;
    rep(i,n){
        cnt+=p[i].second;
        if(k<=cnt){cout<<p[i].first<<endl; return 0;}
    }
}


Measured memory_bytes: 1024
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for gohyaku in range(A + 1):
    for hyaku in range(B + 1):
        for goju in range(C + 1):
            if gohyaku * 500 + hyaku * 100 + goju * 50 == X:
                ans += 1
print(ans)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int a,b,c=1,d=0,ans=0;
	cin>>a>>b;
	while(c<=b){
		c*=2;
		d++;
	}
	f(i,d){
		int sum=0,x=a,y=b;
		sum+=min((((x-1)/(int)(pow(2,i+1))+1)*pow(2,i+1))-x,pow(2,i));
		x=((x-1)/(int)(pow(2,i+1))+1)*pow(2,i+1);
		sum+=max((int)(0),(int)(y%(int)(pow(2,i+1))-pow(2,i)+1));
		y-=y%(int)(pow(2,i+1));
		if((sum+(y-x)/2)%2) ans+=pow(2,i);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main(){
  int x[3];
  for(int counta = 0;counta<3;counta++){
    cin >> x[counta];
  }
  for(int countb = 0;countb < 2;countb++){
  	for(int counta = 0;counta < 2;counta++){
    	if(x[counta] < x[counta+1]){
      		int i = x[counta];
     	 	x[counta] = x[counta + 1];
     	 	x[counta + 1] = i;
    	}
  	}
  }
  int sum;
  sum = x[0]*10 + x[1] + x[2];
  cout << sum<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

S = input()
T = input()

x = defaultdict(list)
y = defaultdict(list)

for i, t in enumerate(T):
    x[t].append(S[i])

for i, s in enumerate(S):
    y[s].append(T[i])

ok = True
for k, v in x.items():
    a = v[0]
    for c in v:
        if c != a:
            ok = False
            break

for k, v in y.items():
    a = v[0]
    for c in v:
        if c != a:
            ok = False
            break

if ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14056
#include<cstdio>
#include<algorithm>
#define N 2200
#define mod 1000000007
using namespace std;
int f[N][N],s[N],n,k,ans;//设f[i][j]表示已经选取了1~i个位置 最小的那个数是j的方案数 
int main()
{
    scanf("%d%d",&n,&k);f[0][n+1]=1;s[n+1]=1;
    for (int i=n;i>=1;--i) s[i]=s[i+1]+f[0][i];
    for (int i=1;i<=k-1;++i){
        for (int j=1;j<=n-i+1;++j) f[i][j]=s[j];
        s[n+1]=f[i][n+1];for (int j=n;j>=1;--j) s[j]=(s[j+1]+f[i][j])%mod;
    }for (int i=2;i<=n+1;++i) (ans+=f[k-1][i])%=mod;
    for (int i=1;i<=n-k-1;++i) (ans*=2)%=mod;printf("%d",ans);
    return 0;
}

Measured memory_bytes: 18560
import java.util.Map.Entry;
import java.lang.reflect.Method;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayList;

//import org.w3c.dom.css.Counter;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //String S = sc.next();
        int s = Integer.parseInt(sc.next());
        if(s ==1){
            System.out.println(0);
        }else{
            System.out.println(1);
        }
        
    }
}


Measured memory_bytes: 35652
import java.util.Scanner;

public interface Main {
	static int a = 1;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a =new int[n];
		long sum;
		int i, min, max;
		for(i=0; i<n; i++) {
			a[i]= sc.nextInt();
		}
		
		sum = 0;
		min = a[0];
		max = a[0];
		for(i=0; i<n; i++) {
			if(a[i]<min)	min=a[i];
			else if(a[i]>max)	max=a[i];
			sum += a[i];
		}
		System.out.printf("%d %d %d\n", min,max,sum);
	}
}


Measured memory_bytes: 41308
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
using namespace std;
#define INF 100000000
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define rep(i, n) for(int (i)=1; (i)<=(n); (i)++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    int mx, my;
    mx = -101;
    my = 101;
    for(int i=0; i<N; i++){
        int x;
        cin >> x;
        if(x >= mx) mx = x;
    }
    for(int i=0; i<M; i++){
        int y;
        cin >> y;
        if(y <= my) my = y;
    }
    if(mx < my){
        for(int Z=mx+1; Z<=my; Z++){
            if(X < Z && Z <= Y){
                cout << "No War" << endl;
                return 0;
            }
        }
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char S[6]; scanf ("%s", S);
	int c[2] = { 0, };
	for (int i = 0; S[i]; i++) c[S[i] - 'A']++;
	puts(c[0] && c[1] ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int a[200005];
    int k,n;
    cin>>k>>n;
    a[0]=0;
    a[n+1]=k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int ans=a[n]-a[1];
    for(int i=1;i<=n;i++){
        ans=min(ans,k-(a[i+1]-a[i]));
        ans=min(ans,k-(a[i]-a[i-1]));
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(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 (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[root(x)];
    }
};

int N, Q;
int parent[105000];
char Query[105000];
int M[105000];
int IsMarked[105000];
ll ans;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
    cin >> N >> Q;
    if(N == 0) break;
    for(int i = 1; i <= N; i++) {
        IsMarked[i] = 1e9;
    }
    ans = 0;
    for(int i = 2; i <= N; i++) {
        cin >> parent[i];
    }
    IsMarked[1] = true;
    for(int i = 1; i <= Q; i++) {
        cin >> Query[i] >> M[i];
        if(Query[i] == 'M') {
            chmin(IsMarked[M[i]], i);
        }
    }
    UnionFind uni(N + 1);
    for(int i = 1; i <= N; i++) {
        if(IsMarked[i] != 1e9) continue;
        uni.merge(parent[i], i);
    }
    for(int q = Q; q >= 1; q--) {
        if(Query[q] == 'M') {
            if(IsMarked[M[q]] == q) uni.merge(parent[M[q]], M[q]);
            continue;
        } else {
            ans += uni.root(M[q]);
        }
    }
    cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 5724
length = int(input())
str_ls = list(input())
num = length // 2
#print(num)
#print(str_ls)
ls_1 = str_ls[:num]
ls_2 = str_ls[num:]
#print(ls_1)
#print(ls_2)
if length == 1:
    print('No')
elif ls_1 == ls_2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;


int main() {
	int N; cin >> N;
	while (N--) {
		int Y, X; cin >> Y >> X;
		vector<vector<int>>field(Y, vector<int>(X));
		vector<int>chars;
		for (int i = 0; i < Y; ++i) {
			string st; cin >> st;
			for (int j = 0; j < X; ++j) {
				if (st[j] == '.') {
					field[i][j] = 0;
				}
				else {
					field[i][j] = st[j];
					if (find(chars.begin(),chars.end(),st[j]) == chars.end()) {
						chars.push_back(st[j]);
					}
				}
			}
		}
		vector<int>perms(chars.size());
		iota(perms.begin(), perms.end(), 0);
		bool ans = false;
		do {
			bool allok = true;
			vector<vector<int>>nfield(field);
			for (int i = 0; i < perms.size(); ++i) {
				int nc = chars[perms[i]];
				int l = 100;
				int r = 0;
				int u = 100;
				int d = 0;
				for (int j = 0; j < Y; ++j) {
					for (int k = 0; k < X; ++k) {
						if (nfield[j][k] == nc ) {
							l = min(l, k); r = max(r, k);
							u = min(u, j); d = max(d, j);
						}
					}
				}
				bool ok = true;
				for (int j = l; j <=r; ++j) {
					for (int k = u; k <=d; ++k) {
						if (nfield[k][j] == nc || nfield[k][j] == 1000) {
							nfield[k][j] = 1000;
						}
						else {
							ok = false;
						}
					}
				}
				if (!ok) {
					allok = false;
					break;
				}
			}
			if (allok) {
				ans = true;
				break;
			}
		} while (next_permutation(perms.begin(), perms.end()));
		if (ans) {
			cout << "SAFE" << endl;
		}
		else {
			cout << "SUSPICIOUS" << endl;
		}
	}
	return 0;
}

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

long func(long x){
	return x*x;
}

int main(){
	int d;
	while ( scanf(" %d", &d) != EOF ){
		long area=0;
		for(int i=0; i<600/d; ++i)
			area += d*func(i*d);
	
		printf("%ld\n", area);
	}

	return 0;
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define ten(n) ((int)1e##n)
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T> bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
ll ri(){ll l;cin>>l;return l;} string rs(){string s;cin>>s;return s;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
ostream&operator<<(ostream&o,const vb&t){forr(e,t)o<<"#."[e];return o;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";forr(e,t)o<<e<<",";o<<"}"<<endl;return o;}
#ifdef LOCAL
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return v;}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}
#else
#define out(args...)
#endif

void Main() {
  int n = ri();
  vector<int> A(n);
  rep(i, n) A[i] = ri();

  int state = 0;
  int cur = A[0];
  int ans = 1;

  rep(i, 1, n) {
    int a = A[i];
    if (state == 0) {
      state = a - cur;
    }
    else if (state < 0) {
      if (a > cur) {
        ans++;
        state = 0;
      }
    }
    else if (state > 0) {
      if (a < cur) {
        ans++;
        state = 0;
      }
    }
    cur = a;
  }
  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

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

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            auto q = p;
            swap(q[i], q[j]);

            bool ok = true;
            for (int k = 0; k < N-1; ++k) {
                ok = ok && (q[k] <= q[k+1]);
            }

            if (ok) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }

    cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int N, M, K, Q, W, H, R, C;
int dp[110][11000];

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

    cin >> N >> W;
    vector<int> v(N), w(N);
    REP(i, N) cin >> v.at(i) >> w.at(i);

    REP(i, N) {
        REP(j, W + 1) {
            chmax(dp[i + 1][j], dp[i][j]);
            if (j + w[i] <= W) chmax(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
        }
    }
    cout << dp[N][W] << endl;

    return 0;
}



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

const int MAX = 210000;
const int MOD = 1000000007;

void	ComInit(vector<long> &fac, vector<long> &finv, vector<long> &inv) {
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i=2; i<MAX; i++) {
		fac.at(i) = (fac.at(i-1)*i) %MOD;
		inv.at(i) = MOD - (inv.at(MOD%i)*(MOD/i)) %MOD;
		finv.at(i) = (finv.at(i-1)*inv.at(i)) %MOD; 
	}
}

long	COM(int N, int K, vector<long> &fac, vector<long> &finv) {
	if (N<K)
		return 0;
	if ((N<0)||(K<0))
		return 0;
	return (fac.at(N) * ((finv.at(K)*finv.at(N-K)) %MOD)) %MOD;
}

int	main() {
	// Array
	vector<long> fac(MAX);
	vector<long> finv(MAX);
	vector<long> inv(MAX);
	// Initialize
	ComInit(fac, finv, inv);

	long H, W, A, B;
	cin >>H >>W >>A >>B;

	long S=0;
	int h=H-A;
	int w=B+1;
	while ((h>0)&&(w<=W)) {
		long SS=COM(h+w-2, h-1, fac, finv)*COM(H+W-h-w, H-h, fac, finv);
		SS %=MOD;
		S += SS;
		S %=MOD;
		h--;
		w++;
	}
	cout <<S <<endl;
	return 0;
};


Measured memory_bytes: 5120
import java.util.*;

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

        String S = sc.next();

        if (S.contains("A") && S.contains("B")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

}


Measured memory_bytes: 22612
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ

int main(){
	int a,b;scanf("%d%d",&a,&b);
	printf("%d\n",max(0,a-b-b));
}

Measured memory_bytes: 128
//gauravsinghh
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 1000005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

bool comp(const pair < ll, ll >&a, const pair < ll, ll >&b){
    return ((a.ss < b.ss) || (a.ss == b.ss && a.ff < b.ff));
}

signed main(){ 
    IOS
    //io_set();
    // ll tt;
    // w(tt){

    // }
    ll l, r, m = INT_MAX;
    cin >> l >> r;
    if(l%2019 == 0 || r%2019 == 0){
        cout << 0 << endl;
        return 0;
    }
    else{
        ll y = r/2019;
        ll z = (l-1)/2019;
        if((y-z) == 0){
            fo(i, l, r){
                fo(j, i+1, r){
                    ll x = (i%2019 * j%2019)%2019;
                    m = min(m, x);
                }
            }
            cout << m << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define in insert
#define pb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 0x3f3f3f3f3f3f3f3fll;
#define mod 1000000007


int main()
{
FIO

    ll x[6];
    FOR(5) 
    {
        cin >> x[i];
        if(x[i] == 0)
        {
            cout << i;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main(){
  int a;
  int b;
  cin>>a;
  cin>>b;
  if(a<b){
    cout<<"a < b"<<endl;
  }else if(a==b){
    cout<<"a == b"<<endl;
  }else{
    cout<<"a > b"<<endl;
  }
}

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

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

    string s;
    cin >> s;

    vector<string> A;
    A.push_back("AKIHABARA");
    A.push_back("KIHABARA");
    A.push_back("AKIHBARA");
    A.push_back("AKIHABRA");
    A.push_back("AKIHABAR");
    A.push_back("KIHBARA");
    A.push_back("AKIHBRA");
    A.push_back("AKIHABR");
    A.push_back("KIHABAR");
    A.push_back("KIHABRA");
    A.push_back("AKIHBAR");
    A.push_back("KIHBRA");
    A.push_back("AKIHBR");
    A.push_back("KIHABR");
    A.push_back("KIHBAR");
    A.push_back("KIHBR");
    
    REP(i, A.size()){
        if(A[i] == s){
            cout << "YES" << endl; 
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	int a;
	int b;
	int c;
	int x;
	int y;
	cin >> a >> b >> c >> x >> y;

	int ans = a * x + b * y;
	int ubound = 2 * max(x, y);
	int s;
	int t;
	int u;
	int cand;
	for (u = 0; u <= ubound; u++) {
		s = max((int)ceil(x - (double)u / 2.0), 0);
		t = max((int)ceil(y - (double)u / 2.0), 0);
		cand = s * a + t * b + u * c;
		if (cand < ans) {
			ans = cand;
		} 
	}

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 3648