akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int n, arr[100005], best, memo[100005];

int dp(int x){
	if(x==0 or x==1){
		return 0;
	}
	else if(x==2){
		return dp(x-1)+abs(arr[x]-arr[x-1]);
	}
	else if(memo[x]!=-1){
		return memo[x];
	}
	best=min(dp(x-1)+abs(arr[x]-arr[x-1]), dp(x-2)+abs(arr[x-2]-arr[x]));
	memo[x]=best;
	return best;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	memset(memo,-1,sizeof(memo));
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
	}
	cout << dp(n) << endl;
}


Measured memory_bytes: 2560
int m,n,p,i,l[1000],t,f;
char s[1000],a[10];
main(){
	for(;scanf("%d%d",&m,&n),m;){
		memset(l,0,sizeof(l));
		t=0;
		p=m;
		for(i=1;i<=n;i++){
			scanf("%s",s);
			*a=0;
			if(i%3==0)
				strcat(a,"Fizz");
			if(i%5==0)
				strcat(a,"Buzz");
			if(!*a)
				sprintf(a,"%d",i);
			if(strcmp(s,a)&&p>1)
				l[t]=1,p--;
			for(;t=(t+1)%m,l[t];);
		}
		f=0;
		for(t=0;t<m;t++)
			if(!t[l]){
				if(f)
					putchar(' ');
				f=printf("%d",1+t);
			}
		puts("");
	}
	{int n;for(n=1000000;n--;)getchar();}//delay(0.52s)
	exit(0);
}

Measured memory_bytes: 444
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    while(true){
        cin >> s;
        if(s=="0"){
            break;
        }
        int sum=0;
        for(int i=0;i<s.size();i++){
            int n=s[i]-'0';
            sum += n;
        }
        cout << sum << endl;
    }
}


Measured memory_bytes: 3180
while True:
    n=int(input())
    if n == 0:
        break
    a=[0]*10
    
    for i in range(n):      
        x=int(input())      
        a[x]+=1
        
    for y in range (10):
        if a[y] == 0:
            print('-')
        else:
            print('*'*a[y])


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  unsigned long long n;
  cin >> n;
  
  if(n % 2){
    cout << 0 << endl;
    return 0;
  }
  
  unsigned long long ans = 0;
  unsigned long long div = 10;
  
  while(n >= div){
    ans += n / div;
    div *= 5;
  }
  
  cout << ans << endl;
  
  /*
  ans = 1;
  while(n){
    ans *= n;
    n -= 2;
  }
  
  cout << ans << endl;
  */
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;
    double res = 0;

    int point = 1;
    int time=0;
    while(point < k){
        point = point * 2;
        time ++;
    }

    for (int i=1; i<k && i<= n; i++){
        if(i * point / 2 >= k){
            point = point /2;
            time = time - 1;
        }

        res += ((double)1/(double)n) * 1/(double)point;
    }

    if(n >= k){
        for(int i=k; i<=n; i++){
            res += 1/(double)n;
        }
    }

    cout << setprecision(14) << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, m;
set <pair <int, int> > s;

void add(int a, int b){
    if(s.count(make_pair(a, b))){
        s.erase(make_pair(a, b));
    }
    else s.insert(make_pair(a, b));
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0 ; i < m ; i++){
        int x, y;
        cin >> x >> y;
        if(y < x) swap(x, y);
        if(x == 1) add(x, y);
        else{
            add(1, x);
            add(1, y);
        }
    }
    if(s.size() == 0) cout << "YES\n";
    else cout << "NO\n";
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
template<typename T = int, T mod = 1'000'000'007, typename U = long long>
struct umod{
        T val;
        umod(): val(0){}
        umod(U x){ x %= mod; if(x < 0) x += mod; val = x;}
        umod& operator += (umod oth){ val += oth.val; if(val >= mod) val -= mod; return *this; }
	umod& operator -= (umod oth){ val -= oth.val; if(val < 0) val += mod; return *this; }
	umod& operator *= (umod oth){ val = ((U)val) * oth.val % mod; return *this; }
	umod& operator /= (umod oth){ return *this *= oth.inverse(); }
        umod& operator ^= (U oth){ return *this = pwr(*this, oth); }
	umod operator + (umod oth) const { return umod(*this) += oth; }
	umod operator - (umod oth) const { return umod(*this) -= oth; }
	umod operator * (umod oth) const { return umod(*this) *= oth; }
	umod operator / (umod oth) const { return umod(*this) /= oth; }
        umod operator ^ (long long oth) const { return umod(*this) ^= oth; }
	bool operator < (umod oth) const { return val < oth.val; }
	bool operator > (umod oth) const { return val > oth.val; }
	bool operator <= (umod oth) const { return val <= oth.val; }
	bool operator >= (umod oth) const { return val >= oth.val; }
	bool operator == (umod oth) const { return val == oth.val; }
	bool operator != (umod oth) const { return val != oth.val; }
        umod pwr(umod a, U b) const { umod r = 1; for(; b; a *= a, b >>= 1) if(b&1) r *= a; return r; }
        umod inverse() const {
		U a = val, b = mod, u = 1, v = 0;
		while(b){
			U t = a/b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		if(u < 0)
			u += mod;
		return u;
        }
};

template<typename U>
struct NCR {
        vector<U> fact, ifact;
        NCR(int size){
                fact.resize(size + 1); ifact.resize(size + 1);
                fact[0] = 1;
                for(int i = 1; i <= size; i++) fact[i] = fact[i - 1] * i;
                ifact[size] = fact[size].inverse();
                for(int i = size - 1; i >= 0; i--) ifact[i] = ifact[i + 1] * (i + 1);
        }
        U ncr(int n, int r){
                if(n < r) return 0;
                return fact[n] * ifact[r] * ifact[n - r];
        }
};

using U = umod<int,998244353>;
using N = NCR<U>;
int main(){
	N k(10'000'100);
	vector<U> p2(10'000'100); p2[0] = 1;
	int n; cin >> n;
	for(int i = 1; i <= n; i++) p2[i] = p2[i - 1] * 2;
	U ans = U(3) ^ n;
	for(int i = n / 2 + 1; i <= n; i++) ans -= k.ncr(n, i) * p2[n - i + 1];
	cout << ans.val << endl;
	return 0;
}


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

int main(){
	int n,a;
	int mx=-1000000,mn=1000000;
	long sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		mx=max(mx,a);
		mn=min(mn,a);
		sum += a;
	}
	cout<<mn<<' '<<mx<<' '<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3068
h, _w = gets.chomp.split(' ').map(&:to_i)
su = 'snuke'
h.times do |i|
  s = gets.chomp.split(' ')
  s.each_with_index do |x, j|
    next unless x == su

    ans = ('A'.ord + j).chr
    print ans
    puts(i + 1)
    exit
  end
end


Measured memory_bytes: 14148
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

signed main(void)
{
  int a, b;
  cin >> a >> b;
  if(a*b%2) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/* Your prologue will be the story. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<complex>
using namespace std;
template <class _T> inline void read(_T &_x) {
	int _t; bool _flag=false;
	while((_t=getchar())!='-'&&(_t<'0'||_t>'9')) ;
	if(_t=='-') _flag=true,_t=getchar(); _x=_t-'0';
	while((_t=getchar())>='0'&&_t<='9') _x=_x*10+_t-'0';
	if(_flag) _x=-_x;
}
typedef long long LL;
const int maxn = 100010;
int num[maxn];
int main() {
	//freopen("A.in","r",stdin);
	//freopen("A.out","w",stdout);
	int n; read(n);
	for (int i = 1; i < n; ++i) num[i] = num[i / 10] + i % 10;
	int ans = num[1] + num[n - 1];
	for (int i = 1; i < n; ++i) ans = min(ans, num[i] + num[n - i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repe(i, n) for(i = 0; i <= (n); i++)
#define repr(i, n) for(int (i) = (n); (i) > 0; --(i))
#define repre(i, n) for(int (i) = (n); (i) >= 0; --(i))
typedef long long ll;
typedef unsigned long long ull;

int dp[5005][5005];

int main()
{
    ll N, sum = 0;
    cin >> N;
    vector<ll> b(N, 1e5);
    rep(i, N-1){
        cin >> b[i];
    }
    vector<ll> a(N, 0);
    sum += b[0];
    for(int i = 1; i < N; i++){
        sum += min(b[i], b[i-1]);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
    int n,x,y,ans[2100]={0};
    cin>>n>>x>>y;
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
    {
        ans[min(j-i,abs(x-i)+abs(j-y)+1)]++;
    }
    for(int i=1;i<n;i++)
        cout<<ans[i]<<endl;
    return 0;
}


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

int main()
{
    int n;
    int r;
    scanf("%d %d", &n, &r);
    if (n >= 10)
    {
        printf("%d\n", r);
    }
    else
    {
        printf("%d\n", r + 100 * (10 - n));
    }
}

Measured memory_bytes: 256
a,b=input().split()

if a>b:
    a=int(a)
    b=int(b)

else:
    x=int(a)
    a=int(b)
    b=x

while True:
    ext=a%b
    if ext==0:
        gcd=b
        break
    else:
        a=b
        b=ext

print(gcd)



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//前処理テーブルの大きさ指定
const int MAX = 1200000; // = 10^6 + 2*(10^5)
//ちなみに、1024MBで持てる最大長の配列は10^8程度

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる。
  ll cost; // e.costでその辺の重みにアクセスできる。
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける。
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す。
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す。
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}

// A^N mod M を計算する。modしたくなかったらM = LINFとかにすればよい。(O(√N))
ll modpow(ll A, ll N, ll M) {
  ll ans = 1;
  while (N > 0) {
    if (N & 1) ans = ans * A % M;
      A = A * A % M;
      N >>= 1;
   }
  return ans;
}

//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int M = 0;
  for (int i = 0; i < N; i++) {
    M = (A.at(i) - (M / 2)) * 2;
  }
  int ans = (0 + M) / 2;
  for (int i = 0; i < N; i++) {
    cout << ans;
    ans = (A.at(i) - (ans / 2)) * 2;
    if (i == N - 1) {
      cout << endl;
    }
    else {
      cout << " ";
    }
  }
}

Measured memory_bytes: 3792
#include<iostream>
#include<string>
#include <cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
const int nmax = 310;
double dp[nmax][nmax][nmax];
int n;

double rec(int x, int y, int z)
{
    if (dp[x][y][z] >= 0) return dp[x][y][z];
    if (x==0 && y==0 && z==0) return 0.0;
    double res = 0.0;
    if (x>0) res += rec(x-1, y, z) * x;
    if (y>0) res += rec(x+1, y-1, z) * y;
    if (z>0) res += rec(x, y+1, z-1) * z;
    res += n;
    res *= 1.0 / (x+y+z);
    return dp[x][y][z]=res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    int a[4];
    a[0]=a[1]=a[2]=a[3]=0;
    rep(i,n)
    {
        int b;cin >> b;
        a[b]++;
    }
    
    // dp[a[1]][a[2]][a[3]]=0;
    // rep(j, a[1]+1) rep(k, a[2]+1) rep(l, a[3]+1) dp[j][k][l]=-1;
    memset(dp, -1, sizeof(dp));

    cout << fixed << setprecision(10) << rec(a[1], a[2], a[3]) << endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> h(n,0);
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  int count=0;
  vector<int> distance(n,0);
  distance[n-1] = 0;
  for (int i=n-2;i>=0;i--){
    count++;
    if(h[i]<h[i+1]){
      count=0;
    }
    distance[i]=count;
  }
  sort(distance.begin(),distance.end());
  cout << distance[n-1] << endl;
}


Measured memory_bytes: 1024
import numpy as np
from heapq import heapify, heappop
def main():
    N = int(input())
    A = np.array(list(map(int, input().split())))
    Hi = [(-height, i) for i, height in enumerate(A)]

    heapify(Hi)

    count = 0
    current = N
    while True:
        (_h, i) = heappop(Hi)
        if i > current:
            pass
        else:
            height = -_h
            count += np.sum(height - A[i:current])
            current = i
        if current == 0:
            break
    print(count)
if __name__ == '__main__':
    main()


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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;


void solve()
{
	int n; cin >> n;
	vector<int> a(n);
	forn(i, n) cin >> a[i];
	int i = 0, cnt = 1;
	while (i < n)
	{
		if (a[i] == cnt)
		{
			//cout << a[i] << ' ' << cnt << endl;
			cnt++;
		}
		i++;
	}
	if (cnt == 1) cout << -1;
	else cout << n - cnt + 1;
}

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


Measured memory_bytes: 3992
#include <iostream>
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;

int N,A,B;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n>0) {
    sum += n%10;
    n/= 10;
  }
  return sum;
}

int main() {
  cin >> N >> A >> B;
  int total = 0;
  REP(i,N+1) {
    int num = findSumOfDigits(i);
    if (A <= num && num <= B) total += i;
  }
  cout << total << endl;
}

Measured memory_bytes: 256
n, y = map(int, input().split())
ans = (-1, -1, -1)
for i in range(0, n+1):
    for j in range(0, n+1-i):
    	if 10000*i+5000*j+1000*(n-i-j) == y:
    		ans = (i, j, n-i-j)
print(ans[0], ans[1], ans[2])

Measured memory_bytes: 3060
import copy

h, w, k = map(int, input().split())
ls = [list(input()) for _ in range(h)]

ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        cnt = 0
        x = copy.deepcopy(ls)
        for g in range(h):
            for l in range(w):
                if (i >> g) & 1:
                    x[g] = ['.' for _ in range(w)]
                if (j >> l) & 1:
                    for y in range(h):
                        x[y][l] = '.'
        for z in x:
            for m in z:
                if m == '#':
                    cnt += 1
        if k == cnt:
            ans += 1
            
print(ans)

Measured memory_bytes: 9356
#include<cstdio>
#include<iostream>
using namespace std;
const int Maxn=110;
int n;
char a[Maxn],b[Maxn];
int main()
{
	scanf("%d",&n);
	scanf("%s%s",a,b);
	for(int i=0;i<n;++i)
	printf("%c%c",a[i],b[i]);
	puts("");
	return 0;
}

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

int gcd(int a,int b){
	if(a<b) swap(a,b);
	if(a%b == 0) return b;
	else return gcd(b,a%b);
}
int m,n;
bool c[500][500],v[500];
int b[500],r[500],p[500];
bool match(int bc){
	if(bc < 0) return true;
	for(int i = 0; i < n; ++i){
		if(!c[bc][i] || v[i]) continue;
		v[i] = true;
		if(match(p[i])){
			p[i] = bc;
			return true;
		}
	}
	return false;
}
int main(){
	while(cin>>m>>n,n){
		for(int i = 0; i < m; ++i) cin >> b[i];
		for(int i = 0; i < n; ++i) cin >> r[i];
		for(int i = 0; i < m; ++i)for(int j = 0; j < n; ++j){
			c[i][j] = gcd(b[i],r[j]) > 1;
		}
		for(int i = 0; i < n; ++i)p[i] = -1;
		int ans = 0;
		for(int i = 0; i < m; ++i){
			for(int j = 0; j < n; ++j)v[j] = 0;
			if(match(i)) ++ans;
		}
		cout << ans << endl;
	}
}

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

int merge(vector<int>& v) {
	int n = v.size();
	int h = n / 2;
	if (n == 1) return 0;
	vector<int> L(v.begin(), v.begin() + h);
	vector<int> R(v.begin() + h, v.end());
	int res = merge(L) + merge(R) + n;
	L.push_back(2e9);
	R.push_back(2e9);
	int l = 0, r = 0;
	for (int i = 0; i < n; i++) {
		if (L[l] <= R[r]) {
			v[i] = L[l++];
		} else {
			v[i] = R[r++];
		}
	}
	return res;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto& x:a) cin >> x;
	int r = merge(a);
	for (int i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << a[i];
	}
	cout << endl << r << endl;
}


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

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

void makePrimeTable(vector<bool> &isPrime, int n)
{
    isPrime.resize(n + 1, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for (int i = 2; i * i <= n; i++)
    {
        if (isPrime[i])
        {
            for (int j = 2; i * j <= n; j++)
            {
                isPrime[i * j] = false;
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<bool> isPrime;
    makePrimeTable(isPrime, 200000);
    vector<int> rui(100001, 0);
    for (int i = 0; i < 100010; i++)
    {
        rui[i + 1] = rui[i] + (i % 2 == 1 && isPrime[i] && isPrime[(i + 1) / 2] ? 1 : 0);
    }
    int q;
    cin >> q;
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        int ans = rui[r + 1] - rui[l];
        // if (l <= 2 && 2 <= r)
        // {
        //     ans--;
        // }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

struct Edge {
    ll to,id;
    Edge(ll to,ll id):to(to),id(id){}
};

ll N,M;

vector<Edge> G[60];

vector<ll> es;

bool dfs(ll v,ll tv,ll p=-1){
    if(v == tv){
        return true;
    }
    for(Edge e : G[v]){
        if(e.to == p) continue;
        if(dfs(e.to,tv,v)){
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}

int main(){
   cin >> N;
   rep(i,N-1){
       ll a,b;
       cin >> a >> b;
       a--;b--;
       G[a].emplace_back(b,i);
       G[b].emplace_back(a,i);
   }
   cin >> M;
   vector<ll> eset(M);
   rep(i,M){
       ll a,b;
       cin >> a >> b;
       a--;b--;
       es = vector<ll>();
       dfs(a,b);
       for(ll e : es){
           eset[i] |= 1ll << e;
       }
   }

   ll ans = 0;
   rep(i,(1 << M)){
       ll mask = 0;
       rep(j,M){
           if(i>>j&1) mask |= eset[j];
       }
       ll white = __builtin_popcountll(mask);
       ll now = 1ll << (N-1-white);
       if(__builtin_popcountll(i) % 2 == 0) ans += now;
       else ans -= now;
   }
   cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.*;

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

		int[] num = new int[30];
		int[] flag = new int[30];
		
		for(int i = 0; i < 30; i++) {
			num[i] = i + 1;
		}
		
		int tmp;
		
		for(int i = 0; i < 28; i++) {
			tmp = sc.nextInt();
			
			flag[tmp - 1] = 1;
		}
		
		int cnt = 0;
		
		for(int i = 0; i < 30; i++) {
			if(flag[i] == 0) {
				System.out.println(num[i]);
				
				cnt++;
			}
			
			if(cnt == 2) {
				break;
			}
		}
	}
}

Measured memory_bytes: 26324
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
using namespace std;
int main()
{
    char a[500],stack[500],t;
    int top=0;
    cin>>a;
    for(int i=0;i<strlen(a);i++)
    {
        if(a[i]=='F'&&top==0)
        continue;
        else if(a[i]=='C')
        {      
        stack[top++]=a[i];
        }
        else
        { 
            if(a[i]=='F')
            {
               t=stack[--top];
                break;
            }
        }
    }
    if(t=='C')
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;

}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n,k;cin>>n>>k;
    vector<int> l(n);
    for(int i=0;i<n;i++) cin>>l[i];
    sort(l.rbegin(),l.rend());
    int res=0;
    for(int i=0;i<k;i++) res += l[i];
    cout<<res<<endl;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    vector<int> A(3);
    for (int i = 0; i < 3; i++) {
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    int ans = 0;
    ans = min(abs(A.at(0) - A.at(2)) + abs(A.at(0) - A.at(1)), abs(A.at(1) - A.at(2)) + abs(A.at(1) - A.at(0)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k; cin >> k;
    ll x = 7, ans = 0, m = 0;
    while (ans == 0 || m % k != 0) {
        ans++;
        m = (m + x) % k;
        // eprintf("%lld %lld %lld\n", ans, m, x);
        x = (x * 10) % k;
        if (ans > k) break;
    }
    cout << (ans > k ? -1 : ans) << "\n";
    return 0;
}

Measured memory_bytes: 3616
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	ans := 0
	for i := 0; i < (1 << uint(len(s)-1)); i++ {
		tmp := int(s[0] - '0')
		for j := 0; j < len(s)-1; j++ {
			if ((i >> uint(j)) & 1) == 0 {
				tmp = tmp*10 + int(s[j+1]-'0')
			} else {
				ans += tmp
				tmp = int(s[j+1] - '0')
			}
		}
		ans += tmp
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    string s; cin >> s;
    if (s[3] == s[2] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int X[100];
int main(int argc, char** argv)
{
    int n;
    int sum=0;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        scanf("%d", &X[i]);
        sum+=X[i];
    }

    /*
     * 0                                   x
     * |-----------------------------------|
     *
     * for i in [0..n)
     *   for p in [0..n)
     *     costs[p] = (x[i] - p)*(x[i] - p);
     *
     *  sigma{0..n-1}{p^2 -2px[i] + x[i]^2}
     *  = np^2 -2p(sigma x[i]) + sigma x[i]^2
     *  = n(p - sigma x[i]/n)^2 - sigma x[i] * sigma x[i]/n + sigma x[i]^2
     *
     * p = sigma x[i]/n のとき最小値。
     *
     */

    int ans=0;
    int p=(double)sum/n + 0.5;
    for(int i=0; i<n; i++)
        ans += (X[i]-p)*(X[i]-p);
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1728
# coding: utf-8
# Your code here!
N,C=map(int,input().split())

D=[]
for _ in range(C):
    D.append(list(map(int,input().split())))
    
c=[]
for _ in range(N):
    c.append(list(map(int,input().split())))


col=[[0]*30 for i in range(3)]

for i in range(N):
    for j in range(N):
        col[(i+j+2)%3][c[i][j]-1]+=1

ans=10**9
for col0 in range(C):
    temp0=0
    for i in range(C):
        temp0+=col[0][i]*D[i][col0] 
    for col1 in range(C):
        if col0==col1:
            continue
        #print(temp0)
        temp1=temp0
        for i in range(C):
            temp1+=col[1][i]*D[i][col1]
        for col2 in range(C):
            if col2==col0 or col2==col1:
                continue
            temp2=temp1
            for i in range(C):
                #print(col0,col1,col2)
                temp2+=col[2][i]*D[i][col2]
            #print(col0,col1,col2)
            ans=min(ans,temp2)
            
print(ans)



Measured memory_bytes: 5620
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    import itertools
    n,k=map(int, input().split())
    sunukel=[0]*n
    for i in range(k):
        d=int(input())
        l=list(map(int, input().split()))
        for j in l:
            sunukel[j-1]+=1
    print(sunukel.count(0))
resolve()


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

int main(){
  int n;
  cin>>n;
  int a,b,sum=0;
  rep(i,n){
    if(i==n-1){
        sum+=b;
        break;
    }
    cin>>a;
    if(i==0) sum+=a;
    else sum+=min(a,b);

    b=a;

  }
  cout<<sum;
}

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

int main(){
  int a,b,ans;
  cin >> a >> b;
  if(a<b) ans=((b-a)/2)+a;
  else if(a>b) ans=((a-b)/2)+b;
  if((a+b)%2 == 0) cout << ans << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
const int MOD = 1e9+7;


int main(){
    int M,D;cin >> M >> D;
    int ans = 0;
    for(int i = 1;i <= M;i++){
        for(int d = 1;d <= D;d++){
            int d10 = d/10;
            int d1 = d%10;
            if(d10 >= 2 && d1 >= 2 && d1 * d10 == i){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  n %= 1000;
  
  if (n == 0) cout << 0 << '\n';
  else cout << 1000 - n << '\n';
}

Measured memory_bytes: 3648
#include<stdio.h>

int main(){
  int a,b,c,n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d %d %d",&a,&b,&c);
      if(a*a==b*b+c*c) printf("YES\n");
      else if(b*b==c*c+a*a) printf("YES\n");
      else if(c*c==a*a+b*b) printf("YES\n");
      else printf("NO\n");
    }
  return 0;
}

Measured memory_bytes: 580
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

N = int(input())
A = dict()
for _ in range(N):
    a = int(input())
    A.setdefault(a,0)
    A[a] += 1
ans = 0
for a in A:
    ans += A[a]%2!=0
print(ans)

Measured memory_bytes: 88508
S = raw_input().split(' ')
S[0] = int(S[0])
S[1] = int(S[1])
 
d = str(S[0]/S[1])
r = str(S[0]%S[1])
f = format(1.0*S[0]/S[1], ".8f")
 
print(d + " " + r + " " + f)

Measured memory_bytes: 6452
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c = readInts()
s = a+b+c
k = max(a,b,c)*3 - s
if k%2 == 0:
    print(k//2)
else:
    print(k//2 + 2)


Measured memory_bytes: 10408
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int N, K; 
int dfs(vector<vector<int>> &graph, int parent, int child){
  int cnt = 0;
  if(parent == -1) cnt = K-1;
  else cnt = K-2;
  if(K < graph[child].size()) return 0;

  int ret = 1;
  for(auto e : graph[child]){
    if(e == parent) continue;
    ret *= cnt; cnt--;
    ret %= MOD;
  }
  for(auto e : graph[child]){
    if(e == parent) continue;
    ret *= dfs(graph, child, e);
    ret %= MOD;
  }
  return ret;
}

signed main() {
  cin >> N >> K;

  vector<vector<int>> graph(N);
  REP(i, N-1){
    int a, b;
    cin >> a >> b;
    a--; b--;
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
  }

  int ans = K*dfs(graph, -1, 0);
  cout << ans%MOD << endl;

  return 0;
}

Measured memory_bytes: 11520
# coding: utf-8

str = input()
x = len(str)
count = 0
tmp_c = 0

for i in range(x):
    if str[i:i+1] == 'A' or str[i:i+1] == 'T' or str[i:i+1] =='C' or str[i:i+1] == 'G':
        tmp_c = tmp_c + 1
    else:
        if count < tmp_c:
            count = tmp_c
        tmp_c = 0

    if i+1 == x:
        if count < tmp_c:
            count = tmp_c
        break

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define PII pair<int,int>
#define ll long long
int N=INT_MAX;
ll INF1=1e9 + 5;
ll INF2=1e18L + 5;
map<int ,int>my;
//vector<PII>v[1000005];
const int M = 1e5 + 5;
const ll MOD = 1e9 + 7;
int n,m;
char a[1005][1005];
int arr[1005][1005];
ll ans;

int main(){
    scanf("%d%d",&n ,&m);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<n;i++){
        if(a[i][0]=='.'){
            arr[i][0]=1;
        }
        else
            break;
    }
    for(int j=1;j<m;j++){
        if(a[0][j]=='.'){
            arr[0][j]=1;
        }
        else{
            break;
        }
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<m;j++){
            if(a[i][j]=='#'){
                continue;
            }
            if(arr[i-1][j]>0){
                arr[i][j]=(arr[i][j]+arr[i-1][j])%MOD;
            }
            if(arr[i][j-1]>0){
                arr[i][j]=(arr[i][j]+arr[i][j-1])%MOD;
            }
        }
    }
    cout<<arr[n-1][m-1]%MOD;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b; cin >> a >> b;
    cout << max(0, a - 2*b) << endl;
}

Measured memory_bytes: 256
# 2
# Xの座標から、X含めK分対象となる。
# X - K +1 < ... < X < X + K -1
# 今回、上限、下限値に触れることはない。

K, X = map(int, input().split())
res = ""
for i in range(X - K + 1, X + K):
    if i != X + K:
        res = str(res + str(i) + " ") 
    else:
        res = str(res + str(i)) 

print(res)

Measured memory_bytes: 2940
while n = gets.chomp.to_i
	break if n==0
	s=Array.new
	c=Array.new
	s=gets.chomp.split(" ").map{|i| i.to_i}

	count=0
	loop{
		for i in 0..n-1
			c[i]=s.count(s[i])
		end
		break if s==c
		s=c
		c=[]
		count += 1
	}
	puts count
	puts s.join(" ")
end

Measured memory_bytes: 8828
use std::io;
use std::collections::HashMap;
use std::mem;

fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.trim().split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

fn main(){
    let k = read_ints()[0];
    let d = k / 50;
    let m = k % 50;
    let m1 = m/3;
    let m2 = m/3;
    let m3 = m - m1 - m2;
    
    let bias = 49 + d - m;
    
    println!("50");
    
    print!("{} ",bias + m1 * 50);
    print!("{} ",bias + m2 * 50);
    print!("{} ",bias + m3 * 50);
    
    for i in 0..46{
        print!("{} ",bias);
    }
    println!("{} ",bias);
}







/*
DOCS


let mut h = HashMap::new();
let a = 5;
h.insert(a,true);
match h.get(&a){
    Some(v) => println!("{}",v),
    None    => println!("none"),
}


use std::mem;

let mut x = 5;
let mut y = 1;
mem::swap(&mut x,&mut y);


let v = vec![0;2]; // [0,0]







*/

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

class Program{
  public static void Main(){

    string o = Console.ReadLine();
    string e = Console.ReadLine();
    
    int lo = o.Length;
    int le = e.Length;
    
    for(int i=0; i<le; i++){
      Console.Write(o[i]);
      Console.Write(e[i]);
    }
    if(lo != le){
      Console.Write(o[lo-1]);
    }
  }
}


Measured memory_bytes: 11092
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
int INF=2e+9;
int main(){
	ll N,K;
	scan(N);scan(K);
	ll kosu=0;
	if(K==0) kosu=N*N;
	else{
		for(ll b=K+1;b<=N;b++){
			kosu+=(N/b)*(b-K)+max(0,(int)((N%b)-(K-1)));
		}
	}
	prin(kosu);
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
  public static void main(String[] args)
  {

    Scanner reader =new Scanner (System.in);
    int a =reader.nextInt();
    int array[];
    int counter[];
    int min=0;
    array=new int [a];
    counter=new int [a];
    for(int i=0;i<a;i++)
    {
      array[i]=reader.nextInt();
      while(array[i]%2!=1)
      {
        array[i]=array[i]/2;
        counter[i]++;

      }


    }
min =counter[0];
 for(int i=0;i<a;i++)
 {

   if(counter[i]<min)
   {
     min=counter[i];

   }

 }
 System.out.println (min);

}
}


Measured memory_bytes: 23380
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

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

    vector<int> num;
    int now = 1;
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if(S[i] == (char)('0'+now)) cnt++;
        else {
            num.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if(cnt != 0) num.push_back(cnt);
    if(num.size() % 2 == 0) num.push_back(0);

    vector<int> sums(num.size() + 1);
    for(int i = 0; i < num.size(); i++) {
        sums[i+1] = num[i] + sums[i];
    }

    int left = 0;
    int right = 0;
    int add = 2 * K + 1;
    int ans = 0;
    int tmp = 0;
    for(int i = 0; i < num.size(); i+=2) {
        int nextleft = i;
        int nextright = min(i+ add, (int)num.size());
        tmp = sums[nextright] - sums[nextleft];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, m, n) for (int i = m; i < n; i++)
#define repr(i, m, n) for (int i = m; i >= n; i--)
#define db(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
#define EPS 1e(-9);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//--GLOBAL---------------------------------
const int MAX = 10;
ll fac[MAX];
void facinit() { // a! mod
  fac[0]=fac[1] = 1;
  reps(i, 2, MAX){
    fac[i] = fac[i - 1] * i % MOD;
  }
}
//--MAIN-----------------------------------
void Main() {
    int N;
    cin >>N;
    double x[N],y[N];
    rep(i,N){
        cin>>x[i]>>y[i];
    }

    double ans=0;
    rep(i,N-1){
        reps(j,i+1,N){
            ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }

    ans*=2;

    ans/=N;

    cout<< ans<<"\n";

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
use std::io::{stdin, Read};

fn main() {
    let mut input = String::new();
    stdin().read_to_string(&mut input).unwrap();
    let rows: Vec<&str> = input.split('\n').collect();
    let row1_list: Vec<&str> = rows[0].split(' ').collect();
    let n: i32 = row1_list[0].parse().unwrap();
    let y: i32 = row1_list[1].parse().unwrap();

    let tt = y / 10000;
    let ft = y / 5000;
    for i in 0..tt + 1 {
        for j in 0..ft + 1 {
            let k = n - i - j;
            if k < 0 {
                continue;
            }
            if 1000 * k + 5000 * j + 10000 * i == y {
                println!("{} {} {}", i, j, k);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}


Measured memory_bytes: 4352
/*
 ============================================================================
 Name        : ABC_111_A.c
 Author      :
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int n;
	scanf("%d",&n);

	n = 1110 - n;
	printf("%d",n);
	return 0;
}


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

int main(void){
  int n,f,count;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> f;
    if(f%2==1) count++;
  }
  if(count%2==1){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
}


Measured memory_bytes: 256
from collections import defaultdict


def main():
    N, T = map(int, input().split())
    a_list = list(map(int, input().split()))
    d = defaultdict(int)
    min_a, min_i = a_list[0], 0
    for i in range(1, len(a_list)):
        a = a_list[i]
        d[a - min_a] += 1
        min_a = min(min_a, a)

    print(d[max(d)])

if __name__ == '__main__':
    main()


Measured memory_bytes: 20960
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]
        self.height = [1] * n
        self.size = [1] * n

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

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.height[x] < self.height[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.height[x] == self.height[y]:
                    self.height[x] += 1

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

    def group_size(self, x):
        return self.size[self.find(x)]


N, M, K = map(int, input().split())
uf = UnionFind(N)
exc = [set() for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    exc[a - 1].add(b - 1)
    exc[b - 1].add(a - 1)
    uf.unite(a - 1, b - 1)
for _ in range(K):
    c, d = map(int, input().split())
    if uf.issame(c - 1, d - 1):
        exc[c - 1].add(d - 1)
        exc[d - 1].add(c - 1)

ans = [uf.group_size(i) - len(exc[i]) - 1 for i in range(N)]
print(*ans)


Measured memory_bytes: 69360
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     ll n,b,i,j,k,a;
     cin>>n>>a>>b;
     ll ans=n/(a+b);
     ans*=a;
     ans+=min((n%(a+b)),a);
     cout<<ans;
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 256