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

#define nl                 "\n"
#define ll                 long long
#define pb                 push_back
#define pf                 push_front
#define np                 next_permutation
#define pp                 prev_permutation
#define sqr(x)             ((x)*(x))
#define pi                 acos(-1)
#define setprecision(x)    fixed<<setprecision((int)(x))
#define mem1(x)            memset(x,0,sizeof(x))
#define mem2(x)            memset(x,-1,sizeof(x))
#define all(x)             (x).begin(),(x).end()
#define sort1(x)           sort(all(x))
#define csort(x,c)         sort(all(x),c)
#define rsort(x)           sort(x.rbegin(),x.rend())

using namespace std;
void solve()
{
    int n;
    cin>>n;
    vector<int>a(n+1);
    int limit=sqrt(n);
    for(int i=1; i<=limit; i++)
    {
        for(int j=1; j<=limit; j++)
        {
            for(int k=1; k<=limit; k++)
            {
                int b=sqr(i)+sqr(j)+sqr(k)+i*j+j*k+i*k;
                if(b<=n)
                    a[b]++;
            }
        }
    }
    for(int i=1; i<=n; i++)
        cout<<a[i]<<endl;
}
int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //int t; cin>>t; while(t--){solve();}
    solve();
    return 0;
}



Measured memory_bytes: 3700
n = int(input())
dice = []
for _ in range(n):
    num = list(map(int, input().split()))
    dice.append(num)

cnt = 0
for die in dice:
    if die[0] == die[1]:
        cnt += 1
        if 3 <= cnt:
            break
    else:
        cnt = 0

if cnt >= 3:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
void gofail(){
	cout<<"No\n";
	exit(0);
}
const int N=100100;
int a[N],b[N],c[N],sum[3*N],sum1,sum2,n;
void add(int x){for(;x;x-=x&-x)sum[x]^=1;}
int qry(int x){int ans=0;for(;x<=3*n;x+=x&-x)ans^=sum[x];return ans;}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	for(int i=1;i<=n;++i)cin>>b[i];
	for(int i=1;i<=n;++i)cin>>c[i];
	for(int i=1;i<=n;++i){
		if(a[i]<b[i]){
			if(a[i]+1!=b[i])gofail();
			if(b[i]+1!=c[i])gofail();
			if(c[i]%3)gofail();
			a[i]=a[i]/3+1;b[i]=0;
		}else{
			if(a[i]-1!=b[i])gofail();
			if(b[i]-1!=c[i])gofail();
			if(a[i]%3)gofail();
			a[i]=a[i]/3;b[i]=1;
		}
		if((a[i]^i)&1)gofail();
		if(i&1)sum2^=b[i];
		else sum1^=b[i];
	}
	for(int i=1;i<=n;i+=2){
		sum1^=qry(a[i]);
		add(a[i]);
	}
	memset(sum,0,sizeof sum);
	for(int i=2;i<=n;i+=2){
		sum2^=qry(a[i]);
		add(a[i]);
	}
	if(sum1||sum2)gofail();
	cout<<"Yes\n";
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;

vector<ll> inv,fact,invfact;
 
//snuke
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
 
 
 
void mod_build(int n=101010){  
  fact.resize(n+1);
  inv.resize(n+1);
  invfact.resize(n+1);
  fact[0]=inv[0]=invfact[0]=1;
  inv[1]=1;
  rep(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
    invfact[i+1]=invfact[i]*inv[i+1]%mod;
  }
}
ll perm(int n,int k){
  if(n<0||k<0||k>n)return 0;
  return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
  if(n<0||k<0||k>n)return 0;
  return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
  k%=mod-1;
  if(k<0)k+=mod-1;
  ll ret=1;
  while(k){
    if(k&1)ret=ret*n%mod;
    n=n*n%mod;
    k>>=1;
  }
  return ret;
}

int main(){
  mod_build();
  int n,m;
  cin>>n>>m;
  vector<ll> x(n),y(m);
  mint xsum=0,ysum=0;
  rep(i,n){
    cin>>x[i];
    if(i!=0) xsum += (x[i]-x[i-1])*(n-i)*i;
  }
  rep(i,m){
    cin>>y[i];
    if(i!=0) ysum += (y[i]-y[i-1])*(m-i)*i;
  }
  mint ans = xsum * ysum;
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=5e3+20;
const int inf=0x3f3f3f3f;

#define pii pair<int,int>

int n;
vector<pii >s;
vector<pii >t;
char str[maxn];

inline void init()
{
	n=read();
	scanf("%s",str+1);
	s.push_back(mkr(0,str[1]=='0'));
	REP(i,1,n-1)if(str[i]!=str[i+1])s.push_back(mkr(i,str[i]=='1'));
	s.push_back(mkr(n,str[n]=='1'));
	scanf("%s",str+1);
	t.push_back(mkr(0,str[1]=='0'));
	REP(i,1,n-1)if(str[i]!=str[i+1])t.push_back(mkr(i,str[i]=='1'));
	t.push_back(mkr(n,str[n]=='1'));
	if(SZ(s)>SZ(t))swap(s,t);
}

inline void doing()
{
	vector<pii >Top; Top.push_back(s.front());
	REP(i,1,n)Top.push_back(mkr(0,Top.back().se^1));
	reverse(Top.begin(),Top.end()); Top.pop_back();
	Top.insert(Top.end(),s.begin(),s.end());
	REP(i,1,n)Top.push_back(mkr(n,Top.back().se^1));

	int ans=inf;
	
	REP(i,0,SZ(Top)-SZ(t))if(Top[i].se==t[0].se)
	{
		int sum=0;
		REP(j,0,i-1)sum+=Top[j].fi;
		REP(j,i+SZ(t),SZ(Top)-1)sum+=n-Top[j].fi;
		REP(j,0,SZ(t)-1)
			sum+=abs(Top[i+j].fi-t[j].fi);
		chkmin(ans,sum);
	}
	printf("%d\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}


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



int main(){
  int H,W,K;
  cin>>H>>W>>K;
  
  vector<vector<int>> kari(H, vector<int>(W, 0));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      char x;
      cin>>x;
      if(x=='#') kari.at(i).at(j)=1;
    }
  }
  vector<vector<int>> ban(H, vector<int>(W, 0));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ban.at(i).at(j)=kari.at(i).at(j);
    }
  }
  int kaz=0;
  for(int s=0;s<(1<<H);s++){
    bitset<12> d(s);
    for (int i = 0; i < H; i++) {
      if (d.test(i)) {
        for(int p=0;p<W;p++){
          ban.at(i).at(p)=0;
        }
      }
    }
    vector<vector<int>> ban2(H, vector<int>(W, 0));
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        ban2.at(i).at(j)=ban.at(i).at(j);
      }
    }
    for(int t=0;t<(1<<W);t++){
      bitset<12> e(t);
      for (int j = 0; j < W; j++) {
        if (e.test(j)) {
          for(int q=0;q<H;q++){
            ban2.at(q).at(j)=0;
          }
        }
      }
      int sum=0;
      for(int c=0;c<H;c++){
        for(int d=0;d<W;d++){
          if(ban2.at(c).at(d)==1) sum++;
        }
      }
      if(sum==K) kaz++;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          ban2.at(i).at(j)=ban.at(i).at(j);
        }
      }
    }
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        ban.at(i).at(j)=kari.at(i).at(j);
      }
    }
  }
  cout<<kaz<<endl;
  
  
}

Measured memory_bytes: 3628
N = gets.chomp.to_i
LS = gets.chomp.split(" ").map{|s| s.to_i}

def ntangle_ok?(ls)
  sum = ls.inject(0){|acc, l| acc + l}
  return ls.inject(true){|acc, l| acc & ((sum - l) > l)}
end

if ntangle_ok?(LS)
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 1788
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val S = CharArray(N) {
        next()[0]
    }
    val T = S.filter { "MARCH".contains(it) }.groupBy { it }.map { it.value.size.toLong() }
    var ans = 0L
    for (i in 0 until T.size) {
        for (j in i + 1 until T.size) {
            for (k in j + 1 until T.size) {
                ans += T[i] * T[j] * T[k]
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 37620
import java.util.*;
 
public class Main{
  
  public static void main(String[] args){
   
    Scanner sc = new Scanner(System.in);
    
    int tH = sc.nextInt();
    int tA = sc.nextInt();
    int aH = sc.nextInt();
    int aA = sc.nextInt();
   
    int tCount =0;
    while(tH > 0){ 
     tH -= aA;
     tCount++;
    }
     
    int aCount =0;
    while(aH > 0){ 
      aH -= tA;
      aCount++;
    }
    
    if(tCount < aCount){
      System.out.println("No");
    }else if(tCount == aCount){
      System.out.println("Yes");
    }else{
       System.out.println("Yes");
    }
   
  }
  
}

Measured memory_bytes: 35760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    string s;
    cin >> s;
    if(s[0] == s[2])cout << "Yes\n";
    else cout << "No\n";
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  vector<string> s(3);
  for (auto& i : s) cin >> i;
  for (int i = 0; i < 3; ++i) cout << s[i][i];
  cout << endl;
}



Measured memory_bytes: 256
//int -> ll
//http://web.mit.edu/~ecprice/acm/acm08/notebook.html#file12
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include<bits/stdc++.h>
typedef long long ll;
#define x first
#define y second
#define REP(i,sss,eee) for(int i=sss;i<=eee;++i)
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vb vector<double>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
#define N 1000000007
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
long long ex(long long a, long long b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	long long tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
long long inv(long long k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}

/*****************default********************/
int n;
std::vector<std::vector<vb>> dp;
double f(int a1, int a2, int a3)
{
	if(a1<0||a2<0||a3<0){return 0;}
	if(dp[a1][a2][a3]!=-1){return dp[a1][a2][a3];}
	double sum=(a1+a2+a3);
	double ans=((((n*1.0)-sum)*1.0)/sum);
	if(a1>0)
	{
		ans+=(((a1*1.0)/sum)*(f(a1-1,a2,a3)+1.00));
	}
	if(a2>0)
	{
		ans+=(((a2*1.0)/sum)*(f(a1+1,a2-1,a3)+1.00));
	}
	if(a3>0)
	{
		ans+=(((a3*1.0)/sum)*(f(a1,a2+1,a3-1)+1.00));
	}
	return (dp[a1][a2][a3]=ans);
}
int main(){
	dp.resize(303,std::vector<vb>(303,vb(303,-1)));
	cin>>n;
	int a1=0,a2=0,a3=0;
	REP(i,0,n-1)
	{
		int a;cin>>a;
		if(a==1){++a1;}if(a==2){++a2;}if(a==3){++a3;}
	}
	dp[0][0][0]=0;
	printf("%.15lf\n",f(a1,a2,a3));
}

Measured memory_bytes: 221312
#include <iostream>
#define fast ios::sync_with_stdio(0), cin.tie(0)
#define ll long long
const int md = 1e9 + 7;
using namespace std;
ll mn1, mn2, a, b, c, d, n;
int main() {
	fast;
	cin >> a >> b >> c >> d >> n;
	mn1 = min(min(4 * a, 2 * b), c);
	mn2 = min(min(min(8 * a, 4 * b), 2 * c), d);
	cout << (n / 2) * mn2 + (n & 1) * mn1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
int main() {

	int t;
	int i,j,n;

	int w,k;

	cin>>n>>w>>k;

	char a[10][10];

	std::vector<int> row(n,0);
	std::vector<int> col(n,0);

	int br=0;

	for (i=0;i<n;i++) {
		for (j=0;j<w;j++) {
			cin>>a[i][j];
			if (a[i][j]=='#') {
				row[i]++;
				col[j]++;
				br++;
			}
		}
	}

	int vk=0;

	for (int biti=0;biti<(1<<n);biti++)
	for (int bitj=0;bitj<(1<<w);bitj++) {

		// bitset<8> r(biti);
		// cout<<r<<"\n";

		// cout<<"--------------\n";

		int br1=0;

		int pos[10][10]={0};

		for ( int j = 0; j < n ; ++ j ) {
            if ((biti&(1<<j))!=0) {
            	// cout<<"biti: "<<j<<"\n";

            	for (int j1=0;j1<w;j1++)
            	if (a[j][j1]=='#' && pos[j][j1]==0) {
            		br1++;
            		pos[j][j1]=1;
            	}
            }
        }

        for ( int j = 0; j < w ; ++ j ) {
            if ((bitj&(1<<j))!=0) {
            	// cout<<"bitj: "<<j<<"\n";

            	for (int j1=0;j1<n;j1++) 
            	if (a[j1][j]=='#' && pos[j1][j]==0) {
            		br1++;
            		pos[j1][j]=1;
            	}
            }
        }

			// bitset<8> x(biti);
	  //       bitset<8> y(bitj);
	  //       cout<<x<<" "<<y<<" "<<br1<<" "<<br<<"\n";

	  //     for (i=0;i<n;i++)
	  //     {
	  //     	for (j=0;j<w;j++) cout<<pos[i][j];
	  //     	cout<<"\n";
	  //     }

        if (br-br1==k) {
        	vk++;
        	// cout<<"yes\n";
        
        }

	}

	cout<<vk<<"\n";

	return 0;
}

Measured memory_bytes: 3632
use proconio::{input, fastout};
use proconio::marker::Chars;
// use itertools::*;

#[fastout]
fn main() {
  input!{
    n: usize,
    s: Chars
  };
  let s: Vec<usize> = s.iter().map(|x| { x.to_digit(10).unwrap() as usize }).collect();
  // let mut dp = vec![vec![(false, false, false);10];4];
  let mut dp = vec![vec![vec![(false, false, false);10];10];10];
  let mut ans = 0;
  for i in s {
    for j in 0..10 {
      for k in 0..10 {
        let a = &dp[j][k][i];
        if a.0 && a.1 && !a.2{
          dp[j][k][i] = (true, true, true);
          ans += 1;
        }
      }
    }
    for j in 0..10 {
      for k in 0..10 {
        let a = &dp[j][i][k];
        if a.0 && !a.1 {
          dp[j][i][k] = (true, true, false);
          // ans += 1;
        }
      }
    }
    for j in 0..10 {
      for k in 0..10 {
        let a = &dp[i][j][k];
        if !a.0 {
          dp[i][j][k] = (true, false, false);
          // ans += 1;
        }
      }
    }
  }
  println!("{}", ans);
}


Measured memory_bytes: 2504
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N, M, S, T;
	cin >> N >> M;
	vector<vector<int> > G(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b; --a, --b;
		G[a].push_back(b);
	}
	cin >> S >> T; --S, --T;
	vector<vector<int> > dist(N, vector<int>(3, -1));
	dist[S][0] = 0;
	queue<pair<int, int> > que; que.push(make_pair(S, 0));
	while (!que.empty()) {
		pair<int, int> u = que.front(); que.pop();
		for (int i : G[u.first]) {
			int nxt = (u.second + 1) % 3;
			if (dist[i][nxt] == -1) {
				dist[i][nxt] = dist[u.first][u.second] + 1;
				que.push(make_pair(i, nxt));
			}
		}
	}
	if (dist[T][0] == -1) cout << -1 << endl;
	else cout << dist[T][0] / 3 << endl;
	return 0;
}

Measured memory_bytes: 12672
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

bool ok(string s) {
  int n = s.size();
  if (n % 2 == 1) return false;
  for (int i = 0; i < n / 2; i++)
    if (s[i] != s[i + n / 2]) return false;
  return true;
}

void solve() {
  string s; cin >> s;
  int n = s.size();
  for (int i = n - 1; i >= 0; i--) {
    string subs = s.substr(0, i);
    // debug2(i, subs);
    if (ok(subs)) {
      outl(i);
      return;
    } 
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io
    
    ll n,m;
    cin>>n>>m;
    ll ans;
    if(n*2>=m){
        ans=m/2;
    }else{
        ans=n+(m-n*2)/4;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

lint sgm(lint n) {
	//0からの総和を返す
	return n * (n + 1) / 2;
}

lint fact(lint n) {
	//n!を返す
	if (n == 0) return 1;
	else return n * fact(n - 1);
}

lint power(lint x, lint n, lint m) {
	//(x^n)%mを返す
	lint res = 1;
	x %= m;
	while (n > 0) {
		if (n % 2 == 1) {
			res = res * x % m;
		}
		x = x * x % m;
		n /= 2;
	}
	return res;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	string S;
	cin >> S;
	lint Z = S.size();
	lint cnt = 0;
	rep(i, Z) {
		if (S[i] == 'W') {
			cnt++;
		}
	}
	lint sum = 0;
	rep(i, Z) {
		if (S[i] == 'W') {
			sum += i;
		}
	}
	cout << sum - sgm(cnt-1) << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(){
    int A,B;cin>>A>>B;
    for(int i = 1;i < 1000000;i++){
        if(floor(i * 1.08) == A+i && floor(i * 1.1) == B+i){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>
#include <bitset>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

bool is_sheep0[4] = {true, true, false, false};
bool is_sheep1[4] = {true, false, true, false};
vector<bool> sheep;
int n;
string s;

bool check(){
  if(((sheep[n - 1] && s[n - 1] == 'o') || (!sheep[n - 1] && s[n - 1] == 'x')) && sheep[n - 2] != sheep[0])return false;
  if(((sheep[n - 1] && s[n - 1] == 'x') || (!sheep[n - 1] && s[n - 1] == 'o')) && sheep[n - 2] == sheep[0])return false;
  if(((sheep[0] && s[0] == 'o') || (!sheep[0] && s[0] == 'x')) && sheep[n - 1] != sheep[1])return false;
  if(((sheep[0] && s[0] == 'x') || (!sheep[0] && s[0] == 'o')) && sheep[n - 1] == sheep[1])return false;
  return true;
}

void dump() {
  for(int i = 0; i < n; i++){
    if(sheep[i])cout << 'S';
    else cout << 'W';
  }
  cout << endl;
}

int main(int argc, char const* argv[])
{
  cin >> n;
  cin >> s;
  sheep = vector<bool>(n, false);
  for(int i = 0; i < 4; i++){
    sheep[0] = is_sheep0[i];
    sheep[1] = is_sheep1[i];
    for(int j = 1; j < n - 1; j++){
      if((sheep[j] && s[j] == 'o') || (!sheep[j] && s[j] == 'x')){
        sheep[j + 1] = sheep[j - 1];
      }else{
        sheep[j + 1] = !sheep[j - 1];
      }
    }
    if(check()){
      dump();
      return 0;
    }
  }
  cout << - 1 << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

ll func(ll A, ll x, ll B) {
    return floor(A * x / B) - A * floor(x / B);
}

int main() {
    ll A, B, N; cin >> A >> B >> N;
    ll ans = func(A, min(B-1, N), B);
    cout << ans << endl;
}

Measured memory_bytes: 3596
from collections import deque
from copy import deepcopy


def bfs(table, i, j, h, w):
    dq = deque()
    ans = 0
    dq.append((i, j, 0))  # x,y,distance
    table[i][j] = "#"
    while dq:
        x, y, dis = dq.popleft()
        ans = max(ans, dis)
        if x > 0 and (x - 1, y) and table[x - 1][y] != "#":
            dq.append((x - 1, y, dis + 1))
            table[x - 1][y] = "#"
        if x < h - 1 and (x + 1, y) and table[x + 1][y] != "#":
            dq.append((x + 1, y, dis + 1))
            table[x + 1][y] = "#"
        if y > 0 and (x, y - 1) and table[x][y - 1] != "#":
            dq.append((x, y - 1, dis + 1))
            table[x][y - 1] = "#"
        if y < w - 1 and (x, y + 1) and table[x][y + 1] != "#":
            dq.append((x, y + 1, dis + 1))
            table[x][y + 1] = "#"

    return ans


def main():
    h, w = [int(i) for i in input().strip().split()]
    grid = [list(input()) for _ in range(h)]
    ans = 0
    for i in range(h):
        for j in range(w):
            if grid[i][j] == ".":
                _grid = deepcopy(grid)
                max_path = bfs(_grid, i, j, h, w)
                ans = max(ans, max_path)

    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

#define ll long long 

const int INF = 1e9+5;

int main(){
	int n;
	cin >> n;
	vector<int> height(n);
	for(int i = 0; i < n; ++i){
		cin >> height[i];
	}
	vector<int> dp(n, INF);
	dp[0] = 0;
	int j;
	for(int i = 0; i < n; ++i){
		j = i+1;
		if(j < n){
			dp[j] = min(dp[j], dp[i] + abs(height[i]-height[j]));
		}
		j = i+2;
		if(j < n){
			dp[j] = min(dp[j], dp[i] + abs(height[i]-height[j]));
		}
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map <Long,Integer>  map = new HashMap<Long,Integer>();
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (map.containsKey(temp)==false) {
				map.put(temp, 1);
			} else {
				int j= map.get(temp);
				j++;
				map.put(temp, j);
			}
		}
		int M = sc.nextInt();
		if (M>N) {
			System.out.println("NO");
			return ;
		}
		for (int i=0;i<M;i++) {
			long temp = sc.nextLong();
			if (map.containsKey(temp)==false) {
				System.out.println("NO");
				return ;
			} else {
				int j= map.get(temp);
				if (j==0) {
					System.out.println("NO");
					return ;
				}
				j--;
				map.put(temp, j);
			}
		}
		System.out.println("YES");
	}
}

Measured memory_bytes: 75192
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  if (a[0] >= 3200){
    cout << 1 << " " << n << endl;
  }
  else {
    int hoge[9] = {};
    for (int i = 0; i < n; i++){
      int m = min(a[i]/400, 8LL);
      hoge[m]++;
    }
    int sum = 0;
    for (int i = 0; i < 8; i++){
      sum += min(1, hoge[i]);
    }

    cout << sum << " " << sum + hoge[8] << endl;
  }

  return 0;
}


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

int main(){
	char X[2];
	int Y[2], i=0;
	cin >> X[0] >> X[1];
	for(i=0;i<2;i++){
		if(X[i]=='A') Y[i]=0;
		if(X[i]=='B') Y[i]=1;
		if(X[i]=='C') Y[i]=2;
		if(X[i]=='D') Y[i]=3;
		if(X[i]=='E') Y[i]=4;
		if(X[i]=='F') Y[i]=5;
	}
	if(Y[0]<Y[1]) cout << "<" << endl;
	if(Y[0]>Y[1]) cout << ">" << endl;
	if(Y[0]==Y[1]) cout << "=" << endl;
}


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

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

ll v[4][101];
int c[4];

int main() {
	int n,w;
	cin>>n>>w;
	int w0;
	cin >> w0 >> v[0][++c[0]];
	FOR(i,1,n){
		int r;
		cin >> r;
		cin >> v[r-w0][++c[r-w0]];
	}
	REP(i,4){
		sort(v[i] + 1, v[i] + 1 + c[i], greater<ll>());
		dump(i);
		REP(j,c[i])dump(v[i][j+1]);
		REP(j,c[i])v[i][j+1]+=v[i][j];
		c[i]++;
	}
	ll ans = 0;
	REP(i,c[0])REP(j,c[1])REP(k, c[2])REP(l,c[3]){
		ll a = (ll)v[0][i] + v[1][j] + v[2][k] + v[3][l];
		ll s = (ll)w0 * (i+j+k+l) + j + k*2 + l*3;
		if(s<=w)ans = max(ans, a);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   long long s=a*b;
    long long m=c*d;
     if(s<m){
      cout<<m;
        }
  else{
    cout<<s;
     }
}




Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    int mod = 1000000007;

    long result = 1;

    for (int i = 1; i <= N; i++) {
      result = (long) result * i % mod; 
    }

    System.out.println(result);

  }

}

Measured memory_bytes: 20820
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define LL long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pii pair < int , int >

int n;
int A[1005][1005];
int pos[1005];
int vs[1005];
int B[1005][1005];

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	queue < pair < int , int > > q;

	cin >> n;
	for ( int i = 1; i <= n; i++ ){
		for ( int j = 1; j < n; j++ ) cin >> A[i][j];
		pos[i] = 1;
	}
	
	int ans = (n * (n-1)) / 2;
	for ( int i = 1; i <= n; i++ ){
		if ( i == A[A[i][1]][1] && vs[i] == 0 && vs[A[i][1]] == 0 ){
			q.push(mp(i,A[i][1]));
			pos[i]++;
			pos[A[i][1]]++;
			ans -= 1;
			vs[i] = true;
			vs[A[i][1]] = true;
			B[i][A[i][1]] = B[A[i][1]][i] = true;
		}
	}

	int step;
	for ( step = 0; q.size() > 0 ; step++ ){
		int sz = q.size();
		while ( sz-- ){
			int u = q.front().fi, v = q.front().se;
			q.pop();

			vs[u] = false;
			vs[v] = false;
			if ( pos[u] < n){
				int xu = A[u][pos[u]];
				if ( !vs[xu] && !vs[u] && xu != u ){
					if ( pos[xu] < n ){
						if ( A[xu][pos[xu]] == u && B[u][xu] == 0 ){
							pos[u]++;
							pos[xu]++;
							B[u][xu] = B[xu][u] = 1;
							vs[u] = vs[xu] = true;
							ans -= 1;
							q.push(mp(xu,u));
						}
					}
				}
			}

			if ( pos[v] < n){
				int xv = A[v][pos[v]];
				if ( !vs[xv] && !vs[v] && xv != v ){
					if ( pos[xv] < n ){
						if ( A[xv][pos[xv]] == v && B[v][xv] == 0 ){
							pos[v]++;
							pos[xv]++;
							B[v][xv] = B[xv][v] = 1;
							vs[v] = vs[xv] = true;
							ans -= 1;
							q.push(mp(xv,v));
						}
					}
				}
			}
		}		
	}

	if ( ans == 0 ) cout << step << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 8192
def dist(pos):
    r = []
    for i in xrange(len(cave)):
        r.append(((cave[i][0]**2 + cave[i][1]**2), cave[i]))
    r.sort(reverse = True)
    return r[0][1]

n = int(raw_input())
for i in xrange(n):
    pos = [0,0]
    cave = []
    while 1:
        x,y = map(int, raw_input().split())
        if x == 0 and y == 0:
            fpos = dist(cave)
            print "%d %d" % (fpos[0], fpos[1])
            break
        pos[0] += x
        pos[1] += y
        cave.append([pos[0], pos[1]])

Measured memory_bytes: 4324
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>

using namespace std;


int N,L;
int ans;
int motonoaji;
int i_hiitaaji;
int minabs;
int minnoaji;

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

  int i;

  motonoaji = (L-1)*N + N*(N+1)*0.5;

  i_hiitaaji = motonoaji - (L+1-1);
  minabs = abs(motonoaji - i_hiitaaji);
  minnoaji = i_hiitaaji;
  for(i=1;i<=N;i++) {
    i_hiitaaji = motonoaji - (L+i-1);
    if (minabs > abs(motonoaji - i_hiitaaji)) {
      minabs = abs(motonoaji - i_hiitaaji);
      minnoaji = i_hiitaaji;
    }
  }

  cout << minnoaji << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
#AC, WA, TLE, RE
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(n):
  si = input()
  if si == 'AC':
    AC += 1
  elif si == 'WA':
    WA += 1
  elif si == 'TLE':
    TLE += 1
  elif si == 'RE':
    RE += 1

print('AC x '+str(AC))
print('WA x '+str(WA))
print('TLE x '+str(TLE))
print('RE x '+str(RE))

Measured memory_bytes: 9152
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
    ll N,M;
    cin >> N >> M;
  ll wa = 0;
  for(int i = 1;i<=M - N;i++)wa += i;
  cout << wa - M << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;

class Main {

	static List<Long> orthometric;  //海抜
	static Map<Long,List<Integer>> seaLevel = new TreeMap<Long,List<Integer>>();

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)){
			int len = sc.nextInt();
			orthometric = new LinkedList<Long>();  //海抜
			TreeSet<Long> seas = new TreeSet<Long>();
			long now = 0l;
			for (int i=0; i<len; i++) {
				long a = sc.nextLong();
				if (a != now) {  //隣が同じ高さだと無視
					orthometric.add(a);  //海抜を読み込み
					if (!seaLevel.containsKey(a)) {  //含まれていない場合
						List<Integer> list = new ArrayList<Integer>();
						list.add(orthometric.size()-1);  //位置を記録
						seaLevel.put(a, list);
					} else seaLevel.get(a).add(orthometric.size()-1);
					seas.add(a);  //海の変化を読み込み
					now = a;
				}
			}
			//for (List<Integer> l : seaLevel.values()) System.out.println(l);
			if (orthometric.size()>0) {
				List<int[]> land = new ArrayList<int[]>();
				land.add(new int[]{0,orthometric.size()-1});  //最初は全部
				int max = findLand();
				System.out.println(max);
			} else System.out.println("0");  //全部0だったら

			}
	}

	public static int findLand() {
		int max = 0;
		//List<Long> o = new LinkedList<>(orthometric);
		Long[] oArray = new Long[orthometric.size()];
		orthometric.toArray(oArray);
		int count = 1;
		for (List<Integer> l : seaLevel.values()) {
			//Integer[] array = new Integer[l.size()];
			//l.toArray(array);
			for (int i : l) {
				//System.out.println("i-----------" + i);
				if ((i!=0)&&(i!=oArray.length-1)) {  //最初と最後ではない場合
					if ((oArray[i-1]!=-1)&&(oArray[i+1]!=-1)) count++;  //島の真ん中であればcount+1
					else if ((oArray[i-1]==-1)&&(oArray[i+1]==-1)) count--;  //島はこのエリアしかない場合count-1
				} else if ((i==0)&&(i!=oArray.length-1)) {
					if (oArray[i+1]==-1) count--;  //島はこのエリアしかない場合count-1
				} else if ((i!=0)&&(i==oArray.length-1)) {
					if (oArray[i-1]==-1) count--;  //島はこのエリアしかない場合count-1
				}
				oArray[i] = -1l;  //沈没させる
			}
			//System.out.println("count: " + count);
			max = Math.max(max, count);
		}
		return max;
	}
}


Measured memory_bytes: 93396
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n);
	VEC(int, a, n);

	int f = 1, cnt = 0;
	REP(i, n) {
		f = a[f - 1];
		cnt++;
		if (f == 2) break;
		if (i == n - 1) {
			OUT(-1)BR;
			return 0;
		}
	}
	OUT(cnt)BR;
	
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
vector<long long> v;

long long erase(){

    long long match_index = -1;
    long long r = -1;

    for(long long i = 0; i < v.size(); i++){
        if(v[i] == i+1){
            match_index = i;
        }
    }
    if(match_index != -1){
        r = v[match_index];
        v.erase(v.begin()+match_index);
    }

    return r;
}

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

    for(long long i = 0; i < n; i++){
        long long b;
        cin >> b;
        v.push_back(b);
    }

    vector<long long> ans;

    bool flag = true;
    for(long long i = 0; i < n; i++){
        long long r = erase();
        if(r == -1){
            flag = false;
            break;
        }
        ans.push_back(r);
    }

    if(flag == false){
        printf("-1\n");
        return 0;
    }

    for(long long i = ans.size()-1; i >= 0; i--){
        printf("%lld\n", ans[i]);
    }

    return 0;


}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void rd(string &x){
  char *buf = (char *)wmem;
  rd(buf);
  x = buf;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
int isp(string s){
  string t = s;
  reverse(t.begin(), t.end());
  if(s==t){
    return 1;
  }
  return 0;
}
int main(){
  wmem = memarr;
  int N;
  string S;
  rd(S);
  N = S.size();
  if(isp(S) == 0){
    wt_L("No");
    wt_L('\n');
    return 0;
  }
  N /= 2;
  if(isp(S.substr(0,N)) == 0){
    wt_L("No");
    wt_L('\n');
    return 0;
  }
  if(isp(S.substr(N+1,N)) == 0){
    wt_L("No");
    wt_L('\n');
    return 0;
  }
  wt_L("Yes");
  wt_L('\n');
  return 0;
}
// cLay varsion 20200321-1

// --- original code ---
// int isp(string s){
//   string t = s;
//   reverse(t.begin(), t.end());
//   if(s==t) return 1;
//   return 0;
// }
// 
// {
//   int N;
//   string S;
//   rd(S);
//   N = S.size();
//   if(isp(S) == 0) wt("No"), return 0;
//   N /= 2;
//   if(isp(S.substr(0,N)) == 0) wt("No"), return 0;
//   if(isp(S.substr(N+1,N)) == 0) wt("No"), return 0;
//   wt("Yes");
// }


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
import java.math.BigDecimal;
      
public class Main{
  
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
  
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
int cnt=0;
while(true){
int n=ir.nextInt();
if(n==0) break;
cnt++;
Vector[] vs=new Vector[n];
for(int i=0;i<n;i++) vs[i]=new Vector(ir.nextInt(),ir.nextInt());
double ans=0;
for(int i=0;i<n;i++) ans+=vs[i].crossP(vs[(i+1)%n])/2;
out.println(cnt+" "+Math.abs(ans));
}
out.flush();
}

static class Vector{

double x;
double y;

public Vector(double x,double y){this.x=x; this.y=y;}

public double crossP(Vector v){return this.x*v.y-this.y*v.x;}

public double dotP(Vector v){return this.x*v.x+this.y*this.y;}

public double length(){return Math.hypot(x,y);}

public Vector add(Vector v){return new Vector(this.x+v.x,this.y+v.y);}

public Vector subtract(Vector v){return new Vector(this.x-v.x,this.y-v.y);}

public String toString(){return "("+this.x+","+this.y+")";}
}

static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
  
public InputReader(InputStream in) {this.in=in;}
    
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
  
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
  
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
  
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
   
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
  
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
  
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
}

Measured memory_bytes: 16924
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
 
#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c)
#define rsort(a,n) sort(a,a+n,greater<>())
 
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100;
 
int main(void){
    ll n;
    str s,t,u;

    in1(n);
    prl((n*(n+1))/2);

    return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}


int main() {
	int64_t a, b;
	std::cin >> a >> b;
	while (a && b) {
		if (a > b) a %= b;
		else b %= a;
	}
	int64_t gcd = a + b;
	int res = 0;
	for (int i = 2; (int64_t) i * i <= gcd; i++) {
		if (gcd % i == 0) {
			res++;
			while (gcd % i == 0) gcd /= i;
		}
	}
	if (gcd > 1) res++;
	printf("%d\n", res + 1);
	return 0;
}


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



int main(){
	string str;
	cin >> str;

	char last = str[str.size()-1];

	cout << str;
	if(last == 's') cout << "es" << endl;
	else cout << "s" << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};



int main() {
  //input
  ll x;
  cin >> x;
  //x /= 100;
  
  ll ans = 100;
  int i = 0;
  while(ans < x) {
    ans += ans / 100;
    i++;
  }
  cout << i << endl;
  
}

Measured memory_bytes: 3616