akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LL long long
using namespace std;

struct Dinic {
  typedef LL FLOW_TYPE;
  static const int MAXN = 2e5;
  static const FLOW_TYPE INF = numeric_limits<FLOW_TYPE>::max();
  struct edge {
		int a, b;
    FLOW_TYPE cap, flow;
	};
	int n, s, t;
  vector<int> d, ptr, q;
	vector<edge> e;
	vector<vector<int> > g;
	//takes in number of nodes source and sink
	Dinic(int a, int b, int c): n(a), s(b), t(c) {
    d = vector<int>(n + 1, 0);
    ptr = vector<int>(n + 1, 0);
    q = vector<int>(n + 1, 0);
    g = vector<vector<int> >(n + 1);
  }
	void add_edge(int a, int b, FLOW_TYPE cap) {
		edge e1 = { a, b, cap, 0 };
		edge e2 = { b, a, 0, 0 };
		g[a].push_back ((int) e.size());
    e.push_back (e1);
    g[b].push_back ((int) e.size());
    e.push_back (e2);
	}
	bool bfs() {
    int qh=0, qt=0;
    q[qt++] = s;
    fill(d.begin(), d.end(), -1);
    d[s] = 0;
    while(qh < qt && d[t] == -1) {
      int v = q[qh++];
      for(size_t i=0; i<g[v].size(); ++i) {
        int id = g[v][i],
          to = e[id].b;
        if(d[to] == -1 && e[id].flow < e[id].cap) {
          q[qt++] = to;
          d[to] = d[v] + 1;
        }
      }
    }
    return d[t] != -1;
	}
	FLOW_TYPE dfs(int v, FLOW_TYPE flow) {
    if (!flow)  return 0;
    if (v == t)  return flow;
    for (; ptr[v]<(int)g[v].size(); ++ptr[v]) {
      int id = g[v][ptr[v]],
        to = e[id].b;
      if (d[to] != d[v] + 1)  continue;
      FLOW_TYPE pushed = dfs (to, min (flow, e[id].cap - e[id].flow));
      if (pushed) {
        e[id].flow += pushed;
        e[id^1].flow -= pushed;
        return pushed;
      }
    }
    return 0;
	}
	FLOW_TYPE dinic() {
    FLOW_TYPE flow = 0;
    for(;;) {
      if(!bfs()) break;
      fill(ptr.begin(), ptr.end(), 0);
      while(FLOW_TYPE pushed = dfs(s, INF))
        flow += pushed;
    }
    return flow;
	}
  void cut_dfs(int r, vector<bool> &vis) {
    if(vis[r]) return ;
    vis[r] = true;
    for(auto &id: g[r]) {
      int to = e[id].b;
      if(e[id].cap - e[id].flow > 0) {
        cut_dfs(to, vis);
      }
    }
  }
  vector<int> find_cut() { // Returns S
    vector<bool> vis(MAXN, false);
    cut_dfs(s, vis);
    vector<int> ans;
    for(int i = 0; i < vis.size(); i++) {
      if(vis[i]) {
        ans.push_back(i);
      }
    }
    return ans;
  }
};

const int MAXN = 103;
LL arr[MAXN], n;

int main() {
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int V = n + 3, sc = V - 2, sink = V - 1;
  Dinic tester(V, sc, sink);
  for(int i = 1; i <= n; i++) {
    if(arr[i] < 0) {
      for(int j = i*2; j <= n; j += i) {
        if(arr[j] > 0) {
          tester.add_edge(i, j, Dinic::INF);
        }
      }
    }
    if(arr[i] < 0) {
      tester.add_edge(sc, i, -arr[i]);
    } else if(arr[i] > 0) {
      tester.add_edge(i, sink, arr[i]);
    }
  }
  LL res = 0;
  for(int i = 1; i <= n; i++) {
    if(arr[i] > 0) res += arr[i];
  }
  // cerr << "D: " << res << " " << tester.dinic() << endl;
  cout << res - tester.dinic() << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();

        long ans = 0;
        for(int i = 1; i <= N; i++) {
            if(i % 3 == 0 || i % 5 == 0) continue;
            ans += i;
        }

        os.println(ans);
    }

}

Measured memory_bytes: 27188
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>

using namespace std;


int calc2(int a) {
   
   int amari = 0;
   int count = 0;
   while (amari == 0) {
      amari = a%2;
      a /= 2;
      count++;
   }
   return count-1;
}

int main() {
   
   int N;
   cin >> N;
   int a[N];
   int tmp;
   int ans = 0;
   for (int i = 0; i < N; i++) {
      cin >> tmp;
      ans += calc2(tmp);
   }
   
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    void calc()
    {
        cin = new Scanner();
        int[] RGBN = cin.ArrayInt(4,0);
        int R=RGBN[0];
        int G=RGBN[1];
        int B=RGBN[2];
        int N=RGBN[3];
        int ans=0;
        for(int i_R=0;i_R<=N/R;i_R++)
        {
          for(int i_G=0;i_G<=(N-R*i_R)/G;i_G++)
          {
            for(int i_B=(N-R*i_R-G*i_G)/B-1;i_B<=(N-R*i_R-G*i_G)/B;i_B++)
            {
              if(R*i_R+G*i_G+B*i_B==N)ans++;
            }
          }
        }
          
        Console.WriteLine(ans);
    }


}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}
multimap<ll,ll> pos;
ll m,n;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(cin >> m && m){
    pos.clear();
    ll x, y;
    vector<pll> v(m);
    rep(i,m){
      cin >> x >> y;
      v[i] = mp(x,y);
    }
    cin >> n;
    vector<pll> v2(n);
    rep(i,n){
      cin >> x >> y;
      v2[i] = mp(x,y);
      pos.insert(mp(x,y));
    }
    rep(i,n){
      int dx = v2[i].fi - v[0].fi,dy = v2[i].se - v[0].se;
      int s = 1;
      bool f = true;
      while(f){
        auto tmp = pos.equal_range(v[s].fi + dx);
        auto it = tmp.fi;
        for(; it != tmp.se; ++it){
          if(it->se == v[s].se + dy){
            ++s;
            break;
          }
        }
        if(it == tmp.se){
          f = false;
        }
      }
      if(s == m){
        cout << dx << ' ' << dy << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, x; cin >> n >> x;
    ll ans = n;
    vector<ll> m(n);
    for(ll i = 0; i < n; i++){
        cin >> m[i];
        x -= m[i];
    }
    sort(all(m));
    ans += x / m[0];
    cout << ans;
    cout << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  lli L, R;
  cin >> L >> R;
  if (R - L >= 2019)
    R = L + 2018;
  lli minVal = 2018;
  for (lli i = L; i <= R; i++) {
    for (lli j = i + 1; j <= R; j++) {
      minVal = min(minVal, (i * j) % 2019);
    }
  }
  cout << minVal << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(N);
    ll sum = 0;
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    sort(ALL(A));
    reverse(ALL(A));
    double tmp = (double)sum / (4*M);
    //cout << tmp << endl;
    if(A[M-1] < tmp){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = Long.parseLong(sc.next());
        int ans = 0;
        for (int i = 1; i <= x; i++) {
            double t = (i * (i + 1)) / 2.0;
            if (t >= x) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>
#include <map>
using namespace std;


void func139c() {
  int N;
  cin >> N;
  vector<int> H(N);
  int ans = 0, buf = 0;
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  for (int i = 0; i < N-1; i++) {
    if (H[i] >= H[i+1]) {
      buf++;
    }else{
      buf = 0;
    }
    if (buf > ans) ans = buf;
  }
  cout << ans << "\n";
}

int main(void) {
  func139c();
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(){
	double r=0.0, S, R, p;
	scanf("%lf", &r);
	p = 3.141592653589;
	R = 2.0*r*p;
	S = r*r*p;
	printf("%f %lf\n",S, R);
		return 0;
}

Measured memory_bytes: 648
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;

typedef long long ll;



int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N;
    cin >> N;
    ll A[2*112345];
    repeat(i,N){
        cin >> A[i];
    }
    ll ans = 0;
    if(A[0] > 0)
        ans  = -1;
    repeat(i, N-1){
        if(A[i+1]-A[i] > 1)
            ans = -1;
    }
    if(ans == -1){
        cout << ans << endl;
        return 0;
    }
    
    repeat(i, N){
        if(i>0 && A[N-1-i] == A[N-i]-1)
            continue;
        ans += A[N-1-i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    unsigned long long k, a, b;

    cin >> k >> a >> b;

    unsigned long long need = a - 1;
    unsigned long long mi = k + 1;

    if (b <= a)
    {
        cout << k + 1;
        return 0;
    }

    if (k < a + 1)
    {
        cout << k + 1;
        return 0;
    }



    if ((k - need) % 2 == 0)
        cout << max(mi, a + ((k - need) / 2 + (k - need) % 2) * (b - a));
    else
        cout << max(mi, 1 + a + ((k - need) / 2) * (b - a));
    //cout << max(1 + k, t * b);

    return 0;
}


Measured memory_bytes: 256
n, m, x0, y0 = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x_max = max(x)
y_min = min(y)

if x_max < y_min:
    if x0 < y_min and x_max < y0:
        print("No War")
    else:
        print("War")
else:
    print("War")


Measured memory_bytes: 3060
#include <cstdio>

int N;
int count[28];
char S[100008];
int main() {
	scanf("%d",&N);
	scanf("%s",S);
	for(int i=0;i<N;i++) {
		count[(int)(S[i]-'a')]++;
	}
	long long sol=1;
	int mod = 1000000007;
	for(int i=0;i<26;i++) {
		sol *= count[i]+1;
		sol %= mod;
	}
	sol += mod - 1;
	sol %= mod;
	printf("%lld\n", sol);
	return 0;
}

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

using namespace std;

using ll =long long;

int main()
{
    string S;
    ll K;
    cin >> K >> S;
    string ans;
    if(S.length() > K)
    {
        ans = S.substr(0,K) + "...";
    }
    else
    {
        ans = S;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3132
import sys
input = lambda: sys.stdin.readline().rstrip()
import bisect

N, M = map(int, input().split())

pref = [[] for _ in range(N)]

res = []

for i in range(M):
    p, y = map(int, input().split())
    pref[p-1].append(y)
    res.append((p-1, y))

for ar in pref:
    ar.sort()

for pre, year in res:
    p = str(pre + 1)
    p_zero = p.zfill(6)
    y = str(bisect.bisect_left(pref[pre], year) + 1)
    y_zero = y.zfill(6)
    print(p_zero + y_zero)

Measured memory_bytes: 64744
import sys
from decimal import Decimal


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    A, B = map(str, input().split())
    A = int(A)
    B = int(Decimal(B) * 100)
    c = str(A * B)
    answer = 0
    for i in range(len(c) - 2):
        answer = answer * 10 + int(c[i])

    print(answer)


if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    long double a,b,c,eps=1.0E-14;
    cin>>a>>b>>c;
    a=sqrtl(a);
    b=sqrtl(b);
    c=sqrtl(c);
    if(a+b+eps<c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

//a=97,z=122


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> data(10001,-1);

int root(int x){
  if(data[x] == -1)return x;
  else return data[x] = root(data[x]);
}

bool same(int x,int y){
  if(root(x) == root(y))return 1;
  else return 0;
}

int unite(int x,int y){
  if(!same(x,y))data[root(x)] = y;
  return 0;
}

int main(){
  int n,q,com,x,y;
  vector<int> ans;
  cin >> n >> q;
  while(data.size()>n+1)data.erase(data.begin());
  for(int i = 0;i < q;i++){
    cin >> com >> x >> y;
    if(com){
      if(same(x,y))ans.push_back(1);
      else ans.push_back(0);
    }
    else{
      unite(x,y);
    }
  }
  for(int i = 0;i < ans.size();i++)cout << ans[i]<< endl;
}


Measured memory_bytes: 3396
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[100], b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll dat[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
string dp[10000 + 100];

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

  cin >> n >> m;
  rep(i, m) cin >> a[i];
  rrep(i, 1, n + 1) {
    rep(j, m) {
      if (i - dat[a[j] - 1] < 0) continue;
      string curr = dp[i], af = dp[i - dat[a[j] - 1]];
      if (i - dat[a[j] - 1] != 0 && af == "") continue;
      af += to_string(a[j]);
      // debug(af);
      if (Size(curr) < Size(af))
        dp[i] = af;
      else if (Size(curr) > Size(af))
        continue;
      else {
        if (af > curr) dp[i] = af;
      }
    }
  }
  // Cout(dp[5]);
  Cout(dp[n]);
  return 0;
}

Measured memory_bytes: 41472
a,b,c,d = list(map(int, input().split()))

i = 0
while True:
    if i % 2 == 0:
        c-=b
    else:
        a-=d

    if c <= 0:
        print('Yes')
        break
    if a <= 0:
        print('No')
        break
    i += 1


Measured memory_bytes: 9108
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    string s, t; cin >> s >> t;

    if (s[0] == t[2] and s[1] == t[1] and s[2] == t[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

#define all(v) v.begin(), v.end()

#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

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

  ll n, k;
  cin >> n >> k;

  ll a[200000] = {};
  rep(i, k) {
    a[i] = n / k;
    if (i != 0 && i <= n % k) {
      a[i]++;
    }
  }

  ll ans = a[0] * a[0] * a[0];
  if (k % 2 == 0) {
    ans += a[k / 2] * a[k / 2] * a[k / 2];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

LL dp[55][10000] = {};

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL N,A; cin >> N >> A;
    VL x(N);
    REP(i,N) {
        cin >> x[i];
        x[i] -= A;
    }
    dp[1][5000] += 1;
    dp[1][5000+x[0]] += 1;

    FOR(i,1,N){
        for(int j = 0; j < 10000; j++){ // 5000 -> 0
            dp[i+1][j] += dp[i][j]; // dont use
            if(j + x[i] >= 0 && 10000 > j + x[i]){
                dp[i+1][j+x[i]] += dp[i][j]; //use
            }

        }
    }
    cout << dp[N][5000]-1 << endl;

}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    
    int l[50] = {};
    for(int i=0;i<N;i++){
        cin >> l[i];
    }
    sort(l,l+N,greater<int>());
    
    int ans = 0;
    for(int i=0;i<K;i++){
        ans = ans+l[i];
    }
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string s;
int main() {
	std::cin >> s;
	long long ans = 0;
	for(int bit = 0;bit < (1 << ((int)s.size() -
1));bit++){
		long long num = s[0] - '0';
		long long sum = 0;
		for (int i = 0;i < (int)s.size() - 1;i++){
			if (bit & (1 << i)){
				sum += num;
				num = 0;
			}
			num = num * 10 + s[i + 1] - '0';
		}
		sum += num;
		ans += sum;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,X;
  cin>>N>>X;
  vector<int> S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
    X -=S.at(i);
  }
  sort(S.begin(),S.end());
  cout<<N+X/S.at(0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll x; cin >> x;
  for(ll i=0;i<=1000;i++){
    for(ll j=-1000;j<i;j++){
      if(x%(i-j)==0 && (i*i*i*i*i)-(j*j*j*j*j)==x){
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3632
N = int(input())
H = list(map(int, input().split()))

flag = True

for i in range(N-1, 0, -1):
    if H[i] == H[i-1] - 1:
        H[i-1] -= 1
    elif H[i] < H[i-1] - 1:
        flag = False
        break
    elif H[i] >= H[i-1]:
        continue
        
if flag:
    print("Yes")
else:
    print("No")   

Measured memory_bytes: 14224
from math import factorial

n,a,b = map(int,input().split())

mod = 10**9+7

def comb(n,k,p):
  x = 1
  y = 1
  for i in range(k):
    x= (x *(n-i))%p
    y= (y* (k-i))%p
  yinv = pow(y,p-2,p)
  return (x*yinv)%p

ans = (pow(2,n,mod)- 1 - comb(n,a,mod)-comb(n,b,mod))%mod
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
#define F first
#define S second
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<pi> vpi;
typedef std::string str;
typedef std::pair<pi,int> ppi;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,C;
int s[100010],t[100010],c[100010];
vpi ch[40];
int cum[100010];//累積和
int a[100010];//startとstopの記録
int solve(){
  int res=0;
  //チャンネルごとにa[i]に記録
  fill(a,0);
  rep(i,C){
    if(ch[i].size()==0) continue;
    //ch[i]を開始時刻でソート
    std::sort(ch[i].begin(),ch[i].end());
    bool f=true;//番組同士が連続しているか否か
    rep(j,ch[i].size()-1){
      if(f) a[ch[i][j].F-1]++;//連続していなければstartの記録
      if(ch[i][j].S==ch[i][j+1].F){//stopが次の番組のstartと同時刻(連続判定)
	f=false;//連続
      }
      else{
	a[ch[i][j].S]--;//stopは連続していないのでstopの記録
	f=true;//連続でない
      }
    }
    if(f){
      a[ch[i][ch[i].size()-1].F-1]++;//連続していないなら最後のstartを記録
    }
    a[ch[i][ch[i].size()-1].S]--;//最後のstopを記録      
  }
  //累積和をとる。シミュレート
  fill(cum,0);
  rep1(i,100005){
    cum[i]=cum[i-1]+a[i-1];
  }
  rep(i,100005){
    res=std::max(res,cum[i]);
  }
  return res;
}
int main(){
  cin>>N>>C;
  rep(i,N){
    cin>>s[i]>>t[i]>>c[i];
    c[i]--;
    //チャンネルごとに振り分ける
    ch[c[i]].push_back(mp(s[i],t[i]));
  }
  prin(solve());
  return 0;
}


Measured memory_bytes: 3456
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int A, B;
  
  std::cin >> A >> B;

  std::cout << (A >= 13 ? B : A >= 6 ? B / 2 : 0) << std::endl;

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
typedef pair <int,int> P;
const ll MAX_N = 100000;
int main() {
//input
int a,b;
scanf("%d%d",&a,&b);

//compute
if(a<=b){
    rep(i,b)cout<<a;
}
else{
    rep(i,a)cout<<b;
}
//output

	return 0;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

lnt powmod(lnt a, lnt p, lnt m){
	lnt res = 1, tmp = a;
	while(p != 0){
		if(p % 2) res = (res*tmp) % m;
		tmp = (tmp*tmp) % m;
		p /= 2;
	}
	return res;
}

int main(){
	summon_tourist;

	lnt N; cin >> N;

	lnt c00 = 0, c01 = 0, c10 = 0;
	vector<plnt> X;
	map<plnt, lnt> mp;

	REP(i, N){
		lnt a, b; cin >> a >> b;
		if(a==0 and b==0) c00++;
		else if(a==0) c01++;
		else if(b==0) c10++;
		else X.pb(make_pair(a, b));
	}

	for(plnt &p: X){
		lnt a = p.first, b = p.second;
		lnt g = GCD(abs(a), abs(b));
		a /= g; b /= g;
		if(a < 0){
			a*=-1; b*=-1;
		}
		mp[make_pair(a, b)]++;
		if(b < 0){
			lnt ta = -b, tb = a;
			a = ta; b = tb;
		}
		p = make_pair(a, b);
	}
	sort(ALL(X));
	X.erase(unique(ALL(X)), X.end());
	lnt ans = (powmod(2, c01, MOD) + powmod(2, c10, MOD) - 1 + MOD) % MOD;
	for(plnt p: X){
		lnt a = p.first, b = p.second;
		cerr << a << ' ' << b << ln;
		lnt A = b, B = -a;
		lnt c0 = mp[p], c1 = mp[make_pair(A, B)];
		ans = ans * ((powmod(2, c0, MOD) + powmod(2, c1, MOD) - 1 + MOD) % MOD) % MOD;
	}
	
	cout << (ans-1+c00+MOD) % MOD << ln;
}

Measured memory_bytes: 35948
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    vi a(N), b(N), c(N-1);

    REP(i,N) cin >> a[i];
    REP(i,N) cin >> b[i];
    REP(i,N-1) cin >> c[i];

    int ans = 0;
    REP(i,N) {
        ans += b[a[i]-1];

        if (i != 0) if (a[i-1]+1 == a[i]) {
            ans += c[a[i-1]-1];
        }
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}


int main() {
  ll N,W,w,v,w1;
  cin >> N >> W;
  vector<vector<ll>> V(4);
  rep(i,N) {
    cin >> w >> v;
    if (i==0) w1=w;
    V[w-w1].push_back(v);
  }
  rep(i,4) sort(V[i].rbegin(),V[i].rend());
  rep(i,4){
    rep(j,V[i].size()) {
      if (j==0) continue;
      V[i][j]+=V[i][j-1];
    }
  }
  ll res = 0;
  rep(i,V[0].size()+1) {
    rep(j,V[1].size()+1) {
      rep(k,V[2].size()+1) {
        rep(l,V[3].size()+1) {
          if (w1*(i+j+k+l)+j+2*k+3*l>W) continue;
          ll tmp=0;
          if (i>0) tmp += V[0][i-1];
          if (j>0) tmp += V[1][j-1];
          if (k>0) tmp += V[2][k-1];
          if (l>0) tmp += V[3][l-1];
          chmax(res,tmp);
        }
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
 int i, j, k, kosuu, box, CGcount = 0, a[101];

 scanf("%d", &kosuu);
 for(i = 1;i <= kosuu;i++){
   scanf("%d", &a[i]);
 }

 for(i = 1;i <= kosuu;i++) {
   for(j = kosuu;j > i;j--) {
     if (a[j] < a[j-1]) {
       box    = a[j-1];
       a[j-1] = a[j];
       a[j]   = box;
       CGcount++;
     }
   }
 }
 for(k = 1;k < kosuu;k++) {
   printf("%d ", a[k]);
 }
 printf("%d\n%d\n", a[kosuu], CGcount);

 return 0;
}

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

int main()
{
  int n; cin>>n; 
  if(n%10 == 3)
    cout<<"bon";
  else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)
    cout<<"pon";
  else
    cout<<"hon";
  
}

Measured memory_bytes: 3552
// #include "slimes.h"
#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <vector>

long long min_cost(const std::vector<int>& slimes)
{
    std::vector<std::vector<long long>> dp(
        slimes.size(),
        std::vector<long long>(slimes.size(),
                               std::numeric_limits<long long>::max()));

    for (int right = 0; right < slimes.size(); ++right) {
        for (int left = right; left >= 0; --left) {
            if (left == right) {
                dp[left][right] = 0;
                continue;
            }
            const long long sum = std::accumulate(
                cbegin(slimes) + left, cbegin(slimes) + right + 1, 0ll);
            for (size_t cut = left; cut < right; ++cut) {
                dp[left][right] = std::min(
                    dp[left][right], dp[left][cut] + dp[cut + 1][right] + sum);
            }
        }
    }

    return dp.front().back();
}

int main(int argc, char* argv[])
{
    size_t num_slimes;
    std::cin >> num_slimes;
    std::vector<int> slimes;
    slimes.reserve(num_slimes);
    for (size_t i = 0; i < num_slimes; ++i) {
        int slime_length;
        std::cin >> slime_length;
        slimes.push_back(slime_length);
    }
    std::cout << min_cost(slimes) << std::endl;
    return 0;
}



Measured memory_bytes: 4148
/*
Mangal bhavan amangal haari
Drabahu su Dasharath achar Bihari
Raam Siya Raam Siya Raam jai jai Raam
Raam Siya Raam Siya Raam jai jai Raam
Ho hoi hai wohi jo Raam rachi raakha
Ko kari tarak badhave saakha
Raam Siya Raam Siya Raam jai jai Raam
Ho dheeraj dharam mitra aru naari
Aapad kaal parakhiye chaari
Ho jehike jehi par satya sanehu
So tehi milay na kachhu sandehu
Ho jaaki rahi bhawana jaisi
Prabhu murati dekhi tin taisi
Ho Raghukul reet sada chali aayi
Praan jaaye par vachan na jaayi
Raam Siya Raam Siya Raam jai jai Raam, Raam
Raam Siya Raam Siya Raam jai jai Raam
Ho hari anant hari katha ananta
Kahahi sunahi bahuvidhi sab santa
Raam Siya Raam Siya Raam jai jai Raam, Raam
Raam Siya Raam Siya Raam jai jai Raam
Raam Siya Raam Siya Raam jai jai Raam
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
//auto->.
//map<int,int>::iterator i
vector<int> sieve(int n) 
{ 

    vector<bool> prime(n+1,true); 
       
    prime[0] = false; 
    prime[1] = false; 
    int m = sqrt(n); 
   vector<int> ans;

    for (int p=2; p<=m; p++) 
    { 
    
        if (prime[p]) 
        { 
         
            for (int i=p*2; i<=n; i += p) 
            prime[i] = false; 
        } 
    }  
    //vector<int> ans; 
    for (int i=0;i<n;i++) 
        if (prime[i]) 
            ans.push_back(i); 
    return ans; 
}

int gcd(int a,int b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int mod = 1e9 + 7;
int power(int a , ll b)
{
	int res = 1;
	while(b)
	{
		if(b & 1)
			res = 1LL * res * a ;//% mod;
		a = 1LL * a * a ;//% mod;
		b >>= 1;
	}
	return res;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
ll min(int a,ll b)
{
	if(a>b)
	return b;
	return a;
}
ll max(int a,ll b)
{
	if(a>b)
	return a;
	return b;
}
ll myXOR(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}
int conti(int x)
{
	if(x<1)
	return 0;
	if(x%4==0)
	return x;
	if(x%4==1)
	return 1;
	if(x%4==2)
	return x+1;
	if(x%4==3)
	return 0;
}
 
bool ispfsq(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is        an integer 
  return ((sr - floor(sr)) == 0); 
}
#define PI 3.141592653589793


vector<int > adj[200005],col[2];
bool visited[200005];
int  a[200005];
ll s[200005], ans;
map<ll, int> lst;
void solve()
{
vector<pair<int,int> > tri;
map<ll,ll > m;
for(int i=1;i<=100;i++)
{
	for(int j=1;j<=100;j++)
	{
		for(int z=1;z<=100;z++)
		{
			m[(i+j+z)*(i+j+z)-(i*j + j*z + z*i)]++;
		}
	}
}
ll n;
cin>>n;
for(int i=1;i<=n;i++)
{
	if(m.find(i)!=m.end())
	{
		cout<<m[i]<<"\n";
	}
	else
	{
		cout<<0<<"\n";
	}
}

}


int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
int mul=0;
if(mul==1)
{
 int t;
    cin>>t;
   while(t--)
    {
		solve();
	cout<<"\n";
    }
  
}
else
{
	solve();
}
}

Measured memory_bytes: 10688
n = int(input())
h = list(map(int,input().split()))
sum_h = sum(h)
sum_now = 0
ans = 0

while sum_h != sum_now:
    for i in range(n):
        if h[i] != 0:
            start = i
            break
     
    goal = n
    
    for i in range(n-start):
        if h[start+i] == 0:
            goal = start + i
            break
            
        if start + i == n-1:
            goal == n
        
    water = min(h[start:goal])
    
    for i in range(start,goal):
        h[i] -= water
        
    ans += water
    sum_now += water * (goal-start)
        
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;

int main()
{
  int n;
  cin>>n;
  vecint p(n);
  REP(i,n) cin>>p[i];
  int cnt = 0;
  REP(i,n) {
    if (p[i] != i+1) ++cnt;
  }
  if (cnt <= 2) {
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
  return 0;
}


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

int main()
{
    long a, b, c, d;
    long long ans[4], ma;
    cin >> a >> b >> c >> d;
    ans[0] = a * c;
    ans[1] = a * d;
    ans[2] = b * c;
    ans[3] = b * d;

    ma = max(ans[0], ans[1]);
    ma = max(ma, ans[2]);
    ma = max(ma, ans[3]);

    cout << ma << endl;
}


Measured memory_bytes: 3632
H , W = map(int, input() .split())

if W == 1:
    N = 1

elif H == 1:
    N = 1

else:   
    if H % 2 ==0:
        N = H * W / 2
        
            
    elif H % 2 ==1:
        if W % 2 ==0:
            N = H * W / 2
        else:
            N = int(H * W / 2) + 1

print(int(N))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
struct node
{
	int l,r;
	bool operator < (const node &a) const
	{
		if(r!=a.r) return r<a.r;
		else return l<a.l;
	}
}t[100005];
int main()
{
	//freopen("1.txt","r",stdin);
	int n,c,k;
	scanf("%d%d%d",&n,&c,&k);
	for(int i=0;i<n;++i)
	{
		scanf("%d",&t[i].l);
		t[i].r=t[i].l+k;
	}
	sort(t,t+n);
	int ans=0;
	for(int i=0;i<n;)
	{
		ans++;
		int N=1;
		int j=i+1;
		while(N<c&&j<n)
		{
			if(t[j].l<=t[i].r)
			{
				N++;
				j++;
			}
			else break;
		}
		i=j;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
// const int maxn=2000000;
const int maxlog=31;
struct node
{
    int id;
    unsigned long long val;
    node(int i=-1,unsigned long long val=0):id(i),val(val) { }
}A(0,1000000000),B(1,1000000000),C(2),pw[maxlog],temp0,temp1,temp2,a[maxlog],b[maxlog];
int tot=2;
inline void add(node &a,node b,node c)
{
    if(a.id==-1) a.id=++tot;
    printf("+ %d %d %d\n",b.id,c.id,a.id);
    a.val=b.val+c.val;
}
inline void cmp(node &a,node b,node c)
{
    if(a.id==-1) a.id=++tot;
    printf("< %d %d %d\n",b.id,c.id,a.id);
    a.val=b.val<c.val;
}
int main()
{
    int i,j,k;
    printf("32925\n");
    add(pw[0],A,B),cmp(pw[0],C,pw[0]);
    // cmp(pw[0],C,A);
    for(i=1;i<maxlog;i++)
        add(pw[i],pw[i-1],pw[i-1]);
    add(A,A,pw[0]),add(B,B,pw[0]);
    temp0.id=++tot,temp1.id=++tot;
    for(i=maxlog-1;i>=0;i--)
    {
        add(temp1,temp0,pw[i]);
        cmp(a[i],temp1,A);
        // for(j=0;j<i;j++) add(a[i],a[i],a[i]);
        temp2.id=++tot,temp2.val=0,add(temp2,a[i],temp2);
        // for(j=0;j<i;j++) add(b[i],b[i],b[i]);
        for(j=0;j<i;j++) add(temp2,temp2,temp2);
        add(temp0,temp0,temp2);
        // fprintf(stderr,"%llu %llu %llu %llu\n",a[i].val,temp0.val,temp2.val,A.val);
        // fprintf(stderr,"%llu\n",a[i].val);
    }
    // temp0.id=++tot,temp1.id=++tot;
    // for(i=maxlog-1;i>=0;i--)
    // {
    //     add(temp1,temp0,pw[i]);
    //     cmp(b[i],temp1,B);
    //     temp2.id=++tot,temp2.val=0,add(temp2,b[i],temp2);
    //     // for(j=0;j<i;j++) add(b[i],b[i],b[i]);
    //     for(j=0;j<i;j++) add(temp2,temp2,temp2);
    //     add(temp0,temp0,temp2);
    //     // fprintf(stderr,"%llu\n",b[i].val);
    // }
    temp0.id=++tot,temp1.id=++tot,temp0.val=0;
    for(i=maxlog-1;i>=0;i--)
    {
        add(temp1,temp0,pw[i]);
        cmp(b[i],temp1,B);
        // for(j=0;j<i;j++) add(a[i],a[i],a[i]);
        temp2.id=++tot,temp2.val=0,add(temp2,b[i],temp2);
        // for(j=0;j<i;j++) add(b[i],b[i],b[i]);
        for(j=0;j<i;j++) add(temp2,temp2,temp2);
        add(temp0,temp0,temp2);
        // fprintf(stderr,"%llu %llu %llu %llu\n",b[i].val,temp0.val,temp2.val,B.val);
        // fprintf(stderr,"%llu\n",b[i].val);
    }
    temp0.id=++tot,temp1.id=++tot;
    // for(i=0;i<maxlog;i++) add(b[i],b[i],pw[0]);
    for(i=0;i<maxlog;i++)
        for(j=0;j<maxlog;j++)
        {
            // if(a[i].val && b[j].val) fprintf(stderr,"%d %d\n",i,j);
            add(temp1,a[i],b[j]);
            cmp(temp1,pw[0],temp1);
            // cmp(temp1,temp0,a[i]);
            // cmp(temp1,temp1,b[j]);
            // fprintf(stderr,"%llu %llu %llu\n",a[i].val,b[j].val,temp1.val);
            for(k=0;k<i+j;k++)
                add(temp1,temp1,temp1);
            add(C,C,temp1);
            // if(temp1.val) fprintf(stderr,"%llu\n",temp1.val);
        }
    // for(i=0;i<maxlog;i++)
    //     fprintf(stderr,"%llu\n",a[i].val);
// #ifdef DEBUG
    // assert(C.val==56088);
    fprintf(stderr,"%llu\n",C.val); //56088
// #endif
    return 0;
}

Measured memory_bytes: 3692
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#include <numeric>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
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() {
    ll N, D; cin >> N >> D;
    int ans = 0;
    rep(i, N) {
        ll x, y;
        cin >> x >> y;
        ll d= x * x + y * y;
        if (d <= D * D) {
            ans++;
        }
    }
    cout << ans << endl;
}


  

























Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (n); i++)
#define RREPS(i, n) for (int i = (n); i > 0; i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if (A > B) swap(A, B);
  if (B > C) swap(B, C);
  REP(i, K) C *= 2;
  cout << A + B + C << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int x1,x2,x3,x4,x5;
 cin >> x1 >> x2 >> x3 >> x4 >> x5;
 if(x1==0)
 cout << "1";
 else if(x2==0)
 cout << "2";
 else if(x3==0)
 cout << "3";
 else if(x4==0)
 cout << "4";
 else
 cout << "5";
 return 0;
}

Measured memory_bytes: 3624