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

int main() {
  int h, w;
  cin >> h >> w;
  
  string board[60];
  for (int i = 0; i < h; i++) cin >> board[i];
  
  int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
  int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (board[i][j] == '.') {
        int cnt = 0;
        for (int k = 0; k < 8; k++) {
          int x = i + dx[k];
          int y = j + dy[k];
          if (x < 0 || x >= h || y < 0 || y >= w) continue;
          if (board[x][y] == '#') cnt++;  
        }
        board[i][j] = '0' + cnt;
      } 
    }  
  }  
  
  for (int i = 0; i < h; i++) cout << board[i] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	char key[1000];
	int i=0;
	
	scanf("%s", key);
	while(key[i] != '\0'){
		if(key[i] >= 'D') printf("%c", key[i]-3);
		else printf("%c", key[i]+23);
		++i;
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
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)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    vector<bool> b(4,false);
    for(char c:s){
        if(c=='N')b[0]=true;
        if(c=='W')b[1]=true;
        if(c=='S')b[2]=true;
        if(c=='E')b[3]=true;
    }
    if(b[0]^b[2]||b[1]^b[3])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  string s;
  cin>>a>>s;
  if(a%2==1){
    cout<<"No"<<"\n";
    return(0);
	}
  for(int i=0;i<a/2;i++){
    if(s[i]!=s[i+a/2]){
      cout<<"No"<<"\n";
      return(0);
    }
  }
  cout<<"Yes"<<"\n";
  return(0);
}


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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

ld const PI = 4*atan((ld)1);

int main()
{
	fastio;

	int n;
	cin >> n;

	map<ii, int> ctr;
	for (int i = 0; i < n; ++i)
	{
		double x;
		cin >> x;

		ll y = llround(x * 1e9);
		int two = 0, five = 0;
		while (y % 2 == 0)
			y /= 2, two++;
		while (y % 5 == 0)
			y /= 5, five++;
		ctr[mp(two, five)]++;
	}

	ll res = 0;
	for (auto x : ctr)
		for (auto y : ctr)
		{
			if (x.f1.f1 + y.f1.f1 >= 18 && x.f1.s2 + y.f1.s2 >= 18)
			{
				if (x.f1 < y.f1) res += (ll) x.s2 * y.s2;
				else if (x.f1 == y.f1) res += (ll) x.s2 * (y.s2 - 1) / 2;
			}
		}

	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>
#include <string.h>
#include <ctype.h>


int main(void)
{
	int i,j;
	int N,a[100] = {0},v;

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

	for(i = 0; i < N; i++)
	{
		v = a[i];
		for(j = i; j >= 0 && a[j-1] > v; j--)
		{
			a[j] = a[j-1];
		}
		a[j] = v;

		for(j = 0; j < N; j++)
		{
			if (j == N-1)
			{
				printf("%d\n", a[j]);
			}else
			{
				printf("%d ", a[j]);
			}
		}

	}


	return 0;
}

Measured memory_bytes: 600
n = int(input())
a = [list(map(int, input().split(' '))) for _ in range(n - 1)]

for i in range(n):
    # from i
    # now = 1ループごとにnow
    now = 0
    for j in range(i, n - 1):
        (c, s, f) = a[j]
        if now <= s:
            now = s + c
        else:
            # matsu
            now = s + (now - s + f - 1) // f * f + c
    print(now)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  char A; cin >> A;
    if(A == 'a'){
      cout << "a";
      return 0;
    }
    if(A == 'b'){
      cout << "a";
      return 0;
    }
    if(A == 'c'){
      cout << "a";
      return 0;
    }
    if(A == 'd'){
      cout << "a";
      return 0;
    }
    if(A == 'e'){
      cout << "a";
      return 0;
    }
    if(A == 'f'){
      cout << "a";
      return 0;
    }
    if(A == 'g'){
      cout << "a";
      return 0;
    }
    if(A == 'h'){
      cout << "a";
      return 0;
    }
    if(A == 'i'){
      cout << "a";
      return 0;
    }
    if(A == 'j'){
      cout << "a";
      return 0;
    }
    if(A == 'k'){
      cout << "a";
      return 0;
    }
    if(A == 'l'){
      cout << "a";
      return 0;
    }
    if(A == 'm'){
      cout << "a";
      return 0;
    }
    if(A == 'n'){
      cout << "a";
      return 0;
    }
    if(A == 'o'){
      cout << "a";
      return 0;
    }
    if(A == 'p'){
      cout << "a";
      return 0;
    }
    if(A == 'q'){
      cout << "a";
      return 0;
    }
    if(A == 'r'){
      cout << "a";
      return 0;
    }
    if(A == 's'){
      cout << "a";
      return 0;
    }
    if(A == 't'){
      cout << "a";
      return 0;
    }
    if(A == 'u'){
      cout << "a";
      return 0;
    }
    if(A == 'v'){
      cout << "a";
      return 0;
    }
    if(A == 'w'){
      cout << "a";
      return 0;
    }
    if(A == 'x'){
      cout << "a";
      return 0;
    }
    if(A == 'y'){
      cout << "a";
      return 0;
    }
    if(A == 'z'){
      cout << "a";
      return 0;
    }
  cout << "A";
}

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

#define NIL -1
#define MAX 25

class node{
public:
  int parent;
  int left;
  int right;
  int depth;
  int height;

  node(){
    parent = NIL;
    left = NIL;
    right = NIL;
    depth = NIL;
  }
};

node T[MAX];

void preOrder(int id){
  printf(" %d",id);
  if(T[id].left != NIL) preOrder(T[id].left);
  if(T[id].right != NIL) preOrder(T[id].right);
};

void inOrder(int id){
  if(T[id].left != NIL) inOrder(T[id].left);
  printf(" %d",id);
  if(T[id].right != NIL) inOrder(T[id].right);
}

void postOrder(int id){
  if(T[id].left != NIL) postOrder(T[id].left);
  if(T[id].right != NIL) postOrder(T[id].right);
  printf(" %d",id);
}

int main(){

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

  for(int i=0; i<n; i++){
    int id, left, right;
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left != -1 ? left : NIL;
    T[id].right = right != -1 ? right : NIL;
    if(left != -1) T[left].parent = id;
    if(right != -1)T[right].parent = id;
  }

  // Find root id.
  int root;
  for(int i=0; i<n; i++){
    if(T[i].parent == NIL){
      root = i;
      break;
    }
  }

  //print result
  printf("Preorder\n");
  preOrder(root);
  printf("\n");

  printf("Inorder\n");
  inOrder(root);
  printf("\n");

  printf("Postorder\n");
  postOrder(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
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(void) {
    int n;
    cin>>n;
    double ans=0;
    for(int i=0;i<n;i++){
        double a;
        cin>>a;
        ans+=1/a;
    }
    ans=1/ans;
    cout<<setprecision(10)<<ans<<endl;
}

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

int main() {
 string  S;
   cin >> S;
  
    if ((S.size() < 4) ||((S.size() >= 4) && ((S.at(0) != 'Y') || (S.at(1) != 'A') || (S.at(2) != 'K') || (S.at(3) != 'I')))) {
      
     cout << "No" << endl;
  }
    else {
      cout << "Yes" << endl;
    }
  }
  

 


Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
    #define ll long long
    #define ull unsigned long long
    #define fr(i,a,b) for(int i =a ; i < b; i++)
    #define FR(i,a,b) for(int i =a ; i > b; i--) 
    #define frj(j,a,b) for(int j =a ; j < b; j++)
    #define FRE(i,a,b) for(int i =a ; i >= b; i--) 
    #define fre(i,a,b) for(int i =a ; i <= b; i++)
    #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

    #define mkp make_pair 
    #define pb push_back
    #define pii pair<int,int>
    #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
    //#define c(a,b) cout<<a<<"--"<<b<<endl;
    #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
    #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
    #define pp(a) cout<<a.first<<" "<<a.second<<endl;
    //sum array
    #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
    #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
    s[i]=s[i-1]+a[i];}

    #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
    #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;
    #define prs(s)   for(auto x : s){cout<<x<<" ";}cout<<endl;
    
    #define all(x)           x.begin(), x.end()
    #define prm(m,r,c) fr(i,0,r){frj(j,0,c){cout<<m[i][j]<<" "; }cout<<endl;}
    #define fillm(m,r,c,k) fr(i,0,r)frj(j,0,c)m[i][j]=k;
    constexpr auto PI  = 3.14159265358979323846L;
    constexpr auto eps = 1e-6;
    constexpr auto mod = 1000000007;
    #define MOD 1000000007
   // #define maxv 200005
    #define MAXN 100001

  template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
  template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }


    const int INF = 1e9 +5;

int main(){
      
      speed;
      int n;
      cin>>n;
      vector<int> dp (3,0);
      fr(i,0,n)
      {

          vector<int> c (3,0);
          fr(i,0,3)
            cin>>c[i];

          vector<int> temp(3,-INF);
          fr(i,0,3)
          {
              fr(j,0,3)
                {
                  if(i!=j)
                      temp[j]= max(temp[j],c[j]+dp[i]);
                }            
          }
          dp = temp;
      }

      cout<<*max_element(all(dp))<<endl;
      return 0;

  }



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    ll k;cin>>k;
    if(k%7==0)k/=7;
    ll sum=0;ll r=1;int res=0;
    while(res<=2*k){
        res++;
        r%=k;
        sum+=r;
        sum%=k;
        if(sum==0){
            cout<<res<<endl;
            return 0;
        }
        r*=10;
    }
    cout<<-1<<endl;
}

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

using ll=long long;
const int INF = 0x3f3f3f3f;
const int MAX_N = 105, MAX_W = 1e5+5;
int N, W;
ll dp[MAX_W];
int w[MAX_N];
int v[MAX_N];

void solve()
{
	memset(dp, 0, sizeof(dp));
	for(int i=0; i<N; ++i){
		for(int j=W; j>= w[i]; --j){
			dp[j] = max(dp[j], dp[j-w[i]]+v[i]);
		}
	}
	long long ans = 0;
	for(int i=0;i<=W;++i)ans=max(ans, dp[i]);
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> W;
	for(int i=0;i<N;++i) cin >> w[i] >> v[i];
	solve();
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;


int main(){
    int a, b; cin >> a >> b;

    int d = b-a;

    int h = 0;
    rep1(i,d) h += i;
    cout << h-b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long a, b, k;
    cin >> a >> b >> k;
    if(a >= k) {
        a = a - k;
    }
    else if(b >= k - a) {
        b = b - (k - a);
        a = 0;
    }
    else {
        a = 0;
        b = 0;
    }
    cout << a << " " << b << endl;
}

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

using namespace std;



int main() {
   int w, h, x, y;
   cin >> w >> h >> x >> y;

   int mul = 0;



   if (w % 2 == 0 and h % 2 == 0) {
        if (x == w / 2 and y == h / 2) mul = 1;
   }

   long double W = w, H = h;
   cout << W * H / 2 << ' ' << mul << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  char str[11];
  scanf("%s", str);
  int max = 0;
  int current = 0;
  for (int i=0;i<11&&str[i]!='\0';i++)
  {
    if (str[i] == 'A'||str[i]=='C'||str[i]=='G'||str[i]=='T') {
      current++;
    } else {
      if (current > max) max = current;
      current = 0;
    }
  }
  if (current > max) max = current;
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 256
///////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

///////////////////////////////////////////////////////////////////////////////

#define pb push_back

void longin(long &a)
{
        cin >> a;
}

void longinl1(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a;
                cin >> a;
                v.push_back(a);
        }
}

void longinl2(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b;
                cin >> a >> b;
                v.push_back({a, b});
        }
}

void longinl3(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b, c;
                cin >> a >> b >> c;
                v.push_back({a, b, c});
        }
}

void longina(auto &v, long count)
{
        longinl1(v, count);
}

long min(const vector<long> v)
{
        long ret = (long)numeric_limits<double>::infinity();
        for (auto i : v) ret = min(ret, i);
        return ret;
}

///////////////////////////////////////////////////////////////////////////////

int main()
{
        long x, y, z, k;
        longin(x); longin(y); longin(z); longin(k);

        vector<long> alist, blist, clist;
        longina(alist, x); longina(blist, y); longina(clist, z);

        vector<long> absum;
        for (auto a: alist) {
                for (auto b: blist) {
                        absum.pb(a + b);
                }
        }
        sort(absum.begin(), absum.end(), greater<long>());

        vector<long> abcsum;
        for (auto c : clist) {
                for (int i = 0; i < min((long)(absum.size()), k); ++i) {
                        abcsum.pb(c + absum[i]);
                }
        }
        sort(abcsum.begin(), abcsum.end(), greater<long>());

        for (int i = 0; i < k; ++i) {
                cout << abcsum[i] << endl;
        }

        return 0;
}

///////////////////////////////////////////////////////////////////////////////


Measured memory_bytes: 43384
dfs :: Int -> Int -> String -> Int -> Int -> IO Bool
dfs a b s na nb
  | null s = return True
  | head s == 'a' = if na + nb < a + b
                    then putStrLn "Yes" >> dfs a b s' (na+1) nb
                    else putStrLn "No" >> dfs a b s' na nb
  | head s == 'b' = if na + nb < a + b && nb < b
                    then putStrLn "Yes" >> dfs a b s' na (nb+1)
                    else putStrLn "No" >> dfs a b s' na nb
  | otherwise = putStrLn "No" >> dfs a b s' na nb
  where
    s' = tail s

solve (t:s:_) = dfs a b s 0 0
  where (_:a:b:_) = map read $ words t

main = getContents >>= solve.lines



Measured memory_bytes: 2812
#include<bits/stdc++.h>
using namespace std;
#define nu 1005
#define MOD 1000000007
typedef long long int ll;

ll dp[nu][nu];
string s[nu];


int main()
{
    ll n,m,x,y,i,j,mx=0;
    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    for(i=1;i<n;i++)
    {
        if(s[i][0]=='.')
            dp[i][0]=dp[i-1][0];
    }
    for(i=1;i<m;i++)
    {
        if(s[0][i]=='.')
            dp[0][i]=dp[0][i-1];
    }
    for(i=1;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            if(s[i][j]=='.')
            {
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
            }
        }
    }
    cout<<dp[n-1][m-1]<<"\n";
    return 0;
}

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

int n;
vector<int> v;

int solve();

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  cout << solve() << endl;
  return 0;
}

int solve() {
  int ans = 0;
  for(int i = 0; i < n; ++i) {
    int now = v[i], cnt = 1;
    while(++i < n && v[i] == now) ++cnt;
    if(cnt > now)
      ans += cnt - now;
    else if(cnt < now)
      ans += cnt;
    --i;
  }
  return ans;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization ("Ofast")
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define siz(s) (int)s.size()

template<class T> inline bool chmin(T &a, T b) {
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b) {
	if(a<b){a=b;return true;}
	return false;
}
template<class T> inline int getidx(vector<T> &v, T a) {
	return lower_bound(all(v), a) - v.begin();
}

constexpr int mod=1e9+7;
constexpr int inf=3e18;


signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N,K;cin>>N>>K;
	int ans=0;
	for(int i=K;i<=N+1;i++){
		int mi=(i-1)*i/2;
		int mx=(N-i+1+N)*i/2;
		ans+=mx-mi+1;
		ans%=mod;
	}
	cout<<ans<<"\n";
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll a, b;cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;
	return 0;
}


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

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}
  
int main() {
  int n;
  cin >> n;
  priority_queue<string> q;
  for (int i = 0; i< n; i++) {
    string s;
    cin >> s;
    q.push(s);
  }
  int count = 0;
  string s = q.top();
  while (!q.empty()) {
    count++;
    q.pop();
    while (s == q.top() && !q.empty()) {
      q.pop();
    }
    if (!q.empty()) {
      s = q.top();
    }
  }
  cout << count<<endl;
} 


Measured memory_bytes: 11660
n = int(input())
list = list(map(int,input().split()))

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI:len(list)])
maxM = maxV * (len(list)-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI-1:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x
                list[i+1] = list[i+1]+x
print(ans)


Measured memory_bytes: 32128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
ll a = pow(10, 18);
int main()
{
    ll a, b; cin >> a >> b;
    char c; cin >> c;
    ll d; cin >> d;
    b *= 100; b += d;
    a *= b;
    a /= 100;
    cout << a << '\n';
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll a, b, q, ans;

ll gv(ll u, ll v)
{
	if(u==v) return 2*(u-1);
	if(sq(u*v)!=-1) return 2*sq(u*v)-3;
	ll tt=(ll)sqrt(u*v);
	if(u*v>tt*tt+tt) return 2*tt-1;
	else return 2*tt-2;
}

int main(void)
{
	cin>>q;
	while(q--)
	{
		cin>>a>>b;
		cout<<gv(a,b)<<"\n";
	}
}



// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e18
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  while(1){
    int H, W;
    cin >> H >> W;
    if(!(H|W))
      break;
    REP(i, H) {
      REP(j, W) { cout << '#'; }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3120
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(read())
ans = 0
for i in range(1,N+1,2):
  count = 0
  for j in range(1,i+1):
    if i % j ==0:
      count += 1
  if count == 8:
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int n;
string s, ans;
char ani[200000], S = 'S', W = 'W';

bool solve(){
    bool res = true;
    for (int i = 1; i < s.size() - 2; i++){
        if (ani[i] == S && s[i] == 'o') ani[i + 1] = ani[i - 1];
        else if (ani[i] == W && s[i] == 'x') ani[i + 1] = ani[i - 1];
        else {
            if (ani[i - 1] == S) ani[i + 1] = W;
            else ani[i + 1] = S;
        }
    }
    int right;
    for (int i = 1; i < n; i++){
        if (i != n - 1) right = i + 1;
        else right = 0;
        if (ani[i] == S){
            if (s[i] == 'o' && ani[right] != ani[i - 1]) res = false;
            else if (s[i] == 'x' && ani[right] == ani[i - 1]) res = false;
        }else{
            if (s[i] == 'x' && ani[right] != ani[i - 1]) res = false;
            else if (s[i] == 'o' && ani[right] == ani[i - 1]) res = false;
        }
    }
    return res;
}

int main(){
    sc(n)
    cin >> s;
    bool check = false;
    for (int i = 0; i < 4; i++){
        if (i == 0){
            ani[0] = S;
            ani[1] = S;
            if (s[0] == 'o') ani[n - 1] = S;
            else ani[n - 1] = W;
        }else if (i == 1){
            ani[0] = S;
            ani[1] = W;
            if (s[0] == 'o') ani[n - 1] = W;
            else ani[n - 1] = S;
        }else if (i == 2){
            ani[0] = W;
            ani[1] = W;
            if (s[0] == 'o') ani[n - 1] = S;
            else ani[n - 1] = W;
        }else {
            ani[0] = W;
            ani[1] = S;
            if (s[0] == 'o') ani[n - 1] = W;
            else ani[n - 1] = S;
        }
        if (solve()){
            check = true;
            break;
        }
    }
    for (int i = 0; i < n; i++) ans += ani[i];
    if (check) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

ll f(ll b, ll n) {
	if (n < b) { return n; }
	return f(b, n / b) + n % b;
}


int main() {

	string w;
	cin >> w;

	string ans = "Yes";

	for (char x = 'a'; x <= 'z'; x++) {
		if (count(w.begin(), w.end(), x) % 2 != 0) { ans = "No"; }
	}

	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 504
import Text.Printf

calc_c :: Double -> Double -> Double -> Double
calc_c a b angle_c = sqrt $ a^^2 + b^^2 - 2*a*b*(cos $ ang2rad angle_c)

calc_h :: Double -> Double -> Double
calc_h b angle_c = b * (sin $ ang2rad angle_c)

ang2rad :: Double -> Double
ang2rad = (*) (pi / 180)

calc_s :: Double -> Double -> Double -> Double
calc_s a b angle_c = (a * calc_h b angle_c) / 2

calc_l :: Double -> Double -> Double -> Double
calc_l a b angle_c = a + b + calc_c a b angle_c

main :: IO ()
main = do
    [a, b, angle_c] <- getLine >>= return . map (\n -> read n :: Double) . words
    printf "%.5f %.5f %.5f" (calc_s a b angle_c) (calc_l a b angle_c) (calc_h b angle_c)



Measured memory_bytes: 4224
//Moh_K_Imar .......
//28/08/2020  ... 11,38.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a,b;
    cin>>a>>b;
    if(a>=13)cout<<b<<endl;
    else if(a>=6&&a<=12)cout<<b/2<<endl;
    else cout<<0<<endl;

    return 0;
}



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

int main() {

    int N;
    cin >> N;

    int A[N];
    rep(i, N){
        cin >> A[i];
    }
    int min = INF;
    int max = 0;
    rep(i, N){
        if(min > A[i]){
            min = A[i];
        }
        if(max < A[i]){
            max = A[i];
        }
    }
    int ans = max - min;
//    string ans;
//    if(N <= A){
//        ans = "Yes";
//    }else{
//        ans = "No";
//    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<class T>
vector<T> divisor(T n){
    vector<T> ret;
    for(T i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return(ret);
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int g = v[0];
    for (int i = 0; i < n; ++i) {
        g = __gcd(g, v[i]);
    }
    for (int i = 0; i < n; ++i) {
        v[i] /= g;
    }
    map<int, int> x;
    for (int i = 0; i < n; ++i) {
        x[v[i]]++;
    }
    map<int, int> m;
    for (auto &&j : x) {
        auto w = divisor(j.first);
        for (auto &&k : w) {
            m[k] += j.second;
        }
    }
    int ans = 0;
    for (auto &&k : m) {
        if(k.second >= n-1){
            ans = max(ans, k.first);
        }
    }
    cout << ans*g << "\n";
    return 0;
}

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

using namespace std;

typedef long long ll;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	fast();
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	vector<int> points;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] < a[i+1]) {
			points.pb(i);
		}
	}
	ll ans = 1000, stocks = 0;
	for (int i = 0; i < points.size(); ++i) {
		int x = points[i];
		++i;
		while (i < points.size() && points[i] - x == 1) {
			++i;
		}
		--i;
		int y = points[i] + 1;
		stocks = ans/a[x];
		ans -= stocks*a[x];
		ans += stocks*a[y];
	}
	cout << ans << nl;
}

Measured memory_bytes: 3636
#include <cstdio>

const int H = 100;
const int W = 100;
const int N = H * W;

int h, w, n;
int a[N];

int i = 0, j = 0, ri = 1;
int c[H][W];

void paint(int col, int cnt) {
	for (int k = 0; k < cnt; k++) {
		c[j][i] = col;
		if (i == 0 && ri == -1) {
			ri = 1;
			j++;
			continue;
		}
		if (i == w - 1 && ri == 1) {
			ri = -1;
			j++;
			continue;
		}
		i += ri;
	}
}

int main(int argc, char *argv[]) {
	scanf("%d%d%d", &h, &w, &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < n; i++) {
		paint(i + 1, a[i]);
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++)
			printf("%d ", c[i][j]);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	while(cin>>n,n){
		int m;
		cin>>m;
		vector<pii> v(m);
		rep(i,m) cin>>v[i].F>>v[i].S;
		
		VV(pii) vv(n);
		rep(i,n){
			int m;
			cin>>m;
			rep(j,m){
				int a,b;
				cin>>a>>b;
				vv[i].PB(mkp(a,b));
			}
			int x = INF;
			int y = INF;
			rep(j,m){
				mins(y, vv[i][j].F);
				mins(x, vv[i][j].S);
			}
			rep(j,m){
				vv[i][j].F-=y;
				vv[i][j].S-=x;
			}
		}
		vint ans;
		rep(i,4){
			rep(j,v.size()){
				pii tmp = v[j];
				v[j].F = -tmp.S;
				v[j].S = tmp.F;
			}
			int x = INF;
			int y = INF;
			rep(j,m){
				mins(y, v[j].F);
				mins(x, v[j].S);
			}
			rep(j,m){
				v[j].F-=y;
				v[j].S-=x;
			}
			rep(j,n){
				if(v==vv[j]){
					ans.PB(j);
				}
			}
			reverse(ALL(v));
			rep(j,n){
				if(v==vv[j]){
					ans.PB(j);
				}
			}
		}
		sort(ALL(ans));
		ans.erase(unique(ALL(ans)), ans.end());
		rep(i,ans.size()){
			cout<<ans[i]+1<<endl;
		}
		cout<<"+++++"<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

int n,d[100];
bool graph[100][100], visited[100];
queue<int> q;


void bfs(int s){
    q.push(s);
    visited[0]=true;

    while(!q.empty()){
        int v=q.front(); q.pop();
        for(int v2=0; v2<n; v2++){
            if(graph[v][v2] && visited[v2]==false){
                d[v2]=d[v]+1; visited[v2]=true;
                q.push(v2);
            }
        }
    }
}


int main(void){
    cin >> n;

    for(int i=0; i<n; i++){
        visited[i]=false;
        d[i]=-1;
        for(int j=0; j<n; j++) graph[i][j]=false;
    }
    for(int i=0; i<n; i++){
        int v,k; cin >> v >> k;
        for(int j=0; j<k; j++){
            int w; cin >> w;
            graph[v-1][w-1]=true;
        }
    }
    d[0]=0;


    q.push(0);
    bfs(0);

    for(int i=0; i<n; i++){
        printf("%d %d\n",i+1, d[i]);
    }

}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int main() {
    int N; cin >> N;
    vector<ll> T(N);
    REP(i, 0, N) cin >> T[i];

    ll ans = T[0];
    REP(i, 1, N) {
        ans = lcm(ans, T[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(i64 i = 0; i < N; i++)
#define Rep(i, k, N) for(i64 i = k; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    int X, Y;
    cin >> X >> Y;
    int a = 4*X - Y;
    if( 0 <= a && a/2 <= X && a % 2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3636
n,k,q = map(int, input().split())

ans_list = []
for _ in range(q):
   ans_list.append(int(input()))

n_list = [k-q]*n

for i in range(len(ans_list)):
   n_list[ans_list[i] - 1] += 1

for i in range(len(n_list)):
   if(n_list[i] > 0):
      print('Yes')
   else:
      print('No')

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
	string s;
	cin >> s;
	if(s[0] == 'A'){
		int cnt = 0;
		REP1(i, s.size() - 1){
			if(s[i] == 'C' && 2 <= i && i <= s.size() - 2) cnt++;
			else if(s[i] < 'a' || 'z' < s[i]){
				cout << "WA\n";
				return 0;
			}
		}
		if(cnt==1){
			cout << "AC\n";
			return 0;
		}
		else{
			cout << "WA\n";
			return 0;
		}
	}
	else{
		cout << "WA\n";
		return 0;
	}
	return 0;
}


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

int a, b, k;
int main()
{
	std::cin >> a >> b >> k;

	int num = 0;
	int ans;
	for (int i = std::max(a, b); i > 0; --i) {
		if (num == k)
			break;
		if (a%i == 0 && b%i == 0) {
			++num;
			ans = i;
		}
	}

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


Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
ll dig(ll n) {
  ll keta = log10(n) + 1;
  ll ans = 0;
  ll x = n;
    for(int i = 0;i < keta;i++) {
    ans += x % 10; x /= 10;
  }
  return ans;
}
int main(int argc, char const *argv[])
{
  ll n,a,b;scanf("%lld %lld %lld",&n,&a,&b);
  ll sum = 0;
  for (int i = 0; i < n; ++i)
  {
    if(dig(i+1) >= a and dig(i+1) <= b)sum += i+1;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
 
using namespace std;
 
void solve(int n,int k, vector<int> arr)
{
	sort(arr.begin(),arr.end());
  	int ans=1e9+9;
  	for (int i=0;i<=(n-k);i++)
    {
    	ans=min(ans,arr[i+k-1]-arr[i]);
    }
    cout<<ans;
}
void input()
{
	int n,k;
  	cin>>n>>k;
  	vector<int> arr(n);
  	for (int i=0;i<n;i++)
      cin>>arr[i];
  	solve(n,k,arr);
}
int main()
{
	input();
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int n = ReadInt();
        int m = (int)Math.Sqrt(n);
        var dic = new Dictionary<int, int>();
        for (int x = 1; x <= m; x++)
        {
            for (int y = 1; y <= m; y++)
            {
                for (int z = 1; z <= m; z++)
                {
                    var a = x * x + y * y + z * z + x * y + y * z + z * x;
                    if (dic.ContainsKey(a)) dic[a]++;
                    else dic[a] = 1;
                }
            }
        }
        for (int i = 1; i <= n; i++)
        {
            Console.WriteLine(dic.ContainsKey(i) ? dic[i] : 0);
        }
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}


Measured memory_bytes: 30612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
  int N;
  ll K;
  cin >> N >> K;
  vector<ll>A(N);
  vector<ll>F(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  for (int i = 0; i < N; i ++) cin >> F[i];
  sort(A.begin(), A.end());
  sort(F.begin(), F.end());
  reverse(A.begin(), A.end());
  ll ma = 1e13;
  ll mi = 0;
  while (ma != mi) {
    ll mu = (ma + mi) / 2;
    ll k = K;
    bool can = true;
    for (int i = 0; i < N; i ++) {
      if (A[i] * F[i] > mu) {
        //cout << 'r' << ' ';
        ll kj = (A[i] * F[i]) - mu;
        kj = ((kj - 1) / F[i]) + 1;
        k -= kj;
        if (k < 0) can = false;
      }
      if (!can) break;
    }
    if (can) ma = mu;
    else mi = mu + 1;
    //cout << endl;
    //cout << ma << ' ' << mi << endl;
  }
  cout << mi << endl;
}



Measured memory_bytes: 6380
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        string s = Console.ReadLine();
        var arr = new string[] { "Sunny", "Cloudy", "Rainy" };
        Console.WriteLine(arr.Concat(arr).SkipWhile(x => x != s).Skip(1).First());
    }
}


Measured memory_bytes: 11348
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    print(*max_element(all(v)) - *min_element(all(v)));
}

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

#define int long long int

signed main()
{
    int n,i,j;
    cin>>n;
    int sum=(n*(n+1))/2;
    for(i=2;i<=n;i++)
    {
        for(j=i;j<=n;j+=i) sum+=(j);
    }
    cout<<sum;
}


Measured memory_bytes: 3556
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (200000L)
#define MAX_K (20)

using namespace std;

long nbss[MAX_K][MAX_N + 1] = {};

int main() {
  // read inputs
  long N, as[MAX_N];
  scanf("%ld", &N);
  for (long i = 0; i < N; i++) {
    scanf("%ld", &as[i]);
  }

  // nbss[i + 1][k] : the number of as[j] (j <= i) where the kth LSB is 1
  for (long k = 0; k < MAX_K; k++) {
    for (long i = 0; i < N; i++) {
      if (as[i] & (1 << k)) {
        nbss[k][i + 1] = nbss[k][i] + 1;
      } else {
        nbss[k][i + 1] = nbss[k][i];
      }
    //   printf("%ld ", nbss[k][i + 1]);
    }
    // printf("\n");
  }

  // solve
  long ans = 0;
  for (long l = 0; l < N; l++) {
    long r = N - 1;
    for (long k = 0; k < MAX_K; k++) {
      long rk;
      if (as[l] & (1 << k)) {
        rk = upper_bound(nbss[k], nbss[k] + N + 1, nbss[k][l + 1]) - nbss[k] - 2;
      } else {
        rk = upper_bound(nbss[k], nbss[k] + N + 1, nbss[k][l + 1] + 1) - nbss[k] - 2;
      }
    //   printf("l = %ld, k = %ld, rk = %ld\n", l, k, rk);
      r = min(r, rk);
    }
    ans += r - l + 1;
  }
  printf("%ld\n", ans);
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;

int n,x,a[110];

int main() {
  cin >> n >> x;
  ll sum=0;
  rep(i,n){
  cin >> a[i]; sum+=a[i];
  }
  sort(a,a+n);
  int ans=0;  sum<x? ans=-1 : ans=0;
  sum=0; 
  rep(i,n){
    if(sum+a[i]<=x){
    ans++; sum+=a[i];
    }
    else break;
  }
  cout << ans << endl;
}

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


 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		int[][] dp = new int[n][3]; //max happy points with act i on last considered day
		
		
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		
		//3 cases: chose a,b or c on previous go
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 3; j++) { // activity on ith day
				if(i == 0) { //first day
					if(j == 0) {
						dp[i][j] = a[0];
					}else if(j == 1) {
						dp[i][j] = b[0];
					}else {
						dp[i][j] = c[0];
					}
				}else {
					for(int k = 0; k < 3; k++) { // activity on previous day
						if(j == k) {
							continue;
						}else {
							if(j == 0) dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + a[i]);
							else if(j == 1) dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + b[i]);
							else dp[i][j] = Math.max(dp[i][j], dp[i-1][k] + c[i]);
						}
					}
				}
				
			}
		}
		
		System.out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
			
		}
}

Measured memory_bytes: 97360
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//??????
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()

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

	for (int i = 0; i < n; i++) {
		int h, m;
		scanf("%2d:%2d", &h, &m);

		// [0, 3600)
		int deg_h, deg_m;
		deg_h = 300 * h + 5 * m;
		deg_m = 60 * m;

		if (deg_h > deg_m) swap(deg_h, deg_m);

		int angle = deg_m - deg_h;

		if (angle > 1800) {
			deg_h += 3600;
			angle = deg_h - deg_m;
		}

		if (angle < 300) cout << "alert";
		else if (angle >= 900) cout << "safe";
		else cout << "warning";
		cout << endl;
	}

}

Measured memory_bytes: 3140
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function kaibun(s)
  flag=true
  for i=1:fld(length(s),2)
    if s[i]!=s[end-i+1]
      flag=false
    end
  end
  return flag
end
function main()
  a,b=pM(split(readline()))
  ans=0
  for i =a:b
    if kaibun(string(i))
      ans+=1
    end
  end
  println(ans)
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


Measured memory_bytes: 119904