akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, cnt[2] = {};
	cin >> n;
	vector<ll> x(n), y(n);
	rep(i, n){
		cin >> x[i] >> y[i];
		cnt[((x[i] + y[i]) % 2 + 2) % 2]++;
	}
	if(cnt[0] && cnt[1]){
		cout << -1 << endl;
		return 0;
	}
	
	vector<ll> ms;
	rep(i, 35) ms.pb(1ll << i);
	if(cnt[0]){
		ms.pb(1);
		rep(i, n) x[i]++;
	}
	
	cout << ms.size() << endl;
	rep(i, ms.size()) cout << ms[i] << (i==ms.size()-1?"\n":" ");
	
	rep(i, n){
		ll u = x[i] + y[i];
		ll v = x[i] - y[i];
		
		auto solve = [](ll val){
			vi res(35);
			ll av = (abs(val) - 1) / 2;
			res[34] = 1;
			rep(i, 34) res[i] = av >> i & 1;
			if(val < 0) rep(i, 35) res[i] ^= 1;
			return res;
		};
		
		vi a = solve(u);
		vi b = solve(v);
		string ans;
		rep(i, 35){
			if(a[i] && b[i]) ans += 'R';
			if(a[i] && !b[i]) ans += 'U';
			if(!a[i] && b[i]) ans += 'D';
			if(!a[i] && !b[i]) ans += 'L';
		}
		if(cnt[0]) ans += 'L';
		cout << ans << endl;
	}
	
	
	return 0;
}

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

int n, x, sum;

inline int hantei(int p) {
	for (int i = 1; i * i <= p; i++) {
		int a = p - i;
		if (a % (2 * i + 1) == 0 && a >= 1) {
			return 0;
		}
	}
	return 1;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		sum += hantei(x);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1164
n=gets.to_i
a=gets.split.map(&:to_i)
m=a.delete(a.max)
l=0
lm=1/0.0
a.each do |aa|
  if (aa-m/2.0).abs<lm
    lm=(aa-m/2.0).abs
    l=aa
  end
end
puts [m,l].join(" ")


Measured memory_bytes: 9732
#include <iostream>
using namespace std;
int main(){
  int a[4];
  for(int i=0;i<5;i++){
    cin>>a[i];
  }
  if((a[0]>=(a[2]+a[4])&&a[1]>=(a[3]+a[4]))&&(a[2]>=a[4]&&a[3]>=a[4])){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3116
n=int(input())
a=[]
b=[]

for _ in range(n):
    a_ele, b_ele=map(int, input().split())
    a.append(a_ele)
    b.append(b_ele)
a_min=min(a)
a_max=max(a)

print((b[a.index(max(a))]-1)+(max(a)+1))

Measured memory_bytes: 11052
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;

LL b[51];
LL p[51];
LL dfs(int N,LL X){
	//cout<<N<<" "<<X<<endl;
	if(b[N]+p[N]<=X)return p[N];
	if(N==0)return 0;
	if(X<=0)return 0;
	if(X==b[N-1]+p[N-1]+2)return p[N-1]+1;
	if(X<=b[N-1]+p[N-1]+1)return dfs(N-1,X-1);
	return p[N-1]+1+dfs(N-1,X-(b[N-1]+p[N-1]+2));
}

int main(){
	int N;
	LL X;
	cin>>N>>X;
	b[0]=0;
	p[0]=1;
	REP(i,N+1){
		if(i==0)continue;
		b[i]=b[i-1]*2+2;
		p[i]=p[i-1]*2+1;
		//cout<<i<<" "<<b[i]<<" "<<p[i]<<endl;
	}
	
	LL ans=dfs(N,X);
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
	}
	int max = 0;
	int max_2 = 0;
	
	int flg=0;
	
	for(int i=0; i<n; i++){
		if(a[i]>max){
			max=a[i];
		}
	}
	
	for(int i=0; i<n; i++){
		if(a[i]>max_2&&a[i]<max){
			max_2=a[i];
		}else if(a[i]==max){
			flg++;
		}
	}
	
	for(int i=0; i<n; i++){
		if(a[i]==max&&flg==1){
			printf("%d\n",max_2);
		}else{
			printf("%d\n",max);
		}
	}
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int64_t GCD(int64_t a,int64_t b){
    return b == 0 ? a : GCD(b, a % b);
   
}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
  sort(a.begin(),a.end());
  int sum=0;
  rep(i,n-1){
    sum+=a[i];
  }
  if(sum>a[n-1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
S = input()

if 1 <= int(S[:2]) <= 12 and 1 <= int(S[2:]) <= 12:
    print('AMBIGUOUS')
elif 1 <= int(S[2:]) <= 12:
    print('YYMM')
elif 1 <= int(S[:2]) <= 12:
    print('MMYY')
else:
    print('NA')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

int main(){
	int n;
	int a[50];

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

	auto min_it = min_element(a, a+n);
	auto max_it = max_element(a, a+n);
	int min_pos = distance(a, min_it);
	int max_pos = distance(a, max_it);
	int min = *min_it;
	int max = *max_it;

	bool mmode = false;

	int pos;
	if(abs(min) > abs(max)){
		mmode = true;
		pos = min_pos;
	}else{
		pos = max_pos;
	}

	cout << 2*n-2 << endl;

	rep(i, n) {
		if(i==pos) continue;

		cout << pos+1 << " " << i+1 << endl;
	}

	if(mmode == false){
		rep(i, n-1) cout << i+1 << " " << i+2 << endl;
	}else{
		rrep(i, n-1, 1) cout << i+1 << " " << i << endl;
	}
	
	
}


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


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

    
    vector<int> x(m);
    rep(i,m) cin >> x[i];
    if(n>=m){
        cout<<0<<endl;
        return 0;
    }
    vector<int> d(m-1);
    ll sum =0;
    sort(x.begin(),x.end());
    rep(i,m-1){
        d[i]=x[i+1]-x[i];
        sum+=d[i];

    }
    //cout<< sum << endl;
    sort(d.begin(),d.end());
    int cnt = 0;
    for(int i=d.size()-1;cnt<n-1;i--){
        sum -= d[i];
        cnt++;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
int sum[300005];
char s[300005];

int main(){
    int n;
    scanf("%d%s",&n,s+1);
    sum[0] = 0;
    for(int i = 1; i <= n; i++) sum[i] = sum[i-1]+(s[i]=='E');
    int ans = n;
    for(int i = 1; i <= n; i++){
        int left = (i-1)-sum[i-1];
        int right = sum[n]-sum[i];
        int cur = left+right;
        ans = cur<ans?cur:ans;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3128
using System;

namespace abc124_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int num1 = int.Parse(input[0]);
            int num2 = int.Parse(input[1]);
            int sum = 0;
            for(int i = 0; i<2; ++i)
            {
                if (num1 > num2)
                {
                    sum += num1;
                    num1 -= 1;
                }
                else
                {
                    sum += num2;
                    num2 -= 1;
                }
            }
            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 13140
def Euclid(a,b):
  r = a % b
  if r == 0:
    return b
  return Euclid(b,r)
import fractions

a,b = map(int,input().split())
#c = Euclid(a,b) if a > b else Euclid(b,a)
c = fractions.gcd(a,b)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
if c == 1:
  print(1)
else:
  print(len(factorization(c))+1)



Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
   
int main() 
{
  ll n,m;
  cin>>n>>m;
  if(n==m)
  	cout<<"Yes";
  else
    	cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 6
#define MAX 102
 
int main(void){
 
    int i, face[N], temp;
    char str[MAX];
     
    for(i = 0; i < N; i++){
        scanf("%d", &face[i]);
    }
    while(fgets(str, MAX, stdin) != NULL){
        for(i = 0; str[i] != '\n'; i++){
            if(str[i] == 'E'){
                temp = face[3];
                face[3] = face[5];
                face[5] = face[2];
                face[2] = face[0];
                face[0] = temp;
            }
            else if(str[i] == 'W'){
                temp = face[3];
                face[3] = face[0];
                face[0] = face[2];
                face[2] = face[5];
                face[5] = temp;
            }
            else if(str[i] == 'S'){
                temp = face[4];
                face[4] = face[5];
                face[5] = face[1];
                face[1] = face[0];
                face[0] = temp;
            }
            else if(str[i] == 'N'){
                temp = face[4];
                face[4] = face[0];
                face[0] = face[1];
                face[1] = face[5];
                face[5] = temp;
            }
        }
    }
    printf("%d\n", face[0]);    
    return 0;
}


Measured memory_bytes: 2112
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

pub fn uppper_bound<T: Ord>(a: &Vec<T>, x: &T) -> usize {
    use std::cmp::Ordering;
    let mut l = 0;
    let mut r = a.len();
    while l != r {
        let m = l + (r - l) / 2;
        match a[m].cmp(x) {
            Ordering::Less | Ordering::Equal => l = m + 1,
            Ordering::Greater => r = m,
        }
    }
    l
}

pub fn lower_bound<T: Ord>(a: &Vec<T>, x: &T) -> usize {
    use std::cmp::Ordering;
    let mut l = 0;
    let mut r = a.len();
    while l != r {
        let m = l + (r - l) / 2;
        match a[m].cmp(x) {
            Ordering::Less => l = m + 1,
            Ordering::Equal | Ordering::Greater => r = m,
        }
    }
    l
}

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      mut ls: [usize; n],
    }
    ls.sort();

    let mut ans = 0;
    for i in 0..n {
        let a = ls[i];
        for j in i+1..n {
            let b = ls[j];

            // これ以上は作れない
            let idx = lower_bound(&ls, &(a + b));
            ans += (idx - j - 1);
        }
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int count = 0;
    int i;
    for(i=1; i<n; i++){
        count += (n-1)/i;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, d;
int m[110];
int missile[110][10010];
int power[110];

int main() {
  while (scanf("%d %d", &n, &d), n|d) {
    multiset<int> powers;
    int all = 0;
    REP(i, n) {
      scanf("%d", &m[i]);
      all += m[i];
      power[i] = 0;
      REP(j, m[i]) {
        scanf("%d", &missile[i][j]);
        power[i] += missile[i][j];
      }
      powers.insert(power[i]);
    }
    if (*powers.rbegin() - *powers.begin() > d) { goto NO; }
    assert(all <= 10000);
    REP(i, all) {
      REP(j, n) {
        if (m[j] == 0) { continue; }
        int npower = power[j] - missile[j][m[j] - 1];
        if (*powers.rbegin() != power[j]) {
          if (*powers.rbegin() - npower > d) { continue; }
        } else {
          if (*(++powers.rbegin()) - npower > d) { continue; }
        }
        //cout << missile[j][m[j] - 1] << endl;
        powers.erase(powers.find(power[j]));
        powers.insert(npower);
        power[j] = npower;
        m[j]--;
        goto next;
      }
      goto NO;
next:;
    }
   puts("Yes");
   continue;
NO:
   puts("No");
   continue;
  }
}

Measured memory_bytes: 1376
# Function for calc
def match(n, a, b):
    if (b - a)% 2 == 0:
        print((b-a)/2)
    else:
        if (n - b) >= a:
            print((a)+((b-(a+1))/2))
        else:
            x=(n-b+1)
            print(x+((n-(a+x))/2))
# Run match
in_string = raw_input()
[N, A, B] = [int(v) for v in in_string.split()]
match(N, A, B)


Measured memory_bytes: 2568
#include <iostream>
#include<math.h>
#include <stdio.h>
using namespace std;
 
#include <stdio.h>
#include <string>
#include <iostream>
 
int main(void) {
    string word;
    string wordnew;
    cin >> word ;
    char c=word[word.size()-1];
    if(c=='s'){
        wordnew=word+"es";
        cout<<wordnew;
        
    }
    else{
        wordnew=word+"s";
        cout<<wordnew;
    }
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	if(c >= a){
		cout<<"0 ";
		c-=a;
		if(c >= b){
			cout<<0;
		}
		else{
			cout<<b-c;
		}
	}
	else{
		cout<<a-c<<" "<<b;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(lli i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
#define deb(x) cout << #x": " << (x) << endl;


int main(){ _
    string a,b;
    cin >> a >> b;
    vector<lli> l(0);
    fore(i,0,sz(a)-sz(b)+1)
    {
      lli dif=0;
      fore(n,0,sz(b))
      {
        if(b[n]!=a[i+n])dif++;
      }
      l.pb(dif);
    }
    lli mi=1e18;
    fore(i,0,sz(l))
    {
      mi=min(mi,l[i]);
    }
    cout << mi <<ENDL;
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


#define mod 1000000007
#define ll long long int
#define mk make_pair
#define pb push_back
#define xx first
#define yy second


double pi=3.141592653589793238;
const int M = 1e9+7;
const int Nmax=5005;
const int MM = 1e7+1;
const int N=200010;

int main(){
//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int T=1;
//cin>>T;
while(T--){
string a,b;
cin>>a>>b;
int aa=a.size();
int bb=b.size();
vector<vector<int> > dp(aa+1,vector<int> (bb+1,0));
for(int i=1;i<=aa;i++){
        //cout<<";;;;;\n";
    for(int j=1;j<=bb;j++){
        if(a[i-1]==b[j-1])dp[i][j]=dp[i-1][j-1]+1;
        else{
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
}
string ans="";
int i=aa,j=bb;
while(i>0 && j>0){
    if(a[i-1]==b[j-1]){
        ans+=a[i-1];
        i--;
        j--;
    }
    else{
        if(dp[i][j]==dp[i-1][j]){
            i--;
        }
        else j--;
    }
}
reverse(ans.begin(),ans.end());
cout<<ans<<"\n";
}
return 0;
}


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

int main(){
    cout.sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    bool reverse = false;
    int q,aux; cin >> q;
    char auxi;
    deque<char> dq;
    for(int i = 0; i < s.size(); i++){
        dq.push_back(s[i]);
    }
    while(q--){
        cin >> aux;
        if(aux == 1){
            if(!reverse){
                reverse = true;
            }
            else{
                reverse = false;
            }
        }
        else{
            cin >> aux;
            cin >> auxi;
            if(aux==1){
                if(reverse){
                    dq.push_back(auxi);
                }
                else{
                    dq.push_front(auxi);  
                }
            }
            else{
                if(reverse){
                    dq.push_front(auxi);
                }
                else{
                    dq.push_back(auxi);  
                }
            }
        }
    }
    if(reverse){
        for(int i = dq.size()-1; i >= 0; i--){
            cout << dq[i];
        }
    }
    else{
        for(int i = 0; i < dq.size(); i++){
            cout << dq[i];
        }
    }
    return 0;
}

Measured memory_bytes: 976
import sys
import math
import itertools
import random
n=int(input())
lis=[0]*(10**8)
for a in range(1,int((math.sqrt(n)/2)+100)):
    for b in range(1,int((math.sqrt(n)/2)+100)):
        for c in range(1,int((math.sqrt(n)/2)+100)):
            lis[int(a**2+b**2+c**2+a*b+b*c+c*a)]+=1
for i in range(1,n+1):
    print(lis[i])

Measured memory_bytes: 859292
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        //???
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


vector<ll> prime_fact(ll n){
    vector<ll> ret;ll k=n;bool flag;
    while(k>1)
    {
        ll s=sqrt(k)+1;flag=false;ll i=2;
        while(k%i!=0){
            if(i>=s){
                flag=1;break;
            }
            i++;
        }
        if(flag){
            ret.push_back(k);  k=1;
        }
        else{
            k/=i;  ret.push_back(i);
        }
    }
    return ret;
}
//問題やばいのは素数きても{1,1,1,1,p}{1,1,1,p,1}みたいな場合があり得る
//だから足りない分は1で埋めるし、
//普通に{2,3,4}の順列数えた後に{24,1,1}とかも数えに行かなきゃいけない
int main(){
    COMinit();
    ll n,m;
    cin>>n>>m;
    vector<ll> p=prime_fact(m);//O(log(m))
    ll el=p.size();//要素数
    map<ll,ll> ma;
    for(ll x:p){
        ma[x]++;
    }
    //これでダブリカウントできるなぁ
    //重複組み合わせ蟻本P67
    ll ans=1;
    for(auto x:ma){
        ll num=x.second;
        ll tmp=COM(num+n-1,n-1);
        ans=(ans*tmp)%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12288
# +, -, *, /, =
m = int(input())
while True:
	s = input()
	if s == '+':
		m = m + int(input())
	elif s == '-':
		m = m - int(input())
	elif s == '*':
		m = m * int(input())
	elif s == '/':
		m = m // int(input())
	elif s == '=':
		print(m)
		exit(0)



Measured memory_bytes: 5588
from bisect import bisect
def main():
    maxa2 = 200000
    maxa2 = max(6, maxa2)  # maxa2が6未満だとエラーになる
    p = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(maxa2)]
    p[0] = p[1] = False
    p[2] = p[3] = p[5] = True
    for is1 in range(3, maxa2, 2):
        for is2 in range(is1 ** 2, maxa2, is1):
            p[is2] = False
    prime_list = [i for i, b in enumerate(p) if b]

    x = int(input())
    if x in prime_list:
        print(x)
    else:
        xp = bisect(prime_list, x)
        r = prime_list[xp]
        print(r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 86600
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


class Solver(object):
    def __init__(self):
        pass

    def solve(self, N, S):
        ans = ""
        for s in S:
            ans += chr(((ord(s)-65)+N) % 26+65)
        return ans


def main():
    N = int(input())
    S = input().rstrip()

    solver = Solver()
    print(solver.solve(N, S))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0; i < N; ++i){
        int P;
        cin >> P;
        --P;
        vec[P] = i;
    }
    int now = vec[0];
    int cnt = 1;
    int ans = 0;
    for(int i = 1; i < N; ++i){
        if(now < vec[i]){
            ++cnt;
        } else {
            ans = max(ans, cnt);
            cnt = 1;
        }
        now = vec[i];
    }
    ans = max(ans, cnt);
    cout << N - ans << endl;
}

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

vint dx = {1,0};
vint dy = {0,1};

int n;

int dfs(int y, int x, int sum, const vvint &field) {
    if (y == 1 && x == n-1) return sum;
    int res = 0;
    rep(i,2) {
        int n_x = x + dx[i];
        int n_y = y + dy[i];
        if (n_x >= n || n_y >= 2) continue;
        int n_sum = sum + field[n_y][n_x];
        res = max(dfs(n_y,n_x,n_sum,field),res);
    }
    return res;
}

int main() {
    cin >> n;
    vvint field(2,vint(n));
    rep(i,2)rep(j,n) cin >> field[i][j];
    cout << dfs(0,0,field[0][0],field) << endl;
}

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

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));
#ifdef LOCAL
#define debug(x) std::cerr << #x << ": " << x << endl
#else
#define debug(x) 860111
#endif
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

//mt19937 mrand(random_device{}());
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;
ll a, b, c;
//ll a[maxn];

//check T
void solve()
{
	cin >> a >> b >> c;
	bool flag = (c-a-b)*(c-a-b) > 4*a*b;
	flag &= (c-a-b > 0ll);
	cout << (flag? "Yes" : "No") <<endl;
  return;
}


signed main()
{
  fastIO();
  T = 1;
  //cin >> T; //this
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,t,s,u,max;
    cin>>a>>b;
    t=a+b;
    s=a-b;
    u=a*b;
    max=t;
    if(max<s){
        max=s;
    }
    if(max<u){
        max=u;
    }
    
    cout<<max<<endl;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  string s;
  int w;
  cin >> s >> w;
  string ans="";
  for(int i=0;i<s.length();i+=w){
    ans+=s[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

static const int MAX_NUM = 100;

int main(int argc, char const *argv[])
{
    int R[MAX_NUM],n;

    std::cin >> n;

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

    for(int i = 0;i < n;i++){
        if(i != n - 1) std::cout << R[i] << " ";
        else std::cout << R[i] << std::endl;
    }

    for(int i = 1;i < n;i++){
        int v = R[i];
        int j = i - 1;

        while((j >= 0) && (R[j] > v)){
            R[j + 1] = R[j];
            j--;
        }
        R[j + 1] = v;

        for(int i = 0;i < n;i++){
            if(i != n - 1) std::cout << R[i] << " ";
            else std::cout << R[i] << std::endl;
        }
    }

    return 0;
}



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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

int main() {
    int a, b;
    cin >> a >> b;
/*
    ll aa, bb;
    aa = a/0.08;
    bb = b/0.1;
    ll a1 = max(aa, bb)*0.08;
    ll b1 = max(aa, bb)*0.1;
    // cout << "aa = " << aa << " bb = " << bb << endl;
    // cout << "a1 = " << a1 << " b1 = " << b1 << endl;
    if ( a1 == a && b1 == b ) {
        cout << max(aa, bb) << endl;
    } else {
        cout << -1 << endl;
    }*/
    rep2(i, (int)100/0.08) {
        if ( (int)(i*0.08) == a && (int)(i*0.1) == b ) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main() {
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            cout << i <<"x"<<j << "="<<i*j<< endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include<string>
#include<set>

using namespace std;
int main(void){
    int W,H,N;
    cin>>W>>H>>N;
    
    int d[4];
    d[0]=0;
    d[1]=W;
    d[2]=0;
    d[3]=H;
    int x,y,a;
    for(int i=0;i<N;i++){
        
        cin>>x>>y>>a;
        if(a==1){
            d[0]=max(d[0],x);
        }else if(a==2){
            d[1]=min(d[1],x);
        }else if(a==3){
            d[2]=max(d[2],y);
        }else if(a==4){
            d[3]=min(d[3],y);
        }
    
    }
    int ans;
    if((d[1]-d[0])>0 && (d[3]-d[2])>0){
        ans=(d[0]-d[1])* (d[2]-d[3]);
        cout<<ans<<endl;
   }else{
       cout<<0<<endl;
   }
   
    
     
    
    
    return 0;
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CARD_MAX 36

typedef struct{
	char suit,value;
} card;

void print_cards(card[],int);
void bubble_sort(card[],int);
void selection_sort(card[],int);
void swap(card[],int,int);
void cards_copy(card[],card[],int);
int cards_compare(card[],card[],int);

int main(void){
	int i,card_count;
	char buf[128],*ch;
	fgets(buf, sizeof(buf), stdin);
  card_count = atoi(buf);

	card cards1[CARD_MAX];
	card cards2[CARD_MAX];

	fgets(buf,sizeof(buf),stdin);
	ch = strtok(buf," ");
	for (i = 0;i < CARD_MAX;i++) {
		if (ch == NULL) {
			break;
		} else {
			cards1[i].suit = ch[0];
			cards1[i].value = ch[1];
		}
		ch = strtok(NULL," ");
	}

	cards_copy(cards1, cards2, CARD_MAX);

	bubble_sort(cards1, card_count);
	selection_sort(cards2,card_count);
	print_cards(cards1, card_count);
	printf("Stable\n");
	print_cards(cards2, card_count);
	printf(cards_compare(cards1,cards2,card_count) == 1 ? "Stable\n" : "Not stable\n");
}

void print_cards(card array[], int array_length){
	for (int i = 0; i < array_length;i++){
		printf("%c%c",array[i].suit,array[i].value);
		if (i < array_length - 1){
			printf(" ");
		} else{
			printf("\n");
		}
	}
}

void bubble_sort(card array[], int array_length){
	for (int i = 0; i < array_length; i++){
		for(int j = array_length - 1; j >= i+1; j--){
			if(array[j].value < array[j-1].value){
				swap(array, j, j-1);
			}
		}
	}
}

void selection_sort(card array[], int array_length){
	for (int i = 0; i < array_length; i++) {
		int mini = i;
		for (int j = i; j < array_length; j++){
			if (array[j].value < array[mini].value){
				mini = j;
			}
		}
		swap(array, i,mini);
	}
}

void swap(card array[], int a, int b){
	card tmp = array[a];
	array[a] = array[b];
	array[b] = tmp;
}

void cards_copy(card original[], card destination[], int original_length){
	for(int i = 0; i < original_length; i++){
		destination[i] = original[i];
	}
}

int cards_compare(card a[], card b[], int length){
	for(int i = 0; i < length; i++){
		if(a[i].suit != b[i].suit || a[i].value != b[i].value) return 0;
	}
	return 1;
}



Measured memory_bytes: 2048
# AOJ 0110 Alphametic

while line = gets
  m = /([0-9X]+)\+([0-9X]+)=([0-9X]+)/.match(line)
  next unless m

  x_s, y_s, z_s = m[1], m[2], m[3]
  numbers = (0..9).to_a
  [x_s, y_s, z_s].each do |s|
    if s.length > 1 && s[0] == "X"
      numbers -= [0]
      break
    end
  end

  found = false
  numbers.each do |n|
    x, y, z = [x_s, y_s, z_s].map {|s| s.gsub("X", n.to_s).to_i}
    if x + y == z
      found = true
      puts n
      break
    end
  end

  puts "NA" unless found
end

Measured memory_bytes: 6184
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
const int N = 1e6 + 10, Mod = 1e9 + 7;
int n, q, A[N];
long long P[N], PA[N];
inline int Get(int l, int r)
{
    return (int)(upper_bound(A, A + n, r) - lower_bound(A, A + n, l));
}
int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);
    for (int i = 0; i < n; i++)
    {
        P[i] = A[i];
        PA[i] = A[i];
        if (i >= 1)
            P[i] += P[i -1];
        if (i >= 2)
            PA[i] += PA[i - 2];
    }
    for (; q; q --)
    {
        int k;
        scanf("%d", &k);
        int id = lower_bound(A, A + n, k) - A;
        if (id >= n - 1)
        {
            printf("%lld\n", PA[n - 1]);
            continue;
        }
        int le = id - 1, ri = n, md;
        while (ri - le > 1)
        {
            md = (le + ri) >> 1;
            int dif = abs(A[md] - k);
            if (Get(k - dif, dif + k) <= n - 1 - md)
                le = md;
            else
                ri = md;
        }
        int lb;
        long long sum = P[n - 1] - P[le];
        lb = le - (n - 1 - le);
        if (lb < 0)
        {
            printf("%lld\n", sum);
            continue;
        }
        if (n - 1 - le == le - lb)
            sum += A[lb], lb --;
        if (lb < 0)
        {
            printf("%lld\n", sum);
            continue;
        }
        if (lb > 0)
            sum += PA[lb - 1];
        printf("%lld\n", sum);
    }
    return (0);
}

Measured memory_bytes: 8704
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt(); 
		List<Integer> list = new ArrayList<>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		
		int count = 0;
		for(int k = 1; k < n; k++) {
			if(list.get(k)-list.get(k-1) == 0){
				count ++;
				k++;
			}
		}
		
		System.out.println(count);
		
	}
	
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define VS vector<string>
#define ll long long int
int main(void) {
    string a, b;
    cin >> a >> b;
        if(a.size()<b.size()) {
            cout << "LESS" << endl;
        } else if(b.size() < a.size()) {
            cout << "GREATER" << endl;
        } else {
            REP(i,100) {
                if(a[i] < b[i]) {
                    cout << "LESS" << endl;
                    break;
                } else if(b[i] < a[i]) {
                    cout << "GREATER" << endl;
                    break;
                } else if(i == a.size() - 1) {
                    cout << "EQUAL" << endl;
                    break;                                                                                                    
                }
            }
        }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[10],i,l;
  scanf("%s",s);
  for(l=0;s[l];l++);
  for(i=0;i*2<=l;i++){
    if(s[i]-s[l-i-1])break;
  }
  printf("%s\n",i*2>l?"Yes":"No");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]
typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define mp make_pair
#define ld long double
#define ull unsigned long long int
#define mod 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n,m;
	cin>>n>>m;
	ll ans=0;
	if(n>=2)
	{
		ans=(n*(n-1))/2;
	}
	if(m>=2)
	{
		ans+=(m*(m-1))/2;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	int N;
	int count = 0;
	int countif = 0;
	int a[100];

	cin >> N;

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

	int rate[9] = { 0,0,0,0,0,0,0,0,0 };

	for (int i = 0; i < N; i++) {
		if (1 <= a[i] && a[i] <= 399) {
			rate[0]++;
		}
		else if (400 <= a[i] && a[i] <= 799){
			rate[1]++;
		}
		else if (800 <= a[i] && a[i] <= 1199) {
			rate[2]++;
		}
		else if (1200 <= a[i] && a[i] <= 1599) {
			rate[3]++;
		}
		else if (1600 <= a[i] && a[i] <= 1999) {
			rate[4]++;
		}
		else if (2000 <= a[i] && a[i] <= 2399) {
			rate[5]++;
		}
		else if (2400 <= a[i] && a[i] <= 2799) {
			rate[6]++;
		}
		else if (2800 <= a[i] && a[i] <= 3199) {
			rate[7]++;
		}
		else if(3200<=a[i]&&a[i]<=4800){
			rate[8]++;
		}
	}

	for (int i = 0; i < 8; i++) {
		if (rate[i] != 0) {
			count++;
		}
	}

	countif = count;

	if (rate[8] != 0) {
		countif += rate[8];
	}

	if (count == 0) {
		count = 1;
	}
	
	cout << count <<" "<<countif<< endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

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

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;cin>>n>>m;
    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

//#define int long long
//#define endl "\n"
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int d;
vector<vector<int>>vec(12, vector<int>(12));
double dis(int xx, int yy) {
	int tt=0;
	rep(i, d) {
		tt += (vec[xx][i] - vec[yy][i]) * (vec[xx][i] - vec[yy][i]);
	}
	return sqrt(tt);
}


int main() {
	int n, c = 0;
	cin >> n >> d;
	rep(i, n) {
		rep(j, d) {
			cin >> vec[i][j];
		}
	}
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (dis(i, j) == (int)dis(i, j)) {
				c++;
			}
		}
	}
	cout << c << endl;
}



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

int main() {
	int A, B; cin >> A >> B;

	if (A == 1) {
		A = 14;
	}
	if (B == 1) {
		B = 14;
	}

	if (A == B) {
		cout << "Draw";
	}
	else if (A > B) {
		cout << "Alice";
	}
	else if (A < B) {
		cout << "Bob";
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  double d;
  while(cin >>d){
    if(d<=48) cout <<"light fly"<<endl;
    else if(d<=51) cout <<"fly"<<endl;
    else if(d<=54) cout <<"bantam"<<endl;
    else if(d<=57) cout <<"feather"<<endl;
    else if(d<=60) cout <<"light"<<endl;
    else if(d<=64) cout <<"light welter"<<endl;
    else if(d<=69) cout <<"welter"<<endl;
    else if(d<=75) cout <<"light middle"<<endl;
    else if(d<=81) cout <<"middle"<<endl;
    else if(d<=91) cout <<"light heavy"<<endl;
    else cout <<"heavy"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1224
#include<stdio.h>

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;

    if (V-W < 0) {
        no;
        return 0;
    }

    int a = abs(A-B);
    int b = (V-W) * T;
    if (a <= b) yes;
    else no;

    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/tokiomarine2020/tokiomarine2020_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/tokiomarine2020/tokiomarine2020_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/tokiomarine2020/tokiomarine2020_b && sh shellscripts/submit_cpp.sh
*/


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int res = 0;
    rep(i, 4)
    {
        char n;
        cin >> n;
        if (n == '2')
            res++;
    }
    cout << res << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) begin(x)+(a), begin(x)+(n)
#define ADD(a, b) ((((a)%MOD+MOD)%MOD+((b)%MOD+MOD)%MOD)%MOD)
#define SUB(a, b) ((((a)%MOD+MOD)%MOD-((b)%MOD+MOD)%MOD+MOD)%MOD)
#define MUL(a, b) (((((a)%MOD+MOD)%MOD)*(((b)%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }


int N, M;
int b[100010];


signed main(){
    cin >> N >> M;
    rep(i, 0, N) cin >> b[i], b[i]/=2;

    int p2 = 1;
    for(int x = b[0];x%2 == 0;x/=2) p2*=2;

    if(all_of(RNG(b, 1, N), [p2](int x){ return !(x%p2) and x%(2*p2); })){
        int sm = 1;
        rep(i, 0, N) sm = lcm(sm, b[i]);
        cout << CEIL((M/sm)/2.0) << endl;
    }
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 1024
// AtCoder Regular Contest 077 C - pushpush
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] values = new int[n];
        for(int i = 0; i < n; i++){
            values[i] = scan.nextInt();
        }

        int nHalf = n / 2;
        int odd = n % 2;

        if(n != 1){
            for(int i = 0; i < nHalf + odd; i++){
                System.out.print(values[n - 1 - i*2] + " ");
            }

            for(int i = 0; i < nHalf - 1; i++){
                System.out.print(values[odd + i*2] + " ");
            }

            System.out.println(values[n - 2]);
        }else{
            System.out.println(values[0]);
        }
    }
}


Measured memory_bytes: 93208