akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long int
#define ull                 unsigned long long int
#define ld                  long double
#define fi                  first
#define se                  second
#define pb                  push_back
#define pbb                 pop_back
#define mp                  make_pair
#define pii     	        pair<int,int>
#define all(x)              x.begin(), x.end()
#define uniq(x)             x.erase(unique(x.begin(),x.end()),x.end())
#define mem(array, value)   memset(array, value, sizeof(array))
#define PI      	        2*acos(0.0)
#define EPS     	        1e-8
#define line                cout << "\n==========\n"
#define fastRead 	        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define trace(...)          __f( #__VA_ARGS__ , __VA_ARGS__ )
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << "\n";
}
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) << " : " << arg1 << " , ";
    __f(comma + 1, args...);
}

const int INF = 1e9+9;

const int nax = 1e5+5;
int ara[nax];

int main ()
{
    #ifdef Lollipop
        //freopen ("input.txt", "r", stdin);
        //freopen ("output.txt", "w", stdout);
    #endif

    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> ara[i];
    }
    sort(ara, ara+n);
    cout << ara[n/2] - ara[n/2-1] << endl;

    return 0;
}




Measured memory_bytes: 640
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]

x = int(input())

if x == 3 or x == 5 or x == 7:
    print("YES")
else:
    print("NO")









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

int main(){
  int N,K;
  cin >> N >> K;
  if(K>(N-1)*(N-2)/2){
    cout << -1 << endl;
  }
  else{
    cout << N-1+(N-1)*(N-2)/2-K << endl;
    for(int i=2; i<=N; i++){
      cout << 1 << ' ' << i << endl;
    }
    int i=2;
    for(; N-i<(N-1)*(N-2)/2-K; i++){
      for(int j=0; j<N-i; j++){
        cout << i << ' ' << i+1+j << endl;
      }
      K+=N-i;
    }
    for(int j=0; j<(N-1)*(N-2)/2-K; j++){
      cout << i << ' ' << i+1+j << endl;
    }
  }
}

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

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

	vector<int> P(N);
	for (int i = 0; i < N; i++) cin >> P.at(i);

	int k = 0;

	for (int i = 0; i < N; i++) {
		if (P.at(i) != i + 1) {
			k++;
		}
	}

	if (k <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

int main() {
  string S; cin >> S;
  int stock = 0;
  int score = 0;
  for(int i = 0; i < S.size(); ++i) {
    if(stock > 0 && S[i] == 'g') {
      score++;
      stock--;
    } else if(stock == 0 && S[i] == 'g') {
      stock++;
    } else if(stock == 0 && S[i] == 'p') {
      stock++;
      score--;
    } else if(stock > 0 && S[i] == 'p') {
      stock--;
    }
  }
  cout << score << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 998244353;
using ll = long long;
using namespace std;

const int bound = 100000;
ll sp[310][bound];
ll dp[310][bound];

int main(){
	int n;  cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	dp[0][0] = 1;
	ll sum = 0;
	ll product = 1;
	for( int i = 0; i < n; ++i ){
		sum += a[i];
		product *= 3; product %= mod;
		for( int x = 0; x < bound-500; ++x ){
			dp[i+1][x] += (dp[i][x]*2); dp[i+1][x] %= mod;
			dp[i+1][x+a[i]] += ( dp[i][x] ) % mod; dp[i+1][x+a[i]] %= mod;
		}
	}
	ll ngsum = 0;
	for( int x = (sum+1)/2; x < bound; ++x ){
		ngsum += dp[n][x];
	}
	if( sum % 2 == 0 ){
		sp[0][0] = 1;
		for( int i = 0; i < n; ++i ){
			for( int x = 0; x < bound-500; ++x ){
				sp[i+1][x] += sp[i][x]; sp[i+1][x] %= mod;
				sp[i+1][x+a[i]] += ( sp[i][x] ) % mod; sp[i+1][x+a[i]] %= mod;
			}
		}
	}
	cout << ( product - ( ngsum - sp[n][sum/2]+mod)*3 % mod + mod ) % mod << endl;
}

Measured memory_bytes: 472576
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<pair<string,pair<int,int>>> p(n);
    rep(i,n){
        string s;
        int a;
        cin>>s>>a;
        p[i]=make_pair(s,make_pair(a,i));
    }
    sort(all(p),[&](auto a,auto b){
        if(a.ft==b.ft) return a.sc.ft>b.sc.ft;
        return a.ft<b.ft;
    });
    rep(i,n){
        cout<<p[i].sc.sc+1<<'\n';
    }
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int A[5];
    int reast_i = -1;
    int reast = 9;
    rep(i,5){
      cin >> A[i];
      if(A[i]%10!=0 && A[i]%10<=reast){
        reast = A[i]%10;
        reast_i = i;
      }
    }
    int result = 0;
    rep(i,5){
      if(A[i]%10==0 || reast_i==i) result+=A[i];
      else result+=A[i]+10-A[i]%10;
    }
    cout << result << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef pair<int, int> pii;

bool memo[1000000] = {};
vector<int> pri;

void calc()
{
	for (int i = 2; i < 1000000; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < 1000000; l += i)
			{
				memo[l] = true;
			}
		}
	}
}

int main()
{
	calc();
	for (int i = 1; i < pri.size(); i++)
	{
		pri[i] += pri[i - 1];
	}
	int n;
	while (cin >> n&&n)
	{
		cout << pri[n - 1] << endl;
	}
}

Measured memory_bytes: 2560
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{	
	string s;
	cin>>s;
	if(s.length()%2) cout<<"No"<<endl;
	else
	{
		bool ans=true;
		for(int i=0;i<s.length();i+=2)
		{
			if(s[i]!='h'||s[i+1]!='i') {ans=false;break;}
		}
		if(!ans) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
}		

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.sort()
diff = [x[i] - x[i - 1] for i in range(1, m)]
diff.sort()
i = 0
while diff and i < n - 1:
    diff.pop()
    i += 1
print(sum(diff))


Measured memory_bytes: 56872
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>
#include <iostream>
#include <cmath>
using namespace std;

int main(){
    int N,M;
    cin>>N;
    cin>>M;
    int s[M],c[M];
    for(int i=0;i<M;i++){
        cin>>s[i]>>c[i];
    }
    int ans=0;
    for(int i=0;i<M;i++){
        if(s[i]==1&&c[i]==0){
            if(N!=1){
                ans=-1;
                break;
            }

        }
        for(int j=i+1;j<M;j++){
            if(s[i]==s[j]&&c[i]!=c[j]){
                ans=-1;
                break;
            }
        }
    }
    int candidate[N];
    for(int i=0;i<N;i++)candidate[i]=10;
    if(ans!=-1){
        int digi=0;
        for(int i=0;i<M;i++){
            digi=s[i]-1;
            if(candidate[digi]>c[i]){
                candidate[digi]=c[i];
            }
        }
        for(int i=0;i<N;i++){
            if(candidate[i]>=10){
                if(i==0)ans+=pow(10,N-1);
                if(i==0&&N==1)ans=0;
            }else{
                ans+=candidate[i]*pow(10,N-1-i);
            }
        }
    }
    cout<<ans;


}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int D = scanner.nextInt();
        int T = scanner.nextInt();
        int S = scanner.nextInt();

        System.out.println( S * T >= D ? "Yes" : "No");


    }

}

Measured memory_bytes: 35600
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
const ll mod = 998244353;
int n, d[N], cnt[N];
ll powmod(ll a,ll b)
{
	ll ans = 1;
	while(b)
	{
		if(b&1) ans = ans*a%mod;
		a = a*a%mod;
		b >>= 1;
	}
	return ans;
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=1;i<=n;i++) cin >> d[i];
 	if(d[1]) return cout << 0, 0;
 	sort(d+1,d+n+1);
 	for(int i=1;i<=n;i++) cnt[d[i]]++;
 	if(d[1]) return cout << 0, 0;
 	if(n>1&&!d[1]&&!d[2]) return cout << 0, 0;
 	ll ans = 1;
 	int pre = 1;
// 	for(int i=2;i<=n;)
// 	{
// 		int j = i + 1, cur = 1;
// 		while(j<=n&&d[j]==d[i]) cur++, j++;
// 		ans = (ans * powmod(pre,cur))%mod;
// 		pre = cur;
// 		i = j;
// 	}
	int dep = 0;
	for(int i=1;i<=n;i++) dep = max(dep,d[i]+1);
	for(int i=2;i<dep;i++) ans = ans*powmod(cnt[i-1],cnt[i])%mod;
 	ans = (ans+mod)%mod;
 	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
ABC = list(map(int,input().split()))

dic = {}

dic[5] = 0
dic[7] = 0

for i in ABC:

    if i == 5 or i == 7:

        dic[i] += 1

if dic[5] == 2 and dic[7] == 1:
    print ("YES")
else:
    print ("NO")


Measured memory_bytes: 2940
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn depth_search(graph: &Vec<Vec<usize>>, traced_route: &mut Vec<usize>,
                counter_vec: &mut Vec<usize>, bonus: &Vec<usize>,
                cur_bonus: usize){

    if traced_route.len() == 0{
        return;
    }
    for next_v in &graph[*(traced_route.last().unwrap())]{
        //prevent loop
        if traced_route.len() >= 2  && *next_v == traced_route[traced_route.len()-2]{
            continue;
        }

        traced_route.push(*next_v);
        counter_vec[*next_v] = cur_bonus + bonus[*next_v];
        depth_search(graph, traced_route, counter_vec, bonus, cur_bonus + bonus[*next_v]);
        traced_route.pop();
    }
    
}

fn main(){
    let line: Vec<usize> = read_as_vec();
    let (n, q) = (line[0], line[1]);

    let mut graph: Vec<Vec<usize>> = vec![Vec::new(); n];

    for _ in 0..n-1{
        let line: Vec<usize> = read_as_vec();
        let (a, b) = (line[0]-1, line[1]-1);
        graph[a].push(b);
        graph[b].push(a);
    }


    let mut bonus: Vec<usize> = vec![0; n];
    for _ in 0..q{
        let line: Vec<usize> = read_as_vec();
        let (p, x) = (line[0]-1, line[1]);
        bonus[p] += x;
    }


    let mut counter_vec: Vec<usize> = vec![0;n];
    counter_vec[0] = bonus[0];
    let mut traced_route: Vec<usize> = vec![0];

    depth_search(&graph, &mut traced_route, &mut counter_vec, &bonus, bonus[0]);


    for elem in counter_vec{
        print!("{} ", elem);
    }
    println!("");
}


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

signed main(){
  int N, M; cin >> N >> M;
  vector<vector<char> > A(N, vector<char> (N)), B(M,vector<char> (M));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++) cin >> A[i][j];
  }
  for(int i = 0; i < M; i++){
    for(int j = 0; j < M; j++) cin >> B[i][j];
  }
  char c = B[0][0];
  bool ok = false;
  for(int i = 0; i + M <= N; i++){
    for(int j = 0; j + M <= N; j++){
      if(A[i][j] == c){
        bool ok2 = true;
        for(int k = 0; k < M; k++){
          for(int l = 0; l < M; l++){
            if(A[i + k][j + l] != B[k][l]) ok2 = false;
          }
        }
        if(ok2) ok = true;
      }
    }
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
using namespace std; 

int main(){
    int a,s,d; cin >> a >> s >> d;
    if (a==s && s==d) cout << "No" << "\n";
    else if (a!=s && s!=d && a!=d) cout << "No" << "\n";
    else cout << "Yes" << "\n";
    
}


























Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = [(1+i)/2 for i in p]
tmp = sum(p[:k])
ans = tmp
for i in range(n-k):
  tmp += p[i+k] - p[i]
  ans = max(ans, tmp)
print(ans)

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

using namespace std;
int n , f[10] , v[10] , x[10] , y[10];
double sol;

double calc (int a , int b){

    if (a == 0)
        return 0;

    return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));

}

void back(int pas , double sum){
    int i;
    if (pas == n + 1){
        sol += sum;
        return;
    }

    for (i = 1 ; i <= n ; i++){
        if (!f[i]){
            f[i] = 1;
            v[pas] = i;
            back(pas + 1 , sum + calc(v[pas - 1] , v[pas]));
            f[i] = 0;
        }
    }

}

int main()
{
    //FILE *fin = fopen ("a.in","r");
    int i;
    cin >> n;
    for (i = 1 ; i <= n ; i++){
        cin >> x[i] >> y[i];
    }

    back(1 , 0.0);

    for (i = 1 ; i <= n ; i++)
        sol /= i;

    cout << setprecision(8) << fixed << sol;

    return 0;
}


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

int main ()
{
  long long int H;
  std::cin >> H;

  long long int ans = 1;
  long long int prev_atk = 1;
  while (H > 1)
    {
      H /= 2;
      prev_atk *= 2;
      ans += prev_atk;
    }

  std::cout << ans << std::endl;

}


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

int main() {
	int N;	// ボールの個数.
	cin >> N;
	int K;	// タイプBのロボットのX座標.
	cin >> K;

	int answer = 0;
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		if (x < K - x) {
			answer += x * 2;
		}
		else {
			answer += (K - x) * 2;
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;

int main()
{
	int h[100], w[100];
	int n=0;
	
	while(1){
		cin >> h[n] >> w[n];
		if(h[n] == 0 && w[n] == 0)	break;
		n++;
	}
	
	for(int i=0; i<n; i++){
		for(int j=1; j<=h[i]; j++){
			if(j==1 || j==h[i]){
				for(int m=1; m<=w[i]; m++)
					cout << '#';
			}
			else{
				for(int m=1; m<=w[i]; m++){
					if(m==1 || m==w[i])
						cout << '#';
					else
						cout << '.';
				}
			}
			cout << endl;
		}
		if(i<=n-1)
			cout << endl;
	}
	
	return 0;
}



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

typedef long long llint;

int n, k;
int black[2001][2001];
int white[2001][2001];
int B[4001][4001];
int W[4001][4001];

int sumB(int y, int x, int h, int w) {
    return B[y + h][x + w] - B[y + h][x] - B[y][x + w] + B[y][x];
}
int sumW(int y, int x, int h, int w) {
    return W[y + h][x + w] - W[y + h][x] - W[y][x + w] + W[y][x];
}

int main() {
    cin >> n >> k;
    
    for (int i = 0; i < k * 2; i++) {
        for (int j = 0; j < k * 2; j++) {
            black[i][j] = 0;
            white[i][j] = 0;
        }
    }

    while(n--) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        x %= k * 2;
        y %= k * 2;
        if (c == 'B') {
            black[y][x]++;
        } else {
            white[y][x]++;
        }
    }

    B[0][0] = W[0][0] = 0;
    for (int i = 1; i <= k * 4; i++) {
        B[i][0] = W[0][0] = 0;
        for (int j = 1; j <= k * 4; j++) {
            B[i][j] = B[i][j - 1] + black[(i - 1) % (k * 2)][(j - 1) % (k * 2)];
            W[i][j] = W[i][j - 1] + white[(i - 1) % (k * 2)][(j - 1) % (k * 2)];
        }
    }
    for (int j = 1; j <= k * 4; j++) {
        B[0][j] = W[0][j] = 0;
        for (int i = 1; i <= k * 4; i++) {
            B[i][j] += B[i - 1][j];
            W[i][j] += W[i - 1][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < k * 2; i++) {
        for (int j = 0; j < k * 2; j++) {
            ans = max(ans, sumB(i, j, k, k) + sumB(i + k, j + k, k, k) + sumW(i, j + k, k, k) + sumW(i + k, j, k, k));
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 156544
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
#define rep(i,n) for(i=0;i<n;i++)
#define repr(i,n) for(i=n-1;i>=0;i--)
#define mp(x,y)  make_pair(x,y)
#define FAST    ios::sync_with_stdio(false); cin.tie(0);
#define modd 1000000007
using namespace std;
 
int main(){
ll n,d; cin>>n>>d;
d*=d; ll a,b,c=0;
while(n--){
cin>>a>>b;
if(a*a+b*b<=d)c++;
}
cout<<c;
}

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

using namespace std;

#define mod 1000000007
#define ll long long int
#define mk make_pair
#define pb push_back
#define xx first
#define yy second


double pi=3.141592653589793238;
const int M = 1e9+7;
const int Nmax=5005;
const int MM = 1e7+1;
const int N=200010;


int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int T=1;
//cin>>T;
while(T--){
int n;
cin>>n;
int arr[n+1];
for(int i=1;i<=n;i++)cin>>arr[i];
ll dp[n+1];
dp[1]=0;
arr[0]=0;
for(int i=2;i<=n;i++){
    dp[i]=1e10;
    for(int j=1;j<=2;j++){
        if(i-j>0){
            dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
        }
    }
}
cout<<dp[n];
}
return 0;
}



Measured memory_bytes: 4776
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  cout << (a+b+c)-max({a,b,c})+max({a,b,c})*pow(2,k);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int x, a, b;
	cin >> x >> a >> b;
	if(a >= b){
		cout << "delicious" << endl;
	}else if(a < b && (b - a) <= x){
		cout << "safe" << endl;
	}else{
		cout << "dangerous" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc120/tasks/abc120_b

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main() {
    int cnt = 0, pos;
    bool flag = true;
    string s;
    cin >> s;

    int i = 0;
    while (i < s.size() - 1 && s.size() >= 2) {
        // [0, 1]か[1, 0]のデータを見つけたら削除して、前に戻る
        if (s[i] == '0' && s[i + 1] == '1' || s[i] == '1' && s[i + 1] == '0') {
            s.erase(s.begin() + i, s.begin() + i + 2);
            cnt += 2;
            if (i > 0)
                i--;
        } else {
            i++;
        }
    }

    cout << cnt << endl;

    return 0;
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

int dp[2][110];

void solve() {
    int m;
    cin >> m;
    for (auto &i : dp) {
        for (int j = 0; j < m; j++) {
            cin >> i[j];
        }
    }
    dp[1][0] += dp[0][0];
    for (int i = 0; i < 2; i++) {
        for (int j = 1; j < m; j++) {
            int tp = dp[i][j];
            dp[i][j] = tp + dp[i][j - 1];
            if (i > 0)
                dp[i][j] = max(dp[i][j], tp + dp[i - 1][j]);
        }
    }
    cout << dp[1][m - 1] << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

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

const LL INF=1<<30;
const LL MOD=1000000007;

LL gcd(LL a,LL b){
    if(b==0)return a;

    return gcd(b,a%b);
}

LL kaijo(LL n){
    LL ans=1;
    for(LL i=1;i<=n;++i){
        (ans*=i)%=MOD;
    }
    return ans;
}


int main(){
    LL n;
    cin>>n;
    LL ans[200100];

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

    if(n%2==0){

    for(int i=n-1;i>=1;i-=2){
        cout<<ans[i]<<" ";
    }

    for(int i=0;i<n-1;i+=2){
        cout<<ans[i]<<" ";
    }

    } else{

    for(int i=n-1;i>=0;i-=2){
        cout<<ans[i]<<" ";
    }

    for(int i=1;i<n-1;i+=2){
        cout<<ans[i]<<" ";
    }


    }

    cout<<endl;
}

Measured memory_bytes: 3712
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni(), m = ni();
		int[] a = new int[n+5];
		for(int i = 0; i < m; i++) {
			int l = ni();
			int r = ni();
			a[l-1] -= 1;
			a[r] += 1;
		}
		for(int i = a.length-2; i >= 0; i--) {
			a[i] += a[i+1];
		}
		int ct = 0;
		for(int i = 0; i < n+5; i++) {
			if(a[i] == m) ct++;
		}
		out.println(ct);
	}
	
		
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

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

int main() {
	int n,x;

	while(cin>>n>>x){

	    if(n==0 && x==0){
	        break;
	    }
	    
	    int s=0;
	    
	    for(int i=3;i<=n;++i){
	        for(int j=2;j<i;++j){
	            for(int k=1;k<j;++k){
	                if(i+j+k==x){
	                    s= s+1;

	                }

	            }
	        }
	    }
	     cout<<s<<endl;
	}
	return 0;
}



Measured memory_bytes: 3088
def main():
    mod = 998244353
    n = int(input())
    ab = sorted([tuple(map(int, input().split())) for _ in [0]*n])
    next_idx = [-1]*n
    for i in range(n-1, -1, -1):
        dist = sum(ab[i])
        now = i
        while now < n-1:
            a1, b1 = ab[now+1]
            if a1 < dist:
                now = next_idx[now+1]
            else:
                break
        next_idx[i] = now
    dp = [0]*(n+1)
    dp[n] = 1
    for i in range(n-1, -1, -1):
        dp[i] = (dp[i+1]+dp[next_idx[i]+1]) % mod
    print(dp[0])


main()

Measured memory_bytes: 42272
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

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

    int counter = 0;
    for (int i = 0; i < n; i++) {
        int input;
        cin >> input;
        if (input != i + 1) ++counter;
    }

    if (counter == 0 || counter == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

long long N, L;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N >> L) {
        long long s = L, t = L + N-1;
        long long all = 0;
        for (int i = s; i <= t; ++i) all += i;
        int res = 1<<29;
        int num;
        for (int i = s; i <= t; ++i) if (chmin(res, abs(i))) num = i;
        cout << all - num << endl;
    }
}


















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

int n, m, q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
  if(A.size()==n+1){
    int now=0;
    for(int i=0;i<q;i++){
      if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
    }
    ans=max(ans,now);
    return;
  }
  
  A.push_back(A.back());
  while(A.back()<=m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  cin >> n >> m >> q;
  a=b=c=d=vector<int>(q);
  for(int i=0;i<q;i++){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int>(1,1));
  cout << ans << endl;
  return 0;
}
  
  
  

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main() {
	int N, W;
	cin >> N >> W;
	vector<vector<long> > dp(N, vector<long>(W + 1, 0));
	vector<pair<int, int> > a(N);
	for(auto& x: a) cin >> x.first >> x.second;

	for(int i = 0; i < N; i++) {
		for(int j = 0; j <= W; j++) {
			if(i == 0) dp[i][j] = j - a[i].first >= 0 ? a[i].second : 0;
			else dp[i][j] = j - a[i].first < 0 ? dp[i-1][j] : max(dp[i - 1][j], a[i].second + dp[i - 1][j - a[i].first]);
		}
	}

	cout << dp[N - 1][W] << endl;
	return 0;
}


Measured memory_bytes: 79488
import java.io.*;
import java.util.*;


public class Main {

    class A {
        int a;
        int b;

        public A(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            A a1 = (A) o;
            return a == a1.a &&
                    b == a1.b;
        }

        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }


    private void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        List<Integer> list = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        Set<A> set = new HashSet<>();
        for (int i = 1; i <= n; i++) {
            if (i % 2 == 0) {
                list.add(i);
            } else {
                list2.add(i);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < list2.size(); j++) {
                set.add(new A(list.get(i), list2.get(j)));
            }
        }
        out.println(set.size());
    }


    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        try (
                InputReader in = new InputReader(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }


    static class InputReader implements AutoCloseable {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }


        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        @Override
        public void close() {

        }
    }

}


Measured memory_bytes: 22996
n = int(input())
h = list(map(int, input().split()))
flag = True
for i in range(n-1, 0, -1):
  if h[i]<h[i-1]:
    h[i-1] -= 1
for i in range(1, n):
  if h[i]<h[i-1]:
    flag = False
if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 14396
N = int(input())
h = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[-1])

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

using namespace std;

int main() {
	int i,n,ans=0,l=0,r=0,b=0;
	string a;
	while(1){
		cin >> n;
		if(n==0) break;
		for(i=0;i<n;i++){
			cin >> a;
			if(a=="lu"){
				l=1;
			}else if(a=="ru"){
				r=1;
			}else if(a=="ld"){
				l=0;
			}else if(a=="rd"){
				r=0;
			}
			
			if((l==1 && r==1) && b==0) {
				ans++;
				b=1;
			}
			if((l==0 && r==0) && b==1){
				ans++;
				b=0;
			}
			
			
		}
		
		
		cout << ans << endl;
		ans=0;
		b=0;
		l=0;r=0;
		
	}
	
	return 0;
}

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

#define int long long
#define endl "\n"
#define deb(x) cout << #x << " -> " << x << endl;
#define print(x)                        \
    for (auto x_ : x) cout << x << " "; \
    cout << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define mod 1000000007  // 1e9 + 7
#define prec(x, y) fixed << setprecision(y) << x

void solve() {
    int i, j, n, m, k, ans, x, t;
    cin >> n >> x >> t;
    if (n % x == 0) {
        cout << (n / x) * t << endl;
        return;
    }
    cout << (n / x + 1) * t << endl;

    return;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int tc = 1;
    // cin >> tc;
    while (tc--) {
        solve();
    }
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI acos(-1)

int main(){
    int n,m,maxi = 0,money;
    string s;
    cin >> n;
    map<string,int> blue;
    for(int i = 0;i < n;i++){
        cin >> s;
        blue[s]++;
    }
    cin >> m;
    map<string,int> red;
    for(int i = 0;i < m;i++){
        cin >> s;
        red[s]++;
    }
    for(pair<string,int> now : blue){
        maxi = max(maxi,now.second - red[now.first]); 
    }
    cout << maxi << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,a[100010]={},sum=0;
	cin >> n;
	for(ll i=0;i<n;i++){
		cin >> a[i];
	}
	ll cnt[100010]={};
	/*for(ll i=0;i<n;i++){
		cout << i << "番目のaの要素は" << a[i] << endl;
	}
	cout << sum << endl;*/
	for(ll i=0;i<n;i++){
		if(a[i]>100000){
			sum++;
		}else{
			cnt[a[i]]++;
		}
	}
	/*cout << sum << endl;
	for(ll i=0;i<=n;i++){
		cout << i << "番目のcntの要素は" << cnt[i] << endl;
	}*/
	for(ll i=0;i<100010;i++){
		if(i==cnt[i]){
			continue;
		}else if(i<cnt[i]){
			sum+=(cnt[i]-i);
		}else if(i>cnt[i]){
			sum+=cnt[i];
		}
	}
	cout << sum << endl;
		
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, K, R, S, P;
    cin >> N >> K >> R >> S >> P;
    string T;
    vector<string> A(K);
    vector<int> size(K, 0);
    cin >> T;
    int j = 0;
    rep(i, 0, N)
    {
        if (j == K)
        {
            j = 0;
        }
        A.at(j) += T.at(i);
        size.at(j)++;
        j++;
    }
    ll ans = 0;
    rep(i, 0, K)
    {
        rep(j, 0, size.at(i))
        {
            if ((j != size.at(i) - 1) && (A.at(i).at(j) == A.at(i).at(j + 1)))
            {
                A.at(i).at(j + 1) = '0';
            }
            if (A.at(i).at(j) == 'r')
            {
                ans += P;
            }
            else if (A.at(i).at(j) == 's')
            {
                ans += R;
            }
            else if (A.at(i).at(j) == 'p')
            {
                ans += S;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
	int n; 
    cin>>n;
	vector<int> ans(n+1,0);
	for(int i=0; i<n-1; i++){
		int x; 
        cin>>x;
		++ans[x];
	}
	for(int i=1; i<=n; ++i){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 4000
# coding: utf-8
# Your code here!
l = list(map(int,input().split()))
N = l[0]
K = l[1]
s = input()
ans = ""

for i in range(N):
    if i != K - 1:
        ans += s[i]
    else:
        a = s[i]
        a = a.lower()
        ans += a


print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	int l=a.size();
	for(int i=0;i<l-1;i++)if(a[i]=='A'&&a[i+1]=='C')
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=1e6+5;

long long n,a,b;

int main(){
	cin>>n;
	long long t=sqrt(n);
	int r=t;
	for (int i=r;i>=1;i--){
		if (n%i==0){
			a=i;
			b=n/a;
			break;
		}
	}
	cout<<(a+b-2);
	return 0;
}


Measured memory_bytes: 3656
import itertools


N = int(input())
D = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}
for i in range(N):
    s = input()
    if s[0] in D.keys():
        D[s[0]] += 1
ans = 0
for v in itertools.combinations(D.values(), 3):
    ans += v[0] * v[1] * v[2]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;   
const int inf = (int) 1e9+7;
int main(){
	fastIO;
	int x,y;
	cin>>x>>y;
	cout<<max(x+y,max(x-y,x*y))<<'\n';      	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
   int N;
   cin>>N;
   
   if(N%2==0){
       cout<<N<<endl;
   }
   else{
       cout<<N*2<<endl;
   }

}

Measured memory_bytes: 3580
ans = []
while True:
    a,op,b = raw_input().split()
    if op == "+":
        ans.append(int(a)+int(b))
    elif op == "-":
        ans.append(int(a)-int(b))
    elif op == "*":
        ans.append(int(a)*int(b))
    elif op == "/":
        ans.append(int(a)/int(b))
    else:
        break
for char in ans:
    print char


Measured memory_bytes: 4644
I = lambda:map(int,input().split())
n,t = I()

#タプルを要素にもつリストのループ処理
#タプルの第二要素がt以下ならリスト格納
k = [c for c,s in [(I()) for _ in [0]*n] if s<=t]
print(min(k) if k!=[] else "TLE")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    string s;
    cin>>s;
    int n=s.length();
    rep(i,n){
        s[i]='x';
    }
    cout<<s<<endl;
}

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

typedef struct sPosition {
    int t;
    int x;
    int y;
} Position;

using namespace std;

int main(void) {
    int n;
    cin >> n;
    vector<Position> positions(n + 1, {0, 0, 0});
    for (int i = 0; i < n; ++i) {
        int t, x, y;
        cin >> t >> x >> y;
        Position p = {t, x, y};
        positions[i + 1] = p;
    }
    bool can = true;
    for (int i = 0; i < n; ++i) {
        int dt = positions[i + 1].t - positions[i].t;
        int dist = abs(positions[i + 1].x - positions[i].x) + abs(positions[i + 1].y - positions[i].y);
        if (dist > dt) {
            can = false;
            break;
        }
        can = dt % 2 == 0
              ? dt % 2 == 0 && dist % 2 == 0
              : dt % 2 == 1 && dist % 2 == 1;
    }
    cout << (can ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1408
def m():
    H, W = map(int, input().split())
    S = [list(input()) for _ in range(H)]
    Gx = [[-1 for _ in range(W)] for _ in range(H)]
    Gy = [[-1 for _ in range(W)] for _ in range(H)]

    for a in range(H):
        left = 0
        for b in range(W):
            if S[a][b] == '#':
                left = 0
            else:
                Gx[a][b] = left + 1
                left = Gx[a][b]
    for b in range(W):
        top = 0
        for a in range(H):
            if S[a][b] == '#':
                top = 0
            else:
                Gy[a][b] = top + 1
                top = Gy[a][b]

    for i in reversed(range(H)):
        right = 0
        for j in reversed(range(W)):
            if Gx[i][j] == -1:
                right = 0
            else:
                Gx[i][j] = max(Gx[i][j], right)
                right = Gx[i][j]

    for j in reversed(range(W)):
        bot = 0
        for i in reversed(range(H)):
            if Gy[i][j] == -1:
                bot = 0
            else:
                Gy[i][j] = max(Gy[i][j], bot)
                bot = Gy[i][j]
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(Gx[i][j] + Gy[i][j], ans)
    return ans - 1


print(m())


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

int main() {
    int a, b;
    cin >> a >> b;
    for(int i = 1; i < 1111; i++) {
        if(i * 8 / 100 == a && i / 10 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}
template<class T> void contout(const T &v){for(auto it=v.begin();it!=v.end();++it,cerr<<(it!=v.end()?" ":"\n"))cout<<*it;}

void solve(){
  ll n,m; cin>>n>>m;
  vector<vector<ll>> E(n);
  rep(_,n-1){
    ll x,y; cin>>x>>y;
    --x; --y;
    E[x].push_back(y);
    E[y].push_back(x);
  }

  // 木DP (0-rooted)
  vector<ll> dp(n,1);
  function<void(ll,ll)> dfs1=[&](ll v,ll p){
    foreach(nv,E[v]){
      if(nv==p) continue;
      dfs1(nv,v);
      dp[v]*=dp[nv]+1;
      dp[v]%=m;
    }
  };
  dfs1(0,-1);

  // 全方位木DP
  vector<ll> ans(n,1);
  function<void(ll,ll)> dfs2=[&](ll v,ll p){
    foreach(nv,E[v]){
      ans[v]*=dp[nv]+1;
      ans[v]%=m;
    }
    ll k=E[v].size();
    vector<ll> l(k),r(k);
    rep(i,k) l[i]=r[i]=dp[E[v][i]]+1;
    rep(i,1,k){
      l[i]*=l[i-1];
      l[i]%=m;
    }
    rep(i,k-2,-1,-1){
      r[i]*=r[i+1];
      r[i]%=m;
    }
    rep(i,k){
      ll nv=E[v][i];
      if(nv==p) continue;
      dp[v]=1;
      if(i>0) dp[v]*=l[i-1];
      if(i<k-1) dp[v]*=r[i+1];
      dp[v]%=m;
      dfs2(nv,v);
    }
  };

  dfs2(0,-1);
  rep(i,n) cout<<ans[i]<<"\n";
}


Measured memory_bytes: 20864