akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

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

    int res;
    if (a >= 13) {
        res = b;
    } else if (12 >= a && a >= 6) {
        res = b/2;
    } else {
        res = 0;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
"""
#使用方法
print(ord("A")) #str型で入れたること
#>>65
print(chr(65)) #int型で入れたること
#>>A
"""
#ABC 146-D
n = int(input()) #n文字サイクルさせる
s = list(input()) #元の文字列(全て大文字)
list1 = []
for i in range(len(s)):
    number = (ord(s[i]) + n - ord("A")) %26 + ord("A")
    list1.append(chr(number))

print("".join(list1))

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(a) cerr << #a << ": " << a << endl
#define endl '\n'
#define int long long

const int N = 3001;

string s, t;
int n, m;
int cache[N][N];

int dp(int i, int j)
{
      if(i==n || j==m) return 0;

      int &ans = cache[i][j];
      if(ans != -1) return ans;

      if(s[i]==t[j]) ans = 1 + dp(i+1, j+1);
      else ans = max(dp(i+1, j), dp(i, j+1));

      return ans;
}

void path(int i, int j)
{
        if(i==n || j==m) return ;


        if(s[i]==t[j]){
            cout<<s[i];
            return path(i+1, j+1);
        }
        else
        {
              if(dp(i, j)==dp(i+1, j)) return path(i+1, j);
              else return path(i, j+1);
        }
}

int32_t main()
{
      IOS;

      cin>>s>>t;
      n = s.size(), m= t.size();

      memset(cache, -1, sizeof cache);
      dp(0, 0);
      path(0, 0);



      return 0;
}


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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N;

int main(void) {

    cin >> N;
    ll ans = 0;
    REP(i, 1, N + 1) {
        if (i % 3 != 0 && i % 5 != 0) {
            ans += i;
        } 
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n)[::-1]:
    if a[i+1] > 0:
        score = min(a[i+1], b[i])
        count += score
        a[i+1] -= score
        b[i] -= score
    if b[i] > 0:
        score = min(a[i], b[i])
        count += score
        a[i] -= score
        b[i] -= score
print(count)


Measured memory_bytes: 18624
x, y = (int(a) for a in input().split())
foot = 0
y_tmp = y
y_tmp2 = y

for i in range(x):
    y_tmp -= 2 * i + 4 * (x - i)
    y_tmp2 -= 4 * i + 2 * (x - i)
    if y_tmp == 0 or y_tmp2 == 0:
        print('Yes')
        exit()
    else:
        y_tmp = y
        y_tmp2 = y

print('No')

Measured memory_bytes: 9072
#include <iostream>
#include <vector>
using namespace std;

const int N = 15;
int arr[N];
bool flag;


void dfs(int left, int right, int cur){
    if (flag) return;

    if (cur == 10){
        flag = true;
        return;
    }

    if (left < arr[cur]){
        dfs(arr[cur], right, cur + 1);
    }
    if (right < arr[cur]){
        dfs(left, arr[cur], cur + 1);
    }
}

int main(){
    int t; cin >> t;
    while (t--){
        for (int i = 0; i < 10; ++ i) cin >> arr[i];
        flag = false;

        int left(0), right(0);

        dfs(left, right, 0);
        if (flag) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 3028
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;

int main (){
	int NNN;
	cin >> NNN;
	vector <pair<int,int>> nines;
	vector <pair<int,int>> sixs;
	int counter= 0;
	int temp=0;
	int tati=0;
	while(counter<100000){
		temp = counter;
		tati=0;
		while(temp>0){
			while(temp>=9){
				while(temp>=81){
					while(temp>=729){
						while(temp>=6561){
							while(temp>=59049){
								if(temp >= 59049){
									temp = temp - 59049;
									tati++;
								}
							}
							if(temp >= 6561){
								temp = temp - 6561;
								tati++;
							}
						}
						if(temp >= 729){
							temp = temp - 729;
							tati++;
						}
					}
					if(temp >=81){
						temp = temp - 81;
						tati++;
					}
				}
				if(temp >=9){
					temp = temp - 9;
					tati++;
				}
			}
		}

		nines.push_back(make_pair(counter,tati));
		counter += 9;
	}
	counter = 0;
	while(counter<100000){

		temp = counter;
		tati=0;
		while(temp>0){
			while(temp>=6){
				while(temp>=36){
					while(temp>=216){
						while(temp>=1296){
							while(temp>=7776){
								while(temp >= 46656){
									if(temp >= 46656){
										temp = temp - 46656;
										tati ++;
									}
								}
								if(temp >= 7776){
									temp = temp - 7776;
									tati++;
								}
							}
							if(temp >= 1296){
								temp = temp - 1296;
								tati++;
							}
						}
						if(temp >= 216){
							temp = temp - 216;
							tati++;
						}
					}
					if(temp >=36){
						temp = temp - 36;
						tati++;
					}
				}
				if(temp >=6){
					temp = temp - 6;
					tati++;
				}
			}
		}

		sixs.push_back(make_pair(counter,tati));
		counter += 6;
	}

	sort(nines.begin(),nines.end());
	sort(sixs.begin(),sixs.end(),greater<pair<int,int>>());

	int ninep = 0;
	int sixp=0;
	int ninemax = nines.size()+1;
	int min = 100000000;
	int kaisu = min+1;
	while(ninep <= ninemax){
		kaisu  = min +1;
		if(nines[ninep].first>NNN){
			break;
		}

		if(nines[ninep].first + sixs[sixp].first <= NNN){
			kaisu = NNN - (nines[ninep].first + sixs[sixp].first) + nines[ninep].second + sixs[sixp].second;
		}

		while(nines[ninep].first + sixs[sixp].first > NNN){
			sixp++;	
		}

		kaisu = NNN - (nines[ninep].first + sixs[sixp].first) + nines[ninep].second + sixs[sixp].second;
		if(min > kaisu){
			min = kaisu;
		}

		ninep++;
	}

	cout << min << endl;
	return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	int a;
	int b;
	int total;

	cin >> a >> b;

	total = a + b;

	if (a % 3 == 0)
	{
		cout << "Possible" << endl;

	}

	else if (b % 3 == 0)
	{
		cout << "Possible" << endl;

	}

	else if (total % 3 == 0)
	{
		cout << "Possible" << endl;

	}
	else
	{
		cout << "Impossible" << endl;
	}

	return 0;
}

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

#include <cmath>
#include <map>
#include <cstdlib>

using namespace std;

void num_to_switch(vector<int> &v, int n){
  int nn = n;
  int s = v.size();
  for(int i = 0; i < s; i++){
    v[i] = nn % 2;
    nn = nn / 2;
  }
  return;
}

void show_vec(vector<int> v){
  int size = v.size();
  for(int i = 0; i < size-1; i++){
    cout << v[i] << " ";
  }
  cout << v[size-1] << endl;
  return;
}

int main(int argc, char *argv[]){

  int N, M;
  cin >> N >> M;
  vector<int> k(0);
  vector<vector<int>> s(M);
  for(int m = 0; m < M; m++){
    int kk = 0;
    cin >> kk;
    k.push_back(kk);
    s[m];//.resize(kk);
    for(int K = 0; K < kk; K++){
      int ss;
      cin >> ss;
      s[m].push_back(ss);
    }
  }
  vector<int> p(M);
  for(int i = 0; i < M; i++){
    cin >> p[i];
  }
  int count = 0;
  for(int i = 0; i < pow(2, N); i++){
    bool boolean = true;
    //printf("\ni : %d\n", i);
    vector<int> switch_(N, 0);
    num_to_switch(switch_, i);
    //show_vec(switch_);

    for(int j = 0; j < M; j++){

      int p_on = 0;
      for(int kk = 0; kk < k[j]; kk++){
        p_on += switch_[  s[j][kk] -1 ];
        //printf("switch_[  s[%d][%d]  ] : %d\n", j, kk, switch_[  s[j][kk] ] -1 );
      }
      //printf("num of on : %d\n", p_on);
      if(p[j] % 2 != p_on % 2) boolean = false;
      //if(!boolean) break;
    }
    if(boolean) count++;
  }

  cout << count << endl;

/*
  cout << "k : ";
  show_vec(k);

  cout << "s[][]" << endl;
  for(int i = 0; i < M; i++){
    show_vec(s[i]);
  }

*/


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;
/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll sum = 0;//合計
  rep(i,n) sum += a[i];
  set<ll> candidates;//合計の約数の集合
  //約数列挙
  for(int i=1;i*i <= sum;i++){
    if(sum%i == 0){
      candidates.insert(i);
      candidates.insert(sum/i);
    }
  }
  ll ans = 1;
  for(ll x: candidates){
    ll need;
    {
      vector<ll> r(n);
      rep(i,n) r[i] = a[i]%x;//約数で割った余り
      sort(r.begin(), r.end());
      ll B = 0;
      rep(i,n) B += x-r[i];
      ll A = 0;
      need = 1e18;
      rep(i,n) {
        A += r[i];
        B -= x-r[i];
        need = min(need, max(A,B));//操作回数
      }  
    }
    if(need <= k) ans = max(ans,x);
  }
  cout << ans << endl;
}

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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  ll A[3];
  cin >> A[0] >> A[1] >> A[2];
  sort(A, A+3);
  cout << A[1] - A[0] + A[2] - A[1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}


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

    Int n, d;
    cin >> n >> d;
    int ans = 0;
    while(n > 0){
        n -= d*2+1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> N;
	vector<int>X(N),cX(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		cX[i] = X[i];
	}
	sort(cX.begin(), cX.end());
	ll medlow = cX[N / 2 - 1];
	ll medhigh = cX[N / 2];
	for (int i = 0; i < N; i++) {
		if (X[i] <= medlow)printf("%d\n",medhigh);
		else printf("%d\n", medlow);
	}
}

Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main(void){
    int a[210];
    int n,i,j,f=1;
    cin >> n;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=-1;f;i++){
        for(j=0;j<n;j++){
            if(a[j]%2==1){
                f=0;
                break;
            }else a[j]/=2;
        }
    }
    cout<<i<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var a,b int
	fmt.Scanf("%d %d", &a, &b)

	fmt.Println(answer(a, b))
}

func answer(a int, b int) int {
	var min_a = int(math.Ceil(float64(a) / 0.08))
	var max_a = int(math.Trunc(float64(a+1) / 0.08)) - 1
	var min_b = int(math.Ceil(float64(b) / 0.1))
	var max_b = int(math.Trunc(float64(b+1) / 0.1)) - 1

	for i := min_a; i <= max_a; i++ {
		if min_b <= i && i <= max_b {
			return i
		}
	}
	return -1
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ls (p << 1)
#define rs (p << 1 | 1)
#define mid (l + r) / 2
#define rep(i, l, r) for(int i = l; i <= r; ++i)
typedef long long ll;
const int N = 80000000 + 5;
struct tree{
    int min, tag;
}t[N];
int n, m, a, b, fir;
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
void lazy(int p, int k){
    t[p].min = t[p].tag = k;
}
void down(int p, int l, int r){
    if(!t[p].tag) return;
    lazy(ls, t[p].tag), lazy(rs, t[p].tag + mid - l + 1);
    t[p].tag = 0;
}
void update(int p, int l, int r, int x, int y, int k){
    down(p, l, r);
    if(l >= x && r <= y){ lazy(p, k); return;}
    if(mid >= x) update(ls, l, mid, x, y, k);
    if(mid < y) update(rs, mid + 1, r, x, y, k + max(0, mid - max(l, x) + 1));
    t[p].min = min(t[ls].min, t[rs].min);
}
int query(int p, int l, int r, int x, int y){
    if(l >= x && r <= y) return t[p].min;
    down(p, l, r);
    if(mid >= x) return query(ls, l, mid, x, y);
    else return query(rs, mid + 1, r, x, y);
}
int main(){
    n = read(), m = read();
    rep(i, 1, n){
        a = read(), b = read(); 
        fir = (a == 1 ? m + 1 : query(1, 1, m, a - 1, a - 1) + 1);
        update(1, 1, m, a, b, fir);
        printf("%d\n", t[1].min >= m + 1 ? -1 : t[1].min + i);
    }
    return 0;
}

Measured memory_bytes: 11920
#include <stdio.h>

int main () {
	int n, k;
	scanf("%d %d", &n, &k);
	int a[n + 1];
	
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i + 1]);
	}
	
	for (int i = k + 1; i <= n; i++) {
		if ( a[i] > a[i - k]) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2424
/*16D8103005J 相良和希 ayachi0117 C++*/
#include<iostream>
#include<cmath>
bool Pnumber(int x)
{
	for(int i=2;i<=std::sqrt(x);i++){
/*		if(i/10 != 0){
			if(i%10==1 || i%10==3 || i%10==7 || i%10==9){
				if(x%i == 0){
					return false;
				}
			}
		}else{*/
			if(x%i == 0){
				return false;
			}
/*		}*/
	}
	return true;
}

int main()
{
	int n;
	std::cin >> n;
	int x[n];
	int cou=0;
	for(int i=0;i<=n-1;i++){
		std::cin >> x[i];
	}
	for(int i=0;i<=n-1;i++){
		if(Pnumber(x[i])){
			cou++;
		}
	}
	std::cout << cou << "\n" ;
	return 0;
}



Measured memory_bytes: 3100
a,b,c=map(int,input().split())

def hantei(n1,n2,n3):
  ans="Yes"
  if n1==n2 and n2==n3:
    ans="No"
  if n1!=n2 and n2!=n3 and n3!=n1:
    ans="No"
  return ans

print(hantei(a,b,c))

Measured memory_bytes: 3060
#include<stdio.h>
#define N 10000 
#define Q 500

int main(){
  int S[N],T[Q],n,q,i,j,t=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
 
  scanf("%d",&q);
  
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
   
  for(i=0;i<n;i++){
    for(j=0;j<q;j++){
      if(S[i]==T[j]){
	t++;
	T[j]=-1;
	break;
      }
    }
  } 
 
  printf("%d\n",t);
  return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;

const ll oo=1e18;
const int MOD=1000000007;
const int INF=1000000000;
const ld EPS=0.000000001;

ll t,a,b,ans;

signed main() {
    cin>>t;
    while(t--) {
        cin>>a>>b;
        if(a>b) swap(a,b);
        ll tmp=sqrt(a*b);
        ans=(tmp-1)*2;
        if(tmp*tmp==a*b&&a!=b) ans--;
        if(tmp*(tmp+1)<a*b) ans++;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

x=_I()
#6,5の繰り返し

rest=x%11
x-=rest
ans =int((x/11)*2)
if rest==0:
	print(ans)
	exit()

if rest <=6:
	ans +=1
else:
	ans+=2
print(ans)


Measured memory_bytes: 64236
#include<bits/stdc++.h>
using namespace std;
#define N 1111116

int n,k,a[N],b[N],A[N],B[N],f[N],ans;
map<int,int> mp;

int get(int x){
	return f[x]==x?x:f[x]=get(f[x]);
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();
	for (int i=1;i<=n;i++) a[n+1]^=(a[i]=read());
	for (int i=1;i<=n;i++) b[n+1]^=(b[i]=read());
	memcpy(A,a,sizeof(A));sort(A+1,A+n+2);
	memcpy(B,b,sizeof(B));sort(B+1,B+n+2);
	for (int i=1;i<=n+1;i++)
		if (A[i]!=B[i]) {printf("-1\n");return 0;};
	for (int i=1;i<=n;i++)
		if (a[i]!=b[i]){
			ans++;
			if (!mp[a[i]]) mp[a[i]]=++k;
			if (!mp[b[i]]) mp[b[i]]=++k;
		}
	if (!mp[a[n+1]]) mp[a[n+1]]=++k;
	if (!mp[b[n+1]]) mp[b[n+1]]=++k;
	for (int i=1;i<=k;i++) f[i]=i;
	for (int i=1;i<=n+1;i++)
		if (a[i]!=b[i]) f[get(mp[a[i]])]=get(mp[b[i]]);
	for (int i=1;i<=k;i++)
		if (f[i]==i) ans++;
	printf("%d\n",ans-1);return 0;
}

Measured memory_bytes: 19200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> sum(n + 1);
  rep(i, n) sum[i + 1] = (sum[i] + a[i])% m;
  
  map<ll, ll> cnt;
  rep(i, n) cnt[sum[i + 1]]++;
  cnt[0]++;
  ll ans = 0;
  for(auto c : cnt) {
    ans += c.second * (c.second - 1) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int N, M;
  unordered_map<int,int> cnt;

  cin >> N;
  for (int i = 0; i < N; ++i) {
    int d; cin >> d;
    cnt[d] += 1;
  }

  cin >> M;
  bool f = true;
  for (int i = 0; i < M; ++i) {
    int t; cin >> t;
    if (cnt[t]-- <= 0) {
      f = false;
    }
  }

  puts(f ? "YES" : "NO");

  return 0;
}



Measured memory_bytes: 8520
from collections import Counter


def choose(n, r):
    x, y = 1, 1
    for i in range(r):
        x *= n - i
        y *= i + 1
    return x // y


N = int(input())
*a, = map(int, input().split())

ctr = Counter(a)

b = 0
for cnt in ctr.values():
    b += choose(cnt, 2)

ret = []
for x in a:
    cnt = ctr[x]
    res = b - choose(cnt, 2) + choose(cnt - 1, 2)
    ret.append(res)

print(*ret, sep='\n')


Measured memory_bytes: 30040
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
//#define INF (INT_MAX/2)
#define EPS (1.0e-8)
//#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
ll pow_mod(ll a, ll n, ll MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 0x01) { 
            res *= a;
            res %= MOD;
        }
        a = a * a;
        a %= MOD;
        n >>= 1LL;
    }
    return res;
}

ll recipro_mod(ll num, ll MOD) {
    return pow_mod(num, MOD - 2, MOD);
}

void fact_mod(vl& fact, vl& rFact, const int Size, const ll MOD) {
    fact = vl(Size, 0);

    fact[0] = 1;
    FOR(i, 1, Size) fact[i] = fact[i-1] * i % MOD;

    rFact = vl(Size, 0);
    rFact[0] = 1;
    rFact[Size-1] = recipro_mod(fact[Size-1], MOD);
    for (int i = Size-1; i > 0; i--) rFact[i - 1] = rFact[i] * i % MOD;
}

ll combi_mod(vl& fact, vl& rFact, ll n, ll k, const ll MOD){
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] % MOD * rFact[k] % MOD * rFact[n - k] % MOD;
}
#endif


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

    const ll MOD = (ll)1e9 + 7;
    ll N, A, B, C; std::cin >> N >> A >> B >> C;

    vl fact, rFact;
    fact_mod(fact, rFact, 2 * N, MOD);

    ll rApB = recipro_mod(A + B, MOD);
    ll pt = A * rApB%MOD;
    ll pa = B * rApB%MOD;

    ll ans = 0;
    FOR(i,N,2*N) {
        // Σ M-1CN-1 {pt^N pa^(M-N) + pt^(M-N) pa^N} 100M/(A+B)
        ll t = 1;
        ll cmb = combi_mod(fact, rFact, i - 1, N - 1, MOD) % MOD;
        ll pow = (pow_mod(pt, N, MOD)*pow_mod(pa, i - N, MOD) % MOD
                + pow_mod(pt, i - N, MOD)*pow_mod(pa, N, MOD) % MOD) % MOD;
        t *= cmb; t %= MOD;
        t *= pow; t %= MOD;
        t *= 100; t %= MOD;
        t *= i; t %= MOD;
        t *= rApB; t %= MOD;
        ans += t; ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
#include<stdio.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 100000000;

bool isOK(int a[],int index,int key){
    if(a[index] >= key){
        return true;
    }else{
        return false;
    }
}

int binary_search(int a[],int n,int key){
    int left = -1;
    int right = n;

    while(right-left>1){
        int mid = left + (right - left)/2;
        if(isOK(a,mid,key)){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}

int factrial(int n){
    if(n==0){
        return 1;
    }else{
        return n*factrial(n-1);
    }
}

int main(void){
    string s;
    cin >> s;
    int len = s.size();

    for(int i=0;i<len;++i){
        cout << 'x';
    }
    cout << endl;
    return 0;
}



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

using namespace std;

const long long mod = 1000000007;

int h,w;
char a[100001][10001];
long long f[10001][10001];

int main(){
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    cin >> h >> w;
    memset(a,0,sizeof(0));
    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++)
            cin >> a[i][j];
    memset(f,0,sizeof(f));
    int base = 1LL;
    for (int i = 1; i <= h; i++)
    {
        if (a[i][1] == '#') base = 0;
            f[i][1] = base;
    }
    base = 1LL;
    for (int i = 1; i <= w; i++)
    {
        if (a[1][i] == '#') base =0;
            f[1][i] = base;
    }
    for (int i = 2; i <= h; i++)
        for (int j = 2; j <= w; j++)
            if (a[i][j] != '#')
            {
                f[i][j] = (f[i][j] + ((f[i-1][j] + f[i][j-1]) % mod ) )% mod;
            }
            /*if (a[i][j] != '#')
            f[i][j] = f[i-1][j] + f[i][j-1];*/
    /*for (int i = 1; i <= h; i++){
        for (int j = 1; j <= w; j++)
            cout << f[i][j] << " " << " " << " " << " ";
        cout << endl;
    }*/
    cout << f[h][w]%mod ;
    return 0;

}


Measured memory_bytes: 792832
let n, ans, cs = read_int (), ref 0, Array.make_matrix 10 10 0
let rec f n = if n < 10 then n else f (n / 10)
let _ = for k = 1 to n do let h, l = f k, k mod 10 in cs.(h).(l) <- cs.(h).(l) + 1 done; for i = 1 to 9 do for j = 1 to 9 do ans := !ans + cs.(i).(j) * cs.(j).(i) done done; Printf.printf "%d\n" !ans

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

using namespace std;

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

    char a;
    cin>>a;

    if(a >= 'a' && a <= 'z')
        cout<<'a';
    else if(a >= 'A' && a <= 'Z')
        cout<<'A';
    return 0;
}


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

int n, a;
bool flag = 0;

int main(){
	cin >> n;
	for (int i = 0; i < n; ++i){
      	cin >> a;
		if (a % 2 == 1) flag = 1;
	}
	cout << (flag ? "first" : "second") << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ReadLine();
            var S = new HashSet<int>(ReadInts());
            ReadLine();
            var T = new HashSet<int>(ReadInts());
            System.Console.WriteLine(S.Intersect(T).Count());
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }

        static int ReadInt()
        {
            return int.Parse(ReadLine());
        }

        static IEnumerable<int> ReadInts()
        {
            return ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(x => int.Parse(x));
        }
    }

    //static class Console
    //{
    //    static StreamReader reader = new StreamReader("input.txt");

    //    public static string ReadLine()
    //    {
    //        return reader.ReadLine();
    //    }
    //}
}

Measured memory_bytes: 25656
INF = 10**12
maxH = 2 * 10**4 + 10

def solve():
    H, N = map(int, input().split())
    ABs = [tuple(map(int, input().split())) for _ in range(N)]

    dp = [INF] * (maxH+1)
    dp[0] = 0
    for A, B in ABs:
        for h in range(maxH-A+1):
            h2 = h + A
            dp2 = dp[h] + B
            if dp2 < dp[h2]:
                dp[h2] = dp2

    print(min(dp[H:]))


solve()


Measured memory_bytes: 40688
#include <bits/stdc++.h>
#include <set>
using namespace std;
int func(int n){
	if(n % 2 == 0) return n/2;
	else return 3 * n + 1;
}

int main()
{
	int s;
	cin >> s;
	set<int> a{s};
	int m(2), c(func(s));
	while(a.count(c) == 0){
		a.insert(c);
		++m;
		c = func(c);
	}
	cout << m << endl;
	return 0;
}

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

int toInt(const string a){
  stringstream ss;
  ss<<a;
  int b;
  ss>>b;
  return b;
}

string toStr(const int a){
  stringstream ss;
  ss<<a;
  string b;
  ss>>b;
  return b;
}

int main(void){
  int q;cin>>q;
  for(int i=0;i<q;++i){
    int c=0;
    string s;cin>>s;
    set<string> p;
    p.insert(s);
    for(;s.size()!=1;){
      int max=0;
      for(int i=1;i<s.size();++i){
        int a=toInt(s.substr(i,s.size()-i)),b=toInt(s.substr(0,i));
        if(max<a*b) max=a*b;
      }
      ++c;
      s=toStr(max);
      if(p.find(s)!=p.end()){c=-1;break;}
      p.insert(s);
    }
    cout<<c<<endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <string>
#include <queue>

using namespace std;

int main() {
	int n, q, query, t, x;

	cin >> n >> q;

	queue<int> Q[n];

	for (int i = 0; i < q; i++) {
		cin >> query >> t;

		if (query == 0) {
			cin >> x;
			Q[t].push(x);
		}
		else if (query == 1) {
			if (Q[t].size() != 0)
				cout << Q[t].front() << endl;
		}
		else {
			if (Q[t].size() != 0)
				Q[t].pop();		
		}	
	}
}




Measured memory_bytes: 4264
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        
        for(int i = a; i <= b; i++){
        	if(c % i == 0){
                count++;
            }
        }
        System.out.println(count);
        sc.close();
    }
}



Measured memory_bytes: 26324
N = int(input())
S = input().strip()
cmax = 0
for n in range(1,N-1):
    X = S[:n]
    Y = S[n:]
    Cx = {}
    Cy = {}
    for i in range(n):
        a = X[i]
        if a not in Cx:
            Cx[a] = 0
        Cx[a] += 1
    for i in range(N-n):
        a = Y[i]
        if a not in Cy:
            Cy[a]=0
        Cy[a] += 1
    cnt = 0
    for a in Cx:
        if a in Cy:
            cnt += 1
    cmax = max(cmax,cnt)
print(cmax)

Measured memory_bytes: 39792
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, d: isize, xy: [[isize; 2]; n]);

    let mut count = 0;
    for v in xy {
        if d * d >= v[0] * v[0] + v[1] * v[1] {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 15748
N=int(input())
S=[input() for i in range(N)]


AC_num=S.count("AC")
WA_num=S.count("WA")
TLE_num=S.count("TLE")
RE_num=S.count("RE")

print("AC x",AC_num)
print("WA x",WA_num)
print("TLE x",TLE_num)
print("RE x",RE_num)





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

int main(){
  int h, w, m;
  vector<int> numh(300005), numw(300005);
  int mxh=0, mxw=0;
  cin >> h >> w >> m;
  rep(i, m){
    int tmph, tmpw;
    cin >> tmph >> tmpw;tmph--;tmpw--;
    mp[P(tmph, tmpw)]=true;
    numh[tmph]++;
    numw[tmpw]++;
    mxh = max(mxh, numh[tmph]);
    mxw = max(mxw, numw[tmpw]);
  }
  //maxの行と列を調べて、交点に爆弾があるか調べる
  vector<int> mxrow, mxcol;
  rep(i, h)if(numh[i]==mxh)mxrow.emplace_back(i);
  rep(i, w)if(numw[i]==mxw)mxcol.emplace_back(i);

  int adjust = 1;//交点に爆弾がなければ0
  rep(i, mxrow.size()){
    rep(j, mxcol.size()){
      if(!mp[P(mxrow[i], mxcol[j])]){
        adjust = 0;
        break;
      }
    }
    if(adjust==0)break;
  }

  cout << mxh+mxw-adjust << endl;

  return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n+1);
    auto g = [&](ll n)-> ll {
        return n*(n+1)/2;
    };
    ll res = 0;
    rep1(i,n+1)res += ll(i)*g(n/i);
    out(res);
}

Measured memory_bytes: 81272
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		char[] arr = new char[n];
		Arrays.fill(arr, '0');
		arr[0] = 'a';
		arr[1] = 'b';
		int aidx = 0;
		for (int i = 0; i < q; i++) {
			int from = sc.nextInt() - 1;
			int to = sc.nextInt() - 1;
			char x = arr[to];
			arr[to] = arr[from];
			arr[from] = x;
			if (arr[from] == 'a') {
				aidx = from;
			} else if (arr[to] == 'a') {
				aidx = to;
			}
			if (aidx != 0) {
				arr[aidx - 1] = 'b';
			}
			if (aidx != n - 1) {
				arr[aidx + 1] = 'b';
			}
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (arr[i] == 'a' || arr[i] == 'b') {
				count++;
			}
		}
		System.out.println(count);
	}
}


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

using namespace std;

int main() {
	int t;
	cin >>t;
	for(int i = 0; i <t ; i++) {
		int n,k;
		int sum =0;
		cin >>n >>k;
		vector<int> x(n);
		for(int j = 0; j <n ;j++){
			cin >>x[j];
		}
		vector<int> len(n-1);
		for(int l = 0; l<n-1;l++){
			len[l] = x[l+1] - x[l];
		}
		sort(len.begin(),len.end());

		for(int m=0;m<n-k;m++){
			sum+=len[m];
		}
		cout << sum <<endl;

	}

	return 0;
}

Measured memory_bytes: 1860
using System;

class test{
    static void Main(){
        string[] str;
        str=Console.ReadLine().Split(' ');
        int a=int.Parse(str[0]);
        int b=int.Parse(str[1]);
        int c=int.Parse(str[2]);
        int n=0;
        for(;a<=b;a++){
            if(c%a==0)n++;
        }
        Console.WriteLine(n);
    }
}


Measured memory_bytes: 9220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int h[100010];
	for (int i = 1; i <= n; i++)
	{
		cin >> h[i];
	}
	h[0] = h[1];
	int dp[100010];
	dp[0] = 0;
	dp[1] = 0;
	for (int i = 2; i <= n; i++)
	{
		dp[i] = min(dp[i - 2] + max(h[i - 2] - h[i], h[i] - h[i - 2]), dp[i - 1] + max(h[i - 1] - h[i], h[i] - h[i - 1]));
	}
	cout << dp[n] << endl;
}

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

int main(){
    int n,k;
    cin >> n;
    int N[2*(n+1)];
    int C[201];
    
    for(int i=1; i<=2*n; i++){
        N[i] = i;
    }
    int m;
    cin >> m;
    for(int i=0; i<m; i++){
        for(int f=1; f<=2*n; f++){
            C[f] = N[f];
        }
        int t=0,s=0;
        cin >> k;
        if(k==0){
            for(int j=1; j<=2*n; j++){
                if(j%2==1){
                    t++;
                    N[j] = C[t];
                }else{
                    s++;
                    N[j] = C[n+s];
                }
            }
        }else{
            for(int j=1; j<=2*n; j++){
                if(j<=2*n-k) {
                    C[j] = N[j];
                    N[j] = N[k+j];
                }
                else{
                    N[j] = C[j-2*n+k];
                }
            }
        }
    }
    for(int i=1; i<=2*n; i++){
        cout << N[i] << endl;
    }
}

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

int judge_prime_number(int n);

int main(void) {
	while(1){
		int a,d,n;
		scanf("%d %d %d",&a,&d,&n);
		if(a==0 && d==0 && n==0){break;}
		int i,count,judge;
		i = 0;
		count = 0;
		while(1){
			judge = judge_prime_number(a + (d * i));
			if(judge == 1){
				count += 1;
				if(count == n){
					printf("%d\n",a+(d*i));
					break;
				}
			}
			i++;
		}
	}
	return 0;
}

int judge_prime_number(int n){
	if(n==2 || n==3 || n==5 || n==7 || n==11 || n==13){
		return 1;
	}
	if((n%2)==0 || (n%3)==0 || (n%5)==0 || (n%7)==0 || (n%11)==0 || n==1){
		return 0;
	}

	int root_n;
	root_n = (int)sqrt(n);
	int i;
	for(i=3;i<=root_n;i+=2){
		if((n % i)==0){return 0;}
	}
	return 1;

}

Measured memory_bytes: 600
use proconio::input;
use proconio::marker::Usize1;

macro_rules! chmax {
    ($max_v: expr, $v: expr) => {
        if $v > $max_v {
            $max_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        p: [Usize1; n],
        c: [i64; n],
    };

    let mut vs = vec![];
    let mut b = vec![false; n];
    for i in 0..n {
        if !b[i] {
            let mut v = vec![];
            let mut c = i;
            while !b[c] {
                b[c] = true;
                v.push(c);
                c = p[c];
            }
            vs.push(v);
        }
    }

    let mut ans = c[vs[0][0]];
    for v in vs.iter() {
        let sum_v = v.iter().map(|&v_i| c[v_i]).sum::<i64>();
        let n_v = v.len();
        let mut a = c[v[0]];
        for i in 0..n_v {
            let mut s = 0_i64;
            for j in i..std::cmp::min(2 * n_v, i + k) {
                s += c[v[j % n_v]];
                chmax!(a, s);
            }
        }
        if k > n_v {
            let x = k / n_v;
            let k = k % n_v;
            for i in 0..n_v {
                let mut s = x as i64 * sum_v;
                chmax!(a, s);
                for j in i..i + k {
                    s += c[v[j % n_v]];
                    chmax!(a, s);
                }
            }
            for i in 0..n_v {
                let mut s = (x as i64 - 1) * sum_v;
                chmax!(a, s);
                for j in i..i + n_v + k {
                    s += c[v[j % n_v]];
                    chmax!(a, s);
                }
            }
        }
        chmax!(ans, a);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2376
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n;
    ll k; 
    cin >> n >> k;
    vint a(n);
    rep(i,n) {
        int x; cin >> x;
        x--;
        a[i] = x;
    }
    set<int> st;
    st.insert(0);
    vint data;
    data.push_back(0);
    int x = 0;
    rep(i,n) {
        if (st.find(a[x]) == st.end()) {
            st.insert(a[x]);
            data.push_back(a[x]);
            x = a[x];
        }
        else {
            x = a[x];
            break;
        }
    }
    // vout(data);
    // cout << endl;
    // cout << x << endl;
    ll remain;
    rep(i,data.size()) {
        if (data[i] == x) {
            remain = i;
        }
    }
    if (remain >= k) cout << data[k]+1 << endl;
    else {
        k -= remain;
        ll roop = data.size()-remain;
        ll t = k % roop;
        cout << data[remain+t]+1 << endl;
    }
}

Measured memory_bytes: 13904
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int x, a, b;
    cin >> x >> a >> b;
    
    if(abs(x - a) < abs(x - b)){
        cout << "A\n";
    }
    else{
        cout << "B\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	double A,B,T;
	cin>>A>>B>>T;
	int kai;
	kai=(T+0.5)/A;
	cout<<kai*B<<endl;
}

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

int main(void){
  int i,j,k,l;
  int n,m;
  char before[10000],after[10000];
  char str[100000];

  while(1){
    scanf(" %d",&n);
    if(n==0)break;

    for(i=0;i<n;i++){
      scanf(" %c %c",&before[i],&after[i]);
    }
    scanf("%d",&m);
    
    for(i=0;i<m;i++){
      scanf(" %c\n",&str[i]);
      for(j=0;j<n;j++){
	if(str[i]==before[j]){
	  str[i]=after[j];
	  break;
	}
      }
    }
    for(i=0;i<m;i++){
      printf("%c",str[i]);
    }
    printf("\n");
    
  }
  return(0);
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	vector<int> v(3);
	for (int i=0; i<3; i++) cin>>v[i];
	sort(v.begin(), v.end());
	vector<int> w={5,5,7};
	cout << (v==w ? "YES" : "NO") << endl;
	return 0;
}


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

int main() {
    string S; cin >> S;
    if(S == "SUN") cout << 7 << '\n';
    else if(S == "MON") cout << 6 << '\n';
    else if(S == "TUE") cout << 5 << '\n';
    else if(S == "WED") cout << 4 << '\n';
    else if(S == "THU") cout << 3 << '\n';
    else if(S == "FRI") cout << 2 << '\n';
    else if(S == "SAT") cout << 1 << '\n';
}

Measured memory_bytes: 256
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)

MY_NAMESPACE(testbed)
int main()
{
	ll modval = 1000000007;  // 10^9 + 7

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	vector<ll> pos, neg;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (a[i] < 0)
			neg.push_back(a[i]);
		else
			pos.push_back(a[i]);
	}

	bool neg_answer = false;
	if (pos.size() == 0)
		neg_answer = (k % 2 == 1);
	else if (n == k)
		neg_answer = (neg.size() % 2 == 1);

	ll res = 1;
	if (neg_answer) {
		sort(a.begin(), a.end(), [](ll x, ll y) -> bool {
			return abs(x) < abs(y);
			});
		for (int i = 0; i < k; i++)
		{
			res *= a[i];
			res %= modval;
			res += modval;
			res %= modval;
		}
	}
	else
	{
		sort(pos.begin(), pos.end());    // the biggest at last
		sort(neg.rbegin(), neg.rend());  // the biggest abs(negative) at last

		if (k % 2 == 1)
		{
			res = pos.back(); pos.pop_back();
		}

		vector<ll> p;
		while (pos.size() > 1)
		{
			ll tmp = pos.back(); pos.pop_back();
			tmp *= pos.back(); pos.pop_back();
			p.push_back(tmp);
		}
		while (neg.size() > 1)
		{
			ll tmp = neg.back(); neg.pop_back();
			tmp *= neg.back(); neg.pop_back();
			p.push_back(tmp);
		}
		sort(p.rbegin(), p.rend());

		for (int i = 0; i < k / 2; i++)
		{
			ll pval = p[i];
			pval %= modval;
			res *= pval;
			res %= modval;
		}
	}

	cout << res << "\n";
	return 0;
}
MY_NAMESPACE_

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

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

    cout << s.substr(0, 3) << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n;
    cin>>n;
    vector<int>a(n),b(n+1,0);
    REP(i,n) {
        cin>>a[i];
        b[a[i]]++;
    }
   // show(b);
    int maxn=0;
    for (int i = 1; i <= n; i++)
    {
        maxn+=b[i]*(b[i]-1)/2;
      //  cerr<<maxn<<endl;
    }
   // cerr<<maxn<<endl;
    int copy=maxn;
   // cerr<<copy<<endl;
    for (int i = 0; i < n; i++)
    {
        if(b[a[i]]>=2)
        {
            maxn-=b[a[i]]*(b[a[i]]-1)/2;
            maxn+=(b[a[i]]-1)*(b[a[i]]-2)/2;
        }
        cout<<maxn<<endl;
        maxn=copy;
    }
    
    

    
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a, bool g){
	if(g){
		if(a[index]<key){
			return true;
		}
	}
	else{
		if(a[index]>key){
			return true;
		}
	}
	return false;
}

ll bin_search(ll key, vector<ll> &a, bool g){
	
	ll l=-1;
	ll r=a.size();

	if(g){
		l=a.size();
		r=-1;
	}

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a, g)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

int main(){

	ll H,W,h,w;
	cin>>H>>W>>h>>w;

	ll ans=(H-h)*(W-w);
	
	cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256