akhauriyash/Code-Regression huggingface dataset:
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> mev;
vector<int> deg;
vector<bool> vis;

void dfs(int u) {
	vis[u] = true;
	for(auto &v : adj[u]) {
		mev[v] = max(mev[v], mev[u] + 1);
		deg[v]--;
		if(deg[v] == 0 and !vis[v]) {
			dfs(v);
		}
	}
}
int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, m;
	cin >> n >> m;

	adj.resize(n);
	mev.resize(n);
	deg.resize(n);
	vis.resize(n);

	for(int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		deg[v]++;
		adj[u].emplace_back(v);
	}

	for(int u = 0; u < n; u++) {
		if(deg[u] == 0 and !vis[u]) {
			mev[u] = 0;
			dfs(u);
		}
	}

	cout << *max_element(mev.begin(), mev.end());
}

Measured memory_bytes: 11264
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

N,K = map(int,input().split())
A = list(map(int,input().split()))

def is_divide(d):
    Rs = [a%d for a in A]
    Rs.sort()
    cumsum = [0] * (N + 1)
    for i in range(N - 1,-1,-1):
        cumsum[i] = cumsum[i + 1] + d - Rs[i]
    cum = 0
    for i in range(N):
        if max(cum,cumsum[i]) <= K:
            return True
        cum += Rs[i]
    return False

S = sum(A)
ans = 0
for i in range(1,S + 1):
    if i*i > S:
        break
    if S%i == 0:
        if is_divide(i):
            ans = max(ans,i)
        if is_divide(S//i):
            ans = max(ans,S//i)
print(ans)


Measured memory_bytes: 42476
def is_palindrome(s):
    return s == s[::-1]

s = input()

if len(s) % 2 == 0:
    p = len(s) // 2
    if is_palindrome(s) and is_palindrome(s[:p]) and is_palindrome(s[p:]):
        print('Yes')
    else:
        print('No')
else:
    p = len(s) // 2
    if is_palindrome(s) and is_palindrome(s[:p]) and is_palindrome(s[p + 1:]):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n,a,b;
vector<int> ret;
void dfs(int l,int r,int mask){
    if(__builtin_popcount(mask)==1){
        ret.pb(l);
        ret.pb(r);
        return;
    }
    int x=l^r;
    int tb=x&-x,tc=mask^tb;
    int td=tc&-tc;
    dfs(l,l^td,mask^tb);
    dfs(l^tb^td,r,mask^tb);
}
int main(){
    cin>>n>>a>>b;
    if(__builtin_popcount(a)%2==__builtin_popcount(b)%2){
        cout<<"NO"<<endl;
        return 0;
    }
    dfs(a,b,(1<<n)-1);
    cout<<"YES"<<endl;
    rep(i,ret.size()){
        cout<<ret[i]<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1656
x, y = input().split()
shinsu = {
    'A':1,
    'B':2,
    'C':3,
    'D':4,
    'E':5,
    'F':6
}

if shinsu[x] < shinsu[y]:
    print('<')
elif shinsu[x] > shinsu[y]:
    print('>')
else:
    print('=')

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
int A[202020];
ll sum=0;
ll dif[302020];
ll tot[302020];
ll ret[302020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,N) cin>>A[i], A[i]--;
	FOR(i,N-1) {
		x=A[i];
		y=A[i+1];
		if(y<x) y+=M;
		sum += y-x;
		if(x+1<y) {
			dif[x+2]++;
			dif[y+1]--;
			tot[y+1]+=y-x-1;
			dif[M+x+2]++;
			dif[M+y+1]--;
			tot[M+y+1]+=y-x-1;
		}
	}
	
	
	ll mi=1LL<<60;
	FOR(i,3*M) {
		if(i) {
			dif[i]+=dif[i-1];
			tot[i]+=tot[i-1];
		}
		tot[i]-=dif[i];
		mi=min(mi,sum+tot[i]);
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 1000000007; //10^9+7

int main() {
    int n;
    vector<int> a;
    int V;
    cin >> n;
    REP(i, n){
        cin >> V;
        a.push_back(V);
    }
    sort(a.rbegin(), a.rend());
    int t = 0;
    REP(i, n){
        if(abs(a[0] / 2 - a[i]) < abs(a[0] / 2 - t))t = a[i];
    }
    print(a[0] << " " << t);
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int n;
ll a[112345], b[112345];

int main(){
	scanf("%d", &n);
	REP(i, n) scanf("%lld", a+i);
	ll sm = 0;
	REP(i, n) sm += a[i];
	sm /= 2;
	ll tmp = 0;
	for(int i=1; i<n; i+=2) tmp+=a[i];
	for(int i=0; i<n; i+=2){
		b[i] = sm-tmp;
		tmp = tmp-a[i+1]+a[i];
	}
	tmp = 0;
	for(int i=2; i<n; i+=2) tmp+=a[i];
	for(int i=1; i<n; i+=2){
		b[i] = sm-tmp;
		tmp = tmp-a[i+1]+a[i];
	}
	REP(i, n) printf("%lld ", b[i]*2);
}


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

#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long int ll;

using namespace std;

int main() {
  int N, H;
  cin >> N;
  int ans = 0;
  int highest = numeric_limits<int>::min();
  REP(i, N) {
    cin >> H;
    if(H >= highest) {
      highest = H;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
K,S = map(int,input().split())
patterns = 0

# # arr = [[x+y for y in range(min(S-x+1,K+1))] for x in range(K+1)]
# farr = list(chain.from_iterable(arr))
# for z in farr:
#     temp_z = S - z
#     if temp_z <= K and temp_z >=0:
#         patterns += 1
# print(farr)
# print(farr.count(S))

for x in range(K+1):
    for y in range(max(0,S-K-x), min(K+1,S-x+1)):
        patterns += 1
print(patterns)

Measured memory_bytes: 2940
import sys
N, K = map(int, input().split()) #N: 町の数, K: ちょうどこの回数でたどり着く町

visited = [False for _ in range(N)]

A = list(map(lambda n: int(n)-1, input().split()))
tmp = 0 #次に訪れる番号
visited[0] = True
#cnt = 0 #テレポートの回数
log = [0] #テレポートの記録

for i in range(1, K+1):
    tmp = A[tmp]
    if visited[tmp]:
        start = log.index(tmp)
        break

    visited[tmp] = True
    log.append(tmp)

if i == K:
    print(tmp+1)
else:
    loop = log[start:i+1]
    period = len(loop)
    remain = K - i
    print(loop[remain%period] + 1)


Measured memory_bytes: 33868
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("avx")

// timus 219263UI
//    (><)

#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <assert.h>  
#include <string.h>
#include <algorithm>
#include <unordered_map>

using namespace std;

typedef long long ll;

#define y1 needtrainharder
#define f first
#define s second
#define gg exit(0)
#define sz() size()
#define pb emplace_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define alln(x, y) x, x + y
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"

const int inf = 1e9 + 5;  
const ll infll = 1e18 + 5ll;  
const long double eps = 1e-15;
const int maxn = 1e5 + 100;
const int maxlog = 21;
const int P = 97;
const int mod = 1e9 + 7;

ll n;

std::vector<int> getNum(ll x) {
  std::vector<int> ret;
  while (x) {
    ret.pb(x % 10);
    x /= 10;
  }
  reverse(all(ret));
  return ret;
}

int dp[18][200];

std::vector<int> numOfN;

int calc(int id, int sum, int tight) {
  if ( id >= numOfN.sz() ) {
    return sum;
  }
  int &ret = dp[id][sum];
  if ( ret != -1 )
    return ret;
  int newTight = (tight?numOfN[id]:9);
  for (int i = 0; i <= newTight; ++i) {
    ret = max(ret, calc(id + 1, sum + i, (numOfN[id] == i?tight:0) ));
  }
  return ret;
}

int main() { 
  boost; 
  // srand(time(NULL));
  file(task);  
  cin >> n;
  numOfN = getNum(n);
  memset(dp, -1, sizeof dp);
  cout << calc(0, 0, 1);
  return 0; 
}
/*

7 2
0 2 4 8 9 9 0
4 3 
2 100

0 0 0 inf inf inf inf


*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
set<ll> st;
int main()
{
    int n;
    cin>>n;
    int flag=1;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        if(st.count(x))
        {
            flag=0;
            break;
        }
        else
            st.insert(x);
    }
    if(flag)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;

}


Measured memory_bytes: 9600
#include <stdio.h>
#define A 100
 
main(){
  int c,i,j,k,n,minj=0,count=0;
  int b[A];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++)scanf("%d",&b[i]);
 
  for(i=0;i<=n;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(b[j]<b[minj])minj = j;
    }
    c = b[i];
    b[i] = b[minj];
    b[minj] = c;
    if(minj != i)count++;
  }
   
  for(i=0;i<n;i++){
    printf("%d",b[i]);
    if(i != n-1)printf(" ");
  }
   
  printf("\n%d\n",count);
  return 0;
}


Measured memory_bytes: 2144
import bisect

def main():
    Q = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in [0] * Q)

    l = min(LR)[0]
    r = max(LR, key=lambda x: x[1])[1]
    num = []
    apnd = num.append
    for i in range(l, r + 1, 2):
        x = (i + 1) // 2
        if is_prime(i) and is_prime(x):
            apnd(i)

    for l, r in LR:
        x = bisect.bisect_left(num, l)
        y = bisect.bisect_right(num, r)
        print(y - x)

def is_prime(n):
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True

main()


Measured memory_bytes: 17532
import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


K = 10**9+7
N = II()
a = np.array(acinput())
a = a[a != 0]
N = len(a)
s1 = 0
for i in range(N):
    s1 += a[i]
    s1 %= K

s1 %= K

# s1%=K
# s2 = s1
s = (s1*s1) % K
T = 0
for i in range(N):
    T += a[i]*a[i]
    T %= K
# s += K

tmp = modinv(2, K)
s += K
print((s-T)*tmp % K)

Measured memory_bytes: 49388
import java.util.*;
public class Main {
    public static void main(String[] args ){
        Scanner o = new Scanner(System.in);
        String s1 = o.nextLine();
        String s2 = o.nextLine();
        boolean ok = true;
        for ( int i = 0 ; i < s1.length() ; i++ )
        {
            if ( s1.charAt(i) != s2.charAt(i) )
            {
                ok = false;
                break;
            }
        }

        if(!ok){
            System.out.println("No");
        }
        else{
            System.out.println("Yes");
        }
        
    }
}

Measured memory_bytes: 35752
#include <stdio.h>

int main()
{
    long long a, b, c, k;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
    if(k%2)
        printf("%lld", b-a);
    else
        printf("%lld", a-b);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;

int adj[26][26];

bool cycle(void){
  int d[26];
  for(int i=0;i<26;i++)d[i] = 0;

  for(int i=0;i<26;i++){
    for(int j=0;j<26;j++){
      for(int k=0;k<26;k++){
	if(adj[k][j] && d[j] > d[k] + adj[k][j]){
	  d[j] = d[k] + adj[k][j];
	  if(i==25)return true;
	}
      }
    }
  }
  return false;
}

int main(){
  int n,h,w;
  string pict[50];
  int rr,rd,lu,ll;
  bool flag;

  cin >> n;
  while(n){
    n--;
    cin >> h >> w;
    for(int i=0;i<h;i++)cin >> pict[i];
    for(int i=0;i<26;i++){
      for(int j=0;j<26;j++)adj[i][j] = 0;
    }

    flag = true;
    for(int i='A';i<='Z';i++){
      rr = 0;
      rd = 0;
      lu = h;
      ll = w;
      for(int j=0;j<h;j++){
	for(int k=0;k<w;k++){
	  if(pict[j][k] == i){
	    rr = max(rr,k);
	    rd = max(rd,j);
	    lu = min(lu,j);
	    ll = min(ll,k);
	  }
	}
      }

      for(int j=lu;j<=rd;j++){
	for(int k=ll;k<=rr;k++){
	  if(pict[j][k] == '.'){
	    flag = false;
	    break;
	  }else if(pict[j][k] != i){
	    if(!adj[pict[j][k] - 'A'][i - 'A']){
	      adj[pict[j][k] - 'A'][i - 'A'] = -1;
	      
	      if(cycle()){
		flag = false;
		break;
	      }
	    }
	  }
	}
	if(!flag)break;
      }
      if(!flag)break;
    }

    if(!flag)cout << "SUSPICIOUS" << endl;
    else cout << "SAFE" << endl;
  }
}

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

int Change_to_number(char);

int main(){
  char command[7],str[13];
  int i,n,*data,number;
  data = malloc(sizeof(int)*22369620);
  //for(i=0;i<22369620;i++)data[i]=0;
  scanf("%d",&n);
  while(n--){
    number = 0;
    scanf("%s %s",command,str);
    if(command[0] == 'i'){
      for(i=0;i<strlen(str);i++){
	number += pow(4,i)*Change_to_number(str[i]);
      }
      data[number-1]=1;
    }
    else{
      for(i=0;i<strlen(str);i++){
	number += pow(4,i)*Change_to_number(str[i]);
      }
      if(data[number-1]==1)printf("yes\n");
      else printf("no\n");
    }
  }
  free(data);
}
int Change_to_number(char c){
  if(c == 'A')return 1;
  else if(c == 'C')return 2;
  else if(c == 'G')return 3;
  else return 4;
}



Measured memory_bytes: 7104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define debug(a,b,c) cout << a << " " << b << " " << c << endl;
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 
#define endl "\n";
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//code here
    int n ; cin >> n;
	cout << ((n>=30)?"Yes":"No") << endl;
}

Measured memory_bytes: 3600
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()

    val res = (1..n).map { sc.nextInt() }
            .groupBy { it }
            .map { if (it.key > it.value.count()) it.value.count() else it.value.count() - it.key }
            .sum()


    println(res)
}

Measured memory_bytes: 53840
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;
static const int INF = 999999999;


static const vector<int> numToMatch({ 2,5,5,4,5,6,3,7,6 });
int n_match, n_num;



int calNumToMatch(int num) {
	return numToMatch[num - 1];
}

void calMaxDigit(vector<int>& dp, vector<int> nums) {
	
	FOR(i, 1, n_match+1) {
		for (int num : nums) {

			int iMinusMatchNum = i - calNumToMatch(num);
			if (iMinusMatchNum >= 0) dp[i] = max(dp[i], dp[iMinusMatchNum] + 1);

		}
	}

}

string calNums(vector<int> dp, vector<int> nums, string ans) {
	int tmp_n = n_match;
	//大きい順にソート
	sort(nums.begin(), nums.end(), greater<int>());
	
	while (tmp_n > 0) {
		
		for (int num : nums) {
			int tmp_i = tmp_n - calNumToMatch(num);
			if (tmp_i >= 0 && dp[tmp_i] == dp[tmp_n] - 1) {
				ans += to_string(num);
				tmp_n -= calNumToMatch(num);
				break;
			}
		}

	}
	return ans;
}

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

	
	cin >> n_match >> n_num;

	vector<int> nums(n_num);
	FOR(i, 0, n_num) cin >> nums[i];

	vector<int> dp(n_match + 1, -INF);
	dp[0] = 0;

	//最大桁数計算
	calMaxDigit(dp, nums);
	//cout << "dp:" << endl;
	//FOR(i, 0, n_match+1) cout << dp[i] << endl;
	

	//各桁の数値計算
	string ans;
	ans = calNums(dp, nums, ans);
	//cout << "ans:" << ans << endl;
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
    long long int GCD(long long int a,long long int b){long long int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
    using namespace std;
    typedef long long ll;
    int main() {
      ll a,b,n;
      cin >> n >> a >> b;
      if(a>b){
        cout << 0 << endl;
      }
      else if(n==1&&a!=b){
        cout << 0 << endl;
      }
      else{
        cout << (a+(b*(n-1)))-(b+(a*(n-1)))+1 << endl;
      }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second

ll FastModExp(ll a,ll b,ll m)
{
// To compute a^b mod m
    ll res=1;
    while(b>0)
    {
        if(b&1)
        {
            res=(res*a)%m;
        }
        a=(a*a)%m;
        b=b>>1;
    }

    return res;
}
int main()
{
    ll i,j;
    cin>>i>>j;
    cout<<max(i+j,max(2*i-1,2*j-1));
    return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int X;
	cin >> X;
	if (X == 25) {
		cout << "Christmas" << endl;
	}
	else if (X == 24) {
		cout << "Christmas Eve" << endl;
	}
	else if (X == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	else {
		cout << "Christmas Eve Eve Eve" << endl;
	}
}

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

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

int N, K, L;
int road[200005], rail[200005];
pair<P, int> cmp[200005];
P tmp[200005];
int ans[200005];

void init(int parent[])
{
	for(int i = 1; i <= N; i++) parent[i] = i;
}

int root(int parent[], int i)
{
	if(parent[i] == i) return i;
	return parent[i] = root(parent, parent[i]);
}

void unite(int parent[], int i, int j)
{
	int root_i = root(parent, i);
	int root_j = root(parent, j);
	if(root_i == root_j) return;
	parent[root_i] = root_j;
}

int main(void)
{
	cin >> N >> K >> L;
	init(road), init(rail);
	
	int p, q;
	for(int i = 0; i < K; i++){
		cin >> p >> q;
		unite(road, p, q);
	}
	for(int i = 0; i < L; i++){
		cin >> p >> q;
		unite(rail, p, q);
	}
	
	for(int i = 1; i <= N; i++) root(road, i), root(rail, i);
	for(int i = 1; i <= N; i++){
		cmp[i] = make_pair(make_pair(road[i], rail[i]), i);
	}
	sort(cmp+1, cmp+N+1);
	for(int i = 1; i <= N; i++) tmp[i] = cmp[i].first;
	
	int pos = 1, l, r;
	while(pos <= N){
		l = lower_bound(tmp+1, tmp+N+1, tmp[pos]) - tmp;
		r = upper_bound(tmp+1, tmp+N+1, tmp[pos]) - tmp;
		for(int i = l; i < r; i++) ans[cmp[i].second] = r - l;
		pos = r;
	}
	
	for(int i = 1; i <= N; i++){
		cout << ans[i];
		if(i != N) cout << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 7040
n=int(input())
a=[int(o) for o in input().split()]
ans=1000
stock=0
prev=0
for i in range(n-1):
    if i>0 and prev<a[i] and stock>0:
        ans+=stock*a[i]
        stock=0
    if a[i]<a[i+1]:
        m=ans//a[i]
        ans-=m*a[i]
        stock+=m
        prev=a[i]
    #print(ans," ",stock)
if  prev<a[n-1] and stock>0:
        ans+=stock*a[n-1]
print(ans)

Measured memory_bytes: 62028
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main(){
	queue<int> q;
	queue<string> name;
	int n , tim;
	cin >> n >> tim;
	//string name[100000];
	for( int i=0 ; i<n ; i++ ){
		int x;
		string str;
		cin >> str >> x;
		q.push(x);
		name.push(str);
	}
	int counter=0;
	while(1){
		if( q.size() == 0 )break;
		int x = q.front();
		string str = name.front();
		q.pop();
		name.pop();
		if( x-tim >0 ){
			q.push(x-tim);
			name.push(str);
			counter+=tim;
		}
		else{
			counter+=x;
			cout << str <<" "<<counter<<endl;
		}
	}
}

Measured memory_bytes: 5684
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

long long gcd(long long a,long long b){
	if(b==0)return a;
	return gcd(b,a%b);
}

long long lcm(long long a,long long b){
	long long g=gcd(a,b);
	return a/g*b;
}


int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n;
	cin>>n;
	vector<LL> a(n);
	vector<LL> g1(n);
	vector<LL> g2(n);
	FOR(i,0,n){
		cin>>a[i];
	}
	g1[0]=a[0];
	g2[n-1]=a[n-1];
	FOR(i,1,n){
		g1[i]=gcd(g1[i-1],a[i]);
	}
	FORD(i,n-1,0){
		g2[i]=gcd(g2[i+1],a[i]);
	}
	LL ans=max(g1[n-2],g2[1]);
	FOR(i,1,n-1){
		ans=max(ans,gcd(g1[i-1],g2[i+1]));
	}
	cout<<ans;


	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(void){

int W,H,x,y,r;
cin >> W>>H>>x>>y>>r;

if ((x-r>=0 && x+r<=W)&&(y-r>=0 && y+r<=H)){
    cout << "Yes" << endl;
}
else{
    cout << "No" << endl;
}
    
}



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


int main(){
  int n, a;
  cin >> n >> a;
  cout << n * n - a << endl;
  return 0;
} 

Measured memory_bytes: 256
val primeToIndex =
    mapOf(2 to 0, 3 to 1, 5 to 2, 7 to 3, 11 to 4, 13 to 5,
          17 to 6, 19 to 7, 23 to 8, 29 to 9, 31 to 10, 37 to 11,
          41 to 12, 43 to 13, 47 to 14)

val nonUsePrimes =
    listOf(53, 59, 61, 67, 71, 73, 79, 83, 89, 97)

val primeArr = primeToIndex.keys.toIntArray()

fun main(args: Array<String>) {
    val n = readInputLine().toInt()

    val primes = Array(n + 1, {IntArray(15)})
    
    for (i in 2..n) {
        if (primeToIndex.containsKey(i)) {
            primes[i][primeToIndex.get(i)!!] = 1
            continue
        }
        
        if (nonUsePrimes.contains(i)) {
            continue
        }
        
        for (p in primeToIndex.keys) {
            if (i % p == 0) {
                for (j in 0..14) {
                    primes[i][j] = primes[i / p][j]
                }
                primes[i][primeToIndex.get(p)!!]++
                break
            }
        }
    }
    
    val totalPrimes = IntArray(15)
    for (p in primes) {
        for (i in 0..14) {
            totalPrimes[i] += p[i]
        }
    }

    // 指数とインデックスの関係:
    // 2 -> 0
    // 4 -> 1
    // 14 -> 2
    // 24 -> 3
    // 74 -> 4
    val cnt = IntArray(5)
    for (p in totalPrimes) {
        if (p >= 2) {
            cnt[0]++
        }
        if (p >= 4) {
            cnt[1]++
        }
        if (p >= 14) {
            cnt[2]++
        }
        if (p >= 24) {
            cnt[3]++
        }
        if (p >= 74) {
            cnt[4]++
        }
    }

    var ans = 0
    
    // 同じものは使えないため、複数組み合わせの場合は使える素数の数から減算する処理をする
    // p^4q^4r^2のケースはpとqのパターン数分2で除算する必要がある
    ans += cnt[4]
    ans += cnt[3] * (cnt[0] - 1)
    ans += cnt[2] * (cnt[1] - 1)
    ans += cnt[1] * (cnt[1] - 1) * (cnt[0] - 2) / 2
    
    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}



Measured memory_bytes: 35872
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int a,b,c,m,ans=0; cin>>a>>b>>c;
    m=max(max(a,b),c);
    ans+=3*m-a-b-c;
    cout<<(ans%2==0 ? ans/2 : (ans+3)/2)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int len[10010];
int res[10010];
int dp[10010];
int n,m;
int x;
bool yes[10010];
int cost[10]={0,2,5,5,4,5,6,3,7,6};
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x;
		yes[x]=true;
	}
	memset(res,-1,sizeof(res));
	res[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=9;j>=1;j--){
			if(cost[j]<=i&&yes[j]&&res[i-cost[j]]!=-1){
				if(len[i]<len[i-cost[j]]+1){
					len[i]=len[i-cost[j]]+1;
					res[i]=j;
					dp[i]=i-cost[j];
				}
			}
		}
	}
	for(int i=n;i;i=dp[i])
		cout<<res[i]; 
	return 0;
}


Measured memory_bytes: 384
import java.sql.SQLTransactionRollbackException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] str = sc.next().toCharArray();
        String abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        String ans = "";

        for (int i = 0; i < str.length; i++) {
            ans += abc.toCharArray()[((abc.indexOf(str[i])+n) % 26)];
        }

        System.out.println(ans);
    }

}


Measured memory_bytes: 147668
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;
ll inf = 1;

struct segtree {
    ll N, dat[2*MAX];
    segtree() {}
    segtree(ll n) {
        N = 1;
        while(N < n) N *= 2;
        for(ll i = 0; i < 2*N-1; i++)
            dat[i] = inf;
    }
    // update k th element
    void update(ll k, ll a) {
        k += N-1; // leaf
        dat[k] = a;
        while(k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }
    // min [a, b)
    ll query(ll a, ll b) { return query(a, b, 0, 0, N); }
    ll query(ll a, ll b, ll k, ll l, ll r) {
        if(r <= a or b <= l) return inf;
        if(a <= l and r <= b) return dat[k];
        int m = (l + r) / 2;
        return min(query(a, b, k*2+1, l, m), query(a, b, k*2+2, m, r));
    }
};

int main(){
  ll N , Q; cin >> N >> Q;
  rep(i,31) inf *= 2;
  inf--;
  segtree seg(N);
  rep(i,Q){
    ll a; cin >> a;
    if(a == 0){
      ll x , y; cin >> x >> y;
      seg.update(x , y);
    }
    else{
      ll x, y ; cin >> x >> y;
      cout << seg.query(x, y + 1) << endl;
    }
  }
}



Measured memory_bytes: 5156
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
#include <ctime>
#include <numeric>
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
const double pi=acos(-1);
int dx[]={0,1,0,-1,1,1,-1,-1},dy[]={1,0,-1,0,1,-1,1,-1};

int n,m;

vector<PI> G[500];
bool vis[500];
map<string,int> ms2i;

int s2i(const string& in){
  int sz=SZ(ms2i);
  if(ms2i.count(in))return ms2i[in];
  return ms2i[in]=sz;
}

int dij(const string& from,const string&to){
  int go=s2i(to);
  memset(vis,0,sizeof(vis));

  priority_queue<PI>q;
  q.push(mp(0,s2i(from)));
  while(!q.empty()){
    int c=-q.top().F;
    int v=q.top().S;
    q.pop();
    if(vis[v])continue;
    vis[v]=true;
    if(v==go)return c;
    FOR(it,G[v]){
      if(vis[it->F])continue;
      q.push(mp(-c-it->S,it->F));
    }
  }
}

void solve(){
  string s,p,g;
  cin>>s>>p>>g;
  ms2i.clear();
  rep(i,n)G[i].clear();

  rep(i,m){
    string as,bs;
    int d,t;
    cin>>as>>bs>>d>>t;
    int a=s2i(as),b=s2i(bs);
    G[a].pb(mp(b,d/40+t));
    G[b].pb(mp(a,d/40+t));
  }
  cout<<dij(s,p)+dij(p,g)<<endl;
}

main(){
  while(cin>>n>>m,n)solve();
}

Measured memory_bytes: 0
/************************************/
/* NoobM							*/
/* File Name : atjp.cpp				*/
/* Date : 27.06.2020 19:24:07 +06	*/
/************************************/

#include <bits/stdc++.h>

#define rr(i, b)    for (int i = 0; i < int(b); i++)
#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]
#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl
#define bug(x) cout << #x << " " << x << endl
#define ll long long
#define vii vector <int>

using namespace std;

void solve() {
	string a, b;
	cin >> a >> b;
	
	int counter = 0;
	
	for(int i = 0; i < a.size(); i++) {
		if(a[i] != b[i]) counter++;
	}
	
	cout << counter << endl;
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
	
	int t = 1;
	//cin >> t;
	
	while (t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

string dir="LRUD";
int dx[]{0,0,-1,1},dy[]{-1,1,0,0};

char S[300000],T[300000];
int main(){
	map<char,int>mp;
	rep(i,4)mp[dir[i]]=i;
	int h,w;cin>>h>>w;
	int n;cin>>n;
	int sx,sy;cin>>sx>>sy;sx--;sy--;
	scanf("%s%s",S,T);
	string s=S,t=T;
	bool ok=false;
	rep(i,2)rep(j,2){//Tak
		int x=sx,y=sy;
		rep(k,n){
			char c=s[k];
			if(mp[c]==i||mp[c]==2+j){
				x+=dx[mp[c]];
				y+=dy[mp[c]];
			}
			if(x<0||y<0||x>=h||y>=w){
				ok=true;goto g;
			}
			char d=t[k];
			if((!i)==mp[d]||(2+(!j))==mp[d]){
				int nx=x+dx[mp[d]];
				int ny=y+dy[mp[d]];
				if(nx<0||ny<0||nx>=h||ny>=w){}
				else x=nx,y=ny;
			}
		}
	}
	g:;
	if(ok)puts("NO");
	else puts("YES");
}

Measured memory_bytes: 1024
#男子  500M  1000M
#AAA級  35秒50 1分11秒00
#AA級   37秒50 1分17秒00
#A級  40秒00 1分23秒00
#B級  43秒00 1分29秒00
#C級  50秒00 1分45秒00
#D級  55秒00 1分56秒00
#E級  1分10秒00   2分28秒00
while line = gets
  fh,th = line.split.map(&:to_f)
  if fh<35.50&&th<71
    puts :AAA
  elsif fh<37.50&&th<77
    puts :AA
  elsif fh<40&&th<83
    puts :A
  elsif fh<43 && th < 89
    puts :B
  elsif fh<50 && th < 105
    puts :C
  elsif fh <55 && th < 116
    puts :D
  elsif fh < 70 && th <148
    puts :E
  else puts :NA
  end
end

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

int main() {
    int n , m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; i++) cin >> a.at(i);

    int sum = 0;
    for (int i = 0; i < m; i++) {
        sum += a.at(i);
    }

    if (sum > n) cout << -1 << endl;
    else cout << n - sum << endl;
}

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

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    
   if((a+b)%3==0 or a%3==0 or b%3==0)
    {
        printf("Possible");
    }
    else
        printf("Impossible");
    return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    string hoge;
    cin>>hoge;
    for(int i=hoge.length()-1;0<=i;i--){
        cout<<hoge[i];
    }
    cout<<endl;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

int main(){
    ll a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    ll ans = LLINF;
    for (ll i = 0; i < max(x,y)+1; i++)
    {
        
        ll temp = i*c*2;
        if(x > i) temp += (x-i)*a;
        if(y > i) temp += (y-i)*b;

        ans = min(ans,temp);
    }

    cout << ans << endl;

    return 0;
     
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
using ii = pair<ll, ll>;
#define ff first 
#define ss second
#define len(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define MAXN 100010

int main(){
	ios::sync_with_stdio(0);
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b+c>=22)
		cout << "bust\n";
	else
		cout << "win\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define MAX 20000000000

typedef long long int ll;
typedef unsigned long long int ull;


using namespace std;

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


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

	string S;
	ll N, K;
	cin >> N >> K >> S;

	ll count = 1;
	vector<ll> ud;

	range(i, 1, N) {
		if (S[i - 1] != S[i]) {
			ud.push_back(count);
			count = 0;
		}
		
		count++;
	}
	ud.push_back(count);
	ud.push_back(0);
	//ud.push_back(0);

	ll max;

	if (S[0] == '1') {

		if ((ud.size()-1)/2 <= K) {
			cout << N << endl;
			return 0;
		}

		ll dst = 0;
		rep(i, K*2) {
			dst += ud[i];
		}
		dst += ud[K*2];

		max = dst;

		range(i, 1, ud.size() - K*2 + 1) {
			if (i % 2 == 0) {
				dst = dst - ud[i - 1] + ud[i + K*2] + ud[i + K*2 - 1];
			}
			else {
				dst = dst - ud[i - 1];
			}
			if (dst > max)max = dst;
		}
	}
	else {
		if ((ud.size()/2) <= K) {
			cout << N << endl;
			return 0;
		}

		ll dst = 0;
		rep(i, K*2) {
			dst += ud[i];
		}
		max = dst;

		range(i, 1, ud.size() - K*2) {
			if (i % 2 == 1) {
				dst = dst - ud[i - 1] + ud[i + K*2] + ud[i + K*2 - 1];
			}
			else {
				dst = dst - ud[i - 1];
			}
			if (dst > max)max = dst;
		}

	}

	cout << max << endl;




	
	return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
int main() {
  long long N,K,F=0;cin>>N>>K;
  if(N<=K){
    cout<<0<<endl;return 0;
  }
  vector<long long>V(N);
  for(int X=0;X<N;X++)cin>>V[X];
  sort(V.begin(),V.end());
  for(int X=0;X<N-K;X++)F+=V[X];
  cout<<F<<endl;
}

Measured memory_bytes: 4776
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    int m, n;
    cin >> m >> n;
    int a[h][w];
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            a[i][j] = 0;
        }
    }
    for(int i = 0; i < m; ++i){
        for(int j = 0; j < w; ++j){
            a[i][j] = 1;
        }
    }
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < n; ++j){
            a[i][j] = 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if (a[i][j] == 0) ++ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
public class Main {

    public static void main(String[] args)throws IOException{
	    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(bf.readLine());

            for (int i=0;i<n;i++){
                System.out.println(bf.readLine().replaceAll("Hoshino","Hoshina"));
            }
    }
}

Measured memory_bytes: 16956
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

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

	cout << "ABC" << to_string(N) << endl;
	return 0;
}

Measured memory_bytes: 256
template<bool r>
class Range{
    struct It{
        int it;
        explicit constexpr It(int it_):it(it_){}
        int operator*(){return it;}
        bool operator!=(It& a){return it!=a.it;}
        void operator++(){ r ? --it : ++it;}
    };
    const It i,n;
  public:
    explicit constexpr Range(int i,int n):i(i),n(n){}
    Range<true> rev(){return Range<true>(n.it - 1, i.it - 1);};
    const It& begin(){return i;}
    const It& end(){return n;}
};
inline Range<false> in(int n) { return Range<false>(0, n);}
inline Range<false> in(int i, int n) { return Range<false>(i, n);}
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main() {
    int n;
    while (cin >> n && n) {
        vector<pair<int, int>> books(n);
        for (auto& p: books) cin >> p.first >> p.second;
        sort(books.rbegin(), books.rend());
        int rs = 0, ws = 0;
        for (auto& p: books) rs += p.first, ws += p.second;
        int longest = books.front().first;
        if (longest * 2 <= rs) {
            cout << rs + ws << endl;
            continue;
        }
        int rest = longest * 2 - rs;
        vector<bool> dp(rest + 1, false);
        dp[0] = true;
        for (int i : in(1, n)) {
            int val = books[i].second;
            for (int j : in(val, rest + 1).rev()) {
                dp[j] = dp[j] | dp[j - val];
            }
        }
        for (int i : in(rest + 1).rev()) {
            if (dp[i]) {
                cout << rest + rs + ws - i << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3104
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    vn = vk = vn_k = 1
    for i in range(1, n+1):
        vn = vn * i % modp
        if i == k:
            vk = vn
        if i == n-k:
            vn_k = vn
    return vn * get_inv(vk, modp) * get_inv(vn_k, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

def main():
    X,Y=mis()
    if (X+Y)%3 != 0:
        print(0)
    else:
        x, y = X - (X+Y)//3, Y - (X+Y)//3
        if x >= 0 <= y:
            print(comb(x+y, x, N1097))
        else:
            print(0)


main()


Measured memory_bytes: 5684
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll f(ll n) {
    ll mod = n % 4;
    if (mod == 0) return n;
    if (mod == 1) return 1;
    if (mod == 2) return n+1;
    if (mod == 3) return 0;
}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << (f(a-1)^f(b)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	double p[n];
	int i,j;
	for(i=0;i<n;i++)
	cin>>p[i];
	double dp[n+1][n+1];
	for(i=0;i<=n;i++)
	dp[0][i]=0.0;
	dp[0][0]=1.0;
	for(i=1;i<=n;i++)
	dp[i][0]=dp[i-1][0]*(1-p[i-1]);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
			dp[i][j]=((1-p[i-1])*dp[i-1][j])+(p[i-1]*dp[i-1][j-1]);
	}
	double sum=0;
	for(i=(n+1)/2;i<=n;i++)
		sum=sum+dp[n][i];
	cout<<setprecision(9)<<sum;
}

Measured memory_bytes: 74108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    int a,b = 0,c,d;
    string s;

    cin>>a;

    b = (a / 500) * 1000;
    a = a % 500;
    b += (a / 5) * 5;
    cout<<b<<endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b;
	a=1;b=1;
	while(1)
	{
	 printf("%dx%d=%d\n",a,b,a*b);
	 if(b<9)
	 b++;
	 else
	  {
	 	b=1;a++;
	  }
	  if(a==10)
	  break;
	}
	return(0);
}

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

using namespace std;
int ara[59];
int main()
{
    int n, m, x;
    cin >> n >> m;
    m *= 2;
    while(m--)
    {
        scanf("%d",&x);
        ara[x]++;
    }
    for(x=1;x<=n;x++) printf("%d\n",ara[x]);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
l = [0]*(10**7)
for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      l[x**2+y**2+z**2+x*y+y*z+z*x] += 1

for i in range(1, n+1):
  print(l[i])

Measured memory_bytes: 146392
from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# x以上のものがK個あるならOK
def f(x):
    cnt = 0
    for i in A:
        for j in B:
            for k in C:
                if i+j+k<x:break
                cnt += 1
                if cnt>=K:
                    return True
    return False

def get_boarder():
    l, r = 0, A[0]+B[0]+C[0]
    while r-l>1:
        m = (l+r)//2
        if f(m):
            l = m
        else:
            r = m
    return l

boarder = get_boarder()
q = []
for i in A:
    for j in B:
        for k in C:
            if i+j+k<boarder:break
            heappush(q, -(i+j+k))

for _ in range(K):
    print(-heappop(q))

Measured memory_bytes: 532044
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long int X;
	cin >> X;
	//vector<string> S(N);
	int s=0;
	long long int a=100;
  	
	while(a<X){
		a *= 1.01;
		s++;
	}

	  
	cout << s << endl;

}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int n, k;
int binpow(int a, int b) {
    if (b == 0) return 1;
    if (b & 1)
        return a * binpow(a * a, b / 2);
    else
        return binpow(a * a, b / 2);
}

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    cin >> n >> k;
    cout << k * binpow((k - 1), n - 1) << endl;
    return 0;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  
  if (A >= 13) {
    cout << B << endl;
  }
  
  else if (A >= 6) {
    cout << B / 2 << endl;
  }
  
  else {
    cout << 0 << endl;
  }
    
  return 0;
}

Measured memory_bytes: 256