akhauriyash/Code-Regression huggingface dataset:
//Compiler optimization
#pragma GCC optimize("Ofast")

//include
#include <bits/stdc++.h>
using namespace std;

//typedef
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;

//macro
#define reverse(a) reverse(a.begin(),a.end())
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define each(x, v) for (auto &x : v)

//abbreviation
#define pb push_back
#define elif else if
#define mp make_pair
#define endl '\n'

//debug
#define debug(x) cerr << #x << ": " << x << endl
#define v_debug(v) cerr << #v << endl;fr(i,v.size()) cerr << i << ": " << v[i] << endl

//const
const  ll INF = 1e18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(20);
    int x,y;
    cin  >> x >> y;
    if(y-2*x>= 0 && (y-2*x)%2 == 0 && 4*x-y>=0){
        cout << "Yes" << endl;
    }else cout << "No" << endl;

}

Measured memory_bytes: 3648
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

n = onem()
nn = prime_decomposition(n)
l = cl.Counter(nn)

kkk = 1
for i,j in l.items():
	kkk *= (i-1) * (i ** (j-1))

print(kkk)


Measured memory_bytes: 6032
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,dp[100009],dp2[100009];
pair <long long, long long> p[100009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=1; c<=a; c++){
		cin>>p[c].first>>p[c].second;
	}
	for(c=0; c<=100002; c++){
		dp[c]=999999999999999999LL;
    dp2[c]=dp[c];
	}
  dp[0]=0;
	dp[p[1].second]=p[1].first;
  dp2[0]=0;
	for(c=2; c<=a; c++){
    if(c==2){
    }
		for(d=0; d<=100002; d++){
			if(dp[d]==999999999999999999LL) continue;
			if(dp2[d]>dp[d]) dp2[d]=dp[d];
			if(dp[d]+p[c].first>b) continue;
			if(dp2[d+p[c].second]>dp[d]+p[c].first) dp2[d+p[c].second]=dp[d]+p[c].first;
		}
		for(d=0; d<=100002; d++){
			dp[d]=dp2[d];
			dp2[d]=999999999999999999LL;
		}
    dp2[0]=0;
	}
	for(c=0; c<=100002; c++){
		if(dp[c]<=b) e=c;
	}
	cout<<e;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        int k = scanner.nextInt();
        int heights[] = new int[i];
        for (int j = 0; j < heights.length; j++) {
            heights[j] = scanner.nextInt();
        }
        long numOfWays = getNumOfWays(heights, k);
        System.out.println(numOfWays);
    }

    private static long getNumOfWays(int hei[], int k) {

        long dp[] = new long[hei.length];
        for (int i = dp.length - 2; i >= 0; i--) {
            long cost = Integer.MAX_VALUE;
            int end = Math.min(dp.length - 1, i + k);
            for (int j = i + 1; j <= end; j++) {
                cost = Math.min(Math.abs(hei[i] - hei[j]) + dp[j], cost);
            }
            dp[i] = cost;
        }
        return dp[0];
    }


}

Measured memory_bytes: 59144
#include <iostream>
//#include <algorithm>
#include <vector>
#include <cstdlib>
using namespace std;

int main(){
	int N,K;
	vector<int>Distances;
	vector<int>Heights;
	cin>>N>>K;
	Distances.reserve(N);
	Heights.reserve(N);
	int i,j;
	int min=2147483647;
	int dist;
	for(i=0;i<N;i++){
		cin>>Heights[i];
		if(i==0){
			Distances[i]=0;
		}
		else if(i<K){
			for(j=0;j<i;j++){
				dist=Distances[j]+abs(Heights[i]-Heights[j]);
				if(dist<min){
					min=dist;
				}
			}
			Distances[i]=min;
			min=2147483647;
		}
		else{
			for(j=i-K;j<i;j++){
				dist=Distances[j]+abs(Heights[i]-Heights[j]);
				if(dist<min){
					min=dist;
				}
			}
			Distances[i]=min;
			min=2147483647;
		}
	}
	cout<<Distances[N-1];
	//for(i=0;i<N;i++)
	return 0;
}


Measured memory_bytes: 1024
using System;
class P{
  static void Main(){
    int d = int.Parse(Console.ReadLine());
    if (d == 25)
      Console.WriteLine("Christmas");
    if (d == 24)
      Console.WriteLine("Christmas Eve");
    if (d == 23)
      Console.WriteLine("Christmas Eve Eve");
    if  (d == 22)
      Console.WriteLine("Christmas Eve Eve Eve");
  }
}

Measured memory_bytes: 11092
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> l;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }
    sort(l.rbegin(), l.rend());
    int ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += l[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import queue

n,u,v = map(int, input().split())
u -= 1
v -= 1

path = [[] for i in range(n)]

for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    path[a].append(b)
    path[b].append(a)

t = [10**9]*n
t[u]=0
q = queue.Queue()

q.put(u)

while not q.empty():
    p = q.get()
    for x in path[p]:
        if t[x]>t[p]+1:
            q.put(x)
            t[x]=t[p]+1

a = [10**9]*n
a[v]=0
q = queue.Queue()

q.put(v)

while not q.empty():
    p = q.get()
    for x in path[p]:
        if a[x]>a[p]+1:
            q.put(x)
            a[x]=a[p]+1

c = [a[i] for i in range(n) if a[i]>t[i]]
print(max(c)-1)


Measured memory_bytes: 84252
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        p: [usize; n]
    }
    let mut min_item = n + 1;
    let mut ans = 0;
    for pi in p.iter() {
        if pi < &min_item {
            ans += 1;
            min_item = *pi;
        }
    }
    println!("{}", ans)
}


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


int main() {
	int a, b;
	int y;

	cin >> a >> b;

	if (a <= 5) y = 0;
	else if (a <= 12) y = b / 2;
	else y = b;

	cout << y << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll x; cin>>x;
	REP(i,200){
		REP(j,200){
			if(pow(i,5)-pow(j,5)==x){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
			if(pow(i,5)+pow(j,5)==x){
				cout<<i<<" "<<-j<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<endl;
	return 0;
}


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {
	

	int a, b;

	cin >> a >> b;

	int cnt = 1;
	int ans = 0;
	while (true) {

		if (cnt >= b) {
			cout << ans << endl;
			return 0;

		}
		cnt += a - 1;
		ans++;
	}

}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[0 for i in range(n+1)]
l[0]=1
l[1]=1
for i in range(m):
    a=int(input())
    l[a]=-1
#print(l)
mod=10**9+7
for i in range(2,n+1):
    if l[i]==-1:
        continue
    elif l[i-1]==-1 and l[i-2]==-1:
        l[i]=0
    elif l[i-1]==-1:
        l[i]=l[i-2]
    elif l[i-2]==-1:
        l[i]=l[i-1]
    else:
        l[i]=l[i-1]+l[i-2]
    l[i]%=mod
print(l[-1]%mod)

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

#define ll long long
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)

//library----------------------------------------------


int main(){
  int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k;
  if(e-a<=k) {printf("Yay!");}
  else {printf(":(");}
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>

using namespace std;


//默认的优先队列是一个最大堆，当然这个最大的基准可以自己设置
int main() {
    char com[20];

    priority_queue<int> pq;

    while (true) {
        int key;
        cin >> com;
        if (com[0] == 'i') {
            cin >> key;
            pq.push(key);
        } else if (com[1] == 'x') {
            cout << pq.top()<<endl;
            pq.pop();
        } else if (com[0] == 'e') {
            break;
        }
    }
    return 0;

}


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<int> A,B,C;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    A = fetch_vec<int>(N);
    B = fetch_vec<int>(N);
    C = fetch_vec<int>(N-1);
}

void solve(){
    input();
    int ans=0;
    int prev=-1;
    REP(i,N){
        ans+=B[A[i]-1];
        if(A[i]-prev==1) ans+= C[prev-1];
        prev = A[i];
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
void YesNo(bool flag){ cout<<(flag? "Yes":"No");}
void YESNO(bool flag){ cout<<(flag? "YES":"NO");}

ll a,b,c,d,n;
vector<ll>v[3];
map<ll,ll>m;
string s[3],s2;
void input(){
    cin>>a>>b>>c;
}
void src(){
    YESNO((a*100+b*10+c)%4==0);
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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

int main() {
	// your code goes here
	int n;cin>>n;
	unordered_map<long long int,long long int>um;
	long long int sum=0;
	for(int i=0;i<n;i++){
		long long int x;cin>>x;
		um[x]++;
		sum+=x;
	}
	int q;cin>>q;
	for(int i=0;i<q;i++){
		long long int x;
		long long int b,c;cin>>b>>c;
		x=um[b];
		um[b]=0;
		um[c]+=x;
		x*=b;
		sum-=x;
		x/=b;
		x*=c;
		sum+=x;
		cout<<sum<<endl;
	}
	
	
	return 0;
}

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

using namespace std;

int main(){
    int a, b;
    cin>>a>>b;
    string astr;
    string bStr;
    for(int i =0;i< a;i++){
        astr += b+'0';
    }
    for(int i = 0;i< b;i++){
        bStr += a+'0';
    }
    if( astr > bStr)cout<<bStr;
    else cout<<astr;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i,n){
    int a;
    cin >> a;
    ans += a-1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//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 PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#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)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n, k; cin >> n >> k;

	vector<LL> a(n);

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

	vector<LL> sm(n + 1),po(n + 1);

	//幅Kの部分は全部シロかクロにしないといけない。
	//他は自由に選べるので
	//幅Kとそれを除いた部分を別に下処理しておいて、それを使って全探索する。

	//幅Kの分は何も考えずに足す。
	for (int i = 0; i < n; i++)sm[i + 1] = sm[i] + a[i];

	//K以外はプラスは選び、マイナスは無視
	for (int i = 0; i < n; i++)po[i + 1] = po[i] + max(a[i], 0LL);

	LL ans = 0;

	for (int i = 0; i < n - k + 1; i++) {
		int l = i;
		int r = i + k;

		LL other = po[l] + (po[n] - po[r]);
		LL cur = sm[r] - sm[l];

		//幅Kがマイナスになるなら、全部シロを選び0にする。
		ans = max(ans, other + max(cur, 0LL));

	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2560
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	x := getString()

	ans := ""
	for i := -1; i < 2; i += 2 {
		for j := -1; j < 2; j += 2 {
			for k := -1; k < 2; k += 2 {
				tmp := btoi(x[0])
				tmp += i * btoi(x[1])
				tmp += j * btoi(x[2])
				tmp += k * btoi(x[3])

				if tmp == 7 {
					ans = solve(i, j, k, x)
				}
			}
		}
	}
	fmt.Println(ans)
}

func solve(i, j, k int, x string) string {
	ans := string(x[0])

	ans += string('+'+1-i) + string(x[1])
	ans += string('+'+1-j) + string(x[2])
	ans += string('+'+1-k) + string(x[3])

	ans += "=7"

	return ans
}

func btoi(b byte) int {
	i, _ := strconv.Atoi(string(b))
	return i
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
n = int(input())
a = [0] * 100
for i in range(1,n+1):
  msb = str(i)[0]
  lsb = str(i)[-1]
  if msb == '0' or lsb == '0':
    continue
  a[int(msb) * 10 + int(lsb)] += 1

tmp = 0
for i, ai in enumerate(a):
  if '0' not in str(i):
    if i % 11 == 0:
      tmp += ai * ai
    else:
      tmp += ai * a[int(str(i)[::-1])]
  else:
    continue
    
print(tmp)

Measured memory_bytes: 3188
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
a=array(N)
N.times do|i|
  a[i]=gets.to_i
end
puts yn_judge(a.select{|x| x.odd?}.size>0,"first","second")

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int a, b;
  cin >> a >> b;
  cout << (b - a) * (b - a - 1) / 2 - a;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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

char s[100000];

int main(){
	ios::sync_with_stdio(false);

	int n, a, b;


	int ac=0;
	int bc=0;
	int c=0;

	scanf("%d %d %d", &n, &a, &b);
	scanf("%s", s);

	int t=a+b;

	REP(i, n){
			switch (s[i]) {
			case 'a':{
				if(c<t){
					c++;
					printf("Yes\n");
				}else{
					printf("No\n");
				}
				break;
			}

			case 'b':{
				if((c<t)&&(bc<b)){
					c++;
					bc++;
					printf("Yes\n");
				}else{
					printf("No\n");
				}
				break;
			}

			case 'c':{
				printf("No\n");
				break;
			}

		default :	break;
	}
}

}


Measured memory_bytes: 768
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
judge = [False for i in range(N)]
True_X=x
# print(judge)
for i in range(N):
    if x-a[i]>=0:
        judge[i]=True
        x-=a[i]
temp_count=0
for i in range(N):
    if judge[i]:
        temp_count+=1
# print(judge)
if sum(a)<True_X:
    print(temp_count-1)
else:
    print(temp_count)


Measured memory_bytes: 3064
#include <stdio.h>

 long F[100];
 long fib(long);

 int main(){

   long n;

   scanf("%ld",&n);

   printf("%ld\n",fib(n));

   return 0;

 }

long fib(long n){

  if(n==0 || n==1)return F[n]=1;

  if(F[n]>1)return F[n];

  return F[n]=fib(n-2)+fib(n-1);

}

Measured memory_bytes: 596
import std.stdio;
import std.conv;
import std.string;
import std.math;
import std.random;
import std.range;
import std.algorithm;
import std.functional;
import core.bitop;
import std.bigint;
import std.typecons;
import std.container;
 
void main()
{
    auto input = readln.split.to!(ulong[]);
    auto X = input[0], Y = input[1];

    int result;
    for (ulong cur = X; cur <= Y; cur *= 2)
        result++;
    result.writeln;
}

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

#define BOTTOM 0
#define LEFT 1
#define RIGHT 2
#define TOP 3

class point {
public:
	int x, y;
	int id, kind;
	point() {}
	point( int a, int b, int c, int d ) { x = a; y = b; id = c; kind = d; }
	bool operator <( point p ) { if( y == p.y ) return kind < p.kind; else return y < p.y; }
};

int main()
{
	int n;
	cin >> n;
	vector<point> S( n * 2 );
	vector<int> rx( n );
	for( int i = 0, k = 0; i < n; i++ ) {
		int sx, sy, ex, ey;
		cin >> sx >> sy >> ex >> ey;
		if( sy == ey ) {
			if( sx > ex ) {
				swap( sx, ex );
				swap( sy, ey );
			}
			S[k] = point( sx, sy, i,  LEFT );
			k++;
			S[k] = point( ex, ey, i, RIGHT );
			k++;
			rx[i] = ex;
		}
		else {
			if( sy > ey ) {
				swap( sx, ex );
				swap( sy, ey );
			}
			S[k] = point( sx, sy, i, BOTTOM );
			k++;
			S[k] = point( ex, ey, i, TOP );
			k++;
		}
	}

	sort( S.begin(), S.end() );
	set<int> B;
	int ans = 0;
	for( int i = 0; i < n * 2; i++ ) {
		point ep = S[i];
		if( ep.kind == BOTTOM ) {
			B.insert( ep.x );
		}
		else if( ep.kind == TOP ) {
			B.erase( ep.x );
		}
		else if( ep.kind == LEFT ) {
			auto it1 = upper_bound( B.begin(), B.end(), rx[ep.id] );
			auto it2 = lower_bound( B.begin(), B.end(), ep.x );
			ans += distance( it2, it1 );
		}
	}

	cout << ans << endl;
}



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

const int MAX = 100;
int main() {
	int N, A[MAX];
	cin >> N;
	for (int i = 0;i < N;++ i) cin >> A[i];
	sort(A, A+N);
	cout << A[N - 1] - A[0];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

Aをソートすれば、後は最大のものから最小のものを引いた値が答え
*/

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

int gcd[202][202];

int main() {
    using std::cin;
    using std::cout;
    using std::endl;
    using std::min;
    using std::max;
    int k;
    cin >> k;

    ll sum = 0LL;

    for(int i=1; i<=k; i++)
        for(int j=1; j<=k; j++){
            gcd[min(i,j)][max(i,j)] = std::gcd(i,j);
        }
    
    for(int i=1; i<=k; i++){
        for(int j=1; j<=k; j++){
            for(int h=1; h<=k; h++){
                int g = gcd[min(i,j)][max(i,j)];
                sum += gcd[min(g,h)][max(g,h)];
            }
        }
    }

    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
const int maxn=	210;
int a[maxn];
int main()
{
	std::ios::sync_with_stdio(false);
	int n,l;
	cin>>n>>l;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		a[i]=l+i-1;
		sum+=a[i];
	}
	int m=1;
	for(int i=1;i<=n;i++)
	{
		if(abs(a[m])>abs(a[i]))m=i;
	}
	cout<<sum-a[m];
	return 0;
}

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

using namespace std;

int main(){
	string s,s1="";
	cin>>s;
	if(s.size()<4){
		cout<<"No"<<endl;
	}
	else{
		s1=s1+s[0]+s[1]+s[2]+s[3];
		if(s1=="YAKI") cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
const ll MOD = 1000000007;

int main(){
    int N; SCD(N);
    vector<ll> T,A;
    vector<ll> upper;
    vector<ll> lower;
    VSCLLD(T,N);
    VSCLLD(A,N);
    bool wrong = false;

    REP(i,N){lower.PB(1);}
    REP(i,N){upper.PB(1100000000);}

    ll nowh = 0;
    REP(i,N){
        if (nowh < T[i]){
            upper[i] = T[i];
            lower[i] = T[i];
            nowh = T[i];
        }else{
            upper[i] = nowh;
        }
    }

    REP(i,N){
        //cout << i << ": [" << lower[i] << "," << upper[i] << "]" << "\n";
    }

    nowh = 0;
    REPr(i,N){
        if (nowh < A[i]){
            if ((upper[i] < A[i]) or (A[i] < lower[i])) {wrong = true;}
            upper[i] = A[i];
            lower[i] = A[i];
            nowh = A[i];
        }else{
            
            upper[i] = min(upper[i],nowh);
        }
    }

    REP(i,N){
        //cout << i << ": [" << lower[i] << "," << upper[i] << "]" << "\n";
    }

    ll ans = 1;
    if (wrong) {
        PRINTD(0);
        return 0;
    }

    REP(i,N){
        ans = (ans * ((upper[i] - lower[i] + 1) % MOD) % MOD);
    }
    PRINTLLD(ans);

    return 0;
}

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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll inf = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/


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

    cout << n * n * n;

}






Measured memory_bytes: 256
h,w=map(int,input().split())
n=int(input())
a = list(map(int,input().split()))
mat = [[0]*w for i in range(h)]
idx = 0
for y in range(h):
  for x in range(w):
    if y % 2 == 0:
      mat[y][x] = idx+1
    else:
      mat[y][w-1-x] = idx+1
    a[idx] -= 1
    if a[idx] == 0:
      idx += 1

for y in range(h):
  print(" ".join(list(map(str, mat[y]))))
    

Measured memory_bytes: 9324
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n[4];
  for(int i = 0; i < 3; scanf("%d", &n[i]), i++);
  sort(n, n + 3);
  int a = 0;
  a = (a * 10) + n[2];
  a = (a * 10) + n[1];
  a += n[0];
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def divisors(n):
    lower = []
    upper = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            lower.append(i)
            if i != n // i:
                upper.append(n // i)

    lower.extend(reversed(upper))
    return lower


def main():
    N = int(readline())

    ans = 0
    for n in range(1, N + 1, 2):
        d = divisors(n)
        if len(d) == 8:
            ans += 1

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<stdio.h>
#include<ctype.h>

int main(void){
	
	char str[1000],s[1000];
	char *ptr =str;
	int i=0;
	
	while(scanf("%c",ptr) != EOF){
		
		if(isupper(*ptr) == 0){
			*ptr = toupper(*ptr);
			
			printf("%c",*ptr);
		}else{
			
			printf("%c",*ptr);
		}
		ptr++;
		i++;
	}
	
	
	return 0;
}

Measured memory_bytes: 524
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		long[] H = new long[N];
		for(int i = 0; i < N; i++) {
			H[i] = sc.nextLong();
		}
		
		ArrayList<ArrayList<Integer>> vertex = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			ArrayList<Integer> v = new ArrayList<>();
			vertex.add(v);
		}
		
		for(int i = 0; i < M; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			vertex.get(a).add(b);
			vertex.get(b).add(a);
		}
		
		boolean[] OK = new boolean[N];
		Arrays.fill(OK, true);
		
		for(int i = 0; i < N; i++) {
			if(OK[i]) {
				ArrayList<Integer> v = vertex.get(i);
				for(int j = 0; j < v.size(); j++) {
					int x = v.get(j);
					if(H[i] > H[x]) {
						OK[x] = false;
					}
					else {
						OK[i] = false;
					}
				}
			}
		}
		
		int count = 0;
		for(int i = 0; i < N; i++) {
			if(OK[i])count++;
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 71012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=INT_MAX;
struct segtree
{
    vector<int> node;
    vector<int> lazy;
    vector<bool> lflg;
    int n;
    segtree(int sz)
    {
        n=1;while(n<sz) n*=2;
        node.resize(2*n,0);
        lazy.resize(2*n,0);
        lflg.resize(2*n,false);
    }
    void lazyupdate(int k, int l, int r)
    {
        if(lflg[k])
        {
            node[k]+=(r-l+1)*lazy[k];
            push(lazy[k],k,l,r);
            lazy[k]=0;
            lflg[k]=false;
        }
    }
    void push(int v,int k,int l,int r)
    {
        if(r-l>0)
        {
            lazy[2*k]+=v;
            lazy[2*k+1]+=v;
            lflg[2*k]=lflg[2*k+1]=true;
        }
    }
    void update(int qa, int qb, int v, int k=1, int l=1,int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k, l, r);
        if(qb<l||r<qa) return;
        if(qa<=l&&r<=qb)
        {
            node[k]+=(r-l+1)*v;
            push(v,k,l,r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa,qb,v,2*k,l,m);
            update(qa,qb,v,2*k+1,m+1,r);
            node[k]=(node[2*k]+node[2*k+1]);
        }
    }
    int get(int qa, int qb, int k=1, int l=1, int r=-1)
    {
        if(r<0) r=n;
        lazyupdate(k ,l, r);
        if(qb<l||r<qa) return 0;
        if(qa<=l&&r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            int lv=get(qa, qb, 2*k, l, m);
            int rv=get(qa, qb, 2*k+1, m+1, r);
            return lv+rv;
        }
    }
};

int main()
{
    int n,q;
    scanf("%d %d",&n,&q);
    segtree tree(n);
    for(int i=0;i<q;i++){
        int c;
        scanf("%d",&c);
        if(c){
            int x;
            scanf("%d",&x);
            cout<<tree.get(x,x)<<endl;
        }else{
            int s,t,v;
            scanf("%d %d %d",&s,&t,&v);
            tree.update(s,t,v);
        }
    }
}


Measured memory_bytes: 4968
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 200000
#define mod 998244353
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
char s[MN+5];
int num[3],n,same=1,diff=1;
inline int pow(int x,int k)
{
	int sum=1;
	for(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;
	return sum;	
}
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=2;i<=n;++i) same&=(s[i]==s[i-1]),diff&=(s[i]!=s[i-1]);
	for(int i=1;i<=n;++i) (++num[s[i]-'a'])%=3;
	if(same) return 0*puts("1");
	if(n%3==0) 
	{
		int len=((1LL*(pow(3,n)-3LL*pow(2,n-1)%mod)*(mod+1)/3)%mod+mod)%mod;
	//	cout<<"prelen="<<len<<endl;
		if(num[0]==num[1]) len=(len-pow(2,n/3)-(n==3)+mod)%mod; 
		else len=(len+pow(2,n/3-1))%mod;
		return 0*printf("%d\n",(len+diff)%mod);
	}
	int ths=(pow(3,n-1)-pow(2,n-1)+mod+diff)%mod;
	printf("%d",ths);
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3+10;
char s[maxn][maxn];
int dp1[maxn][maxn],dp2[maxn][maxn],dp3[maxn][maxn],dp4[maxn][maxn];
int main()
{
  int n , m ;
  scanf("%d%d",&n,&m);
  for(int i = 1 ; i <= n ; i++)
  {
    scanf("%s",s[i]+1);
  }
  for(int i = 1 ; i <= n ; i++)
  {
    for(int j = 1 ; j <= m ; j++)
    {
      if(s[i][j] == '.')
        dp1[i][j] = dp1[i-1][j] + 1 , dp2[i][j] = dp2[i][j-1]+1;
    }
  }
  for(int i = n ; i >= 1 ; i--)
  {
    for(int j = m ; j >= 1 ; j--)
    {
      if(s[i][j] == '.')
        dp3[i][j] = dp3[i+1][j] + 1 , dp4[i][j] = dp4[i][j+1] + 1;
    }
  }
  int ans = 0;
  for(int i = 1 ; i <= n ; i++)
  {
    for(int j =  1 ; j <= m ; j++)
    {
      if(s[i][j] == '.') ans = max(ans,dp1[i][j] + dp2[i][j] + dp3[i][j] + dp4[i][j] - 3);
    }
  }
  cout<<ans<<endl;
}
/*
4 6
#..#..
.....#
....#.
#.#...
 */

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

int main(){
	int e[4];
	for(int i=0;i<4;i++)cin>>e[i];
	sort(e,e+4);

	if(e[0]==e[1] && e[2]==e[3])cout<<"yes"<<endl;
	else cout<<"no"<<endl;


	return 0;
}



Measured memory_bytes: 3140
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

D = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for _ in range (D)]
t = [int(input()) for _ in range(D)]

M = 26
last = [0]*M
score = 0
for i in range(D):
    score += S[i][t[i]-1]
    last[t[i]-1] = i+1
    for m in range(M):
        score -= C[m]*(i+1-last[m])
    print(score)


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

ll check(vector<ll> a) {
    int n = a.size();

    ll ans = 0;
    while (1) {
        bool f = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] >= n) {
                f = 1;
                ll k = a[i] / n;
                ans += k;
                a[i] %= n;
                for (int j = 0; j < n; j++) if (i != j) a[j] += k;
            }
        }
        if (!f) break;
    }

    return ans;
}

int main() {
#ifdef HOME
    assert(freopen("in", "r", stdin));
#endif
    //cerr << check(vector<ll>(50, 1e16 + 100)) << endl;

    int n;
    while (cin >> n) {
        vector<ll> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];

        cout << check(a) << endl;
    }

#ifdef HOME
    cerr << "time: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]

c = Counter(S)
cnt = 1
c = c.most_common()
for i in range(len(c)-1):
    if c[i][1] == c[i+1][1]:
        cnt += 1
    else:
        break
ans_list = [""] * cnt
for i in range(cnt):
    ans_list[i] = c[i][0]
ans_list.sort()
for i in range(cnt):
    print(ans_list[i])

Measured memory_bytes: 45040
import java.util.Scanner;

/*

*/

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

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans[] = new int [10000000];

        for (int a = 1; a <=100; a++) {
            for (int b = 1; b <=100; b++) {
                for (int c = 1; c <=100; c++) {
                    int math = a*a + b*b + c*c + a*b + b*c + c*a;
                    ans[math-1]++;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.println(ans[i]);
        }
    }
}

Measured memory_bytes: 77840
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  l=LI()

  q=[]
  for x in l:
    heapq.heappush(q,-x)

  for _ in range(m):
    x=-heapq.heappop(q)
    heapq.heappush(q,-(x//2))

  return -sum(q)

# main()
print(main())


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

using namespace std;

#define endl "\n"
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)

template <typename T>
bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }

int w[301];
int dp[301][301];
bool past[301][301];

int memo(int l, int r)
{
  if (past[l][r])
    return dp[l][r];
  if (r - l <= 1)
  {
    past[l][r] = true;
    dp[l][r] = 0;
    return 0;
  }
  int res = 0;
  if (abs(w[r - 1] - w[l]) <= 1 && memo(l + 1, r - 1) == r - l - 2)
  {
    chmax(res, memo(l + 1, r - 1) + 2);
  }
  rep(i, l + 1, r)
  {
    chmax(res, memo(l, i) + memo(i, r));
  }
  past[l][r] = true;
  dp[l][r] = res;
  return res;
}

void solve(int &n)
{
  rep(i, 0, n) cin >> w[i];
  cout << memo(0, n) << endl;
}

int main()
{
  int n;
  while (cin >> n, n)
  {
    fill(w, w + 301, 0);
    rep(i, 0, 301) rep(j, 0, 301)
    {
      past[i][j] = false;
      dp[i][j] = 0;
    }
    solve(n);
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
  show(MOD);
#endif
  return 0;
}

///////////////////////////////////////////////////////////////////////////////////
// NOTE
///////////////////////////////////////////////////////////////////////////////////
// 典型的な区間DPの問題
// dp[l][r] := [l, r)の区間で取り除ける最大の個数.
// 遷移は大きく分けて2パターンあって、
// w[l] と w[r - 1] の差が1以下なら、この2つを対にして取り除ける.
// ただし、そうするには条件が必要で、[l + 1, r - 1)の区間のブロックを全て取り除けた場合のみ.
// もう一つのパターンは
// [l, mid) と [mid, r) にブロックを分割する.これは特別な条件はいらない.
// こんな感じの遷移をすると上手にできるかな.
//
// 区間DPの問題って少ないというよりあんまり目立たない感じがして、問題に触れている数が少ない気がするわ.
// 機会があったら区間DPだけ勉強するようにしないといつか痛い目に合いそうだわ.
// 参考記事
// http://kutimoti.hatenablog.com/entry/2018/03/10/220819


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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 20;

int n;
int order[N];
PII loc[N];
double g[N][N];

double calc(int a, int b)
{
    int x = loc[a].first - loc[b].first;
    int y = loc[a].second - loc[b].second;
    return sqrt(x * x + y * y);
}

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
    {
        scanf("%d%d", &loc[i].first, &loc[i].second);
        order[i] = i;
    }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            g[i][j] = calc(i, j);

    int cnt = 0;
    double res = 0.0;
    do
    {
        for(int i = 2; i <= n; i++)
        {
            int st = order[i - 1], ed = order[i];
            res += g[st][ed];
        }
        cnt++;
    }while(next_permutation(order + 1, order + 1 + n));

    printf("%f\n", res / cnt);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long ll;
const int MAXN = 1e6 + 10;
const int MM = 4e3 + 10;
const int Mod = 1e9 + 7;
int N;
int A[MAXN], B[MAXN];
ll fac[MAXN], ifc[MAXN];
ll f[MM][MM];
ll ans;

inline int fp(int a, int b) {
	int x = 1;
	while(b) {
		if(b & 1) x = 1ll * x * a % Mod;
		a = 1ll * a * a % Mod; b >>= 1;
	}
	return x;
}

inline void init(int n) {
	register int i;
	for(*fac = i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % Mod;
	for(ifc[n] = fp(fac[n], Mod - 2), i = n; i; --i) ifc[i - 1] = 1ll * ifc[i] * i % Mod;
}

inline int C(int n, int k) {
	if(n < 0 || k < 0 || n < k) return 0;
	return 1ll * fac[n] * ifc[k] % Mod * ifc[n - k] % Mod;
}

int main() {
	register int i, j; init(8e3);
	scanf("%d", &N);
	for(i = 1; i <= N; ++i)
		scanf("%d%d", A + i, B + i),
		++f[2001 - A[i]][2001 - B[i]];
	for(i = 1; i <= 4001; ++i)
		for(j = 1; j <= 4001; ++j)
			f[i][j] = ((ll) f[i][j] + f[i - 1][j] + f[i][j - 1]) % Mod;
	for(i = 1; i <= N; ++i)
		ans = ((ll) ans + f[2001 + A[i]][2001 + B[i]]) % Mod;
	for(i = 1; i <= N; ++i)
		ans = ((ll) ans - C(2 * A[i] + 2 * B[i], 2 * A[i]) + Mod) % Mod;
	printf("%lld\n", 1ll * ans * fp(2, Mod - 2) % Mod);
	return 0;
}


Measured memory_bytes: 137344
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll N, K;
combination comb( 1000010 );

int main()
{
  std::cin >> N >> K;

  repi( k, 1, K+1 )
    std::cout << (comb( K-1, k-1 )*comb( N-K+1, k )).x << std::endl;

  return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    
    int n;
    string s;
    
    cin >> n >> s;
    
    int num[n],ans = n;
    
    for(int i = 0; i <= n; i++) num[i] = 0;
    
    for(int i = 1; i <= n; i++, num[i] = num[i-1]) if(s[i-1]=='W') num[i]++;
    for(int i = 0; i < n; i++) ans = min(ans, num[i] + ( n - i - 1 ) - ( num[n] - num[i+1] ) );
    
    cout << ans << endl;
}


Measured memory_bytes: 1796