akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    int e,y;
    cin >> e >> y;
    switch(e){
        case 0:
            if(y >= 1989){
                cout << 'H' << y - 1988 << endl;
            }else if(y >= 1926){
                cout << 'S' << y - 1925 << endl;
            }else if(y >= 1912){
                cout << 'T' << y - 1911 << endl;
            }else{
                cout << 'M' << y - 1867 << endl;
            }
            break;
        case 1:
            cout << 1867 + y << endl;
            break;
        case 2:
            cout << 1911 + y << endl;
            break;
        case 3:
            cout << 1925 + y << endl;
            break;
        case 4:
            cout << 1988 + y << endl;
            break;
        default:
            break;
    }
    return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    int a, b;
    cin >> a >> b;
    // 001 : 010 : 011
    /**
     a | b | S
     0 | 0 | 0
     0 | 1 | 1
     1 | 0 | 1
     1 | 1 | 0
    */

    cout << (a ^ b) << endl;

    return 0;
}



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

using namespace std;
typedef long long ll;

int T, n;
const int maxn = 100;
const int maxv = 1000000000;
const int maxw = 100000;

const ll INF = 1ll<<60;

ll dp[maxw+5]; //minimal weight for val
ll W;
ll w[maxn];
ll v[maxn];

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> W;
  for(int i = 0; i < n; i++) cin >> w[i] >> v[i];
  dp[0] = 0;
  dp[w[0]] = v[0];
  for(int i = 1; i < n; i++) for(int j = W; j > -1; j--) if(w[i]<=j) dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
  ll V = 0;
  for(int j = W; j > -1; j--) V = max(V, dp[j]);
  cout << V << endl;
  //cout << dp[n-1][30];
  return 0;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n, m, k int
	fmt.Scanf("%d %d %d", &n, &m, &k)
	lines, _ := scanLongIntSlices(2, 11*200000)

	booksA := lines[0]
	booksB := lines[1]

	time := 0
	for _, t := range booksA {
		time += t
	}

	numA := n
	numB := 0
	maxCount := 0

	changed := true
	for changed {
		changed = false
		if time <= k && numA+numB > maxCount {
			maxCount = numA + numB
		}
		if numB < m && time <= k {
			time += booksB[numB]
			numB++
			changed = true
		} else if numA > 0 && time > k {
			time -= booksA[numA-1]
			numA--
			changed = true
		}
	}

	fmt.Printf("%d\n", maxCount)
}

func scanIntSlice(size int) []int {
	input := []int{}
	for i := 0; i < size; i++ {
		var in int
		fmt.Scanf("%d", &in)
		input = append(input, in)
	}
	return input
}

func scanLongIntSlices(lines int, maxBufSize int) ([][]int, error) {

	res := [][]int{}

	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, bufio.MaxScanTokenSize)
	sc.Buffer(buf, maxBufSize)

	for sc.Scan() {
		line := sc.Text()
		strs := strings.Split(line, " ")
		ints := make([]int, len(strs))
		for i, c := range strs {
			n, err := strconv.Atoi(c)
			if err != nil {
				return nil, err
			}
			ints[i] = n
		}
		res = append(res, ints)
	}

	if err := sc.Err(); err != nil {
		return nil, err
	}

	return res, nil
}


Measured memory_bytes: 15704
H, W = list(map(int, input().split()))

if H % 3 == 0 or W % 3 == 0:
    print(0)
    exit()

a = []
a.append([H//3*W, (H-H//3)*(W//2), (H-H//3)*(W//2+W%2)])
a.append([(H//3 + 1)*W, (H-H//3-1)*(W//2), (H-H//3-1)*(W//2+W%2)])
t = W
W = H
H = t
a.append([H//3*W, (H-H//3)*(W//2), (H-H//3)*(W//2+W%2)])
a.append([(H//3 + 1)*W, (H-H//3-1)*(W//2), (H-H//3-1)*(W//2+W%2)])

ans = min(W, H)
for i in range(len(a)):
    if  not 0 in a[i]:
        ans = min(ans, max(a[i]) - min(a[i]))


print(ans)


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

ll Pow(ll a, ll b, ll c){
    ll ans = 1;
    a %= c;
    while (b){
        if (b & 1) ans = (ans * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return (ans % c);
}

bool cmp(const int &a, const int &b){
    return a < b;
}

ll gcd(ll x, ll y){
    return x % y == 0 ? y : gcd(y, x % y);
}

ll lcm(ll x, ll y){
    return x / gcd(x, y) * y;
}

int main(){
    int w, h, x, y;
    scanf("%d%d%d%d", &w, &h, &x, &y);
    double s = (double)w * h / 2;
    int flag = 0;
    if (x * 2 == w && y * 2 == h) flag = 1;
    printf("%.12lf %d\n", s, flag);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    static int cards[4][13];
    int i,j,n,m;
    char c;
    char s[5]={'S','H','C','D','\0'};
    scanf("%d\n",&n);
    for(i=0;i<n;i++){
        scanf("%c %d\n",&c,&m);
        for(j=0;j<4;j++)
            if(s[j]==c){
                cards[j][m-1]=1;
            }
    }
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0)
                printf("%c %d\n",s[i],j+1);
        }
    }
    return 0;
}


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

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

unsigned long long lcm(unsigned long long a, unsigned long long b)
{
    int temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

int main()
{
  unsigned long long A, B, C, D;
  cin >> A >> B >> C >> D;
  
  //A-B間のCの倍数の数
  unsigned long long cCount = B / C - (A - 1) / C;
  //A-B間のDの倍数の数
  unsigned long long dCount = B / D - (A - 1) / D;
  //A-B間のCとDの最小公倍数の倍数の数
  unsigned long long cdCount = B / lcm(C, D) - (A - 1) / lcm(C, D);
  
  cout << B - A + 1 - (cCount + dCount - cdCount)  << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int n,m;
    cin>>n>>m;
    string a[n];
    for(long int i=0;i<n;i++)
    cin>>a[i];
    long long int dp[n][m];
    dp[n-1][m-1]=1;
    long long int mod=pow(10,9)+7;
    for(long int i=n-2;i>=0;i--)
    {
        if(dp[i+1][m-1]==1&&a[i][m-1]=='.')
        dp[i][m-1]=1;
        else
        dp[i][m-1]=0;
    }
    for(long int i=m-2;i>=0;i--)
    {
        if(dp[n-1][i+1]==1&&a[n-1][i]=='.')
        dp[n-1][i]=1;
        else
        dp[n-1][i]=0;
    }
    for(long int i=n-2;i>=0;i--)
    {
        for(long int j=m-2;j>=0;j--)
        {
            if(a[i][j]=='.')
            dp[i][j]=(dp[i+1][j]+dp[i][j+1])%mod;
            else
            dp[i][j]=0;
        }
    }
   
    cout<<dp[0][0];
}

Measured memory_bytes: 9088
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}


//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll N;
char A[510][510];

void solve(){
  bool exist = 0;
  rep(i, N)rep(j, N){
    if(A[i][j] == '#') exist = 1;
  }
  if(exist == 0){
    cout << -1 << endl;
    return;
  }
  ll sumW[N];
  rep(i, N){
    sumW[i] = 0;
  }
  rep(i, N){
    rep(j, N){
      if(A[i][j] == '#'){
        sumW[j]++;
      }
    }
  }

  vector<ll> need(N, 0);
  rep(i, N){
    ll x = 0;
    rep(j, N){
      if(A[i][j] == '#') continue;
      need[i]++;
      if(sumW[i] == 0) x = 1;
    }
    need[i] += x;
  }
  sort(need.begin(), need.end());
  ll cnt = 0;
  rep(i, N) if(sumW[i] != N) cnt++;
  cout << (need[0] + cnt) << endl;
}

int main(){
  cin >> N;
  rep(i, N)rep(j, N) cin >> A[i][j];
  solve();
}


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

const int N = 2e5+10;
long long int v[N];
long long int n, k;
long long int INF = 1e18+10;

long long int bb_p(long long int l, long long int r, long long int index, long long int query){
	if(l > r) return r;
	long long int mid = (l+r)/2ll;
	long long int value = v[mid] * v[index];
	if(value <= query) return bb_p(mid+1ll, r, index, query);
	else return bb_p(l, mid-1ll, index, query);
}

long long int bb_n(long long int l, long long int r, long long int index, long long int query){
	if(l > r) return l;
	long long int mid = (l+r)/2ll;
	long long int value = v[mid] * v[index];
	if(value <= query) return bb_n(l, mid-1ll, index, query);
	else return bb_n(mid+1ll, r, index, query);
}

bool check(long long int query){
	long long int ans = 0;
	for(long long int i=0; i < n-1ll; i++){
		if(v[i] >= 0ll) ans += bb_p(i+1ll, n-1ll, i, query) - i;
		else ans += n - bb_n(i+1ll, n-1ll, i, query);
	}
	return k <= ans;
}

long long int solve(long long int l, long long int r){
	if(l > r) return l;
	long long int query = (l+r)/2ll;
	if(check(query)) return solve(l, query-1ll);
	else return solve(query+1ll, r);
}


int main(){
	cin >> n >> k;
	for(long long int i=0; i < n; i++) cin >> v[i];
	sort(v, v+n);
	cout << solve(-INF, INF) << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
using namespace std;

const int maxn = 1e6;
char s[maxn + 5];
int n, b[maxn + 5];

int solve(int low) {
	int x = 0, hi = 0;
	rep(i, 1, n) {
		if (s[i] != '?') {
			x += s[i] == '0' ? 1 : -1;
		} else {
			if (x - 1 + b[i + 1] >= low) x--;
			else x++;
		}
		hi = max(hi, x);
	}
	return hi - low;
}

int main() {
	scanf("%s", s + 1), n = strlen(s + 1);
	per(i, n, 1) b[i] = min(0, b[i + 1] + (s[i] != '1' ? 1 : -1));
	printf("%d\n", min(solve(b[1]), solve(b[1] - 1)));
	return 0;
}

Measured memory_bytes: 8672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(ll N, vector<ll> &x, ll &ans){

    if(N == 1) ans = abs(x.at(1)-x.at(0));
    else{
        sort(x.begin(), x.end());

        for(ll i = 0; i != N-1; ++i){
            ll left{}, right{};
            left = x.at(i+1) - x.at(i);
            right = x.at(i+2) - x.at(i+1);

            ll tmp{};
            tmp = __gcd(left, right);
            ans = min(ans, tmp);
        }
    }

    return;
}

int main(){

    ll N, X;
    cin >> N >> X;
    vector<ll> x;
    x.push_back(X);
    for(ll i = 0; i != N; ++i){
        ll tmp;
        cin >> tmp;
        x.push_back(tmp);
    }

    ll ans = INF;
    solver(N, x, ans);

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


Measured memory_bytes: 4228
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array(lr())
sum_water = A.sum()
A *= 2
m1 = sum_water - A[1::2].sum() # 山１に降った水
print(m1, end=' ')
cur = m1
for a in A[:-1]:
    print(a - cur, end=' ')
    cur = a - cur
# 20

Measured memory_bytes: 23100
N,M,X = map(int, input().split())
grid = [[]]
for i in range(N):
    ls = list(map(int, input().split()))
    grid.append(ls)
    

def rec(r,progress,result):
    if r == N:
        result.append(progress)
        progress = progress + [grid[N]]
        result.append(progress)
        return
    else:
        rec(r+1,progress,result)
        progress = progress + [grid[r]]
        rec(r+1,progress,result)

def rap():
    result = []
    progress = []
    rec(0,progress,result)
    ans = float('inf')
    for item in result:
        stals = [0]*(M+1)
        for item2 in item:
            for i, j in enumerate(item2):
                stals[i] += j
        f = True
        for  m in stals[1:]:
            if m < X:
                f = False
        if f:
            ans = min(ans,stals[0])
    if  ans == float('inf'):
        print(-1)
    else:
        print(ans)
            
    return 

rap()

Measured memory_bytes: 9708
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
print(n//3)

Measured memory_bytes: 38384
from heapq import heappush,heappop
N,M=input().split(" ")
N=int(N)
M=int(M)
Alist=input().split(" ")
# Alist = [-float(A) for A in Alist]
hAqueue=[]
for A in Alist:
    heappush(hAqueue,-float(A))

for m in range(M):
    tmp=heappop(hAqueue)
    heappush(hAqueue,tmp/2)
Alist = [-int(A) for A in hAqueue]
print(sum(Alist))

Measured memory_bytes: 17352
#include<stdio.h>

int main(void)

{
	int n , m ,i ,h ;
	
	while(scanf("%d %d",&n ,&m))
	{	 bool ok = true , go = false;
	   if( n == 0 && m == 0)
	   {
	   	break;
	   }
	  
	   for( i = 0 ; i < n ; i++)
	   {
	   	  if(ok)
	   	  {
	   	  	for(h = 0 ; h < m ;h++)
	   	  	{
	   	  		if(ok)
	   	  		{
	   	  			printf("#");
	   	  			ok= false;
	   	  			
					 }
	   	  		else
	   	  		{
	   	  			printf(".");
	   	  			ok=true;
					 }
		    }
	   	  	printf("\n");
	   	  	ok= false;
			 }
			 else
			 {
			for(h = 0 ; h < m ;h++)
			{
				if(ok)
				{
					printf("#");
					ok=false;
				}
				else
				{
					printf(".");
					ok=true;
				}
			}
			printf("\n");
			ok=true;
	      }
	    
   
			 
			 	
      }
        printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2696
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        lld x;
        cin>>x;
        if(x)
            cout<<0<<endl;
        else
            cout<<1<<endl;
    }
}





Measured memory_bytes: 3692
/*{{{*/
#include<bits/stdc++.h>

typedef long long ll;

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

#define vl vector<ll>
#define pll pair<ll,ll>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

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

  ll T = 1e6+10;

  ll ans = 0;
  vl effs;
  FOR(i,2,T){
    if(n%i!=0) continue;
    ll count = 0;
    while(n%i==0){
      count++;
      n/=i;
    }
    ll diff = 0;
    REP(j,count+1){
      if(j*(j+1)/2<=count) diff = j;
      else break;
    }
    ans += diff;
  }
  if(n>1) ans += 1;

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


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	static void Main(){
		const int mod=1000000007;
		int n=int.Parse(Console.ReadLine());
		long ans=1,p=0;
		int[][] a=new int[n*2][];
		for(int i=0;i<n;i++){a[i]=Array.ConvertAll((Console.ReadLine()+" 1").Split(),int.Parse);}
		for(int i=n;i<n*2;i++){a[i]=Array.ConvertAll((Console.ReadLine()+" -1").Split(),int.Parse);}
		Array.Sort(a,(u,v)=>u[0]-v[0]);
		for(int i=0;i<n*2;i++){
			p+=a[i][1];
			if(Math.Abs(p)>1&&Math.Sign(p)==Math.Sign(a[i][1])){ans=(ans*Math.Abs(p))%mod;}
		}
		Console.WriteLine(ans);
	}
}

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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
    lli n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    lli len = s.length();

    // X がいけるかどうかチェック
    // c<d なら、Yがdについてしまってからいけばいい
    if (c < d) {
        // まず Y がいってしまうべき => 行けなかったら終わり
        REP(i, b-1, d-1) {
            if (s[i] == '#' && s[i+1] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        // 次に X がいく
        REP(i, a-1, c-1) {
            if (s[i] == '#' && s[i+1] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    // まず そもそもY がいけるか？
    REP(i, b-1, d-1) {
        if (s[i] == '#' && s[i+1] == '#') {
            cout << "No" << endl;
            return 0;
        }
    }
    // A がまたぐ余地があるか？
    REP(i, b-1, d) {
        if (s[i] == '#')
            continue;
        if (s[i-1] == '.' && s[i+1] == '.') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using ll = long long;
using namespace std;

int main() {
  string s;
  cin >> s;
  if (s == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int h, w;
    while (cin >> h >> w)
    {
        if ((h == 0) && (w == 0))
        {
            return (0);
        }
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
#define SZ(x) ((int) (x).size())
#define mem(x, b) memset((x), b, sizeof (x))
typedef long long ll;
#define QAQ cerr << "233\n";
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
template<typename tp> inline void arr(tp *a, int n) {
  for(int i = 1; i <= n; i ++)
    cout << a[i] << " ";
  puts("");
}
#define GG return puts("-1"), 0;
const int N = 3e5 + 233;
int a[N], n, ans = 0, zero[N];
vector<int> vec;
main(void) {
  read(n);
  for(int i = 1; i <= n; i ++)
    read(a[i]), zero[i] = zero[i - 1] + !a[i];
  if(a[1] != 0) GG;
  for(int i = 1; i <= n - 1; i ++) {
    if(a[i + 1] == a[i] + 1)
      ans ++;
    else {
      if(a[i + 1] <= i && a[i] >= a[i + 1] - 1)
        ans += a[i + 1];
      else GG;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3840
#include<stdio.h>
int main(){
int x,y,sum=0,sumy=0,k=0,ave;
while(scanf("%d,%d",&x,&y)!=EOF){
sum+=x*y;
k++;
sumy+=y;
}
ave=(double)sumy/k+0.5;
printf("%d\n%d\n",sum,ave);
return 0;
}

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

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

int main()
{
	int a,b,c,d;
	cin>>a;
	vector<int>v;
	for(int i=1;i<=a;++i){
		for(int j=1;j<=a;++j){
			for(int k=1;k<=a;++k){
				b = gcd(i,j);
				c = gcd(b,k);
				v.push_back(c);
				/*d = gcd(i,k);
				if(b == c && b == d){
					v.push_back(b);
				}else{
					if(b <= c && b <= d) v.push_back(b);
					else if(c <= b && c <= d) v.push_back(c);
					else v.push_back(d);
				}*/
			}
		}
	}
	cout<<accumulate(v.begin(),v.end(),0LL)<<endl;
	return 0;
}

Measured memory_bytes: 36220
#include <iostream>
#include<map>
#include<vector>

using namespace std;

int ans=0;

int main()
{
    int n,k;
    cin >> n >> k;
    int d;
    map<int,int> m;
    for(int i=1;i<=n;i++){
        m[i]=0;
    }
    for(int i=0;i<k;i++){
        cin >> d;
        vector<int> snacks(d,0);
        for(int j=0;j<d;j++){
            cin >> snacks[j];
        }
        for(int j=0;j<snacks.size();j++){
            m[snacks[j]]++;
        }
    }
    for(auto it: m){
        if(it.second==0){
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,i,b,c=1;
    cin>>a>>b;
    for(i=0;i<a;i++)
	{
        if(c>b)c=c+b;
        else c=c+c;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
/* title: Card Game
	 source: JOI 2009-2010 Yosen No.3
	 hint: Just do it
*/



#include <iostream>
#include <algorithm> // sort, binary_search and upper_bound
#include <vector>
using namespace std;


int main()
{
	for(int N; cin >> N && N; ) {
		vector<int> v(N);
		for(int i = 0; i < N; i++) cin >> v[i];

		sort(v.begin(), v.end());
		
		vector<int> A, B;
		for(int i = 1; i <= 2 * N; i++) {
			(binary_search(v.begin(), v.end(), i) ? A : B).push_back(i);
		}

		int top = 0, turn = true;
		while(!A.empty() && !B.empty()) {
			auto p = (turn ? &A : &B);
			auto it = upper_bound(p->begin(), p->end(), top);

			if(it == p->end()) top = 0;
			else {
				top = *it;
				p->erase(it);
			}

			turn = !turn;
		}

		cout << B.size() << endl << A.size() << endl;
	}
}
			 

Measured memory_bytes: 1220
# https://atcoder.jp/contests/abc156/tasks/abc156_a
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, r = map(int, input().split())
    print(r + max(0, 100 * (10 - n)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC087A
{
  class Program
  {
      static void Main(string[] args)
      {
          int x, a, b, c;
  
          x = int.Parse(Console.ReadLine());
          a = int.Parse(Console.ReadLine());
          b = int.Parse(Console.ReadLine());
  
          c = (x - a) % b;
  
          Console.WriteLine(c);
  
          Console.ReadKey();
      }
  }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_size(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  int K;
  cin>>K;
vector<int> v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};


cout<<v[K-1]<<endl;
}

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

using namespace std;

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

    long a = 1e15;
    for(long x = 1; x < 1e7; x++)
        if(x * (n / x) == n)
            a = min(a, x + (n/x));
    cout << a - 2 << endl;
}


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

int main(){
    int n, m, a, b, cnt[MAX];
    fill(cnt, cnt+MAX, 1);
    pair<int, pair<int, int>> p[MAX];
    pair<int, int> ans[MAX];
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++){
        scanf("%d%d", &a, &b);
        p[i] = make_pair(b, make_pair(i, a));
    }
    sort(p, p+m);
    for(int i = 0; i < m; i++){
        ans[p[i].second.first] = make_pair(p[i].second.second, cnt[p[i].second.second]++);
    }
    for(int i = 0; i < m; i++){
        printf("%06d%06d\n", ans[i].first, ans[i].second);
    }
}


Measured memory_bytes: 3840
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

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

vector<int> ps[10];
char buf[30000+1];
int main() {
	int N;
	cin >> N >> buf;
	for(int i=0;i<N;i++){
		ps[buf[i]-'0'].push_back(i);
	}
	int ret=0;
	for(int i=0;i<10;i++){
		if(ps[i].size()==0)continue;
		int a=ps[i].front()+1;
		for(int j=0;j<10;j++){
			if(ps[j].size()==0)continue;
			int b=ps[j].back();
			for(int k=0;k<10;k++){
				auto u=lower_bound(ps[k].begin(),ps[k].end(),a);
				if(u!=ps[k].end()&&*u<b){
					ret++;
				}
			}
		}
	}

	cout << ret << endl;

	

	return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
/********
*	????????????????????°
*********/

/*********??¢?????´?????????
*	(1)
*	(2)
*********/

int main(void)
{
	int n, x ;			//
	int karigoukei ;//???????¨????
	int i, j, k, h ;//


	
	while(1){				//??°?????\???
		h = 0;
		scanf("%d %d\n", &n, &x);
		if(n == 0 && x == 0 ){
			break;
		} else {
			
			for(i = 1 ; i <= n; i++ ){
				for(j= 1 ; j <= n ; j++ ){
					for(k = 1 ; k <= n ; k++ ){
						
						karigoukei = i + j + k;
						if(i < j && j < k){
								if(x == karigoukei){
									h++;
								} else {
								//????¨???????x??¨??????????????¨????????????
								}
							//??????????????¨?????????????????????????????????
						}else {
							//??????????????¨?????????????????????????????????	
						}
						
					}
				}
			}
		}
		printf("%d\n", h);
	}
    return 0;
	
}

Measured memory_bytes: 1036
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        k: i64,
        a: i64,
        b: i64
    }
    if (a..b + 1).any(|i| i % k == 0) {
        println!("OK");
    } else {
        println!("NG");
    }
}


Measured memory_bytes: 2196
#include<iostream>
#include<cmath>
#include<vector>
#include<climits>
#include<algorithm>
#include<numeric>
#include<iomanip>
#include<map>
#include<set>
#include<random>
#include<cassert>
using namespace std;
#define ll long long int
#define ld long double
const ll Mod = (ll)1e9+7;
ll CaseN=1;
const ld PI = 22/7.0;
#define INF (ll)1e18 
ll tst()
{
   ll ans=0;  
    
   
       
   return ans;
}


void solve()
{
   ll l,r,d;
   cin>>l>>r>>d;
  ll ans=0;
  for(ll i=l;i<=r;i++)
  {
	 if(i%d==0){ans++;} 
	 }

  cout<<ans<<endl;   
//cerr<<"Case #"<<CaseN<<": ";
    CaseN++;

return ;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;
	//cin>>t;
	while(t--)
	{
	solve();
	}
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = (a), i##_end_ = (b); i <= i##_end_ ; ++i)
#define drep(i, a, b) for(register int i = (a), i##_end_ = (b); i >= i##_end_ ; --i)
#define clear(a, b) memset((a), (b), sizeof(a))
typedef long long LL;
int read() {
	int x = 0, flag = 1;
	char ch = getchar();
	while(!isdigit(ch)) {
		if(ch == '-') flag = -1;
		ch = getchar();
	}
	while(isdigit(ch)) {
		x = (x << 3) + (x << 1) + (ch - 0x30);
		ch = getchar();
	}
	return flag * x;
}

LL a, b;
int sign(LL a) {
	return (a >= 0);
}
void gdata() {
	exit(998244353);
}
int main() {
#ifdef Qrsikno
	freopen("k.in","r",stdin);
	freopen("k.out","w",stdout);
#endif
	cin >> a >> b;
	if(a == b) puts("0");
	else if(a == 0) printf("%lld\n", (b < 0) + abs(b));
	else if(b == 0) printf("%lld\n", (a > 0) + abs(a));
	else 
		if(a * b < 0) {
			if(abs(a) == abs(b)) printf("1\n");
			else printf("%lld\n", 1 + abs(abs(b) - abs(a))); 
		}else {
			if(a < 0) 
				if(abs(a) < abs(b)) printf("%lld\n", 2 + abs(abs(b) - abs(a)));
				else printf("%lld\n", abs(abs(a) - abs(b)));
			else if(a > b) 
					printf("%lld\n", 2 + abs(abs(b) - abs(a)));
				 else printf("%lld\n", abs(abs(b) - abs(a)));
		}
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
struct A
{
    ll to,next,w;
} a[2*N];
ll head[2*N];
ll res[2*N];
ll r[2*N];
ll vis[2*N];
ll n,m;
ll tot;
void add(int u,int v)
{
    tot++;
    a[tot].to=v;
    a[tot].next=head[u];
    head[u]=tot;
}
void bfs()
{
    queue<ll> q;
    q.push(1);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        vis[x]=1;
        for(int i=head[x];i!=-1; i=a[i].next)
        {
            ll y=a[i].to;
            if(!vis[y])
            {
                res[y]+=res[x];
                q.push(y);
            }
        }
    }
}
int main()
{
    memset(head,-1,sizeof(head));
    cin>>n>>m;
    int a,b;
    for(int i=0;i<n-1;i++)
    {
        cin>>a>>b;
        add(a,b);
        add(b,a);
    }
    for(int i=0;i<m;i++)
    {
        cin>>a>>b;
        res[a]+=b;
    }
    bfs();
    for(int i=1;i<=n;i++)
    {
        cout<<res[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 20364
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            price = 500 * i + 100 * j + 50 * k
            if price == x:
                count += 1
                break

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back


typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int EPS = 1e-9;
const int MOD = 1e9+7;

vi D;

bool check(){
  int jump = 0;
  REP(i,SZ(D)){
    jump = max(jump,D[i]/10);
    jump--;
    if(jump < 0){
      return false;
    }
  }
  return true;
}

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  REP(i,n){
    int a;
    cin >> a;
    D.pub(a);
  }
  int jump = 0;
  if(!check()){
    cout << "no" << endl;
    return 0;
  }
  rev(ALL(D));
  if(!check()){
    cout << "no" << endl;
    return 0;
  }
  
  cout << "yes" << endl;
  return 0;
}



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

int func(long long x) {
	long long sum = 0;
	while (x > 0) {
		sum += x % 10;
		x /= 10;
	}
	return sum;
}

int main()
{
	int cnt = 0;
	long long a, n, m;
	long long x;
	int i;
	int ov;

	cin >> a >> n >> m;

	for (int y = 1; y <= 72; y++) {
		ov = 0;
		x = 1;
		for (i = 0; i < n; i++) {
			x *= (y + a);
			if (x > m) {
				ov = 1;
				break;
			}
		}
		if (ov) {
			break;
		}
		if (func(x) == y) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}


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

int main()
{
	int a, b, x;
	cin >> x >> a >> b;
	if (b <= a) cout << "delicious" << endl;
	else if (b > a && b - a <= x) cout << "safe" << endl;
	else cout << "dangerous" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	string s;
	cin>>s;
	if(s[1]=='R')
		cout<<"ABC";
	else
		cout<<"ARC";
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 3640
S=input()[::-1]
N=len(S)
T=['maerd','esare','resare','remaerd']
ans='YES'
i=0
while i<N:
    if S[i:i+5]==T[0]:
        i+=5
    elif S[i:i+5]==T[1]:
        i+=5
    elif S[i:i+6]==T[2]:
        i+=6
    elif S[i:i+7]==T[3]:
        i+=7
    else:
        ans='NO'
        break
print(ans)

Measured memory_bytes: 9284
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    x,y,a,b,c=parseMap(split(readline()))
    p=sort(parseMap(split(readline())),rev=true)
    q=sort(parseMap(split(readline())),rev=true)
    r=sort(parseMap(split(readline())),rev=true)
    ans=sum(p[1:x])+sum(q[1:y])
    xi,yi=x,y
    for i in r
        if xi>0 && yi>0
            if p[xi]<q[yi] && i>p[xi]
                ans+=i-p[xi]
                xi-=1
            elseif i>q[yi]
                ans+=i-q[yi]
                yi-=1
            end
        elseif xi>0 && i>p[xi]
            ans+=i-p[xi]
            xi-=1
        elseif yi>0 && i>q[yi]
            ans+=i-q[yi]
            yi-=1
        else
            break
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 139596
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const n = Number(stdin.split('\n')[0])

const ans = _ => {
  for (let i = n; i > 0; i--) {
    const root = Math.sqrt(i)
    if (Number.isInteger(root)) {
      return i
    }
  }
}

console.log(ans())


Measured memory_bytes: 11468
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		int N = int.Parse(str);
		int[][] X = new int[N][];
		for(var i=0;i<N;i++){
			string[] str2 = Console.ReadLine().Split();
			X[i] = new int[3];
			X[i][0] = int.Parse(str2[0]);
			X[i][1] = int.Parse(str2[1]);
			X[i][2] = int.Parse(str2[2]);
		}
		Array.Sort(X,(a, b) => a[0] - b[0]);
		string ans = "Yes";
		int nt = 0;
		int xt = 0;
		int yt = 0;
		for(var i=0;i<N;i++){
			if(Math.Abs(X[i][1]-xt) + Math.Abs(X[i][2]-yt) <= X[i][0] - nt){
				if((X[i][0] - nt) % 2 == (Math.Abs(X[i][1]-xt) + Math.Abs(X[i][2]-yt)) % 2){
					nt = X[i][0];
					xt = X[i][1];
					yt = X[i][2];
				} else {
					ans = "No";
					break;	
				}
			} else {
				ans = "No";
				break;
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 22088
n = int(input())
x = list(map(int, input().split()))

mini, maxi = min(x), max(x)
min2, max2 = mini**2*n, maxi**2*n
ans = max2 if max2 > min2 else min2

for p in range(mini, maxi+1):
  suma = 0
  for z in x:
    suma += (z-p)**2
  if ans > suma:
    ans = suma
    
print(ans)

Measured memory_bytes: 3064
'use strict'
let input = require("fs").readFileSync("/dev/stdin", "utf8");

let Nums = input.split('\n');
let amount = Nums[0]*1;
let arr = Nums[1].split(" ").map(x => x*1);
let sum = arr.reduce((x,a)=> { return a+=x });
// 差についての十分に大きい暫定最小値
let min = 5050;
let tempSum = 0;
let restSum = 0;
for(let i =0; i < amount; i++){
  tempSum += arr[i];
  restSum = sum - tempSum;
  if(Math.abs(tempSum - restSum) < min){
      min = Math.abs(tempSum - restSum);
  }
}

console.log(min);

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;//(cost,to)
using vP = vector<P>;
using vvP= vector<vP>;

const int INF = 1001001001;


int main(){
    int n;cin>>n;
    
    map<string, int> mp;
    
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    
    vector<string> t={"AC", "WA", "TLE", "RE"};
    
    rep(i,4)cout<<t[i]<<" x "<<mp[t[i]]<<endl;
    
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	long long n,cnt=0;
	while(cin>>n&&n!=0){
		cnt=0;
		while(n!=1){
			if(n%2==0){
				n=n/2;
				cnt++;
			}else{
				n=n*3+1;
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  bool a[n+1][3];
  memset(a,0,sizeof(a));
  for(int i=0; i<3; i++) {
    int m;
    cin >> m;
    for(int j=0,x; j<m; j++) {
      cin >> x;
      x--;
      a[x][i]=1;
    }
  }
  int cnt=0;
  for(int i=0; i<n; i++) {
    if(!a[i][0]&&a[i][2]||a[i][1]&&a[i][2]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3092
from sys import stdin, stdout  

X,Y,A,B,C = [int(c) for c in input().split()]

p= [int(c) for c in input().split()]
q= [int(c) for c in input().split()]
r= [int(c) for c in input().split()]

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p=p[:X]
q=q[:Y]
    
p.sort()
q.sort()
res=sum(p)+sum(q)

i=j=0

for k,val in enumerate(r):
    if(i<len(p) and j<len(q)):
        if(val<=p[i] and val <= q[j]):
            break
        elif(val>p[i] and val<q[j]):
            res=res+val-p[i]
            i=i+1
        elif(val<p[i] and val>q[j]):
            res=res+val-q[j]
            j=j+1
        elif(val>p[i] and val>q[j]):
            if(p[i]>q[j]):
                res=res+val-q[j]
                j=j+1
            else:
                res=res+val-p[i]
                i=i+1
    elif(i<len(p) and j==len(q)):
        if(val<=p[i]):
            break
        elif(val>p[i]):
            res=res+val-p[i]
            i=i+1
    elif(i==len(p) and j<len(q)):
        if(val<=q[j]):
            break
        elif(val>q[j]):
            res=res+val-q[j]
            j=j+1
    elif(i==len(p) and j==len(q)):
        break
        
print(res)

Measured memory_bytes: 22992
#include <bits/stdc++.h>
using namespace std;
int dp[100000]={0};
int fun(int arr[], int n){
    dp[0]=0;
    dp[1]= abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++){
        int option1=dp[i-1]+abs(arr[i]-arr[i-1]);
        int option2=dp[i-2]+abs(arr[i]-arr[i-2]);
        dp[i]=min(option1,option2);
    }
    //for(int i=0;i<n;i++) cout<<dp[i]<<" ";
    return dp[n-1];
}
int main(){
  int n;
  cin>>n;
  int arr[n+1];
  for(int i=0;i<n;i++) cin>>arr[i];
  cout<<fun(arr,n)<<endl;

}


Measured memory_bytes: 1024
def main():
    from sys import stdin
    input = stdin.readline

    n, m, r = map(int, input().split())
    l = list(map(int, input().split()))
    for i in range(r):
        l[i] -= 1
    d = [[float('inf')] * n for _ in range(n)]
    for _ in range(m):
        i, j, k = map(int, input().split())
        d[i-1][j-1] = k
        d[j-1][i-1] = k

    # Warshall-Floyd algorithm
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

    # full search
    # 8! = 40320
    from itertools import permutations

    answer = float('inf')
    for i in permutations(l):
        ans = 0
        for j in range(r-1):
            ans += d[i[j]][i[j+1]]
        if ans < answer:
            answer = ans

    print(answer)

main()

Measured memory_bytes: 74644
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

long comb(long n, long r){
  if(r>n-r) r=n-r;
  long p=1;
  for (long i=1; i<=r; i++) p=p*(n-i+1)/i;
  return p;
}

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

  vector<long> vec(n);
  rep(i,n) cin>>vec[i];
  sort(all(vec), greater<long>());

  long acc=0;
  rep(i,a) acc += vec[i];
  printf("%.7Lf\n", (long double)acc/a);

  int d=0;
  while(a+d<n && vec[a-1]==vec[a+d]) d++;
  int c=0;
  while(a-c-1>=0 && vec[a-c-1]==vec[a-1]) c++;

  if(a<n && vec[0]==vec[a]){
    long ans=0;
    for(int s=a; s<=b && vec[a-1]==vec[s-1]; s++) ans += comb(c+d,s);
    cout << ans << endl;
  } else cout << comb(c+d, c) << endl;

  return 0;
}


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

using namespace std;

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

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

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

    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (v[i] > c[i] ? v[i] - c[i] : 0);
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
import math
import statistics
n = int(input())
a = list(map(int,input().split()))
a = [aa-i-1 for i, aa in enumerate(a)]
answer = n*10**20
median_low = statistics.median_low(a)
median_high = statistics.median_high(a)

for m in (median_low,median_high):
  ans=0
  for aa in a:
    ans += abs(aa-m)
  answer = min(ans,answer)
print(answer)


Measured memory_bytes: 27244
X, K, D = map(int, input().split())
if X < 0:
  X = -X
a = X // D
b = X - a*D
ans = 0
if a < K:
  if (K - a) % 2 == 0:
    ans = b
  else:
    ans = D - b
else:
  ans = X - K*D
  
print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define mod 1000000007
#define F first
#define S second


int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a>c)
	{
		swap(a,c);
		swap(b,d);
	}

	if(b>=c)
	{
		cout<<min(b,d)-c<<endl;
	}
	else
	{
		cout<<0<<endl;
	}
}  

Measured memory_bytes: 256
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define REP(i, n) for(int i = 0; i < n; i++) //普通のループ
#define REPR(i, n) for(int i = n; i >= 0; i--) //逆ループ
#define FOR(i, m, n) for(int i = m; i < n; i++) //最初の数値を指定したループ

//型名省略
typedef long long ll;

using namespace std;

int main(){
    ll N, R, rate;
    
    cin >> N >> R;
    if(N<1 || N>100){
        return 1;
    }
    if(R<0 || R> 4112){
        return 1;
    }

    if(N<10){
        rate = R+100*(10-N);
    }else{
        rate = R;
    }

    cout << rate;

    return 0;
}

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

int main() {
  int n,k,ans=1;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  if (n == k) {
    cout << ans << endl;
    return 0;
  } else {
    n -= k;
    k--;
    while(n>0) {
      ans++;
      n -= k;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3780
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    
    string s;
    cin>>s;
    ll n=s.size();
    map<ll,ll> mp;
    rep(i,n){
        mp[s[i]-'a']++;
    }
    rep(i,26){
        if(mp[i]%2!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256