akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#define ll long long

using namespace std;


void solve(){
    string str1, str2;
    cin >> str1 >> str2;
    int count = 0;
    for(int i = 0; i < str2.length(); i++)
    {
        if(str1[i]!=str2[i])
        count++;
    }
    cout << count << endl;
  
}

int main()
{
    solve();
    return 0;
}

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

int n, a[205];
int fact(int n){
	int ret = 0;
	while(n){
//		cout<<n<<"n\n";
		if(n/2 * 2 == n && !(n & 1)) ret++;
		else break;
		n/=2;
	}
//	cout<<"----\n";
	return ret;
}
int main(){
	cin>>n;
	int minim = 1e9;
	for(int i = 0;i<n;i++){
		cin>>a[i];
//		cout<<fact(a[i])<<"f\n";
		minim = min(minim, fact(a[i]));
	}
	cout<<minim<<"\n";
	return 0;
}

Measured memory_bytes: 256
import collections
N, A = map(int, input().split())
ys = [int(x) - A for x in input().split()]

dp = collections.defaultdict(lambda: 0)
dp[0] = 1
for y in ys:
    for accum, count in list(dp.items()):
        dp[accum + y] += count
found = -1 # for dp[0]
for accum, count in dp.items():
    if accum == 0:
        found += count
print(found)

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

using namespace std;

int x, a;

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

    cin >> x >> a;

    if(x < a)
        cout << "0";
    else
        cout << "10";

    return 0;
}


Measured memory_bytes: 256
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) {if(y < x) x = y;}
template<typename T, typename U> inline void mxze(T &x, U y) {if(x < y) x = y;}

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
template<typename T>
void _scan( vector<T> &v ){
	for(int i=0; i<(int)v.size(); i++) _scan(v[i]);
}
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h)
	{ cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++;
	cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr<<#x<<" = "; for(auto _i:x) cerr<<_i<<", ";cerr<<"\n";}}
#define debuga(x, sz) {{cerr<<#x<<" = ";for(int _i=0;_i<sz;_i++)cerr<<x[_i]<<", ";cerr<<"\n";}}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

ll MOD = 1e9+7;

inline ll Msum(ll x){return x;}
template<typename... Rest>
inline ll Msum(ll x, Rest... rest){ return (x + Msum(rest...)) % MOD; }

inline ll Mprod(ll x){return x;}
template<typename... Rest>
inline ll Mprod(ll x, Rest... rest){ return x * Mprod(rest...) % MOD; }

inline ll Mnorm(ll x){ return (x%MOD + MOD) %MOD; }
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

const int MAXN = 1e5+5;
int n, k;

int main(){
	scan(n, k); int p1;
	for(int i=0; i<n; i++){
		int x; scan(x); if(x == 1) p1=i;
	}
	int ans = 3*n;
	for(int l=0; l+k-1<n; l++){
		int r = l+k-1;
		if(l <= p1 && p1 <= r){
			int x = l;
			int y = n-1-r;
			x = (x+k-2)/(k-1);
			y = (y+k-2)/(k-1);
			mnze(ans, 1+x+y);
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;
#define pi 3.141592653589793238

int main(){
  double a,b,h,m;
  cin >> a >> b >> h >> m;
  double a1 = h/12 + m/60/12;
  double b1 = m/60;
  double ab = (a1-b1)*pi*2;
  double ans = sqrt((a*a)+(b*b)-(2*a*b*cos(ab)));
  cout << std::fixed << std::setprecision(20) << ans << endl;
  return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換

int main(){
int n;
cin>>n;
ll a[n];
map<ll,int> m;
rep(i,n){
    cin>>a[i];
    m[a[i]]++;
}
ll count = 0;
rep(i,n){
    if(a[i]<m[a[i]]) {
        m[a[i]]--;
        count++;
    }else if(a[i]>m[a[i]]){
        count++;
    }


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

Measured memory_bytes: 10220
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;

    bool flag = false;
    int ct = 1, plus = 2;
    while (ct <= N) {
        if (ct == N) {
            flag = true;
            break;
        }
        ct += plus;
        plus++;
    }

    if (flag) {
        vector<vector<int>> ans(plus, vector<int>(plus - 1, 1));
        int s = 2;
        repd(i, 1, plus - 1) {
            rep(j, i + 1) {
                ans[j][i] = s;
                s++;
            }
        }

        s = 2;
        repd(i, 2, plus) {
            rep(j, i) {
                ans[i][j] = s;
                s++;
            }
        }

        cout << "Yes" << endl;
        cout << plus << endl;
        rep(i, plus) {
            cout << plus - 1 << " ";
            rep(j, plus - 2) {
                cout << ans[i][j] << " ";
            }
            cout << ans[i][plus - 2] << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main(void){
    unsigned long int H,W;
    unsigned long  int answer=0;
    cin>>H>>W;
    if(H*W%2){
        answer++;
    }
    answer=answer+H*W/2;
    if(W==1 || H==1){
        cout<<1;
    }else{
    cout<<answer;
        
    }
    return 0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,m,h[1501],w[1501];
    while(cin>>n>>m,n){
        if(n==0&&m==0) break;
        rep(i,n) cin>>h[i];
        rep(i,m) cin>>w[i];
        int H[1501],W[1501];
        H[0]=0,W[0]=0;
        rep(i,n) H[i+1]=H[i]+h[i];
        rep(i,m) W[i+1]=W[i]+w[i];
        vec A;
        rep(i,n+1)rep(j,m+1) A.push_back(H[i]-W[j]);
        sort(all(A));
        ll ans=0,x=0,a=0;
        rep(i,A.size()){
        if(A[i]!=a) ans+=x*(x-1)/2,x=1,a=A[i];
        else x++;
        if(i==A.size()-1) ans+=x*(x-1)/2;
        }
        cout<<ans<<"\n";
    }
}


Measured memory_bytes: 51984
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N;
    cin >> N;
    vector<vector<int>> G(N + 1);
    vector<int> A(N + 1), H(N + 1), D(N + 1);
    for(int i = 2; i <= N; i += 1){
        cin >> A[i];
        D[A[i]] += 1;
    }
    queue<int> q;
    for(int i = 1; i <= N; i += 1) if(not D[i]) q.push(i);
    while(not q.empty()){
        int u = q.front();
        q.pop();
        sort(G[u].begin(), G[u].end(), greater<int>());
        for(int i = 0; i < (int)G[u].size(); i += 1)
            H[u] = max(G[u][i] + i + 1, H[u]);
        if(not --D[A[u]]) q.push(A[u]);
        G[A[u]].push_back(H[u]);
    }
    cout << H[1];
    return 0;
}


Measured memory_bytes: 6912
// https://atcoder.jp/contests/abc083/tasks/abc083_a
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    // 出力
    // if ((a + b) > (c + d))
    // {
    //     cout << "Left";
    // }
    // else if ((a + b) < (c + d))
    // {
    //     cout << "Right";
    // }
    // else
    // {
    //     cout << "Balanced";
    // }


    string ret[3] = {"Right", "Balanced", "Left"};
    cout << ret[(((a + b) > (c + d)) - ((a + b) < (c + d))) + 1];

    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>

using namespace std;

int calc(int x, int y){
	if(y <= 0) return -x;
	else if(x <= 0){
		int tmp = y * 2 - x;
		int tmp2 = -x * 2 + y;
		return min(tmp, tmp2);
	}else{
		return y;
	}
}

int N, K;
int X[100100];

void input(){
	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; ++i){
		scanf("%d", X + i);
	}
}

int solve(){
	int ans = -1;
	for(int i = 0; i + K - 1 < N; ++i){
		int tmp = calc(X[i], X[i + K - 1]);
		if(ans == -1 || ans > tmp) ans = tmp;
	}
	return ans;
}

int main(){
	input();
	int ans = solve();
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 512
n=int(input())
while n!=0:
    a=0
    b=0
    for i in range(n):
        x,y=[int(j) for j in input().split(" ")]
        if x>y:
            a+=x+y
        elif x<y:
            b+=x+y
        else:
            a+=x
            b+=y
    print("%d %d"%(a,b))
    n=int(input())
        

Measured memory_bytes: 7620
#include<stdio.h>
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

typedef struct{
  int B[3][3];
}board;

board P;

int heustric(){
  int i,j,x,y,sum=0;

  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(P.B[i][j] == 0) continue;
      x = (P.B[i][j] -1)%3 - j;
      y = (P.B[i][j] -1)/3 - i;

      if(x < 0) sum -= x;
      else sum += x;

      if(y < 0) sum -=y;
      else sum+= y;
    }
  }

  return sum;
}

int DFS(int x,int y,int max,int cnt,int n){
  int i,temp,x0,y0,time,h;

  h = heustric();
  if(h == 0) return cnt;
  else if(cnt + h > max) return -1;

  for(i=0;i<4;i++){
    x0 = x + dx[i];
    y0 = y + dy[i];

    if((i == (n +2)%4 && n!= -1) || (x0 < 0 || 3<= x0 || y0 < 0 || 3 <= y0)) continue;
    temp = P.B[y][x];
    P.B[y][x] = P.B[y0][x0];
    P.B[y0][x0] = temp;

    time = DFS(x0,y0,max,cnt+1,i);

    if(time != -1) return time;
    temp = P.B[y][x];
    P.B[y][x] = P.B[y0][x0];
    P.B[y0][x0] = temp;
  }

  return -1;
}

int main(){
  int i,j,x,y,time;
  board S;
  
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
	scanf("%d",&P.B[i][j]);
	if(P.B[i][j] == 0){
	  x = j;
	  y = i;
	}
      }
    }

    S = P;

    for(i=1;i<46;i++){
      P = S;

      time = DFS(x,y,i,0,-1);
      if(time != -1){
	printf("%d\n",time);
	break;
      }
    }

    return 0;
}
	  



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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  CFS;
  int n,q;
  cin >> n >> q;
  vector<pair<int,pair<int,int>>> v(2*n);
  int s,t,x;
  rep(i,n){
    cin >> s >> t >> x;
    v[2*i]={s-x,{x,1}};
    v[2*i+1]={t-x,{x,0}};
  }
  sort(all(v));
  map<int,int> mp;
  int idx=0,d;
  rep(t,q){
    cin >> d;
    while(idx<2*n){
      if(v[idx].first>d) break;
      if(v[idx].second.second){
        mp[v[idx].second.first]++;
      }else{
        auto itr = mp.find(v[idx].second.first);
        itr->second--;
        if(itr->second==0) mp.erase(itr);
      }
      idx++;
    }
    if(mp.size()==0) cout << -1 << endl;
    else cout << (mp.begin()->first) << endl;
  }
  return 0;
}


Measured memory_bytes: 15360
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <iomanip>
using namespace std;

using c_p_dd = pair<double, double>;

double f_slope(c_p_dd temp) { return temp.second / temp.first; }

int main() {
	vector<c_p_dd> v; int n; double t; cin >> n >> t; v.resize(n);
	for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
	sort(v.begin(), v.end(),
		[](const c_p_dd& l, const c_p_dd& r) { return f_slope(l) > f_slope(r); }
	);
	cout << fixed << setprecision(4) << f_slope(v[0]) * t << endl;
	return 0;
}


Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N, M; cin >> N >> M;
    vector<int> H(N);
    for(auto& it:H){
        cin >> it;
    }

    vector<bool> chk(N,true);

    for(int i=0; i<M; i++){
        int A, B; cin >> A >> B;
        if(H.at(A-1) > H.at(B-1)){
            chk.at(B-1) = false;
        }else if(H.at(A-1) < H.at(B-1)){
            chk.at(A-1) = false;
        }else{
            chk.at(A-1) = false;
            chk.at(B-1) = false;
        }
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        if(chk.at(i)){
            ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3796
#include<iostream>
#include<cstdio>

using namespace std;

const int maxn=1e5+5;
const int sentinel=0x3f3f3f3f;

struct card{
    char suit;
    int value;
};

int n;
card a[maxn],b[maxn],l[maxn/2+2],r[maxn/2+2];

void merge(int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++){
        l[i]=a[left+i];
    }
    for(int i=0;i<n2;i++){
        r[i]=a[mid+i];
    }
    l[n1].value=r[n2].value=sentinel;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(l[i].value<=r[j].value){
            a[k]=l[i++];
        }else{
            a[k]=r[j++];
        }
    }
}

void mergesort(int left,int right)
{
    int mid;
    if(left+1<right){
        mid=(left+right)>>1;
        mergesort(left,mid);
        mergesort(mid,right);
        merge(left,mid,right);
    }
}

int partition(int p,int r)
{
    struct card t,x;
    x=b[r];
    int i=p-1;
    for(int j=p;j<r;j++){
        if(b[j].value<=x.value){
            i++;
            swap(b[i],b[j]);
        }
    }
    swap(b[i+1],b[r]);
    return i+1;
}

void quicksort(int p,int r)
{
    int q;
    if(p<r){
        q=partition(p,r);
        quicksort(p,q-1);
        quicksort(q+1,r);
    }
}

int main()
{
    char s[10];
    int stable=1,v;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %d",s,&v);
        a[i].suit=b[i].suit=s[0];
        a[i].value=b[i].value=v;
    }
    mergesort(0,n);
    quicksort(0,n-1);
    for(int i=0;i<n;i++){
        if(a[i].suit!=b[i].suit){
            stable=0;
            break;
        }
    }
    if(stable==1){
        printf("Stable\n");
    }else{
        printf("Not stable\n");
    }
    for(int i=0;i<n;i++){
        printf("%c %d\n",b[i].suit,b[i].value);
    }
    return 0;
}
/*
6
D 3
H 2
D 1
S 3
D 2
C 1
*/



Measured memory_bytes: 5456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ios::sync_with_stdio(false);
	ll n; cin >> n;
	bool a = 1;
	for(ll i = 0; i < n; ++i){
		ll b; cin >> b;
		a ^= (b & 1);
	}
	cout << (a ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int D[107][7],i,j,N;
int G[55][6]={
    {1,2,3},{1,3,5},{1,5,4},{1,4,2},
    {2,1,4},{2,4,6},{2,6,3},{2,3,1},
    {3,1,2},{3,2,6},{3,6,5},{3,5,1},
    {4,1,5},{4,2,1},{4,6,2},{4,5,6},
    {5,1,3},{5,3,6},{5,4,1},{5,6,4},
    {6,2,4},{6,4,5},{6,5,3},{6,3,2}};
 
int ch(int a,int b)
{
    int i;
    for(i=0;i<24;i++)
    {
        if(D[a][1]==D[b][G[i][0]]&&
           D[a][2]==D[b][G[i][1]]&&
           D[a][3]==D[b][G[i][2]]&&
           D[a][6]==D[b][7-G[i][0]]&&
           D[a][5]==D[b][7-G[i][1]]&&
           D[a][4]==D[b][7-G[i][2]])
        return 1;
    }
    return 0;
}
 
int main()
{
    scanf("%d",&N);
    for(i=0;i<N;i++)
        for(j=1;j<=6;j++)
            scanf("%d",&D[i][j]);
    for(i=0;i<N;i++)
        for(j=i+1;j<N;j++)
        {
            if(ch(i,j))
            {
                puts("No");
                return 0;
            }
        }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,x) for(int i=0; i<(int) (x); i++)
#define PI 3.14159265359
using namespace std;

int main()
{
	char a;
	cin >> a;
	if(a<91)
		cout << "A" << endl;
	else
		cout << "a" << endl;
	//////////////////////////////////
	//--------end--------
	//
	return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
using namespace std;

int linearSearch(int A[], int n, int key) {
    int i = 0;
    A[n] = key;

    while (A[i] != key) i++;
    return i != n;
}

int main() {
    int i, n, A[10000+1], q, key, sum = 0;

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

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &key);
        if (linearSearch(A, n, key)) sum++;
    }

    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 2704
S = input().split('T')
S = [len(s) for s in S]
X = S[::2]
Y = S[1::2]

from collections import defaultdict,deque

dpx = defaultdict(int)# 初期値を0にした辞書
dpy = defaultdict(int)# 初期値を0にした辞書

dpx[sum(X)] = 1
dpy[sum(Y)] = 1
que = deque()
for i,x in enumerate(X):
    if i == 0:
        continue
    for k,v in dpx.items():
        if v:
            que.append(k-2*x)
    while que:
        q = que.popleft()
        dpx[q] = 1

for i,y in enumerate(Y):
    for k,v in dpy.items():
        if v:
            que.append(k-2*y)
    while que:
        q = que.popleft()
        dpy[q] = 1


x,y = map(int,input().split())
print('Yes' if dpx[x] and dpy[y] else 'No')


Measured memory_bytes: 85084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, d, x[11][11];
int ans;
int cnt;

signed main() {
	cin >> n >> d;
	rep(i, n) {
		rep(j, d)cin >> x[i][j];
	}
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			rep(k, d) {
				cnt += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
			}
			if ((int)sqrt(cnt)*(int)sqrt(cnt) == cnt)ans++;
			cnt = 0;
		}
	}
	cout << ans << endl;
}

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

int		main(void)
{
	vector<string> siritori(3);
	for (int i = 0; i < 3; i++)
		cin >> siritori.at(i);
	if (siritori.at(0).at(siritori.at(0).size() - 1) == siritori.at(1).at(0))
		cout << (siritori.at(1).at(siritori.at(1).size() - 1) == siritori.at(2).at(0) ? "YES" : "NO") << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <algorithm>
#include <fstream>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
struct edge{ int to, cost; };

const int INF = 1<<30;
const int MAX_V = 40500;
int N, V;
int d[MAX_V];
int cost[10][10];
vector<edge> G[MAX_V];

int factorial (int n )
{
	if (n == 0 ) return 1;

	return n*factorial (n-1 );
}

void make_edge (map<vector<int>, int> node )
{
	map<vector<int>, int>::iterator it = node.begin();
	for (; it != node.end(); it++ ){
		vector<int> s = (*it).first;
		int from = (*it).second;
		rep (i, N ){
			for (int j = i+1; j < N; j++ ){
				int c = cost[i][j];
				swap (s[i], s[j] );
				int to = node[s];
				edge e;
				e.to = to, e.cost = c;
				G[from].push_back (e );
				swap (s[i], s[j] );
			} // end for
		} // end rep
	} // end for
}

void dijkstra (int s )
{
	priority_queue<P, vector<P>, greater<P> > que;
	fill (d,  d + V, INF );
	d[s] = 0;
	que.push (P (0, s ) );

	while (!que.empty() ){
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first ) continue;
		rep (i, G[v].size() ){
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost ){
				d[e.to] = d[v] + e.cost;
				que.push (P (d[e.to], e.to ) );
			} // end if
		} // end rep
	} // end while
}

int main()
{
	memset (cost, 0, sizeof (cost ) );
	cin >> N;
	int n = N;

	V = factorial(n );

	rep (i, n ) rep (j, n ) cin >> cost[i][j];

	vector <int> order(n, 0 );
	map <vector<int> , int>  node;

	rep (i, n ) order[i] = i;

	int cnt = 0;
	do{
		node[order] = cnt;
		cnt++;
	} while (next_permutation (ALL (order ) ) );	

	make_edge (node );
	dijkstra (0 );

	int res = 0;
	rep (i, V )
		res = max (res, d[i] );

	cout << res << endl;
		
	return 0;
}

Measured memory_bytes: 17000
#include<iostream>
//#include<CastingInterop.h>
#include<string>
#include<array>
using namespace std;

int main()
{
	int x;
	string s;
	/*int arr1[4];
	for (int i = 0; i < 4; i++)
	{
		cin >> arr1[i];
	}*/
	cin >> s;
	
	
	
	if (s[0] == s[1]&&s[0] == s[2] || s[1] == s[2] &&s[1]== s[3] || s[0] == s[1]&&s[1] == s[2]&&s[2] == s[3])
		cout << "Yes";
	else if (s[0] == s[1] || s[2] == s[3])
		cout << "No";

	else
		cout << "No";
}

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

using namespace std;
typedef long long LL;

int main(){
  LL N, K;
  cin >> N >> K;
  vector<LL> A(N);
  rep(i,N) cin >> A[i];
  rep(i,N) A[i]--;
  vector<LL> visit(N, -1);
  LL now=0;
  LL dif, loop;
  if(N>=K){
    rep(i,K) now=A[now];
    cout << now+1 << endl;
    return 0;
  }
  rep(i,N+1){
    if(visit[now]!=-1){
      dif=i-visit[now];
      loop=now;
      break;
    }
    visit[now]=i;
    now=A[now];
  }
  rep(i,(K-visit[loop])%dif) now=A[now];
  cout << now+1 << endl;

  return 0;
}


Measured memory_bytes: 6432
"""
union-find木
"""


class UnionFind:
    def __init__(self, n):
        self.par = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

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


def abc120_d():
    n, m = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(m)]

    ans = 0
    for i in range(m):
        uf = UnionFind(n)
        for j in range(m):
            if i == j:
                continue
            uf.unite(ab[j][0] - 1, ab[j][1] - 1)

        s = set()
        for j in range(n):
            s.add(uf.find(j))
        if len(s) > 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    abc120_d()


Measured memory_bytes: 43376
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            int ans = 0;

            // 出力
            if (S.charAt(0) == 'R' && S.charAt(1) == 'R' && S.charAt(2) == 'R') {
                ans = 3;
            } else if (S.charAt(0) == 'R' && S.charAt(1) == 'R') {
                ans = 2;
            } else if (S.charAt(1) == 'R' && S.charAt(2) == 'R') {
                ans = 2;
            } else if (S.charAt(0) == 'R' || S.charAt(1) == 'R' || S.charAt(2) == 'R') {
                ans = 1;
            }


            out.println(ans);

        }

    }
}



Measured memory_bytes: 35820
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
//int g(int x){
//	x=modpow(x,MOD-2);
//	return x;
//}
int n,m,cnt[100010],ans[100010];
vector<int>v[100010];
queue<int>q;
signed main(){
	cin>>n>>m;
	rep(i,n-1+m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		v[a].pb(b);
		cnt[b]++;
	}
	rep(i,n)if(!cnt[i])q.push(i);
	while(!q.empty()){
		int x=q.front();
		q.pop();
		for(int to:v[x]){
			cnt[to]--;
			if(!cnt[to]){
				ans[to]=x+1;
				q.push(to);
			}
		}
	}
	rep(i,n)cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 8064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AWeatherPrediction solver = new AWeatherPrediction();
        solver.solve(1, in, out);
        out.close();
    }

    static class AWeatherPrediction {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            if (x.compareTo("Sunny") == 0) {
                out.println("Cloudy");
            } else if (x.compareTo("Cloudy") == 0) {
                out.println("Rainy");
            } else {
                out.println("Sunny");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public 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();
        }

    }
}



Measured memory_bytes: 21332
#!/usr/bin/env python3
import sys
import itertools

def half(odd):
    return (odd + 1) // 2


class cPrimes:
    def __init__(self, N):
        self.N = N
        self.L = N // 96 + 1
        self.sieve()
    
    def sieve(self):
        self.bits = [ -1 ] * self.L
        for p in itertools.takewhile(lambda p: p * p < self.N,
                            itertools.islice(self.enumerate(), 2, None)):
            k0 = p // 3
            for k in range(k0 + p * 2, self.N // 3 + 1, p * 2):
                self.erase_bit(k)
            for k in range(-k0 - 1 + p * 2, self.N // 3 + 1, p * 2):
                self.erase_bit(k)
    
    def enumerate(self):
        yield 2
        yield 3
        k0 = 1
        for m, B in enumerate(self.bits):
            for k in range(k0, 32):
                if ((B >> k) & 1) == 1:
                    yield m * 96 + k * 3 + 1 + (k & 1)
            k0 = 0
    
    def is_prime(self, n):
        if n < 4:
            return n >= 2
        else:
            q, r = divmod(n, 6)
            if r == 1:
                k = q >> 4
                l = (q & 15) << 1
                return ((self.bits[k] >> l) & 1) == 1
            elif r == 5:
                k = q >> 4
                l = ((q & 15) << 1) + 1
                return ((self.bits[k] >> l) & 1) == 1
            else:
                return False
    
    def erase_bit(self, k):
        m = k >> 5 # 6bit目以降
        l = k & 31 # 5bit目まで
        if l != 31:
            self.bits[m] &= ~(1 << l)
        else:
            self.bits[m] &= ~(-1 << 31)


def solve(Q: int, l: "List[int]", r: "List[int]"):
    limit = max(r)
    like2017_count = [0 for i in range(half(limit)+1)]
    cp = cPrimes(limit)

    for i in range(1, half(limit)+1):
        if cp.is_prime(i) and cp.is_prime(i * 2 - 1):
            like2017_count[i] = like2017_count[i-1] + 1
        else:
            like2017_count[i] = like2017_count[i-1]
    
    for q in range(Q):
        print(like2017_count[half(r[q])] - like2017_count[half(l[q])-1])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    Q = int(next(tokens))  # type: int
    l = [int()] * (Q)  # type: "List[int]" 
    r = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(Q, l, r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
int dx[4] = { 0, 0, 1, -1 },dy[4] = { 1, -1, 0, 0 }, H,W;
char mapdata[110][110];
void dfs(int y,int x){
    char tmp = mapdata[y][x];mapdata[y][x] = '.';
    rep(i,4){
        int ny = y+dy[i],nx = x+dx[i];
        if(0 <= ny && ny < H && 0 <= nx && nx < W && tmp == mapdata[ny][nx]) dfs(ny,nx);
    }
}
int main(){
    while(1){
        cin >> H >> W;if(H == 0 && W == 0) break;
        int ans = 0;
        rep(i,H) cin >> mapdata[i];
        rep(i,H){
            rep(j,W){
                if(mapdata[i][j] != '.'){
                dfs(i,j); ans++;
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int X, A;
    cin >>  X >> A;
    cout << (X < A ? 0 : 10) << endl;
    return (0^_^0);
}



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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    int res = 0;
    if (K == N) res = 1;
    else if (K == 2) res = N - 1;
    else for (int i = 0; i < N - 1; i += K-1) ++res;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> V;

#define _ cin.tie(0);ios::sync_with_stdio(false);
int n;
int main(){ _;
  cin>>n;
  int ans=0;
  FOR(i,1,n+1){
    int mod=0;
    if (i%2==0 ) continue;
    FOR(j,1,i+1){
      if(i%j==0){
	++mod;
      }
    }
    if(mod==8){
      ++ans;
    }
  }
  cout<<ans<<endl;
    

  return 0;
}


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

int arr[22][22];
long long int dp[22][(1<<22)];
int n;
long long int call(int i,long long int mask)
{
	 if(i==n)
	 return 1;
	 
	 if(dp[i][mask]!=-1)
	  return dp[i][mask];
	  
	long long int ans=0;
	for(int j=0;j<n;j++)
	{
		if(arr[i][j] && !(mask&(1<<j)))
		ans=(ans%1000000007+call(i+1,(mask|(1<<j)))%1000000007)%1000000007;
	}
	return dp[i][mask]=ans%1000000007;
}

 int main() 
{  

 cin>>n;
 for(int i=0;i<n;i++)
  for(int j=0;j<n;j++)
    cin>>arr[i][j];

  for(int i=0;i<=n;i++)
    for(int j=0;j<=(1<<n);j++)
      dp[i][j]=-1;
 
  cout<<call(0,0)<<endl;
 
	return 0;
} 

Measured memory_bytes: 405760
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

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


int main() {
  int N;
  cin>>N; 
  vector<long>a(5);
  rep(i,N){
    string s;
    cin>>s;
    if(s.at(0)=='M'){
      a.at(0)++;
    }
    else if(s.at(0)=='A'){
      a.at(1)++;
    }
    else if(s.at(0)=='R'){
      a.at(2)++;
    }
    else if(s.at(0)=='C'){
      a.at(3)++;
    }
    else if(s.at(0)=='H'){
      a.at(4)++;
    }
  }
  long ans=0;
  rep(i,5){
    rep2(j,i+1,5){
      rep2(k,j+1,5){
        ans+=a.at(i)*a.at(j)*a.at(k);
      }
    }
  }
  cout << ans<< endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int val = 0;
    int ans = 0;
    rep(i,n) {
        if (s[i] == 'I') val++;
        else val--;
        chmax(ans,val);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
///1<<3シフト演算子 とは　0001の1を三つずらして1000にする, これは8を表しておりつまりbitは0から7まで
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"Yes"<<endl
#define cno cout<<"No"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using ld = long double;

//条件式 ? 真の場合の文 : 偽の場合の文
//abs(x) = (x の絶対値)
//string S  S,at(i),S += T,S += c,S.size(),S.substr(l)l文字目から最後まで,
///S.substr(l, r)l文字目からl+r-1文字目 n文字目から0個で空列を返せる
//*min_element(all(x)) *max_element(all(x))
//vi x; x.back(),x.front(),x.push_back(),x.pop_back()
//swap(a, b)
//gcd(a, b)最大公約数
//sort(all(x)),reverse(all(x)),sort(x.begin()+l,a.begin()+r)lからrまで
//stack<int> a; a.push(x),a.pop(),a.top(),a.empty()bool
//queue<int> b; b.push(x),b.pop(),b.front(),b.empty()bool,b.size() 要素が小さい順
//priority_queue<int, vector<int>, greater<int>> c,c.top()
//map<int, int> M1; 変数[key] = value; 変数.erase(key); 変数.at(key); 変数.count(key)所属判定　変数.size()
//find(all(x), key)boolソート済みのベクトル
//*lower_bound(all(x),k)以上の最小の要素,*uppper_bound(all(x),k)より大きい最小の要素
//char('0'+cnt) 数字cntからcharへの変換
//int(char-'0') charからintへの変換


int sum(int x){
    return x*(x+1)/2;
}

int main(){

    int n;
    cin >> n;
    
    int k = 0;
    while(sum(k) < n) k++;

    int red = sum(k) - n;

    for(int i = 1; i < red; i++) cout << i << endl;
    for(int i = red+1; i < k+1; i++) cout << i << endl;


}


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

typedef long long int ll;
int main(){
    string S;
    ll K;
    cin >> S >> K;
    for(int i = 0;i < S.size();i++){
        if(S[i] != '1' ){
            cout << S[i] << endl;
            break;
        }
        if(S[i] == '1' && i + 1 >= K){
            cout << 1 << endl;
            break;
        }
        if(i == S.size() - 1 && S[i] == '1'){
            cout << 1 << endl;
           break;
        }
    }
}

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

int main(){
  int x, y;
  string ans = "Yes";
  cin >> x >> y;
  
  if(y % 2 != 0){
    ans = "No";
  }
  if(y > 4 * x || y < 2 * x){
    ans = "No";
  }
  
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 階乗
fn factorial(n: i32) -> i32 {
    let mut factorial_value: i32 = 1;
    for i in 1..(n + 1)
    {
        factorial_value *= i;
    }

    return factorial_value;
}
    
fn main() {
    let n: i32 = read();
    let xy: Vec<Vec<i32>> = read_vec2(n as u32);
    let mut sum_distance: f64 = 0.0;
    let mut distance_count: i32 = 0;

    // 経路はN!通りだが、実際に必要な町間距離の情報は(1..N の和)通りである。
    for i in 0..(n - 1) as usize
    {
        for j in (i + 1)..n as usize
        {
            let distance: f64 = (( (xy[i][0] - xy[j][0]).pow(2) + (xy[i][1] - xy[j][1]).pow(2) ) as f64).sqrt();
            sum_distance += distance;
            distance_count += 1;
        }
    }

    // 町間距離の総計は(N - 1) * N!を取得した町間距離で割った数
    sum_distance *= ((n - 1) * factorial(n) / distance_count) as f64;
    // N!で割る
    sum_distance /= factorial(n) as f64;

    println!("{}", sum_distance);
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
    long long N,K,k,M,S,T,i;
    cin>>N>>K;
    long long A[N];
    S=0;
    for(i=0;i<N;i++){
        cin>>A[i];
        S+=A[i];
    }
    M=1;
    while(M<K+1){
        M*=2;
    }
    M/=2;
    k=0;
    while(M>0){
        k+=M;
        T=0;
        for(i=0;i<N;i++){
            T+=A[i]^k;
        }
        if(T>S&&k<K+1){
            S=T;
        }else{
            k-=M;
        }
        M/=2;
    }
    cout<<S<<endl;
}

Measured memory_bytes: 1024
import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(1000000)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))

    N = int(input())
    S = input()
    start = S[0]
    ret = start
    for i in range(1, N):
        end = S[i]
        if start != end:
            start = end
            ret += end
    print(len(ret))


if __name__ == "__main__":
    main()


Measured memory_bytes: 5984
n = int(input())
ans = {}

bosses = input().split(' ')

for id in range(n-1):
  if ans.get(bosses[id]) is None:
    ans[bosses[id]] = 1
  else:
    ans[bosses[id]] += 1
    
for id in range(n):
  if ans.get(str(id+1)) is None:
    print(0)
  else:
    print(ans.get(str(id+1)))

Measured memory_bytes: 39464
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 29 18:42:42 2018

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []

A, B, C = map(int, input().split())
n_poison = 0
if A+B >= C:
    n_poison = C
else:
    n_poison = A+B+1

print(B+n_poison)
    
    

Measured memory_bytes: 15172
import copy
n = int(input())
list0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
list1 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list2 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list3 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list4 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
for i in range(n):  
  b, f, r, v = list(map(int, input().split()))
  if b == 1:
    list1[f-1][r-1] += v
  elif b == 2:
    list2[f-1][r-1] += v
  elif b == 3:
    list3[f-1][r-1] += v
  else:
    list4[f-1][r-1] += v
for j in range(3):
  print(" " + " ".join((list(map(str, list1[j])))))
print("####################")
for j in range(3):
  print(" " +" ".join((list(map(str, list2[j])))))
print("####################")
for j in range(3):
  print(" " + " ".join((list(map(str, list3[j])))))
print("####################")
for j in range(3):
  print(" " + " ".join((list(map(str, list4[j])))))


Measured memory_bytes: 6344
from itertools import accumulate
from collections import defaultdict


N, M = map(int, input().split())
A = list(map(int, input().split()))

S = [0]
S.extend(accumulate(A))
S = [s % M for s in S]

D = defaultdict(int)
ans = 0
for s in S:
    ans += D[s]
    D[s] += 1

print(ans)


Measured memory_bytes: 16928
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		Integer[] a = new Integer[m];
		for(int i = 0; i < m; i++){
		    a[i] = sc.nextInt();
		}
		
		// 計算
		int result = Integer.MAX_VALUE;
		int index = upperBound(a, x);
		result = min(m - index, index);
		
		// 出力
		System.out.println(result);
		
	}
	
	static int upperBound(Integer[] array, int n){
		int index = ~Arrays.binarySearch(array, n, (x,y) -> x.compareTo(y) > 0 ? 1 : -1);
		return index;
	}
}




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

using namespace std;

#define F first
#define S second
const int MAX_N = 1<<18;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> P;

int n;
int minX[2*MAX_N-1],maxX[2*MAX_N-1];
int minY[2*MAX_N-1],maxY[2*MAX_N-1];

struct Data{
    int x,y,b;
    Data(){}
    Data(int x,int y,int b) : x(x),y(y),b(b) {}
    bool operator < (const Data &d)const{
        return b < d.b;
    }
};

void init(ll n_){
    n = 1;
    while(n < n_) n *= 2;
    for(int i = 0 ; i < 2*n-1 ; i++){
        minX[i] = minY[i] = INT_MAX;
        maxX[i] = maxY[i] = INT_MIN;
    }
}

void update(int k,pii p){
    k += n - 1;
    minX[k] = min(minX[k],p.first);
    maxX[k] = max(maxX[k],p.first);
    minY[k] = min(minY[k],p.second);
    maxY[k] = max(maxY[k],p.second);
    while(k > 0){
        k = (k - 1) / 2;
        minX[k] = min(minX[2*k+1],minX[2*k+2]);
        maxX[k] = max(maxX[2*k+1],maxX[2*k+2]);
        minY[k] = min(minY[2*k+1],minY[2*k+2]);
        maxY[k] = max(maxY[2*k+1],maxY[2*k+2]);
    }
}

P query(int a,int b,int k,int l,int r){
    if(r <= a || b <= l){
        return P(pii(INT_MAX,INT_MIN),pii(INT_MAX,INT_MIN));
    }
    if(a <= l && r <= b){
        return P(pii(minX[k],maxX[k]),pii(minY[k],maxY[k]));
    }else{
        P vl = query(a,b,2*k+1,l,(l+r)/2);
        P vr = query(a,b,2*k+2,(l+r)/2,r);
        return P(pii(min(vl.F.F,vr.F.F),max(vl.F.S,vr.F.S)),
                 pii(min(vl.S.F,vr.S.F),max(vl.S.S,vr.S.S)));
    }
}

ll getArea(P p){
    return (ll)(p.F.S-p.F.F)*(ll)(p.S.S-p.S.F);
}

int main(){
    int N,d,x,y,b;
    cin >> N >> d;
    vector<Data> v(N);
    for(int i = 0 ; i < N ; i++){
        cin >> x >> y >> b;
        v[i] = Data(x,y,b);
    }
    sort(v.begin(),v.end());
    init(N);
    for(int i = 0 ; i < N ; i++){
        update(i,pii(v[i].x,v[i].y));
    }
    ll res = 0;
    for(int i = 0, j = 0 ; i < N ; i++){
        int s = v[i].b, t = v[j].b;
        while(j < N && t - s <= d) j++, t = v[j].b;
        j--;
        P p = query(i,j+1,0,0,n);
        res = max(res,getArea(p));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 11628
from collections import OrderedDict as od
 
  
dic = od()
for s in "abcdefghijklmnopqrstuvwxyz":
    dic[s] = 0
 
x = ""
while True:  
    try:  
        x += input().lower()
    except EOFError:
        break
 
for key,value in dic.items():
    value = x.count(key)
    print(key, ":", value)


Measured memory_bytes: 5964
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const ll INF=1e18;


string s;

void bfs(string w,int i,int sum){
  if(i==4&&sum==7){
    cout << w+"=7"<<endl;
    exit(0);
  }
  if(i==4) return;
  bfs(w+"+"+s[i],i+1,sum+(int)(s[i]-'0'));
  bfs(w+"-"+s[i],i+1,sum-(int)(s[i]-'0'));
}
int main() {
  string w="";
  cin>>s;
  w+=s[0];
  bfs(w,1,(int)(s[0]-'0'));
}

Measured memory_bytes: 3632