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

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int64_t ans = 1e18;
    for(int ab = 0; ab <= 2 * max(X, Y); ab += 2) {
        int64_t a = max(0, X - ab / 2);
        int64_t b = max(0, Y - ab / 2);
        ans = min(ans, a * A + b * B + ab * C);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
const ll mod = 1000000007;
int find_set(vector<int> &parent, int v) 
{
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent, parent[v]);
}
 
void make_set(vector<int> &parent, vector<int> &siz, int v) 
{
    parent[v] = v;
    siz[v] = 1;
}
 
void union_sets(vector<int> &parent, vector<int> &siz, int a, int b) 
{
    a = find_set(parent, a);
    b = find_set(parent, b);
    
    if (a != b) 
    {
        if (siz[a] < siz[b])
            swap(a, b);
        parent[b] = a;
        siz[a] += siz[b];
    }
}
int main()
{
	SPEED
	int n, m;
	cin >> n >> m;

	vector<int> parent(n+1);
	vector<int> siz(n+1);

	for (int i = 0; i < n+1; ++i)
	{
		make_set(parent, siz, i);
	}

	int a, b;
	for (int i = 0; i < m; ++i)
	{
		cin >> a >> b;
		if (find_set(parent, a) != find_set(parent, b))
		{
			union_sets(parent, siz, a, b);
		}
	}

	int ans = INT_MIN;
	for (int i = 0; i < n+1; ++i)
	{
		ans = max(ans, siz[i]);
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 4788
import itertools
N = int(input())
l = [i for i in range(N)]
x = [0] * N
y = [0] * N
total = 0
for i in range(N):
    x[i], y[i] = map(int, input().split())

for v in itertools.permutations(l, N):
    totali = 0
    for i in range(len(v)-1):
        totali += ((x[v[i]] - x[v[i+1]])**2 + (y[v[i]] - y[v[i+1]])**2)**0.5

    total += totali

for i in range(1, N+1):
    total /= i

print(total)

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

using namespace std;
#define ll long long
#define int ll
#define m_p make_pair


int32_t main() 
{
	int n;
	cin >> n;
	
	for (int a=1;a<=3500;a++)
	{
		//cout << a << endl;
		for (int b=1;b<=3500;b++)
			if (4*a*b-n*a-n*b > 0)
				if ((n*a*b)%(4*a*b-n*a-n*b) == 0)
				{
					return cout << a << " "<< b << " "<<n*a*b/(4*a*b-n*a-n*b),0;
				}
			
	}

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
serial = [[0]*N for _ in range(N)]
c = 0

for i in range(N):
    for j in range(i+1, N):
        serial[i][j] = c
        serial[j][i] = c
        c += 1
        
ins = [0]*(N*(N-1)//2)
outs = defaultdict(list)

for i in range(N):
    for j in range(1, N-1):
        s = serial[i][A[i][j-1]-1]
        t = serial[i][A[i][j]-1]
        ins[t] += 1
        outs[s].append(t)

q = deque([i for i in range(N*(N-1)//2) if ins[i]==0])
ans = 0

while True:
    if len(q)==0:
        break
    
    nq = deque([])
    
    while q:
        v = q.popleft()
        
        for nv in outs[v]:
            ins[nv] -= 1
            
            if ins[nv]==0:
                nq.append(nv)
    
    ans += 1
    q = nq

if ins!=[0]*(N*(N-1)//2):
    print(-1)
    exit()
    
print(ans)

Measured memory_bytes: 137984
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    l=list(range(a,b+1))
    cnt=0
    for i in range(len(l)):
        if str(l[i])==str(l[i])[::-1]:
            cnt+=1
    print(cnt)
resolve()

Measured memory_bytes: 6516
n = int(input())
a = [n]
index = 0

for i in range(1, 1000000):
    if a[i - 1] % 2 == 0:
        m = a[i - 1] / 2
    else:
        m = 3 * a[i - 1] + 1
    if m in a:
        index = i + 1
        break
    a.append(m)
print(index)

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

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

	string alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";

	for (int i = 0; i < A.size(); i++) {
		for (int j = 0; j < 26; j++) {
			if (alph[j+3] == A[i]) {
				cout << alph[j];
			}
		}
	}

	cout << endl;
	return 0;
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int n;
  cin >> n;
  cout << "ABC" << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K,i,x,sum=0;
  cin >> N;
  cin >> K;
  
  for(i=0;i<N;i++){
    cin >> x;
    if(x<=(K-x)) sum=sum+2*x;
    else sum=sum+2*(K-x);
  }
  cout << sum <<endl;
}

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

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

    int count = 0;

    for (int i = 0; i < (s.size() + 1) / 2; i++){
        if (s[i] != s[(s.size() - 1) - i]){
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#include <random>
#define INF 1000000007
using namespace std;

int main(void){
	int n,temp;
	cin >> n;
	int ans=0;
	for(int i=0; i<n; i++){
		cin >> temp;
		while(temp%2==0){
			ans++;
			temp/=2;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define ff first
#define ss second
#define pb push_back

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 100005;

int main(){
	int n;
	char s[N];
	scanf("%d", &n);
	scanf("%s", s);
	int ans = 0;
	for(int i = 0; i < n-2; i++){
		if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

typedef long long ll;
typedef std::pair<ll, ll> ii;
typedef std::pair<ll, ii> i3;

const int ms = 100100;

int par[ms];

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

void make_union(int a, int b)
{
	a = get_par(a);
	b = get_par(b);
	par[b] = a;
}

int main()
{
	int n;
	while(std::cin >> n)
	{
		std::vector<ii> a, b;
		for(int i = 0; i < n; i++)
		{
			par[i] = i;
			int x, y;
			std::cin >> x >> y;
			a.push_back(ii(x, i));
			b.push_back(ii(y, i));
		}
		std::sort(a.begin(), a.end());
		std::sort(b.begin(), b.end());
		std::priority_queue<i3, std::vector<i3>, std::greater<i3> > hp;
		for(int i = 1; i < n; i++)
		{
			hp.push(i3(a[i].first - a[i - 1].first, ii(a[i].second, a[i - 1].second)));
			hp.push(i3(b[i].first - b[i - 1].first, ii(b[i].second, b[i - 1].second)));
		}
		ll ans = 0;
		while(!hp.empty())
		{
			ii to = hp.top().second;
			int cost = hp.top().first;
			hp.pop();
			if(get_par(to.first) != get_par(to.second))
			{
				make_union(to.first, to.second);
				ans += cost;
			}
		}
		std::cout << ans << '\n';
	}
}

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

set<int> p[101];

int main() {
  int n, ans, m, pp;
  while(cin>>n, n) {
    ans = -1;
    for (int i=0; i<n; ++i) {
      p[i].clear();
      cin>>m;
      for (int j=0; j<m; ++j) {
        cin>>pp; p[i].insert(pp);
      }
    }

    set<int> target;
    cin>>m;
    for (int i=0; i<m; ++i) {
      cin>>pp; target.insert(pp);
    }

    for (int i=0; i<n; ++i) {
      bool ok = true;
      for (set<int>::iterator it = target.begin(); it != target.end(); ++it) {
        if (p[i].find(*it) == p[i].end()) ok = false;
      }
      if (ok) {
        if (ans == -1) ans = i+1;
        else ans = -2;
      }
    }

    if (ans < 0) ans = -1;
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1628
import sys

n, *xyh = map(int, sys.stdin.read().split())
xyh = list(zip(*[iter(xyh)] * 3))

def contradict(cx, cy, ch, x, y, h):
    return max(ch - abs(x - cx) - abs(y - cy), 0) != h

def main():
    for x, y, h in xyh:
        if h: x0, y0, h0 = x, y, h; break
    cand = []
    for cx in range(101):
        for cy in range(101):
            ch = h0 + abs(cx - x0) + abs(cy - y0)
            for x, y, h in xyh:
                if contradict(cx, cy, ch, x, y, h): break
            else:
                cand.append((ch, cx, cy))
    cand.sort(reverse=True)
    res = cand[0]
    print(res[1], res[2], res[0])

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

int main(){
    ll n,m,v,p;
    cin >> n >> m >> v >> p;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.rbegin(),a.rend());
    vector<ll> s(n+1);
    rep(i,n){
        s[i+1] += a[i];
        s[i+1] += s[i];
    }
    ll res = 0;
    res += p;
    for(int i=p;i<n;i++){
        if(a[p-1] > a[i]+m)break;
        ll T = p-1;
        T += n-i;
        ll hoge = v-T;
        if(hoge<=0){
            res++;
            continue;
        }
        // cerr << i << " " << hoge << " "<< m*hoge  << " " <<  (a[i]+m)*(i-p+1)   - (s[i]-s[p-1]) << endl;
        if(m*hoge - ( (a[i]+m)*(i-p+1)   - (s[i]-s[p-1]) ) <= 0){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4428
import math
def calc_zyouzyo(siki) :
    j = 0
    while True :
        if '*' not in siki and '/' not in siki:
            break
        if siki[j] == '*' :
            siki[j-1] = str(int(siki[j-1]) * int(siki[j+1]))
            del siki[j:j+2]
        elif siki[j] == '/' :
            if (int(siki[j-1]) < 0 and int(siki[j+1]) < 0) or (int(siki[j-1]) >= 0 and int(siki[j+1]) >= 0) :
                siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]))
            else :
                if int(siki[j-1]) % int(siki[j+1]) == 0 :
                    siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]))
                else :
                    siki[j-1] = str(int(siki[j-1]) // int(siki[j+1]) + 1)
            del siki[j:j+2]
        else :
            j += 1
    if len(siki) == 1 :
        return(siki[0])
    else :
        return(siki)
    
def calc_kagen(siki) :
    j = 0
    while True :
        if '+' not in siki and '-' not in siki:
            break
        if siki[j] == '+' :
            siki[j-1] = str(int(siki[j-1]) + int(siki[j+1]))
            del siki[j:j+2]
        elif siki[j] == '-' :
            siki[j-1] = str(int(siki[j-1]) - int(siki[j+1]))
            del siki[j:j+2]
        else :
            j += 1
    if len(siki) == 1 :
        return(siki[0])
    else :
        return(siki)

def calc(siki) :
    siki = calc_zyouzyo(siki)
    siki = calc_kagen(siki)
    return(siki)

n = int(input())
for i in range(n) :
    tmp = list(input())
    siki = []
    num = ''
    for j in range(len(tmp)) :
        if tmp[j] in ['*', '/', '+', '-', '(', ')', '='] :
            if num != '' :
                siki.append(num)
            siki.append(tmp[j])
            num = ''
        else :
            num += tmp[j]
    siki.remove('=')
    j = 0
    while True :
        if j == len(siki) or ')' not in siki:
            break
        stack = []
        if siki[j] == ')' :
            for k in range(j-1,-1, -1) :
                if siki[k] == '(' :
                    break
                else :
                    stack.append(siki[k])
            stack.reverse()
            siki[k] = calc(stack)
            del siki[k+1 : j+1]
            j = k+1
        else :
            j += 1
    siki = calc(siki)
    print(siki)


Measured memory_bytes: 5668
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 100100
#define No printf("No\n");return 0;
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int T,n,a[N],vis[N],p[N],tot; 
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
	}
	bool ok=true;
	tot=0;
	for(int i=1;i<=n;i++){
		if(a[i]>=n||a[i]<1){
			ok=false;
			break;
		}
		++vis[a[i]];
		if(vis[a[i]]==1){
			p[++tot]=a[i];
			if(tot>2){
				ok=false;break;
			} 
		}
	}
	if(!ok){
		No;
	}
	bool tmp=false;
	if(tot==1){
		if(p[1]==n-1||p[1]<=n/2){
			tmp=true;
		}
	}
	else{
		if(p[1]>p[2])swap(p[1],p[2]);
		if(p[1]+1==p[2]){
			int res=p[2]-vis[p[1]];
			if(res>=1&&res<=vis[p[2]]/2){
				tmp=true;
			}
		}
	}
	if(tmp){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 640
x, y, z, k = map(int, input().split())
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]
Z = [int(i) for i in input().split()]
X.sort(reverse=1)
Y.sort(reverse=1)
Z.sort(reverse=1)

answer = [i+j for i in X[:k] for j in Y[:k]]
answer.sort(reverse=1)

answer2 = [i+j for i in Z[:k] for j in answer[:k]]
answer2.sort(reverse=1)

for p in answer2[:k]:
    print(p)

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

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

    int ary[201];
    for (int i=0; i<N; i++) cin >> ary[i];

    int count = 0;
    while (true) {
        bool isAllEven = true;
        for (int i=0; i<N; i++) {
            if (ary[i] % 2 != 0) {
                isAllEven = false;
                break;
            }
            ary[i] = ary[i]/2;
        }
        if (!isAllEven) {
            break;
        }
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define vmax_p(v) max_element(v.begin(), v.end())
#define vmin_p(v) min_element(v.begin(), v.end())
#define vmax_idx(v) distance(v.begin(), vmax_p(v))
#define vmin_idx(v) distance(v.begin(), vmin_p(v))
#define vcopy(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

// floor(x): truncate

// 2進数変換
// string s = bitset<20>(x).to_string();

using namespace std;
using ll = long long;

void displayVec(vector<int> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int binarySearch(vector<int> v, int target)
{
    int left = -1;
    int right = v.size();

    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (v[mid] >= target)
        {
            right = mid;
        }
        else
        {
            left = mid;
        }
    }

    if (right < v.size() && v[right] == target)
    {
        return right;
    }
    return -1;
}

int main(int argc, const char *argv[])
{
    int a, b;
    cin >> a >> b;

    if (a >= 13)
    {
        cout << b << endl;
    }
    else if (a >= 6 && a <= 12)
    {
        cout << b / 2 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
S = str(input())
pntr = 0
flg = 1


while pntr <= len(S) - 1:
	if S[pntr] == "d":
		if pntr + 7 <= len(S) - 1 and S[pntr + 7] == "a":
			if S[pntr : pntr + 5] == "dream":
				pntr += 5
			else:
				flg = 0
				break
		elif pntr + 6 <= len(S) - 1 and S[pntr : pntr + 7] == "dreamer":
			pntr += 7
		elif pntr + 4 <= len(S) - 1 and S[pntr : pntr + 5] == "dream":
			pntr += 5
		else:
			flg = 0
			break
			
	elif S[pntr] == "e":
		if pntr + 5 <= len(S) - 1 and S[pntr : pntr + 6] == "eraser":
			pntr += 6
			# print("eraser")
		elif pntr + 4 <= len(S) - 1 and S[pntr : pntr + 5] == "erase":
			pntr += 5
			# print("erase")
		else:
			flg = 0
			break
	else:
		flg = 0
		break
		
if flg:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 40560
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c[i];

  int ans = 0;
  int cnt;
  rep(i, 1 << h) {
    rep(j, 1 << w) {
      cnt = 0;
      rep(s, h) {
        if (i & 1 << s) continue;
        rep(t, w) {
          if (j & 1 << t) continue;
          if (c[s][t] == '#') ++cnt;
        }
      }
      if (cnt == k) ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if(a==0){
    cout<<"1"<<endl;
}else if(b==0){
    cout<<"2"<<endl;
}else if(c==0){
    cout<<"3"<<endl;
}else if(d==0){
    cout<<"4"<<endl;
}else{
    cout<<"5"<<endl;
}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define MAXN 1000000
#define MOD 1000000007
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
namespace IO {
    const int MX = 4e7;
    char buf[MX]; int c, sz;
    void begin() {
        c = 0;
        sz = fread(buf, 1, MX, stdin);
    }
    inline bool read(int &t) {
        while(c < sz && buf[c] != '-' && (buf[c] < '0' || buf[c] > '9')) c++;
        if(c >= sz) return false;
        bool flag = 0; if(buf[c] == '-') flag = 1, c++;
        for(t = 0; c < sz && '0' <= buf[c] && buf[c] <= '9'; c++) t = t * 10 + buf[c] - '0';
        if(flag) t = -t;
        return true;
    }
}
int cnt;
typedef pair<int,int>p;
map<p,int>mp;
struct edge
{
    int to,cost;
};
vector<edge>v[100010*10];
int getid(int x,int y)
{
    p pp=make_pair(x,y);
    if(mp.count(pp))return mp[pp];
    mp[pp]=++cnt;
    return cnt;
}
int dis[100010*10];
void dijkstra()
{
    fill(dis+1,dis+cnt+1,INF);
    dis[1]=0;
    priority_queue<p,vector<p>,greater<p> >q;
    q.push(p(0,1));
    while(!q.empty())
    {
        p temp=q.top();
        q.pop();
        int w=temp.first;int id=temp.second;
        if(w>dis[id])continue;
        for(int i=0;i<v[id].size();i++)
        {
            edge &e=v[id][i];
            if(w+e.cost<dis[e.to])
            {
                dis[e.to]=w+e.cost;
                q.push(p(dis[e.to],e.to));
            }
        }
    }
}
int main()
{
    IO::begin();
    int n,m,x,y,z;
    //scanf("%d%d",&n,&m);
    IO::read(n);IO::read(m);
    cnt=n;
    while(m--)
    {
        //scanf("%d%d%d",&x,&y,&z);
        IO::read(x);IO::read(y);IO::read(z);
        int temp1,temp2;
        temp1=getid(x,z);temp2=getid(y,z);
        v[x].push_back(edge{temp1,1});
        v[temp1].push_back(edge{x,1});
        v[temp1].push_back(edge{temp2,0});
        v[temp2].push_back(edge{temp1,0});
        v[temp2].push_back(edge{y,1});
        v[y].push_back(edge{temp2,1});
    }
    dijkstra();
    if(dis[n]==INF)printf("-1\n");
    else printf("%d\n",dis[n]/2);
    return 0;
}


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

using namespace std;

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

#define int ll


main(){
	int n,d;
	cin >> n >> d;
	int x[n],y[n];
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i];
	}

	int ans = 0;
	for(int i=0;i<n;i++){
		if(x[i]*x[i]+y[i]*y[i]<=d*d) ans++;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

map<char, bool> mp;

int main()
{
    string s;
    cin >> s;
    if(s.size() < 26){
        for(int i = 0; i < s.size(); i++){
            mp[s[i]] = 1;
        }
        for(char x = 'a'; x <= 'z'; x++){
            if(!mp[x]){
                cout << s << x; return 0;
            }
        }
    }
    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1; return 0;
    }
    int pos;
    char qe;
    for(int i = 0; i <= 25; i++){
        bool b = 0;
        for(char j = s[i] + 1; j <= 'z'; j++){
            if(!mp[j]){
                b = 1;
                qe = j;
                break;
            }
        }
        if(b){
            pos = i;
        }
        mp[s[i]] = 1;
    }
    for(int i = 0; i < pos; i++){
        cout << s[i];
    }
    cout << qe;
}


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

int get_sum_of_each_digit(int num) {
  int sum = 0;
  while (num > 0) {
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

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

  if (N % get_sum_of_each_digit(N) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B=0,C,D=0,E,F=INF;
  cin >> A;
  for(int i=1;i<A;i++){
    B=A-i;
    E=i;
    C=0;
    D=0;
    rep(j,INF){
      C+=B%10;
      if(10>B)break;
      B/=10;
    }
    rep(j,INF){
      D+=E%10;
      if(10>E)break;
      E/=10;
    }
    F=min(D+C,F);
  }
  Out(F);
}


Measured memory_bytes: 256
using System;

namespace ABC173_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int[] count = { 0, 0, 0, 0 };
            string[] results = { "AC", "WA", "TLE", "RE" };

            if(n != 0)
            {
                count = ReadResults(n, results);
            }

            for (int k = 0; k < results.Length; k++)
            {
                Console.WriteLine(results[k] + " x " + count[k]);
            }
        }

        static int[] ReadResults(int n, string[] results)
        {
            int[] count = new int[results.Length];

            for (int i = 0; i < n; i++)
            {
                string result = Console.ReadLine();

                for (int j = 0; j < results.Length; j++)
                {
                    if (result == results[j])
                    {
                        count[j]++;
                    }
                }
            }

            return count;
        }
    }
}

Measured memory_bytes: 30648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.StringJoiner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] l1 = br.readLine().split(" ");

		int n = Integer.parseInt(l1[0]);
		int x = Integer.parseInt(l1[1]);
		int y = Integer.parseInt(l1[2]);

//		int[][] cost = new int[n][n];
		
		int[] cnt = new int[n];

		for(int i = 0; i < n; ++i) {
			for(int j = i; j< n; ++j) {

				int dis = Math.abs(j - i);

				int temp = Math.abs(x -1 -i) + Math.abs(y -1 -j) + 1;
				if(temp < dis) {
					dis = temp;
				}
				temp = Math.abs(y-1 -i) + Math.abs(x-1 - j) + 1;
				if(temp < dis) {
					dis = temp;
				}
				
//				cost[i][j]=dis;
				cnt[dis]++;
			}
		}		

		for(int k = 1; k< n;++k) {
			System.out.println(cnt[k]);
		}
	}
}

Measured memory_bytes: 22160
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
#include<string>
#include<map>
#include<bits/stdc++.h>

using namespace std;


#define mod(cans) cans%10**9+7
#define cin_pl(x,y) for(int i=0;i<x;i++){cin>>y[i];}
#define pl_twin(x,y,z) for(int i=0;i<x;i++){cin>>y[i]>>z[i];}
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define repx(i,n,x) for(int i=x;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define st(s) size_t size = s.length()
#define prians(Answer) cout<<Answer<<"\n"
#define com_div(x,Co) for(int i=1;i<x+1;i++){if(x%i==0){Co++;}}
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}s

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int>> matrix;
typedef pair<int,int> pr;
typedef vector<pr> vpt;
typedef greater<int> gi;
typedef vector<double> vd;

int main()
{
    int n;
    cin>>n;
    vd v(n);
    cin_pl(n,v);
    sort(all(v));
    double tmp=v[0];
    int d=0;
    rep1(i,n)
    {
        tmp=(tmp+v[i])/2;
    }
    prians(tmp);
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
#include<fstream>
#include <chrono>
using namespace std;
typedef long long LL;


int main(void)
{
	/*
	chrono::system_clock::time_point start, end;
	start = chrono::system_clock::now();
	end = chrono::system_clock::now();
	double time = static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
	//printf("time %lf[ms]\n", time);
	*/

	LL D;
	LL man=0;
	
	vector<int> c(27);
	vector<LL> last(27,0);
	cin >>D;
	for (int i = 1; i <= 26; i++) {
		cin >>c[i];
	}
	vector<vector<LL>> s(D+1,vector<LL>(27,0));
	vector<LL> t(D+1);
	for (int i = 1; i <= D; i++) {
		for (int j = 1; j <= 26; j++) {
			cin >>s[i][j];
		}
	}
	for (int i = 1; i <= D; i++) {
		cin >>t[i];
	}

	for (int i = 1; i <= D; i++) {
		LL dis = 0;
		man+=s[i][t[i]];
		last[t[i]] = i;
		for (int j = 1; j <= 26; j++) {
			dis+=(c[j]*(i-last[j]));
		}
		man-=dis;
		cout <<man<<endl;
	}
	return 0;
}


Measured memory_bytes: 3688
import java.util.Scanner;

public class Main {

    public static int ans(int stones[], int n, int k){
        int storage[] = new int[n+1];
        storage[1] = 0;
        for(int i=2; i<=n; i++){
           storage[i] = Integer.MAX_VALUE;

           for(int j=i-1; j>=1 && (i-j)<=k; j--){
               storage[i] = Math.min(Math.abs(stones[i] - stones[j]) + storage[j], storage[i]);
           }

        }
        return storage[n];
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int stones[] = new int[n+1];
        for(int i=1; i<=n; i++){
            stones[i] = sc.nextInt();
        }
        System.out.println(ans(stones, n, k));
    }
}

Measured memory_bytes: 51040
#include <bits/stdc++.h>
using namespace std;
 
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
 
#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
 
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
 
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  
  VI xs(N);
  REP(i,N) cin >> xs[i];
  RSORT(xs);
  
  double ans = C * 1. / A;
  int acc = 0;
  REP(i,N){
	acc += xs[i];
	maxi(ans, (C + acc) * 1. / (A + B * (i+1)));
  }
  cout << (int)ans << endl;
 
  return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
inline int sd(int num) {
	int sum = 0;
	while(num) {
		sum += num % 10;
		num /= 10;
	}
	return sum;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,A,B;
	cin >> n >> A >> B;
	int sum = 0;
	int i = 1;
	while(i<=n) {
		int x = sd(i);
		if(x <= B && x >= A) {
			sum += i;
		}
		i++;
	}
	cout << sum << endl;
	return 0;
}


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

using namespace std;

int main() {
  string str;
  int cntB = 0, cntA = 0;
  
  getline(cin, str);
  
  for(int i = 0; i < 3; i++) {
    if (str[i] == 'A') {
    	cntA++;
    } else {
		cntB++;
    }
  }
  
  if(cntA != 0 && cntB != 0) {
	cout << "Yes" << endl;
  } else {
	cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <utility>
#include <tuple>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

ll mod = 1e9+7;

int main(){
    double n,m;
    cin >> n >> m;
    double den = pow(2,m);
    int ans = 100 * (n - m) * den;
    ans += 1900 * m * den;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define rhl (1000000007)

using namespace std;

int f[2010][2010][2],n,k;

int main(){
  cin>>n>>k,f[n][0][0]=1;
  for (RG int i=n;i;--i)
    for (RG int j=n;j>=0;--j){
      (f[i][j][1]+=f[i][j+1][1])%=rhl;
      for (RG int p=0;p<2;++p){
	(f[i-1][j+1][0]+=f[i][j][p])%=rhl;
	(f[i-1][j][1]+=f[i][j][p])%=rhl;
      }
    }
  for (RG int i=n-k-1;i>0;--i) (f[0][n-k][1]<<=1)%=rhl;
  cout<<f[0][n-k][1]; return 0;
}


Measured memory_bytes: 31616
n = int(input())
a = list(input())
b = list(input())
c = list(input())
ans = 0
for i in range(n):
  if len(set([a[i],b[i],c[i]])) == 1:
    continue
  elif len(set([a[i],b[i],c[i]])) == 2:
    ans += 1
  else:
    ans += 2
print(ans)

Measured memory_bytes: 38384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SZ(x) ((int)((x).size()))

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

template<class TH>
void _dbg(const char* name, TH val){
    clog << name << ": " << val << endl;
}
template<class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
    while(*names != ',') clog << *names++;
    clog << ": " << curr_val << ", ";
    _dbg(names+1, vals...);
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
    #define dbg_arr(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg(...)
    #define dbg_arr(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int H, W, N;
    cin >> H >> W >> N;
    vector<pair<int,int>> vec(N);
    for (int i = 0; i < N; i++) cin >> vec[i].second >> vec[i].first;
    int res = H;
    sort(vec.begin(), vec.end());
    int diff = 0;
    for (int i = 0; i < N; i++) {
        int x = vec[i].second, y = vec[i].first;
        if (x-y == diff) diff++;
        else if (x-y > diff) res = min(res, x-1);
    }
    cout << res << "\n";
}


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

//ABC174D

int main(void) {
  int n, k, i, cou=0, tmp;
  scanf("%d ", &n);
  int w[n];
  char rw;
  for(i=0; i<n; i++){
    scanf("%c", &rw);
    if(rw=='W') ++cou;
    w[i]=cou;
    //printf("%c  ", rw);
    //printf("w[%d]=%d\n", i, w[i]);
  }
  //printf("cou=%d\n", cou);
  if(n-cou-1<0) printf("0");
  else printf("%d", w[n-cou-1]);
}

Measured memory_bytes: 2476
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MaxN = 1e5 + 5;
LL cnt[MaxN];
int n;
LL k;
int main(){
	while(~scanf("%d %lld", &n, &k)){
		for(int i = 1; i <= n; i++){
			int a, b;
			scanf("%d %d", &a, &b);
			cnt[a] += b;
		}
		for(int i = 1; i <= 100000; i++){
			k -= cnt[i];
			if(k <= 0){
				printf("%d\n", i);
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	REP(i, N) {
		int a, b;
		cin >> a >> b;
		int ans = a % b;
		if (ans == 0)ans = b;
		cout << ans << endl;
	}

	return 0;
}




Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
 
  if (a * b % 2 == 0 ) {
    cout << "Even" << endl;
  }
      else{
        cout << "Odd" << endl;
  }
    
}

Measured memory_bytes: 256
n = int(input())
bott = 0
rem = -1
for i in range(10000):
    bott = i*(i+1)//2
    bott2 = (i+1)*(i+2)//2
    if(bott<=n and n<bott2):
        rem = bott2-n
        bott = i
        break
ans = []
for i in range(bott+1):
    if(i+1 != rem):
        ans.append(i+1)

for i in ans:
    print(i)


Measured memory_bytes: 41584
#import math
#import numpy as np

N =int(input())
#=input()
#=map(int, input().split())
h =list(map(int, input().split()))
#=[input(), input()]

dp = [0] * N
dp[1] = abs(h[1] - h[0])

for i in range(2, N):
    t1 = dp[i - 1] + abs(h[i] - h[i - 1])
    t2 = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = min(t1, t2)

print(dp[-1])


Measured memory_bytes: 20648
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a,b,gyo0=0,gyo1=0,re0=0,re1=0,h,w,count;
    string s;
    cin>>a>>s>>b;
    if(s=="+"){
        cout<<a+b<<'\n';
    }
    else{
        cout<<a-b<<'\n';
    }
    return(0);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
long long A[500050];
int n,count=0;


void merge(long long A[],int left,int mid,int right){
  int n1=mid-left+1;
  int n2=right-mid;
  long long L[n1],R[n2];
  for(int i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=A[mid+1+i];
  }
  //L[n1]=R[n2]=INFINITY;
  int i=0,j=0,k=left;
  while(i<n1&&j<n2){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }else{
      A[k]=R[j];
      j++;
      count++;
    }k++;
  }
  while(i<n1){
    A[k]=L[i];
    i++;
    k++;
    count++;
  }
  while(j<n2){
    A[k]=R[j];
    j++;
    k++;
    count++;
  }
}

void mergeSort(long long A[],int left,int right){
  if(left<right){
    int mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid+1,right);
    merge(A,left,mid,right);
  }
}

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%lld",&A[i]);
  }
  mergeSort(A,0,n-1);
  for(int i=0;i<n;i++){
    printf("%lld",A[i] );;
    if(i!=n-1)printf(" ");
  }
  printf("\n%d\n", count);
  return 0;
}



Measured memory_bytes: 9580
import java.util.*;

public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {

    String S = sc.next();
    int len = S.length();
    int minDif = Integer.MAX_VALUE;

    for (int i=0; i<=len-3; i++) {
      minDif = Math.min(minDif, Math.abs(Integer.parseInt(S.substring(i, i+3)) - 753));
    }

    System.out.println(minDif);

  }
}

Measured memory_bytes: 21844
k=int(input())
import math
if k==1:
    print(1)
else:
    s1=k*(k+1)//2
    s2=k-1
    for i in range(2,k):
        for j in range(i+1,k+1):
                s2+=math.gcd(i,j)
    s2=s2*6
    s3=0
    if k>2:
        for a in range(1,k-1):
            for b in range(a+1,k):
                for c in range(b+1,k+1):
                    s3+=math.gcd(math.gcd(a,b),c)
        s3=s3*6
    print(s1+s2+s3)


Measured memory_bytes: 9212
using System;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < 50000; i++)
        {
            if ((int)(i * 1.08) == n)
            {
                Console.WriteLine(i);
                break;
            }
            if (i == 49999) Console.WriteLine(":(");
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>
#include <cmath>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;


int main() {
	int n, d;
	cin >> n >> d;
	pair<int, int> xy;
	int x, y;
	int count = 0;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		if (d >= sqrt(pow(x, 2.0) + pow(y, 2.0))) {
			count++;
		}
	}

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


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

const int N = 200000 + 5;

char str[N];
struct Node{
    char c[2], d[2];
}node[N];

int main ()
{
    int n, q;
    cin >> n >> q >> str + 1;
    for (int i = 1; i <= q; ++i) cin >> node[i].c >> node[i].d;
    int ans1 = 0, ans2 = 0;
    for (int i = q; i >= 1; --i) {
        if (ans1 != n) {
            if (node[i].c[0] == str[ans1 + 1] && node[i].d[0] == 'L') {
                ++ans1;
            }
            else if (ans1 && node[i].c[0] == str[ans1] && node[i].d[0] == 'R'){
                --ans1;
            }
        }
        if (ans2 != n) {
            if (node[i].c[0] == str[n - ans2] && node[i].d[0] == 'R') {
                ++ans2;
            }
            else if (ans2 && node[i].c[0] == str[n - ans2 + 1] && node[i].d[0] == 'L') {
                --ans2;
            }
        }
    }
    cout << n - min(n, ans1 + ans2) << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	vector<int>B(N);
	vector<int>C(N);
	int AA = 0, BB = 0;
	for (int i = 0;i < N;i++) {
		cin >> A.at(i);
	}
	for (int i = 0;i < N;i++) {
		cin >> B.at(i);
	}
	for (int i = 0;i < N;i++) {
		C.at(i) = i + 1;
	}
	int k = 0;
	do {
		k++;
		if (A == C) AA = k;
		if (B == C) BB = k;
	} while (next_permutation(C.begin(),C.end()));
	if (AA - BB < 0) {
		cout << (AA - BB) * -1 << endl;
	}
	else {
		cout << AA - BB << endl;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const int N = 3000;
long double cache[N][N];  // Index , H 
long double P[N];
int n;
long double  dp( int i , int  h )
{
	if( i==0 ) return h==0;
	long double &ans = cache[i][h];
	if( ans!=-1 )return ans;
	ans=0;
	if( h ) ans+=P[i]*dp(i-1,h-1);
	if( i-h ) ans+=(1.00-P[i])*dp(i-1,h);
	
	return ans;
}
	
int32_t main()
{
	IOS
	for(int i=0;i<N;i++)
	for(int j=0;j<N;j++)
	cache[i][j]=-1;
	
	cin >> n ;
	for(int i=1;i<=n;i++)
	cin>>P[i];
	
	long double ans = 0;
	for(int h=n;h>n-h;h--)
	{
		ans+=dp(n,h);
	}
	cout << fixed << setprecision(10) << ans <<endl;
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n,x,y;
   cin >> n >> x >> y;
   vector<int> val(n);
   f(i,1,n+1){
      f(j,i+1,n+1){
         int dist = min({abs(x-i)+abs(y-j)+1,abs(i-j)});
         val[dist]++;
      }
   }
   f(i,1,n){
      cout << val[i] << '\n';
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
        string s;
        cin >> s;
        
        const int n = s.size();
        
        auto check = [&](int l, int r) {
                for (int i = l, j = r-1; i <= j; i++, j--) {
                        if (s[i] != s[j]) return false;
                }

                return true;
        };

        if (check(0, n) && check(0, (n-1)/2) && (check((n+3)/2-1, n))) {
                cout << "Yes" << endl;
        } else {
                cout << "No" << endl;
        }

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    int n;
    cin >> n;
    int x[n];
    rep(i,n) cin >> x[i];

    ll ans = MOD;
    for (int i = 1; i <= 100; i++){
        ll tmp = 0;
        for (int j=0; j < n; j++){
            tmp += pow(x[j] - i, 2);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
    
}





//              g++ -std=c++1z


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=998244353;
const int N=2e5+5;
int fact[N];
int invfact[N];

int power(int a,int x){
	if(x==0) return(1);
	int p=power(a,x/2);
	p=(p*p)%M;
	if(x%2==0) return(p);
	return((p*a)%M);
}

void pre(){
	fact[0]=1;
	for(int i=1;i<N;i++){fact[i]=(fact[i-1]*i)%M;}
	for(int i=0;i<N;i++){invfact[i]=power(fact[i],M-2);}
}

int ncr(int n,int r){
	if(r>n) return(0);
	if(n==r||r==0) return(1);
	if(r<0) return(0);
	int ans=fact[n];
	ans=(ans*invfact[n-r])%M;
	ans=(ans*invfact[r])%M;
	return(ans);
}

int32_t main(){
    IOS;
    int n,m,k;
    cin>>n>>m>>k;
    pre();
    int ans=0;
    for(int i=0;i<=k;i++){
    	int res=ncr(n-1,i);
    	res=(res*m)%M;
    	res=(res*power(m-1,n-1-i))%M;
    	ans=(ans+res)%M;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6780
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;
const ll MOD (1e9+7);
const ll INF (2e9);
const int MAX_N (200001);

int main(void) {
    char *s=new char[100005];
    cin>>s;
    int ans=0;
    // cout<<s[0]<<s[1]<<"a"<<s[2]<<"A";
    for(int i=0;s[i+1]!='\0';i++){
        // cout<<i;
        if(s[i]!=s[i+1]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void){
	int i, j;
	int h, w;
	char in[101][101];
	
	scanf("%d %d", &h, &w);
	for(i=0; i< h; i++){
		//printf("(%d,%d)", i,j);
		scanf("%s", in[i]);
	}
	putchar('\n');
	
	for(i=0; i< h; i++){
		printf("%s", in[i]);
		putchar('\n');
		printf("%s", in[i]);
		putchar('\n');	
	}
		
	putchar('\n');
	return 0;
}

Measured memory_bytes: 128