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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)((n)-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

struct UnionFind {
    int n;
    vector<int> dat;
    UnionFind(int size): n(size), dat(size, -1) { }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (dat[y] < dat[x]) swap(x, y);
            dat[x] += dat[y];
            dat[y] = x;
        }
        return x != y;
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    int root(int x){
        return dat[x] < 0 ? x : dat[x] = root(dat[x]);
    }
    int size(int x){
        return -dat[root(x)];
    }
};

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,m; cin >> n >> m;

    auto uf = UnionFind(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
    }
    set<int> roots;
    rep(i,n){
        roots.insert(uf.root(i));
    }
    cout << roots.size()-1 << endl;
    return 0;
}

Measured memory_bytes: 7748
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 120000;

vector<int> eds[MAXN];

int p[MAXN];
int q[MAXN];

int n;

int was[MAXN];

int dfs1(int v) {
	was[v] = 1;
	for (int u: eds[v]) {
		if (q[u] == -1) {
			q[u] = v;
			p[v] = u;
			return 1;
		}
	}
	for (int u: eds[v]) {
		if (!was[q[u]]) {
			if (dfs1(q[u])) {
				q[u] = v, p[v] = u;
				return 1;
			}
		}
	}
	return 0;
}
vector<int> go[MAXN];
int up[MAXN];

void dfs2(int v, int p) {
	was[v] = 1;
	up[v] = p;
	for (int u: go[v]) {
		if (!was[u])
			dfs2(u, v);
	}
}

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int c;
		cin >> c;
		for (int j = 0; j < c; ++j) {
			int x;
			cin >> x;
			--x;
			eds[i].push_back(x);
		}
	}
	fill(p, p + n, -1);
	fill(q, q + n, -1);
	int ch = 0;
	do {
		ch = 0;
		memset(was, 0, sizeof(was));
		for (int i = 0; i < n - 1; ++i) {
			if (was[i] == 0 && p[i] == -1)
				ch |= dfs1(i);
		}
	} while (ch);
	for (int i = 0; i < n - 1; ++i) {
		if (p[i] == -1) {
			cout << -1 << "\n";
			return 0;
		}
	}
	int st = -1;
	for (int i = 0; i < n; ++i)
		if (q[i] == -1) {
			st = i;
			q[i] = n - 1;
		}
	p[n - 1] = st;
	for (int i = 0; i < n - 1; ++i) {
		for (int u: eds[i]) {
			if (q[u] != i) {
				go[q[u]].push_back(i);
			}
		}
	}
	memset(was, 0, sizeof(was));
	dfs2(n - 1, -1);
	for (int i = 0; i < n - 1; ++i) {
		if (!was[i]) {
			cout << -1 << "\n";
			return 0;
		}
	}
	for (int i = 0; i < n - 1; ++i) {
		cout << p[i] + 1 << " " << p[up[i]] + 1 << "\n";
	}
	return 0;
}




Measured memory_bytes: 16896
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ABC = [list(map(int, input().split())) for _ in range(m)]
dist = [-float("inf")]*(n+1)
dist[1] = 0
for i in range(n):
  for a, b, c in ABC:
    if dist[b] < dist[a]+c:
      if i == n-1 and b == n:
        print("inf")
        exit()
      dist[b] = dist[a]+c
ans = dist[n]
print(ans)

Measured memory_bytes: 3444
N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

total = 0
for i in range(len(B_list)):
    # print("A:", A_list)
    # print("B:", B_list)
    result = A_list[i] - B_list[i]
    if result > 0:
        total += B_list[i]
        A_list[i] = A_list[i] - B_list[i]
        B_list[i] = 0
        continue

    total += A_list[i]
    B_list[i] = B_list[i] - A_list[i]
    A_list[i] = 0

    result = A_list[i+1] - B_list[i]
    if result > 0:
        total += B_list[i]
        A_list[i+1] = A_list[i+1] - B_list[i]
        B_list[i] = 0
    else:
        total += A_list[i+1]
        A_list[i+1] = 0
        B_list[i] = B_list[i] - A_list[i+1]

# print("A:", A_list)
# print("B:", B_list)

print(total)

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

int cnt[30];

int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++) {
      int food;
      cin >> food;
      cnt[food - 1]++;
    }
  }
  int res = 0;
  for (int i = 0; i < M; i++) {
    if (cnt[i] == N) res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
int n;
ll dp[202][202];
char c[300];

int main(void){
	scanf("%d%*c",&n);
	for(int i=0;i<n;i++){
		scanf("%c%*c",&c[i]);
	}
	dp[0][0]=1;
	for(ll i=0;i<n;i++){
		for(ll j=0;j<=i;j++){
			if(c[i]=='-')dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
			if(c[i]=='U'){
				dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j])%MOD;
				dp[i+1][j]=(dp[i+1][j]+dp[i][j]*j)%MOD;
			}
			if(c[i]=='D'){
				if(j>0){
					dp[i+1][j-1]=(dp[i+1][j-1]+dp[i][j]*j*j)%MOD;
				}
				dp[i+1][j]=(dp[i+1][j]+dp[i][j]*j)%MOD;
			}
		}
	}
	printf("%lld\n",dp[n][0]);
	return 0;
}

Measured memory_bytes: 3076
def f(n):
    return n//2 if n%2==0 else 3*n + 1

s = int(input())
a = {s}
n = s
for i, _ in enumerate(range(1000000), 2):
    n = f(n)
    if n not in a:
        a.add(n)
    else:
        print(i)
        break

Measured memory_bytes: 3060
while 1:
  day = [0] * 100
  n, q = map(int, raw_input().split())
  if not n:
    break
  for i in range(n):
    data = map(int, raw_input().split())
    for j in range(1, len(data)):
      day[data[j] - 1] += 1
  m = max(day) 
  if m >= q:
    for i in range(0, len(day)):
      if day[i] == m:
        print i + 1
        break
  else:
    print 0

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	int *a = new int[n];
	int *b = new int[n];
	int *c = new int[n - 1];

	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n - 1) cin >> c[i];

	int ans = b[a[0] - 1];
	for(int i = 1; i < n; i++){
		ans += b[a[i] - 1];
		if(a[i] == a[i - 1] + 1) ans += c[a[i - 1] - 1];
	}

	cout << ans << endl;

	delete a, b, c;
	return 0;
}

Measured memory_bytes: 256
using System;
class Program{
	static void Main(){
		string s;
		while((s = Console.ReadLine()) != null){
			int ans = 0, n = int.Parse(s);
			if(n<=36){
				if(n>18) n = 36-n;
				ans = (n+1)*(n+2)*(n+3)/6;
				if(n>9) ans -= 2*(n-9)*(n-8)*(n-7)/3;
			}
			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 9044
#include <algorithm>
#include <deque>
#include <iostream>
#include <numeric>
#include <cmath>
using namespace std;

int main()
{

    long long  N,K,ans=0;
    cin >> N>>K;

    for (long long  i = K; i <=N+1; i++)
    {
        long long mi = i*(i-1)/2;
        long long ma = N*(N+1)/2-(N-i)*(N-i+1)/2;
        ans += ma - mi+1;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

const ll INF = 100000000005;
const int MAXN = 100001;
const int S = 0, T = 1;
const int FW = 0, BW = 1;
const int SFW = 0, SBW = 1, TFW = 2, TBW = 3;
vector<vector<ll>> d(2, vector<ll>(MAXN));
int n[2];
ll bs(ll x, int st, int dir) {
  int stdir = 2 * st + dir;
  int ok = (dir == FW ? -1 : n[st]);
  int ng = (dir == FW ? n[st] : -1);

  while(abs(ok - ng) > 1) {
    int mid = (ok + ng) / 2;
    if((1 - 2 * dir) * (x - d[st][mid]) > 0)
      ok = mid;
    else
      ng = mid;
  }
  if(ng == (dir == FW ? 0 : n[st] - 1))
    return (2 * dir - 1) * INF;
  return d[st][ok];
}

int main() {
  int q;
  cin >> n[S] >> n[T] >> q;
  rep(st, 2) dbg(n[st]);
  rep(st, 2) d[st].resize(n[st]);
  rep(i, n[S]) cin >> d[S][i];
  rep(j, n[T]) cin >> d[T][j];

  vector<ll> x(q);
  rep(k, q) cin >> x[k];

  rep(k, q) {
    ll nb[4];
    rep(st, 2) rep(dir, 2) {
      nb[st * 2 + dir] = bs(x[k], st, dir);
    }
    ll ans = INF;
    ans = min(ans, abs(x[k] - min(nb[SFW], nb[TFW])));
    ans = min(ans, abs(2 * nb[SFW] - nb[TBW] - x[k]));
    ans = min(ans, abs(2 * nb[TFW] - nb[SBW] - x[k]));
    ans = min(ans, abs(2 * nb[SBW] - nb[TFW] - x[k]));
    ans = min(ans, abs(2 * nb[TBW] - nb[SFW] - x[k]));
    ans = min(ans, abs(max(nb[SBW], nb[TBW]) - x[k]));
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3696
def use_fast_io():
    global input
    import io
    import sys
    f = io.BytesIO(sys.stdin.buffer.read())
    input = f.readline
use_fast_io()


from scipy.sparse.csgraph import floyd_warshall
import numpy as np

N, M, L = map(int, input().split())
graph = [[0] * N for _ in range(N)]
for _ in range(M):
    s, t, w = map(int, input().split())
    if w <= L:
        graph[s-1][t-1] = graph[t-1][s-1] = w
graph = floyd_warshall(graph, directed=False)
graph = floyd_warshall(graph <= L, directed=False)
graph[np.isinf(graph)] = 0

Q = int(input())
ans = []
for _ in range(Q):
    s, t = map(int, input().split())
    ans.append(int(graph[s-1][t-1]) - 1)
print(*ans, sep='\n')


Measured memory_bytes: 20412
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC086A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            var sum = 0;
            foreach (var item in N)
            {
                sum += int.Parse(item.ToString());
            }

            if (sum % 9 == 0)
                System.Console.WriteLine("Yes");
            else
                System.Console.WriteLine("No");
        }
    }
}


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


Measured memory_bytes: 2472
import fractions

A, B = map(int, input().split())

g = fractions.gcd(A, B)

def prime_decompose(x):
    decomposed = []
    for i in range(2,int(pow(x,0.5))+1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed

g_dec = set(prime_decompose(g))
print(len(g_dec)+1)

Measured memory_bytes: 64364
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define MAXN 200005

int n,ans;
int a[MAXN],b[MAXN];

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]);
    int x[MAXN],y[MAXN];
    for(int k=0;k<=28;k++)
    {
        for(int i=1;i<=n;i++)
        {
            x[i]=a[i]%(1<<(k+1));
            y[i]=b[i]%(1<<(k+1));
        }
        sort(y+1,y+n+1);
        int t=0;
        for(int i=1;i<=n;i++)
        {
            int s1=lower_bound(y+1,y+n+1,(1<<(k))-x[i])-y-1;
            int t1=lower_bound(y+1,y+n+1,2*(1<<(k))-x[i])-y-1;
            int s2=lower_bound(y+1,y+n+1,3*(1<<(k))-x[i])-y-1;
            int t2=lower_bound(y+1,y+n+1,4*(1<<(k))-x[i])-y-1;
            t+=t1-s1+t2-s2;
        }
        if(t&1)
            ans+=(1<<k);
    }
    printf("%d",ans);
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define inf (int)1e18+7

int n, whole;
int a[17][17];

int cost[(1LL << 17) + 1LL];

string toBin(int x) {
  string res = "";
  for (int i = 31; i >= 0; i --) {
    if ((x & (1 << i)) != 0) {
      res += "1";
    } else {
      res += "0";
    }
  }
  return res;
}

void preprocess () {
  memset(cost, 0, sizeof cost);
  for (int mask = 0; mask <= whole; mask ++) {
    for (int i = 0; i < n; i ++) {
      if ((mask & (1 << i)) != 0) {
        for (int j = i + 1; j < n; j ++) {
          if ((mask & (1 << j)) != 0) {
            cost[mask] += a[i][j];
          }
        }
      }
    }
  }
}
int dp[(1LL << 17) + 1LL];

void solve() {
  dp[0] = 0;
  for (int mask = 1; mask <= whole; mask ++) {
    vector<int > target;
    for (int i = 0; i < n; i ++) {
      if ((mask & (1 << i)) != 0) {
        target.push_back(i);
      }
    }
    for (int sub = 0; sub < (1 << (int)(target.size())); sub ++) {
      int submask = 0;
      for (int i = 0; i < (int)target.size(); i ++) {
        if ((sub & (1 << i)) != 0) {
          submask |= (1 << target[i]);
        }
      }
      dp[mask] = max(dp[mask], cost[submask] + dp[mask ^ submask]);
    }
  }
  cout << dp[whole] << endl;
}


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

  cin >> n;
  whole = (1LL << n) - 1LL;
  for (int i = 0; i < n; i ++) {
    for (int j = 0; j < n; j ++) {
      cin >> a[i][j];
    }
  }

  preprocess();

  solve();

  return 0;
}


// dp[mask] = for (cur 0 to mask) calc(cur) + dp[mask ^ cur];

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

template <typename T>
using lim = numeric_limits<T>;

const int MOD = 1e9+7;
const int N = 3e5;

ll fact[N];
ll invfact[N];

ll modpow(ll b, ll e){
	ll ans = 1;
	while(e){
		if (e&1) ans = ans*b%MOD;
		e >>= 1;
		b = b*b%MOD;
	}
	return ans;
}

ll inv(ll b){
	return modpow(b, MOD-2);
}

void compute(){
	fact[0] = 1;
	for (ll i = 1; i < N; i++) fact[i] = i*fact[i-1]%MOD;
	
	invfact[N-1] = inv(fact[N-1]);

	for (ll i = N-2; i >= 0; i--) invfact[i] = invfact[i+1]*(i+1)%MOD;
}

ll perm(ll n, ll k){
	return fact[n]*invfact[n-k]%MOD;
}
ll choose(ll n, ll k){
	return perm(n,k)*invfact[k]%MOD;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	compute();
	ll h, w, a, b;
	cin >> h >> w >> a >> b;
	ll ans = 0;
	
	for (int i = b; i < w; i++) ans = (ans+choose(i+h-a-1,i)*choose(w-i+a-2,a-1))%MOD;

	cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<cmath>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<ll>

#define pll pair<long long,long long>
#define pis pair<int,string>
#define mp make_pair
#define F first
#define S second
#define T int tt; cin>>tt; while(tt--)
#define fastio ios_base::sync_with_stdio(false);

#define endl '\n'
#define all(a) (a).begin(), (a).end()
#define display(x) for(auto i : x) cout << i << " "; cout << '\n';
#define input(x) for(int i = 0; i < n; i++) cin >> x[i];
#define make(x,y) memset(a, y, sizeof(x))
#define FO1(i,n) for (int i = 1; i <= n; i++)
#define FO(i,n) for (int i = 0; i < n; i++)
#define mod 1000000007
#define Y cout<<"YES"<<endl;
#define N cout<<"NO"<<endl;

using namespace std;

int main()
{
    string s; cin>>s;
    if(s=="BBB" || s=="AAA")  cout<<"No";
    else cout<<"Yes";
   	return 0;
}














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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
const double PI=3.14159265358979323846;

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







int main() {


  cout<<fixed<<setprecision(10);

  ll n,k; cin>>n>>k;
  vint h(n); rep(i,n) cin>>h[i];

  ll max = LLONG_MAX;
  vint dp(n, max);
  dp[0] = 0;
  rep(i,n){
    rep(j,k){
      chmin(dp[min(n-1, i+j+1)], dp[i] + abs(h[min(n-1, i+j+1)] - h[i]));
    }
  }
  cout<<dp[n-1]<<endl;

}

//


Measured memory_bytes: 1792
N = input()

ichi = N[-1]
hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']
bon = ['3']

if ichi in hon:
    unit = 'hon'
elif ichi in pon:
    unit = 'pon'
elif ichi in bon:
    unit = 'bon'

print(unit)

Measured memory_bytes: 61804
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    bool ans=false;
    for(int i=1;i<=9;i++)
        if(n%i==0 && n/i<10)
            ans=true;
    if(ans)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
# 解説思い出し AC
import sys
def main():
    mod = 10**6+3
    cum_prod = [0]
    p = 1
    for i in range(1, 2*mod):
        p = p * i % mod
        cum_prod.append(p)
    Q = int(input())
    Ans = []
    for x, d, n in zip(*[iter(map(int, sys.stdin.read().split()))]*3):
        if d==0:
            Ans.append(pow(x, n, mod))
        elif n>=mod or x==0:
            Ans.append(0)
        else:
            x_d = x * pow(d, mod-2, mod) % mod
            Ans.append(pow(d, n, mod) * cum_prod[x_d + n-1] % mod * pow(cum_prod[x_d-1], mod-2, mod) % mod)
    print("\n".join(map(str, Ans)))

main()


Measured memory_bytes: 71932
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please
 
 
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
 
 
	int N = 0;
	char c;
	while ((c = getchar_unlocked()) >= '0') N = N * 10 + c - '0';
 
	int dp[3000] = {};
	dp[0] = 1;
	const int mod = 1e9 + 7;
	rep(i, N - 1) {
		if (getchar_unlocked() == '<') {
			int k = 0;
			int tmp = dp[0];
			dp[0] = 0;
			rep(j, i + 1) {
				k += tmp;
				if (k >= mod) k -= mod;
				tmp = dp[j + 1];
				dp[j + 1] = k;
			}
		}
		else {
			int k = 0;
			for (int j = i; j >= 0; j--) {
				k += dp[j];
				if (k >= mod) k -= mod;
				dp[j] = k;
			}
		}
	}
	ll kotae = 0;
	rep(i, N) kotae += dp[i];
	printf("%lld", kotae % mod);
 
	Would you please return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<size_t> a(M);
    vector<char> b(M);
    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i];
        --a[i];
    }
    
    bool x = true;
    for (int i = 0; i <1000; ++i) {
        string s = to_string(i);
        if (s.size() != N)continue;
        for (int j = 0; j<M; ++j) {
            if (s[a[j]] != b[j])x = false;
        }
        if (!x)x = true;
        else {
            cout << s << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i, n, l[100], x;
	int sum = 0;

	scanf("%d %d", &n, &x);

	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}

	for (i = 0; i < n; i++) {
		sum += l[i];
		if (x < sum)break;
	}

	printf("%d\n", i + 1);

	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
   if(A<=9&&B<=9){
   	System.out.print(A*B);
   }else{
   	System.out.print(-1);
 	 }
  }
}

Measured memory_bytes: 23764
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m;
  cin>>n>>m;
  
  vector<int> A(n+1,0),B(n+1,0);
  
  int p;
  string s;
  rep(i,m){
    cin>>p>>s;
    if(A[p] == 0 && s=="WA") B[p]++;
    else if(A[p] == 0 && s=="AC") A[p]=1;
  }
  int sum1=0,sum2=0;
  
  rep(i,n+1){
    sum1+=A[i];
    if(A[i]==1) sum2+=B[i];
  }
  
  cout<<sum1<<" "<<sum2<<endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
 
void strsort(std::string &s)
{
    std::vector<char> tmp;
    for(int i=0; i<s.size(); i++) tmp.push_back(s[i]);
    std::sort(tmp.begin(), tmp.end());
    for(int i=0; i<s.size(); i++) s[i] = tmp[i];
}
 
int main()
{
    int N;
    std::cin >> N;
    std::vector<std::string> s(N);
    for(int i=0; i<N; i++){
        std::cin >> s[i];
        strsort(s[i]);
    }
 
    std::sort(s.begin(), s.end());
    long long count = 0;
    std::vector<long long> vcount;
    for(int i=0; i<N; i++){
        count++;
        if(i == N-1 || (i != N-1 && s[i] != s[i+1])) {
            vcount.push_back(count); count = 0;
        }
    }
    long long ans = 0;
    for(auto &&itr = vcount.begin(); itr != vcount.end(); itr++){
        long long c = (*itr);
        ans += c * (c-1) / 2;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 8572
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
typedef vector<int> VI;
typedef vector<pr> VP;
typedef vector<string> VS;
typedef vector<vector<int>> VV;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
const int inf = 1e17;
const int MAXN = 200001;
int fast_pow(int x, int y, int p);




void solve() {
	string s;cin>>s;
	cout<<s[0]<<s[1]<<s[2];

}


int32_t main() {

	IOS;
	int test = 1;
	// cin>>test;
	for (int i = 1; i <= test; i++) {
        // cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}
int fast_pow(int x, int y, int p) {
	int res = 1;
	x = x % p;
	while (y > 0) {
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
{
	unsigned int l, r;	// input
	unsigned int ans;
	unsigned long long i, j;	// for loop
	unsigned int t;

	// input
	cin >> l >> r;

	// calc
	ans = 2019;
	for (i = l; i < r; i++) {
		for (j = i + 1; j <= r; j++) {
			t = (i * j) % 2019;
			if (t < ans) { ans = t; }
			if (0 == ans) { break; }
		}
		if (0 == ans) { break; }
	}

	// output
	cout << ans << endl;

	return 0;
}

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

long long dp[ 100+5 ][ 100000+5 ], pre[ 100+5 ][ 100000+5 ];
const long long mod = 1E9 + 7;

int main() {
	int n, k;
	while ( cin >> n >> k ) {
		memset( dp, 0, sizeof (dp) );
		memset( pre, 0, sizeof (pre) );
		
		long long candy[ n+5 ];
		
		for (int i = 1; i <= n; ++i) cin >> candy[i];
		
		for (int i = 0; i <= n; ++i) dp[i][0] = pre[i][0] = 1;
		for (int i = 0; i <= k; ++i) pre[0][i] = 1;
		
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= k; ++j) {
				long long all = pre[ i-1 ][j];
				long long sub = ( j-candy[i]-1 >= 0 ? pre[ i-1 ][ j-candy[i]-1 ] : 0 );
				
				dp[i][j] += all-sub+mod;
				dp[i][j] %= mod;
				
				pre[i][j] = pre[i][ j-1 ] + dp[i][j];
				pre[i][j] %= mod;
			}
		}
		
		cout << dp[n][k] << '\n';
	}
}


Measured memory_bytes: 164352
#define _USE_MATH_DEFINES
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>


using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const long long int INF=1001001001001001001;
int N,K;
vector<int> D;

int main(){
	int x,y;
	scanf("%d %d",&x,&y);
	int ans=0;
	if(x==0){
		if(y>0)ans=abs(y);
		if(y<0)ans=abs(y)+1;
		printf("%d\n",ans);
	}
	if(y==0){
		if(x>0)ans=abs(x)+1;
		if(x<0)ans=abs(x);
		printf("%d\n",ans);
	}
	if(x>0&&y>0){
		if(x>y){ans=x-y+2;}
		if(x<y)ans=y-x;
		printf("%d\n",ans);
		return 0;
	}
	if(x>0&&y<0){
		ans=abs(abs(y)-x)+1;
		printf("%d\n",ans);
		return 0;
	}
	
	if(x<0&&y>0){
		ans=min(abs(abs(x)-y)+1,y-x);
		printf("%d\n",ans);
		return 0;
	}
	if(x<0&&y<0){
		if(x>y){ans=x-y+2;}
		if(x<y)ans=y-x;
		printf("%d\n",ans);
		return 0;
	}
}

Measured memory_bytes: 256
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

import sys
C = [nl(), nl(), nl()]

d1 = C[0][0] - C[0][1]
d2 = C[1][0] - C[1][1]
d3 = C[2][0] - C[2][1]
if d1 != d2 or d2 != d3:
    print('No')
    sys.exit()

d4 = C[0][0] - C[0][2]
d5 = C[1][0] - C[1][2]
d6 = C[2][0] - C[2][2]
if d4 != d5 or d5 != d6:
    print('No')
    sys.exit()

e1 = C[0][0] - C[1][0]
e2 = C[0][1] - C[1][1]
e3 = C[0][2] - C[1][2]
if e1 != e2 or e2 != e3:
    print('No')
    sys.exit()

e4 = C[0][0] - C[2][0]
e5 = C[0][1] - C[2][1]
e6 = C[0][2] - C[2][2]
if e4 != e5 or e5 != e6:
    print('No')
    sys.exit()


print('Yes')


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        while(sc.hasNext()){
            if(isPrime(sc.nextInt())) count++;
        }
        System.out.println(count);
        sc.close();
    }

    private static boolean isPrime(int x) {
        if(x == 2) return true;
        else if (x < 2 || x % 2 == 0)return false;
        int i = 3;
        while(i <= Math.sqrt(x)){
            if(x % i == 0) return false;
            i = i + 2;
        }
        return true;
    }

}


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

int main(){
	int N, i=2;
	cin >> N;
	if(N<2){
		cout << N;
		return 0;
	} else {
		while(i<=N){
			i = i*2;
		}
	}
	cout << i/2;
}

Measured memory_bytes: 256
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,K = inputlist()
V = inputlist()
n = min(N,K)
ans = 0
from collections import deque
for a in range(n+1):
    for b in range(n+1):
        li = []
        if a+b > n:
            continue
        c = K-(a+b)
        que = deque(V)
        for i in range(a):
            k = que.popleft()
            li.append(k)
        for j in range(b):
            s = que.pop()
            li.append(s)
        li.sort()
        index = 0
        for i in range(len(li)):
            if li[i] < 0:
                index +=1
        na = min(index,c)
        suma = sum(li[na:])
        ans = max(ans,suma)

print(ans)

Measured memory_bytes: 43612
//#error "tsurai"

#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <queue>
#include <functional>

template <class T>
using pqueue=std::priority_queue<T, std::vector<T>, std::less<T>>;

struct Edge {
  size_t a, b;
  intmax_t c, d;
  Edge(size_t a, size_t b, intmax_t c, intmax_t d): a(a), b(b), c(c), d(d) {}
};

using Graph=std::vector<std::vector<Edge>>;

bool ok(const Graph &g, double p) {
  std::vector<bool> visited(g.size());

  double S=0;
  for (size_t i=0; i<g.size(); ++i)
    for (const auto &e: g[i]) {
      S += e.d - e.c*p;
    }
  S *= 0.5;
  //fprintf(stderr, "p: %.12f, S: %.16f\n", p, S);

  pqueue<std::pair<double, size_t>> q;
  q.emplace(0, 0);
  //visited[0] = true;
  double res=0;
  while (!q.empty()) {
    double w=q.top().first;
    size_t v=q.top().second;
    q.pop();
    if (visited[v]) continue;
    visited[v] = true;
    res += w;
    //fprintf(stderr, "w: %.12f\n", w);

    for (const auto &e: g[v]) {
      if (visited[e.b]) continue;
      double nw=e.d-p*e.c;
      q.emplace(nw, e.b);
    }
  }

  return res >= S;
}

int main() {
  size_t n, m;
  scanf("%zu %zu", &n, &m);

  if (n == m+1)
    return !printf("0\n");

  Graph g(n);
  for (size_t i=0; i<m; ++i) {
    size_t a, b;
    intmax_t c, d;
    scanf("%zu %zu %jd %jd", &a, &b, &c, &d);

    g[a].emplace_back(a, b, c, d);
    g[b].emplace_back(b, a, c, d);
  }

  double lb=0, ub=1e12;
  for (int i=0; i<200; ++i) {
    double p=0.5*(lb+ub);
    (ok(g, p)? ub:lb) = p;
  }
  printf("%.12f\n", lb);
}



Measured memory_bytes: 3708
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a==0||b==0)
	{
		cout<<"Zero";
		return 0;
	}
	if(a>0&&b>0)
	{
		cout<<"Positive";
		return 0;
	}
	if(a<0&&b>0)
	{
		cout<<"Zero";
		return 0;
	}
	int n=abs(a-b);
	if(n%2==0)
	{
		cout<<"Negative";
	}
	else
	{
		cout<<"Positive";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,d,ans=0;
	scanf("%d%d",&m,&d);
	for(int i=1;i<=m;i++)
		for(int j=22;j<=d;j++)
		{
			int a=j/10,b=j%10;
			if(a*b==i&&a>=2&&b>=2) ans++;
		}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,m,i;
  double x=0;
  int y=0;
  int a[1000];
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    x+=a[i];
  }
 x=x/(4*m);
  for(i=0;i<n;i++){
    if(a[i]>=x)
      y++;
  }
  if(y>=m)
    printf("Yes");
  else
    printf("No");
  return 0;
}


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


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  el "\n";

int dx[] = { 0,0,1,-1,-1,-1,1,1 };
int dy[] = { 1,-1,0,0,-1,1,1,-1 };



template <class T> inline T biton(T n, T pos)
{
    return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
    return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
    return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
    while (b)
    {
        a = a % b;
        swap(a, b);
    }
    return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
    T ret = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            ret = (ret * p) % m;
        p = (p * p) % m;
    }
    return (T)ret;
};



#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif


void solve()
{
    long long n;
    cin>>n;

    long long res=(n/500ll)*1000l;

    debug(res);

    res+=((n%500ll)/5ll)*5ll;

    cout<<res<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;

    while (t--)
    {
        solve();
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

int main() {
	ll N, K; cin >> N >> K;
	vector<ll> H(N);
	ll s = 0;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
		s += H[i];
	}

	sort(H.begin(), H.end());
	reverse(H.begin(), H.end());
	ll sum = 0;
	if (K <= N) {
		for (int i = 0; i <= K - 1; i++) sum += H[i];
	}
	else {
		cout << 0 << endl;
		return 0;
	}
	cout << s - sum << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<limits.h>
#define MAX 500000
int s[MAX],count=0;
void merge(int, int,int);
void mergeSort(int,int);
int main(){
  int n,mid,left,right,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  mergeSort(0,n);
  for(i=0;i<n;i++){
    if(i!=n-1){
    printf("%d ",s[i]);
    }
    else printf("%d\n%d\n",s[i],count);
  }
}


void merge(int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int l[n1+1],r[n2+1];
  int i,j,k;
    for(i=0;i<n1;i++){
    l[i]=s[left+i];
  }
  for(i=0;i<n2;i++){
    r[i]=s[mid+i];
  }
   l[n1]=INT_MAX;
   r[n2]=INT_MAX;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(l[i]<=r[j]){
      count++;
      s[k]=l[i];
      i=i+1;
    }
    else{
      count++;

      s[k]=r[j];
      j=j+1;
    }
  }
  

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


}




Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int a,b,c;cin>>a>>b>>c;
  int cont=1;
  if(a!=b)cont++;
  if(b!=c&&c!=a)cont++;

  cout<<cont<<endl;
  return 0;
}


Measured memory_bytes: 256
// g++ -std=c++14

/*

Today might be the chance to grasp the chance to let your talent bloom.
May be tomorrow, the day after, or next year...
May be even when you are 30. I'm not sure if physique has anything to do with it
but if you think that it will never come, it probably never will.

- Tooru Oikawa.

*/


#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define inf 1000000000000000001
#define pii pair<int, int>
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

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

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

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

#define int ll

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    n = s.size();
    int ans =  0;
    for(int i = 0 ; i <= n-3 ; i++) {
        string t = s.substr(i,3);
        if(t == "ABC") {
            ans ++;
        }
    }
    cout << ans << endl;


}
int32_t main(){ _
    ll t;
    // cin >> t;
    t = 1;
    while(t--) solve();
}

Measured memory_bytes: 256
N = int(input())
from collections import defaultdict
import itertools

a = {}
a["M"] = 0
a["A"] = 0
a["R"] = 0
a["C"] = 0
a["H"] = 0

b = defaultdict(int)
b["M"] = 1
b["A"] = 1
b["R"] = 1
b["C"] = 1
b["H"] = 1
C = ["M","A","R","C","H"]

for i in range(N):
    s = input()
    if b[s[0]] == 1:
        a[s[0]] += 1
ans = 0        
for v in itertools.combinations(C, 3):
    ans += a[v[0]]*a[v[1]]*a[v[2]]
print(ans)



Measured memory_bytes: 43624
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}


signed main() {
	int k,t=0;
	cin >> k;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= k; j++) {
			for (int ii = 1; ii <= k; ii++) {
				t += gcd(gcd(i, j), gcd(j, ii));
			}
		}
	}
	cout << t << endl;
}





Measured memory_bytes: 3640
# include<stdio.h>
int main()
{
int a[3],i,j,temp;

for(i=0;i<3;i++)
scanf("%d",&a[i]);
for(i=0;i<3;i++){
for(j=0;j<=i;j++)
{
if(a[j]>a[i])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("%d %d %d\n",a[0],a[1],a[2]);

}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
typedef long long ll;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll N,tmp; cin >> N;
    map<int,int> mp;
    vector<int> A(N+50,0);
    REP(i,N) cin >> A[i];
    ll ans = 0;
    REP(i,N){
      ans += mp[i - A[i]];
      mp[i + A[i]]++;
    }
    cout << ans;
  	return 0;
}


Measured memory_bytes: 21156
#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

int main() {
	int N;
	string str;
	map<string, int> count;
	
	cin >> N;
	str.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> str;
		sort(str.begin(), str.end());
		count[str]++;
	}

	long long ans = 0;
	auto begin = count.begin(), end = count.end();
	for (auto iter = begin; iter != end; iter++) {
		ans += iter->second*((long long )iter->second - 1) / 2;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11264
H, W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(a) for a in input().split()] for _ in range(H)]
C = [[A[i][j] - B[i][j] for j in range(W)] for i in range(H)]
X = [[0] * (W) for _ in range(H)]
X[0][0] = (1 << 80 + C[0][0]) | (1 << 80 - C[0][0])
for i in range(H):
    for j in range(W):
        if i:
            X[i][j] |= (X[i-1][j] << 80 + C[i][j]) | (X[i-1][j] << 80 - C[i][j])
        if j:
            X[i][j] |= (X[i][j-1] << 80 + C[i][j]) | (X[i][j-1] << 80 - C[i][j])
s = bin(X[-1][-1] + (1<<13000))
mi = 1<<100
for i in range(len(s)):
    if s[-i-1] == "1":
        mi = min(mi, abs(i-(H+W-1)*80))
print(mi)

Measured memory_bytes: 53980
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    int n;
    cin>>n;
    int a,b;
    cin>>a>>b;
    
    int calA;
    cin>>calA;
    int cost=a;
    int cal=calA;
    
    vi topp;
    rep(i,n){
        int x;
        cin>>x;
        topp.pb(x);
    }
    sort(all(topp));
    reverse(all(topp));
    
    
    rep(i,topp.size()){
        if( cal/cost<=(cal+topp[i])/(cost+b) ){
            cal+=topp[i];
            cost+=b;
        }
        else break;
    }
    
    cout<<(int)(cal/cost)<<endl;
    
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    ll sumi;
    if(n==1 && m>1) cout << m-2 << endl;
    else if(m==1 && n>1) cout << n-2 << endl;
    else if(m==1 && n==1)cout<<  1 << endl;
    else cout << (n-2) * (m-2) << endl;
    
}

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 testcase ll tt; cin>>tt; while(tt--)
#define pb push_back
#define nn cout<<"\n"
#define MOD 1000000007
#define vll vector<ll>
#define here cout<<"I'm here\n";
template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
void vout(vector<ll> ans){
    for(auto ele:ans) cout<<ele;
}

int main() {
    SPEED;
    cout.precision(8);
    cout << fixed;
    ll t;
    cin>>t;
    vector<ll> v(t);
    for(auto &itr:v) cin>>itr;
    map<ll,ll> mp;
    set<ll> s;
    for(auto ele:v) {
        mp[ele]++;
        s.insert(ele);
    }
    // vector<ll> ansv;
    map<ll,ll> ansv;
    ll os=0;
    for(auto ele:s){
        // cout<<((mp[ele]*(mp[ele]-1))/2)<<" ";
        os+=((mp[ele]*(mp[ele]-1))/2);
    }
    // nn; cout<<os<<endl;
    for(auto ele:s){
        ll sum=0;
        if(mp[ele]>2){
            // cout<<"here";
            sum=os-((mp[ele]*(mp[ele]-1))/2)+(((mp[ele]-1)*(mp[ele]-2))/2);
        }
        
        else
        sum=os-((mp[ele]*(mp[ele]-1))/2);
        ansv[ele]=sum;
    }
    // for(auto ele:ansv) cout<<ele<<" ";
    for(auto ele:v){
        cout<<ansv[ele]<<endl;
    }
    return 0;
    
}

Measured memory_bytes: 24960
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <list>
#include <cmath>
#include <fstream>
#include <queue>
#include <sstream>
#include <algorithm>
#include <cstring>
using namespace std;
template <class T> void change(T &a, T &b)// 交&#25442;
{
	T temp;
	temp = a;
	a = b;
	b = temp;
}
template <class T> void quicksort(vector<T> &S,int a,int b) // 快速排序
{
     int x = a;
	 int y = b;
	 T mid = S[(a+b)>>1];
     while (x <= y)
     {
           while (S[x] < mid) x++;
           while (S[y] > mid) y--;
           if (x <= y)
           {
              change(S[x], S[y]);
              x++;
              y--;
           }
     }
     if (x < b) quicksort(S, x, b);
     if (y > a) quicksort(S, a, y);
}
vector<int> vi;
int main()
{
	vi.resize(10);
	for(int i = 0; i < 10; i++)
		cin >> vi[i];
	quicksort(vi,0,9);
	cout << vi[9] << endl;
	cout << vi[8] << endl;
	cout << vi[7] << endl;
	return 0;
}

Measured memory_bytes: 0
import sys
readline = sys.stdin.readline    
MOD = 998244353
N = int(readline())
A = list(map(int, readline().split()))
mA = max(A) + 1
T = [0]*mA
i2 = pow(2, MOD-2, MOD)


table = [0]*mA
table2 = [0]*mA
for a in A:
    table[a] = (table[a] + a)%MOD
    table2[a] = (table2[a] + a*a)%MOD
prime = [True]*mA
for p in range(2, mA):
    if not prime[p]:
        continue
    for k in range((mA-1)//p, 0, -1):
        table[k] = (table[k] + table[k*p])%MOD
        table2[k] = (table2[k] + table2[k*p])%MOD
        prime[k*p] = False

T = [(x1*x1-x2)*i2%MOD for x1, x2 in zip(table, table2)]

ans = 0
coeff = [0]*mA
for i in range(1, mA):
    k = T[i]
    l = - coeff[i] + pow(i, MOD-2, MOD)
    ans = (ans+l*k)%MOD
    for j in range(2*i, mA, i):
        coeff[j] = (coeff[j] + l)%MOD
print(ans)

Measured memory_bytes: 150592
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,j,n) for(int i=j;i<=n;i++)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    
    int a[n],b[m];
    cin>>a[0]>>b[0];
    f(i,1,n)
      cin>>a[i];
    
sort(a,a+n+1); 
    
    f(i,1,m)
      cin>>b[i];
      
sort(b,b+m+1);
    
    if(b[0]-(a[n]+1)>=0)
      cout<<"No War";
    else 
     cout<<"War";
} 

Measured memory_bytes: 3680