akhauriyash/Code-Regression huggingface dataset:
def devide2points(p1,p2):
    s=((p1[0]*2+p2[0])/3,(p1[1]*2+p2[1])/3)
    t=((p1[0]+p2[0]*2)/3,(p1[1]+p2[1]*2)/3)
    u=((p1[0]+p2[0])/2-(p2[1]-p1[1])*(3**(1/2))/6,(p1[1]+p2[1])/2+(p2[0]-p1[0])*(3**(1/2))/6)
    return [s,u,t]

def divide(points):
    res = [points[0]]
    for i in range(len(points)-1):
        res = res + devide2points(points[i],points[i+1]) + [points[i+1]]
    return res

n = int(input())
points = [(0.0,0.0),(100.0,0.0)]
for _ in range(n):
    points = divide(points)
for i in points:
    print(i[0],i[1])


Measured memory_bytes: 6216
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  int p = 0;
  while(p<n) p += 1000;
  cout << p-n << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
 ll N;
  cin>>N;
  vl A(N);
  rep(i,N) {
cin >>A.at(i);
  }
  ll x=A.at(0);
  rep(i,N) {
 x=__gcd(x,A.at(i));
         }
         
         cout<<x<<endl;
         }
  
  

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void read (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: print;

int n,k,a[1000005]; 
int main() {
	int i,j;
    read(n),read(k);
    for(i=1;i<=n;i++)read(a[i]);
    sort(a+1,a+1+n);
    int ans=0;
    for(i=1;i<=n;i++)
    {
    	if(i<n)
    	{
    		if(a[i]<=k)
    		{
    			k-=a[i];
    			ans++;
    		}
    	}
    	else if(i==n&&a[i]==k)ans++;
    	else break;
    }
    print(ans),putc('\n');
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll k;
    cin >> k;
    ll a, b;
    a = k / 50;
    b = k % 50;
    cout << 50 << endl;
    for (int i = 0; i < 50; i++) {
        cout << 49 + a - b + (i < b) * 50 << ' ';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3636
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    _n: i32,
    m: usize,
    lr: [(i32, i32); m],
  }
  let l = lr.iter().map(|p| p.0).fold(-100000000, |x, y| cmp::max(x, y));
  let r = lr.iter().map(|p| p.1).fold(100000000, |x, y| cmp::min(x, y));
  let ans = cmp::max(0, r - l + 1);
  println!("{}", ans);
}


Measured memory_bytes: 6396
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int n,a[100]={};

	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a[i];
	}
////
	int b[100]={};
	for (int i=0;i<n;i++){
		b[i]=a[n-1-i];
	}
///
	cout<<b[0];

	for (int j=1;j<n;j++){
		cout<<" "<< b[j];
	}
	cout<<endl;



	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define int long long
using namespace std;

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
#define ford(i,n) for (int i = n-1; i >= 0; i--)
#define ford2(i,a,b) for (int i = a-1; i >= b; i--)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
#define BIG 1000000000000000000

#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sllll(n,m,k,o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf(" %c", &c)
#define ss(s) scanf("%s", s)
#define sal(t,n) fin(iz,n) { scanf("%lld", &t[iz]); }
#define sad(t,n) fin(iz,n) { scanf("%lf", &t[iz]); }
#define gl(t) scanf(" %[^\n]", t);

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pss(s) printf("%s\n", s.c_str())
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pal(t,n) fin(rz,n) { printf("%lld ", t[rz]); } printf("\n")
#define pad(t,n) fin(rz,n) { printf("%lf ", t[rz]); } printf("\n")

#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
 
#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")

#define ll int
#define vl vector<ll>
#define vvl vector<vl>
#define vvvl vector<vvl>

#define dll pair<ll, ll>
#define vdll vector<dll>
#define vvdll vector<vdll>

#define vb vector<bool>
#define vvb vector<vb>
#define vd vector<double>
#define vvd vector<vd>
#define vc vector<char>
#define vvc vector<vc>

#define all(v) v.begin(), v.end()
#define vlen(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second

long long inv(long long a, long long b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}

const int bm = (int)(1e5) + 5;
int n;
int a[bm];
int harmo[bm];

signed main()
{
    sl(n);
    sal(a, n);
    int nbOrdres = 1;
    fin2(i, 1, n+1) {
        nbOrdres *= i;
        nbOrdres %= mod;
        harmo[i] = (harmo[i-1] + inv(i, mod)) % mod;
    }
    int res = 0;
    fin(i, n) {
        int nbScores = (harmo[i+1] + harmo[n-i] - 1) % mod;
        nbScores = (nbScores * a[i]) % mod;
        res = (res + nbScores) % mod;
    }
    pl((nbOrdres * res)%mod);
}

Measured memory_bytes: 1792
import java.util.Scanner;

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

		if(a.charAt(a.length()-1)==b.charAt(0) && b.charAt(b.length()-1)==c.charAt(0)) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

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

void dfs(vector<vector<int>> &t, vector<int> &val, int v, int parent, int x){
	val[v] += x;
	for(int i = 0; i < t[v].size(); i++){
		if(t[v][i] != parent){
			dfs(t, val, t[v][i], v, val[v]);
		}
	}
}

int main(){
	int N, Q, i;
	scanf("%d%d", &N, &Q);
	vector<vector<int>> t(N, vector<int>(0));
	for(i = 1; i < N; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		t[a].push_back(b);
		t[b].push_back(a);
	}
	vector<int> val(N, 0);
	for(i = 0; i < Q; i++){
		int p, x;
		scanf("%d%d", &p, &x);
		p--;
		val[p] += x;
	}
	dfs(t, val, 0, -1, 0);
	for(i = 0; i < N; i++){
		printf("%d ", val[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 29696
#include<vector>
#include<iostream>
#include<algorithm>
#define MAX_V 100
#define INF 1e9
using namespace std;
int V;
int d[MAX_V];
int cost[MAX_V][MAX_V];
bool used[MAX_V];

void dijkstra(int s)
{
	d[s] = 0;
	while (true)
	{
		int v = -1;
		for (int u = 0; u < V; u++)
		{
			if (!used[u] && (v == -1 || d[u] < d[v]))
			{
				v = u;
			}
		}
		if (v == -1)
		{
			break;
		}
		used[v] = true;

		for (int u = 0; u < V; u++)
		{
			//if (cost[v][u] = INF)
			//{
			//	continue;
			//}
			d[u] = min(d[u], d[v] + cost[v][u]);
		}
	}

}
int main()
{
	cin >> V;
	for (int i = 0; i < MAX_V; i++)
	{
		for (int j = 0; j < MAX_V; j++)
		{
			cost[i][j] = INF;
		}
	}
	for (int i = 0; i < MAX_V;i++)
	{
		d[i] = INF;
		used[i] = false;
	}
	for (int i = 0; i < V; i++)
	{
		int u;
		cin >> u;
		int k;
		cin >> k;
		for (int j = 0; j < k; j++)
		{
			int v_to;
			cin >> v_to;
			int c;
			cin >> c;

			cost[u][v_to] = c;

		}
	}

	dijkstra(0);

	for (int i = 0; i < V; i++)
	{
		cout << i << " " << d[i] << endl;
	}

	return 0;

}



Measured memory_bytes: 3140
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF 1e9+7
#define LLINF 1e18
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,h,m=-LLINF,ans=0;
    cin>>n>>h;
    vector<ll> a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
        m=max(m,a[i]);
    }
    sort(all(b));
    ll it=lower_bound(all(b),m)-b.begin();
    for(int i=n-1;i>=it;i--){
        if(h>0){
            h -=b[i];
            ans++;
        }
        else break;
    }
    if(h>0){
        if(h%m==0) ans+= h/m;
        else ans+= h/m+1;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int d;
	cin >> d;
	
	if (d ==25) cout << "Christmas" << endl;
	if (d ==24) cout << "Christmas Eve" << endl;
	if (d ==23) cout << "Christmas Eve Eve" << endl;
	if (d ==22) cout << "Christmas Eve Eve Eve" << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    reverse(ALL(s));

    Vec can;
    rep(i,n+1){
        if(s[i]=='0'){
            can.pb(i);
        }
    }
//    dbg(s);
//    dbg(can);
    ll now=0;
    Vec road;
    while(true){
        if(now+m>=n){
            road.pb(n-now);
            break;
        }
        auto itr = upper_bound(ALL(can),now+m);
        itr--;
        if(*itr==now){
            cout<<-1<<endl;
            return 0;
        }
        road.pb(*itr-now);
        now = *itr;
    }

    reverse(ALL(road));
    rep(i,road.size()){
        cout<<road[i]<<" ";
    }
    return  0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first 
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

  int S = 0;
  while(1) {
    S += tmp%10;
    tmp /= 10;
    if(tmp==0) break;
  }

   cout << (N%S == 0 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
      int n,w,T=0;
     cin>>n>>w;
      int m[n+1],v[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>m[i]>>v[i];
        T=T+v[i];
    }
    long long  int f[T];
     //f[v[1]]=m[1];
     f[0]=0;
     for(int i=1;i<=T;i++)
     {
          f[i]=1000000000;
     }
    for(int i=1;i<=n;i++)
    {
       for(int j=T;j>=v[i];j--)
       {
           f[j]=min(m[i]+f[j-v[i]],f[j]);
       }
    }
    for(int i=T;i>=v[1];i--)
    {
        if(f[i]<=w)
        {
            cout<<i<<endl;
            return 0;
        }
    }

}


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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, i, j;
  cin >> N;
  vi X(N), Y(N), P(N);
  REP(0, N, i) {
    cin >> X[i] >> Y[i] >> P[i];
  }

  i64 S = 1, s;
  REP(0, N, i) {
    S *= 3;
  }

  vi DD0(N);
  i64 ans0 = 0;
  REP(0, N, i) {
    DD0[i] = min(abs(X[i]), abs(Y[i])) * P[i];
    ans0 += DD0[i];
  }

  if(N == 1) {
    cout << ans0 << endl << 0 << endl;
    return 0;
  }

  i64 N0 = N / 2;
  i64 S0 = 1;
  REP(0, N0, i) {
    S0 *= 3;
  }
  i64 N1 = N - N0;
  i64 S1 = S / S0;
  vvi DD_S0(S0, DD0);
  vvi DD_S1(S1, DD0);
  vi K_S0(S0, 0);
  vi K_S1(S1, 0);
  
  REP(0, S0, s) {
    i64 ss = s;
    REP(0, N0, i) {
      i64 R = ss % 3;
      ss /= 3;
      if(R == 1) {
	REP(0, N, j) {
	  DD_S0[s][j] = min(DD_S0[s][j], abs(X[j] - X[i]) * P[j]);
	}
	K_S0[s]++;
      }
      else if(R == 2) {
	REP(0, N, j) {
	  DD_S0[s][j] = min(DD_S0[s][j], abs(Y[j] - Y[i]) * P[j]);
	}
	K_S0[s]++;
      }
    }
  }

  REP(0, S1, s) {
    i64 ss = s;
    REP(N0, N, i) {
      i64 R = ss % 3;
      ss /= 3;
      if(R == 1) {
	REP(0, N, j) {
	  DD_S1[s][j] = min(DD_S1[s][j], abs(X[j] - X[i]) * P[j]);
	}
	K_S1[s]++;
      }
      else if(R == 2) {
	REP(0, N, j) {
	  DD_S1[s][j] = min(DD_S1[s][j], abs(Y[j] - Y[i]) * P[j]);
	}
	K_S1[s]++;
      }
    }
  }
  
  vi ans(N+1, ans0);
  REP(0, S, s) {
    i64 ss = s;
    vi DD = DD0;

    i64 ss0 = ss % S0;
    i64 ss1 = ss / S0;
    REP(0, N, j) {
      DD[j] = min(DD_S0[ss0][j], DD_S1[ss1][j]);
    }

    i64 K = K_S0[ss0] + K_S1[ss1];
    i64 candidate = accumulate(all(DD), 0LL);
    //cout << candidate << endl;
    
    ans[K] = min(ans[K], candidate);
  }

  REP(0, N+1, i) {
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 4816
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a==c) cout<<0<<endl;
	else cout<<1<<endl; 
	return 0;
}

Measured memory_bytes: 256
source = input().split()
A, B, C = int(source[0]), int(source[1]), int(source[2])
flag = True
index = 0
while B >= A and index <= C:
    B -= A
    index += 1
    if index == C:
        print(C)
        flag = False
        break
if flag:
    print(index)

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    private static int N;
    private static Map<String, Integer> count = new HashMap<>();
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        N = sc.nextInt();
        int maxCount = 0;
        for(int i=0; i<N; i++) {
            String s = sc.next();
            if(count.containsKey(s)) {
                int c = count.get(s) + 1;
                count.put(s, c);
                maxCount = Math.max(maxCount, c);
            }else {
                count.put(s, 1);
                maxCount = Math.max(maxCount, 1);
            }
        }
        
        List<String> result = new ArrayList<>();
        
        for(String key : count.keySet()) {
            if(count.get(key) == maxCount) {
                result.add(key);
            }
        }
        
        Collections.sort(result);
        
        result.forEach(System.out::println);
    }
}


Measured memory_bytes: 87408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((int)(x).size())

using namespace std;
typedef long long ll;

ll sum_tablel[100000];
ll sum_tabler[100000];
void solve(long long N, std::vector<long long> A){
  ll s = 0;
  for (int i = 0; i < N; i++) {
    s += A[i];
  }
  s /= 2;

  sum_tablel[0] = A[0];
  sum_tablel[1] = A[1];
  for (int i = 2; i < N - 1; i++) {
    sum_tablel[i] = sum_tablel[i - 2] + A[i];
  }

  sum_tabler[N - 1] = A[N - 1];
  sum_tabler[N - 2] = A[N - 2];
  for (int i = N - 3; i >= 1; i--) {
    sum_tabler[i] = sum_tabler[i + 2] + A[i];
  }

  for (int i = 0; i < N; i++) {
    ll ans = s;
    if (i >= 2) ans -= sum_tablel[i - 2];
    if (i < N - 1) ans -= sum_tabler[i + 1];
    printf("%lld", ans * 2);
    if (i != N-1) printf(" ");
  }
  printf("\n");
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

int main(){
  vector<int> a(11451419);
  int count = 0;
  int s;
  cin >> s;
  while(true){
    a.at(count) = s;
    if(s%2==0){
      s = s/2;
    }
    else{
      s = 3*s + 1;
    }
    count++;
    for(int i=0;i<count;i++){
      if(a.at(i) == s){
        cout << count+1 << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 44928
import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
count = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        index = bisect.bisect_left(l,l[i]+l[j],j)
     
        count += index-j-1
print(count)

Measured memory_bytes: 3188
use strict;
use warnings;

my ($a, $b) = split(" ", <STDIN>);
my $ans = ceil(($a + $b) / 2);
print $ans;

sub ceil {
    my ($num) = shift;
    if ($num == int($num)) {
        return $num;
    } else {
        return int($num + 1);
    }
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string A; cin >> A;
if(A=="SUN") cout << 7;
else if(A=="MON") cout << 6;
else if(A=="TUE") cout << 5;
else if(A=="WED") cout << 4;
else if(A=="THU") cout << 3;
else if(A=="FRI") cout << 2;
else if(A=="SAT") cout << 1;
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    string a,b,c;
    cin >> a >> b >> c;
    int ans=0;
    rep(i,n){
        if((a.at(i)==b.at(i)&&b.at(i)!=c.at(i))||(a.at(i)!=b.at(i)&&b.at(i)==c.at(i))||(a.at(i)==c.at(i)&&a.at(i)!=b.at(i))){
            ans++;
        }
        else if(a.at(i)!=b.at(i)&&b.at(i)!=c.at(i)&&c.at(i)!=a.at(i)) ans+=2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
w, h, n = map(int, input().split())
xya = []
for _ in range(n):
    x, y, a = map(int, input().split())
    xya.append((x, y, a))
l = 0
r = w
t = h
b = 0
for x, y, a in xya:
    if a==1:
        l = max(l, x)
    elif a==2:
        r = min(r, x)
    elif a==3:
        b = max(b, y)
    else:
        t = min(t, y)

print((r-l)*(t-b) if l<=r and b<=t else 0)

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

const int INF = 1e9;

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

  vector<int> ans(n, INF);
  if(s == INF) {
    rep(i,n) ans[i] = INF - 1;
  }
  rep(i, k) ans[i] = s;

  for (auto it : ans) cout << it << " ";
  cout << '\n';

}



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

using namespace std;

int main()
{
    map<string, int> dic;
    int n, m;
    string s, t;

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

    cin >> m;
    for (int i = 0; i < m; ++i) {
        cin >> t;
        --dic[t];
    }

    int ans = 0;
    for (auto p : dic) {
        ans = max(ans, p.second);
    }
    cout << ans << endl;
}

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

void hit(int &score,bool base[4]){
    if(base[3]){
        score++;
        base[3]=false;
    }

    for(int i=3;i>=2;i--){
        if(base[i-1]){
            base[i-1]=false;
            base[i]=true;
        }
    }
    
    base[1]=true;
}

void homerun(int &score,bool base[4]){
    score++;
    for(int i=1;i<=3;i++){
        if(base[i]){
            score++;
            base[i]=false;
        }
    }
}

int main(){
    int score,out_c,n;
    string s;
    bool base[4];

    cin>>n;
    cin.ignore();

    while(n--){
        out_c=0;
        score=0;
        for(int i=0;i<4;i++){
            base[i]=false;
        }
        while(out_c<3){
            getline(cin,s);
            if(s=="HIT"){
                hit(score,base);
            }else if(s=="HOMERUN"){
                homerun(score,base);
            }else{
                out_c++;
            }
        }

        cout<<score<<endl;
    }

    return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<algorithm>
#include<string>
#define LL long long
LL mod = 1e17;
LL N;
int ans;
int sum;
int main() {
	std::cin >> N;
	bool flag = false;
	for (int i = 16; i >= 0; i--) {
		mod /= 10;
		sum += N / mod;
		if (N / mod && !flag) {
			flag = true;
			ans = i * 9 + (N / mod) - 1;
		}
		N %= mod;
	}
	std::cout << std::max(ans, sum) << std::endl;
	return 0;
}

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

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

	int p;
	int cnt = 0;
	int ans = 0;
	for(int i = 0; i < n; i++){
		std::cin >> p;
		if(i + 1 == p)cnt++;
		else {
			ans += (cnt + 1) / 2;
			cnt = 0;
		}
	}	
	ans += (cnt + 1) / 2;

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

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

int main(){
	int n,x;
	int delta;
	long long ans=0;
	std::vector<int> aList;

	std::cin>>n>>x;
	aList.resize(n);

	for(int i=0; i<n; i++)
		std::cin>>aList[i];


	delta= std::max(aList[0]-x, 0);
	aList[0]-= delta;
	ans+= delta;

	for(int i=0; i<n-1; i++){
		delta= std::max(aList[i]+aList[i+1]-x, 0);
		aList[i+1]-= delta;
		ans+= delta;
	}

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

	return 0;
		
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
using namespace std;


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

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int count = 0;

    for (int i = 0; i < n; ++i) {
        if(a[i] % 2 == 0){
            if((a[i] % 3 != 0) && (a[i] % 5 != 0))count++;
        }
    }
    if(count == 0)print("APPROVED");
    else print("DENIED");
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=max(n-x,x)
b=min(n-x,x)
s=n
while b!=0:
  c=a//b
  d=a%b
  s+=2*b*c
  if d==0:
    s-=b
  a=b
  b=d
print(s)

Measured memory_bytes: 3060
n = int(input())
A = input().split(" ")

r = 1
p = int(A[0])
status = 0

for a in A[1:]:
    a=int(a)
    if status == 0:
        status = a-p
    elif status < 0:
        if a-p > 0:
            r = r + 1
            status = 0
    elif status >0:
        if a-p < 0:
            r = r + 1
            status = 0
    p=a

print(r)

Measured memory_bytes: 11096
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <string>
#include <deque>
#include <stack>
#include <cmath>

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (LL i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<LL> VI;
typedef pair<LL, LL> PLL;

const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 400040	;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL * 1000 * 1000 + 7;

int n;
double arr[3007];
double dpT[3007][3007];
double dp(int pos, int howmany)
{
	if(howmany==0)
		return 1.0;
	if(pos==n)
		return 0;
	if(abs(dpT[pos][howmany]+1)>0.5)
		return dpT[pos][howmany];
	return dpT[pos][howmany]=arr[pos]*dp(pos+1,howmany-1)+(1.0-arr[pos])*dp(pos+1,howmany);
}



int main()
{
	//freopen("input.tXXt", "r", stdin);
	ios_base::sync_with_stdio(0);
	FILL(dpT,-1);
	cin >> n;
	FOR(i,0,n)
		cin >> arr[i];
	cout<<fixed<<setprecision(9)<<dp(0,(n+1)/2);


	return 0;
}


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

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, wtmax;
    cin >> n >> wtmax;
    ll w[n+1], v[n+1];
    for (int i = 1; i <= n; ++i)
        cin >> w[i] >> v[i];
    ll dp[n+1][wtmax+1] = {};
    for (int i = 1; i <= n; ++i) {
        for(ll j = 0; j < w[i]; j++)
            dp[i][j] = dp[i-1][j];
        for (ll j = w[i]; j <= wtmax; ++j)
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
    }
    cout << dp[n][wtmax];
    return 0;
} 


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    map<string,int> mapS;
    rep(n,0,N){
        string s; cin>>s;
        mapS[s]++;
    }

    int maxN=0;
    for(auto m:mapS) maxN=max(maxN,m.second);

    for(auto m:mapS){
        if(m.second==maxN) cout<<m.first<<endl;
    }
}

Measured memory_bytes: 25216
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int n;
char s[200010];

void doSwap(int a, int b) {
	char temp = s[a];
	s[a] = s[b];
	s[b] = temp;
}

int main()
{
	scanf("%d\n", &n);
	scanf("%s\n", s);
	
	int posLast = n - 1;
	while (posLast >= 0) {
		if (s[posLast] == 'R') 
			break;
		posLast--;
	}
	
	int count = 0;
	
	int p = 0;
	while (p < posLast) {
		if (s[p] == 'R') {
			p++;
			continue;
		} else {
			doSwap(p, posLast);
			count++;
			p++;
			while (posLast >= 0) {
				if (s[posLast] == 'R') {
					break;
				}
				posLast--;
			}
		}
	}
	
	printf("%d\n", count);
	
	return 0;
}



Measured memory_bytes: 1928
#include <map>
#include <iostream>

using namespace std;

int result = 0;

void prime_factor(int64_t n) {
  for(int64_t i = 2; i*i <= n; i++) {
    int before = 0;
    int now = 0;
    while(n % i == 0) {
      now++;
      if (now > before) {
        result++;
        before = now;
        now = 0;
      }
      n /= i;
    }
  }
  if (n != 1) {
    result ++;
  }
  return;
}

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

  cout << result << endl;
}


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

int main()
{
    int n;
    std::cin>>n;
    std::vector<int> hen(n);
    for(int i=0;i<n;i++)std::cin>>hen[i];
    std::sort(hen.begin(),hen.end(),std::greater<int>());

    long long max1 = 0,max2 = 0;
    for(int i=0;i<n-1;i++){
        if(hen[i]==hen[i+1]){
            if(hen[i]>max2){
                max2 = max1;
                max1 = hen[i]; 
                i+=1;
                //std::cout<<max1<<" "<<max2<<std::endl;
            }
        }
    }
    std::cout<<max1*max2<<std::endl;
}

Measured memory_bytes: 640
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = []
for i in range(n):
    D.append(ii())
print(len(set(D)))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	double a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	double sugar_max = -1;
	double ans[2] = {};
	rep(i, 31)rep(j, 31)
	{
		double water = a * i + b * j;
		if (100 * water > f)continue;
		rep(k, 101)rep(l, 101)
		{
			double sugar = c * k + d * l;
			if (100 * water + sugar > f || sugar / water > e)continue;
			if (chmax(sugar_max, sugar/water))
			{
				ans[0] = 100 * water+sugar;
				ans[1] = sugar;
			}
		}
	}
	co(ans[0] << " "<<ans[1]);
	return 0;
}


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

using namespace std;

#define MAX_N 100005

int n, k, y[MAX_N], dp[MAX_N];

int f_imp(int);

int f(int p)
{
	if (dp[p] == 0)
	{
		dp[p] = f_imp(p) + 1;
	}
	return dp[p] - 1;
}

int f_imp(int p)
{
	if (p == n - 1)
	{
		return 0;
	}
  	int rs = INT_MAX/2;
	for (int i = 1; i <= k && p + i < n; i++)
    {
      rs = min(rs, f(p + i) + abs(y[p] - y[p + i]));
    }
    return rs;
}

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", y + i);
	}
	printf("%d\n", f(0));
}


Measured memory_bytes: 7296
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n; ll d[1 << 17];
vector<int> G[1 << 17];
ll c[1 << 17];
vector<LP> v;
map<ll, int> mp;

ll h[1 << 17];
ll calc(int id) {
	h[id] = 1;
	ll res = 0;
	rep(j, G[id].size()) {
		int to = G[id][j];
		res += calc(to); h[id] += h[to];
	}
	return res + h[id];
}
int main() {
	bool valid = true;
	cin >> n;
	rep1(i, n) {
		cin >> d[i]; v.push_back({ d[i],i });
		mp[d[i]] = i;
	}
	sort(v.begin(), v.end(), greater<LP>());
	rep(i, n - 1) {
		int id = v[i].second;
		ll nexval = v[i].first - (n-2-2 * c[id]);
		int t = mp[nexval];
		if (t==0||nexval>=v[i].first) {
			valid = false; break;
		}
		else {
			G[t].push_back(id);
			c[t] += c[id] + 1;
		}
	}
	if (!valid)cout << -1 << endl;
	else {
		ll s = calc(v[n-1].second) - n;
		//cout << "hael" << endl;
		/*cout << s << endl;
		cout << v[n - 1].first << endl;*/
		if (s != v[n - 1].first) {
			cout << -1 << endl;
		}
		else {
			rep1(i, n) {
				rep(j, G[i].size()) {
					cout << i << " " << G[i][j] << endl;
				}
			}
		}
	}
	//stop
	return 0;
}


Measured memory_bytes: 21104
#include<iostream>
#include<cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N=200200,P=1e9+7;
int n,m,ans,lim,all,mxo;
int b[N],f[N],s[N];
char S[N];
void work(int w){
	f[0]=s[0]=1;//cout<<w<<' '<<lim<<'\n';
	if(w==1){
		f[1]=0;s[1]=1;
		FOR(i,2,n){
			f[i]=s[i-2];
			s[i]=(s[i-1]+f[i])%P;
			//cout<<f[i]<<' ';
		}
	}
	else{
		FOR(i,1,n){
			f[i]=(s[i-1]-(i-lim-1<0?0:s[i-lim-1])+P)%P;
			s[i]=(s[i-1]+f[i])%P;
			//cout<<f[i]<<'\n';
		}
	}
	FOR(i,1+(w==1),min(lim,n)) (ans+=1ll*i*f[n-i]%P)%=P;
	cout<<w*ans%P<<'\n';
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d%s",&n,&m,S+1);
	ROF(i,m,1) b[i]=S[i]=='R'^S[1]=='B';
	all=1;
	FOR(i,1,m) all&=b[i];
	if(all) return lim=n,ans=1,work(1),0;
	FOR(i,1,m)if(!b[i]){lim=i-!(i%2);break;}
	for(int l=1,r=1;l<=m;l=r){
		while(r<=m && b[r]==b[l]) r++;
		if(b[l]==0) continue;
		if((r-l&1) && l!=1 && r<=m) lim=min(lim,r-l);
	}
	lim=lim+1>>1;
	if(n&1) return puts("0"),0;
	n/=2;work(2);
}


Measured memory_bytes: 2816
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY 2000000001

int H, A[MAX + 1];

void maxHeapify(int i){
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;
    
    if (l <= H && A[l] > A[i]) largest = l;
    else largest = i;
    if (r <= H && A[r] > A[largest]) largest = r;

    if (largest != i){
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract(){
    int maxv;
    if (H < 1) return -INFTY;
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key){
    if (key < A[i]) return;
    A[i] = key;
    while (i > 1 && A[i / 2] < A[i]){
        swap(A[i], A[i/2]);
        i = i / 2;
    }
}

void insert(int key){
    H++;
    A[H] = -INFTY;
    increaseKey(H, key);
}

int main(){
    int key;
    char com[10];

    while (1){
        scanf("%s", com);
        if (com[0] == 'e' && com[1] == 'n') break;
        if (com[0] == 'i'){
            scanf("%d", &key);
            insert(key);
        }else{
            printf("%d\n", extract());
        }
    }
    return 0;
}


Measured memory_bytes: 6520
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first 
#define sec second
#define int long long
#define endl "\n"
//# define M_PI 3.14159265358979323846
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;

signed main(){
	int n;
	cin>>n;
	double ans=2*3.141*n;
	cout<<ans<<endl;
	//std::cout << std::setprecision(2) << 2*3.1415926*n << endl;
	return 0;
}



Measured memory_bytes: 6132
def changeblack(a,n):
    t = n
    for i in range(0,49,2):
        for j in range(0,100,2):
                if t > 0:
                    a[i][j] = '.'
                    t -= 1
    return a
 
def changewhite(a,n):
    t = n
    for i in range(51,100,2):
        for j in range(0,100,2):
                if t > 0:
                    a[i][j] = '#'
                    t -= 1
    return a

A, B = [int(i) for i in input().split()];
 
A -= 1;
B -= 1;
 
def list_2d(H, W, v) :
    return [[v for i in range(W)] for j in range(H)];
 
ans = list_2d(50, 100, '#') + list_2d(50, 100, '.');
ans = changeblack(ans,A)
ans = changewhite(ans,B)
print('100 100')
for i in range(0,100):
    for j in range(0,99):
        print(ans[i][j],end = "")
    print(ans[i][99])
        

Measured memory_bytes: 4468
N, K = map(int, input().split())

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

a = A.index(1)
#print (a)
#すべてindexで処理する
b = (a + 1 + K-2)//(K-1) #左端から1までの個数をKを1回ごとに進む数で割って切り上げ
#print (b)
c = b * (K-1) #上記の処理をしたときの右端のindex

if c >= (N-1): #右端のindexがリストの長さを超えている時
    print (b)
else: #右側にまだ数字が残っている時
    d = (N-1) - c #残っている数
    e = (d+(K-2))//(K-1)
    print (b + e)


Measured memory_bytes: 14004
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K, S): (usize, usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let ans = (0..N)
        .map(|i| {
            if i < K {
                S
            } else if S == 1_000_000_000 {
                2
            } else {
                1_000_000_000
            }
        })
        .map(|x| x.to_string())
        .collect::<Vec<_>>()
        .join(" ");

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


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >>N;
     vector<int> d(N);
   for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
int answer=0;
  for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {

  if(i!=j){
answer += d[i]*d[j];
  }
  }
}

cout <<answer/2<<endl;

}

Measured memory_bytes: 256
def main():
    H, W = list(map(int, input().split(" ")))
    a = []
    for r in range(H):
        a += [input()]
    output = solve(H, W, a)
    for s in output:
        print(s)
    return

#________________________________________
#  Solve
#________________________________________
def solve(H, W, a):
    """
    解答のコード
    """
    index_list = []
    for _r in range(H):
        for _c in range(W):
            if a[_r][_c] is not ".":
                break
            if _c == W-1:
                index_list += [_r]
    j = 0
    for i in index_list:
        del a[i-j]
        j += 1

    index_list = []
    a = list(map(list, zip(*a)))
    for _r in range(len(a)):
        for _c in range(len(a[0])):
            if a[_r][_c] is not ".":
                break
            if _c == len(a[0])-1:
                index_list += [_r]
    j = 0
    for i in index_list:
        del a[i-j]
        j += 1
    a = list(map(list, zip(*a)))
    a = [ "".join(a[i]) for i in range(len(a))]
    return a
#________________________________________


if __name__ == "__main__":
    main()

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

int main(){
  int N ;
  long long Y ;
  cin >> N >> Y ;
  int a = -1;
  int b = -1;
  int c = -1;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N-i;j++){
     
        if(10000*i+5000*j+1000*(N-i-j)==Y){
          a = i;
          b = j;
          c = N-i-j;
        }
      }
    }
  
  
  cout << a << ' ' << b << ' ' << c << endl;
  
}


Measured memory_bytes: 256
//import java.util.Arrays;
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNext()){
			long a = scan.nextLong();
			long b = scan.nextLong();
			long c;
			long r;
			long A = a;
			long B = b;
				while((r = a%b) != 0){
					a=b;
					b=r;
				}
		
				c = A*B/b;
		
				System.out.println(b + " " + c);
		}
	}
} 

Measured memory_bytes: 17220
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    Long price = 100L;
    int year = 0;
    while(price<N){
      price += price/100;
      year++;
    }
    System.out.print(year);
  }
}


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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;

using StrView = string_view;

const string YES = "Yes";
const string NO = "No";

auto solve(StrView S, StrView T) -> void {
  if (S.size() + 1 != T.size()) {
    puts("No");
    return;
  }
  if (S == T.substr(0, S.size())) {
    puts("Yes");
  } else {
    puts("No");
  }
}

auto main() -> int {
  string S;
  cin >> S;
  string T;
  cin >> T;
  solve(S, T);
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ulli;

ulli pow(int n, int p){
  ulli res = 1;
  for (int i = 0; i < p; i++) {
    res *= n;
    if(res > 1e9) throw "error";
  }
  return res;
}


int main(int argc, char *argv[]){
  int n, t;
  string s;
  cin >> n >> t >> s;
  vector<int> p;
  for (int i = 2; i < s.length(); i+=4) {
    char tmp = s[i];
    p.push_back(atoi(&tmp));
  }
  ulli ans = 0;

  for (int i = 0; i < p.size(); i++) {
    try{
      ans += pow(n, p[i])*t;
      if(ans > 1e9)throw "error";
    }catch(const char* s){
      std::cout << "TLE" << std::endl;
      return 0;
    }
  }
  std::cout << ans << std::endl;

  return 0;
}

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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)


void func(long long a, long long b){
    string x1(b, *to_string(a).c_str());
    string x2(a, *to_string(b).c_str());
    cout << (x1<x2? x1:x2) << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    func(a, b);
    return 0;
}


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

using namespace std;
using lli = long long int;

int main()
{
    int n, m, l;
    cin >> n >> m >>l;

    vector<vector<lli>> A(n, vector<lli>(m, 0));
    vector<vector<lli>> B(m, vector<lli>(l, 0));

    //??\???
    for (int y = 0; y < n; ++y)
    {
        for (int x = 0; x < m; ++x)
            cin >> A[y][x];
        cin.ignore();
    }
    for (int y = 0; y < m; ++y)
    {
        for (int x = 0; x < l; ++x)
            cin >> B[y][x];
        cin.ignore();
    }

    vector<vector<lli>> C(n, vector<lli>(l, 0));

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < l; ++j)
            for (int k = 0; k < m; ++k)
                C[i][j] += A[i][k] * B[k][j];

    
    for (int y = 0; y < n; ++y)
        for (int x = 0; x < l; ++x)
            cout << C[y][x] << (x != l - 1 ? ' ' : '\n');

    return 0;
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
char n[5];
int main()
{
    cin>>n;
    if (n[0]==n[1]&&n[1]==n[2]||n[1]==n[2]&&n[2]==n[3])
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys

def process(data):
	count = 0

	M = int(data[0])
	D = data[1]
	
	if len(D) < 2:
		return 0


	for d10 in range(2, int(D[0])+1):
		for d1 in range(2, 10):
			if 0 < d10 * d1 and d10 * d1 <= M:
				if int(str(d10)+str(d1)) <= int(D):
					count += 1
				else:
					break


	return count 

def main(argv):
	for i in range(1):
		data = raw_input()
		data = data.split(" ")
	print(process(data))

	

if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 2692
#include<iostream>
#include<set>
using namespace std;
int main(){
	int a,x,y,max;
	set<int> box;
	while(cin>>x>>y,x||y){
		max=0;
		box.insert(0);
		for(int i=0;i<x;i++){
			cin>>a;
			box.insert(a);
		}
		for(int i=0;i<y;i++){
			cin>>a;
			box.insert(a);
		}
		set<int>::iterator ite=box.begin(),arr=box.begin();
		arr++;
		while(arr!=box.end()){
			if(*arr-*ite>max)
				max=*arr-*ite;
			ite++;
			arr++;
		}
		cout<<max<<endl;
		box.clear();
	}
	return 0;
}

Measured memory_bytes: 0