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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    string s, t;
    cin >> s >> t;

    int res = 0;
    for (int i=0; i<(int)s.size(); ++i) if (s[i] != t[i]) ++res;
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if (e - a <= k) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    
}

Measured memory_bytes: 3624
N=int(input())
A=list(map(int, input().split()))

flag=0 #増加で継続する場合1,減少で継続する場合-1,切り替わり時0
cnt=0

for i in range(N-1):
    if A[i+1]-A[i] >0:
        if flag ==1:
            continue
        elif flag ==-1:
            flag =0
            cnt+=1
        elif flag ==0:
            flag =1
    elif A[i+1]-A[i] <0:
        if flag ==-1:
            continue
        elif flag ==1:
            flag =0
            cnt+=1
        elif flag ==0:
            flag =-1
    elif A[i+1]-A[i] ==0:
        if flag == 0:
            flag = 0
        elif flag ==1:
            flag =1
        elif flag ==-1:
            flag =-1
print(cnt+1) #区切った数ではなく分割された個数なので+1

Measured memory_bytes: 20160
//ABC333.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        if(a==1&&b==1){
            System.out.println("Yes");
        }
        else if(a==3&&b==3){
            System.out.println("Yes");
        }
        else if(a==1&&b==3||a==3&&b==1){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 21716
#include<stdio.h>
#define N 101

int n,g[N][N],color[N],d[N],f[N],t=0;

void visit(int u){
  int i;

  color[u]=1;

  d[u]=++t;

  for(i=0;i<n;i++){
    if(g[u][i]==0)continue;
    if(color[i]==0)visit(i);
  }

  color[u]=2;
  f[u]=++t;
}

void dfs(){
  int i;

  for(i=0;i<n;i++) color[i]=0;

  for(i=0;i<n;i++){
    if(color[i]==0) visit(i);
  }

  for(i=0;i<n;i++) printf("%d %d %d\n",i+1,d[i],f[i]);
}

int main(){

  int i,j,v,a,node;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      g[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&a,&v);
    for(j=0;j<v;j++){
      scanf("%d",&node);
      g[i][node-1]=1;
    }
  }
  dfs();

  return 0;
}



Measured memory_bytes: 2112
n_500 = int(input())
n_100 = int(input())
n_50 = int(input())
price = int(input())
count = 0

for i in range(n_500+1):
    for j in range(n_100+1):
        for k in range(n_50+1):
            if(price ==500*i+100*j+50*k):
                count+=1

print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 1000005;
int lc[maxn], rc[maxn], flag[maxn], num[maxn], d[maxn];
int n, cur, size = 1, ans, ans2; LL L;
char s[maxn];

int lowbit(LL x) {
	int res = 0;
	while (!(x&1)) res++, x >>= 1;
	return res;
}

int main() {
	scanf("%d%lld", &n, &L);
	while (n--) {
		scanf("%s", &s); cur = 1;
		for (int i=0; s[i]; i++) 
			if (s[i] == '0') {
				if (!lc[cur]) {
					lc[cur] = ++size; d[size] = d[cur] + 1;
					rc[cur] = ++size; d[size] = d[cur] + 1;
				}
				cur = lc[cur];
			}
			else {
				if (!rc[cur]) {
					lc[cur] = ++size; d[size] = d[cur] + 1;
					rc[cur] = ++size; d[size] = d[cur] + 1;
				}
				cur = rc[cur];
			}
		flag[cur] = 1;
	}
	rep (i, 1, size)
		if (!lc[i] && !rc[i] && !flag[i])
			num[lowbit(L-d[i]+1)] ^= 1;
	rep (i, 0, 60)
		if (num[i]) return puts("Alice"), 0;
	puts("Bob");
	return 0;
}

Measured memory_bytes: 9344
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int q = 0, s = 0;
		q = scan.nextInt();
		for(int i = 1;i <= q; i++) {
			int c = scan.nextInt();
			int a = scan.nextInt();
			int n = scan.nextInt();
			while(true) {
				if(	c >= 1 && a >= 1 && n >= 1) {	//CANか判定
					s = s + 1;
					c --;
					a --;
					n --;
				} else if( a >= 1 && c >= 2) {	//CCAか判定
					s = s + 1;
					c -= 2;
					a --;
				} else if(c >= 3) {	//CCCか判定
					s = s + 1;
					c = c -3;
				} else {
					break;
				}
			}
			System.out.println(s);
			s = 0;
			c = 0;
			a = 0;
			n = 0;
		}
	}
}

Measured memory_bytes: 20620
#include <stdio.h>
#include <algorithm>

using namespace std;

struct foo {
    int w, s, v;
};

bool operator<(foo a, foo b) {
    return a.w + a.s < b.w + b.s;
}

int N;
foo F[1000];

long long dp[20001];

void to(long long *x, long long y) {
    if (*x < y) *x = y;
}

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d %d %d", &F[i].w, &F[i].s, &F[i].v);
    }
    sort(F, F + N);
    for (int i = 0; i <= 20000; i++) {
        dp[i] = -2e18;
    }
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = F[i].s; j >= 0; j--) {
            to(&dp[j + F[i].w], dp[j] + F[i].v);
        }
    }
    long long ans = 0;
    for (int i = 0; i <= 20000; i++) {
        to(&ans, dp[i]);
    }
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 384
N=int(input())
S=N//15
P=[1,2,4,7,8,11,13,14]
P2=[3,5,6,9,10,12]
Q=0
D=0
if S==0:
    for i in range(1,N+1):
        if i in P2:
            continue
        else:
            D=D+i
else:
    T=S-1
    D=(60+60+15*T*8)*S//2
    N1=N-15*S
    for i in range(1,N1+1):
        if i in P2:
            continue
        else:
            D=D+i+15*S

print(D)
    


Measured memory_bytes: 9208
#include <iostream>
#include <numeric>
#include <algorithm>
#include <string>

typedef long long ll;
using namespace std;

int gcd(int x, int y) {
	while (y != 0) {
		int r = x % y;
		x = y; y = r;
	}
	return x;
}


int main() {
	int N, M;
	string S, T;
	cin >> N >> M >> S >> T;

	for (int i = 0; i < gcd(N, M); i++) {
		if (S[N / gcd(N, M)*i] != T[M / gcd(N, M)*i]) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << (ll)N*M / gcd(N, M);
}

Measured memory_bytes: 512
//
//  main.cpp
//  C - Low Elements
//
//  Created by Hashizo on 2020/01/19.
//  Copyright © 2020 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())


int main(int argc, const char * argv[]) {
	ll ans = 0;

	ll n;
	cin >> n;

	ll point = LONG_MAX;
	vector<ll> p(n);
	REP(i, n) {
		cin >> p[i];
	
		if (point >= p[i]) {
			ans++;
			point = p[i];
		}
	
	}

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


Measured memory_bytes: 1792
from itertools import product

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

a = []
count = 0
for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) > K:
                break
            a.append(A[i] + B[j] + C[k])

a.sort(reverse=True)

for i in range(K):
    print(a[i])

Measured memory_bytes: 8748
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	void solve(){

		
		ini(n);
		vi mortyu(n);
		vi mortym(n);
		vi mortyd(n);
		FOR(i,0,n){
			in(mortyu[i]);
		}
		FOR(i,0,n){
			in(mortym[i]);
		}
		FOR(i,0,n){
			in(mortyd[i]);
		}
		sort(all(mortym),greater<int>());
		sort(all(mortyd),greater<int>());

		vi pref(n);
		FOR(i,0,n){
			int tmp = mortym[i];
			int ll = 0;
			int rr = n-1;
			while(ll<=rr){
				int mid = ll+(rr-ll)/2;
				if(mortyd[mid]>tmp)ll = mid+1;
				else rr = mid-1;
			}
			pref[i] = ll;
		}
		FOR(i,1,n){
			pref[i]+=pref[i-1];
		}
		int rick = 0;
		FOR(i,0,n){
			int tmp = mortyu[i];
			int ll = 0;
			int rr = n-1;
			while(ll<=rr){
				int mid = ll+(rr-ll)/2;
				if(mortym[mid]>tmp)ll = mid+1;
				else rr = mid-1;
			}
			if(ll == 0)continue;
			else{
				//out(tmp,ll);
				rick+=pref[ll-1];
			}
		}
		out(rick);









		
		
	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 3456
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<(999<n ? "ABD" : "ABC")<<'\n';
  return(0);
}


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    int N, Q;
    string S;
    cin >> N >> Q >> S;

    vector<int> acc(N + 1);
    acc[0] = 0;
    acc[1] = 0;
    FOR(i, 1, N) {
        if (S[i - 1] == 'A' && S[i] == 'C') {
            acc[i + 1] = acc[i] + 1;
        } else {
            acc[i + 1] = acc[i];
        }
        //printf("acc[%d] = %d\n", i + 1, acc[i + 1]);
    }
    
    REP(_, Q) {
        int l, r;
        cin >> l >> r;
        l--;
        int result = acc[r] - acc[l];
        if (acc[l] + 1 == acc[l + 1]) {
            result--;
        }
        cout << result << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
ll longinf=1ll<<60;
int inf=1<<29;

int N,K;


int main(){
    cin>>N>>K;
    if(N%K==0) cout<<0<<endl;
    else cout<<1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}


int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a < c && c < b) cout << "Yes" << endl;
    else if(a > c && c > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

int main() {
   Int v, e;
   std::cin >> v >> e;
   std::vector<Int> ss(e), ts(e), cs(e), fs(e);
   rep(i, e) {
      std::cin >> ss[i] >> ts[i] >> cs[i];
   }
   std::vector<std::vector<Int>> fes(v), bes(v);
   rep(i, e) {
      Int s = ss[i], t = ts[i];
      fes[s].emplace_back(i);
      bes[t].emplace_back(i);
   }
   Int res = 0;
   Int source = 0;
   Int sink = v-1;
   for(;;) {
      std::queue<Int> q;
      std::vector<Int> xs(v);
      std::vector<Int> ps(v, -1), es(v, -1);
      q.emplace(source);
      xs[source] = (Int)1 << 53;
      while( not q.empty() ) {
         Int z = q.front(); q.pop();
         rep(r, 2) {
            for(Int i : r?fes[z]:bes[z]) {
               Int w = r ? cs[i] - fs[i] : fs[i];
               Int s = z, t = r ? ts[i] : ss[i];
               guard( ps[t] == -1 );
               if( w > 0 ) {
                  ps[t] = s;
                  es[t] = i;
                  xs[t] = std::min(xs[s], w);
                  q.emplace(t);
               }
            }
         }
      }
      Int f = xs[sink];
      fprintf(stderr, "f = %ld\n", f);
      if( f == 0 ) break;
      for(Int i = sink; i != source; i=ps[i]) {
         Int k = es[i];
         fprintf(stderr, "k=%ld\n", k);
         fs[k] += (ts[k] == i ? +f : -f);
      }
      res += f;
      rep(i, e) {
         fprintf(stderr, "%ld -> %ld : %ld/%ld\n", ss[i], ts[i], fs[i], cs[i]);
      }
   }
   printf("%ld\n", res);
}



Measured memory_bytes: 3308
#include <math.h>
#include <iostream>
using  namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=1e5+5;

int min(int x,int y)
{
  if(x>=y) return  y;
  else return x;
}
int a[10][10];
int main()
{
  ll n,d,ans=0;
    cin>>n>>d;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<d; j++)
        {
            cin>>a[i][j];
        }
    }
    for(int i=0; i<n-1; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            ll sum=0;
            for(int k=0; k<d; k++)
            {
                sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            if((sum-(int)sqrt(sum)*(int)sqrt(sum))<1e-3) ans++;
            sum=0;
        }
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repi(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
int main() {
  int n,a1e,a2v=0;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  a1e=max_element(a.begin(),a.end())-a.begin();
  rep(i,n){
    if(i!=a1e) a2v=max(a2v,a[i]);
  }
  rep(i,n){
    if(i==a1e) cout<<a2v<<endl;
    else cout<<a[a1e]<<endl;
  }
  return 0;
}


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


#define SZ(x) ((int)(x).size())


typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
struct Vec{
    double x, y;
};

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;
}

template<class T>
T min(T a, T b)
{
    if (a < b) return a;
    return b;
}

template<class T>
T max(T a, T b)
{
    if (a > b) return a;
    return b;
}

using namespace std;

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    
    ll N, d = 0;
    int K;
    cin >> N >> K;

    while (N >= pow(K, d)){
        d++;
    }
    cout << d-- << endl;

    return 0;
}


Measured memory_bytes: 3992
#include <iostream>
#include <string>
using namespace std;
int main() {
int H, W;
string a;
cin >> H >> W;
for (int i = 0; i < W + 2; ++i) cout << '#';
cout << endl; 
for (int i = 0; i < H; ++i) {
        cin >> a;
        cout << '#' << a << '#' << endl;
} 
for (int i = 0; i < W + 2; ++i) cout << '#';
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())

changed_list = []
now_list = [A, B, C]
ans = 0
flag = True

while flag:
    if now_list in changed_list:
        flag = False
        ans = -1
    else:
        if len([i for i in now_list if not i % 2 == 0]) != 0:
            flag = False
        else:
            changed_list.append(now_list)
            a = now_list[1] / 2 + now_list[2] / 2
            b = now_list[0] / 2 + now_list[2] / 2
            c = now_list[0] / 2 + now_list[1] / 2
            now_list = [a, b, c]

if ans != -1:
    ans = len(changed_list)

print(ans)

Measured memory_bytes: 3064
let lcs (x, y) =
  let m = String.length x in
  let n = String.length y in
  let dp = Array.make_matrix (m + 1) (n + 1) 0 in
  for i = 1 to m do
    for j = 1 to n do
      dp.(i).(j) <-
        if x.[i-1] = y.[j-1] then dp.(i-1).(j-1) + 1
        else if dp.(i-1).(j) > dp.(i).(j-1) then dp.(i-1).(j)
        else dp.(i).(j-1)
    done
  done;
  dp.(m).(n)

let () =
  let q = read_int () in
  for _ = 0 to q - 1 do
    Scanf.scanf "%s\n%s\n" (fun x y -> (x, y)) |> lcs |> Printf.printf "%d\n"
  done

Measured memory_bytes: 18680
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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; }




void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    int a[n+10];
    rep(i,n) cin >> a[i];
    
    int ans = 0;
    rep(i,n){
        while(a[i]%2 == 0){
            ans++;
            a[i] /= 2;
        }
    }
    cout << ans << endl;
 
}



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



Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner Ent = new Scanner(System.in);
        int P =  Ent.nextInt();
        int Q =  Ent.nextInt();
        int R =  Ent.nextInt();
        int res1 = P + Q;
        int res2 = R + Q;
        int res3 = R + P;
        System.out.println(Math.min(res1,Math.min(res2,res3)));
    }
}

Measured memory_bytes: 22996
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int res=n%10;
  if((res==2)||(res==4)||(res==5)||(res==7)||(res==9)){
    cout<<"hon";}
  else if((res==0)||(res==1)||(res==6)||(res==8)){
    cout<<"pon";}
  else
    cout<<"bon";
  return 0;
}

Measured memory_bytes: 3136
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if (a * b == c * d)
    {
        printf("%d\n", a * b);
    }
    else
    {
        printf("%d\n", a * b > c * d ? a * b : c * d);
    }
    return 0;
}

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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cout << #a << " = " << a << endl

const ll inf = 1e15;
const ll mod = 1e9+7;

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

int A, B;

int main() {
    cin >> A >> B;
    cout << max(max(A + A - 1, A + B), max(B + A, B + B - 1)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int n, i, ans;
    string s, t;

    cin >> s >> t;

    n = s.size();

    ans = 0;
    for (i = 0; i < n; i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }

    printf("%d\n", ans);
    
    return 0;
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
#define _GLIBCXX_DEBUG
const int INF=1e15;

signed main(){
    int N,T;cin>>N>>T;
    bool ok=false;
    int ans=INF;
    REP(i,N){
        int a,b;cin>>a>>b;
        if(b<=T){
            ans=min(ans,a);
            ok=true;
        }
    }
    if(ok) cout<<ans<<endl;
    else cout<<"TLE"<<endl;
}


Measured memory_bytes: 256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,0,n)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,m[3];
ll k;
string s;

int main() {
	REP(i,3)cin >> m[i];
	sort(m, m+3);

	cout << (m[0]==5&&m[1]==5&&m[2]==7 ? "YES" : "NO") << endl;

//	cout << ans;
//	cout << endl;
}


Measured memory_bytes: 256
while True:
	n, m = map(int, input().split())
	if (n, m) == (0, 0):
		break
	dp = [list(map(int, input().split())) for i in range(n)]
	dp = sorted(dp, key=lambda kv:kv[1], reverse=True)
	r = 0
	for d,p in dp:
		if m >= d:
			m -= d
		else:
			r += p*(d-m)
			m = 0
	print(r)

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

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

  vector <long long> v(n);

  for (long long &x: v)
    cin >> x;

  sort(v.rbegin(), v.rend());
  
  long long ans = 0;
  bool changed = true;
  while (changed) {
    changed = false;
    for (int i = 0; i < n; ++i) {
      long long dif = v[i] - (v[i] % n);
      if (dif > 0) {
	changed = true;
	long long val = dif / (n);
	ans += val;
	v[i] %= n;
	for (int j = 0; j < n; ++j) {
	  if (j != i)
	    v[j] += val;
	}
      }
    }
  }

  cout << ans << endl;
}


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

bool solve(long long N, long long Y) {

	for (int i = 0; i <= N; i++)
		for (int j = 0; j <= N - i; j++) {
			int k = N - i - j;
			if (k >= 0 && k <= N - i - j) {
				long long T = 10000 * i + 5000 * j + 1000 * k;
				if (T == Y) {
					cout << i << " " << j << " " << k << endl;
					system("pause");
					return true;
				}
			}
		}

	return false;
}

int main(void) {
	
	long long N, Y;

	cin >> N >> Y;

	if (solve(N, Y))
		;
	else
	{
		cout << -1 << " " << -1 << " " << -1 << endl;
	}
	
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

ll dfs(vector<int> &now, vector<tuple<int, int, int, int>> &vt, int n, int m, int lv){
  ll ret = 0;
  if(lv == n){
    for(auto t :vt){
      auto [a, b, c, d] = t;
      a--; b--;
      if(now.at(b) - now.at(a) == c) ret += d;
    }
    return ret;
  }else{
    int bf;
    if(lv == 0) bf = 1;
    else bf = now.at(lv-1);
    rep2(i, bf, m+1){
      now.at(lv) = i;
      ret = max(ret, dfs(now, vt, n, m, lv+1));
    }
    return ret;
  }
}

int main(){
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> vt(q);
  rep(i, q){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vt.at(i) = make_tuple(a, b, c, d);
  }
  // cerr << "tst" << endl;
  vector<int> now(n, 1);
  ll ans = dfs(now, vt, n, m, 0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
    if a == cur_limit:
        cur_limit += 1
        continue
    answer += (a-1) // cur_limit

print(answer)
# 44


Measured memory_bytes: 7848
#include <stdio.h>
int main(){
	int N;
	int count = 0;
	scanf("%d",&N);
	int a[N];
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
		while( a[i]%2 ==0){
			if( a[i] !=0 && a[i]/2){
			count++;
			a[i]=a[i]/2;
			}
		}
	}
	/*if( a[i] !=0 && a[i]/2){
		count++;
		a[i]=a[i]/2;
	} */
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using Vec = vector<ll>;
using P = pair<ll, ll>;
using VecP = vector<P>;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

//static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000;
//#define PI 3.14159265358979323846
//
//int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
//
//int findSumDigits(int s) {
//    int num = 0;
//    int temp = 0;
//    while (s) {
//        temp = s % 10;
//        num += temp;
//        s = s / 10;
//    }
//    return num;
//}
//
//int countDivisorNum(int n) {
//    int count = 0;
//    for (int i = 1; i <= n; i++) {
//        if (n % i == 0) {
//            count++;
//        }
//    }
//    return count;
//}

int main() {
    ll k;
    cin >> k;
    ll count = 1;

    if (k % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    if (k % 5 == 0) {
        cout << -1 << endl;
        return 0;
    }

    ll temp = 7 % k;
    if (temp == 0) {
        cout << count << endl;
        return 0;
    }

    while (1) {
        count++;
        temp = (temp * 10 + 7) % k;
        if (temp == 0) {
            break;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
#define MAX_N 1000010
bool prime[MAX_N], dp[MAX_N];
int main(){
	for(int i=0;i<=MAX_N;i++){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;
	for(int i=2;i*i<MAX_N;i++){
		if(prime[i]){
			for(int j=i*2;j<=MAX_N;j+=i)prime[j] = false;
		}
	}

	int n, x, menu[30];
	while(1){
                cin >> n >> x;
                if(n==0&&x==0)break;
		for(int i=0;i<=x;i++){
			dp[i] = false;
		}

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

		int ans = 0;

		dp[0] = true;
		for(int i=1;i<=x;i++){
			for(int j=0;j<n;j++){
				if(i-menu[j] >= 0 && dp[i-menu[j]]){
					dp[i] = true;
					break;
				}
			}
			if(dp[i] && prime[i]){
				ans = i;
			}
		}

		if(ans != 0){
			cout << ans << endl;
		}else{
			cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 3112
'use strict'
function Main(input) {
  const cookT = input.split("\n").map(Number);
  cookT.pop();
  // console.log({ cookT });

  let hitoketa = 10;

  for (let i = 0; i < 5; i++) {
    let num = cookT[i] % 10;
    if (num !== 0 && hitoketa > num) {
      hitoketa = num;
    }
  }

  let result = 0;

  for (let i = 0; i < 5; i++) {
    result += Math.ceil(cookT[i] / 10) * 10;
    // console.log(result);
  }
  result = result - 10 + hitoketa;
  console.log(result);



}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

ll solve(ll n, ll m) {
    ll r = (n-2) * (m-2);
    if (r < 0) r *= -1;
    return r;
}

int main() {
    ll n, m;
    cin >> n >> m;
    cout << solve(n, m) << endl;
}


Measured memory_bytes: 3624
#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 debug(var) do{cout << #var << " : "; view(var);}while(0)
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;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
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 m; cin >> m;
    ll n = 0, sum = 0;
    rep(i,m) {
        int d;
        ll c;
        cin >> d >> c;
        n += c;
        sum += d * c;
    }
    ll ans = (n-1) + (sum-1)/9;
    cout << ans << endl;
}

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

using namespace std;

int main() {
	int sub = static_cast<int>('a')-static_cast<int>('A');
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	string ans = "";
	for (int i=0; i<n; ++i) {
		char add;
		if (i == k-1) {
			add = s[i] + sub;
		} else {
			add = s[i];
		}
		ans += add;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

char buffer[51];

bool IsPalindromic(const int32_t num) {
  snprintf(buffer, sizeof(buffer), "%d", num);
  const string str = string(buffer);
  const int32_t length = static_cast<int32_t>(str.length());
  int32_t start = 0;
  int32_t end = length - 1;
  bool is_palindromic = true;
  while (start < end) {
    if (str.c_str()[start] != str.c_str()[end]) {
      is_palindromic = false;
    }
    ++start;
    --end;
  }
  return is_palindromic;
}

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

  int32_t A, B;
  cin >> A >> B;
  int32_t count = 0;
  for (int32_t i = A; i <= B; ++i) {
    if (IsPalindromic(i)) {
      ++count;
    }
  }
  cout << count << endl;

  return 0;
}


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

using namespace std;
long long MOD = 1000000007LL;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	int N, M;
	string num = "";
	cin >> N >> M;
	for (int i = 0; i < N; ++i)num += "*";
	for (int i = 0; i < M; ++i) {
		int s;
		char c;
		cin >> s >> c;
		if (num[s - 1] != '*' && num[s - 1] != c) {
			cout << -1 << endl;
			return 0;
		}
		else {
			num[s - 1] = c;
		}
	}

	if (N == 1) {
		if (num[0] == '*') {
			num[0] = '0';
		}
	}
	else {
		if (num[0] == '0') {
			cout << -1 << endl;
			return 0;
		}
		else if (num[0] == '*') {
			num[0] = '1';
		}

		for (int i = 0; i < N; ++i) {
			if (num[i] == '*') {
				num[i] = '0';
			}
		}
	}
	cout << num << endl;
	return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	double v;
	while (cin >> v) {
		double t = v / 9.8;
		double y = 4.9*t*t;
		cout << (int)ceil(y / 5)+1 << endl;
	}
	return 0;
}

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

const int N = 3e5 + 10;
int a[N];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < 3 * n; i++)
        cin >> a[i];
    sort(a, a + 3 * n, greater<int>());
    long long ans = 0;
    for (int i = 1; i < 2 * n; i += 2)
        ans += a[i];
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1408
N = int(input())
P = sorted([list(map(int, input().split())) for i in range(N)])
Z = set()
for x, y in P:
    Z.add((x, y))
X = []
ans = N - 1
for i in range(N):
    for j in range(i + 1, N):
        xi, yi = P[i]
        xj, yj = P[j]

        p, q = (xj - xi), (yj - yi)
        X.append((p, q))

for p, q in X:
    hit = 0
    for x, y in P:
        if (x - p, y - q) in Z:
            hit += 1
    ans = min(ans, N - hit)
print(max(1, ans))


Measured memory_bytes: 3188
use strict;
use warnings;
use utf8;
use feature qw/say/;
use List::Util qw/sum/;

my $abc = <STDIN>;
my @values = split(/ /, $abc);
my $sum = sum(@values);
my $answer = $sum;

for my $value (@values) {
  my $tmp = $sum - $value;
  if ($tmp < $answer) {
    $answer = $tmp;
  }
}
print $answer;



Measured memory_bytes: 896
use std::io;

fn main() {
    let mut buf: String = String::new();
    let n: i32 = if io::stdin().read_line(&mut buf).is_ok() {
        buf.trim().parse::<i32>().unwrap()
    } else { 0 };
    let mut v: Vec<(i32, i32, i32)> = Vec::new();
    v.push((0,0,0));
    for _ in 0..n {
        buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.trim().split_whitespace();
        v.push(
            (
                iter.next().unwrap().parse::<i32>().unwrap(),
                iter.next().unwrap().parse::<i32>().unwrap(),
                iter.next().unwrap().parse::<i32>().unwrap()
            )
        );
    }
    v.sort_by_key(|t| t.0);
    for i in 0..(v.len() - 1) {
        let dist = (v[i+1].1 - v[i].1).abs() + (v[i+1].2 - v[i].2).abs();
        let turn = v[i+1].0 - v[i].0;
        if dist > turn {
            println!("No");
            return;
        } else if (dist - turn).abs() % 2 == 1 {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 6396
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,x,y=mii()
x-=1
y-=1
ans=[0]*n

for i in range(n-1):
    for j in range(i+1,n):
        p=min(abs(i-j),abs(x-i)+abs(y-j)+1)
        ans[p]+=1
for i in range(1,n):
    print(ans[i])





Measured memory_bytes: 71432
from collections import defaultdict
from bisect import *
def solve():
    mod = 10**9+7
    d = defaultdict(lambda: [])
    N = int(input())
    for i in range(N):
        a = int(input())
        d[a].append(i)
    selist = []
    ends = [-1]
    for l in d.values():
        for i in range(len(l)-1):
            if l[i+1]-1>l[i]:
                selist.append([l[i],l[i+1]])
                ends.append(l[i+1])
    selist = [[-1,-1]]+sorted(selist,key=lambda x:x[1])
    # s_ind = {}
    # for i,(s,e) in enumerate(selist):
        # e_ind[e] = i
    # ends = list(e_ind.keys())
    ends.sort()
    dp = [0]*(len(selist))
    for i in range(1,len(selist)):
        dp[i] = dp[i-1]+1
        ind = bisect_right(ends,selist[i][0])
        dp[i] += dp[ind-1]
        dp[i] %= mod
    ans = dp[-1]+1
    ans %= mod
    return ans
print(solve())


Measured memory_bytes: 52120
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int sn=0;
    int N=n;
    while(N){
        sn+=N%10;
        N/=10;
    }
    if(n%sn==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef double db;

const int N=3e3+5;
const db pi=acos(-1);

int n,L;
db age[N];

int main() {
	scanf("%d%d",&n,&L);
	fo(i,1,n) {
		scanf("%lf",&age[i]);
		age[i]=2*pi*age[i]/L;
	}
	db anx=0,any=0;
	fo(i,1,n)
		fo(j,i+1,n) {
			db angle=(age[i]+age[j])/2;
			anx+=cos(angle)*(i-1+n-j);
			any+=sin(angle)*(i-1+n-j);
			angle=-pi+angle;
			anx+=cos(angle)*(j-i-1);
			any+=sin(angle)*(j-i-1);
		}
	db cnt=(db)n*(n-1)*(n-2)/6;
	printf("%.10lf %.10lf\n",anx/cnt,any/cnt);
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;

        vector<vector<Int>> Y(N, vector<Int>(N, -1));
        for (int i = 0; i < N; ++i) {
            Int A;
            cin >> A;
            for (int j = 0; j < A; ++j) {
                Int x, y;
                cin >> x >> y;
                x--;
                Y[i][x] = y;
            }
        }

        Int ans = 0;
        for (Int mask = 0; mask < 1 << N; ++mask) {
            bool flag = true;
            for (int i = 0; i < N; ++i) {
                if (mask >> i & 1) {
                    for (int j = 0; j < N; ++j) {
                        if (Y[i][j] != -1) {
                            if ((mask >> j & 1) != Y[i][j]) {
                                flag = false;
                            }
                        }
                    }
                }
            }
            if (flag) {
                Int tmp = __pop_count((unsigned) mask);
                chmax(ans, tmp);
            }
        }

        cout << ans << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def era(n):
    ret = [1 for i in range(n + 2)]
    for i in range(2, int(math.sqrt(n) +3)):
        if ret[i] != 0:
            for j in range(2, n//i + 1):
                ret[i * j] = 0
    rret = []
    for i, r in enumerate(ret):
        if r == 1 and i != 0:
            rret.append(i)

    return rret


def houjyo(n, m, k, kaijyo):
    # kaburi ... k
    # all ... n
    if k == n:
        return 1
    else:
        # kasanarierabi nck * nokorierabi (m - k)p(n-k) - houjyo(+1)
        ret = nck(n,k,kaijyo) * npk(m-k, n-k, kaijyo) # - (k + 1) * houjyo(n, m, k+1, kaijyo)
        # print(nck(n,k,kaijyo) , npk(m-k, n-k, kaijyo))
        return ret % MOD


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret


def solve():
    n = getN()
    nums = getList()
    ans = 0
    for i,num in enumerate(nums):
        if i % 2 == 0 and num % 2 == 1:
            ans += 1

    print(ans)



def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

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

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

	vector<int> H( N );
	for( auto& v: H ) { cin >> v; }

	bool result = true;

	int x = H.back();
	for( int i = H.size()-2; i >= 0; --i ) {
		if( H.at( i ) <= x ) {
			x = H.at( i );
		}
		else if( H.at( i ) - 1 <= x ) {
			x = H.at( i ) - 1;
		}
		else {
			result = false;
			break;
		}
	}

	cout << (result ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
// ITP1_2_D 
//1??????

using System;
using System.Collections.Generic;
/*using System.Linq;
using System.Text;
using System.Threading.Tasks;*/


class Program
{
    static void Main(string[] args)
    {
        int W, H, x, y, r;

        string [] sarray = (Console.ReadLine().Split(' '));           //??????????????????????????????

        //int??????iaaray???string??????sarray????????????????????\

        int[] iarray = Array.ConvertAll<string, int>(sarray, delegate (string value)
        {
            return int.Parse(value);
        });

        //??£??\

        W = iarray[0];
        H = iarray[1];
        x = iarray[2];
        y = iarray[3];
        r = iarray[4];

        if(x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H)
        {
            Console.WriteLine("Yes");
        }

        if(x - r < 0 || y - r < 0 || x + r > W || y + r > H)
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 8980