akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using lint = long long int;

int main()
{
    lint n;
    cin >> n;
    vector<lint> vc;
    rep(i,n-1)
    {
        int x;
        cin >> x;
        vc.push_back(x);
    }
    vector<lint> cnt(n);
    rep(i,n-1) cnt[(vc[i] - 1)]++;
    rep (i,n) cout << cnt[i] << endl;
    return 0;
}


Measured memory_bytes: 6348
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
#define vll vector<ll>
using namespace std;
struct custom_hash
{
	static uint64_t splitmix64(uint64_t x)
	{
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
};
#define safe_map unordered_map<ll, ll, custom_hash>

inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
ll power(ll x, ll y)
{
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}
void decToBinary(int n)
{
	// Size of an integer is assumed to be 32 bits 
	for (int i = 7; i >= 0; i--) {
		int k = n >> i;
		if (k & 1)
			cout << "1";
		else
			cout << "0";
	}
}
double compute(ll n, ll h, ll c)
{
	double ans = ((n + 1.00000) * h + n * c);
	ans /= 2.0000000000000 * n + 1;
	return ans;
}
ll count(ll n)
{
	return (2 * n) + 1;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	ll a,b;
	cin >> a >> b;
	cout << a * b;
	return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

ll calc(ll N) {
  if (N%2==0) {
    if ((N/2)%2==0) return N;
    else return N+1;
  } else {
    if (((N+1)/2)%2==0) return 0;
    else return 1;
  }
}

int main() {
  ll A,B;cin>>A>>B;

  if (A<=1) {
    OUT(B);
    return 0;
  }

  OUT((calc(A-1)^calc(B)));

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main{
  Scanner sc = new Scanner(System.in);	
 
  long mod = 1_000_000_000 + 7;
  
  public void run(){
    int s = sc.nextInt();
    
    long[] dp = new long[2001];
    Arrays.fill(dp,-1);
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 1;
    
    for(int i = 3; i < 2001;i++ ){
      dp[i] = 1;
      for(int j = 3; i-j >= 3;j++){
        dp[i] = (dp[i] + dp[j])%mod;
        
      }
    }
    System.out.println((dp[s])%mod);
  }
  public static void main(String[] args){
    Main m = new Main();
    m.run();
  }
}

Measured memory_bytes: 36256
n, m, k = map(int, input().split())
mod = 998244353

N = 10**5 * 2  # N!まで求める
fact  = [1, 1]  # 階乗の元テーブル
fact_inv = [1, 1]  # 階乗の逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル 1,2,,...の逆元を求めてる

# 計算 O(1)
def comb(n, r, mod):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

# 順列
def perm(n, r, mod):
    if (r<0 or r>n):
        return 0
    return fact[n] *  fact_inv[n-r] % mod

# 前処理 O(n)
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    fact_inv.append((fact_inv[-1] * inv[-1]) % mod)

ans = 0
for i in range(k+1):
    ans += comb(n-1, i, mod) * m * pow(m-1, n-i-1, mod)
    ans %= mod

print(ans)

Measured memory_bytes: 117804
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

numOpe = sum(Bs) - sum(As)

numA, numB = 0, 0
for A, B in zip(As, Bs):
    if A < B:
        numA += (B - A + 1) // 2
    elif A > B:
        numB += A - B

if numA <= numOpe and numB <= numOpe:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4596
import numpy as np

n = int(input())
jobs = [list(map(int, input().split())) for i in range(n)]

jobs.sort(key=lambda x:x[1])

flg = True

a, b = np.array(jobs).T

s = np.add.accumulate(a)
if sum(s > b):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 64224
x, y = map(int, input().split())
mod = 10 ** 9 + 7

cnt1 = cnt2 = 0
for i in range(x + 1):
    x_left = x - i
    y_left = y - 2 * i
    if x_left == y_left * 2:
        cnt1 = i
        cnt2 = y_left

if cnt1 == cnt2 == 0:
    ans = 0
else:
    ans = 1
    for i in range(1, cnt1 + 1):
        ans *= (cnt1 + cnt2 - i + 1)
        ans %= mod
        ans *= pow(i, mod - 2, mod)
        ans %= mod

print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
 #define PI 3.14159265359

using namespace std;
const int64_t mod = 1000000007;
const int64_t tmpMod = 998244353;


int main() {
 
  int64_t N,ans=0,d;
  cin>>N>>d;
  vector<int64_t> A(N),B(N);
  for(int i=0; i<N; i++){cin>>A[i]>>B[i];
                        if(A[i]*A[i]+B[i]*B[i]<=d*d)ans++;
                        }
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  cout << ans << endl;
}


Measured memory_bytes: 6376
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
ll dp1[N];
ll dp2[N];
ll a[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    a[0]=a[1],a[n+1]=a[n];
    for(int i=1; i<=n; i++)
    {
        dp1[i]=__gcd(a[i],dp1[i-1]);
    }
    for(int i=n; i>=1; i--)
    {
        dp2[i]=__gcd(a[i],dp2[i+1]);
    }

    ll ans=0;
    for(int i=1; i<=n; i++)
    {
        if(i==1)
        {
            ans=max(ans,dp2[i+1]);
        }
        else if(i==n)
        {
            ans=max(ans,dp1[i-1]);
        }
        else
        {
            ll tem=__gcd(dp2[i+1],dp1[i-1]);
            ans=max(ans,tem);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5924
import itertools
lis=list(map(int,input().split()))
N=lis[0]
M=lis[1]
X=lis[2]
book=[[0]*(M+1)]*N
Cost=[]
for i in range(N):
    book[i]=list(map(int,input().split()))
buy=list(itertools.product('YN', repeat=N))
for i in buy :
    Buy=list(i)
    rikai=[0]*M
    cost=0
    for j in range(N):
        if(Buy[j]=="Y"):
            cost+=book[j][0]
            rikai=[x+y for (x, y) in zip(rikai,book[j][1:M+1])]
    if(min(rikai)>=X):
        Cost.append(cost)
if(len(Cost)>=1):
    print(min(Cost))
else:
    print(-1)

Measured memory_bytes: 9812
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  for (auto it = vc.begin(); it != vc.end(); ++it)
  {
    if (std::next(it) == vc.end())
      os << *it;
    else
      os << *it << ' ';
  }
  return os;
}

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  using std::cout;
  char c{}; cin >> c;
  map<char, char> dic{
    {'A', 'T'},
    {'T', 'A'},
    {'C', 'G'},
    {'G', 'C'}
    };

  cout << dic[c] << '\n';
  return;
}

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

  solve();

  return 0;
}


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

long long rec(long long H)
{
    if (H == 1LL)
        return 1;
    else
        return 2LL * rec(H / 2LL) + 1LL;
}

int main()
{
    long long H;
    cin >> H;
    cout << rec(H) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define     bit_1(a)       __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front
#define     mpr            make_pair
#define     ins            insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     vstr           vector<string>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))
#define     orderset1      tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define     orderset2      tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));
/// lcm(a,b)=a/gcd(a,b)*b (handle overflow)

bool sortinrev1(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second>b.second);
    else return (a.first > b.first);
}
bool sortinrev2(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second<b.second);
    else return (a.first > b.first);
}
int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};


int main()
{
    int x;
    cin>>x;
    if(x>=400 && x<=599)cout<<8<<endl;
    if(x>=600 && x<=799)cout<<7<<endl;
    if(x>=800 && x<=999)cout<<6<<endl;
    if(x>=1000 && x<=1199)cout<<5<<endl;
    if(x>=1200 && x<=1399)cout<<4<<endl;
    if(x>=1400 && x<=1599)cout<<3<<endl;
    if(x>=1600 && x<=1799)cout<<2<<endl;
    if(x>=1800 && x<=1999)cout<<1<<endl;
}



Measured memory_bytes: 3628
import numpy as np
N,M = map(int,input().split())
S = input().split()
T = np.array(input().split(), dtype = np.int32)
dp = np.ones(M+1, dtype = np.int64)
for s in S:
  dp[1:] = (np.where(T == int(s), dp[:-1], 0).cumsum() + dp[1:]) % (10**9 + 7)
print(dp[M])

Measured memory_bytes: 14520
from itertools import accumulate
from collections import Counter

n, m = map(int, input().split())
A = list(map(int, input().split()))
L = [0] + list(accumulate(A))
L = [ i%m for i in L ]
C = Counter(L)
ans = 0
for i in C.values():
  ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 16300
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    const N = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
    var K = parseInt(input);
    var where = K- 1;
    ans = N[where];
    console.log(ans);
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

ll lcm(ll a, ll b){
  return a/gcd(a,b) * b;
}
ll func2(ll n){
  ll res = 0;
  while(n%2 == 0){
    n /= 2;
    res++;
  }
  return res;
}

ll zyou(ll a,ll b){//a＾b
  ll res = 1;
  for(int i = 1;i<=b;i++){
    res *= a;
  }
  return res;
}
struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t),weight(w){ }
};

typedef pair<int,int> P;
using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}


bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

bool palin(string S){//回文判定
  int n = S.size();
  bool flag = true;
  if(n%2 == 0){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  else if(n%2 == 1){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  return flag;
}
/*vector<int> d(N+1,-1);

//頂点xとの各点との最短距離を求める
void bfs(int x,Graph &G){
  d[x] = 0;
  queue<<int> que;
  que.push(x);

  // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
}*/

int main(){
  ll N,K;
  cin >> N >> K;
  ll x0 = N - (N/K) * K;
  ll x1 = abs(x0 - K);
  cout << min(x0,x1) << endl;
 }


Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        int[]A=nai(n);
        Arrays.sort(A);
        int ans=0;
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
                for(int k=j+1;k<n;k++)
                    if(A[i]+A[j]>A[k] && A[i]!=A[j] && A[i]!=A[k] && A[j]!=A[k])
                        ans++;
        pn(ans);
        
    }
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 33640
import math

N = int(input())
P = []
for i in range(N):
    P.append([int(a) for a in input().split()])

count = 0

for i in range(N):
    for j in range(N):
        if i < j:
            count += math.sqrt((P[i][0] - P[j][0]) ** 2 + (P[i][1] - P[j][1]) ** 2)

print(2 * count / N)

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

const int maxn = 100009;
struct node {
	int x, y, t;
	bool operator < (const node &a) const {
		return t < a.t;
	}
} a[maxn];
int n;

int main() {
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		scanf("%d%d%d", &a[i].t, &a[i].x, &a[i].y);
	sort(a+1, a+n+1);
	for (int i=1; i<=n; i++)
		if (abs(a[i].x-a[i-1].x) + abs(a[i].y-a[i-1].y) > a[i].t - a[i-1].t || ((a[i].t - a[i-1].t) - abs(a[i].x-a[i-1].x) - abs(a[i].y-a[i-1].y)) % 2 == 1) {
			return puts("No"), 0;
		}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

const long long int MOD=1e9+7;

long long int modinv(long long int a, long long int m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long 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;
}

long long int comb(long long int i, long long int j) {
    long long int k=i-j;
    if(k<j) j=k;
    long long int ret=1;
    for(int x=0; x<k; x++) {
        ret *= (i-x);
        ret %= MOD;
        ret *= modinv(x+1, MOD);
        ret %= MOD;
    }
    return ret;
}

int main() {
    long long int N, K;
    cin >> N >> K;
    
    for(int i=0; i<K; i++) {
        if(N-K<i) {
            cout << 0 << endl;
        } else {
            long long int ans;
            ans = comb(K-1, i);
            ans *= comb(N-K+1, i+1);
            ans %= MOD;
            cout << ans << endl;
        }
    }
    

    return 0;
    
}

Measured memory_bytes: 256
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
map<ll,ll>M;
vector<ll>sum;
void init()
{
    ll i;
    fo(i,1,60)sum.pb((i*(i+1))/2);
}
void primeFactors(ll n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        M[2]++;
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            M[i]++;
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
    M[n]++;
}  
void solve()
{
    ll n;cin>>n;
    primeFactors(n);
    init();
    map<ll,ll>::iterator it=M.begin();
    vector<ll>::iterator a;
    ll Sum=0;
    while(it!=M.end())
    {
        ll k=it->S;
    
        a=upper_bound(all(sum),k);
        ll j=a-sum.begin();
        Sum+=j;
        it++;
    }
    cout<<Sum<<"\n";
    
}
int main()
{
   fastio
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//If wrong on pretest 2 means logically wrong


/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


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

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
typedef pair<int,int> P;
int main(){
	int m;
	cin>>m;
	cout<<48-m<<endl;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int g[13] = {0, 1, 2, 1, 4, 1, 4, 1, 1, 4, 1, 4, 1}, x, y;
  scanf("%d%d", &x, &y);
  if(g[x] == g[y]) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1e8;


int main(){
  int X,A;
  cin >> X >> A;
  if(X<A){
    cout << 0 << endl;
  }else{
    cout << 10 << endl;
  }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long double
using namespace std;
int main()
{
	int n,d;
	cin>>n>>d;
	int a[n][d];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
			cin>>a[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<n-1;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int sum=0;
			for(int k=0;k<d;k++)
			{
				sum+=((a[i][k]-a[j][k])*(a[i][k]-a[j][k]));
			}
			double p=sqrt(sum);
			if(floor(p)==p)
			{
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()

int main() {
  string s; 
  int k; cin >> s >> k;
  vector<string> v;
  int n=s.size();
  for(int i=1;i<min(n,5)+1;i++){
    for(int j=0;j<n-i+1;j++)
      v.push_back(s.substr(j,i));
  }
  sort(all(v));
  unique(all(v));
  cout << v[k-1] << endl;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  ll res = 0;
  rep(i, n) {
    ll tmp = 0;
    rep(j, m) {
      ll a;
      cin >> a;
      tmp += a;
    }
    res = max(res, tmp);
  }
  cout << res << endl;
}


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

int main(){
    char s[100010];
    int n, i, ans=1;
    cin >> n;
    cin >> s;
    for (i=1; i < n; i++) {
        if (s[i]!=s[i-1]) {
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main(){
    int n, a;
    int64_t sum = 0;
    cin >> n;
    vector<long long> cnt(100005);
    for (int i = 0; i < n; i++){
        cin >> a;
        cnt[a]++;
        sum += a;
    }

    int q;
    cin >> q;
    for (int j = 0; j < q; j++){
        int b, c;
        cin >> b >> c;
        sum -= b * cnt[b];
        sum -= c * cnt[c];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        sum += b * cnt[b];
        sum += c * cnt[c];
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 4036
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

mini = 0
min = float('inf')

for i in range(len(H)):
    if min > abs(A - (T - 0.006 * H[i])):
        min = abs(A - (T - 0.006 * H[i]))
        mini = i + 1

print(mini)


Measured memory_bytes: 3060
# frozen_string_literal: true

_n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)

MAX = 10**18

if a.any?(&:zero?)
  puts 0
  exit
end

ans = a.reduce do |acm, ai|
  new_acm = acm * ai
  if new_acm > MAX
    puts '-1'
    exit
  end
  new_acm
end

puts ans


Measured memory_bytes: 23476
/* 163a.c */
#include <stdio.h>

int main(void){
    float r,s,l=0;
    float M_PI=3.1415926535;
    scanf("%f",&r);
    s = M_PI * r * r;
    l = 2 * M_PI * r;
    printf("%f",l);
    return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

template<class T>
inline bool asMn(T &a, const T &b) { return a > b ? a = b, true : false; }
template<class T>
inline bool asMx(T &a, const T &b) { return a < b ? a = b, true : false; }

const LL infLL = 1e18;
mt19937 rng( (int)chrono::steady_clock::now().time_since_epoch().count() );

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

  #ifdef FourLeafClover
  freopen("input", "r", stdin);
  #endif // FourLeafClover

  int n, a, b; cin >> n >> a >> b;
  vector<int> p(n);
  for (auto &i : p) cin >> i, --i;

  vector<vector<LL> > f(n + 1, vector<LL>(n + 1, infLL) );
  f[0][0] = 0;
  for (int i = 0; i + 1 < sz(f); ++i) {
    for (int j = 0; j < sz(f[i]); ++j) if (f[i][j] ^ infLL) {
      if (p[i] >= j) {
        asMn(f[i + 1][ p[i] + 1 ], f[i][j]);
        asMn(f[i + 1][j], f[i][j] + a);
      }
      else asMn(f[i + 1][j], f[i][j] + b);
    }
  }

  cout << *min_element(all(f.back() ) ) << '\n';

  return 0;
}


Measured memory_bytes: 195840
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		System.out.println(n%k==0 ? 0 : 1);
	}
}

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

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

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

    for (int i=0; i<k; ++i) {
        vector<int> diff(n+1);
        for (int j=0; j<n; ++j) {
            // [left, right) で imos法
            int left = max(0, j - a[j]);
            int right = min(n, j + a[j] + 1);
            diff[left]++; diff[right]--;
        }
        a[0] = diff[0];
        bool all_n = (a[0] == n);
        for (int j=1; j<n; ++j) {
            a[j] = a[j-1] + diff[j];
            if (a[j] != n) all_n = false;
        }
        // 全て n ならこれ以上変わらない
        if (all_n) {
            break;
        }
    }
    for (int i=0; i<n; ++i) cout << a[i] << (i == n-1 ? "\n" : " ");
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<ll> vec(n);
  rep(i, n) cin >> vec[i];

  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  vector<ll> seq; 
  seq.push_back(vec[0]);
  reps(i,1, n/2+10) {
    seq.push_back(vec[i]);
    seq.push_back(vec[i]);
  }
  ll ans = 0;
  rep(i, n-1) {
    ans += seq[i];
  }

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

Measured memory_bytes: 6920
A,B,C,X,Y = map(int, input().split())

n = min(X,Y)

sum = 0

sum = min(n*2*C, A*n+B*n)

if X>Y:
    n = X-n
    sum = sum + n*A
else:
    n = Y - n
    sum = sum + n*B

sum_ab = X*A + Y*B

sum_a_b = 2*max(X,Y)*C


print(min(sum,sum_ab,sum_a_b))

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

ans = 0
for i in range(a, b + 1):
    s = str(i)
    flag = False
    for i in range(len(s)):
        if s[i] != s[len(s) - i - 1]:
            flag = True
    if not flag:
        ans += 1
print(ans)


Measured memory_bytes: 9116
class Unionfind:
    
    def __init__(self,n):
        self.uf = [-1]*n

    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]

    def same(self,x,y):
        return self.find(x) == self.find(y)

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return 
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x

    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

n,m = map(int,input().split())
l = list(map(int,input().split()))
u = Unionfind(n)
for i in range(m):
    x,y = map(int,input().split())
    u.union(x-1,y-1)

l1 = [[] for i in range(n)]
l2 = [[] for i in range(n)]
for i in range(n):
    x = u.find(i)
    l1[x].append(i)
    l2[x].append(l[i]-1)
ans = 0
for i in range(n):
    a = set(l1[i])
    b = set(l2[i])
    ans += len(a&b)
print(ans)


Measured memory_bytes: 45536
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

#define N_MAX 200000
#define INF 1145141919
#define SMAP(a, b) ((a)!=(b))&&((a)^=((b)^=((a)^= (b))))

typedef unsigned long long ull;

int i, j;

int n, m;
int k;

int h, w;

char str[N_MAX];

void solve(){
	return;
}

int main (void) {
	char *s = str;
	int result = 0, curr = 0;
	scanf("%s", str);
	while (*s) {
		if (*s == 'T') curr++;
		else curr--;
		if (curr > result) result = curr;
		s++;
	}
	printf("%d\n", result << 1);
	return 0;
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const int N = 4005;
const int mod = 998244353;
int combi[N][N];

int add(int x,int y) {
   return ((x+y)%mod+mod)%mod;
}
int mul(int x,int y) {
   return (ll)x*y%mod;
}

void init() {
   for(int i=0;i<N;++i) {
      combi[i][i] = combi[i][0] = 1;
   }
   for(int i=1;i<N;++i) {
      for(int j = 1;j<i;++j) {
         combi[i][j] = add(combi[i-1][j],combi[i-1][j-1]);
      }
   }
}
int H(int n,int x) {
   if(x<1) {
      return 0;
   }
   return combi[n+x-1][x-1];
}
void solve() {
   init();
   int k,n;
   scanf("%d%d",&k,&n);
   for(int i= 2;i<=k*2;++i) {
      int special = 0, normal = 0;
      for(int j = 1;j<=k;++j) {
         int x = i - j;
         if(j<x && x<=k) {
            ++special;
         }
      }
      normal = k - special*2;
      if(i&1) {
         //printf("%d %d %d\n", i,special,normal);
         int ret = 0;
         int prev = H(n,normal);
         ret = prev;
         int p = 1;
         for(int x = 1;x<=special;++x) {
            int cur = mul(H(n-x,normal +x),combi[special][x]);
            p = mul(p,2);
            ret = add(ret, mul(p,cur));
            prev = H(n,normal+x);
         }
         printf("%d\n",ret);
      } else {
         --normal;
         int ret = H(n,normal);
         ret = add(ret, H(n-1,normal));
         int p = 1;
         for(int x = 1;x<=special;++x) {
            int cur = mul(H(n-x,normal +x),combi[special][x]);
            p = mul(p,2);
            ret = add(ret, mul(p,cur));
            cur = mul(H(n-x-1,normal+x),combi[special][x]);
            ret = add(ret, mul(p,cur));
         }
         printf("%d\n", ret);
      }
   }
}
int main() {
   //freopen("input.txt","r",stdin);
   solve();
}

Measured memory_bytes: 61440
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  int Y = (S[0]-'0')*1000+(S[1]-'0')*100+(S[2]-'0')*10+(S[3]-'0')*1;
  int M = (S[5]-'0')*10+(S[6]-'0')*1;
  int D = (S[8]-'0')*10+(S[9]-'0')*1;

  if(Y < 2019) cout << "Heisei" << endl;
  else if(Y > 2019) cout << "TBD" << endl;
  else {
    if(M < 4) cout << "Heisei" << endl;
    else if(M > 4) cout << "TBD" << endl;
    else {
      if(D <= 30) cout << "Heisei" << endl;
      else cout << "TBD" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;
const ll kMod = 1000000007;

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

  ll X = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (A[i] > A[j]) ++X;
    }
  }

  ll Y = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      if (A[i] > A[j]) ++Y;
    }
  }

  ll ans1 = K * X % kMod;
  ll ans2 = K * (K - 1) / 2LL % kMod * Y % kMod;
  ll ans = (ans1 + ans2) % kMod;
  cout << ans << endl;
  
  return 0;
}


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

int main()
{
int a, b;
cin >> a >> b;
if(a + b == 15)
cout << "+" << endl;
else if( a * b == 15)
cout <<"*" << endl;
else
cout <<"x"<< endl;
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.Library.LCS
{
    class AOJ_dpl1e
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string s1 = Read();
            string s2 = Read();
            Console.WriteLine(GetDP(s1,s2));
        }

        static int GetDP(string s1,string s2)
        {
            var dp = new int[s1.Length + 1, s2.Length + 1];//s1 i,s2 jまでを同じにする操作数
            for (int i = 1; i <= s1.Length;i++) dp[i, 0] = i;
            for (int i = 1; i <= s2.Length;i++) dp[0, i] = i;
            for (int i = 1; i <= s1.Length; i++)
            {
                for (int j = 1; j <= s2.Length; j++)
                {
                    if (s1[i - 1] == s2[j - 1])
                    {
                        dp[i, j] = dp[i - 1, j - 1];
                    }
                    else
                    {
                        dp[i, j] = Math.Min(dp[i - 1, j] + 1, dp[i, j - 1] + 1);
                        dp[i, j] = Math.Min(dp[i, j], dp[i - 1, j - 1] + 1);
                    }
                    //Console.Write(dp[i, j] + " ");
                }
                //Console.WriteLine();
            }
            return dp[s1.Length, s2.Length];
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}



Measured memory_bytes: 19204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  string s;
  cin >> n >> s;
  ll ans = 0;
  rep(i, n - 2) if(s.substr(i, 3) == "ABC") ans++;
  cout << ans << endl;
}

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

ll f(ll x){
  if(x == 1) return 1;
  return f(x/2)*2+1;
}

int main(){
  ll h;
  cin >> h;
  cout << f(h) << endl;
}


Measured memory_bytes: 3532
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int mm[100005];
int cnt[100005];

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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    map<int,int>mm;
    set<int>s;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        mm[i]=a[i];
        if(a[i])
            s.insert(i);
        mm[i]=a[i];
    }
    int ans=0;
    for(auto i:s)
    {
        int z=mm[i]+mm[i-1];
        ans+=z/2;
        mm[i]=z%2;
    }
    cout<<ans;

} 
    
 


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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector <int> a(n);
    int prev;
    bool flag=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(i==0)prev=a[0];
        else{
            if(prev<a[i])a[i]--;
            if(prev>a[i]){
                flag=false;
                break;
            }
            prev=a[i];
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 640
import numpy as np
A=[int(input()) for i in range(5)]
B=[]
for i in range(5):
    if int(str(A[i])[-1])!=0 and len(str(A[i]))>2:
        B.append(int(str(A[i])[:-2]+str(int(str(A[i])[-2])+1)+'0'))
    elif int(str(A[i])[-1])!=0 and len(str(A[i]))==2:
        B.append(int(str(int(str(A[i])[0])+1)+'0'))
    elif int(str(A[i])[-1])!=0 and len(str(A[i]))==1:
        B.append(10)
    else:
        B.append(int(A[i]))
a=np.array(A)
b=np.array(B)
np.array(B)-np.array(A)
tmp=np.sort(b-a)
print(sum(tmp)+sum(a)-tmp[-1])

Measured memory_bytes: 18768
'''
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
'''

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10000  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

S = int(input())

ans = 0

s = S-3
n = 0

while s >= 0:
    ans += cmb(s+n,n,p)
    s += -3
    n += 1

print(ans % p)

Measured memory_bytes: 10240
#include <stdio.h>

int main ()
{
    int n,a,b;
    scanf("%d", &n);
    if(n==1)
        printf("Hello World\n");
    else
    {
        scanf("%d %d", &a, &b);
        printf("%d\n", a+b);
    
    }
    return 0;
}



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

int isprime[150001];
vector<int> primes;

int main() {
    isprime[0] = isprime[1] = 1;
    for(int i=4; i<=150000; i+=2) isprime[i] = 1;
    for(int i=3; i*i<=150000; i+=2)
        if(isprime[i] == 0)
            for(int j=2; i*j<=150000; ++j)
                isprime[i*j] = 1;

    primes.push_back(2);
    for(int i=3; i<=150000; i+=2)
        if(isprime[i] == 0) primes.push_back(i);

    int N,P;
    while(cin>>N>>P) {
        if(N == -1 && P == -1) break;

        vector<int> pv1,pv2;
        for(int i=0,cnt=0; i<=150000; ++i) {
            if(primes[i] <= N) continue;
            pv1.push_back(primes[i]);
            cnt++;
            if(cnt > P) break;
        }

        for(int i=0; i<pv1.size(); ++i) {
            for(int j=i; j<pv1.size(); ++j) {
                pv2.push_back(pv1[i]+pv1[j]);
            }
        }

        sort(pv2.begin(), pv2.end());
        cout<<pv2[P-1]<<endl;
    }
}

Measured memory_bytes: 1636
k,n = map(int,input().split())
a = list(map(int,input().split()))

c = a[0]+(k-a[n-1])

for i in range (n-1):
    d = a[i+1]-a[i]
    if d > c:
        c = d
    else:
        c = c

s = k - c

print (s)


Measured memory_bytes: 25840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
  int n;
  int min = 1000001;
  int max = -1000001;
  ll sum = 0;
  cin >> n;

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

  for (int j = 0; j < n; j++) {
    sum += num[j];
    if (num[j] < min) min = num[j];
    if (num[j] > max) max = num[j];
  }

  // printf("%d %d %lf\n", min, max, sum);
  cout << min << " " << max << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3112
from itertools import product
N, M = map(int, input().split())
S = [list(map(int, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
ans = 0
for swith in product(*[(True, False) for _ in range(N)]):
    for i in range(M):
        if sum(int(s) for j, s in enumerate(swith, 1) if j in S[i]) % 2 != P[i]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string.h>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int a,b,c;
	int flag[11];
	while(cin >> a >> b >> c)
	{
		memset(flag,0,sizeof(flag));

		flag[a] = 1;
		flag[b] = 1;
		flag[c] = 1;

		int count = 0;
		REP(i,1,11)
		{
			if(flag[i] == 0 && a+b+i <= 20)
			{
				count++;
			}
		}

		if(count/7.0 >= 0.5)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152