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

#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n" 
#define all(c) c.begin(),c.end()
#define present(c,element) (c.find(element)!=c.end())
#define cpresent(c,element) (find(c,element)!=c.end())
const long double pi=3.14159265358979323846;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll mod=1e9+7;



int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int test=1;
//cin>>test;
while(test--)
{

	int a,b,h,m;
	cin>>a>>b>>h>>m;
	long double ang=h*30-5.5*m;
	ang*=pi/180;
	long double ans=sqrt(a*a+b*b-2*a*b*cos(ang));
	cout<<fixed<<setprecision(10)<<ans<<endl;


}
return 0;
}










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

using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  for(int i = 0; i < n; i++) cin >> l[i];
  sort(l.begin(), l.end(), greater<int>());
  int ans = 0;
  for(int i = 0; i < k; i++) ans += l[i];
  cout << ans << endl;
}

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

int main() {
    int n, k, u, v;
    int G[100][100];
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) G[i][j] = 0; 
    }
    for (int i=0; i<n; i++) {
        cin >> u >> k;
        u--;
        for (int j=0; j<k; j++) {
            cin >> v;
            v--;
            G[u][v] = 1;
        }
    }
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            if ( j ) cout << " ";
            cout << G[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        int b = sc.NextInt();
        int c = sc.NextInt();
        int d = sc.NextInt();
        int e = sc.NextInt();
        int f = sc.NextInt();

        var dp = new bool[f + 1, f + 1];
        dp[0, 0] = true;
        for (int i = 0; i <= f; i++)
        {
            for (int j = 0; j <= f; j++)
            {
                if (dp[i, j])
                {
                    if (i + a <= f) dp[i + a, j] = true;
                    if (i + b <= f) dp[i + b, j] = true;
                    if (j + c <= f) dp[i, j + c] = true;
                    if (j + d <= f) dp[i, j + d] = true;
                }
            }
        }

        long m = 0;
        long sugar = 0;

        for (int i = 0; i <= f; i++)
        {
            for (int j = 0; j <= f; j++)
            {
                // j <= i * F
                if (j > i * e) continue;
                if (i * 100 + j > f) continue;
                if (!dp[i, j]) continue;

                // s / m < j / (i+j)
                if (m == 0 || sugar * (i * 100 + j) < m * j)
                {
                    m = i * 100 + j;
                    sugar = j;
                }
            }
        }

        Console.WriteLine($"{m} {sugar}");
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 34748
from fractions import gcd

def solve(p, q, a, n, l=1):
    ans = 1 if p==1 and q<=a and q>=l else 0
    denom = max(l, q//p)
    p_denom = denom*p
    while n*q >= p_denom and denom <= a:  #n/denom >= p/q:
        p_, q_ = p_denom-q, q*denom
        if p_ <= 0:
            denom += 1
            p_denom += p
            continue
        gcd_ = gcd(p_, q_)
        p_ //= gcd_
        q_ //= gcd_
        if n==2 and p_==1 and q_*denom<=a and q_>=denom:
            ans += 1
        else:
            ans += solve(p_, q_, a//denom, n-1, denom)
        denom += 1
        p_denom += p
    #print(p, q, a, n, l, ans)
    return ans

while True:
    p, q, a, n = map(int, input().split())
    if p==q==a==n==0:
        break
    gcd_ = gcd(p, q)
    p //= gcd_
    q //= gcd_
    if n==1:
        print(1 if p==1 and q<=a else 0)
    else:
        print(solve(p, q, a, n))



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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(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 pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll int n;
  cin >> n;
  int ans = 999;
  for(ll int i = 1; i * i <= n; i++){
	if(n % i != 0) continue;
	ll int a = n / i;
	ll int b = i;
	//	cout << a << " " << b << endl;
	ans = min(ans, max(((int)log10(a)+1), ((int)log10(b)+1)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())

l = [1]
for i in range(1,12):
    l.append(26**i + l[i-1])
for i in range(12):
    if l[-(i+1)] > N:
        continue
    else:
        order = 12 - i
        break
a = []
for i in range(order):
    a.append(26**i)

n = N - l[order-1]
s = ""
for i in range(order):
    s += ( chr( ord("a") + (n // a[-(i+1)]) ) )
    n -= a[-(i+1)] * (n // a[-(i+1)])

print(s)

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

using EDGE = vector<vector<pair<ll, ll>>>;

void dfs(ll node, ll dist, vector<ll>& colors, const EDGE& edges)
{
    if (colors[node] != -1) {
        return;
    }

    colors[node] = (dist % 2 == 0) ? 1 : 0;

    for (auto p : edges[node]) {
        dfs(p.first, dist + p.second, colors, edges);
    }
}

void main_()
{
    ll N;
    cin >> N;
    EDGE edges(N + 1, vector<pair<ll, ll>>());
    for (ll i = 0; i < N - 1; i++) {
        ll u, v, w;
        cin >> u >> v >> w;
        edges[u].emplace_back(v, w);
        edges[v].emplace_back(u, w);
    }

    vector<ll> colors(N + 1, -1);
    dfs(1, 0, colors, edges);

    copy(begin(colors) + 1, end(colors), ostream_iterator<ll>(cout, "\n"));
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 9984
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final String s = scanner.nextLine();

    System.out.println(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5) ? "Yes" : "No");
  }
}

Measured memory_bytes: 21844
using System;

namespace Volume0_0001_List_of_Top_3_Hills
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] Input;
            Input = new string[10];
            int[] High;
            High = new int[10];

            int i;

            for (i = 0; i < 10; i++)
            {
                Input[i] = Console.ReadLine();
                High[i] = int.Parse(Input[i]);
            }
            Array.Sort(High);
            for (i = 1; i <= 3; i++)
            {
                Console.WriteLine("{0}", High[10 - i]);
            }
        }
    }
}

Measured memory_bytes: 9284
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;


int main() {
	string s;
	cin >> s;
	int start = s.find("A");
	int end = s.rfind("Z");
	print(end-start + 1);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if((a<=c&&c<=b)||(b<=c&&c<=a)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
}


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

void show(int A[],int N)
{
	for (int i=0;i<N;i++)
	{
	if (i>0)  cout<<" ";
	    cout<<A[i];
	}
	cout<<endl; 
}

int main (void)
{
	int N;
	cin>>N;
	int *A=new int [N];
	for (int i=0;i<N;i++)
	    cin>>A[i];
	int temp,j;
	for (int i=0;i<N;i++)
	{
		j=i-1;
		temp=A[i];
		while (j>=0&&A[j]>temp)
		{
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=temp;
		show(A,N);
	}
	delete[]A;
	return 0;
}


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

using namespace std;

const int INF = 1 << 30;
const std::vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};

template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W;
  cin >> H >> W;
  int sy, sx, gy, gx;
  cin >> sy >> sx >> gy >> gx;
  sy--, sx--, gy--, gx--;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  deque<pair<int, int>> que;
  que.push_front(make_pair(sy, sx));
  vector dist(H, vector(W, INF));
  dist[sy][sx] = 0;
  while (!que.empty()) {
    auto [y, x] = que.front();
    que.pop_front();
    for (int i = 0; i < 4; i++) {
      int ny = y + dy[i], nx = x + dx[i];
      if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
      if (S[ny][nx] == '#') continue;
      if (chmin(dist[ny][nx], dist[y][x])) {
        que.push_front(make_pair(ny, nx));
      }
    }
    for (int i = -2; i < 3; i++) {
      for (int j = -2; j < 3; j++) {
        int ny = y + i, nx = x + j;
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if (S[ny][nx] == '#') continue;
        if (chmin(dist[ny][nx], dist[y][x] + 1)) {
          que.push_back(make_pair(ny, nx));
        }
      }
    }
  }
  if (dist[gy][gx] == INF) {
    cout << -1 << '\n';
  } else {
    cout << dist[gy][gx] << '\n';
  }
  return 0;
}


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

using namespace std;

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

    X = N - (N / 10) * 10;

    switch (X) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }

}

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

int main() {
    ll s = 0;
    cin >> s;
    vector<ll> dp(2001, 0);
    dp[3] = 1;
    for(int i = 4; i <= s; i++) 
        dp[i] = (dp[i-1] + dp[i-3]) % 1000000007;
    cout << dp[s] << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv){
	unsigned char str[1001],p[1001],cmd[8],tmp;
	short a,b,q,i;

	// Input str q
	scanf("%1000s%hd",str,&q);

	// Input & Execute
	while(q-- > 0 ){
		scanf("%7s%hd%hd",cmd,&a,&b);
		if( strcmp(cmd, "print") == 0 ) {
			tmp = str[b+1];
			str[b+1]= '\0';
			puts(str+a);
			str[b+1] = tmp;
		} else if( strcmp(cmd, "reverse") == 0 ){
			memcpy( p, str+a, b-a+1 );
			for(i=0;i<b-a+1;i++){
				str[a+i] = p[b-a-i];
			}
		} else if( strcmp(cmd, "replace") == 0 ){
			scanf("%1000s",p);
			memcpy( str+a, p, b-a+1 );
		}
	}

	return 0;
}

Measured memory_bytes: 608
#include<stdio.h>
#include<math.h>

int main(){
    int a, b, c;
    char op;
    
    while(1){
        scanf("%d %c %d", &a, &op, &b);
        if(op == '+'){
            c = a + b;
        } if(op == '-'){
            c = a - b;
        } if(op == '*'){
            c = a * b;
        } if(op == '/'){
            c = a / b;
        } if(op == '?'){
            break;
        }
        printf("%d\n", c);
    }
    return 0;
}


Measured memory_bytes: 2736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC166C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);
            string[] H = Console.ReadLine().Split(' ');
            int[] A = new int[M];
            int[] B = new int[M];
            for(int i = 0; i < M; i++)
            {
                string[] AB = Console.ReadLine().Split(' ');
                A[i] = int.Parse(AB[0]);
                B[i] = int.Parse(AB[1]);
            }
            int ha = 0;
            int hb = 0;
            int[] yoi = new int[N];
            for(int i = 0; i < M; i++)
            {
                ha = int.Parse(H[A[i]-1]);
                hb = int.Parse(H[B[i]-1]);
                if (ha > hb)
                {
                    yoi[B[i]-1] -= 1;
                }
                else if (ha < hb)
                {
                    yoi[A[i]-1] -= 1;
                }
                else
                {
                    yoi[A[i]-1] -= 1;
                    yoi[B[i]-1] -= 1;
                }

            }
            int count = 0;
            for(int i = 0; i < N; i++)
            {
                if (yoi[i] == 0)
                {
                    count += 1;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 48636
n, m = map(int, input().split())
p = list(range(n+1))
x = [0]*(n+1)
def find(i):
    if p[i] == i:
        return i
    p[i], x[i] = find(p[i]), x[i]+x[p[i]]
    return p[i]
for _ in range(m):
    l, r, d = map(int, input().split())
    pl = find(l)
    pr = find(r)
    if pl == pr and x[r]-x[l] != d:
        print('No')
        break
    else:
        p[pr] = pl 
        x[pr] = x[l] + d - x[r]
else:
    print('Yes')

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

int main(){
    int n, l, r; string s;
    cin >> n; l = n/100; r = n%100;
    if(l && l <13){
        if(r && r < 13) s = "AMBIGUOUS";
        else s = "MMYY";
    }else{
        if(r && r < 13) s = "YYMM";
        else s = "NA";
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque

N = int(input())

pos = deque()
neg = deque()
zeros = 0

for a in map(int, input().split()):
    if a == 0:
        zeros += 1
    else:
        if a > 0:
            pos.append(a)
        else:
            neg.append(a)

for _ in range(zeros):
    if len(pos) == 0:
        pos.append(0)
    else:
        neg.append(0)

pos = sorted(pos)
neg = sorted(neg)
ops = deque()


if len(pos) > 0:
    p0 = pos.pop()
else:
    p0 = neg.pop()

if len(neg) > 0:
    n0 = neg.pop()
else:
    n0 = pos.pop(0)

plast = p0
for n in neg:
    ops.append((plast, n))
    plast = plast - n

nlast = n0
for p in pos:
    ops.append((nlast, p))
    nlast = nlast - p

ops.append((plast, nlast))
m = plast - nlast

print(m)
for x, y in ops:
    print(str(x) + " " + str(y))



Measured memory_bytes: 20104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Itr(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define setp(n) fixed << setprecision(n)
#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define All(a) (a.begin()),(a.end())
#define rAll(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll t,x;
	cin>>t>>x;
	cout<<setp(12)<<(lf)t/x<<endl;
	return 0;
}

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

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

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;
    int K;
    cin >> S >> K;

    int N = S.size();
    vector<int> s(N);
    REP(i, N) s[i] = S[i] - '0';

    function<int(int, int, bool)> f = [&](int i, int k, bool less) {
        if (k == K) {
            return 1;
        }
        if (i >= N) {
            return 0;
        }
        if (less) {
            return f(i + 1, k, true) + 9 * f(i + 1, k + 1, true);
        } else {
            if (s[i] > 0) {
                return f(i + 1, k, true) + (s[i] - 1) * f(i + 1, k + 1, true) + f(i + 1, k + 1, false);
            } else {
                return f(i + 1, k, false);
            }
        }
    };

    cout << f(0, 0, false) << endl;

    return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int a, b, ans = INF;
    cin >> a >> b;
    for(int i = 0; i < 20000; i++){
        if(i * 8 / 100 == a && i * 10 / 100 == b){
            ans = i;
            break;
        }
    }
    cout << (ans != INF? ans : -1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
/*
----------- usage ---------------------------------------
UnionFind uf(N); --- n個の要素を全て根として初期化
uf.merge(a, b); --- aとbが属するグループを併合
uf.issame(a, b) --- aとbが同じグループに属しているかを確認
uf.size(x); --- xが属するグループに含まれる要素数
---------------------------------------------------------
*/

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.merge(a, b);
    }
    int b = 0;
    rep(i, n){
        b = max(b, uf.size(i));
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
int a[200010];
signed main(){
  int n;cin>>n;
  rep(i,n)cin>>a[i];
  sort(a,a+n,greater<int>());
  int ans=0;
  rep(i,n){
    if(i>=1)ans+=a[i/2];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e18;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,X,T;
    cin >> N >> X >> T;
    cout << (N+X-1)/X*T << endl;
}


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

using namespace std;

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

    int l = (N-1)*(N-2)/2;
    if(K > l) {
        cout << -1 << endl;
        return 0;
    }

    cout << N - 1 + l - K << endl;
    
    for(int i = 2; i <= N; i++) {
        cout << 1 << " " << i << endl;
    }

    int k = 0;
    for(int i = 2; i <= N; i++) {
        for(int j = i+1; j <= N; j++) {
            k++;

            if(k > K) {
                cout << i << ' ' << j << endl;
            }
        }
    }

}

Measured memory_bytes: 256
N, K = map(int, input().split())
p = list(map(int, input().split()))
fac = [0] * 735477
fac[0] = 1
if (N >= 1):
    for i in range(1, 1010): fac[i] = i + 1 + fac[i - 1]
# 期待値
#print(p, fac[:max(p)])
exp = [0] * 735477
for i in range(N):
    exp[i] = fac[p[i] - 1] / p[i]
# print(exp)

Ans = 0
ans = [0] * 735477
ans[0] = sum(exp[:K])
for i in range(1, N - K + 1):
    if(i + K == N + 1): break
    ans[i] = ans[i - 1] - exp[i - 1] + exp[i + K - 1]
    # print(ans[i])
    #print(exp[i: i + K])
print(max(ans))


Measured memory_bytes: 113972
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int h, w; cin >> h >> w;
  vector<vector<char> > s(h, vector<char>(w)); REP(i, h) REP(j, w) cin >> s[i][j];
  vector<vector<bool> > used(h, vector<bool>(w, false));
  long long ans = 0;
  REP(i, h) REP(j, w) if (!used[i][j]) {
    used[i][j] = true;
    long long dot = 0, sharp = 0;
    if (s[i][j] == '.') ++dot;
    else ++sharp;
    queue<pair<int, int>> que;
    que.push({i, j});
    while (!que.empty()) {
      auto a = que.front(); que.pop();
      int old_y = a.first, old_x = a.second;
      REP(k, 4) {
        int y = old_y + dy[k], x = old_x + dx[k];
        if (0 <= y && y < h && 0 <= x && x < w && !used[y][x] && s[y][x] != s[old_y][old_x]) {
          used[y][x] = true;
          if (s[y][x] == '.') ++dot;
          else ++sharp;
          que.push({y, x});
        }
      }
    }
    ans += dot * sharp;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int n,t[101],m,p,x,sum,temp;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> t[i];
	cin >> m;
	for(int i = 0; i < m; i++){
		cin >> p >> x;
		temp = t[p-1];
		t[p-1] = x;
		sum = 0;
		for(int i = 0; i < n; i++) sum += t[i];
		cout << sum << endl;
		t[p-1] = temp;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
    SPEED;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int dp1[n][n],dp2[n][n];
    memset(dp1,0,sizeof(dp1));
    memset(dp2,0,sizeof(dp2));
    for(int i=0;i<n;i++)
    {
        dp1[i][i]=a[i];
    }
    for(int dif=1;dif<n;dif++)
    {
        for(int i=0;i<n-dif;i++)
        {
            dp1[i][dif+i]=max(dp2[i][dif+i-1]+a[dif+i],dp2[i+1][dif+i]+a[i]);
            dp2[i][dif+i]=min(dp1[i][dif+i-1],dp1[i+1][dif+i]);
        }
    }
    cout<<dp1[0][n-1]-dp2[0][n-1];
}

Measured memory_bytes: 144176
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
using namespace std;
#define N 100005
typedef long long ll;

int a[N],d[N];
ll ans=0;

int main(){
    int n,q,b,c,i;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a[i];
        ans+=a[i];
        d[a[i]]++;
    }
        
    cin>>q;
    while(q--){
        cin>>b>>c;
        ans+=d[b]*(c-b);
        d[c]+=d[b];
        d[b]=0;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 4416
package main

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

func main() {
  stdin := bufio.NewScanner(os.Stdin)
  stdin.Scan()
  text := stdin.Text()
  
  inputs := strings.Fields(text)
  
  nStr := inputs[0]
  n, _ := strconv.Atoi(nStr)
  
  dStr := inputs[1]
  d, _ := strconv.Atoi(dStr)
  
  nop := n / (2 * d + 1)
  if n % (2 * d + 1) > 0 {
    nop++
  }
  
  fmt.Println(nop)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if(n%4==0||n%7==0||n%11==0)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	int p=n;
	while(n>=4)
	{
		n-=7;
		if(n%4==0||n%7==0||n%11==0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	while(p>=4)
	{
		p-=4;
		if(p%4==0||p%7==0||p%11==0){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{
    int sum=0;
    for(int i=0;i<5;i++)
    {
        int a;
        scanf("%d",&a);
        sum=sum+a;
    }

    printf("%d\n",15-sum);

    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <stdio.h>

using namespace std;

int main() {
    int n;
    cin>>n;
    vector<int> x(n);
    vector<int> y(n);
    for(int i=0;i<n;i++) cin>>x.at(i)>>y.at(i);
    double total=0;
    double tmp;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            tmp = (x.at(i)-x.at(j))*(x.at(i)-x.at(j))+(y.at(i)-y.at(j))*(y.at(i)-y.at(j));
            total += pow((double)tmp,0.5);
        }
    }
    printf("%.10f",(double)total*2/n);
}   



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

#define ll long long
#define mp make_pair
#define pb push_back

string s[3];
int lcp[3][3][4005][4005];

void build_lcp(int a, int b) {
	for (int i = s[a].size() - 1; ~i; -- i)
		for (int j = s[b].size() - 1; ~j; -- j)
			if (s[a][i] == s[b][j] || s[a][i] == '?' || s[b][j] == '?')
				lcp[a][b][i][j] = lcp[a][b][i + 1][j + 1] + 1;
}

int main() {
	ios :: sync_with_stdio(0);
	cin >> s[0] >> s[1] >> s[2];
	for (int i = 0; i < 3; ++ i) for (int j = 0; j < 3; ++ j) if (i != j) build_lcp(i, j);
	int id[3]; for (int i = 0; i < 3; ++ i) id[i] = i;
	int ans = 1e9;
	do {
		int a = id[0], b = id[1], c = id[2];
		int asiz = s[a].size();
		int bsiz = s[b].size();
		int csiz = s[c].size();
		int sa = 0;
		for (int sb = 0; sb <= asiz; ++ sb) {
			for (int sc = b; sc <= sb + bsiz || sc <= asiz; ++ sc) {
				if (sb - sa < asiz && lcp[a][b][sb - sa][0] < min(asiz - sb + sa, bsiz)) continue;
				if (sc - sb < bsiz && lcp[b][c][sc - sb][0] < min(bsiz - sc + sb, csiz)) continue;
				if (sc - sa < asiz && lcp[a][c][sc - sa][0] < min(asiz - sc + sa, csiz)) continue;
				ans = min(ans, max(sa + asiz, max(sb + bsiz, sc + csiz)));
			}
		}
	} while (next_permutation(id, id + 3)) ;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 200960
n,ma,mb = map(int,input().split())
l = []
sum_a = 0
sum_b = 0
for _ in range(n):
    a,b,c = map(int,input().split())
    sum_a += a
    sum_b += b
    l.append([a,b,c])

INF = 10**10
dp = list( list([INF for i in range(450)] for i in range(450)) for i in range(45))
dp[0][0][0] = 0
for i in range(n):
    for s in range(sum_a+1):
        for k in range(sum_b+1):
            a,b,c = l[i]
            dp[i+1][s][k] = min(dp[i][s][k], dp[i+1][s][k],dp[i][s-a][k-b]+c)

ans = 10**10
k = 1
while ma*k < 450 and mb*k < 450 :
    ans = min(ans, dp[n][ma*k][mb*k])
    k += 1
if ans != 10**10:
  print(ans)
else:
  print(-1)


Measured memory_bytes: 144468
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007
#define mp make_pair
  int main()
  {
     FASTIO;
    ll s,w;
    cin>>s>>w;
    if(w>=s)
    cout<<"unsafe";
    else
    cout<<"safe";
     }

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long N;
    cin >> N;
    int sum = 0;
    for (long long i = 2; i*i <= N; i++) {
        int j = 0;
        while (N%i==0) {
            j += 1;
            N /= i;
        }
        if (j > 0) {
            int k = 1;
            while (j >= k) {
                sum += 1;
                j -= k;
                k++;
            }
        }
    }
    if (N > 1) {
        sum += 1;
    }
    cout << sum;
}


Measured memory_bytes: 3656
N, M = map(int, input().split())
a = []
ans = -1
MOD = 10 ** 9 + 7
if N == 1:
    ans = 1
else:
    if M > 0:
        a += [int(input())]
    for i in range(M - 1):
        a += [int(input())]
        if a[i + 1] - a[i] == 1:
            ans = 0
            break
    a.append([-1])
if not ans in [0, 1]:
    memo = [0] * (N + 1)
    memo[0] = 1
    if a[0] == 1:
        memo[1] = 0
        j = 1
    else:
        memo[1] = 1
        j = 0
    for i in range(N - 1):
        if i + 2 == a[j]:
            j += 1
            continue
        memo[i + 2] = memo[i] + memo[i + 1]
        memo[i + 2] = memo[i + 2] % MOD
    else:
        ans = memo[i + 2]
print(ans)

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

using namespace std;

int n,a;
bool valid=1;

int main()
{
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>a;
        if (a%2==0)
        {
            if (a%3==0 || a%5==0)
            {
                continue;
            }
            else
            {
                cout<<"DENIED";
                valid=0;
                break;
            }
        }
        else
        {
            continue;
        }
    }
    if (valid ==1)
    {
        cout<<"APPROVED";
    }
    return 0;
}


Measured memory_bytes: 256
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n,m;
    scanf("%d%d",&n,&m);
    if (n>m) swap(n,m);
    long long ans=0;
    if (n==1)
    {
        if (m==1)
        {
            ans=1;
        }
        else
        {
            ans=m-2;
        }
    }
    else
    {
        ans=(long long)(n-2)*(m-2);
    }
    cout<<ans<<endl;
    return 0;
} 


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

X,Y = map(int,readline().rstrip().split())
for c in range(X+1):
    t = X-c
    sum = 2*c+4*t
    if sum == Y:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 9188
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,ans;
string s;
map<string,ll> mp;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        mp[s]++;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>s;
        mp[s]--;
    }
    for(auto x:mp){
        ans=max(ans,x.second);
    }
    cout<<ans<<endl;
}


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


void solve(long long A, long long B){
	long long res;
	res = -99999999999;
	res = std::max(res, A+B);
	res = std::max(res, A*B);
	res = std::max(res, A-B);
	cout << res << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    set<ll> st;
    rep(i, n) {
        cin >> a[i];
        st.insert(a[i]);
    }

    if(st.size() == n) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }


    return 0;
}

Measured memory_bytes: 11264
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll N;
    cin >> N;
    string S;
    cin >> S;

    VL cnte(N,0), cntw(N,0);
    ll ce=0, cw=0;
    rep(i,0,N){
        if(i!=0)cnte[i]=ce;
        if(i!=0)cntw[i]=cw;
        
        if(S[i]=='E')ce++;
        else if(S[i]=='W')cw++;
    }
    cnte[N-1]=ce;
    cntw[N-1]=cw;
    ll ans=INF;
    rep(i,0,N-1){
        ll tmp = cntw[i];
        tmp += cnte[N-1] - cnte[i+1];
        ans = min(tmp, ans);
    }
    ll lst = cntw[N-1];
    ans = min(lst, ans);
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N;  cin>>N;
    vector<int> a(N,0);
    int count=1,ans=0;
    bool can=false;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]==1)can=true;    //１がある＝-1出力しない
        if(a[i]==count){
            count++;
        }
        else{
            ans++;
        }
    }

    if(!can){
        cout<<-1;
    }
    else{
        cout<<ans;
    }

    return 0;
}

Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%d", $A);
fscanf(STDIN, "%d", $B);
fscanf(STDIN, "%d", $C);
fscanf(STDIN, "%d", $D);
fscanf(STDIN, "%d", $E);
$input_arr = array($A, $B, $C, $D, $E);

$flag = True;
foreach($input_arr as $value){
    if ($value % 10!= 0){
        $flag = False;
    }
}
if ($flag){
    echo array_sum($input_arr);
    die();
}

$minimum = 9;
$ans = 0;
foreach($input_arr as $value){
    if ($minimum % 10 > ($value % 10)){
        if (($value % 10) > 0){
            $minimum = $value;
        }
    }
}
#echo $minimum;
foreach($input_arr as $value){
    $ans += ceil($value / 10) * 10;
}
$ans -= ceil($minimum / 10) * 10;
$ans += $minimum;
echo $ans;

Measured memory_bytes: 3828
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  [n, m] <- getl $ wrds toInt
  unless ( n == 0 && m == 0) $ do
    putStrLn $ solve n m
    main
    
solve :: Int -> Int -> String
solve n m = show r ++ " " ++ show c
  where
    (r, c) = eg (max n m) (min n m) 0

eg :: Int -> Int -> Int -> (Int, Int)
eg x y c
  | y == 0 = (x, c)
  | otherwise = eg y (x `mod` y) (c + 1)

toInt :: String -> Int
toInt s = read s

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4072
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[[]*n for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)
ans=0
for i in range(n):
    if ab[i]:
        flg=0
        for j in ab[i]:
            if h[i]<=h[j]:
                flg=1
                break
        if flg==0:
            ans+=1
    else:
        ans+=1
print(ans) 

Measured memory_bytes: 29428
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#define REP(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define REPN(i,n) for(int(i)=1;(i)<(int)(n);(i)++)
#define _abs(x) ((x)>0?(x):-(x))
#define ll  long long 
using namespace std;   
int main()
{
    double a;
    double b[1001];
    double c;
    double d=0;
    cin>>a;
    for(int i=0;i<a;i++)
    {
        cin>>b[i];
    }
    for(int i=0;i<a;i++)
    {
        c=1/b[i];
        d+=c;
    }
    d=1/d;
    cout<<d;
    return 0;
} 

Measured memory_bytes: 256
// Problem : C - Peaks
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n,m;
		cin>>n>>m;
		int arr[n+1];
		for(int i=1;i<=n;++i)
		cin>>arr[i];
		map<int,vector<int>>mp;
		for(int i=0;i<m;++i)
		{
			int l,r;
			cin>>l>>r;
			mp[l].pb(r);
			mp[r].pb(l);
		}
		int ans = 0;
		for(int i=1;i<=n;++i)
		{
			int xxx = mp[i].size();
			if(!xxx)
			{
				ans++;
				continue;
			}
			int ct = 0;
			for(auto x:mp[i])
			{
				if(arr[i]>arr[x])
				ct++;
			}
			if(ct==xxx)
			ans++;
		}
		cout<<ans;  	
    }
    return 0;
}



Measured memory_bytes: 15688
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,c,h,k,maxi,d,x;
	cin>>n;
	map<ll,ll> m;
	for(i=1;i<=100;i++)
	{
		for(j=1;j<=100;j++)
		{
			for(k=1;k<=100;k++)
			{
				c=i*i+j*j+k*k+i*j+j*k+i*k;
				if(c<=n)
				{
					m[c]++;
				}
			}
		}

	}
	for(i=1;i<=n;i++)
	{
		cout<<m[i]<<endl;
	}
}



	

		

Measured memory_bytes: 4236
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9){
        cout<<"hon\n";
    }else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
        cout<<"pon\n";
    }else{
        cout<<"bon\n";
    }
return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
    double ax,ay,bx,by,cx,cy,dx,dy;
    while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&ax,&ay,&bx,&by,&cx,&cy,&dx,&dy)){
        if(((ax-cx)*(by-ay)+(ay-cy)*(ax-bx))*((ax-cx)*(dy-ay)+(ay-cy)*(ax-dx))<=0&& ((bx-dx)*(ay-by)+(by-dy)*(bx-ax))*((bx-dx)*(cy-by)+(by-dy)*(bx-cx))<=0)printf("YES\n");
        else printf("NO\n");
    }
}

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

int n;
vector<int> b;
queue<int> qu;
vector<int> ans;

void solve();

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    b.push_back(x);
  }
  solve();
  for(int i = 0; i < ans.size(); ++i)
    cout << ans[i] << endl;
  return 0;
}

void solve() {
  vector<int> dummy;
  dummy.push_back(-1);
  while(n > 0) {
    bool ch = 0;
    for(int i = n - 1; i >= 0; --i)
      if(i + 1 == b[i]) {
        ans.push_back(i + 1);
        b.erase(b.begin() + i);
        ch = 1;
        --n;
        break;
      }
    if(!ch) {
      ans = dummy;
      return;
    }
  }
  reverse(ans.begin(), ans.end());
}

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

#define PI 3.14159265358979323846

int main(){
    long double A,B,H,M;
    cin >> A >> B >> H >> M;
    long double L=A*A+B*B-2*A*B*cos((30.0*H-11.0*M/2.0)*PI/180.0);
    long double r=sqrt(L);
    cout << fixed << setprecision(12) <<r <<endl;
    return 0;
}

Measured memory_bytes: 4132
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n) ; i++ )
using ll = long long;

using namespace std;
int main(){
    int n;cin>>n;

    vector<int> L(n);

    for(auto & e: L ){
        cin >> e;
    }
    sort(L.begin(),L.end());
    int ans=0;
    rep(j,L.size()){
        rep(i,j){
            int l2 = L[i]+L[j];
            int r = lower_bound(L.begin(),L.end(),l2) - L.begin();
            int l = j+1;
            ans += max(0,r-l);
        }
    }

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

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

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int a = fs.nextInt();
		int b = fs.nextInt();
		int c = fs.nextInt();
		int k = fs.nextInt();
		if (k < a) {
			System.out.println(k);
		} else if (k < a + b) {
			System.out.println(a);
		} else {
			System.out.println(2 * a + b - k);
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

struct activity{
    int A,B,C;
};

int solve(vector<activity> ar,int n){
    
   int dp[n+1][3];
    dp[1][0]=ar[1].A;
    dp[1][1]=ar[1].B;
    dp[1][2]=ar[1].C;
    
    for(int i=2;i<=n;i++){
        dp[i][0]=ar[i].A+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=ar[i].B+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=ar[i].C+max(dp[i-1][0],dp[i-1][1]);
    }
    
    return max(dp[n][0],max(dp[n][1],dp[n][2]));
}

int main() {
	// your code goes here
	int n;
	cin>>n;
	vector<activity> ar(n+1);
	for(int i=1;i<=n;i++){
	    cin>>ar[i].A;
	    cin>>ar[i].B;
	    cin>>ar[i].C;
	    
	}
	
	cout<<solve(ar,n)<<endl;
	return 0;
}


Measured memory_bytes: 6704
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
int main(){
    int a[3],temp=0;
    std::cin >> a[0] >> a[1] >> a[2];
    for(int i=0;i<2;i++){
        if(a[i]>a[i+1]){
            temp = a[i];
            a[i]=a[i+1];
            a[i+1]=temp;
        }
    }

    if(a[0]==a[1]&&a[1]==a[2]){
        std::cout << 0 << std::endl;
        return 0;
    }else if(a[0]<a[1]&&a[1]==a[2]){
        if((a[2]-a[0])%2==0){
            std::cout << (a[2]-a[0])/2 << std::endl;
            return 0;
        }else{
            std::cout << (a[2]-a[0]+1)/2+1 << std::endl;
            return 0;
        }
    }else if(a[1]<a[2]&&a[1]==a[0]){
        std::cout << a[2]-a[0] << std::endl;
        return 0;
    }else{
        if((a[1]-a[0])%2==0){
            std::cout << a[2]-a[1]+(a[1]-a[0])/2 << std::endl;
            return 0;
        }else{
            std::cout << a[2]-a[1]+(a[1]-a[0]+1)/2+1 << std::endl;
            return 0;
        }
    }
        
}

Measured memory_bytes: 256