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

int main() {
  int N,t0,t1,t2,t3;
  cin >> N;

  t0=N/1000;
  t1=(N-1000*t0)/100;
  t2=(N-1000*t0-100*t1)/10;
  t3=(N-1000*t0-100*t1-10*t2);
    
  
  
  if (t1==t0){
    if(t2 == t1){
      cout << "Yes" << endl;
    }
    else{
      cout<< "No" << endl;
    }
  }
  else{
  	if(t1==t2){
    	if(t2==t3){
        	cout << "Yes" << endl;
        }
      	else{
        	cout << "No" << endl;
        }
    }
    else{
    	cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
// chctxdy
int main(){
	ll k, q; cin >> k >> q;
	vll d(k); for (ll i = 0; i < k; i++) cin >> d[i];
	while (q--){
		ll n, x, m; cin >> n >> x >> m; x %= m;
		ll c = 0;
		vll dd(k); 
		for (ll i = 0; i < k; i++){
			dd[i] = d[i] % m; 
			if (dd[i] == 0) dd[i] = m;
			c += dd[i];
		}
		ll s = x; s += c * ((n - 1) / k); 
		for (ll i = 0; i < (n - 1) % k; i++) s += dd[i];
		cout << n - 1 - s / m << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
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 f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/

vector<vector<int>> poss;
int k;
void dfs(int i, vector<int> v){
	if(i == k){
		poss.pb(v);
		return;
	}
	rep(j,1,4){
		v.pb(j);
		dfs(i+1, v);
		v.ppb();
	}
}

signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int a,b,c;
		cin >> a >> b >> c;
		cin >> k;
		dfs(0,{});
		for(auto j : poss){
			int ta = a, tb = b, tc = c;
			for(auto k : j){
				if(k == 1) ta *= 2;
				if(k == 2) tb *= 2;
				if(k == 3) tc *= 2;
				if(ta < tb and tb < tc){
					cout << "Yes" << endl;
					goto ou;
				}
			}
		}
		cout << "No" << endl;
		ou:;
	}
}

Measured memory_bytes: 3840
import sys
from collections import deque

input = sys.stdin.readline
N, M = map(int, input().split())

edges = [[] for _ in range(N)]
edge_set = set()
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

    edge_set.add((a, b))

ans = 0
for a, b in edge_set:
    q = deque()
    q.append(0)
    visited = set()
    while q:
        p = q.popleft()
        if p in visited:
            continue
        visited.add(p)
        for np in edges[p]:
            if (p, np) == (a, b) or (np, p) == (a, b):
                continue
            q.append(np)
    if len(visited) != N:
        ans += 1

print(ans)

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n;
vll s;

lli query(lli x){
  cout << x << endl << flush;
  string s;
  cin >> s;
  if(s == "Male") return 1;
  if(s == "Female") return 2;
  if(s == "Vacant"){
    exit(0);
  }
}

int main(){
  cin >> n;
  s = vll(n+1);
  s[0] = s[n] = query(0);
  lli from,to;
  from = 0;
  to = n;
  for(lli i = 0;i < 20;i++){
    lli x = (from+to)/2;
    s[x] = query(x);
    if(s[x] == s[from] && (x-from)%2 == 0 || s[x] != s[from] && (x-from)%2 != 0){
      from = x;
    }else{
      to = x;
    }
  }
}


Measured memory_bytes: 1620
#include <iostream>
#include <locale>
#include <string>

using namespace std;

int main() {
	string str1 = "abcdefghijklmnopqrstuvwxyz";
	string str2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string str3 = str1 + str2 + str1;
	string s,o;
	
	getline(cin, s);
	
	o = "";
	for(int i=0; i < s.size(); i++) {
		char c = s[i];
		if (isalpha(static_cast<unsigned char>(c))) {
			o += str3.substr(str3.find(c) + 26,1);
		} 
		else {
			o += c;
		}
	}			
	cout << o << endl;
	
	return 0;
}


Measured memory_bytes: 3220
#include <vector>
#include <iostream>
using namespace std;
 
int main(int argc, const char * argv[]) {
    int total;
    cin >> total;
    
    vector<int> rabbits;
    int r;
    int count = 0;
    
    for (int i = 0; i < total; i++) {
        cin >> r;
        rabbits.push_back(r);
    }
    
    for (int i = 0; i < total; i++) {
        if (rabbits[rabbits[i]-1] == i+1) {
            count++;
        }
    }
    
    cout << count/2 << "\n";
    
    return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
 
int main() {
 
int al[30] = {0};
char b[2000]= {0};
int i,j,n;
 
i=0;
 
while( scanf("%c",&b[i]) != EOF) {
 
if (b[i] >= 'A' && 'Z' >= b[i] ) {
n = b[i] - 'A';
al[n] += 1;
 
} else if(b[i] >=  'a' && b[i] <= 'z' ) {
n = b[i] - 'a';
al[n] += 1;
}
i=i+1;
}
 
for(j=97; j<=122; j++) {
n = j - 'a';
printf("%c : %d\n",j,al[n]);
}
 
return 0;
 
}


Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
#define sc scanf
#define pr printf
#define pb push_back
#define ll long long int
int main()
{
    string s;
    while(cin>>s)
    {
        if(s[0]=='S')
        cout<<"Cloudy"<<endl;
    if(s[0]=='C')
        cout<<"Rainy"<<endl;
    if(s[0]=='R')
        cout<<"Sunny"<<endl;
    }

    return 0;
}

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

int main(){
	int a,b,c;
	int ans;
	
	string cunning="7767555555555555555555555555555555555555545555555555555555555555555555555555555555555555555555555555";
	
	for(int i=0;i<104;i++){
		cin>>a>>b;c=a+b;
		//-----test-----
		if(i<cunning.size()){
			cout<<cunning[i]<<endl;
			continue;
		}
		//--------------
		ans=1;
		while(10<=c){
			c/=10;
			ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1208
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int A[3];
	FOR(i,0,3) cin >> A[i];
	sort(A, A + 3);
	
	string ans = "NO";
	if (A[0] == 5 && A[1] == 5 && A[2] == 7) ans = "YES";

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int n;
  scanf("%d",&n);
  long a[n];
  for(int i=0;i<n;i++){
	scanf("%ld",&a[i]);
  }
  
  for(int i=n-1;i>0;i--){
	if(a[i-1]-a[i]>=2){
      printf("No");
      return 0;
    }
    if(a[i-1]-a[i]==1){
      a[i-1]--;
    }
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<map>
#include<algorithm>
std::map<int,int>g;
int i,j,n,m,s[100001],f[100001];
int cal(int i,int j)
{
	if(f[i]==f[j])return f[i];
	if(f[i]>f[j])std::swap(i,j);
	return f[i]+std::min(f[j]-f[i]>>1,s[j]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;++i)
	{
		scanf("%d",&j),++f[j%m];
		if(!(++g[j]&1))++s[j%m];
	}
	for(j=0,i=1;i+i<m;++i)
		j+=cal(i,m-i);
	if(m%2==0)j+=f[m/2]>>1;
	printf("%d",j+*f/2);
}

Measured memory_bytes: 5248
n,m,x = map(int,input().split())
numbers = list(map(int,input().split()))
y = x
z = x
x0 = 0
xn = 0
for i in range (0,x):
  y -= 1
  if y in numbers:
    x0 += 1
  else:
    continue
for j in range(x,n):
  z += 1
  if z in numbers:
    xn += 1
  else:
    continue
print(min(x0,xn))
#print(n,m,x)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll a;
  string s;
  cin >> s;
  a=s.length();
  rep(i,a-8)cout << s[i];
}

Measured memory_bytes: 256
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans = 909
elif m == 5:
    ans -= 10000
    ans += 1
    ans += 909
elif m == 6:
    ans = 90909
print(ans)

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin>>s;
  char c[100005];
  if(s[0]=='0'){
      for(long long int i=0;i<s.length();i++){
        if(i%2==0){
          c[i]='0';
        }else{
          c[i]='1';
        }
      }
  }else{
    for(long long int i=0;i<s.length();i++){
      if(i%2==0){
        c[i]='1';
      }else{
        c[i]='0';
      }
    }
  }
  int f=0;
  for(int i=0;i<s.length();i++){
    if(s[i]!=c[i]){
      f++;
    }
  }
  cout<<f;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
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...));
}
struct modint {
    ll x;
    modint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    ll value() const {
        return x;
    }
    modint operator-() const {
        return modint(-x);
    }
    modint& operator+=(const modint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator-=(const modint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator*=(const modint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    modint operator+(const modint a) const {
        modint res(*this);
        return res += a;
    }
    modint operator-(const modint a) const {
        modint res(*this);
        return res -= a;
    }
    modint operator*(const modint a) const {
        modint res(*this);
        return res *= a;
    }
    modint pow(ll t) const {
        if (t == 0) return 1;
        modint a = pow(t >> 1);
        a *= a;
        if (t % 2 == 1) a *= *this;
        return a;
    }
    modint inv() const {
        return pow(MOD - 2);
    }
    modint& operator/=(const modint a) {
        return (*this) *= a.inv();
    }
    modint operator/(const modint a) const {
        modint res(*this);
        return res /= a;
    }
};
struct combination {
    vector<modint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; i--) {
            ifact[i - 1] = ifact[i] * i;
        }
    }
    modint operator()(int n, int k) {
        if (n < k || k < 0) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    modint h(int n, int k) {
        n += k - 1;
        if (k < 0 || k > n) return  modint(0);
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(2002002);
int main() {
    ll n, k;
    cin >> n >> k;
    chmin(k, n);
    modint ans = 0;
    for(int i = 0; i <=k; i++) {
        int x=n-i;
        ans += modint(comb(n, i) * comb.h(x, n-x));
    }
    cout<<ans.value()<<endl;
}


Measured memory_bytes: 31488
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

vector<int> adj[500];
bool color[500];
int d[500];

int bfs(int start, int size) {
  for (int i = 0; i < size; i++) {
    color[i] = false;
    d[i] = -1;
  }

  queue<int> bfsQueue;
  bfsQueue.push(start);
  color[start] = true;
  d[start] = 0;

  while (bfsQueue.size() > 0) {
    int u = bfsQueue.front();
    bfsQueue.pop();

    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i];
      if (!color[v]) {
        color[v] = true;
        d[v] = d[u] + 1;
        bfsQueue.push(v);
      }
    }
  }

  int maxD = -1;
  int maxDid = -1;

  for (int i = 0; i < size; i++) {
    if (d[i] > maxD) {
      maxD = d[i];
      maxDid = i;
    }
  }

  return maxDid;
}

int main() {
  int H, W;
  cin >> H >> W;

  string S[H];
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }

  int firstV = -1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int v = i * W + j;

      if (S[i][j] == '.') {
        if (firstV == -1) {
          firstV = v;
        }
        if (i - 1 >= 0 && S[i - 1][j] == '.') {
          adj[v].push_back((i - 1) * W + j);
        }
        if (i + 1 < H && S[i + 1][j] == '.') {
          adj[v].push_back((i + 1) * W + j);
        }
        if (j - 1 >= 0 && S[i][j - 1] == '.') {
          adj[v].push_back(i * W + j - 1);
        }
        if (j + 1 < W && S[i][j + 1] == '.') {
          adj[v].push_back(i * W + j + 1);
        }
      }
    }
  }

  // for (int i = 0; i < H * W; i++) {
  //   cout << i << ": " << adj[i] << endl;
  // }

  int ans = -1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int v = i * W + j;

      if (S[i][j] == '.') {
        int a = bfs(v, H * W);
        // cout << v << ": " << a << " " << d[a] << endl;
        if (ans == -1 || ans < d[a]) {
          ans = d[a];
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main()
{
	int l, n;
	cin >> n >> l;
	string s[n];
	for (int i = 0; i < n; i++) cin >> s[i];
	sort(s, s + n);
	for (int i = 0; i < n; i++) cout << s[i];
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
<?php

    // 末尾に改行をつけて出力
    function output($str) {
        echo $str . PHP_EOL;
    }

    list($a, $b, $m) = explode(' ', trim(fgets(STDIN)));

    $price_reizo = explode(' ', trim(fgets(STDIN)));
    $price_densi = explode(' ', trim(fgets(STDIN)));
    $price_reizo = array_map('intval', $price_reizo);
    $price_densi = array_map('intval', $price_densi);

    $coupon = [];
    while ($line = trim(fgets(STDIN))) {
        $coupon[] = explode(' ', $line);
    }

    $min = 1000000;
    for ($i = 0; $i < $m; $i++) {
        $c = $coupon[$i];
        $price = $price_reizo[$c[0] - 1] + $price_densi[$c[1] - 1] - $c[2];
        if ($price < $min) {
            $min = $price;
        }
    }

    $price = min($price_reizo) + min($price_densi);
    if ($price < $min) {
        $min = $price;
    }

    output($min);


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

int main() {
  string s;
  cin >> s;
  int x = 10*(s[5] - '0') + s[6] - '0';
  if (x <= 4) {
    cout << "Heisei" << endl;
  }
  else {
    cout << "TBD" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b;
	cin>>a>>b;
	if(a==b){
		cout << 0;
		return 0;
	}
	else{
		if((a+b)%2==0){
			cout << (a+b)/2;
		}
		else{
			cout << "IMPOSSIBLE";
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    long ans = 0;
    sort(a,a+n,greater<long>());
    ans += a[0];
    for(int i=2;i<n;i++){
        ans += a[i/2];
    }
    cout << ans << endl;
}

Measured memory_bytes: 5212
#include<bits/stdc++.h>
using namespace std;
const int N=6;
int n,m,s[N],c[N]; 
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)cin>>s[i]>>c[i];
    for(int i=0;i<1000;i++){
        string t=to_string(i);
        if(t.size()==n){
            int j;for(j=1;j<=m;j++)if(t[s[j]-1]!=c[j]+'0')break;
            if(j==m+1){cout<<i<<endl;return 0;}
        }
    }
    return cout<<-1,0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, H;
    cin >> N >> H;
    vector<int> a(N), b(N);
    rep(i,N) cin >> a[i] >> b[i];

    sort(a.begin(), a.end(), greater<int>());
    sort(b.begin(), b.end(), greater<int>());

    int i = 0;
    int count = 0;
    while (H > 0) {
        count++;
        if (i >= N || a[0] > b[i]) H -= a[0];
        else {
            H -= b[i];
            i++;
        }
    }

    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 1024
N = input()
n = int(N)
l = len(N)
k = int(input())
ans = 0
tmp = 0
def c(x,y):
  z = 1
  for w in range(y):
    z *= x - w
    z /= y - w
  return z
#print(c(5,2))
for i in range(l):
  for d in range(10):
    if d < int(N[i]):
      if d == 0 and k - tmp >= 0:
        now = c(l-1-i,k-tmp) * 9**(k-tmp)
        ans += now
        #print(i,d,now,l-1-i,k-tmp)
      elif k - tmp - 1 >= 0:
        now =  c(l-1-i,k-tmp-1) * 9**(k-tmp-1)
        ans += now
        #print(i,d,now,l-1-i,k-tmp-1)
    elif d == int(N[i]):
      if d != 0:
        tmp += 1
if k == tmp:
  ans += 1
print(int(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

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

	int s = 0;
	int ret = -1;
	int d = INF;

	for (int i = 0; i < N; i++) {
		s += v[i];
		int t = sum - s;
		if (d > abs(s - t)) {
			d = abs(s - t);
		}
	}

	cout << d << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  char a; cin >> a;
  if(a>='a' && a<='z') cout << 'a' << endl;
  else cout << 'A' << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
#define pb push_back;
#define sz(v) ((int)(v).size())
#define ll long long;
int main()
{
    int a;
    cin>>a;
    int x[111];
    int ans=0;
    for(int i=0;i<a;i++)
    {
        cin>>x[i];
        ans+=x[i];
    }
    sort(x,x+a);
    if(ans%10==0)
    {
        for(int i=0;i<a-1;i++)
        {
                if((ans-x[i])%10!=0)
                {
                                cout<<ans-x[i]<<endl;
                                return 0;
                }
        }
        cout<<"0"<<endl;
    }
    else
    {
        cout<<ans<<endl;
    }
    return 0;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  string s;
  cin>>s;
  int l=s.length()+1;
  string rvs=s;
  reverse(rvs.begin(),rvs.end());
  /*
  if(l==3){
    if(s==rvs){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    return 0;
  }
  */
  if(s==rvs){
    s=s.substr(l/2);
    string ss=s;
    reverse(ss.begin(),ss.end());
    if(s==ss){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}


Measured memory_bytes: 256
(let ((s1 (car (concatenate 'list (symbol-name (read)))))
      (s2 (car (concatenate 'list (symbol-name (read)))))
      (s3 (car (concatenate 'list (symbol-name (read))))))

  (format t "~{~A~}~%"
          (append (list s1) (list s2) (list s3))))



Measured memory_bytes: 10468
#include<cstdio>

int main(){
    int N;
    scanf("%d", &N);
    
    char S[N][10];
    long long m=0,a=0,r=0,c=0,h=0;
    for(int i=0;i<N;i++){
        scanf("%s",S[i]);

        switch(S[i][0]){
            case 'M':
                m++;
                break;
            case 'A':
                a++;
                break;
            case 'R':
                r++;
                break;
            case 'C':
                c++;
                break;
            case 'H':
                h++;
                break;
            default:
                break;
        }
    }

    long long ans;
    ans = m*a*r +  m*a*c + m*a*h + m*r*c + m*r*h 
        + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h;

    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1152
use std::io;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeMap;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn prime_factors(n: u64) -> HashMap<u64, u64> {
    let mut n = n; 
    let mut prime_numbers: HashMap<u64, u64> = HashMap::new();
    let mut candidate = 2;

    while n > 1 {
        while n % candidate == 0 {
            let val = prime_numbers.entry(candidate).or_insert(0);
            *val += 1;
            n /= candidate;
        }
        candidate += 1;
    }
    return prime_numbers;
}

fn main() {
    let n: u64 = input();
    let mut factors: BTreeMap<u64, u64> = BTreeMap::new();
    for i in 1..(n+1) {
        // println!("{:?}", prime_factors(i));
        for (k, v) in prime_factors(i) {
            let num = factors.entry(k).or_insert(0);
            *num += v;
        }
    }
    let mut count = 0;
    let entries: Vec<_> = factors.iter().collect();
    for entry in &entries {
        if *entry.1 + 1 >= 75 {
            count += 1;
        } else {
            break;
        }
    }
    if entries.len() < 1 {
        println!("{}", count);
        return;
    }
    for i in 0..entries.len()-1 {
        for j in (i+1)..entries.len() {
            if entries[i].1 + 1 >= 25 && entries[j].1 + 1 >= 3 {
                count += 1;
            }
            if entries[i].1 + 1 >= 15 && entries[j].1 + 1 >= 5 {
                count += 1;
            }
            if entries[j].1 + 1 >= 25 && entries[i].1 + 1 >= 3 {
                count += 1;
            }
            if entries[j].1 + 1 >= 15 && entries[i].1 + 1 >= 5 {
                count += 1;
            }
        }
    }
    if entries.len() < 2 {
        println!("{}", count);
        return;
    }
    for i in 0..entries.len()-2 {
        for j in (i+1)..entries.len()-1 {
            for k in (j+1)..entries.len() {
                if entries[i].1 + 1 >= 5 && entries[j].1 + 1 >= 5 && entries[k].1 + 1 >= 3 {
                    // println!("{:?}, {:?}, {:?}", entries[i], entries[j], entries[k]);
                    count += 1;
                }
                if entries[j].1 + 1 >= 5 && entries[k].1 + 1 >= 5 && entries[i].1 + 1 >= 3 {
                    // println!("{:?}, {:?}, {:?}", entries[i], entries[j], entries[k]);
                    count += 1;
                }
                if entries[k].1 + 1 >= 5 && entries[i].1 + 1 >= 5 && entries[j].1 + 1 >= 3 {
                    // println!("{:?}, {:?}, {:?}", entries[i], entries[j], entries[k]);
                    count += 1;
                }
            }
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2192
#include<bits/stdc++.h>
#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,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int n;
    cin >> n;
    int a[n],b[n],c[n];
    REP(i,n){
        cin >> a[i];
        a[i]--;
    }
    REP(i,n)cin >> b[i];
    REP(i,n-1)cin >> c[i];
    int ans=0;
    REP(i,n){
        ans+=b[a[i]];
        if(a[i-1]+1==a[i]) ans+=c[a[i-1]];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3604
N,Y = map(int, input().split())

for j in range(N+1):
    for i in range(N+1):
        sum = 10000*j + 5000*i + 1000*(N-i-j)
        if(sum==Y and N-i-j>=0):
            print(j,i,N-i-j)
            exit()
            
print('-1 -1 -1')

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

long long kMod = 998244353;

class Node {
  public:
    int id;
    int d;
    Node() {}
};

bool has_smaller_d(const Node& a, const Node& b) {
  return a.d < b.d;
}

long long doubling_power(long long a, long long x) {
  long long bit = 1;
  long long res = 1;
  while (bit <= x) {
    if (x & bit) {
      res *= a;
      res %= kMod;
    }
    bit = bit << 1;
    a = a * a;
    a %= kMod;
  }
  return res;
}

int main()
{
  int n;
  cin >> n;
  vector<int> m(n+1);
  for (int i = 1; i <= n; i++) {
    int d;
    cin >> d;
    if (i == 1 && d != 0) {
      cout << "0\n";
      return 0;
    }
    if (i != 1 && d == 0) {
      cout << "0\n";
      return 0;
    }
    if ((int)m.size() <= d) {
      cout << "0\n";
      return 0;
    }
    m.at(d)++;
  }
  long long pre = m.at(1);
  long long res;
  if (pre != 0 && m.at(0) == 1) {
    res = 1;
  } else {
    res = 0;
  }
  int cnt = m.at(0) + m.at(1);
  for (int i = 2; i < (int)m.size(); i++) {
    res = res * doubling_power(pre, m.at(i));
    res = res % kMod;
    pre = m.at(i);
    cnt += m.at(i);
    if (cnt == n) {
      break;
    }
  }
  cout << res << '\n';

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
   string s;
   int ans=10000;
   cin>>s;
   int n=s.size();
   rep(i,n-2){
   if(abs(ans-753)>abs(stoi(s.substr(i,3))-753)){
        ans=stoi(s.substr(i,3));
                }
   }
   cout<<abs(ans-753)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	string Atcoder, input, Contest;
	cin >> Atcoder >> input >> Contest;
	cout << "A" << input[0] << "C" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int x[101],i=1;
  char s[100];
  
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      x[i-2]=x[i-2]+ x[i-1];
      i=i-2;
    } else if ( s[0] == '-' ){
      x[i-2]=x[i-2]- x[i-1];
      i=i-2;
    } else if ( s[0] == '*' ){
      x[i-2]=x[i-2]* x[i-1];
      i=i-2;
    } else {
      x[i] = atoi(s);
    }
    i++;
  }
  printf("%d\n", x[1]);
  
  return 0;
}

Measured memory_bytes: 548
import math
def cc(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = tuple(int(i) for i in input().split())

n = int(N/K)
c1 = n**3

k_2 = K/2

if N < k_2:
    print(0)
elif K%2 != 0:
    print(c1)
else:

    if N < n*K + k_2:
        c2 = n**3
    else:
        c2 = (n+1)**3
    print(c1 + c2)

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-------------------------------------------------

string s;

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

	cin >> s;
	int ans = 0;
	REP(i, 4) ans = (s[i] == '+' ? ans + 1: ans - 1);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
s = input()
n = len(s)
mod = 10**9+7

a = [0]*n
b = [0]*n
c = [0]*n
d = [0]*n

x = 0
y = 0
for i in range(n):
    a[i] = x
    b[i] = y
    if s[i] == 'A':
        x += 1
    elif s[i] == '?':
        y += 1

x = 0
y = 0
for i in range(n-1,-1,-1):
    c[i] = x
    d[i] = y
    if s[i] == 'C':
        x += 1
    elif s[i] == '?':
        y += 1

def f(A,B,C,D):
    if B+D == 0:
        return pow(3,B+D,mod)*A*C%mod
    if B+D == 1:
        return pow(3,B+D,mod)*A*C%mod + pow(3,B+D-1,mod)*B*C%mod + pow(3,B+D-1,mod)*A*D%mod

    return pow(3,B+D,mod)*A*C%mod + pow(3,B+D-1,mod)*B*C%mod + pow(3,B+D-1,mod)*A*D%mod + pow(3,B+D-2,mod)*B*D%mod

res = 0
for i in range(1,n-1):
    if s[i] == 'B' or s[i]=='?':
        res = (res+f(a[i],b[i],c[i],d[i]))%mod
print(res%mod)

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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int a[101] = {};
  rep(i, 0, 12) {
    int b;
    cin >> b;
    a[b]++;
  }
  int f = 0;
  rep(i, 0, 100) if(a[i] % 2 == 1) f = 1;
  cout << (f ? "no" : "yes") << endl;
}

Measured memory_bytes: 3196
#include <stdio.h>
int main(void){   
   int S,h,m,s;
   scanf("%d",&S);
   
   s=S%60;
   m=S/60%60;
   h=S/3600;
   
   printf("%d:%d:%d\n", h, m, s);
   
   return 0;
}


Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
const int MOD = 1e9+7;
long long n,a[N],s[N];
long long res=0;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
		s[i]%=MOD;
	} 
	for(int i=1;i<=n;i++){
		res+=1LL*a[i]*(s[n]-s[i]+MOD)%MOD;
		res%=MOD;
	}
	printf("%lld\n",res);
}

Measured memory_bytes: 6828
#include <stdio.h>
#include <math.h>
 
int main(){
  int N, K;
  scanf("%d %d", &N, &K);
  int h[N], i, ans = 0;
  for(i=0; i<N; i++){
    scanf("%d", &h[i]);
    if (h[i] >= K) ans++;
  }

  printf("%d", ans);

  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<bits/stdc++.h>
#define lli long long
#define fin  freopen("input.txt","r",stdin);
#define fout freopen("output.txt","w",stdout);
#define ini(a) scanf("%d",&a);
#define ini2(a,b) scanf("%d%d",&a,&b);
#define inl(a) scanf("%lld",&a);
#define inl2(a,b) scanf("%lld%lld",&a,&b);
#define all(a) a.begin(),a.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SIZE 200010
#define PI 3.14159265358979
using namespace std;


int main()
{

   double a,b,c,d;
   cin>>a>>b>>c>>d;

   double dega=c*30+((d/60)*30);
   double degb=d*6;
   double kon=abs(dega-degb);
   //if(kon>=180)kon-=180;
  // cout <<kon<<endl;
   double ans=a*a+b*b-2.00*a*b*cos((kon*PI)/180.00);
   printf("%.9f",sqrt(ans));
}



Measured memory_bytes: 4212
import heapq
import math
N, M =map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(a)


for i in range(M):
  tmp_min = heapq.heappop(a)
  heapq.heappush(a,math.ceil(tmp_min/2))
  
  
print(-sum(a))
  

Measured memory_bytes: 14532
#include<iostream>
using namespace std;
int main(){
  long long int n;
  cin>>n;
  long long int a[n],ka[100000];
  for(long long i=0;i<=100000;i++){
      ka[i]=0;
  }
  
  long long int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    ka[a[i]]++;
    sum+=a[i];
  }
  long long int q;
  cin>>q;
  for(int i=0;i<q;i++){
    long long int b,c;
    cin>>b>>c;
    long long int s=ka[b];
    ka[b]=0;
    sum=sum-s*b;
    sum+=c*s;
    cout<<sum<<endl;
    ka[c]+=s;
  }
  return 0;
}


Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
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; }

const ll MAX_S = 1000000;
int D;

vector<ll> cvec(26, 0);
vector< vector<ll> > smap(365, vector<ll>(26, 0));
vector<int> lastvec(26, 0);

ll Scalc(int today, int no, ll now) {
    // その日のコンテストの満足度
    now += smap.at(today).at(no);
    // コンテストが行われた記録
    lastvec.at(no) = (today+1);
    // 行われなかったコンテストへの不満
    for(int i = 0; i < 26; ++i) {
        now -= (cvec.at(i)*((today+1) - lastvec.at(i)));
    }
    return now;
}

struct sdata {
    ll sss; int no;
    bool operator<(const sdata &r) const { return sss > r.sss; }
};

int main() {
    cin >> D;
    for(int i = 0; i < 26; ++i) cin >> cvec.at(i);
    for(int i = 0; i < D; ++i) {
        for(int j = 0; j < 26; ++j) {
            cin >> smap.at(i).at(j);
        }
    }

    vector<int> tvec(D, 0);
    for(int i = 0; i < D; ++i) {
        // その日の満足度No.1を選ぶやり方
        vector<sdata> svec(26);
        for(int j = 0; j < 26; ++j) {
            sdata mkdata;
            mkdata.sss = smap.at(i).at(j);
            mkdata.no = j;
            svec.at(j) = mkdata;
        }
        sort(svec.begin(), svec.end());
        tvec.at(i) = svec.at(0).no + 1;
    }
    
    for(int i = 0; i < D; ++i) {
        cout << tvec.at(i) << endl;
    }
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    map<int,int> fmp, smp;
    rep(i,n){
        if(i%2==0) fmp[p[i]]++;
        else smp[p[i]]++;
    }
    int a=0, b=0,checka, checkb;
    for(auto& v :fmp){
        if(a<v.second){
            a=v.second;
            checka=v.first;
        }
    }
    for(auto& v : smp){
        if(b<v.second){
            b=v.second;
            checkb=v.first;
        }
    }
    if(checka!=checkb){
        cout<<n-a-b<<endl;
        return 0;
    }
    int c=0,d=0;
    for(auto& v: fmp){
        if(v.first==checka) continue;
        c=max(c,v.second);
    }
    for(auto& v: smp){
        if(v.first==checkb) continue;
        d=max(d,v.second);
    }
    int an=max(a+d, c+b);
    cout<<n-an<<endl;
    return 0;
}

Measured memory_bytes: 5376
program prob003
  implicit none
  integer i,j,k,ans
  character(len=100) str
  read(*,'(a)') str
  ans=0
  do i=1,len(trim(str))
     k=0
     do j=i,len(trim(str))
        if(str(j:j)=='A'.or.str(j:j)=='C'.or.str(j:j)=='G'.or.str(j:j)=='T') then
           k=k+1
        else
           exit
        end if
     end do
     ans=max(ans,k)
  end do
  print*, ans
end program prob003

Measured memory_bytes: 2948
N, Q = map(int,input().split())
s = list(input())

count=[]
num=0
count.append(num)
for i in range(len(s)-1):
	if s[i] == "A" and s[i+1] == "C":
		num=num+1
		count.append(num)
	else:
		count.append(num)

for i in range(Q):
	l, r = map(int,input().split())
	print(count[r-1]-count[l-1])





Measured memory_bytes: 6876
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

        Map<Integer, Boolean> S = new HashMap<>();
        Map<Integer, Boolean> H = new HashMap<>();
        Map<Integer, Boolean> C = new HashMap<>();
        Map<Integer, Boolean> D = new HashMap<>();

        for (int i = 0 ; i < 13; i++) {
            S.put(i, false);
            H.put(i, false);
            C.put(i, false);
            D.put(i, false);
        }

        int N = Integer.parseInt(sc.next());

        for (int i = 0; i < N; i++) {
            String m = sc.next();
            int n = Integer.parseInt(sc.next());

            switch (m) {
                case "S":
                    S.put(n-1, true);
                    break;
                case "H":
                    H.put(n-1, true);
                    break;
                case "C":
                    C.put(n-1, true);
                    break;
                case "D":
                    D.put(n-1, true);
                    break;
            }
        }

        S.forEach((integer, aBoolean) -> {if (!aBoolean) System.out.printf("S %d\n", integer+1);});
        H.forEach((integer, aBoolean) -> {if (!aBoolean) System.out.printf("H %d\n", integer+1);});
        C.forEach((integer, aBoolean) -> {if (!aBoolean) System.out.printf("C %d\n", integer+1);});
        D.forEach((integer, aBoolean) -> {if (!aBoolean) System.out.printf("D %d\n", integer+1);});
    }
}

Measured memory_bytes: 31636
#include <bits/stdc++.h>
#define eps 1e-9
#define nmax 200
#define f(c,a,b) for(int c=a; c<=b; c++)
#define pi acos(-1)

using namespace std;
typedef double db;
struct P{
    db x, y;
    P operator - (P a){ return (P){x-a.x, y-a.y}; }
    db dot(P a){ return a.x*x + a.y*y; }
    P operator * (db a) { return (P){a*x, a*y}; }
    P operator + (P a){ return (P){x+a.x, y+a.y}; }
    P operator / (db a) { return (P) {x/a, y/a}; }
    db times(P a){ return x*a.y-y*a.x; }
    db le() { return sqrt( x*x+y*y ); }
    db le2() { return x*x+y*y; }
    P rot90(){ return (P){-y,x}; }
    db rad(P a) { return atan2(times(a),dot(a)); }
    void pri(){ printf("%.10lf %.10lf\n", x, y); }
    void swap(P& a){
        db tx = x, ty = y;
        x = a.x;  y = a.y;
        a.x = tx; a.y = ty;
    }
    bool operator < (const P a) const { return (x==a.x)?(y<a.y):(x<a.x); } 
    bool operator == (const P a) const { return (x==a.x)&&(y==a.y); }
}po[nmax];

int sign(db x) { return (x<-eps) ? -1 : x>eps; }
db disLP(P p1, P p2, P p){ return abs( (p1-p).times(p2-p) ) / (p1-p2).le(); }

bool intersection(P p1, P q1, P p2, P q2){
    if(max(p1.x,q1.x)+eps < min(p2.x,q2.x)) return false;
    if(max(p1.y,q1.y)+eps < min(p2.y,q2.y)) return false;
    if(max(p2.x,q2.x)+eps < min(p1.x,q1.x)) return false;
    if(max(p2.y,q2.y)+eps < min(p1.y,q1.y)) return false;
    int t1=sign( (p2-p1).times(q1-p1) )*sign( (q1-p1).times(q2-p1) ), 
    t2=sign( (p1-p2).times(q2-p2) )*sign( (q2-p2).times(q1-p2) );
    return (t1>=0) && (t2>=0);
}

db disSP(P p1, P p2, P p){
    if((p1-p2).dot(p-p2) < eps) return (p-p2).le();
    if((p2-p1).dot(p-p1) < eps) return (p-p1).le();
    return disLP(p1, p2, p);
}

db disSS(P p1, P q1, P p2, P q2){
    if( intersection(p1, q1, p2, q2) ) return 0;
    db a = disSP(p1,q1,p2);
    db b = disSP(p1,q1,q2);
    db c = disSP(p2,q2,p1);
    db d = disSP(p2,q2,q1);
    return min(min(a,b),min(c,d) );
}

int main(){
    //freopen("owo.in","r",stdin);
    int q;
    P p1, q1, p2, q2;
    cin >> q;
    while(q--){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&p1.x,&p1.y,&q1.x,&q1.y,&p2.x,&p2.y,&q2.x,&q2.y);
        printf("%.10lf\n", disSS(p1, q1, p2, q2));
    }
    return 0;
}


Measured memory_bytes: 3240
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt();
	    	int h = sc.nextInt();
	    	int w = sc.nextInt();
	    	int[] a = new int[n];
	    	int[] b = new int[n];
	    	int count = 0;
	    	for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if (a[i] >= h && b[i] >= w) {
				count++;
			}
	    	}
	    	System.out.println(count);
	}
}


Measured memory_bytes: 26992
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 998244353
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

h1,m1,h2,m2,k = IL()

h = h2 - h1
m = m2 - m1
total = h*60 + m

print(total- k)

Measured memory_bytes: 65088
def main():
    N, M = map(int, input().split())
    adj = [set() for _ in range(N+1)]
    for _ in range(M):
        a, b = map(int, input().split())
        adj[a].add(b)
        adj[b].add(a)
    for i in range(2, N):
        if i in adj[1] and N in adj[i]:
            print("POSSIBLE")
            return
    print("IMPOSSIBLE")


if __name__ == "__main__":
    main()


Measured memory_bytes: 104524
n = int(input())
data = []

for _ in range(n):
    x, y, h = map(int, input().split())
    data.append((x,y,h))

data.sort(key=lambda x:x[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        flg = False
        # print(cx, cy)
        tmp = None
        for k in data:
            x = k[0]
            y = k[1]
            h = k[2]
            if not tmp:
                tmp = h+abs(cx-x)+abs(cy-y)
                continue
            if h == 0 and tmp>abs(cx-x)+abs(cy-y):
                flg = True
                break
            elif h == 0:
                continue
            elif tmp == h+abs(cx-x)+abs(cy-y):
                continue
            else:
                flg = True 
                break
        if flg:
            continue
        else:
            print(cx, cy, tmp)
            exit()


Measured memory_bytes: 3188
n, m, q = map(int, input().split())
a, b, c, d = [], [], [], []
for i in range(q):
	x, y, z, w = map(int, input().split())
	x, y = x - 1, y - 1
	a.append(x)
	b.append(y)
	c.append(z)
	d.append(w)

import itertools
lst = list(range(1, m + 1)) #[1,2,...,m]
A = list(itertools.combinations_with_replacement(lst, n))

maxs = 0
for v in A:
	score = 0
	for i in range(q):
		if v[b[i]] - v[a[i]] == c[i]:
			score += d[i]
	maxs = max(maxs, score)

print(maxs)




Measured memory_bytes: 84652
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,tim;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    cin>>e;
    
    if (a<0){
        tim=0-a*c+d+b*e;
    }else if(a==0){
        tim=d+b*e;
    }else if(a>0){
        tim=(b-a)*e;
    }
    cout<<tim<<endl;
}



Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    long long N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    long long MinTime = min({A, B, C, D, E});
    long long ans = (N + MinTime - 1) / MinTime + 4;
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

int main()
{
    set<int> a,b,d;
    int n,c;
    cin>>n;
    while(n--){
        cin>>c;
        a.insert(c);
    }
    cin>>n;
    while(n--){
        cin>>c;
        b.insert(c);
    }
    set<int>::iterator it=a.begin();
    set<int>::iterator it1=a.begin(),it2=a.end(),it3=b.begin(),it4=b.end();
    set_union(it1,it2,it3,it4,inserter(d,d.begin()));
    for(it=d.begin();it!=d.end();it++){
        cout<<*it<<"\n";
    }
}





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

int main() {
    long n, k, ans;
    cin >> n >> k;
    ans = pow(n/k, 3);
    if(k%2 == 0) ans += pow((n+k/2)/k, 3);
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define maxn 105
#define max(a,b) ((a)>(b)?(a):(b))
int n,a[2][maxn];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<2;i++)
		for(int j=1;j<=n;j++) scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++) a[0][i]+=a[0][i-1];
	for(int i=1;i<=n;i++) a[1][i]+=max(a[0][i],a[1][i-1]);
	printf("%d\n",a[1][n]);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<bitset>
using namespace std;
#define rep(i,a,b) for(register int i = a; i < b; ++ i)
typedef long long ll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define mkp make_pair

const int N = 1e5 + 5;
ll mp[N];

int main() {
	int n,a,b;
	ll ans;
	scanf("%d%d%d",&n,&a,&b);
	rep(i,0,n) {
		scanf("%lld",&mp[i]);
	}
	ans = 0;
	for(int i = 0; i < n - 1; ++ i) {
		ans += 1ll * min((mp[i + 1] - mp[i]) * a, 1ll * b);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024