akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define mod 1000000007

using namespace std;

string s[1001];

int main() {
    IOS;
    ll n,m;
    cin>>n>>m;
    for(int h=0;h<n;h++)
        cin>>s[h];
    //sort(arr,arr+n);
    ll dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int y=0;y<n;y++)
    {
        for(int h=0;h<m;h++)
        {
            if(s[y][h]=='.')
            {
                if(h-1>=0 && y>=0 && s[y][h-1]=='.')
                    dp[y][h]=(dp[y][h]+dp[y][h-1])%mod;
                if(y-1>=0 && h>=0 && s[y-1][h]=='.')
                    dp[y][h]=(dp[y][h]+dp[y-1][h])%mod;

            }
             //cout<<dp[y][h]<<" ";
        }
        //cout<<"\n";
    }
    cout<<dp[n-1][m-1]<<"\n";
    return 0;
}


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

int main(){
	int x;
	int i = 0;
	while(1){
		cin >> x;
		i++;
		if(x != 0){
			cout << "Case" << " " << i << ":" << " " << x << endl;
		}else{
			break;
		}
	}
	return 0;
} 

Measured memory_bytes: 1160
<?php
  while (true) {
    $a = trim(fgets(STDIN));
    if ($a == "0") { return; }
    $b = explode(" ", trim(fgets(STDIN)));
    $z = 0;
    foreach ($b as $val) {
      $z += pow(($val - array_sum($b) / $a), 2) / $a;
    }
    print(sqrt($z) . "\n");
  }
?>

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

int main() {
    string s,t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t){
        cout << "Yes" << endl;
    }
    else if(s>=t){
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

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

    public Main(){
    	new AOJ().doIt();
    }
    
    class AOJ{
    	void doIt(){
    		for(int i=1;i<=9;i++)for(int s=1;s<=9;s++)System.out.println(i+"x"+s+"="+(i*s));
    	}
    }
    
}

Measured memory_bytes: 17132
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::string s;
    std::cin >> s;
    int k = std::count(s.begin(), s.end(), 'x');
    std::cout << (k >= 8 ? "NO" : "YES") << std::endl;

    return 0;
}


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

int main()
{int a, b;
   cin >> a >> b;
   for(int i = 0;i < 2000;i++) {
     int store_a = (int)(i*0.08);
     int store_b = (int)(i*0.1);
     if(store_a == a && store_b == b) {
       cout << i << endl;
       return 0;
     }

   }
   cout << -1 << endl;
   return 0;
}


Measured memory_bytes: 256
import sys
from fractions import gcd
sys.setrecursionlimit(10**5)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
l = list(map(int, input().split()))

u = 10**9+7

lcm = 1
s = 0
for i in range(N):
    k = l[i]
    g = gcd(k,lcm)
    t = k//g
    lcm = lcm*t
    s = s*t + lcm//k
print(s%u)

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

int main(){
    vector<int>a(3);
    cin>>a[0]>>a[1]>>a[2];
    sort(a.begin(),a.end());
    if(a[0]==5&&a[1]==5&&a[2]==7)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 3592
import copy, sys

class Dice(object):
    def __init__(self, nums):
        self.top, self.front, self.right, self.left, self.back, self.bottom = nums

    def roll(self, directions):
        if directions == 'E':
            self.top, self.right, self.left, self.bottom = self.left, self.top, self.bottom, self.right
            return

        if directions == 'N':
            self.top, self.front, self.back, self.bottom = self.front, self.bottom, self.top, self.back
            return

        if directions == 'S':
            self.top, self.front, self.back, self.bottom = self.back, self.top, self.bottom, self.front
            return

        if directions == 'W':
            self.top, self.right, self.left, self.bottom = self.right, self.bottom, self.top, self.left
            return

        self.roll(directions[0])
        self.roll(directions[1:])

    def equal(self, dice):
        d = copy.copy(self)

        if(dice.front == d.top):
            d.roll('S')
        elif(dice.front == d.right):
            d.roll('WS')
        elif(dice.front == d.left):
            d.roll('ES')
        elif(dice.front == d.back):
            d.roll('SS')
        elif(dice.front == d.bottom):
            d.roll('N')

        if(dice.top == d.right):
            d.roll('W')
        elif(dice.top == d.left):
            d.roll('E')
        elif(dice.top == d.bottom):
            d.roll('WW')

        return not(dice.top != d.top or dice.front != d.front or dice.right != d.right or dice.left != d.left or dice.back != d.back or dice.bottom != d.bottom)

if __name__ == '__main__':
    n = int(input())
    dices = [[] for _ in range(600)]
    for i in range(n):
        nums = [int(_) for _ in input().split()]
        d = Dice(nums)
        s = sum(nums)
        for dice in dices[s]:
            if d.equal(dice):
                print('No')
                sys.exit()
        dices[s].append(d)
    print('Yes')

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

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

#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ms(a, x) memset(a, x, sizeof(a))
#define len(x) (x).size()
#define pb push_back
#define eb emplace_back
#define f first
#define s second

const double eps = 1e-9;
const double pi = acos(-1.0);
const int inf = 1e9 + 7;
const int maxn = 1e5+5;

int n, k;
int h[maxn];
int dp[maxn];

int main() {
    fastIO();
    cin >> n >> k;
    for (int i = 0; i < n; ++i) cin >> h[i];
    
    for (int idx = n-2; idx >= 0; --idx) {
        int &ans = dp[idx];
        ans = inf;
        for (int i = 1; i <= k; ++i) {
            if (i + idx >= n) break;
            ans = min(ans, dp[idx + i] + abs(h[idx] - h[idx + i]));
        }
    }

    cout << dp[0] << "\n";
    return 0;
}



Measured memory_bytes: 4380
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
    public static boolean debug = true;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        LinkedList<Integer> list = new LinkedList();
        for(int i=0; i<n; i++){
            list.add(sc.nextInt());
        }

        Collections.sort(list);

        double temp = 0;
        for(int i=0; i<list.size();i++){
            if(temp ==0){
                temp = list.get(i);
            }
            temp = (list.get(i) + temp )/2;
        }

        System.out.println(temp);


    }
    public static void d(String message){
        if(debug){
            System.out.println(message);
        }
    }
}


Measured memory_bytes: 23252
#include <stdio.h>

#define N 100
#define WHITE 0
#define BLACK 1
#define GRAY 2

int G[N][N], d[N], f[N], color[N], time=0;

void DFS(int n, int u){
  int v;

  color[u] = GRAY;

  d[u] = ++time;

  for(v = 0; v < n; v++)
    if(G[u][v] == 1 && color[v] == WHITE) DFS(n, v);

  color[u] = BLACK;
  f[u] = ++time;

}

int main(){
  int n, i, j, u, k, v;

  scanf("%d", &n);

  //initialize
  for(i = 0; i < n; i++)
    for(j = 0; j < n; j++)
      G[i][j] = 0;

  for(i = 0; i < n; i++){
    scanf("%d %d", &u, &k);
    for(j = 0; j < k; j++){
      scanf("%d", &v);
      G[u - 1][v - 1] = 1;
    }
  }

  for(i = 0; i < n; i++)
    color[i] = WHITE;

  for(i = 0; i < n; i++)
    if(color[i] == WHITE) DFS(n, i);

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

  return 0;
}

Measured memory_bytes: 636
N = int(input())
S = list(input())

alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

for i in range(len(S)):
    for j in range(52):
        if S[i] == alphabet[j]:
            S[i] = alphabet[j+N]
            break

print("".join(S))

Measured memory_bytes: 3188
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
        string frame = "";
        for (int i = 0; i < N[1] + 2; i++) frame += "#";
        string res = "";
        res += frame;
        res += "\n";
        for (int i = 0; i < N[0]; i++)
        {
            res += "#" + Console.ReadLine() + "#\n";
        }
        res += frame;
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 13396
#include<stdio.h>
int main(void){
    int n;
    int k;
    int b;
    scanf("%d",&n);
    scanf("%d",&k);
    int a[n];
    for(int i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++ ){
            if(a[i] > a[j]){
                b = a[i];
                a[i] = a[j];
                a[j] = b;
            }
        }
    }
    /*for(int i = 0; i< n;i++){
        printf("%d\n",a[i]);
    }*/
    int sum = 0;
    for(int i = 0; i < k; i++){
        sum = sum + a[i];
    }
    printf("%d\n",sum);

    return 0;
}

Measured memory_bytes: 1716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,k;
  cin>>n>>k;
  k--;
  vll a(n+1);
  ll ans=0;
  rep(i,n) cin>>a[i+1];
  ll cu;
  rep(i,n){
    if(a[i+1]==1) cu=i+1;
  }
  if(n-cu<k){
    ans=1;
    ans+=((n-k-1)+k-1)/k;
  }
  
  else if(cu-1<k){
    ans=1;
    ans+=((n-k-1)+k-1)/k;
  }
  else{
    
  ans+=(n-1+k-1)/k;
  }
  COUT(ans);
}

  


Measured memory_bytes: 1024
from fractions import gcd
n, X = map(int, input().split())
x = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(abs(X-x[i]))
if n > 1:
    b = gcd(a[0],a[1])
else:
    b = a[0]
for i in range(n):
    b = gcd(b,a[i])
print(b)

Measured memory_bytes: 16372
/*
 *  Created on: 21 / 6 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO

#include <bits/stdc++.h>
//#include <bits/BIGINT.h>
//#include <bits/Int128.h>
using namespace std;

#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)
#define test(t)      while(t--)

//ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//__int128
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    //stp(0)
    Eslam__Waheed
      //  while (true)
       // {
            ll n; cin >> n;
            ss ans = "";
            while (n)
            {
                ll x = n % 26;
                if (x == 0) x = 26;
                ans += ((x - 1) + 'a');
                //cout << ((x - 1)) << endl;
                n = ((n - 1) / 26);
            }
            reverse(all(ans));
            cout << ans << endl;
      //  }
}

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

using namespace std;

const int N = 3010;

double p[N];

long double dp[N][N];

int main() {

    int n;
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
        cin >> p[i];


    dp[0][0] = 1;

    for(int i = 1 ; i <= n ; i++) 
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
    

    for(int i = 1 ; i <= n ; i++) {
        for(int j = 1; j <= i ; j++) {
            dp[i][j] = p[i] * dp[i - 1][j - 1] + (1 - p[i]) * dp[i - 1][j];
        }
    }

    double ans = 0;
    for(int i = (n + 1) / 2 ; i <= n ; i++) 
        ans = ans + dp[n][i];

    cout << setprecision(10) <<  ans << '\n';

    return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 1000000007
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)

typedef unsigned int UI;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<char, int> PCI;
int n , k;
int curAns = 0;
vector<vector<int> > g(2000);
int dist[2000][2000];
vector<int> quantBySubtrees;

int cnt = 0;
void dfs(int u , int from , int p = -1)
{
	for(int i = 0; i < g[u].size(); i++)
	{
		int v = g[u][i];
		if(v != p)
		{
			dist[from][v] = dist[from][u] + 1;
			if(dist[from][v] == k % 2 + k / 2)
			{
				cnt++;
			}
			if(dist[from][v] > k / 2 + k % 2)
			{
				curAns++;
			}
			dfs(v , from , u);
			if(dist[from][v] == 1)
			{
				quantBySubtrees.pb(cnt);
				cnt = 0;
			}
		}
	}
}
int findAns(int u)
{
	quantBySubtrees.clear();
	curAns = 0;
	dfs(u , u);
	if(k % 2)
	{
		sort(quantBySubtrees.begin() , quantBySubtrees.end());
		for(int i = 0; i < (int)quantBySubtrees.size() - 1; i++)
		{
			curAns += quantBySubtrees[i];
		}
	}
	return curAns;
}
int main()
{
	//freopen("input.txt" , "r" , stdin);
	scanf("%d %d" , &n , &k);
	for(int i = 1; i < n; i++)
	{
		int u , v;
		scanf("%d %d" , &u , &v);
		u--;v--;
		g[u].pb(v);
		g[v].pb(u);
	}
	int ans = INF;
	for(int center = 0; center < n; center++)
	{
		ans = min(ans , findAns(center));
	}
	cout << ans;
    return 0;
}


Measured memory_bytes: 16128
#include<iostream>
using namespace std;
main(){
	int n,m;
	cin>>n>>m;
	int i=0;
	int a[100000]={};
	int ans=0;
	while(m--){
		cin>>a[i];
		ans+=a[i];
		i++;
	}
	if(ans>n)cout<<"-1";
	else {
		cout<<n-ans;
	}
}

Measured memory_bytes: 4012
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int f,a,b; 
string t,s;
int j()
{
    int m=min(a,b);
    for(int i=0;i<m;i++)
    {
        if(s[i]<t[i]) return 1;
        else if(s[i]>t[i]) return 0;
    }
    if(a<b) return 1;
    else return 0;
}
bool cmp1(char a,char b)
{
    return a<b;
}
bool cmp2(char a,char b)
{
    return a>b;
}
int main(){
    cin>>s>>t;
    a=s.size();
    b=t.size();
    sort(s.begin(),s.end(),cmp1);
    sort(t.begin(),t.end(),cmp2);
    if(j()) cout<<"Yes";
	else cout<<"No"; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  int a, b;
  cin >> a >> b;
  if(10<=a+b)cout<<"error"<<endl;
  else{cout<<a+b<<endl;}
  

  return 0;
}

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

int dp[100001];
int n,k;
int potezi[100001];
vector <int> pot;
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		potezi[a]=1;
		pot.push_back(a);
	}
	dp[0]=0;
	
	for(int i=1;i<=k;i++){
		if(potezi[i]==1)dp[i]=1;
		else{
			for(int j=0;pot[j]<i && j<pot.size();j++){
			if(dp[i-pot[j]]==0) {
				dp[i]=1;
				break;
			}
			}
		}
	}
	
	if(dp[k]==1)cout<<"First";
	else cout<<"Second";
	
}

Measured memory_bytes: 896
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        int n = scanInt();
        long ans = 0;
        long tmp = scanLong();
        for (int i = 1; i < n; i++) {
            long a = scanLong();
            if (tmp > a) {
                ans += tmp - a;
            } else {
                tmp = a;
            }
        }
        out.print(ans);
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

Measured memory_bytes: 54692
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>

using namespace std;

typedef long long ll;

const int MAXN = 200005;
const ll MOD = 924844033;
const ll G = 5;

struct Edge
{
	int to;
	int nxt;
}edge[MAXN << 1];

int n,N,id;
int size[MAXN];
int first[MAXN];
int rev[MAXN << 2];

ll ans;
ll cnt[MAXN];
ll fac[MAXN];
ll inv[MAXN];
ll f[MAXN << 2];
ll g[MAXN << 2];
ll wn[2][MAXN << 2];

void addE(int u,int v)
{
	edge[++id] = (Edge){v,first[u]};
	first[u] = id;
}

void dfs(int u,int fa)
{
	size[u] = 1;
	cnt[n]++;
	for (int i = first[u];i;i = edge[i].nxt)
		if (edge[i].to != fa)
		{
			dfs(edge[i].to,u);
			size[u] += size[edge[i].to];
			cnt[size[edge[i].to]]--;
		}
	cnt[n - size[u]]--;
}

ll power(ll a,ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			(res *= a) %= MOD;
		(a *= a) %= MOD;
		b >>= 1;
	}
	return res;
}

void init()
{
	fac[0] = 1;
	for (int i = 1;i <= n;i++)
		fac[i] = fac[i - 1] * i % MOD;
	inv[n] = power(fac[n],MOD - 2);
	for (int i = n;i >= 1;i--)
		inv[i - 1] = inv[i] * i % MOD;
}

void NTTinit(int l)
{
	N = 1;
	while (N < l)
		N <<= 1;
	for (int i = 1;i < N;i++)
		rev[i] = (rev[i >> 1] >> 1) + (i & 1) * (N >> 1);
	int half = N >> 1;
	for (int i = 0;i < half;i++)
		wn[1][i + half] = power(wn[0][i + half] = power(G,(MOD - 1) * i / N),MOD - 2);
	for (int i = half - 1;i >= 0;i--)
	{
		wn[0][i] = wn[0][i << 1];
		wn[1][i] = wn[1][i << 1];
	}
}

void NTT(ll *v,int inv)
{
	for (int i = 0;i < N;i++)
		if (i < rev[i])
			swap(v[i],v[rev[i]]);
	for (int i = 1;i < N;i <<= 1)
		for (int j = 0;j < N;j += (i << 1))
		{
			ll *l = v + j,*r = v + j + i,*w = wn[inv == -1] + i,V;
			for (int k = 0;k < i;k++,l++,r++,w++)
			{
				V = *r * *w;
				*r = (*l - V) % MOD;
				*l = (*l + V) % MOD;
			}
		}
	if (inv == -1)
	{
		ll Inv = power(N,MOD - 2);
		for (int i = 0;i < N;i++)
			(v[i] *= Inv) %= MOD;
	}
}

int main()
{
	scanf("%d",&n);
	init();
	for (int u,v,i = 1;i < n;i++)
	{
		scanf("%d%d",&u,&v);
		addE(u,v);
		addE(v,u);
	}
	dfs(1,0);
	for (int i = 0;i <= n;i++)
		f[i] = cnt[i] * fac[i] % MOD;
	for (int i = 0;i <= n;i++)
		g[i] = inv[n - i];
	NTTinit(n << 1 | 1);
	NTT(f,1);
	NTT(g,1);
	for (int i = 0;i < N;i++)
		(f[i] *= g[i]) %= MOD;
	NTT(f,-1);
	for (int i = 1;i <= n;i++)
		printf("%lld\n",(inv[i] * f[i + n] % MOD + MOD) % MOD);
	return 0;
}

Measured memory_bytes: 47616
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>

using namespace std;

int N;

int main()
{
  cin >>N;
  
  float a;
  
  a=(N-N/2)*1.0/N;
  
  cout << a ;
  
  
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    int r = 0;
    for (int i = a; i <= b; i++)
    {
        int s = i % 10;
        int t = i / 10000 % 10;
        int u = i / 10 % 10;
        int v = i / 1000 % 10;
        if (s == t && u == v)
        {
            r++;
        }
    }
    cout << r << endl;
    /*
    5桁の回文数 9 * 9 * 10 = 810
    1桁 & 5桁目の取りうる範囲
    2桁 & 4桁目の取りうる範囲
    */
}

Measured memory_bytes: 3616
n, m = map(int, input().split())

hList = [int(x) for x in input().split()]

tenboudai = [1 for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    if hList[a - 1] == hList[b - 1]:
        tenboudai[a - 1] = 0
        tenboudai[b - 1] = 0
    elif hList[a - 1] > hList[b - 1]:
        tenboudai[b - 1] = 0
    else:
        tenboudai[a - 1] = 0

ans = 0
for i in tenboudai:
    if i == 1:
        ans += 1

print(ans)

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

int main() {
	int n,H[100010];
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> H[i];
	}
	for(int i=1;i<n;i++){
		if(H[i]-1 >= H[i-1]){
			H[i]--;
		}
	}
	cout << (is_sorted(H,H+n) ? "Yes" : "No") << "\n";
	return 0;
}

Measured memory_bytes: 640
/*
   Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define pii pair < ll, ll >
#define vi vector < ll >
#define vb vector < bool >
#define vvi vector < vector < ll > >
#define vvb vector < vector < bool > >
#define vpii vector < pair < ll, ll > >
#define vvpii vector < vector < pair < ll, ll > > >
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define min_pq(t) priority_queue < t, vector < t >, greater < t > >
#define max_pq(t) priority_queue < t >
#define pb push_back
#define ff first
#define ss second

ll mod_sum() { return 0ll; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_product(T a, Args... args) { return (a*mod_product(args...))%mod; }

// --------------------------------------------------------------

ll solve(){
    int n, k;
    cin >> n >> k;
    vb vec(n, false);
    for(int i=0; i<k; i++){
        int d;
        cin >> d;
        while(d--){
            int x;
            cin >> x;
            vec[x-1] = true;
        }
    }
    cout << count(all(vec), false) << endl;
    return 0;
}

int main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}



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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    ll n, a, b;
    cin >> n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            a = i;
            b = n / i;
        }
    }
    // debug(a);
    // debug(b);
    ll ans = (a - 1) + (b - 1);
    out(ans);
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""

# 最大公約数 と 最小公倍数
"""def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g"""

# 二分探索
"""import bisect # 二分探索
print(A,bisect.bisect_left(A,4))
print(C,n - bisect.bisect_right(C,4))
print(sum(bisect.bisect_left(A,b) * (n-bisect.bisect_right(C,b)) for b in B))"""

# 円周率 pi
"""import math
pi_ = math.pi"""

def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7

def main():
  n,a,b = readInts()
  sum_ = a + b
  if n // sum_  == 0:
    if n >= a:
      print(a)
    else:
      print(n)
  else:
    quo = n // sum_ # quotient 商
    if n % sum_ != 0:
      sur = n % sum_
      if sur >= a:
        print(quo * a + a)
      else:
        print(quo * a + sur)
    else:
      print(quo * a)
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
import queue
N,M =[int(i)for i in input().split()]
adlist =[[]for i in range(N)] #隣接リスト
oyalist =[[]for i in range(N)] #親ノードリスト
for _ in range(N+M-1):
    A,B =[int(i)-1 for i in input().split()]
    adlist[A].append(B)
    oyalist[B].append(A)

iri =[0]*N #入次数のリスト
for i in range(N):
    iri[i] =len(oyalist[i])

topo =[0]*N #トポロジカルソートの番号
tyouten =oyalist.index([]) #頂点
num = 0 #ソート番号
q =queue.Queue()
q.put(tyouten)
topo[tyouten]=num

while num != N-1:
    now = q.get()
    for i in adlist[now]:
        iri[i] -=1
        if iri[i] == 0:
            q.put(i)
            num += 1
            topo[i] =num

#出力
oyalist[tyouten].append(-1)
for i in range(N):
    oyalist[i] =sorted(oyalist[i],key=lambda x:topo[x],reverse=True)
    print(oyalist[i][0]+1)

Measured memory_bytes: 39452
N = int(input())
D, X = map(int, input().split())

A = [int(input()) for _ in range(N)]

choco = [0] * (D + 1)
for a in A:
    i = 0
    while i * a + 1 <= D:
        choco[i * a + 1] += 1
        i += 1
print(sum(choco) + X)

Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <istream>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define vec vector<int>a(n)
#define soot(a) sort(a.begin(),a.end())
/*int n;
cin >> n;
vector<int>a(n);
rep0(i, n - 1)cin >> a[i];*/
using namespace std;
int main() {
	vector<int>a(3);
	rep0(i, 2)cin >> a[i];
	soot(a);
	cout << a[0] <<" "<< a[1] <<" "<< a[2] << endl;
	return 0;
}


Measured memory_bytes: 3140
#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>
#include<complex>
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 = 4000001;
const double eps = 1E-18;

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 fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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

ll N;
vector<vector<ll>> g;

vector<ll> go;
vector<ll> back;

ll dfs(ll v) {
	go[v] = 1;
	for (ll w : g[v]) {
		
		if (go[w] == 0) {
			ll u = dfs(w);
			if (u!=0) { return u; }
		}

		if (go[w] == 1 && back[w] == 0) {return v;}
	}
	back[v] = 1;
	return 0;

}

vector<ll> gr;

ll rt, X;

ll grundy(ll v, bool b) {
	set<ll> st;

	for (ll w : g[v]) {
		if (w != rt) { st.insert(grundy(w, b)); }
	}

	ll ret = 0;
	while (1) {
		if (!st.count(ret)) {
			if (v == X && b == 1) { ret++; }
			gr[v] = ret;
			return ret; }
		ret++;
	}
}


int main() {
	cin >> N;
	
	g.resize(N + 1);
	go.assign(N + 1, 0);
	back.assign(N + 1, 0);

	repn(i, N) {
		ll p;
		cin >> p;
		g[p].push_back(i);
	}

	repn(i, N) {
	if (go[i] == 1) { continue; }

		X = dfs(i);
		if (X != 0) { rt = i; break; }
	}

	//cout << X << " " << rt << endl;
	
	bool b = 0;

	gr.assign(N + 1, 0);
	grundy(rt, 0);
	if (gr[X] != gr[rt]) { b = 1; }

	gr.assign(N + 1, 0);
	grundy(rt, 1);
	if (gr[X] == gr[rt] + 1) { b = 1; }

	if (b == 1) { cout << "POSSIBLE"; }
	else { cout << "IMPOSSIBLE"; }


	
	system("PAUSE");



}

Measured memory_bytes: 36352
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        N: usize,
        T: f32,
        A: f32,
        Hs: [f32; N],
    }

    let mut ans_ind: usize = 0;
    let mut min_diff: f32 = std::f32::MAX;
    let diffs = Hs.iter().enumerate().map(|(i, &h)| {
        (i, (T - h * 0.006 - A).abs())
    });

    for (i, diff) in diffs {
        if diff < min_diff {
            min_diff = diff;
            ans_ind = i;
        }
    }

    println!("{}", ans_ind + 1);
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
	// your code goes here
	long long n,sum=0;
	cin>>n;
	for(long long i=1;i<=n;i++)
	{
		sum+=(n-1)/i;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef long long ll;

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

    int n, x, t; cin >> n >> x >> t;
    cout << ((n+x-1)/x)*t << endl;

    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
  cin >> a >> b;
  if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

vector<int> edg[100003];
bool used[100003];
deque<int> ans;

int main() {
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int a, b; cin >> a >> b;
		--a; --b;
		edg[a].push_back(b);
		edg[b].push_back(a);
	}
	int s = 0, t = edg[0][0];
	ans.push_back(s); ans.push_back(t);
	used[s] = used[t] = true;
	bool flag = true;
	for (int i = 0; i < (int)edg[s].size(); ++i) flag &= used[edg[s][i]];
	for (int i = 0; i < (int)edg[t].size(); ++i) flag &= used[edg[t][i]];
	while (!flag) {
		flag = true;
		for (int i = 0; i < (int)edg[s].size(); ++i) {
			flag &= used[edg[s][i]];
			if (!used[edg[s][i]]) {
				s = edg[s][i];
				ans.push_front(s);
				used[s] = true;
				break;
			}
		}
		for (int i = 0; i < (int)edg[t].size(); ++i) {
			flag &= used[edg[t][i]];
			if (!used[edg[t][i]]) {
				t = edg[t][i];
				ans.push_back(t);
				used[t] = true;
				break;
			}
		}
	}
	cout << ans.size() << endl;
	while (!ans.empty()) {
		int pos = ans.front(); ans.pop_front();
		cout << pos + 1 << (ans.empty() ? "\n" : " ");
	}
	return 0;
}


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

using namespace std;

int main() {
	string s, begin, end;
	cin >> s;
	int l = s.length();
	for (int i = 0; i < l; ++i) {
		if (s[i] != s[l - 1 - i]) {
			cout << "No";
			return 0;
		}
	}
	begin = s.substr(0, (l - 1) / 2);
	end = s.substr((l + 3) / 2 - 1);
	for (int i = 0; i < l / 2; ++i) {
		if (begin[i] != begin[(l - 1) / 2 - 1 - i] || end[i] != end[(l - 1) / 2 - 1 - i]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	
	return 0;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll p = n/(a+b);
    ll q = n%(a+b);
    cout << p*a+min(q,a) << endl;
}

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

int main() { 
    long long h, w, ans;
    cin >> h >> w;
    ans = ceil(h*w/2.0);
    if(h == 1 || w == 1) cout << 1 << '\n';
    else printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
  // 整数の入力
  string S,T;
  cin >> S >> T;
  ll ans = 0;
  for (size_t i = 0; i < S.length(); i++)
  {
    if (S[i] != T[i]){
      ans++;
    }
  }
  cout <<ans << endl;

  return 0;
}

Measured memory_bytes: 3856
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(x: usize, y: usize);
    if x % y == 0 {
        println!("-1");
        return;
    }

    let mut buff = x;
    while buff < 1_000_000_000_000_000_000 {
        buff += x;
        if buff % y != 0 {
            println!("{}", buff);
            return;
        }
    }
    println!("-1");
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  map<int, int> mp;
  FOR(i,2,n+1){
    int x = i;
    FOR(j,2,x+1){
      while(x%j==0){
        x/=j;
        mp[j]++;
      }
    }
  }
  
  ll ans = 1;
  for(auto x: mp){
    ans = (ans * (ll)(x.second+1)% MOD) % MOD;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))

a1=sum(a)//N
a2=(sum(a)-1+N)//N

ans1=0
ans2=0

for i in range(N):
    ans1+=(a[i]-a1)**2
    ans2+=(a[i]-a2)**2

print(min(ans1,ans2))

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	cin >> N;
	int64 res = 0;

	FOR(i, 1, N+1) {
	  res = 0;
    for (int x = 1; x * x <= i; x++) {
      for (int y = 1; x * x + y * y + x * y <= i; y++) {
        for (int z = 1;; z++) {
          int now = x * x + y * y + z * z + x * y + y * z + z * x;
          if (now > i) break;
          if (now == i) res++;
        }
      }
    }
    cout << res << endl;
  }
}


Measured memory_bytes: 3632
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio 
    int n ;
    cin >> n ;
    int ans = 0 ;
    for(int i = 1; i <= n; i++){
        if ( !(i % 15 == 0 || i % 3 == 0 || i % 5 == 0 ) ) ans += i ;
    }
    cout << ans << endl;
    return 0 ; 
}

Measured memory_bytes: 3648
import java.util.*;

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

        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int ans = Math.min(Math.abs(a + w - b), Math.abs(b + w - a));
        System.out.println(Math.abs(a - b) <= w ? 0 : ans);

    }
}


Measured memory_bytes: 21844
##### 解けた #####

a,b=input().split(" ")

if (a=="H" and b=="H") or ((a=="D" and b=="D")): # Aが本当で本当と言った場合か、嘘で嘘と言った場合、Bは本当
    print("H")
elif (a=="H" and b=="D") or (a=="D" and b=="H"): # Bが本当で嘘と言った場合か、嘘で本当と言った場合、Bは嘘
    print("D")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#define int long long
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int a[m], b[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
  }

  vector<int> a1;
  for (int i = 0; i < m; i++) {
    if (a[i] == 1) {
      a1.push_back(b[i]);
    }
  }
  vector<int> a2;
  for (int i = 0; i < m; i++) {
    if (b[i] == n) {
      a2.push_back(a[i]);
    }
  }

  sort(a1.begin(), a1.end());
  sort(a2.begin(), a2.end());

  
  while (1) {
    if (a1.size() == 0 || a2.size() == 0) {
      cout << "IMPOSSIBLE" << endl;
      break;
    }
    
    if (a1[0] == a2[0]) {
      cout << "POSSIBLE" << endl;
      break;
    }
    
    if (a1[0] > a2[0]) {
      a2.erase(a2.begin());
    } else {
      a1.erase(a1.begin());
    }
  }
  return 0;
}


Measured memory_bytes: 2936
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

const MOD = 1000000007

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m := getInt(), getInt()
	x := make([]int, n)
	y := make([]int, m)

	for i := 0; i < n; i++ {
		x[i] = getInt()
	}
	for i := 0; i < m; i++ {
		y[i] = getInt()
	}

	l := 0
	r := n - 1
	t := n - 1
	sx := 0
	for t > 0 {
		sx = (sx + (asub(x[r], x[l])*t)%MOD) % MOD
		l++
		r--
		t -= 2
	}

	l = 0
	r = m - 1
	t = m - 1
	sy := 0
	for t > 0 {
		sy = (sy + (asub(y[r], y[l])*t)%MOD) % MOD
		l++
		r--
		t -= 2
	}
	out((sx * sy) % MOD)
}


Measured memory_bytes: 4992
import math
while True:
    # 入力、終了判定
    n = int(input())
    if n==0:
     break
    a = [int(i) for i in input().split()]

    # 平均mの計算
    total = 0
    for si in a:
        total += si
    m = total/n

    # 分散alpha2の計算
    dif2 = 0
    for si in a:
        dif2 += (si-m)**2
    alpha2 = dif2/n

    # 出力
    print(math.sqrt(alpha2))


Measured memory_bytes: 5708
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N = int(input())
A = [int(x) for x in input().split()]
ans = [0]*N
for i in range(N-1):
    ans[A[i]-1] += 1

for i in range(N):
    print(ans[i])


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

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

    int N = (int)S.size();
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'o') cnt++;
    }
    if (cnt + (15 - N) >= 8)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define umapii  unordered_map<int,int>


int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (a[i] == a[j] || a[j] == a[k] || a[i] == a[k]) {
					continue;
				}
				if (a[i] + a[k] > a[j] && a[i] + a[j] > a[k] && a[k] + a[j] > a[i]) {
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;

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

    Vi h(n);
    REP(i, n) cin >> h[i];

    VVi adj(n);
    REP(i, m) {
        int x, y; cin >> x >> y; x--; y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    int cnt = 0;
    REP(i, n) {
        bool f = true;
        REP(j, adj[i].size()) {
            f &= h[i] > h[adj[i][j]];
        }
        if (f) cnt++;
    }

    cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 8680
N, C = map(int, input().split())
S, T = set(), set()
for _ in range(N):
    s, t, c = map(int, input().split())
    S.add((s, c))
    T.add((t, c))
# delete continuous programs
ST = S & T
S -= ST
T -= ST

S = sorted(S)
T = sorted(T)
ans = 0
cnt = 0
si, ti = 0, 0
while si < len(S):
    if S[si][0] <= T[ti][0]:
        cnt += 1
        ans = max(ans, cnt)
        si += 1
    else:
        cnt -= 1
        ti += 1

print(ans)

Measured memory_bytes: 37048
import java.util.*;
public class Main {
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  // 文字列の入力
	  String s = sc.next();
      
      char[] c = s.toCharArray();

      for(int i = 0; i < s.length()-1; i++) {
        if(c[i] == c[i+1]) {
          System.out.println("Bad");
          return;
        }
      }
      System.out.println("Good");
      
	}
}

Measured memory_bytes: 23764