akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll popcount(ll n){
    ll ret=0;
    while(n>0){
        ret+=n%2;
        n/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll par[800010];
ll len[800010];
ll you[800010];
void init(ll n){
  for(int i=0;i<n;i++){
    par[i]=i;
    len[i]=0;
    you[i]=1;
  }
}
ll root(ll n){
  if(par[n]==n)return n;
  return par[n]=root(par[n]);
}
void unit(ll a,ll b){
  a=root(a);
  b=root(b);
  if(a==b)return;
  if(len[a]<len[b]){
    par[a]=b;
    you[b]+=you[a];
  }
  else{
    par[b]=a;
    you[a]+=you[b];
    if(len[a]==len[b])len[a]++;
  }
}
struct edge{
    ll from,to,cost;
};
bool cmp(edge &a,edge &b){
    return a.cost<b.cost;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;cin>>n;
    init(n+1);
    vector<pll> v,w;
    rep(i,0,n){
        ll x,y;cin>>x>>y;
        v.push_back({x,i});
        w.push_back({y,i});
    }
    sort(v.begin(),v.end());
    sort(w.begin(),w.end());
    vector<edge> vv;
    rep(i,1,v.size()){
        vv.push_back((edge){v[i-1].second,v[i].second,v[i].first-
            v[i-1].first});
    }
    rep(i,1,w.size()){
        vv.push_back((edge){w[i-1].second,w[i].second,w[i].first-
            w[i-1].first});
    }
    sort(vv.begin(),vv.end(),cmp);
    ll ans=0;
    rep(i,0,vv.size()){
        edge e=vv[i];
        ll f=e.from,g=e.to,co=e.cost;
        if(root(f)==root(g))continue;
        ans+=co;
        unit(f,g);
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 17888
s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
    if operation[0] == '1':
        n = not n
    if operation[0] == '2':
        t , f, c = operation
        f = int(f)
        if n:
            f = 1 if f != 1 else 2
        if f == 1:
            left=c+left
        elif f == 2:
            right+=c
s = left+s+right
print(s[::-1] if n else s)

Measured memory_bytes: 41332
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<ll> vec(n);
  vector<ll> mvec(n);
  rep(i, n) {
    int x;
    cin >> x;
    vec[i] = x;
    mvec[i] = x;
  }
  sort(mvec.begin(), mvec.end());
  reverse(mvec.begin(), mvec.end());
  rep(i, n) {
    if (vec[i] == mvec[0]) {
      cout << mvec[1] << endl;
    } else {
      cout << mvec[0] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4736
N=int(input())
A=[[[],[]] for _ in range(N)]
for i in range(N):
  a=int(input())
  for j in range(a):
    n,p = map(int, input().split())
    A[i][p].append(n)
def test(i):
  T=[]
  F=[]
  TT=set()
  TF=set()
  for n in range(N):
    if 1 & i>>n:
      T+=A[n][1]
      F+=A[n][0]
      TT.add(n+1)
    else: TF.add(n+1)
  if set(T)<=TT and set(F)<=TF: return len(TT)
  else: return -1
        
s=0
for i in range(2**N):
  s=max(s,test(i))
print(s)
  

Measured memory_bytes: 45404
#include<stdio.h>
int graph[101][101],n,c,d;

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=1;i<=n;i++)
      for(j=1;j<=n;j++)
	graph[i][j]=i==j?0:1000000;

    for(i=0;i<k;i++){
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=1000000?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
using namespace std;

int main()
{
    long long num, count = 0;
    int max, height;
    cin >> num >> max;
    for (long long i = 0; i < num; i++)
    {
        cin >> height;
        if (height >= max)
        {
            count++;
        }
    }
    
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
        #define ll  long long
        #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        #define rep(i,a,b)  for(ll i=a;i<b;i++)
        #define pb push_back
        #define Max(x,y,z) max(x,max(y,z))
        #define f first
        #define s second
        #define lbd lower_bound
        #define sz(x)       (ll)x.size()
        #define pi 3.1415926536
        #define mod 1000000007
        #define MOD 998244353
        #define val 1.00000000
        #define INF INT_MAX
        using namespace std;
        /*const int N=2e5+5;
        bool vis[N];*/
        void solve()
        {
            ll n,m,l=0,r=0,z,sum1=0,cnt1=0,ha,a,b,c,d,x,y;
            cin>>a>>b>>c;
            cout<<c-min(a-b,c);
            
        }        
    int main()
        {   
            /*#ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
            #endif*/
     
            ll t=1;
            //cin>>t;
            while(t--)
                solve();
        }

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll a[300000];
int main(){
	int n;cin>>n;
	map<int,int>mp;
	ll ans=0;
	rep(i,n){
		scanf("%lld",&a[i]);
		ans+=mp[i-a[i]];
		mp[a[i]+i]++;
	}
	cout<<ans<<endl;
}

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

int n,m,x,ans=1e9+7;
int c[105],a[105][105],pos[105];

signed main()
{
	cin>>n>>m>>x;
	for (int i=1;i<=n;i++)
	{
		cin>>c[i];
		for (int j=1;j<=m;j++)  cin>>a[i][j];
	}
	while (pos[0]==0)
	{
		int in[105]={0},money=0;
		for (int i=1;i<=n;i++)
		{
			if (pos[i]==1)
			{
				money+=c[i];
				for (int j=1;j<=m;j++)  in[j]+=a[i][j];
			}
		}
		int flag=1;
		for (int i=1;i<=m;i++)
		{
			if (in[i]<x)
			{
				flag=0;
				break;
			}
		}
		if (flag==1)  ans=min(ans,money);
		
		for (int i=n;i>=0;i--)
		{
			if (pos[i]==1)  pos[i]=0;
			else
			{
				pos[i]=1;
				break;
			}
		}
	}
	if (ans!=1e9+7)  cout<<ans<<endl;
	else cout<<-1<<endl;
	
	return 0;
}

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

using namespace std; 
const int MAX_N = 3005; 
int dp[MAX_N][MAX_N]; 
string s1, s2; 
char before[MAX_N][MAX_N]; 

int main () {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> s1 >> s2; 
	int n = (int) s1.size(); 
	int m = (int) s2.size(); 

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (s1[i - 1] == s2[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1; 
				
			}
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]); 
			}
		}
	}

	string res = ""; 
	int i = n; 
	int j = m; 

	while (i > 0 && j > 0) {
		if (s1[i - 1] == s2[j - 1]) {
			i--;
			j--; 
			res += s1[i]; 
		}
		else if (dp[i][j] == dp[i - 1][j]) {
			i--;
		}
		else {
			j--; 
		}
	}

	reverse(res.begin(), res.end()); 
	cout << res; 
	return 0; 
}

Measured memory_bytes: 36096
#include<bits/stdc++.h>
#define itn int
#define lli long long int
#define REP(a,n) for(int i=a;i < n;i++)
#define REP2(a,n) for(int j = a;j<n;j++)
using namespace std;
int main(void) {
	int N, M;
	scanf("%d %d", &N, &M);
	if (N == M) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

int a,b,d,r;

double f;

scanf("%d",&a);

scanf("%d",&b);

d=a/b;

r=a%b;

f=(double)a/(double)b;

printf("%d %d %lf\n",d,r,f);

return 0;

}

Measured memory_bytes: 636
from itertools import accumulate, count
from bisect import bisect_right

input()
a = [0] + list(accumulate(map(int, input().split())))
i = bisect_right(a, a[-1] // 2)
print(min(2 * a[i] - a[-1], a[-1] - 2 * a[i - 1]))


Measured memory_bytes: 27308
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}
 
 
signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      
    
    int n,m;
    cin>>n>>m;
    int mm[26]={0};
    for(int i=0;i<n;i++)
    {
        string a;
        cin>>a;
        for(int j=0;j<m;j++)
            mm[a[j]-'a']++;
    }
    if(n%2==0&&m%2==0)
    {
        int tot=0;
        for(int i=0;i<26;i++)
            tot+=mm[i]/4;
        if(tot*4==n*m)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }        
    }
    else if(n%2 && m%2)
    {
        int tot=0;
        int x=0,y=0;
        for(int i=0;i<26;i++)
        {
            tot+=mm[i]/4;
            mm[i]%=4;
        }
        for(int i=0;i<26;i++)
        {
            x+=mm[i]/2;
            mm[i]%=2;
        }
        for(int i=0;i<26;i++)
        {
            y+=mm[i];
        }
        int xx=0,yy=0,zz=0;
            xx=(n-1)*(m-1);
            yy=n*m-1-xx;
            zz=1;
        if(tot*4<xx)
        {
            cout<<"No";
            return 0;
        }
        tot-=(xx/4);
        tot*=2;
        if((tot+x)*2<yy)
        {
            cout<<"No";
            return 0;
        }
        tot/=2;
        tot+=xx/4;
        if(tot*4+x*2+y==n*m)
            cout<<"Yes";
        else
            cout<<"No";
    }
    else
    {
        int tot=0;
        int x=0;
        for(int i=0;i<26;i++)
        {
            tot+=mm[i]/4;
            mm[i]%=4;
        }
        for(int i=0;i<26;i++)
        {
            x+=mm[i]/2;
        }
        int xx=0,yy=0;
        if(n%2)
        {
            xx=(n-1)*m;
            yy=n*m-xx;
        }
        else
        {
            xx=n*(m-1);
            yy=n*m-xx;
        }
        
        if(tot*4<xx)
        {
            cout<<"No";
            return 0;
        }
        if(tot*4+x*2==n*m)
            cout<<"Yes";
        else
            cout<<"No";
        
    }
    
    
} 

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

int op(int a, int b) { return max(a, b); }
int e() { return 0; }

int main() {
	int N, K;
	cin >> N >> K;
	int M = 300000;
	vector<int> a(M+1);
	segtree<int, op, e> S(a);
	for (int i = 0; i < N; ++ i) {
		int x;
		cin >> x;
		int l = max(0, x-K);
		int r = min(M, x+K);
		int y = S.prod(l, r+1);
		S.set(x, y+1);
	}
	cout << S.all_prod() << endl;
}


Measured memory_bytes: 8572
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  ll N;
  cin >> N;
  ll a[N];
  for (int i = 0; i < N; i++) scanf("%lld", a + i);

  ll total = N * (N + 1) / 2;
  ll sum = 0;
  for (int i = 0; i < N; i++) sum += a[i];

  string ans = "NO";
  if (sum % total == 0) {
    ll k = sum / total; // 操作を行う回数
    ll d[N];
    d[0] = (a[0] - a[N-1]) - k;
    for (int i = 1; i < N; i++) {
      d[i] = (a[i] - a[i-1]) - k;
    }

    sum = 0;
    for (int i = 0; i < N; i++) {
      sum += d[i];
    }
    if (-sum == k * N) {
      bool flag = true;
      for (int i = 0; i < N; i++) {
        if (d[i] <= 0 && d[i] % N == 0) continue;

        flag = false;
        break;
      }
      if (flag) ans = "YES";
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    string s;
    cin >> s;
    int k, n = s.length();
    cin >> k;
    REP(i,n){
        if (s[i] == 'a') continue;
        int x = 'z'-s[i]+1;
        if (k >= x){
            s[i] = 'a';
            k -= x;
        }
    }
    k %= 26;
    REP(i,k){
        if (s[n-1] != 'z') s[n-1]++;
        else s[n-1] = 'a';
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 640
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            var amount = new string[1];
            amount = line.Split(' ');
            Console.WriteLine(int.Parse(amount[0]) * int.Parse(amount[1]));

        }
    }
}


Measured memory_bytes: 27540
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int a,b;
	char c;
	cin >> a >> c >> b;
	if(c == '+') cout << a + b << endl;
	else cout << a - b << endl;
	return 0;
}

Measured memory_bytes: 256
//MD. HASNAIN ALI (UNSOLVED)
#include<bits/stdc++.h>
using namespace std;
 
#pragma GCC             optimize ("Ofast")
#pragma GCC             optimize("O3")
#define ll              long long
#define lo(i,a,b,c)     for(i=a;i<=b;i=i+c)
#define sca(n)          scanf("%lld", &n)
#define pri(n)          printf("%lld", n)
#define SORT(x)         sort(x.begin(), x.end())
#define REV(x)          reverse(x.begin(), x.end())
#define all(x)          x.begin(), x.end()
#define distance(a,b)   (sq(a.x-b.x) + sq(a.y-b.y))
#define end0             "\n"
#define end1            cout<<"\n";
#define pi              acos(-1)
#define mod             1000000007
#define inf             999999999999999999
#define eps             10e-9      
 
 
 
 
 
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0), cout.tie(0);
  //freopen("test.txt","r",stdin);
  
  ll a,i,b=0;
  string x,y;
  cin>>x>>y;
  a=x.length();
  lo(i,0,a-1,1)
  {
    if(x[i]!=y[i]) b++;  
  }
  cout<<b<<end0;

    return 0;
}













Measured memory_bytes: 3828
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;


int f(int x ,vector<int> a){
    int ans = 0;
    for (int i = 0; i < a.size();i++){
        ans += x % a[i];
    }
    return ans;
}
int gcd(int x, int y)
{
    return x ? gcd(y % x, x) : y;
}

//*********************************************************
// 最小公倍数（Least Common Multiple）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
int lcm(int m, int n)
{
    // 引数に０がある場合は０を返す
    if ((0 == m) || (0 == n))
        return 0;

    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
} //lcm

int lcm_n(vector<int> &numbers)
{
    int l;
    l = numbers[0];
    for (int i = 1; i < numbers.size(); i++)
    {
        l = lcm(l, numbers[i]);
    }
    return l;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }/*
    int l = lcm_n(a);
    cout << f(l - 1, a);
    */
    int ans = 0;
    for (int i = 0; i < n;i++){
        ans += a[i];
    }
    ans -= n;
    cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int takaH, takaA, aoH, aoA;
 
scanf("%d",&takaH);
scanf("%d",&takaA);
scanf("%d",&aoH);
scanf("%d",&aoA);
 
while(1){
	aoH = aoH - takaA;
    if(aoH <= 0){
    printf("Yes");
    break;
    }
    takaH = takaH - aoA;
    if(takaH <= 0){
    printf("No");
    break;
    }
}
return 0;
}

Measured memory_bytes: 1732
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define inf 0x3f3f3f3f
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, x[55], y[55], ans;

int main(){
	getint(N), ans = N;
	for(register int i = 1; i <= N; i++) getint(x[i]), getint(y[i]);
	for(register int i = 1; i <= N; i++)
		for(register int j = i + 1; j <= N; j++){
			const int dx = x[i] - x[j], dy = y[i] - y[j]; int res = 0;
			for(register int k = 1; k <= N; k++)
				for(register int l = 1; l <= N; l++)
					if(x[k] - x[l] == dx && y[k] - y[l] == dy) {res++; break;}
			ans = min(ans, N - res);
		}
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
graf = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    graf[a-1].append(b-1)
    graf[b-1].append(a-1)

out = [0 for _ in range(n)]
out[0] = -1

import queue

next_visit = queue.Queue()
next_visit.put(0)

while not next_visit.empty():
    i = next_visit.get()
    for j in graf[i]:
        if out[j] == 0:
            out[j] = i+1
            next_visit.put(j)
cnt = 1

for i in range(1, n):
    if out[i] == 0:
        cnt = 0
        break
if cnt:
    print("Yes")
    for i in out[1:]:
        print(i)
else:
    print("No")

Measured memory_bytes: 98964
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        //long start = System.currentTimeMillis();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        System.out.println();

        int max = (int)Math.sqrt(n);

        int[] record = new int[n+1];
        Arrays.fill(record,0);
        
        for (int x = 1;x<=max;++x)
        {
            for (int y = 1;y<=max;++y)
            {
                for (int z = 1;z<=max;++z)
                {
                    int tmp = (int) Math.pow(x,2) + (int) Math.pow(y,2) + (int) Math.pow(z,2)
                            + x*y + y*z + x*z;

                    if (tmp <= n) ++record[tmp];
                }
            }
        }

        for (int i = 1;i<=n;++i) System.out.println(record[i]);
        sc.close();
//        long end = System.currentTimeMillis();
//        System.err.println((end-start)+"ms");
    }
}

Measured memory_bytes: 38936
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>
#include <numeric>
#include <stack>
#include <map>
using namespace std;

const long long N_MAX=100001;
long long N;
long long A[N_MAX+1]={}, B[N_MAX]={};
long long res=0;

int main(){
    cin >> N;
    for (int i=0; i<N+1; i++){
        cin >> A[i];
    }
    for (int i=0;i<N;i++){
        cin >> B[i];
    }
    for (int i=0;i<N;i++){
        res += min(A[i],B[i]);
        res += min(A[i+1],B[i]-min(A[i],B[i]));
        A[i+1] -= min(A[i+1],B[i]-min(A[i],B[i]));
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		long[] b = new long[N];
		long sum = 0;
		
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[a[i]-1]++;
		}
		for (int i = 0; i < N; i++) {
			sum += b[i] * (b[i] - 1)/2;
		}
		for (int i=0; i<N; i++) {
			System.out.println(sum-(b[a[i] - 1] - 1));
		}
	}
}

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ii solve(ll X)
{
    map<ll, ll> xs;

    for (ll i = 0; i * i * i * i * i < MOD * MOD; ++i)
    {
        ll res = i * i * i * i * i;

        xs[res] = i;
        xs[-res] = -i;
    }

    ii ans;

    for (auto p : xs)
    {
        auto v = p.first, i = p.second;

        if (xs.count(v - X))
        {
            ans.first = i;
            ans.second = xs[v - X];
            break;
        }
    }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    ll X;
    cin >> X;

    auto ans = solve(X);

    cout << ans.first << ' ' << ans.second << '\n';

    return 0;
}


Measured memory_bytes: 4116
L,R = map(int,input().split())
MOD = 2019

lmod = L%MOD
rmod = R%MOD

ans = 0
if R-L >= 2019:
    ans = 0
else:
    if lmod >= rmod:
        ans = 0
    else:
        ans = float("inf")
        for i in range(lmod,rmod+1):
            for j in range(i+1,rmod+1):
                x = i*j%MOD
                if ans > x:
                    ans = x
print(ans)

Measured memory_bytes: 40812
#include <stdio.h>

const int MAX_V = 1000000;
int prime[MAX_V+1];
int main() {
  int i, k, n, j, p1, q1;
  for( i = 2; i <= MAX_V; i++ ) {
    prime[i] = 1;
  }
  for( i = 2; i*i <= MAX_V; i++ ) {
    if (prime[i] ) {
      for( k = 2 * i; k <= MAX_V; k += i ) {
        prime[k] = 0;
      }
    }
  }
  for( ;; ) {
    scanf( "%d", &n );
    if( n == 0 )break;
    for( j = 2; j <= n; j++ ) {
      int isprime = prime[j];
      int isprimee = prime[j-2];
      if( isprime == 1 && isprimee == 1 ) {
        q1 = j;
        p1 = q1 - 2;
      }
    }
    printf( "%d %d\n", p1, q1 );
  }
  return 0;
}

Measured memory_bytes: 4932
#include<stdio.h>
#include<map>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;

const int MM = 1000000007;
const int MX = 505;

int mn[MX][MX];
char D[MX][MX], R[MX][MX], B[MX][MX];

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	for(int i = 1; i <= N; i++) scanf("%s", D[i]+1);
	for(int i = 1; i <= N; i++) for(int j = 1; j <= M; j++) R[i][j] = B[i][j] = '.';
	for(int i = 2; i <= N-1; i++) R[i][1] = '#', B[i][M] = '#';
	for(int i = 2; i <= N-1; i++){
		for(int j = 2; j <= M-1; j++){
			if( i&1 ){
				R[i][j] = '#';
				if (D[i][j] == '#' ) B[i][j] = '#';
			}
			else{
				B[i][j] = '#';
				if( D[i][j] == '#' ) R[i][j] = '#';
			}
		}
	}
	for(int i = 1; i <= N; i++) printf("%s\n", R[i]+1);
	printf("\n");
	for(int i = 1; i <= N; i++) printf("%s\n", B[i]+1);
}


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

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

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


int main() {
  string S;
  cin >> S;
  vector<string> cand={"dreamer","dream","eraser","erase"};
  rep(i,4) reverse(cand[i].begin(),cand[i].end());
  reverse(S.begin(),S.end());
  int now=0;
  while (now<S.size()) {
    bool f=false;
    for(auto i:cand) {
      // cout << S.substr(now,i.size()) << endl << i << endl;
      if (S.substr(now,i.size())==i) {
        f=true;
        now+=i.size();
      }
    }
    if (f) continue;
    else {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0;i<n;i++) {
    cin >> p.at(i);
  }
  
  sort(p.begin(), p.end());
  int sum=0;
  for (int i=0;i<n-1;i++) {
    sum += p.at(i);
  }
  
  sum += p.at(n-1)/2;
  
  cout << sum << endl;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
c = [0] * 10

for i in range(10):
    c[i] = [int(_) for _ in input().split()]

A = [0] * H
for h in range(H):
    A[h] = [int(_) for _ in input().split()]
    
def warshall_floyd(d):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

c = warshall_floyd(c)
ans = 0
for h in range(H):
    for w in range(W):
        if A[h][w] != -1:
            ans += c[A[h][w]][1]
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
using namespace __gnu_pbds;
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll a, b;

int main() {
  ios::sync_with_stdio(0);
  cout.precision(10);

  cin >> a >> b;
  
  if (abs(a-b) <= 1) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
}

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void _dump(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ": " << x << '}' << "\n";
}
 
template <class Head, class... Tail>
void _dump(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  _dump(s, forward<Tail>(tail)...);
}
// }}} End

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

  VAR(i64, N, T);

  vector<i64> t(N+10);
  vector<i64> diff(N+10);
  reps(i, 1, N) {
    IN(t[i]);
    diff[i] = t[i] - t[i-1];
  }

  i64 res = T;
  reps(i, 1, N) {
    res += min(diff[i], T);
  }

  OUTL(res);

  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long FINV(int n){
    if (n < 0) return 0;
    return finv[n];
}

int main() {
    // 前処理
    COMinit();

    ll n;
    cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];

    ll ans = 0;

    ll sum[n+100] = {};
    sum[0] = 1;
    srep(i,1,n+10){
        sum[i] = sum[i-1];
        sum[i] += (ll)1 * inv[i+1] % MOD;
        sum[i] %= MOD;
    }

    rep(i,n){
        ll tmp = a[i] * fac[n] % MOD * (sum[i] + sum[n-1-i] + MOD - 1) % MOD;
        // cout << i << ' ' << tmp << endl;
        ans = (ans + tmp) % MOD;
    }

    /*
    rep(i,n){
        rep(j,n){
            tmp = fac[n] * finv[abs(j-i)+1] % MOD * fac[abs(j-i)] % MOD * a[i] % MOD;
            ans = (ans + tmp) % MOD;
        }
    }
    */
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13824
#include <bits/stdc++.h>
using namespace std;
int N,M;
int countx;
bool connect;
vector<vector<int>> G;
vector<bool> visited;

void printG(){
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cout << G.at(i).at(j) << ' ';
    }
    cout << endl;
  }
  cout << endl;
}

void dfs(int v){
  visited.at(v) = true;
  countx++;
  if(countx == N){
    connect = true;
    return;
  }
  
  for(int i = 0; i < N; i++){
    if(G.at(v).at(i) == 1 && visited.at(i) == false){
      dfs(i);
    }
  }
  return;
}

int main() {
  cin >> N >> M;
  G = vector<vector<int>>(N,vector<int>(N,0));
  visited = vector<bool>(N,false);
  for(int i = 0; i < M; i++){
    int a,b; cin >> a >> b;
    a--;
    b--;
    //cout << a << ' ' << b << endl;
    G.at(a).at(b) = 1;
    G.at(b).at(a) = 1;
  }
  
  int bridge = M;
  vector<vector<int>> tempG(N,vector<int>(N,0));
  vector<bool> tempvisited(N,false);
  for(int i = 0; i < N; i++){
    for(int j = i; j < N; j++){
      if(G.at(i).at(j) == 1){
        tempG = G;
        tempvisited = visited;
        countx = 0;
        connect = false;
        G.at(i).at(j) = 0;
        G.at(j).at(i) = 0;
        dfs(0);
        if(connect) bridge--;
        //else cout << "!connect "  << i << " " << j << endl;
        G = tempG;
        visited = tempvisited;
      }
    }
  }
  cout << bridge << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



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

  int count = 0;
  int hold = 0;
  FOR(i,0,N-2){
    if(a[i]<a[i+1]){
      if(hold == 2) {
        ++count;
        hold = 0;
      }
      else{
        hold = 1;
      }
    }
    if(a[i]>a[i+1]){
      if(hold == 1) {
        ++count;
        hold = 0;
      }
      else{
        hold = 2;
      }
    }
  }

  ++count;

  cout << count << endl;

}



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

int main(void){
    string n;
    cin >> n;
    for(int i=0;i<3;++i){
        if(n[i]==n[i+1]){
            cout << "Bad\n";
            return 0;
        }
    }
    cout << "Good\n";
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      string[] input = ReadLine().Split();
      int h = int.Parse(input[0]);
      int w = int.Parse(input[1]);
      int n = int.Parse(ReadLine());
      List<int> x = ReadLine().Split().ToList().ConvertAll(x=>int.Parse(x));
      List<List<int>> ans = new List<List<int>>();
      List<int> a= new List<int>();
      List<int> b = new List<int>();
      
      
      for (int i=0;i<n;i++)
      {
        for (int j=0;j<x[i];j++)
        {
          a.Add(i+1);
        }
      }
      
      for (int i=0;i<h;i++)
      {
        if (i%2==0)
        {
          WriteLine(string.Join(" ",a.GetRange(w*i, w)));
        }
        else
        {
          b = a.GetRange(w*i, w);
          b.Reverse();
          WriteLine(string.Join(" ",b));
        }
          
      }
    }
}

Measured memory_bytes: 29776
local mma = math.max
local n = io.read("*n")
local a, b = io.read("*n", "*n")
local taka, ao, sum = a, b, a + b
for i = 2, n do
  a, b = io.read("*n", "*n")
  local next_sum = sum
  if sum % (a + b) ~= 0 then
    next_sum = (a + b) * ((sum // (a + b)) + 1)
  end
  if a < taka then
    if taka % a ~= 0 then
      taka = ((taka // a) + 1) * a
    end
    next_sum = mma(next_sum, (taka // a) * (a + b))
  end
  if b < ao then
    if ao % b ~= 0 then
      ao = ((ao // b) + 1) * b
    end
    next_sum = mma(next_sum, (ao // b) * (a + b))
  end
  sum = next_sum
  taka, ao = a * (sum // (a + b)), b * (sum // (a + b))
  -- print(taka, ao, sum)
end
print(sum)


Measured memory_bytes: 888
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        int[] A = new int[N];
        int[] B = new int[N];
        Map<Integer,Long> map = new TreeMap<>();
        for (int i = 0; i < N ; i++) {
            int price  = sc.nextInt();
            long avail = sc.nextInt();
            if(!map.containsKey(price)){
                map.put(price,avail);
            }else{
                map.put(price,map.get(price)+avail);
            }
        }

        long amount = 0;
        for(Map.Entry<Integer,Long> e: map.entrySet()){
            int price = e.getKey();
            long avail = e.getValue();
            if(M <= avail){
                amount += (long) M * price;
                break;
            }else{
                amount += (long) price* avail;
                M -= avail;
            }
        }

        System.out.println(amount);

    }}

Measured memory_bytes: 90600
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)
#define cube(x) (x) * (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    REP(i, n) cin >> a[i];
    REP(i, n){
        int key = a[i];
        int j;
        for(j = i-1; (j >= 0 && a[j] > key); j--) {
            a[j+1] = a[j];
        }
        a[j+1] = key;
        REP(i, n-1) cout << a[i] << " ";
        cout << a[n-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
#define maxn 200000

using namespace std;

int n, k;
int dp[2011][2011];
int sum[2011];
int fac[2011];

int power(int a, int b, int m)
{
    int ans = 1;
    a %= m;
    while(b){
        if(b & 1) ans = (ans * a) % m;
        a = (a * a) % m;
        b >>= 1;
    }
    return ans;
}

int C(int a, int b){
	int ans = fac[a];
	ans *= power((fac[a - b]*fac[b])%mod, mod - 2, mod);
	ans %= mod;
	return ans;
}

signed main()
{

 	FLASH

 	fac[0] = 1;
 	fr(i, 1, 2001) fac[i] = (i*fac[i - 1])%mod;
 	cin>>n>>k;
	
	fr(i, 0, n + 1) dp[0][i] = i + 1;
	sum[0] = dp[0][0];
	fr(i, 1, n + 1) sum[i] = (sum[i - 1] + dp[0][i])%mod;

	fr(i, 1, n + 1){
		fr(j, 0, n + 1){
			dp[i][j] = sum[j];
		}
		sum[0] = dp[i][0];
		fr(j, 1, n + 1) {sum[j] = sum[j - 1] + dp[i][j]; sum[j] %= mod;}
	} 	

	fr(i, 1, k + 1){
		if(n - k - i + 1 < 0){
			cout<<0<<'\n';
			continue;
		}
		else{
			int ans = dp[i - 1][n - k - i + 1]*C(k - 1, i - 1);
			ans %= mod;
			cout<<ans<<'\n';
		}
	}

}

Measured memory_bytes: 31744
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
#define N 50
int n, m;
string a[N+1];
string b[N+1];
bool can(int i, int j) {
    bool ans = true;
    for(int ii = 0; ii < m; ii++) {
        for(int jj = 0; jj < m; jj++) {
            ans &= i + ii < n and j + jj < n and b[ii][jj] == a[i + ii][j + jj];
        }
    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < m; i++) {
        cin >> b[i];
    }
    bool ans = false;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            ans |= can(i, j);
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static final Scanner sc = new Scanner(System.in);
    static final int MOD = (int) 1E9 + 7;
    
    public static void main(String[] args) {
        int n = nint();
        double sum = 0;
        for (int i = 0; i < n; i++) {
            sum += (double)1/nint();
        }
        System.out.println((double)1/sum);
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }

    private static char[][] nsToChars2D(int h, int w) {
        return nsToChars2D(h, w, 0);
    }

    private static char[][] nsToChars2D(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 21844
import java.util.Arrays;

public class Main {
	public static void main(String[] age){
		String input = new java.util.Scanner(System.in).nextLine();
		String[] arrayinput = input.split(" ");
		int a = Integer.parseInt(arrayinput[0]);
		int b = Integer.parseInt(arrayinput[1]);
		int c = Integer.parseInt(arrayinput[2]);
		int numbers[] = {a, b, c};
		Arrays.sort(numbers);
		a = numbers[0];
		b = numbers[1];
		c = numbers[2];
		System.out.println(a+" "+b+" "+c);
	}
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N,M;
vector<pll> ABv;
vector<pll> LRv;
map<ll,ll> Ap;
ll B[101010];
ll Bx[101010];
vector<pair<pll, ll>> lrv;
map<ll, ll> lrazat;
pll LR[202020];
vector<pll> uvv[101010];
vector<ll> anss;
ll i, j, k;

ll dfs(ll a,vector<ll>& mk){
    if(mk[a])
        return false;
    mk[a] = true;
    ll i;
    ll ret = Bx[a];
    fornum(i,0,uvv[a].size()){
        ll r= dfs(uvv[a][i].first, mk);
        if(r){
            anss.push_back(uvv[a][i].second + 1);
            ret ^= 1;
        }
    }
    return ret;
}

int main(){
    scanf("%lld%lld", &N, &M);
    fornum(i,0,N){
        ll a, b;
        scanf("%lld%lld", &a, &b);
        ABv.push_back({a, b});
    }
    sort(ABv.begin(), ABv.end());
    for (i = N - 1; i >= 0;--i)
    {
        B[i] = ABv[i].second;
    }
    fornum(i,0,M){
        ll l, r;
        scanf("%lld%lld", &l, &r);
        --l;
        lrv.push_back({{l, r}, i});
        lrazat[l] = 0;
        lrazat[r] = 0;
    }
    i = 0;
    for(auto &a:lrazat){
        while(i<N&&ABv[i].first<=a.first){
            ++i;
        }
        a.second = i;
        
    }
    fornum(i,0,M){
        LR[i] = {lrazat[lrv[i].first.first], lrazat[lrv[i].first.second]};
    }

    Bx[0] = B[0];
    fornum(i,1,N+1){
        Bx[i] = B[i - 1] ^ B[i];
    }
    vector<ll> mk(N + 3);
    fornum(i,0,M){
        uvv[LR[i].first].push_back({LR[i].second, i});
        uvv[LR[i].second].push_back({LR[i].first, i});
    }
    
    fornum(i,0,N+1){
        if(mk[i])
            continue;
        if(dfs(i,mk)){
            break;
        }
    }
    if(i!=N+1){
        printf("-1");
        return 0;
    }
    printf("%d\n", anss.size());
    sort(anss.begin(), anss.end());
    fornum(i,0,anss.size()){
        printf("%lld ", anss[i]);
    }

    return 0;
}

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



// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // Failed to predict input format
    int N, M; cin>>N>>M;
    vector<long long> dp(1<<N, 1ll<<61);
    for(int i=0;i<M;++i){
        int b=0;
        long long ai,bi;cin>>ai>>bi;
        for(int i=0;i<bi;++i){
            int c;cin>>c;
            b += (1 << (c-1));
        }
        dp[b] = min(dp[b],ai);
    }
    dp[0] = 0;
    for(int i=0;i<(1<<N);++i){
        for(int j=0;j<(1<<N);++j){
            dp[i|j] = min(dp[i|j], dp[i]+dp[j]);
        }
    }
    if(dp[(1<<N)-1]!=(1ll<<61)){
        cout<<dp[(1<<N)-1]<<endl;
    }
    else{
        cout<<-1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
while True:
    try:
        n = float(raw_input())
        d = [0]*10
        d[0] = n
        for i in xrange(1,10):
            if i%2 == 0: d[i] = d[i-1]/3
            else: d[i] = d[i-1]*2
        print round(sum(d),8)
    except:
        break

Measured memory_bytes: 4240
n,k = map(int,input().split())
P = list(map(int,input().split()))



def E(x):
    # ans = 0
    tmp = (x*(x+1))/2 if x % 2 == 0 else x+(((x-1)*(x))/2)
    return tmp/x
ans = 0
for i in range(len(P)):
    P[i] = round(E(P[i]),1)
max_v = tmp = sum(P[:k])
l = 0
r = k
for i in range(1,len(P)-k+1):
    tmp = tmp-P[i-1]+P[r]
    max_v = max(max_v, tmp)
    r += 1
print(max_v)

Measured memory_bytes: 71816
#include <stdio.h>
int main(){
	int i,a,b,c,cnt=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1852
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    lint N, P;
    cin >> N >> P;
    map<lint, int> mp;
    lint p = P;
    for (lint i = 2; i * i <= P; ++i) {
        while (p % i == 0) {
            p /= i;
            ++mp[i];
        }
    }
    if (p != 1) ++mp[p];
    lint ans = 1;
    for (auto p : mp) {
        rep(i, p.second / N) ans *= p.first;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve(){
    ll n, t;
    cin >> n >> t;
    ll a[n];
    rep(i, n) cin >> a[i];
    ll tt = 0, ans = 0;
    rep(i, n)
    {
        if(tt > a[i]) ans += t - (tt-a[i]);
        else ans += t;
        tt = a[i]+t;
    }
    cout << ans;
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 1792