akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            long N = long.Parse(line);

            var PrimeFactor = new List<long>();

            // 素因数分解する
            long sqrtN = (long)Math.Sqrt(N);
            long tmp = N;
            for(long i = 2; i <= sqrtN; i++)
            {
                if (tmp % i == 0)
                {
                    PrimeFactor.Add(i);
                    tmp = tmp / i;
                    i--;
                }
            }
            if (tmp > 1) PrimeFactor.Add(tmp);

            // 各素数が何個ずつあるか調べる(個数のみが重要)
            List<int> PrimeFactorCounts = new List<int>();
            long before = 0;
            int count = 0;
            foreach(var data in PrimeFactor)
            {
                if (before == 0)
                {
                    before = data;
                    count = 1;
                }
                else if (before == data)
                {
                    count++;
                }
                else
                {
                    before = data;
                    PrimeFactorCounts.Add(count);
                    count = 1;
                }
            }
            if (count > 0)PrimeFactorCounts.Add(count);
            // 素数の個数について、1,2,3,4,…と削りながらカウントする
            int ret = 0;
            foreach (var data in PrimeFactorCounts)
            {
                int next = 0;
                for (int i = data; i > next; i -= next)
                {
                    ret++;
                    next++;
                }
            }
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 27852
#include <cstdio>
#include <algorithm>

const int maxn=100;
const int inf=0x3f3f3f3f;

int a[maxn+10],n,x,maxx=inf;

int main()
{
  scanf("%d%d",&n,&x);
  for(register int i=1; i<=n; ++i)
    {
      scanf("%d",&a[i]);
      x-=a[i];
      maxx=std::min(maxx,a[i]);
    }
  printf("%d\n",n+x/maxx);
  return 0;
}


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

int main() {
  int a, b, h, ans;
  cin >> a;
  cin >> b;
  cin >> h;
  ans = ((a+b)*h)/2;
  cout << ans << endl;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    for(int i=0; i<=n; i++){
        if((int)(i*27/25)==n){cout<<i;return 0;}
    }
    cout<<":(";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	string sInput;
	register int i, j;
	while (cin >> sInput){
		for (i = 0; i < sInput.length(); ++i){
			if (sInput[i] == 'A')
				break;
		}
		for (j = sInput.length() - 1; j >= 0; --j){
			if (sInput[j] == 'Z')
				break;
		}
		cout << j - i + 1 << endl;
	}
	endapp:
	//system("pause > nul");
	return 0;
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>=22){
        cout << "bust" << endl;
    }
    else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.readline

N, Q = map(int, input().split())
connections = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    pa, ki = map(int, input().split())
    connections[pa].append(ki)
    connections[ki].append(pa)

scores = [0 for _ in range(N + 1)]
for _ in range(Q):
    tag, p = map(int, input().split())
    scores[tag] += p

i = 1

def dfs(k=1,bef=-1):
    global scores
    global fins
    kids = connections[k]
    if len(kids)==1 and bef==kids[0]:
        return
    for kid in kids:
        # print(f'k:{k} kids:{kids}')
        if bef==kid:
            continue
        scores[kid]+=scores[k]
        dfs(kid,k)


dfs()



print(*scores[1:])

Measured memory_bytes: 268392
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n;
  while(cin >> n, n){
    vector<pii> events(2*n);
    for(int i=0;i<n;i++){
      int m,a,b;
      cin >> m >> a >> b;
      events[2*i] = pii(a,m);
      events[2*i+1] = pii(b,-m);
    }
    sort(events.begin(), events.end());

    int sum = 0;
    bool ans = true;
    for(int i=0;i<2*n;i++){
      sum += events[i].second;
      if(sum > 150)ans = false;
    }

    cout << (ans ? "OK" : "NG") << endl;
  }
}

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

using namespace std;

int main(void){
    long long A, B;
    cin >> A >> B;
    if((A + B) % 2 == 1){
        cout << "IMPOSSIBLE" << endl;
    }else{
        long long ans = (A + B) / 2;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int direction[][] = new int [][]{
			{-1,  0},
			{-1, -1},
			{ 0, -1},
			{ 1, -1},
			{ 1,  0},
			{ 1,  1},
			{ 0,  1},
			{-1,  1}
			,
		};

		String S;
		char ch[][] = new char[H][W];

		for (int i = 0; i < H; i++){
			S = sc.next();
			ch[i] = S.toCharArray();
		}

		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				if (ch[i][j] != '#'){
					int bomb = 0;
					for (int k = 0; k < direction.length; k++){
						int x = i + direction[k][1];
						int y = j + direction[k][0];
						if (x >= 0 && x < H && y >=0 && y <W){
							if (ch[x][y] == '#'){
								bomb ++;
							}
						}
						ch[i][j] = (char)('0' + bomb);
					}
				}
			}
		}
		for (int i = 0; i < H; i++){
			System.out.println(String.valueOf(ch[i]));
		}

	}
}


Measured memory_bytes: 23124
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
    int n;
    char buf[30];

    //標準入力から一行をbufに格納
    fgets(buf, sizeof(buf), stdin);

    n = atoi(buf);
    
    if ((n>10) | (n<1))
    {
        return 0;
    }
    else
    {
        n = n + n * n + n * n * n;
    }
    
    

    //標準入力に書き出す
    printf("%d\n", n);
    return 0;
}

Measured memory_bytes: 1672
inf = 10 ** 8 + 10

n, m = map(int, input().split())

keys = set()

for i in range(m):
    price, _ = map(int, input().split())
    key = 0
    for ind in (int(x) - 1 for x in input().split()):
        key += (1 << ind)
    keys.add((price, key))

dp = [inf] * (1 << n)
dp[0] = 0

for price, key in sorted(keys):
    for mask in range(1 << n):
        dp[mask | key] = min(dp[mask | key], dp[mask] + price)

ans = dp[(1 << n) - 1]
print(ans if ans != inf else -1)


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

int main(){
  int n,ans=0;
  cin >> n;
  int s[n];
  
  for(int i=0; i<n;i++){
  cin >> s[i];
  }
  
  int b=1;
  for(int i=0;i<n;i++){
  if(s[i] != b){ ++ans;}else{++b;}
  }
  if(n != ans){cout << ans << endl;}else{cout << -1 << endl;}
  
}

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

using namespace std;

struct dice{
	vector<int> diceindex{0,1,2,3,4,5};
    vector<int> dicenum{1,2,3,4,5,6};
    
    void setNumber(vector<int> &setnum){
        for(int i = 0; i < 6; i++){
            dicenum[diceindex[i]] = setnum[diceindex[i]];
        }
        return;
    }

    vector<int> getNumber(){
        vector<int> indexed(6);
        for(int i = 0; i < 6; i++)
            indexed[i] = dicenum[diceindex[i]];

        return indexed;
    }

    void roll(char d){
        vector<int> dump = diceindex;
        vector<int> newindex(6);
        switch(d){
            case 'N':{
                vector<int> n{4,0,2,3,5,1};
                newindex = n;
              break;
            }
            case 'S':{
                vector<int> n{1,5,2,3,0,4};
                newindex = n;
              break;
            }
            case 'W':{
                vector<int> n{3,1,0,5,4,2};
                newindex = n;
              break;
            }
            case 'E':{
                vector<int> n{2,1,5,0,4,3};
                newindex = n;
              break;
            }
        }
        for(int i = 0; i < 6; i++){
            diceindex[newindex[i]] = dump[i];
        }
        return;
    }

    vector<int> getAround(int num){
        int pos;
        for(int i = 0; i < 6; i++){
            if(dicenum[i] == num){
                pos = i;
                break;
            }
        }
        vector<int> a;
        switch(pos){
            case 0:{
                vector<int> n{1,2,4,3};
                a = n;
                break;
            }
            case 1:{
                vector<int> n{5,2,0,3};
                a = n;
                break;
            }
            case 2:{
                vector<int> n{0,1,5,4};
                a = n;
                break;
            }
            case 3:{
                vector<int> n{1,0,4,5};
                a = n;
                break;
            }
            case 4:{
                vector<int> n{0,2,5,3};
                a = n;
                break;
            }
            case 5:{
                vector<int> n{1,3,4,2};
                a = n;
                break;
            }

        }
        vector<int> re(4);
        for(int i = 0; i < 4; i++){
            re[i] = dicenum[a[i]];
        }
        return re;
    }
};

int main(){
    vector<int> dicenum(6);
    for(int i = 0; i < 6; i++){
        cin >> dicenum[i];
    }
    dice d;
    d.setNumber(dicenum);
    int q;
    cin >> q;
    for(int z = 0; z < q; z++){
        vector<int> r(2);
        cin >> r[0] >> r[1];
        vector<int> a = d.getAround(r[0]);
        int ans;
        for(int i = 0; i < 4; i++){
            if(a[i] == r[1]){
                ans = a[(i+1)%4];
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3116
use std::io::{self, BufRead};
use std::cmp::min;

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let line = lines.next().unwrap().unwrap();
  let vs: Vec<usize> = line.split(' ').map(|x| x.parse().unwrap()).collect();
  let h = vs[0];
  let w = vs[1];
  let mut map: Vec<Vec<char>> = Vec::new();
  for _ in 0..h {
    let line = lines.next().unwrap().unwrap().chars().collect();
    map.push(line);
  }
  let mut memo: Vec<Vec<i32>> = vec![vec![0; w]; h];
  memo[0][0] = if map[0][0] == '#' { 1 } else { 0 };
  for n in 1..(h+w+1) {
    let i0 = if n < w { 0 } else { n - w + 1 };
    let i1 = if n < h { n } else { h - 1 };
    for i in i0..(i1+1) {
      let j = n - i;
      if i == 0 {
        memo[i][j] = memo[i][j-1] + (if map[i][j-1] == '.' && map[i][j] == '#' { 1 } else { 0 });
      } else if j == 0 {
        memo[i][j] = memo[i-1][j] + (if map[i-1][j] == '.' && map[i][j] == '#' { 1 } else { 0 });
      } else {
        let x = memo[i][j-1] + (if map[i][j-1] == '.' && map[i][j] == '#' { 1 } else { 0 });
        let y = memo[i-1][j] + (if map[i-1][j] == '.' && map[i][j] == '#' { 1 } else { 0 });
        memo[i][j] = min(x, y);
      }
    }
  }
  println!("{}", memo[h-1][w-1]);
}

Measured memory_bytes: 4352
/*************************************************************************
  >         File: D.cc
  >       Author: lyyllyyl
  >         Mail: riho.yoshioka@yandex.com
  > Created Time: Mon 10 Oct 2016 12:51:15 PM CST
*************************************************************************/
#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(0);
  std::string s = "CODEFESTIVAL2016";
  std::string r;
  std::cin >> r;
  int ans = 0;
  for (int i = 0; i < (int) r.size(); ++i) {
    if (r[i] != s[i]) ans++;
  }
  std::cout << ans << std::endl;


  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=a-(2*b);
		if(c>0) System.out.println(c);
		else System.out.println("0");

	}

}


Measured memory_bytes: 27052
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
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<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    string right="CODEFESTIVAL2016",s;cin>>s;
    int ans=0;
    for(int i=0;i<16;i++){
        if(right[i]!=s[i])ans++;
    }
    cout<<ans<<endl;
}


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

int main(){
  int a,b,k,i;
  cin>>k;
  cin>>a>>b;
  rep(i,b-a+1){
    if((a+i)%k==0){
      cout<<"OK";
      return 0;
    }
  }
  cout<<"NG";
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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() {
    int h, w, n;
    cin >> h >> w >> n;
    vector<int> v;
    rep(i, n) {
        int a; cin >> a;
        rep(j, a) v.push_back(i+1);
    }

    rep(i, h*w) {
        int row = i / w + 1;
        if ((i / w) % 2 == 0) {
            cout << v[i] << " ";
        } else {
            cout << v[row*w - i%w - 1] << " ";
        }
        if (i % w == w-1) cout << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define IOS  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define loop (i,n)for(i=0;i<n;i++)
#define INF  1000000000
#define mp   make_pair
#define pb   push_back
using ll =   long long int;
typedef      pair<int,int> pii;
typedef      vector<pii> vii;
typedef      vector<int> vi;
#define f    first
#define s    second
int main()
{
  // freopen("inputfile.txt","r",stdin);
  IOS;
   ll n,k;cin>>n>>k;
   cout<<min(k-(n%k),n%k)<<endl;
   return 0;
}

//..!!ALHAMDULLAH!!..........//


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mkp make_pair

#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n;
    string s="";
    cin >>n;

    if(n == 0){
        puts("0");
        return 0;
    }

    while (abs(n)>0){

        if(n%2 == 0){
            s = "0" + s;
        }else{
            s = "1" + s;
            n -= 1;
        }

        n /= -2;
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << s << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

int main() {
 int N;
 cin >> N;
 string S;
 cin >> S;
 long long r = 0;
 long long g = 0;
 long long b = 0;
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'R') r++;
    else if(S.at(i) == 'G') g++;
    else  b++;
  }
 long long  ans = r*g*b;
 for(int i = 0; i < N; i++){
   for(int j = i+1; j < N; j++){
    int k = j+j-i;
       if(k < N && S.at(i) != S.at(j) && S.at(j) != S.at(k) && S.at(i) != S.at(k)){
          ans--;
         }
       }
     }
   cout << ans << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<P> v(n);
  rep(i, 0, n) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());

  map<P, int> mp;
  rep(i, 0, n) {
    rep(j, i + 1, n) {
      P p = make_pair(v[j].first - v[i].first, v[j].second - v[i].second);
      mp[p]++;
    }
  }

  int ans = 0;
  for (auto m : mp)
    chmax(ans, m.second);
  cout << n - ans << endl;
}


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

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();

        int N = cin.Int();
        var s = new int[N];
        int sum = 0;
        for(int i = 0; i < N; i++)
        {
            s[i] = cin.Int();
            sum += s[i];
        }

        if (sum % 10 != 0) Console.WriteLine(sum);
        else
        {
            var list = new List<int>();
            for(int i = 0; i < N; i++)
            {
                if (s[i] % 10 != 0) list.Add(s[i]);
            }
            list.Sort();
            if (list.Count == 0) Console.WriteLine(0);
            else Console.WriteLine(sum - list[0]);
        }

        Console.ReadLine();
    }
}

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 Int()
    {
        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] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        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] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        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] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <math.h>
int a[10],i,n,s;
int summing(int n,int s){
	int ans=0,i,max=0,min=0,m;
	if(n==1){if(s<10 && a[s]==1)return 1; else return 0;}
	else{
		for(i=0,m=n;m>0 && i<10;i++){if(a[i]==1){min+=m*i;m--;}}
		for(i=9,m=n;m>0 && i>=0;i--){if(a[i]==1){max+=m*i;m--;}}
		if(s<min || max<s)return 0;
		//for(i=0;i<10;i++){printf("%d",a[i]);}
		for(i=0;i<10;i++){
			if(a[i]==1 && n*i<=s){
				if(n==2){
					m=s-i*2;
					if(m>=0 && m<10 && i!=m && a[m]==1)ans++;
				}
				else{
					a[i]=0;
					ans+=summing(n-1,s-n*i);
					a[i]=1;
				}
			}
		}
		//printf("%d,%d\n",n,ans);
		return ans;
	}
}
int main(void){
	for(i=0;i<10;i++)a[i]=1;
	while(scanf("%d %d",&n,&s)!=EOF){printf("%d\n",summing(n,s));}
	return 0;
}

Measured memory_bytes: 600
n = int(input())
raw = []
for _ in range(n):
  raw.append(list(map(int,input().split())))
for i in range(n-2):
  if raw[i][0] == raw[i][1] and raw[i+1][0] == raw[i+1][1] and raw[i+2][0] == raw[i+2][1]:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 62360
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <unordered_map>
#include <list>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = 998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)
#define FORD(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)
#define pll pair<ll, ll>
#define ln endl
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll lcm(ll a, ll b){
    return (a * b) / gcd(a, b);
 }
ll power1(ll a, ll b){
     ll out = 1;
     while(b){
        if(b & 1){
            out *= a;
        }
        b >>= 1;
        a *= a;
     }
     return out;
}
ll power2(ll a, ll b, ll m){
     a %= m;
     ll out = 1;
     while(b){
        if(b & 1){
            out *= a;
            out %= m;
        }
        b >>= 1;
        a = (a * a) % m;
     }
     return out;
}
ll modi(ll x, ll p){
    return power2(x, mod1 - 2, mod1);
}
int main(){
    fast;
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        ll n;
        cin >> n;
        ll q = power1(10, 18);
        ll o = 1;
        bool pos = 0;
        bool qwe = 0;
        for(int i = 0; i < n; i++){
            ll x;
            cin >> x;
            if(x == 0){
                qwe = 1;
                continue;
            }
            if(o == 0){
                continue;
            }
            if(x <= q / o){
                o *= x;
            }
            else{
                pos = 1;
            }
        }
        if(pos && !qwe){
            cout << -1 << endl;
        }
        else if(qwe){
            cout << 0 << endl;
        }
        else{
            cout << o << endl;
        }
    }
}

Measured memory_bytes: 3664
/*
@Author
   Sujeet Kushwaha
*/
 
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define endl "\n"
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
ll mul(ll a,ll b)
{
	if(a>mod)
	 a-=mod;
	if(b>mod)
	 b-=mod;
	return (a%mod*b%mod)%mod;
}
ll add(ll a,ll b)
{
	ll res=a+b;
	if(res>=mod)
	{
      res-=mod;
	}
	return res;
}
// // ll sub(ll a,ll b)
// // {
// // 	ll res=a-b;
// // 	if(res<0)
// // 	 res+=mod;
// // 	return res;
// // }
ll powmod(ll a, ll b)
{
    ll res = 1;
    while (b) {
        if (b&1) {
            res =mul(res,a);
        }
        b >>= 1;
        a=mul(a,a);
    }
 
    return res;
}
 
// ll modinv(ll a)
// {
//     return powmod(a, mod - 2);
// }
//  unordered_map<ll,ll>facti;
//  ll fact(ll n)
//  {
// 	if(n==0)return 1;
// 	if(n<=1)return 1;
// 	if(facti[n]!=0)return facti[n];
// 	return facti[n]=mul(n,fact(n-1));
//  }
//   ll ncr(ll n,ll r)
//   {
//         ll h=fact(n);
// 	ll v=fact(r);
// 	ll j=fact(n-r);
// 	v=mul(v,j);
// 	v=powmod(v,mod-2);
// 	return mul(h,v);
//  }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }

void solve()
{
 ll k,x;
  cin>>k>>x;
  if(k*500>=x)
  {
    cout<<"Yes";
  }
  else
    cout<<"No";
}
int main() {
	fast;
	fast_input;
	fast_output;
	
	  solve();
	return 0;
}

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

int main() {
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; ++i) {
		long long A, B;
		cin >> A >> B;
		if (A > B) {
			swap(A, B);
		}
		long long ok = A;
		long long ng = B + 1;
		while (ng - ok > 1) {
			long long C = (ok + ng) / 2; 
			long long r, l;
			if (0 == (A + C) % 2) {
				r = (A + C) / 2;
				l = (A + C) / 2;
			}
			else {
				r = (A + C) / 2;
				l = (A + C) / 2+ 1;
			}
			if ((r * l) < (A * B)) {
				ok = C;
			}
			else {
				ng = C;
			}
		}
		cout << A + ok - 2 << endl;
	}
}


Measured memory_bytes: 3596
while True:
    n = int(input())
    if n==0: break
    sum=0
    for i in range(n):
        x,y,h,w = map(int,input().split())
        l = x+y+h
        if l<=60 and w<=2:
            fee = 600    
        elif l<=80 and w<=5:
            fee=800
        elif l<=100 and w<=10:
            fee=1000
        elif l<=120 and w<=15:
            fee=1200
        elif l<=140 and w<=20:
            fee=1400
        elif l<=160 and w<=25:
            fee=1600
        else :
            fee=0
        sum += fee
        
    print(sum)


Measured memory_bytes: 5616
#include<cstdio>
#include<iostream>
using namespace std;
bool ok;
int main()
{
	char a;
	while(cin>>a)
	{
		if(a=='C'&&ok==0)
		ok=1;
		if(a=='F'&&ok==1)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
	int		a,b,c,i,j,k,n,m,x,y,ans=0;
	int		h;
	
	scanf("%d %d", &n, &k);
	for(i=1;i<=n;i++) {
		scanf("%d", &h);
		if (h >= k) ans++;
	}

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


	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	// ���� ---------------------------------------------
	int D;
	cin >> D;

	vector<int> c(26, 0);
	for (int i = 0; i < c.size(); i++) {
		cin >> c[i];
	}

	vector<vector<int>> s(D, vector<int>(26, 0));
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < s[i].size(); j++) {
			cin >> s[i][j];
		}
	}
	// ----------------------------------------------------


	// �×~�@ ---------------------------------------------
	// �X�R�A
	int score = 0;
	// ���̃X�R�A
	int dscore = 0;
	// �O���̃X�R�A
	int bscore = 0;
	// �R���e�X�g�����{�����ŋ߂̓��ɂ�
	vector<int> last(26, -1);
	// ���̓��ɂ�
	int dlast = 0;
	// �R���e�X�g�̓���
	vector<int> day(D, 0);
	// ���ɂ��̃��[�v
	for (int i = 0; i < D; i++) {
		// ����܂ł̃X�R�A���i�[
		dscore = bscore;
		// 0�Ԗڂ̃R���e�X�g�̃X�R�A����Ƃ��Ċi�[
		score += s[i][0];
		dlast = last[0];
		last[0] = i;
		for (int k = 0; k < c.size(); k++) {
			score -= c[k] * (i - last[k]);
		}
		last[0] = dlast;
		day[i] = 1;
		// �R���e�X�g�̃��[�v
		for (int j = 1; j < 26;  j++) {
			dscore += s[i][j];
			dlast = last[j];
			last[j] = i;
			for (int k = 0; k < c.size(); k++) {
				dscore -= c[k] * (i - last[k]);
			}
			last[j] = dlast;
			if (dscore > score) {
				score = dscore;
				day[i] = j + 1;
			}
			// �O���̃X�R�A�ɖ߂�
			dscore = bscore;
		}
		// �X�R�A���i�[
		bscore = score;
		// last���X�V
		last[day[i] - 1] = i;
	}

	// �o��
	for (int i = 0; i < day.size(); i++) {
		cout << day[i] << endl;
	}
	// ----------------------------------------------------

	/*
	// A ��� ----------------------------------------------------
	vector<int> t(D, 0);
	for (int i = 0; i < t.size(); i++) {
		cin >> t[i];
		t[i]--;
	}

	int ans = 0;

	for (int i = 0; i < t.size(); i++) {
		ans += s[i][t[i]];
		last[t[i]] = i;
		for (int j = 0; j < c.size(); j++) {
			ans -= c[j] * (i - last[j]);
		}
		cout << ans << endl;
	}
	// ----------------------------------------------------
	*/

	return 0;
}

Measured memory_bytes: 3680
n , m = map(int, input().split())
KS = [list(map(int, input().split())) for _ in range(m)]
P = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    i_str = bin(i)[2:].zfill(n)
    onNum = 0
    for num, ks in enumerate(KS):
        k = ks[0]
        s = ks[1:]
        p = P[num]
        on = 0
        for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
        if on % 2 == p:
            onNum += 1
    if onNum == m:
        ans += 1

print(ans)


        
        


Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
#define retunr return
#define pb push_back
#define mp make_pair
#define null NULL
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", (x))
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", (x))
#define rep(i,l,r) for (int i = l, lim = r;i <= lim; ++i)
#define repr(i,l,r) for (int i = r, lim = l;i >= lim; --i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef unsigned int uint;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define N 100010
#define M 1024
#define MOD 1000000007
void _add(int &a, int b){a = (a+b)%MOD;}
void _sub(int &a, int b){a = (a+MOD-b)%MOD;}
void _mul(int &a, int b){a = (ll)a*b%MOD;}
void _max(int &a, int b){a = max(a,b);}
void _min(int &a, int b){a = min(a,b);}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b,a%b);}
ll pw(ll a, ll b){ll res(1);while(b){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
ll pwM(ll a, ll b, ll mod){ll res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807ll;
const db PI = 3.14159265358979323846;

/*
struct E{
	int v, w, n;
}G[N];
int cnt, point[N];
void adde(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k,q,a[N];
int main(){
//	freopen("1", "r", stdin);
	int ans = 100000;
	rep(i,1,3)sc(a[i]);
	rep(i,1,3)rep(j,1,3)rep(k,1,3)
		if(i!=j&&i!=k&&j!=k)
			ans=min(ans,0+abs(a[i]-a[j])+abs(a[j]-a[k]));
	pr(ans),ln;
/*
	int Case;
	sc(Case);
	rep(ca, 1, Case){
	    printf("Case #%d: ", ca);
	}
*/
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

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

double const pi = 3.1415926535;
int const mod = 1000000007;
int const inf = 2147483647;

int printint(int n) {
	cout << n << endl;
	return 0;
}

int prints(string s) {
	cout << s << endl;
	return 0;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 2 == 1 && b % 2 == 1)cout << "Odd" << endl;
	else cout << "Even" << endl;

	return 0;
}

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

typedef long long LL;

const int maxn = 60;
const int maxv = 5050;

int n, p;
LL a[maxn];
int ou, ji;

int main()
{
  scanf("%d%d", &n, &p);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 2 == 0) ou++;
    else ji++;
  }
  LL ans = (LL)(pow(2, ou) + 0.05);
  if (ji == 0) {
    if (p == 1) cout << 0 << endl;
    else cout << ans << endl;
  }
  else {
    ans *= (LL)(pow(2, ji-1) + 0.05);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(200000)


def read():
    A, B, H, M = map(int, input().strip().split())
    return A, B, H, M


def solve(A, B, H, M, INF = 10**8):
    t = H * 60 + M
    pi2 = math.pi * 2 
    brad = pi2 * t / 60.0
    arad = pi2 * t / (12.0 * 60.0)
    bv = [B * math.cos(brad), B * math.sin(brad)]
    av = [A * math.cos(arad), A * math.sin(arad)]
    ans = math.sqrt((bv[0] - av[0])**2 + (bv[1] - av[1])**2)
    return "%.10f" % ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9608
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
 
max_a=max(a for a,_ in ab)
dp = [0] * (h+max_a)
 
for i in range(0,h+max_a):
    if i==0:
        dp[i]=0
    else:
        dp[i]=min(dp[i-a]+b for a,b in ab)
print(dp[h])


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int k;
string s;
int main(){
	cin>>k>>s;
	for(int i=0;i<min((int)s.size(),k);i++)cout<<s[i];
	if(s.size()>k)puts("...");
	return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>

#define N 200000

int aa[N], bb[N];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	return bb[i] - bb[j];
}

int main() {
	static int ii[N];
	int n, i, time;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &aa[i], &bb[i]);
		ii[i] = i;
	}
	qsort(ii, n, sizeof *ii, compare);
	time = 0;
	for (i = 0; i < n; i++) {
		time += aa[ii[i]];
		if (time > bb[ii[i]]) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 3324
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl;

void solve(){
	ll a, b;
	cin >> a >> b;


	if(a > 0 && b > 0){
		cout << "Positive";
	}else if(a < 0 && b < 0){
		if(abs(a - b) % 2){
			cout << "Positive";
		}else{
			cout << "Negative";
		}
	}else{
		cout << "Zero";
	}
	cout << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ss second
#define ff first
using namespace std;
const int M = 998244353, N = 3001;
int memo[N][N], arr[N], n, s;

int mod(int x, int m = M){
    x %= m;
    return x < 0 ? x+m : x;
}

int solve(int idx, int sum){
    if(sum > s) return 0;

    if(idx == n)
        return sum == s ? 1 : 0;

    if(memo[idx][sum] != -1)
        return memo[idx][sum];

    memo[idx][sum] = mod(mod(2LL*solve(idx+1,sum)) + mod(solve(idx+1,sum+arr[idx])));

    return memo[idx][sum];
}

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    memset(memo, -1, sizeof(memo));
    
    cin>>n>>s;
    for(int i=0; i<n; i++) cin>>arr[i];

    cout<<solve(0,0)<<endl;


}

Measured memory_bytes: 74220
import numpy as np

h,w = map(int,input().split())
x = [[0 if s=="." else 1 for s in list(input())] for _ in range(h)]

for i in reversed(range(h)):
    if sum(x[i])==0:
        x.pop(i)
x = np.array(x).T.tolist()
for i in reversed(range(len(x))):
    if sum(x[i])==0:
        x.pop(i)
x = np.array(x).T.tolist()
h = range(len(x))
x = [["#" if j==1 else "." for j in x[i]] for i in h]
for i in h:
    print ("".join(x[i]))

Measured memory_bytes: 26828
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
book = Hash.new(0)
a.each do |x|
  book[x] += 1
end

e2 = []
e4 = 0
book.each do |k, v|
  if v >= 4
    e4 = [e4, k].max
    e2 << k
  elsif v >= 2
    e2 << k
  end
end

e2.sort!
puts [(e2[-2] || 0) * (e2[-1] || 0), e4 * e4].max

Measured memory_bytes: 16004
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

//pdf見て解答

int main(){
    ll x; cin >> x;
    ll sum = 0, cnt = 0;

    for(ll i = 0;; i++){
        if(i * (i + 1) / 2 >= x){
            put(i);
            return 0;
        }
    }
}

Measured memory_bytes: 3604
#include <cstdio>
#include <cstring>
typedef long long lld;
const int BASE = 10;
const int MAXS = 2e5+5;
const int MOD = 2019;
int cnt[MOD];
char S[MAXS];
int ten[MAXS];
int N;

int main() {
  scanf(" %s", S+1);
  N = strlen(S+1);

  ten[0] = 1;
  for (int i = 1; i <= N; ++i) {
    ten[i] = 1LL * BASE * ten[i-1] % MOD;
  }

  for (int i = 0; i < MOD; ++i) {
    cnt[i] = 0;
  }
  cnt[0] = 1;

  lld ret = 0LL;
  int A = 0;
  for (int i = 1; i <= N; ++i) {
    A = (1LL * BASE * A + (S[i] - '0')) % MOD;

    int key = 1LL * ten[N-i] * A % MOD;
    ret += cnt[key];
    ++cnt[key];
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 2716
#include<bits/stdc++.h>
using namespace  std;
int main()
{
    unsigned long long int n,m,i,a[10000],s=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    if(s>n)
        cout<<"-1"<<endl;
    else

    cout<<n-s<<endl;

    return 0;
}



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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  
  int price=0;
  for(int i=0; i<n; i++){
    if(i<k){
      price += x;
    }else{
      price += y;
    }
  }
  
  cout << price << endl;
  return 0;
}


Measured memory_bytes: 256
/*
___ is a raging sadist.
*/

//Destroy all WA at test 2

#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define pow power
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define endl "\n"
#define PI 3.14159265
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MOD1 = 998244353;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7; 
using namespace std;

ll power(ll x, ll y) 
{ 
   ll res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  

        y = y>>1; 

        if (x<=100000000)
        x = (long long)(x*x);

        //cout<<x<<'\n'; 
    } 
    return res; 
} 





int main()
{


fastio();

ll n;
cin>>n;

ll temp=n;


vector <ll> facts; ll tot=0;
vector <ll> cnt;

for(int i=2;i<=sqrt(n);i++){
ll cn=0;
while (temp%i==0){
temp/=i;
cn+=1;
}
cnt.pb(cn);
}

if (temp!=n&&temp!=1)
cnt.pb(1);


vector <ll> sums(60);

if (temp!=n){
for(int i=0;i<60;i++)
sums[i]=((i+1)*(i+2))/2;

for(int i=0;i<cnt.size();i++){
if (cnt[i]>0){
ll pos=lower_bound(sums.begin(),sums.end(),cnt[i])-sums.begin();
if (sums[pos]==cnt[i])
tot+=pos+1;
else
tot+=pos;
}
}
}

if (n==1)
cout<<0;
else if (temp==n)
cout<<1;
else
cout<<tot;

return 0;
}

Measured memory_bytes: 11632
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
//#define ls x<<1
//#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-10;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;
int ans[maxn];
void solve(){
	int n;scd(n);
	int lim=200;
	rep1(i,lim)rep1(j,lim)rep1(k,lim){
		int x=i,y=j,z=k;
		int val=x*x+y*y+z*z+x*y+y*z+x*z;
		if(val>0&&val<=n)ans[val]++;
	}
	rep1(i,n)printf("%d\n",ans[i]);
}
int main(){
    //IOS;
    //freopen("D:\\data.txt","r",stdin);
    //freopen("D:\\out.txt","w",stdout);
    solve();
 
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;                                             ;;
    ;;         ;;            ;;;;;;;;;       ;;    ;;
    ;;        ;; ;;        ;;                ;;    ;;
    ;;       ;;   ;;       ;;                ;;    ;;
    ;;      ;;;;;;;;;      ;;                ;;    ;;
    ;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
    return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



string x;
int n;
ll kolko[2500];
ll res = 0;


int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> x;
    reverse(x.begin(), x.end());
    n = x.length();
    int tr = 0;
    int st = 1;
    kolko[0] = 1;
    ff(i,0,n - 1){
        tr += (st * (x[i] - '0'));
        st *= 10;
        st %= 2019;
        tr %= 2019;
        res += kolko[tr];
        kolko[tr]++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,int>;
using T = tuple<string,int,int>;

int main(){
  int n,a;
  cin >> n >> a;
  if(n < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

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

int main() {
  
  int N;
  cin >> N;
  vector<int> bipa(N);
  
  for (int i = 0; i < N; i ++) {
    cin >> bipa.at(i);
  }
  
  sort (bipa.begin(), bipa.end());
  reverse (bipa.begin(), bipa.end());
  
  int sum = 1, now = bipa.at(0);
  
  for (int i = 1; i < N; i ++) {
    if (now > bipa.at(i)) {
      sum += 1;
      now = bipa.at(i);
    }
  }
  cout << sum << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll=long long;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  ll a[n],b[n];
  ll count=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    count-=a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
    count+=b[i];
  }
  ll a_count=0,b_count=0;
  for(int i=0;i<n;i++){
    if(a[i]>b[i]){
      b_count+=a[i]-b[i];
    }else{
      if((b[i]-a[i])%2!=0){
        a_count+=(b[i]-a[i])/2+1;
        b_count+=1;
      }else{
        a_count+=(b[i]-a[i])/2;
      }
    }
  }
  if(count>=0&&count>=a_count){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <complex>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

long double const pi = std::acos(-1.0L);

int main() {
  int a, b, h, m;
  scanf("%d %d %d %d", &a, &b, &h, &m);

  auto deg = [](auto x) -> long double { return x * pi / 180.0L; };

  std::complex<long double> zh = std::polar<long double>(a, deg((60*h + m) / 2.0L));
  std::complex<long double> zm = std::polar<long double>(b, deg(m * 6.0L));
  printf("%.20Lf\n", std::abs(zh-zm));
}


Measured memory_bytes: 2580
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n, m;
    cin >> n >> m;
    vector<vector<P>> graph(n), rev(n);
    vector<tuple<int, int, int>> es;
    for(int i = 0; i < m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        c = -c;
        graph[a].emplace_back(b, c);
        rev[b].emplace_back(a, c);
        es.emplace_back(a, b, c);
    }
    vector<bool> ArrivalFrom1(n, false), ArrivalFromN(n, false);
    queue<int> que;
    que.push(0);
    ArrivalFrom1[0] = true;
    while(!que.empty()){
        int from = que.front();
        que.pop();
        for(auto e : graph[from]){
            int to = e.first;
            if(ArrivalFrom1[to])    continue;
            ArrivalFrom1[to] = true;
            que.push(to);
        }
    }
    que.push(n - 1);
    ArrivalFromN[n - 1] = true;
    while(!que.empty()){
        int from = que.front();
        que.pop();
        for(auto e : rev[from]){
            int to = e.first;
            if(ArrivalFromN[to])    continue;
            ArrivalFromN[to] = true;
            que.push(to);
        }
    }
    vector<ll> dist(n, 0);
    for(int loop = 0; loop <= n; ++loop){
        bool update = false;
        for(auto tup : es){
            int from, to, cost;
            tie(from, to, cost) = tup;
            if(!ArrivalFrom1[from] || !ArrivalFrom1[to])    continue;
            if(!ArrivalFromN[from] || !ArrivalFromN[to])    continue;
            if(chmin(dist[to], dist[from] + cost))  update = true;
        }
        if(loop == n && update){
            cout << "inf\n";
            return 0;
        }
    }
    constexpr ll inf = 1e+15;
    dist = vector<ll>(n, inf);
    dist[0] = 0;
    for(int loop = 0; loop < n - 1; ++loop){
        for(auto tup : es){
            int from, to, cost;
            tie(from, to, cost) = tup;
            if(!ArrivalFrom1[from] || !ArrivalFrom1[to])    continue;
            if(!ArrivalFromN[from] || !ArrivalFromN[to])    continue;
            chmin(dist[to], dist[from] + cost);
        }
    }
    ll ans = -dist[n - 1];
    cout << ans << endl;
}

Measured memory_bytes: 3792