akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=998244353;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=501000;
int n,m,ret,rr[N];
ll fac[N],fnv[N];

ll comb(int x,int y) {
	if (y>x||y<0) return 0;
	return fac[x]*fnv[y]%mod*fnv[x-y]%mod;
}

ll ff(int m,int x) {
	return comb(m-1,x-1);
/*	if (m%2==1) return comb(m-1,x-1);
	else {
		if (x>=m/2) return comb(m-1,x-1);
		else return comb(m-1,x-2);
	}*/
}
int main() {
	scanf("%d%d",&n,&m);
	fac[0]=fnv[0]=1;
	rep(i,1,m+1) fac[i]=fac[i-1]*i%mod,fnv[i]=powmod(fac[i],mod-2);
	rep(i,n,m+1) ret=(ret+ff(m,i))%mod;
/*
	rep(S,0,(1<<m)) {
//		int cnt=0,val=0;
		int cb=0,cr=0,cnt=0;
		rep(j,0,m) {
			if (S&(1<<j)) { // R
//				putchar('R');
				cr++;
			} else {
				if (cr==0) cb++; else cr--,cnt++;
//				putchar('B');
			}
		}
		if (cb==0) cnt+=cr;
		else {
			if (cr<cb) continue;
			if (cr>cb) cnt+=cr-cb;
			if (cr==cb) {
				if (S&(1<<(m-1))) continue;
			}
		}

//		printf("%d\n",cnt);
		rr[cnt]++;
	}
	rep(i,0,m+1) printf("%d %d\n",i,rr[i]);
	rep(i,0,m+1) assert(rr[i]==ff(m,i));*/
	printf("%d\n",ret);
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define ll long long int 
#define pii pair<int, int>
#define fi first
#define se second
#define maxn 219
#define maxr 100000
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define gc() ((p1 == p2 && (p2 = (p1 = buffer) + fread(buffer, 1, maxr, stdin), p1 == p2)) ? EOF : *p1++)
using namespace std;

int const INF = 1000000019;

char buffer[maxr], *p1, *p2;
template<class T> void read(T& x){
	char ch = gc(); x = 0; bool f = 1;
	while (!('0' <= ch && ch <= '9') && ch != '-') ch = gc();
	if (ch == '-') f = 0, ch = gc();
	while ('0' <= ch && ch <= '9') x = (x << 1) + (x << 3) + ch - '0', ch = gc();
	x = (f) ? x : -x;
}

int n;
char s[maxn][maxn];
int d[maxn][maxn];

int Floyd(){
	int ans = 0;
	rep(k, 1, n){
		rep(i, 1, n){
			rep(j, 1, n){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	
	rep(i, 1, n) rep(j, 1, n) ans = max(ans, d[i][j]);
	return ans;
}

bool vis[maxn], col[maxn];
bool dfs(int x, bool c){
	vis[x] = 1, col[x] = c;
	rep(op, 1, n){
		if (s[x][op] == '1') {
			if (vis[op]) {
				if (col[op] != c ^ 1) return false;
			}
			else {
				if (!dfs(op, c ^ 1)) return false;
			}
		}
	}
	return true;
}

int main(){
	scanf("%d", &n);
	rep(i, 1, n) scanf("%s", s[i] + 1);
	rep(i, 1, n) rep(j, 1, n) d[i][j] = (s[i][j] == '1') ? 1 : INF; 
	rep(i, 1, n) d[i][i] = 0;
	if (!dfs(1, 0)) printf("-1");
	else printf("%d", Floyd() + 1);
	return 0;
}

Measured memory_bytes: 512
n,m = map(int,input().split())
H = list(map(int,input().split()))
j = [0]*n

for i in range(m) :
    a,b = map(int,input().split())
    if H[a-1] <= H[b-1] :
        j[a-1] += 1
    if H[b-1] <= H[a-1] :
        j[b-1] += 1
print(j.count(0))

Measured memory_bytes: 19972
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>

using namespace std;
const int mod = 1e9+7;
int main()
{
    long long n, m;
    while(~scanf("%lld %lld", &n, &m))
    {
        long long ans = 0;
        if(m > 2*n)
        {
            m -= 2*n;
            m /= 4;
            ans += m + n;
        }
        else
            ans = m/2;
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
D = {a: d[a] for a in A}
m = min(D.values())
E = {}
for k, v in D.items():
    v -= m
    if v in E:
        E[v] = max(E[v], k)
    else:
        E[v] = k
F = sorted(E.keys(), key=lambda f: (max(0, E[f]-E[0]), f), reverse=True)
F.remove(0)
K = N // m
for k in range(K, 0, -1):
    B = [E[0]] * k
    R = N - k * m
    if not R:
        print("".join(map(str, sorted(B, reverse=True))))
        break
    def rec(r, i, j):
        if i < 0:
            return
        for f in F[j:]:
            if r == f:
                B[i] = E[f]
                print("".join(map(str, sorted(B, reverse=True))))
                exit()
            elif r > f:
                B[i], tmp = E[f], B[i]
                rec(r - f, i - 1, j)
                B[i] = tmp
            j += 1
    rec(R, k-1, 0)

Measured memory_bytes: 3360
N = int(input())
T = []
A = []
for i in range(N):
    t, a = map(int, input().split())
    T.append(t)
    A.append(a)
    
v1 = 1
v2 = 1

for i in range(N):
    n = max((v1+T[i]-1)//T[i],(v2+A[i]-1)//A[i])
    v1 = T[i]*n
    v2 = A[i]*n

print(v1+v2) 


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>
#include <complex>
#include <stack>
#include <set>
#include <map>
#

#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

typedef complex<int> POINT;
template <class T>
class vevector : public vector<vector<T>>
{
public:
	using vector<vector<T>>::operator []; 
	T& operator [](const POINT &index) { return (*this)[index.real()][index.imag()]; }
};

template <class T> T read() { T t; cin >> t; return t; }
template <> POINT read<POINT>() { int x, y; cin >> x >> y; return POINT(x, y); }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vevector<T> read(int n, int m) { vevector<T> v; REP(i,n) v.push_back(read<T>(m)); return v; }
template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }

template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

template <class T> string toString(const T &t) { stringstream ss; ss << t; return ss.str(); }

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

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

vector<unsigned char> isPrime;
vector<int> primes;
void initPrimes(int n)
{
	isPrime = vector<unsigned char>(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	FOR(i, 2, n)
	{
		if (!isPrime[i]) continue;
		primes.push_back(i);
		for (int j = i * 2; j <= n; j += i)
			isPrime[j] = false;
	}
}

/// template end ///

void solve()
{
	REP (testcase, INF)
	{
		READ(int, price);
		if (!price) { break; }
		if (testcase != 0) { cout << endl; }

		READ(int, x10, x50, x100, x500);
		int money = x10 * 10 + x50 * 50 + x100 * 100 + x500 * 500;
		int change = money - price;

		int c500 = change / 500; change %= 500;
		int c100 = change / 100; change %= 100;
		int c50 = change / 50; change %= 50;
		int c10 = change / 10; change %= 10;

		x500 = max(x500 - c500, 0);
		x100 = max(x100 - c100, 0);
		x50 = max(x50 - c50, 0);
		x10 = max(x10 - c10, 0);

		if (x10) { write(10, x10); }
		if (x50) { write(50, x50); }
		if (x100) { write(100, x100); }
		if (x500) { write(500, x500); }
	}
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
double dp[3001][3001];
int main(){
	int N;
	cin>>N;
	dp[0][0] = 1;
	rep(i,N){
		double p;
		cin>>p;
		rep(j,i+1){
			dp[i+1][j+1] += dp[i][j]*p;
			dp[i+1][j] += dp[i][j]*(1-p);
		}
	}
	double ans = 0;
	rep(j,N+1) if(j>N-j) ans += dp[N][j];
	printf("%.12f\n",ans);
}

Measured memory_bytes: 68864
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys
#from fractions import gcd
setrecursionlimit(10**6)
input=stdin.readline

print(int(input().rstrip())**2)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define F first
#define S second
using namespace std;


int main()
{
    ll t,i,j,k,ans,n,x;

    //cin>>t;
    t=1;
    while(t--)
    {
        cin>>n;
        vector<ll> a(n),b(n);

        rep(p,0,n)cin>>a[p];
        rep(p,0,n)cin>>b[p];

        i=0;
        while(a[i]==b[i] && i<n)i++;

        if(i==n)cout<<"0";
        else 
        {
            if(a[i]>b[i])swap(a,b);

            ans=0;
            while(a!=b)
            {
                bool flag = next_permutation(all(a));
                ans++;
            }
            cout<<ans;
        }
    }
    return 0;
}



Measured memory_bytes: 3576
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    char x, y;
    cin >> x >> y;
    if ((int)x < (int)y) {
        cout << '<' << endl;
    } else if ((int)x == (int)y) {
        cout << '=' << endl;
    } else {
        cout << '>' << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String S =sc.next();
    String s[] =S.split("",0);
    int N =S.length();
    if(s[N-1].equals("s")){System.out.println(S+"es");}
    else{System.out.println(S+"s");}
  }
}

Measured memory_bytes: 38684
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,p,even=0,odd=0;
  cin >> n >> p;
	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]%2==0){
			even++;
		}else{
			odd++;
		}
	}
	long long x=1;
	for(int i=0;i<n;i++){
		x*=2;
	}
	if(odd==0){
		if(p==1){
			cout << 0 << endl;
		}else if(p==0){
			cout << x << endl;
		}
	}else{
		cout << x/2 << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    
    vector<int> a;
    vector<int> b;

    for(int i =0; i < n; i++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    for(int i =0; i < n; i++){
        int tmp;
        cin >> tmp;
        b.push_back(tmp);
    }
    
    int sum = 0;
    for(int i =0; i < n; i++){
        if(a[i] - b[i] > 0){
            sum += a[i] - b[i];
        }
    }
    cout << sum << endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char c[2][3] = {0};
    for(int i = 0; i < 2; i++){
        scanf("%s", c[i]);
    }
    int flag1 = 0; int flag2 = 0; int flag3 = 0;
    if(c[0][0] == c[1][2]){
        flag1 = 1;
    }
    if(c[0][1] == c[1][1]){
        flag2 = 1;
    }
    if(c[0][2] == c[1][0]){
        flag3 = 1;
    }

    if(flag1 == 1 && flag2 == 1 && flag3 == 1){
        printf("YES\n");
    }else {
        printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
n,m=map(int,input().split())
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans
ans=Comb(n,2)+Comb(m,2)
print(ans)


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main() {
    int N, H, h, ret = 1;
    cin >> N;
    cin >> h;
    while (--N) {
        cin >> H;
        if (H >= h) {
            h = H;
            ++ret;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int inf = 2147483647;

int solve(vector<int> v, int sz){
    vector<int> dp(sz) ;
    dp[0] = 0;
    for (int i= 1 ; i< sz ; i++){
        int x = abs( v[i]- v[i-1] ) + dp[i-1];
        int y = (i==1)? inf : (abs( v[i]- v[i-2] ) + dp[i-2]);

        dp[i] = min(x,y);
    }

    return dp[sz-1];

}

int main(){
    
   
    int N;
    cin>>N;
    vector<int> v(N);
    for( int i = 0 ; i < N ; i++ ){
        cin>>v[i];
       
    }

    
    cout<<solve(v,N)<<endl;
}

Measured memory_bytes: 4264
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1<<30
const int mod = 1e9+7;



int main(){
    ll k; cin >> k;
    vector<vpl> G(k);
    rep(i,k){
        if(i<k-1) G[i].emplace_back(i+1,1);
        else G[k-1].emplace_back(0,1);
    } 
    ll tmp = 1;
    rep(i,k) G[i].emplace_back((i*10)%k,0);
    priority_queue<P,vector<P>,greater<P>> pq;
    pq.emplace(1,1);
    vl d(k,inf);
    d[1] = 1;
    while(!pq.empty()){
        P p = pq.top(); pq.pop();
        ll u = p.second;
        for(auto v : G[u]){
            if(d[v.first] > d[u] + v.second){
                d[v.first] = d[u] + v.second;
                pq.emplace(d[v.first],v.first);
            }
        }
    }
    cout << d[0] << endl;
}


Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main()
{
	cin>>a>>b>>c>>d;
	for(int i=1;;i++)
	{
		c-=b;
		if(c<=0)cout<<"Yes",exit(0);
		a-=d;
		if(a<=0)cout<<"No",exit(0);
	}
}


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

int main(){
  long double A,B;cin>>A>>B;
  cout<<ll(A*B)<<endl;
}

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

///******************************** C o n t a i n e r ********************************///

typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

int const N=1e6+3;
const double PI = acos(-1);
const ll MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}

///************************************************ C o d e ************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///
const ll mx=1e7+1;

ll a[mx],n,i,j,m;

void lol()
{
    m=sqrt(mx);
    for(i=1;i<=m;i++){
        for(j=i*i;j<=mx;j+=i) {if(j==i*i) a[j]+=j; else a[j]+=2*j;}
    }
    for(i=1;i<mx;i++) a[i]+=a[i-1];
}
void _case()
{
    cin>>n;
    cout<<a[n] el;
}

main()
{
///    test

    lol();
    //while(1)
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!



Measured memory_bytes: 81752
#include <bits/stdc++.h>
using namespace std;	
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
#define X real()
#define Y imag()
void pin(pt& p){
	ld x,y; 
	cin>>x>>y; 
	p={x,y};
}
ostream& operator<<(ostream& os, pt p){
	return os<<p.X<<" "<<p.Y<<endl;
} 
ld dot(pt p,pt q){
	return (p.X*q.X + p.Y*q.Y);
}
pt solve(pt p,pt q,pt x){
	ld l = dot((q-p),(x-p))/abs(q-p);
	pt on = l*(q-p)/abs(q-p);
	pt prj = p+on;
	return (prj+(prj-x));
}
int main (){
	cout<<fixed<<setprecision(12);
	pt p,q,x;
	pin(p);
	pin(q);
	int t; 
	cin>>t;
	while(t--){
		pin(x);
		cout<<solve(p,q,x); 
	}
	return 0;
}



Measured memory_bytes: 3352
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-6
#define inf LLONG_MAX
using namespace std;

const int maxn = 1e5 * 3;
vector<int>g[maxn];
int tin[maxn], t = 0, ar[4 * maxn];
pair<int,int> mm[maxn];

void dfs(int v, int par = -1) {
	tin[v] = t++;
	mm[tin[v]].first = t - 1;
	for (int i = 0; i < g[v].size(); ++i) {
		int to = g[v][i];
		if (to != par)
			dfs(to, v);
	}
	mm[tin[v]].second = t - 1;
}

void add(int l, int r, int p, int lt, int rt, int v) {
	if (lt > rt)
		return;
	if (l == lt && rt == r)
		ar[p] = ar[p] + v;
	else {
		int m = (l + r) / 2;
		add(l, m, p * 2, lt, min(rt, m), v),
			add(m + 1, r, p * 2 + 1, max(lt, m + 1), rt, v);
	}
}

int get(int l, int r, int p, int v) {
	if (l == v && r == v)
		return ar[p];
	int m = (l + r) / 2, res = -1;
	if (v <= m)
		res = ar[p] + get(l, m, p * 2, v);
	else
		res = ar[p] + get(m + 1, r, p * 2 + 1, v);
	return res;
}

int main() {
	speed;
	int n, q, a, b, v, c;
	cin >> n >> q;
	for (int i = 0; i < n - 1; ++i) {
		cin >> a >> b;
		--a, --b;
		g[a].push_back(b);
	}
	dfs(0);
	for (int i = 0; i < q; ++i) {
		cin >> v >> c;
		--v;
		add(0, n - 1, 1, mm[tin[v]].first, mm[tin[v]].second, c);
	}
	for (int i = 0; i < n; ++i)
		cout << get(0, n - 1, 1, tin[i]) << ' ';
}

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

void _140() {
    int n;
    cin >> n;

    int a[20];
    int b[20];
    int c[20];
    for (int i = 0; i < n; ++i) 
        cin >> a[i];
    for (int i = 0; i < n; ++i) 
        cin >> b[i];
    for (int i = 0; i < n - 1; ++i) 
        cin >> c[i];

    int score = 0;
    for (int i = 0; i < n - 1; ++i) {
        score += b[a[i] - 1];
        if (a[i + 1] == a[i] + 1) {
            score += c[a[i] - 1];
        }
        // cout << score << endl;
    }
    score += b[a[n - 1] - 1];

    cout << score << endl;
}

#include <string>
void _141() {
    string s;
    cin >> s;
    bool judge = true;
    for (int i = 0; i < s.size(); ++i) {
        if ((i + 1) % 2 == 0 && s[i] == 'R') {
            judge = false;
            break;
        } else if ((i + 1) % 2 == 1 && s[i] == 'L') {
            judge = false;
            break;
        }
    }

    if (judge) 
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void _142() {
    int n, k;
    cin >> n >> k;
    int count = 0;
    int h;
    for (int i = 0; i < n; ++i) {
        cin >> h;
        if (h >= k)
            count++;
    }
    cout << count << endl;
}

void _143() {
    int n;
    cin >> n;
    int d[50];
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }

    int value = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
            value += d[i] * d[j];
        }
    }
    cout << value << endl;
}

void _144() {
    int n;
    cin >> n;

    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return;
            }
        }
    }
    cout << "No" << endl;
}

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



Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
    int a,b[1000],c,d[1000],e=0,i,j;
    cin>>a>>c;
    for(i=1;i<=a;i++)
    cin>>b[i];
    sort(b+1,b+a+1);
    for(j=a,i=1;i<=c;i++,j--)
    d[i]=b[j];
    for( i=1;i<=c;i++)
    e=d[i]+e;
    cout<<e;
}

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

typedef pair<int,int> P;
const int INF = 500000000;

int main(){
    int a;
    cin >> a;
    int v[4];
    for (int i = 3; i >= 0; i--){
        v[i] = a%10; a /= 10;
    }
    bool MMYY = true, YYMM = true;
    int fir = v[0]*10 + v[1], sec = v[2]*10 + v[3];
    if (fir < 1 || fir > 12) MMYY = false;
    if (sec < 1 || sec > 12) YYMM = false;

    if (MMYY && YYMM) cout << "AMBIGUOUS" << "\n";
    else if (MMYY) cout << "MMYY" << "\n";
    else if (YYMM) cout << "YYMM" << "\n";
    else cout << "NA" << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;


public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int c =0;
        for(int i=0; i<a.length(); i++){
            if(a.charAt(i)!=b.charAt(i)){
                c++;
            }
        }
        System.out.println(c);
    }
}

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

const int maxn=300005,mod=998244353;
long long n,a,b,k;
long long ans=0;
long long numa,numb;
long long fac[maxn],inv[maxn],facinv[maxn];//阶乘,逆元,阶乘的逆元
 
void pre(){
	fac[0]=fac[1]=inv[0]=inv[1]=facinv[0]=facinv[1]=1;
        
    for(long long i=2;i<=maxn-5;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
        facinv[i]=facinv[i-1]*inv[i]%mod;
    }
}

long long C(long long u,long long v){
	return fac[u]*facinv[u-v]%mod*facinv[v]%mod;
}

int main(){
	pre();
	//for(long long i=1;i<=10;i++)  cout<<fac[i]<<' ';
	ios::sync_with_stdio(0);
	cin>>n>>a>>b>>k;
	
	for(long long i=0;i<=n;i++){
		//cout<<i<<endl;
		numa=i;
		if(a*numa>k)  break;
		if((k-a*numa)%b!=0)  continue;
		numb=(k-a*numa)/b;
		if(numb<0 || numb>n)  continue;
		//cout<<1<<endl;
		ans=(ans+C(n,numa)*C(n,numb)%mod)%mod;
		//cout<<ans<<endl; 
		//cout<<numa<<' '<<numb<<endl;
		//cout<<C(n,numa)<<' '<<C(n,numb)<<endl;
	}
	
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 7296
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, K, C):
    ans = 0

    for h in range(H+1):
        for w in range(W+1):
            for i in combinations(range(H), r=h):
                i = set(i)
                for j in combinations(range(W), r=w):
                    j = set(j)
                    t = 0
                    for x in range(H):
                        for y in range(W):
                            if x in i or y in j:
                                continue
                            if C[x][y] == '#':
                                t += 1
                    if t == K:
                        ans += 1

    return ans


def main():
    H, W, K = read_int_n()
    C = [read_str() for _ in range(H)]
    print(slv(H, W, K, C))


if __name__ == '__main__':
    main()


Measured memory_bytes: 79092
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    int N,Q;
    string S;
    cin >> N >> S >> Q;
    rep(i,Q){
        lint Dcount=0,Mcount=0,ok=0;
        int k;
        lint ans=0;
        cin >> k;
        rep(j,N){
            if(j>=k){
                if(S[j-k]=='D') Dcount--,ok-=Mcount;
                if(S[j-k]=='M') Mcount--;
            }
            if(S[j]=='D') Dcount++;
            if(S[j]=='M') Mcount++,ok+=Dcount;
            if(S[j]=='C') ans+=ok;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1948
#include <stdio.h>
int main(void){
    int h,w;
    int i,j;
    while(1) {
        scanf("%d %d",&h,&w);
        if(h==0 && w==0) break;
        for (i=1; i<=h; i++){
            for(j=1; j<=w; j++){
                if(1<i && i<h && 1<j && j<w)
                printf(".");
                else
                printf("#");}
                printf("\n");}
                printf("\n"); }
return 0;                
}


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

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < 30;i++){
    for(int j = 0; j < 30; j++){
      if(i * 4 + j * 7 == n){
      	cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)


ll MOD = 1000000007;

int ctoi(char c) {
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return -1;
	}
}

int main() {
	ll x = 10;
	uint m10[20];
	rep(i, 20) {
		m10[i] = x;
		x *= x;
		x %= 2019;
	}
	string s;
	cin >> s;
	vector<ll> t(s.size() + 1);
	t[0] = 0;
	vector<int> c(2019);
	rep(i, 2019) c[i] = 0;
	c[0]++;
	for (uint i = 1; i < s.size() + 1; ++i) {
		int md10 = 1;
		rep(j, 20) {
			if ((((i - 1) >> j) & 1) == 1) {
				md10 *= m10[j];
				md10 %= 2019;
			}
		}
		int su = ctoi(s[s.size() - i]);
		t[i] = (t[i - 1] + (su * md10)) % 2019;
		c[t[i]]++;
	}
	ll res = 0;
	rep(i, 2019)res += c[i] * (c[i] - 1) / 2;
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 5160
n, m = gets.split.map(&:to_i)
arr=gets.split.map(&:to_i)
hash={}
m.times do |i|
  a,b=gets.split.map(&:to_i)
  hash[a] = (hash[a] || []).push(b)
  hash[b] = (hash[b] || []).push(a)
end
cnt=n-hash.count
hash.each do |k,v|
  i=k-1
  varr=v.map{|l|arr[l-1]}
  cnt+=1 if arr[i] > varr.max
  if arr[i] > v.max
  end
end
puts cnt


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

int main() {
	int x;
	cin >> x;
	if ( x<4 ) {
		cout << 1 << '\n';
		return 0;
	}
	int ans=1;
	for (int i=2; i*i<=x; i++) {
		int j=i*i;
		while ( j<=x ) {
			ans=max(ans,j);
			j*=i;
		}
	}
	cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
s = input()

fizz = list()
buzz = list()
for i in range(1, len(s) + 1):
    if i % 2 == 0:
        fizz.append(s[i-1])
    else:
        buzz.append(s[i-1])

boolean = 0
for i in range(len(fizz)):
    if fizz[i] == "R":
        print("No")
        boolean = 1
        break
if boolean != 1:
    for i in range(len(buzz)):
        if buzz[i] == "L":
            print("No")
            boolean = 1
            break

if boolean == 0:
    print("Yes")


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long int
#define mod 998244353
bool vis[10000001] = {0};
ll power(ll x, ll b)
{
    ll p = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            p = p * x;
            p %= mod;
        }
        b >>= 1;
        x *= x;
        x %= mod;
    }
    return p % mod;
}
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll j = 2;

    for (int i = 2; i <= sqrt(n); i++)
    {
        while (i * j <= sqrt(n))
        {
            if (vis[i * j] == 0)
                vis[i * j] = 1;
            j++;
        }
        j = 2;
    }
    vector<ll> vec;
    for (int i = 2; i <= sqrt(n); i++)
    {
        if (vis[i] == 0)
        {
            vec.push_back(i);
        }
    }
    // cerr << "sdkcjsd"
    //      << "\n";
    // for (int i = 0; i < vec.size(); i++)
    // {
    //     cout << vec[i] << "\n";
    // }
    // cerr << "xgdfhfg"
    //      << "\n";
    vector<pair<ll, ll>> vec1;
    ll count = 0;

    for (int i = 0; i < vec.size(); i++)
    {
        count = 0;
        while (n >= vec[i])
        {
            if (n % vec[i] == 0 && n > 1)
            {
                n = n / vec[i];
                count++;
            }
            else
            {
                break;
            }

            // cout << n << "\n";
        }
        vec1.push_back({vec[i], count});
    }
    count = 0;
    //cerr << "sdckjs"
    ///   << "\n";
    // cerr << vec1.size() << "\n";
    // for (int i = 0; i < vec1.size(); i++)
    // {
    //     cerr << vec1[i].first << " " << vec1[i].second << "\n";
    // }
    for (int i = 0; i < vec1.size(); i++)
    {
        ll count1 = 1;
        if (vec1[i].second == 0)
            continue;
        while (vec1[i].second)
        {
            ll p = vec1[i].second - count1;
            if (p > count1)
            {
                count++;
                vec1[i].second -= count1;
                count1 += 1;
                continue;
            }
            count++;
            break;
        }
        //cout << count << "\n";
    }
    if (n != 1 && n != 1)
        cout << count + 1 << "\n";
    else
    {
        cout << count << "\n";
    }

    //  cout << count << "\n";
    return 0;
}

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


int main(){
  int N, K;
  cin >> N >> K;
  vector<int> DP(N);
  vector<int> hs(N);
  for(int i=0; i<N; i++){
    cin >> hs[i];
  }
  DP[0] = 0;
  for(int i=1; i<N; i++){
    int min_ = 1e9;
    for(int j=1; j<min(K+1,i+1); j++){
      min_ = min(abs(hs[i]-hs[i-j])+DP[i-j], min_);
    }
    DP[i] = min_;
  }
  cout << DP[N-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int h[n];
    rep(i, 0, n) cin >> h[i];
    vector<int> dp(100050, INF);
    dp[0] = 0;
    rep(i, 0, n) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,est,cnt;cin >> a >> b;
    cnt = 0;
    for(int i=0;i<2;i++){
       if(a>=b){
        cnt += a;
        a = a - 1;
      }else{
        cnt += b;
        b = b - 1;
      } 
    }

    cout << cnt << endl;
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <numeric>
#include <set>

using namespace std;

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()

int main() {
	string s;
	cin >> s;
	if (s == "keyence") {
		cout << "YES" << endl;
		return 0;
	}
	REP(i, s.size()) {
			string a = s;
			a.erase(i);
			if (a == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
	}
	REP(i, s.size()) {
		FOR(j,1,s.size() - i) {
			string a = s;
			a.erase(i,j);
			if (a == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" <<endl;
}




Measured memory_bytes: 256
package main

import (
        "fmt"
)

func solution(h, w int, s []string) []string {
        m := make([][]byte, h)
        for i := range m {
                m[i] = make([]byte, w)
        }
        var dx = [8]int{1, 0, -1, 1, -1, 1, 0, -1}
        var dy = [8]int{-1, -1, -1, 0, 0, 1, 1, 1}
        for i := 0; i < h; i++ {
                for j := 0; j < w; j++ {
                        if s[i][j] != '#' {
                                c := 0
                                for d := 0; d < 8; d++ {
                                        ni := i + dy[d]
                                        nj := j + dx[d]

                                        if ni < 0 || h <= ni {
                                                continue
                                        }
                                        if nj < 0 || w <= nj {
                                                continue
                                        }
                                        if s[ni][nj] == '#' {
                                                c++
                                        }
                                }
                                m[i][j] = byte(c + '0')
                        } else {
                                m[i][j] = '#'
                        }
                }
        }
        for i := range m {
                s[i] = string(m[i])
        }
        return s
}

func main() {
        var h, w int
        fmt.Scan(&h, &w)
        s := make([]string, h)
        for i := range s {
                fmt.Scan(&s[i])
        }
        for _, t := range solution(h, w, s) {
                fmt.Println(t)
        }
}

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

def memorize(f) :
    cache = {}
    def helper(*args) :
        if args not in cache :
            cache[args] = f(*args)
        return cache[args]
    return helper

@memorize
def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    res = fibonacci(n - 2) + fibonacci(n - 1)
    return res

print(fibonacci(N))


Measured memory_bytes: 5612
#include<cstdio>

using namespace std;

int a[200001];
char ss[100];
int cx(int p){
	printf("%d\n",p-1);
	fflush(stdout);
	scanf("%s",ss);
	return ss[0]=='F';
}
int main(){
	int n;
	scanf("%d",&n);
	int l=1,r=n+1;
	a[1]=a[n+1]=cx(1);
	while(r-l>1){
		int mid=l+r>>1;
		int o=cx(mid);
		a[mid]=o;
		if((o^a[l])!=((l^mid)&1))
			r=mid;
		else l=mid;
	}
	cx(l);cx(r);
}


Measured memory_bytes: 852
#define taskname "data"

#include <bits/stdc++.h>

#define FOR(i, a, b) for(int i = (a) ; i <= (b) ; ++i)
#define FOD(i, a, b) for(int i = (a) ; i >= (b) ; --i)
#define RP(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define FORE(i, a) for(__typeof((a).begin()) i = (a).begin() ; i != (a).end() ; ++i)
#define FRSZ(i, a) for(int i = 0 ; i < (a).size() ; ++i)
#define FPSZ(i, a) for(int i = 0 ; i < (a).size() - 1 ; ++i)
#define RPSZ(i, a) for(int i = 1 ; i < (a).size() ; ++i)
#define FDSZ(i, a) for(int i = (a).size() - 1 ; i >= 0 ; --i)

#define ALL(x) (x).begin(),(x).end()
#define Bit(x, y) (((x) >> ((y) - 1)) & 1)
#define NumBit(x) (__builtin_popcount(x))
#define __unique(a) sort((a).begin(), (a).end()), a.resize(unique(a.begin(), a.end()) - a.begin())

#define SET(x) memset(x, -1, sizeof x)
#define CLR(x) memset(x, 0, sizeof x)
#define BIG(x) memset(x, 0x3f3f3f3f, sizeof x);

#define debugarr(a, n) {FOR(_, 1, n) printf("%d ", (a)[_]); cout << endl;}
#define debugvi(x) {FRSZ(_, x) cout << (x)[_] << " " ; cout << endl;}
#define debug(x) cout << #x << " = " << (x) << endl;

#define fi first
#define se second
using namespace std;

template <typename T> void Read(T &x){
	char ch;
	bool neg = 0;
	x = 0;
	while(!isdigit(ch = getchar()) && ch != '-');
	if (ch == '-') {neg = 1; ch = getchar();}
	do{x = x * 10 + ch - 48;} while(isdigit(ch = getchar()));
	if (neg) x = -x;
	return;}
template <typename T> void Write(T x){
	char ch[32];
	int cnt = 0;
	bool neg = 0;
	if (x < 0) {neg = 1; x = -x;}
	do{ch[++cnt] = x % 10 + 48 ; x /= 10;} while(x);
	if (neg) putchar('-');
	FOD(i, cnt, 1) putchar(ch[i]);}
template <typename T> void Writenm(T x, int num){
    char ch[32];
	int cnt = 0, cntDigit = 0;;
	bool neg = 0;
	if (x < 0) {neg = 1; x = -x;}
	do{ch[++cnt] = x % 10 + 48 ; x /= 10; ++cntDigit;} while(x);
	if (neg) putchar('-');
	FOR(i, cntDigit + 1, num) putchar('0');
	FOD(i, cnt, 1) putchar(ch[i]);}
template <typename T> void Writeln(T x){
	Write(x);
	putchar('\n');}
template <typename T> void Writesp(T x){
	Write(x);
	putchar(' ');}

int n;

void Enter(){
	Read(n);
}

void Solve(){
	if (n % 2)
		Write((n / 2) * (n / 2 + 1));
	else Write((n / 2) * (n / 2));
}

int main(int argc, char const *argv[])
{
	Enter();
	Solve();
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE

//-----CODE------//


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

void solve(void)
{ 
  int N;
  cin>>N;
  int X;cin>>X;
  int GCD = X;
  for (int i = 0; i < N - 1; i++)
  {
    int c;cin>>c;
    GCD = gcd(GCD,c);
  }
  cout<<GCD<<endl;
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define rep_eq(i,l,r) for(int i=l; i<=(int)(r); i++)
#define all(vec) vec.begin(),vec.end()
#define allr(vec) vec.rbegin(),vec.rend()
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; }

using ll=int64_t;

using vb=vector<bool>;
using vc=vector<char>;
using vs=vector<string>;
using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

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

  int D,G; cin >>D >>G;
  vi p(D),c(D);
  rep(i,0,D) {cin >>p[i] >>c[i];}

  int ans=INT_MAX;
  rep(bit,0,1<<D) {
    int s=0;
    int n=0;
    rep(i,0,D) {
      if (bit&(1<<i)) {
        s+=c[i]+p[i]*100*(i+1);
        n+=p[i];
      }
    }
    if (G<=s) {
      chmin(ans,n);
    } else {
      for (int i=D-1;-1<i;i--) {
        if (bit&(1<<i)) {
          continue;
        }
        rep(j,0,p[i]) {
          if (G<=s) {
            break;
          }
          s+=100*(i+1);
          n++;
        }
      }
    }
    chmin(ans,n);
  }

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


Measured memory_bytes: 3576
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define replb(i, a, b) for (ll i = a; i >= b; i--)
#define repl(i, a, b) for (ll i = a; i < b; i++)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); 
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int> >
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define search(arr, c) binary_search(arr.begin(), arr.end(), c)
#define pb push_back
#define ll long long
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ull unsigned long long int

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	BRAHAMASTRA

	int n;
	cin>>n;
	vpi s;
	int a,b;
	for(int i=0;i<n;++i)
	{
		cin>>a>>b;
		s.pb(make_pair(a,b));
	}
	int count=0;
	bool ok=false;
	for(int i=0;i<n;++i)
	{
		if(s[i].first==s[i].second)
		{
			count++;
			if(count==3)
			{
				ok=true;
				break;
			}
		}
		else
			count=0;
	}
	if(ok)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}

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

typedef long long ll;

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

int N, K;
ll A[1001];

int main() {
  cin >> N >> K;
  REP(i,N) cin >> A[i];
  vector<ll> B, C;
  REP(i,N) {
    REP(j, B.size()) {
      B[j] += A[i];
    }
    B.push_back(A[i]);
    copy(B.begin(),B.end(),back_inserter(C));
  }

  ll x = 0;
  int m = 40;
  for (int i = m; i >= 1; i--) {
    int cnt = 0;
    REP(j, C.size()) {
      if (((x|(1LL<<(i-1))) & C[j]) == (x|(1LL<<(i-1)))) cnt++;
    }
    if (cnt >= K) x |= (1LL<<(i-1));
  }

  cout << x << endl;
  
  return 0;
}


Measured memory_bytes: 6384
H, W = map( int, input().split())
V = [ input() for _ in range(H)]
B = [ '' for _ in range(H)]
R = [ '' for _ in range(H)]
N = '#'*(W-1)
for i in range(H):
    if i%2 == 0:
        B[i] = N+V[i][-1]
        R[i] = V[i][:W-1] + '#'
    else:
        R[i] = V[i][-1] + N
        B[i] = '#' + V[i][1:]
for i in range(H):
    print(B[i])
print('')
for i in range(H):
    print(R[i])

Measured memory_bytes: 4340
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool checkAC(char, char);

int main () {
    int n, q;
    string s;
    cin >> n >> q;
    cin >> s;
    vector<int> l(q);
    vector<int> r(q);
    for (int i = 0; i < q; i++) {
        cin >> l[i] >> r[i];
    }
    vector<int> sum_AC(n);
    sum_AC[0] = 0;
    for(int i = 1; i < n; i++) {
        if (checkAC(s[i-1], s[i])) {
            sum_AC[i] = sum_AC[i-1] + 1;
        } else {
            sum_AC[i] = sum_AC[i-1];
        }
    }
    
    for (int i = 0; i < q; i++) {
        cout << sum_AC[r[i]-1] - sum_AC[l[i]-1] << endl;
    }
}

bool checkAC(char c1, char c2) {
    if (c1 == 'A' && c2 == 'C') {
        return true;
    } else {
        return false;
    }
}


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

int main(){
  string a,b;
  cin >> a >> b;
  for(int i=0; i< b.size(); i++){
    cout << a[i] << b[i];
  }
  if(a.size()!=b.size())
    cout << a[a.size()-1];
  return 0;
}

Measured memory_bytes: 256