akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
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;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    double p;
    cin>>n>>p;
    ll v = (ll)round(p*100);
    puta(n*v/100);

    return 0;
}

Measured memory_bytes: 3764
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char, int> mp;
    rep(j,s.size()){
        mp[s[j]]++;
    }
    rep(i,n-1){
        cin >> s;
        map<char, int> cnt;
        rep(j,s.size()){
            cnt[s[j]]++;
        }
        for(auto p : mp){
            if(cnt[p.first] < p.second){
                mp[p.first] = cnt[p.first];
            }
        }
    }
    string ans = "";
    for(auto p : mp){
        rep(j,p.second) ans += p.first;
    }
    sort(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  string s, t;
  cin >> s >> t;
  t+=s;
  co(t);
               
  
  return 0;
}


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

int main(){

    int N,K,n;
    cin >> N >> K;
    vector<int> vec;
    for(int i = 0; i < N; i++){
        cin >> n;
        vec.push_back(n);
    }
    sort(vec.begin(),vec.end());

    int sum = 0;
    for(int i = 0; i < K; i++){
        sum += vec[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
x, y = map(int, input().split())
if abs(y) > abs(x):
  result = abs(y) - abs(x)
  if x < 0:
    result += 1
  if y < 0:
    result += 1
if abs(y) < abs(x):
  result = abs(x) - abs(y)
  if x > 0:
    result += 1
  if y > 0:
    result += 1
if abs(y) == abs(x):
  result = 0
  if x != y:
    result += 1
print(result)


Measured memory_bytes: 3060
import Foundation

var N = UInt(readLine()!)!

let alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

var devided = N
var String = ""

for i in 1...100{
    
    if N % 26 == 0 {
        String = "z" + String
        N -= 1
    } else if N % 26 == 1 {
        String = "a" + String
    } else if N % 26 == 2 {
        String = "b" + String
    } else if N % 26 == 3 {
        String = "c" + String
    } else if N % 26 == 4 {
        String = "d" + String
    } else if N % 26 == 5 {
        String = "e" + String
    } else if N % 26 == 6 {
        String = "f" + String
    } else if N % 26 == 7 {
        String = "g" + String
    } else if N % 26 == 8 {
        String = "h" + String
    } else if N % 26 == 9 {
        String = "i" + String
    } else if N % 26 == 10 {
        String = "j" + String
    } else if N % 26 == 11 {
        String = "k" + String
    } else if N % 26 == 12 {
        String = "l" + String
    } else if N % 26 == 13 {
        String = "m" + String
    } else if N % 26 == 14 {
        String = "n" + String
    } else if N % 26 == 15 {
        String = "o" + String
    } else if N % 26 == 16 {
        String = "p" + String
    } else if N % 26 == 17 {
        String = "q" + String
    } else if N % 26 == 18 {
        String = "r" + String
    } else if N % 26 == 19 {
        String = "s" + String
    } else if N % 26 == 20 {
        String = "t" + String
    } else if N % 26 == 21 {
        String = "u" + String
    } else if N % 26 == 22 {
        String = "v" + String
    } else if N % 26 == 23 {
        String = "w" + String
    } else if N % 26 == 24 {
        String = "x" + String
    } else if N % 26 == 25 {
        String = "y" + String
    }
    N /= 26
    if N == 0{
        break
    }

}

print(String)

Measured memory_bytes: 13064
#include <stdio.h>
#include <math.h>
int main(void) {
	int i,n;
	double s[1001],sum =0.0,m,avg=0.0;
	while(1)
	{
	scanf("%d",&n);
	if(n==0) break;
	for(i=0;i<n;i++){
		scanf("%lf",&s[i]);
		sum += s[i];
	}	
		m=sum/n;
		for(i=0;i<n;i++) avg += pow((s[i]-m),2);
		avg /= n;
		printf("%f\n",sqrt(avg));
		sum = 0.0;
		avg = 0.0;
	}
	return 0;
}

Measured memory_bytes: 1868
#include <bits/stdc++.h>
using namespace std;
#define maxn 200005
#define inf 1e17
#define eps 1e-6
#define ll long long
#define ull unsigned long long
#define main() int main()
#define pii pair<int, ll>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define sa(x) scanf("%d",&x)
#define sab(x,y) scanf("%d%d",&x,&y)
#define pa(x) printf("%d",&x)
#define pab(x,y) printf("%d%d",x,y) 
#define ms(a,x) memset(a,x,sizeof(a))
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define ff0(i,n) for(int i=0;i<n;++i)
#define ff1(i,n) for(int i=1;i<=n;++i)
main()
{
    int n;
    cin>>n;
    int f=0;
    while(n--)
    {
    	int x;
    	cin>>x;
    	if(f==1)continue;
    	if(x%2==0)
    	{
    		if(x%3!=0&&x%5!=0)
    		{
    			f=1;
			}
		}
	}
	if(!f)cout<<"APPROVED"<<endl;
	else cout<<"DENIED"<<endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    //if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }
};

int main()
{
  int n, k; cin >> n >> k;
  deque<int> d;
  rep(i, n) {
    int v; cin >> v;
    d.push_back(v);
  }
  ll ans = 0;
  for(int pop = 0; pop <= min(n, k); ++pop) {
    priority_queue<int, vector<int>, greater<int>> have;
    for(int r = 0; r <= pop; ++r) {
      deque<int> dd = d;
      int l = pop-r;
      rep(i, r) {
        have.push(dd.back());
        dd.pop_back();
      }
      rep(i, l) {
        have.push(dd.front());
        dd.pop_front();
      }
      int rev = k-pop;
      rep(i, rev) {
        if(have.empty() || have.top() > 0) break;
        have.pop();
      }
      ll tmp = 0;
      while(!have.empty()) {
        tmp += have.top(); have.pop();
      }
      chmax(ans, tmp);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

template <class T> T up(T a, T div) { return (a + div - 1) / div; }

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

    int N;
    scan(N);
    vector<ll> t(N), a(N);
    REP(i, N) scan(t[i], a[i]);

    ll x = t[0], y = a[0];

    FOR(i, 1, N) {
        ll nxt = max(up(x, t[i]), up(y, a[i]));
        x      = t[i] * nxt;
        y      = a[i] * nxt;
    }
    print(x + y);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <array>
#include <limits>
//#include <tuple>

using namespace std;

//constexpr long long mod = static_cast<long long>(1e9 + 7);


int main() {
    int V, E;
    std::cin >> V >> E;
    std::vector<std::vector<std::pair<int, int>>> edges(V, std::vector<std::pair<int, int>>());
    while(--E >= 0) {
        int s, t, w;
        std::cin >> s >> t >> w;
        edges[s].push_back(std::make_pair(t, w));
        edges[t].push_back(std::make_pair(s, w));
    }

    int cnt = V - 1;
    int ans = 0;
    std::vector<bool> isUsed(V, false);
    std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>> pque;
    isUsed[0] = true;
    for(auto edge: edges[0])
        pque.push(std::make_pair(edge.second, edge.first));

    while(--cnt >= 0) {
        while(!pque.empty()) {
            auto p = pque.top();
            pque.pop();
            if(!isUsed[p.second]) {
                isUsed[p.second] = true;
                ans += p.first;
                for(auto edge: edges[p.second])
                    pque.push(std::make_pair(edge.second, edge.first));
                break;
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 7780
c = [[int(i) for i in input().split()] for j in range(3)]
b2 = c[0][1]-c[0][0]
b3 = c[0][2]-c[0][0]
a2 = c[1][0]-c[0][0]
a3 = c[2][0]-c[0][0]

d = 0
for i in range(2):
    if c[i+1][1] - c[i+1][0] == b2:
        d += 1
    if c[i+1][2] - c[i+1][0] == b3:
        d += 1
for j in range(2):
    if c[1][i+1] - c[0][i+1] == a2:
        d += 1
    if c[2][i+1] - c[0][i+1] == a3:
        d += 1
if d == 8:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, double> pdd;
const double eps = 1e-10;
const double pi = acos(-1);
inline int sgn(double d){if(fabs(d) < eps) return 0;if(d > 0) return 1;return -1;}
inline double rad(double _deg){return _deg / 180.0 * pi;}
inline double deg(double _rad){return _rad / pi * 180.0;}
struct Point{
	double x, y;
	Point():x(0.0), y(0.0){}
	Point(double a, double b = 0.0): x(a), y(b){}
	Point(const Point& p): x(p.x), y(p.y){}
	Point operator + (const Point& a){return {x + a.x, y + a.y};}
	Point operator - (const Point& a){return {x - a.x, y - a.y};}
	double operator * (const Point& a){return x * a.x + y * a.y;}
	double operator ^ (const Point& a){return x * a.y - y * a.x;}
	bool operator == (const Point& p){return sgn(x - p.x) == 0 && sgn(y - p.y) == 0;}
	bool operator < (const Point &p) const{
		if(sgn(x - p.x) == 0) 
			return sgn(y - p.y) == -1;
		return sgn(x - p.x) == -1;
	}
	double length(){return sqrt(x * x + y * y);}
}typedef Vector;
double distance(const Point &a, const Point &b) 
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt(x * x + y * y);
}
struct Line{
	Point a, b;
	Line() : a(0.0, 0.0) , b(0.0, 0.0){}
};
Point Proj(Point p, Line l)
{
	Vector v1 = l.b - l.a;
	Vector v2 = p - l.a;
	double k1 = v1 * v2;
	double k2 = v1.length();
	k1 /= k2 * k2;
	return {l.a.x + v1.x * k1, l.a.y+ v1.y * k1};
}
int main()
{
	Line l;
	scanf("%lf%lf%lf%lf", &l.a.x, &l.a.y, &l.b.x, &l.b.y);
	int n;
	scanf("%d", &n);
	while(n --)
	{
		Point p;
		scanf("%lf%lf", &p.x, &p.y);
		Point ans = Proj(p, l);
		printf("%0.9lf %0.9lf\n", ans.x, ans.y);
	}
	return 0;
}


Measured memory_bytes: 3252
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int N, M;
vector<int> graph[101010];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b;
        --a; --b;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }

    int d6 = 0, d4 = 0;
    for (int i = 0; i < N; ++i) {
        int d = graph[i].size();
        if ((d & 1) != 0) no();
        else if (d >= 6) ++d6;
        else if (d >= 4) ++d4;
    }
    if (d6 > 0 || d4 >= 3) yes();
    if (d4 <= 1) no();

    // d6 == 0 && d4 == 2
    assert(d6 == 0 && d4 == 2);

    int u, w;
    {
        vector<int> t;
        for (int i = 0; i < N; ++i)
            if (graph[i].size() == 4) t.push_back(i);
        u = t[0]; w = t[1];
    }

    int num_path = 0;
    for (int v : graph[u]) {
        int c = v, p = u;
        while (c != u && c != w) {
            p = graph[c][0] + graph[c][1] - p;
            swap(p, c);
        }
        if (c == w) ++num_path;
    }

    if (num_path == 2) yes(); else no();

    return 0;
}


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

int main(void){
    int n,t;
    cin>>n>>t;
    int time[n+1];
    for(int i=0;i<n;i++)cin>>time[i];
    time[n]=2*1000000000;
    
    
    int ans=0;
    for(int i=0;i<n;i++){
        if(time[i+1]-time[i]>t){
            ans+=t;
            //cout<<ans<<endl;
        }else if(time[i+1]-time[i]==t){
            ans+=t;
            //cout<<ans<<endl;
        }else{
            ans+=time[i+1]-time[i];
            //cout<<ans<<endl;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
from functools import reduce

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    s = list(_ for _ in input())

    if(s[0] == s[-1]):
        if(len(s) % 2 == 0):
            print('First')
        else:
            print('Second')
    else:
        if(len(s) % 2 == 0):
            print('Second')
        else:
            print('First')
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 4708
a=float(input())
s=input()
s1=list(s)
length=len(s1)
for x in s1:
    if ord(x)<97 or ord(x)>122:
        s1.remove(x)
length2=len(s1)
if length==length2 and 1<=length<=10 and 2800<=a<5000:
    if a<3200:
        print('red')
    else:
        print(s)

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

public class Main {
    private static FastReader fr = new FastReader();
    private static PrintWriter out = new PrintWriter(System.out);

    private static long[][] dp;
    private static long calculate(int start, int end, long[] sums){
        if(dp[start][end] != -1) return dp[start][end];
        if(start == end){
            dp[start][end] = 0;
            return dp[start][end];
        }
        long ans = Long.MAX_VALUE;
        for(int i = start; i < end; i++){
            long x = calculate(start, i, sums);
            long y = calculate(i + 1, end, sums);
            ans = Math.min(ans, x + y + sums[i] - (start - 1 >= 0 ? sums[start - 1] : 0) + sums[end] - sums[i]);
        }
        dp[start][end] = ans;
        return dp[start][end];
    }

    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
        // code goes here
        int n = fr.nextInt();
        int[] arr = fr.nextIntArray(n);

        long[] sums = new long[n];
        sums[0] = arr[0];
        for(int i = 1; i < n; i++){
            sums[i] = sums[i - 1] + arr[i];
        }
        dp = new long[n][n];
        for(int i = 0; i < n; i++){
            Arrays.fill(dp[i], -1);
        }
        sb.append(calculate(0, n - 1, sums));
        System.out.print(sb.toString());
    }

    static class FastReader{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] nextLongArray(int n) {
            long[] a=new long[n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}


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

int main() {
  while (true) {
    int a, b, n;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      break;
    }
    cin >> n;
    int m[a][b] = {};
    int x, y;
    int i, j;
    for (i = 0; i < n; i++) {
      cin >> x >> y;
      m[x - 1][y - 1] = -1;
    }

    m[0][0] = 1;
    for (i = 0; i < a; i++) {
      for (j = 0; j < b; j++) {
        if (m[i][j] == -1) {
          m[i][j] = 0;
        } else {
          if (i == 0 && j == 0) {
            m[i][j] = 1;
          } else if (i == 0) {
            m[i][j] = m[i][j - 1];
          } else if (j == 0) {
            m[i][j] = m[i - 1][j];
          } else {
            m[i][j] = m[i - 1][j] + m[i][j - 1];
          }
        }
      }
    }
    cout << m[a - 1][b - 1] << endl;

  }
  return 0;
}



Measured memory_bytes: 3080
#include<stdio.h>
int main(){
  int n,i;
  long int min = 1000001,max = -1000001,total=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    long int esa;
    scanf("%ld",&esa);
    if(esa<min)min=esa;
    if(esa>max)max=esa;
    total+=esa;
  }
  printf("%ld %ld %ld\n",min,max,total);
  return(0);
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const ll d5 = 114514;

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> V[d5];
    for(ll i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        a--;
        V[a].push_back(b);
    }
    priority_queue<ll> PQ;
    ll res = 0;
    for(ll i=0;i<m;i++){
        if(!V[i].empty()){
            for(auto it:V[i])PQ.push(it);
        }
        ll a=0;
        if(!PQ.empty()){
            a=PQ.top();
            PQ.pop();
        }
        res+=a;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 6016
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		int bc[][] = new int[m][2];
		for(int i = 0; i < m; i++){
			bc[i][0]= sc.nextInt();
			bc[i][1] = sc.nextInt();
		}
		Arrays.sort(bc,(b,c) -> Integer.compare(b[1],c[1]));
		int[] na = new int[n];
		int idx = 0;
		Arrays.sort(a);
		for(int j = m-1; j >= 0; j--){
			int mai = 0;
			for(;idx < n&&mai < bc[j][0]&&a[idx] < bc[j][1];idx++){
				na[idx] = bc[j][1];
				mai++;
			}
		}
		long ans = 0;
		if(idx < n){
			for(;idx < n;idx++){
				na[idx] = a[idx];
			}
		}
		for(int i = 0; i < n; i++){
			ans = (long)ans+na[i];
		}
		System.out.print(ans);
	}
}


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

int main(){
  int len,flag=0;
  vector<char> v;
  string str;
  cin>>str;
  len=str.size();
  for(int i=0;i<len;i++){
    if(str[i]=='w'){
      if(v.size()<2){
	flag=1;
	break;
      }
      if(v[v.size()-1]!='e'||v[v.size()-2]!='m'){
	flag=1;
	break;
      }
      v.erase(v.begin()+v.size()-1);
      v.erase(v.begin()+v.size()-1);
      if(v.size()==0&&i!=len-1){
	flag=1;
	break;
      }
    }else v.push_back(str[i]);
  }
  if(flag) cout<<"Rabbit"<<endl;
  else cout<<"Cat"<<endl;
  return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<cmath>

using namespace std;

int main() {
	int n, sum = 0;
	int A[20], B[20], C[19];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < n-1; i++) {
		cin >> C[i];
	}
	for (int i = 0; i < n; i++) {
		sum += B[A[i] - 1];
		if (i != 0) {
			if (A[i] == A[i - 1] + 1) {
				sum += C[A[i - 1] - 1];
			}
		}
	}

	cout << sum;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int mod=998244353;
#define Rint register int
#define C(n,m) (n<m?0:1ll*fac[n]*invfac[n-m]%mod*invfac[m]%mod)
using namespace std;
int T,n,m,p,k;
int ksm(int a,int k){
	int ans=1;
	for(;k;k>>=1,a=1ll*a*a%mod) if(k&1) ans=1ll*ans*a%mod;
	return ans;
}
int a[410],b[410],suma=0,sumb=0,C[410][410],f[410][410]; 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]),suma+=a[i],sumb+=b[i];
	for(int i=0;i<=sumb;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	}
	f[0][0]=1;
	int inv=ksm(suma,mod-2);
	for(int i=1;i<=n;i++) for(int j=suma;j>=a[i];j--) for(int k=sumb;k>=0;k--){
		for(int l=0,pow_t=1,tmp=1ll*a[i]*inv%mod;l<=min(b[i]-1,k);l++){
			f[j][k]=(f[j][k]-1ll*f[j-a[i]][k-l]*C[k][l]%mod*pow_t%mod+mod)%mod;
			pow_t=1ll*pow_t*tmp%mod;
		}
	}
	int ans=0;
	for(int j=0;j<=suma;j++) for(int k=0;k<=sumb;k++) ans=(ans+1ll*f[j][k]*ksm(1ll*suma*ksm(j,mod-2)%mod,k+1))%mod;
	printf("%d\n",(mod-ans)%mod);
}

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

int main()
{
int n;cin>>n;
string s[n];
for(int i=0;i<n;i++)
	{cin>>s[i];
	sort(s[i].begin(),s[i].end());}
sort(s,s+n);
map<string,long long int> m;
for(int i=0;i<n;i++)
	m[s[i]]+=1;
long long sum=0;
for(auto x:m)
	sum+=(x.second*(x.second-1))/2;
cout<<sum;
return 0;
}


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

#define                                 pai                                         acos(-1)
#define                                 ll                                          long long
#define                                 pb                                          push_back
#define                                 mp                                          make_pair
#define                                 pll                                         pair<ll,ll>
#define                                 sz(a)                                       (ll)a.size()
#define                                 endl                                        "\n"
#define                                 gcd(a, b)                                   __gcd(a, b)
#define                                 lcm(a, b)                                   (((a)*(b))/gcd(a,b))
#define                                 all(vec)                                    vec.begin(),vec.end()
#define                                 ms(a, b)                                    memset(a,b,sizeof(a))
#define                                 TEST_CASE(t)                                for(int www=1;www<=t;www++)
#define                                 PRINT_CASE                                  printf("Case %d: ",z)
#define                                 fii                                         freopen("input.txt","r",stdin);
#define                                 foo                                         freopen("output.txt","w",stdout);
#define                                 fast                                        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const ll mod  = 1e9 +07;
const ll mxn  = 1e6 +10;

int  main()
{
    ll i,j,k,a,b,c,d=0,n,m,t,h,u,v,x,y,z;
    double D,S,T,T1;
    cin>>D>>T>>S;
    T1=(D/S);
    if(T1<=T)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}




Measured memory_bytes: 3716
n, w = map(int, input().split(" "))
value, weight = zip(*[list(map(int, input().split(" "))) for _ in range(n)])

dp = [[0 for _ in range(w+1)] for _ in range(n+1)]

for i in range(n):
	for j in range(1, w+1):
		if weight[i] <= j:
			dp[i+1][j] = max(dp[i][j-weight[i]]+value[i], dp[i][j])
		else:
			dp[i+1][j] = dp[i][j]

# [print(dp_i) for dp_i in dp]
print(dp[n][w])



Measured memory_bytes: 42268
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	while(1){
		int N,a[10],ba=0,counter=0;
		char fuda;
		cin >> N;
		if(N==0)break;
		for(int i=0;i<N;++i){
			a[i]=0;
		}
		while(1){
			for(int i=0;i<N;++i){
				cin >> fuda;
				counter+=1;
				switch(fuda){
				case 'M':
					a[i]+=1;
					break;
				case 'S':
					ba+=a[i]+1;
					a[i]=0;
					break;
				case 'L':
					a[i]+=ba+1;
					ba=0;
					break;
				}
				if(counter==100)break;
			}
			if(counter==100)break;
		}
		sort(a,a+N);
		for(int i=0;i<N;++i){
			cout << a[i] << " ";
		}
		cout << ba << endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>

#define LL long long

using namespace std;

int n,m,k,dim[100005]={},grsz[100005]={};
struct UnionFind{
	int V;
	vector<int>ne;
	void init(int v){V=v; for(int i=0;i<V;i++)ne.push_back(i);};
	
	int root(int x){
		if(ne[x]==x)return x;
		return ne[x]=root(ne[x]);
	}
	bool same(int x,int y){return root(x)==root(y);}
	void unite(int x,int y){
		if(same(x,y))return;
		if(x>y)swap(x,y);
		ne[ne[y]]=ne[x];
		return;
	}
};
UnionFind ff;

int main() {
	cin>>n>>m>>k;
	ff.init(n);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		dim[a]++;dim[b]++;ff.unite(a,b);
	}
	for(int i=0;i<k;i++){
		int c,d;
		cin>>c>>d;
		c--;d--;
		if(ff.same(c,d)){dim[c]++;dim[d]++;}
	}
	for(int i=0;i<n;i++)grsz[ff.root(i)]++;
	for(int i=0;i<n;i++){
		if(i)cout<<" ";
		cout<<grsz[ff.ne[i]]-1-dim[i];
	}
	cout<<endl;
	return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
vector<int> vis(N);
int F(int a, int b){
    int cnt1 = 0, cnt2 = 0;
    while(a){
        cnt1++;
        a /= 10;
    }
    while(b){
        cnt2++;
        b /= 10;
    }
    return max(cnt1, cnt2);
}
void solve(){
    int n;
    cin >> n;
    int ans = INF;
    for(int i = 1; i * i <= n; i++){
        if(n % i == 0){
            ans = min(ans, F(i, n / i));
        }
    }
    cout << ans << '\n';
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        solve();
    }
}

Measured memory_bytes: 34220
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	stack<int> S;
	int tmp,ans = 0;

	for(int i = 0; i < N; i++){
		scanf("%d",&tmp);

		if(S.empty() == true || S.top() < tmp){
			S.push(tmp);
			ans++;
		}
		else if(S.top() > tmp){
			while(S.empty() == false && S.top() > tmp){
				S.pop();
			}
			if(S.empty() == true || S.top() < tmp)ans++;
			S.push(tmp);
		}
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll MOD=1e+9+7;
ll mod(long long a, long long m) {
    return (a % m + m) % m;
}

template<class T> struct Matrix {
    vector<vector<T> > val;
    Matrix(int n = 1, int m = 1) {val.clear(); val.resize(n, vector<T>(m));}
    Matrix(int n, int m, T x) {val.clear(); val.resize(n, vector<T>(m, x));}
    void init(int n, int m, T x = 0) {val.clear(); val.resize(n, vector<T>(m, x));}
    void resize(int n, int m, T x = 0) {val.resize(n); for (int i = 0; i < n; ++i) val[i].resize(m, x);}
    int size() {return val.size();}
    inline vector<T>& operator [] (int i) {return val[i];}
    friend ostream& operator << (ostream& s, Matrix<T> M) {s << endl;
        for (int i = 0; i < M.val.size(); ++i) s << M[i] << endl; return s;}
};

template<class T> Matrix<T> operator * (Matrix<T> A, Matrix<T> B) {
    Matrix<T> R(A.size(), B[0].size());
    for (int i = 0; i < A.size(); ++i)
        for (int j = 0; j < B[0].size(); ++j)
            for (int k = 0; k < B.size(); ++k)
                R[i][j] = mod(R[i][j] + A[i][k] * B[k][j], MOD);
    return R;
}

template<class T> vector<T> operator * (Matrix<T> A, vector<T> B) {
    vector<T> v(A.size());
    for (int i = 0; i < A.size(); ++i)
        for (int k = 0; k < B.size(); ++k)
            v[i] = (v[i] + A[i][k] * B[k]) % MOD;
    return v;
}

template<class T> Matrix<T> pow(Matrix<T> A, long long n) {
    Matrix<T> R(A.size(), A.size());
    for (int i = 0; i < A.size(); ++i) R[i][i] = 1;
    while (n > 0) {
        if (n & 1) R = R * A;
        A = A * A;
        n >>= 1;
    }
    return R;
}
int main(){
	int N;
	ll K;
	scan(N);scan(K);
	Matrix<ll> A(N,N,0);
	rep(i,N){
		rep(j,N){
			int a;
			scan(a);
			A[i][j]=a;
		}
	}
	Matrix<ll> Apow=pow(A,K);
	vll ini(N,1);
	vll vans=Apow*ini;
	ll ans=0;
	rep(i,N){
		ans+=vans[i];
		ans%=MOD;
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N;
    cin>>N;
    int zero;
    cin>>zero;
    if(zero!=0){cout<<0<<endl;return 0;}
    vector<int> D(N-1);
    rep(i,N-1){cin>>D.at(i);}
    sort(D.begin(),D.end());
    int num=1,before=1,now=0;
    ll ans=1;
    rep(i,N-1){
        if(D.at(i)==num){
            now++;
            ans*=before;
            ans%=MOD2;
        }
        else{
            num++;
            before=now;
            ans*=before;
            ans%=MOD2;
            now=0;
            if(D.at(i)==num){
                now++;
            }
            else{cout<<0<<endl;return 0;}
        }
        //cout<<ans<<" "<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

int main()
{
	char str[1000100];
	scanf("%s", str);
	int n = strlen(str);
	
	vector<pair<char, int> > data;
	rep(i, n){
		if(!data.empty() && data[data.size()-1].first == str[i])
			data[data.size()-1].second++;
		else
			data.push_back(make_pair(str[i], 1));
	}
	
	int ans = 0;
	rep(i, data.size()-2){
		if(data[i].first == 'J' && data[i+1].first == 'O' && data[i+2].first == 'I'){
			int a = data[i].second;
			int b = data[i+1].second;
			int c = data[i+2].second;
			if(b<=a && b<=c)
				ans = max(ans, b);
		}
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 11852
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>H>>W>>N;
    vec x(N+1), y(N+1), ord(N+1);
    rep(i,N) cin>>x[i]>>y[i], --x[i], --y[i], ord[i] = i;
    x[N] = H;
    y[N] = 0;
    ord[N] = N;
    sort(ALL(ord), [&](int a, int b){
        if(x[a] == x[b]) return y[a] < y[b]; 
        return x[a] < x[b];
    });
    int id = 0, depth = 0;
    reps(i,1,H + 1){
        while(x[ord[id]] < i) ++id;
        if(x[ord[id]] == i) {
            if (y[ord[id]] <= depth) {
                cout << i << endl;
                return 0;
            }else if (y[ord[id]] > depth + 1) {
                ++depth;
            }
        }else{
            ++depth;
        }
    }
}

Measured memory_bytes: 4992
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

a,b, n = map(int, input().split())
val = min(b-1, n)
print(((a*val)//b)-(a)*(val//b))


Measured memory_bytes: 61828
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << endl
#define print10(ele) cout << fixed << setprecision(10) << (ele) << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  ivec a(A);
  int am = 1e6;
  REP(i, A) {
    int tmp;
    cin >> tmp;
    am = min(am, tmp);
    a[i] = tmp;
  }
  ivec b(B);
  int bm = 1e6;
  REP(i, B) {
    int tmp;
    cin >> tmp;
    bm = min(bm, tmp);
    b[i] = tmp;
  }
  pair<int, int> p = make_pair(0, 0);
  int mn = 0;
  int ans = 1e8;
  REP(i, M) {
    int x, y, c;
    cin >> x >> y >> c;
    if (c > mn) {
      x--;
      y--;
      ans = min(ans, a[x] + b[y] - c);
    }
  }
  ans = min(am + bm, ans);
  print(ans);
  return 0;
}

Measured memory_bytes: 1024
import copy
N = int(input())
numbers = [int(i) for i in input().split()]
copy_num = sorted(copy.deepcopy(numbers))

mid = N // 2
mid_num = copy_num[mid]

for i in range(N):
    if numbers[i] >= mid_num:
        print(copy_num[mid-1])
    else :
        print(mid_num)

Measured memory_bytes: 25656
#include<bits/stdc++.h>
using namespace std;
long long mul2(long long z)
  {
    long long s=0;
    while(z%2==0){s++; z/=2;}
    return s;
  }
int main(){
  long long n,m; cin >>n >>m; long long lmul=1; 
  vector<long long>v(n);
  
  for(int i=0; i<n; i++)
  {
    cin >>v[i]; v[i]/=2;
    long long cnt=mul2(v[0]);
    if(mul2(v[i])!=cnt){cout <<0; return 0;}
    else lmul=lmul*v[i]/__gcd(lmul,v[i]);
  }
cout <<(m/lmul+1)/2;
return 0;}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>

using namespace std;

lli gcd(lli a,lli b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}

lli f(lli x,lli y,lli z)
{
    return (x+y)*(x+y)+(z+y)*(z+y)+(x+z)*(x+z);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        lli n,k;
        cin>>n;
        lli ans[n+1]={0};
        for(i=1;i<=100;i++)
        {
            for(j=1;j<=100;j++)
            {
                for(k=1;k<=100;k++)
                {
                    lli temp=f(i,j,k);
                    if(temp<=2*n && temp%2==0)
                    {
                        ans[temp/2]++;
                    }
                }
            }
        }
        for(i=1;i<=n;i++)
        {
            cout<<ans[i]<<"\n";
        }
    }
    return 0;
}


Measured memory_bytes: 3728
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if ( a % 3 == 0 || b % 3 == 0 || ( a + b ) % 3 == 0 )
		cout << "Possible";
	else cout << "Impossible";
	return 0;
}


Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
for _ in range(n):
  array = list(map(int,input().split()))
  a.append(array)
s = c
l = []
for i in range(n):
  for j in range(m):
    s += a[i][j]*b[j]
  if s > 0:
    l.append(i)
  s = c
print(len(l))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

//
int 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;
    }
}

// 二項係数計算
int 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;
}
        signed main() {
    cout<<fixed<<setprecision(10);
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
          if(s[i]=='1')cout<<'9';
          else{
                  if(s[i]=='9')cout<<'1';
          else cout<<s[i];
          }
  }

        }


Measured memory_bytes: 256
A,B=map(int, input().split())

import fractions
import math
C=fractions.gcd(A,B)
c=C
arr=[]
for j in range(int(math.sqrt(C)//1-1)):
  i=j+2
  while c%i==0:
    c=c//i
    arr.append(i)
  if c==1:
    break
if c!=1:
  arr.append(c)
import collections

D=collections.Counter(arr)
print(len(D.keys())+1)

Measured memory_bytes: 5048
def dist(p, X, Y):
  s = 0
  for x, y in zip(X, Y):
    s += abs(x - y) ** p
  return s ** (1/p)

N = int(input())
*X, = map(int, input().split())
*Y, = map(int, input().split())
print(dist(1, X, Y))
print(dist(2, X, Y))
print(dist(3, X, Y))
print(max(abs(x - y) for x, y in zip(X, Y)))


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

  vector<int64_t> a(n);
  int64_t s = 0;
  for (auto&& aa : a) {
    cin >> aa;
    s += aa;
  }

  sort(a.rbegin(), a.rend());
  cout << (a[m - 1] < (s + 4 * m - 1) / (4 * m) ? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    long int k;
    cin >> s >> k;
    
    int i;
    for (i=0 ; i<k ; i++){
        if (s[i] != '1'){
            break;
        }
    }
    
    if (i==k){
        cout << 1 << endl;
    }
    else {
        cout << s[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DWizardInMaze solver = new DWizardInMaze();
        solver.solve(1, in, out);
        out.close();
    }

    static class DWizardInMaze {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int h = Integer.parseInt(in.next());
            int w = Integer.parseInt(in.next());
            int ch = Integer.parseInt(in.next()) - 1;
            int cw = Integer.parseInt(in.next()) - 1;
            int dh = Integer.parseInt(in.next()) - 1;
            int dw = Integer.parseInt(in.next()) - 1;
            char[][] s = new char[h][w];
            for (int i = 0; i < h; i++) {
                s[i] = in.next().toCharArray();
            }

            int[][] d = new int[h][w];
            for (int i = 0; i < h; i++) {
                Arrays.fill(d[i], Integer.MAX_VALUE);
            }

            Deque<Integer> que = new ArrayDeque<>();
            que.add(ch * w + cw);

            //cost
            d[ch][cw] = 0;

            //bfs
            while (!que.isEmpty()) {
                int cur = que.poll();
                int cx = cur / w;
                int cy = cur % w;
                for (int nx = cx - 2; nx <= cx + 2; nx++) {
                    if (nx < 0 || h <= nx) {
                        continue;
                    }
                    for (int ny = cy - 2; ny <= cy + 2; ny++) {
                        if (ny < 0 || w <= ny) {
                            continue;
                        }
                        if (s[nx][ny] == '#') {
                            continue;
                        }
                        if (d[nx][ny] > d[cx][cy] &&
                                Math.abs(nx - cx) + Math.abs(ny - cy) <= 1) {
                            d[nx][ny] = d[cx][cy];
                            que.addFirst(nx * w + ny);
                        } else if (d[nx][ny] > d[cx][cy] + 1) {
                            d[nx][ny] = d[cx][cy] + 1;
                            que.addLast(nx * w + ny);
                        }
                    }
                }
            }
            if (d[dh][dw] == Integer.MAX_VALUE) {
                out.println(-1);
            } else {
                out.println(d[dh][dw]);
            }
        }

    }
}



Measured memory_bytes: 60316
#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
typedef long long ll;
typedef long double ld;
using namespace std;

 
int main() {
    long long N;
    cin >> N;
    long long sum = 0;
    for (int i = 1; i<=N; i++) {
        if (i == 1 || i == 2) {
            sum += i;
            continue;
        }
        if (i%3 != 0 && i%5 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3568