akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}			
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int N;
	cin >> N;
	vector<array<long, 3>> Info;
	Info.resize(N);
	int Entry = 0;
	for (int i = 0; i < N; i++) {
		cin >> Info[i][0] >> Info[i][1] >> Info[i][2];
		if (Info[i][2] != 0) {
                     Entry=i;
		}
	}
	for (long x = 0; x <= 100; x++) {
		for (long y = 0; y <= 100; y++) {
			bool accept = true;
			long H = abs(Info[Entry][0] - x) + abs(Info[Entry][1] - y) + Info[Entry][2];
			for (int i = 0; i < N; i++) {
				if (max(H - abs(Info[i][0] - x) - abs(Info[i][1] - y), 0l) != Info[i][2]) {
					accept = false;
					break;
				}
			}
			if (accept) {
				cout << x << " " << y << " " << H << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 50;
const int mod = 1e9+7;
int dp[maxn];
int h[maxn];
int main(){
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        cin >>  h[i];
        dp[i] = (1<<30)-1;
    }

    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    for(int i = 3; i <= n; i++){
        for(int j = max(1, i-k); j <= i-1; j++){
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
N = int(input())
K = int(input()) 
X = list(map(int, input().split()))

len_X = len(X)

ans = 0

for i in range(len_X):
    if abs(K-X[i])*2 <= abs(X[i])*2:
        ans = ans + (abs(K-X[i])*2)
    else:
        ans = ans + (abs((X[i])*2))

print(ans)

Measured memory_bytes: 3060
from itertools import *
g=lambda a,x,b:a+b if x=='+'else a-b if x=='-'else a*b
def f(s):
 for a,b,c,d in permutations(s):
  for x,y,z in product('+-*',repeat=3):
   if g(g(g(a,x,b),y,c),z,d)==10:return f"((({a} {x} {b}) {y} {c}) {z} {d})"
   if g(g(a,x,b),y,g(c,z,d))==10:return f"(({a} {x} {b}) {y} ({c} {z} {d}))"
 return 0
[print(f(list(map(int,e.split()))))for e in iter(input,'0 0 0 0')]


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

#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define INT(n) int n;assert(0<scanf("%d",&n))
#define VI(v,n) vector<int> v(n);REP(i,n){assert(0<scanf("%d",&v[i]));}

int main(){
  INT(n); INT(k); VI(as, n);
  int ans = 0;
  int l = 0, r = 1000000000, c;
  while (l + 1 < r){
    int cnt = 0;
    c = (l + r) / 2;
    for (int a: as){
      cnt += (a + c - 1) / c - 1;
    }
    if (cnt <= k){
        r = c;
    } else {
        l = c;
    }
  }
  printf("%d\n", r);
  return 0;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

class PrimeFactor {
private:
    map<uint64_t , uint> factor_result;
    const uint64_t data;

public:
    PrimeFactor(uint64_t data) : data(data) {
        uint64_t calc_base = data;
        for (uint64_t index = 2; index * index <= calc_base; index++) {
            while (calc_base % index == 0) {
                factor_result[index]++;
                calc_base /= index;
            }
        }
        if (calc_base != 1) factor_result[calc_base]++;
    }

    map<uint64_t, uint> &query() { return factor_result; }
};


int main() {
    ll N;
    cin >> N;
    PrimeFactor save(N);
    ll ans = 0;
    for (auto now : save.query()) {
        ll temp;
        for (int i = 1; i < 100; i++) {
            if (now.second >= i * (i + 1) / 2) temp = i;
        }
        ans += temp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
using System;

class Program
{
    static void Main()
    {
    	while(true) {
    		var s = Console.ReadLine();
    		
    		if(s == "-")	break;
    	
    		var m = int.Parse(Console.ReadLine());
    		
    		for(int i = 0; i < m; i++) {
    			var h = int.Parse(Console.ReadLine());
    			s = s.Substring(h) + s.Substring(0, h);
    		}
    		Console.WriteLine(s);
    	}
    }
}

Measured memory_bytes: 8856
#include <bits/stdc++.h>
#define fi first
#define se second
#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()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,d,x;
  cin >> n >> d  >> x;
  vi a(n);
  rep(i,n){
    cin >> a[i];
  }
  int ans = 0;
  rep(i,n)ans+=1+(d-1)/a[i];
  ans+=x;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3572
Scanf.scanf "%d" (fun n ->
    let rec first k = if k < 10 then k else first (k / 10) in
    let count ap bp =
        let rec loop i acc =
            if i > n then acc else
                let s = first i in 
                let acc = if s = ap then acc + 1 else acc in
                loop (i + 10) acc
        in
        loop bp 0
    in
    let rec loop1 ap acc =
        let rec loop2 bp acc =
            if bp = 10 then acc else loop2 (bp + 1) (acc + count ap bp * count bp ap)
        in
        if ap = 10 then acc else
            loop1 (ap + 1) (loop2 1 acc)
    in
    loop1 1 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 2432
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 	
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
   
int cnt[N];   
  

 void solve() {
          int n,k;
          cin>>n>>k;	
          cnt[k]=1;
         int  ans=k;
          for(int i=k-1;i>=1;i--) {
			     int nax=(k/i);
			     cnt[i]=po(nax,n);
			     for(int j=2*i;j<=k;j+=i) {
					   cnt[i]=cnt[i]+mod-cnt[j];
					   if(cnt[i]>=mod)
					    cnt[i]-=mod;
					 }
				  ans+=cnt[i]*i;
				  ans%=mod;	 
			  }
			  cout<<ans<<endl;
           
        
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 4312
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b-1); i >= (a); i--)
#define REP(i,n) FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

int main () {
  int N; cin >> N;
  vector<double> v(N); REP(i,N) cin >> v[i];

  SORT(v);

  double ans = v[0];
  REP(i,N-1) {
    ans = (ans+v[i+1])/2.0;
  }

  cout << ans << endl;
}

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

typedef long long ll;
const int maxn = 2E+5 + 5;

int n, c[maxn];
ll siz[maxn], last[maxn], ans[maxn];
std::vector<int> to[maxn];

void DFS1(int u, int father)
{
	siz[u] = 1;
	for(int i = 0; i < to[u].size(); ++i) {
		int v = to[u][i];
		
		if(v != father) {
			DFS1(v, u);
			siz[u] += siz[v];
		}
	}
}

void DFS2(int u, int father)
{
	ans[c[u]] += (last[c[u]] - siz[u] + 1) * siz[u];
	
	ll tmp = last[c[u]] - siz[u], down = 0, T;
	
	T = last[c[u]] = siz[u] - 1;
	for(int i = 0; i < to[u].size(); ++i) {
		int v = to[u][i];
		
		if(v != father)
			DFS2(v, u), ans[c[u]] += down * (siz[v] - (T - last[c[u]])), down += siz[v] - (T - last[c[u]]), T = last[c[u]];
	}
	last[c[u]] = tmp;
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		last[i] = n;
		scanf("%d", &c[i]);
	}
	for(int i = 1; i < n; ++i) {
		int x, y;
		
		scanf("%d%d", &x, &y);
		to[x].push_back(y), to[y].push_back(x);
	}
	
	DFS1(1, 0), DFS2(1, 0);
	
	for(int i = 1; i <= n; ++i)
		printf("%lld\n", ans[i]);
}

Measured memory_bytes: 38252
N = int(input())
A = list(map(int, input().split()))

B = []
for i in range(N):
    B.append(A[i] - (i+1))
    
B = sorted(B)
b = B[len(B) // 2]
ans = 0
for i in range(N):
    ans += abs(A[i] - (b + i + 1))

print(ans)

Measured memory_bytes: 26708
//解説視聴後
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#define rep(i,n) for(int i=0; i < (n); i++)
#define INF 1001001
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int len = (int)(s.length());
  int mod[len];
  int num[2019];
  mod[len-1]=(int)s[len-1] - '0';
  int tmp=10;
  for(int i=len-2;i>=0; i--){
    mod[i]=(mod[i+1]+tmp*((int)(s[i])-'0'))%2019;
    tmp = (tmp*10)%2019;
  }
  rep(i,2019){
    num[i]=0;
  }
  rep(i,len){
    num[mod[i]]++;
  }
  if(num[0]>0) num[0]++;
  long long result=0;
  rep(i,2019){
    if(num[i]<=1) continue;
    result += num[i]*(num[i]-1);
  }
  result = result /2;
  
  cout << result << endl;
  
  
}

Measured memory_bytes: 4504
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll x,y,z;cin>>x>>y>>z;
    cout<<z<<' '<<x<<' '<<y<<endl;
}

Measured memory_bytes: 256
def main():

    N = int(input())
    A = list(map(int, input().split()))
    prefix = [A[0]]
    for i in range(1, N):
        prefix.append(gcd(prefix[-1], A[i]))
    suffix = [A[N-1]]
    for i in range(N-2, -1, -1):
        suffix.append(gcd(suffix[-1], A[i]))
    suffix = suffix[::-1]
    # print(prefix)
    # print(suffix)

    ans = 1
    for i in range(N):
        if i == 0:
            ans = max(ans, suffix[1])
        elif i == N-1:
            ans = max(ans, prefix[-2])
        else:
            ans = max(ans, gcd(prefix[i-1], suffix[i+1]))
    return ans

def gcd(a, b):
    if a > b:
        a, b = b, a
    if a == 0: return b
    else: return gcd(b % a, a)

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 14436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const ll MAX=1e16;
const ll MM=1e18;
const ll mod=998244353;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}
const ll MaxSize = 3e5;
ll facts[MaxSize], invFacts[MaxSize];

void preproc() {
  facts[0] = 1;
  for (int i = 1; i < MaxSize; i++) {
    facts[i] = ((ll)facts[i - 1] * i) % mod;
  }
  invFacts[MaxSize - 1] = expo(facts[MaxSize - 1], mod - 2,mod);

  for (int i = MaxSize - 2; i >= 0; i--) {
    invFacts[i] = ((ll)invFacts[i + 1] * (i + 1)) % mod;
  }
}

ll combination(ll n, ll k) {
  if(n<k) return 0;
  ll res = facts[n];
  res = ((ll)res * invFacts[k]) % mod;
  return ((ll)res * invFacts[n - k]) % mod;
}

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


#define f(x) (x)*(x)*(x)*(x)*(x)
void solve()
{
    
    ll x;
    cin >> x;
    
    ll mx = 500;
    for(ll i = -mx; i <= mx; i++) {
        for(ll j = 0; j <= mx; j++) {
            ll check = f(j)-f(i);
            
            if(check == x) {
                cout << j << " " << i << endl;
                return;
            }
        }
    }
} 
int main()
{
  boost;
  int m;
  //cin >> m;
  int t=1;
  //cin>>t;
  while(t--)
  {
      solve();
  }
}



Measured memory_bytes: 3580
#include<stdio.h>
#define N 100

int main(){
  int n,i,j,temp;
  int array[N];
  int flag = 0;

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

  for(i=0; i<n-1; i++){
    for(j=n-1; j>i; j--){
      if(array[j] < array[j-1]){
	temp = array[j-1];
	array[j-1] = array[j];
	array[j] = temp;
	flag++;
      }
    }
  }

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

  return 0;
}




Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n;
    cin>>n;
    rep(i,100000){
        int s = i*i;
        if(s>n){
            cout<<(i-1)*(i-1)<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((int) a.size())
typedef long long ll;
const int MAXN = 2*1e5 + 10;
const int MAX = 1e7 + 1 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
ll mod = 998244353 ;
ll powr(ll a , ll b){ if(b==0) return 1LL ; ll x = powr(a,b/2) ; x = (x*x)%mod ; if(b%2) return ((a%mod)*x)%mod ; return x ;}
ll gcd(ll a , ll b){if(a==0) return b ; return gcd(b%a,a);}
pair<int,int> dp[105][2004] ;
int main () {
    ll N , H, W ;
    cin >> N >> H >> W ;
    cout<<(N-H+1)*(N-W+1)<<endl;
    return 0 ;
}


Measured memory_bytes: 256
let swap a i j = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp

let rec partition (a : (int * char * int) array) r cmp = function
  | (i, j) when j = r -> swap a i r; i
  | (i, j) when cmp a.(j) a.(r) <= 0 -> swap a i j; partition a r cmp (i + 1, j + 1)
  | (i, j) -> partition a r cmp (i, j + 1)

let rec quick_sort (a : (int * char * int) array) p r cmp =
  if p < r then begin
    let q = partition a r cmp (p, p) in
    quick_sort a p (q - 1) cmp;
    quick_sort a q r cmp
  end

let rec stable_p (a : (int * char * int) array) n i =
  if i = n then true
  else if (fun (xi, _, xd) (yi, _, yd) -> xd = yd && xi > yi) a.(i-1) a.(i) then false
  else stable_p a n (i + 1)

let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i -> doit (sub s 0 i) (sub s (i + 1) (length s - i - 1) :: acc) in
  doit str []

let () =
  let n = read_int () in
  let read i =
    match split (read_line ()) ' ' with
    | [c; d] -> (i, c.[0], int_of_string d)
    | _ -> exit 1 in
  let a = Array.init n read in
  quick_sort a 0 (n - 1) (fun (_, _, x) (_, _, y) -> compare x y);
  print_endline (if stable_p a n 1 then "Stable" else "Not stable");
  Array.iter (fun (_, c, d) -> Printf.printf "%c %d\n" c d) a

Measured memory_bytes: 8900
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
#define itn int
#define bs bitset<5001>

int kai_size = 1000001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int sz(pin x) { return x.first*x.second; }
void make(int c, int pot, int d, vel &col, vel &max_use,vvel &way) {
	if (max_use[pot] < d) {
		if (col[pot] == 0) { col[pot] = c; }
		max_use[pot] = d;
		for (auto x : way[pot]) {
			make(c, x, d - 1, col, max_use, way);
		}
	}
}
signed main() {
	int n, m; cin >> n >> m;
	vvel way(n);
	rep(i, m) {
		int a, b; cin >> a >> b;
		a--;; b--;
		way[a].push_back(b);
		way[b].push_back(a);
	}
	int q; cin >> q;
	vel v(q), d(q), c(q);
	rep(i, q) {
		cin >> v[i] >> d[i] >> c[i]; v[i]--;
	}
	rev(v), rev(d), rev(c);
	vel col(n, 0);
	vel max_use(n, -1);
	rep(i, q) {
		make(c[i], v[i], d[i], col, max_use,way);
	}
	rep(i, n) {
		cout << col[i] << Endl;
	}
	return 0;
}
/*
13:40~

*/

Measured memory_bytes: 26484
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		if(str.equals("a")){
			answer = "vowel";
		}else if(str.equals("i")){
			answer = "vowel";
		}else if(str.equals("u")){
			answer = "vowel";
		}else if(str.equals("e")){
			answer = "vowel";
		}else if(str.equals("o")){
			answer = "vowel";
		}else{
			answer = "consonant";
		}


		System.out.println(answer);


	}

}


Measured memory_bytes: 22228
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  double n,m; cin>>n;
  if((int)n%2) m = (n+1)/2;
  else m = n/2;
  cout << m/n << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
mod = 10**9 + 7
dic = {}

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
            
    if temp != 1:
        arr.append([temp, 1])
        
    if arr == []:
        arr.append([n, 1])

    return arr

for i in range(1, n+1):
    a = factorization(i)
    for i in range(len(a)):
        if a[i][0] not in dic:
            dic[a[i][0]] = 1
        else:
            dic[a[i][0]] += a[i][1]

ans = 1
for k in dic.values():
    ans *= k+1
print((ans//2)%mod)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;

namespace Math {
// Generic modular integer.

    ll modpow(ll b, ll p, ll m) {
        ll r = 1;
        for (; p; p >>= 1, b = b * b % m)
            if (p & 1)
                r = r * b % m;
        return r;
    }

    ll modinv(ll b, ll m) { return modpow(b, m - 2, m); }

    template<int MOD, typename IntType = int>
    struct GModint {
        IntType val;

        GModint() : val(0) {}

        GModint(int v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        GModint(ll v, bool safe = false) { val = safe ? v : ((v % MOD) + MOD) % MOD; }

        explicit operator bool() const { return val != 0; }

        const bool operator==(const GModint &g) const { return val == g.val; }

        const bool operator!=(const GModint &g) const { return val != g.val; }

        const GModint operator+=(const GModint &g) { return *this = *this + g; }

        const GModint operator-=(const GModint &g) { return *this = *this - g; }

        const GModint operator*=(const GModint &g) { return *this = *this * g; }

        const GModint operator/=(const GModint &g) { return *this = *this / g; }

        const GModint operator^=(const GModint &g) { return *this = *this ^ g; }

        const GModint operator-() const { return GModint(val == 0 ? 0 : MOD - val, true); }

        const GModint operator+(const GModint &g) const {
            ll newval = val + g.val;
            if (newval >= MOD)
                newval -= MOD;
            return GModint(newval, true);
        }

        const GModint operator-(const GModint &g) const { return *this + (-g); }

        const GModint operator*(const GModint &g) const { return GModint(1ll * val * g.val); }

        const GModint operator/(const GModint &g) const { return *this * g.inv(); }

        template<class T>
        const GModint operator^(const T t) const { return GModint(modpow(val, t, MOD)); }

        const GModint inv() const { return GModint(modinv(val, MOD)); }
    };

    using Modint = GModint<1000000007>;
}

using Math::Modint;
Modint facts[600005];

Modint ncr(int n, int r) {
    return facts[n] / facts[r] / facts[n - r];
}

int main() {
    facts[0] = 1;
    for (int i = 1; i < 600005; i++) facts[i] = facts[i - 1] * i;

    int n, k;
    cin >> n >> k;
    if (k >= n - 1) {
        cout << ncr(2 * n - 1, n - 1).val << endl;
    } else if (k == 1) {
        Modint m = 1;
        m = m * n * (n - 1);
        cout << m.val << endl;
    } else {
        Modint tans;
        tans += 1;
        for (int i = 1; i <= k; i++) {
            tans += ncr(n, i) * ncr(n - 1, i);
        }
        cout << tans.val << endl;
    }
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define maxn 109
using namespace std;
int n,m;
int a[maxn];
long long dp[maxn][maxn][300];
long long fact[maxn];
const int MOD=1e9+7;
int main(){
    dp[0][0][0]=1;
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>a[i];

    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++)
           for(int k=0;k<=255;k++){
                dp[i][j][k]=dp[i-1][j][k];
                if(j)
                    dp[i][j][k]+=dp[i-1][j-1][k^a[i]];
                dp[i][j][k]%=MOD;
           }
    }
    long long ans=0;
    fact[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i%MOD;
    for(int i=1;i<=n;i++){
        ans+=dp[n][i][m]*fact[i]%MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
	// freopen("./input.txt", "r", stdin);
    int a[4], b[4];
    int deg[5];
    memset(deg, 0, sizeof(deg));
    for (int i = 1; i <= 3; ++i) {
        cin >> a[i] >> b[i];
        ++deg[a[i]];
        ++deg[b[i]];
    }
    int one = 0, two = 0;
    for (int i = 1; i <= 4; ++i) {
        if (deg[i] == 1) {
            ++one;
        } else if (deg[i] == 2) {
            ++two;
        }
    }
    if (one == two && one == 2) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
    
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b;
	char op;
	for(;;){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='+'){
			printf("%d\n",a+b);
			continue;
		}
		if(op=='-'){
			printf("%d\n",a-b);
			continue;
		}
		if(op=='*'){
			printf("%d\n",a*b);
			continue;
		}
		if(op=='/'){
			printf("%d\n",a/b);
			continue;
		}
		break;
	}
return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
 
using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    map<int,int> mapa;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        mapa[x]++;
    }
    for (auto u : mapa) if (u.second > 1) {
        cout << "NO\n";
        exit(0);
    }
    cout << "YES\n";
}

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

int main() {
  int N;
  cin >> N;
  vector<char> data(N);
  int white = 0;
  for(int i = 0; i < N; i++) {
    cin >> data.at(i);
    if(data.at(i) == 'W') {
      white++;
    }
  }
  int count = 0;
  for(int i = N - white; i < N; i++) {
    if(data.at(i) == 'W') {
      count++;
    }
  }
  cout << white - count << endl;    
}

Measured memory_bytes: 3636
a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])

Measured memory_bytes: 61804
#include <iostream>
using namespace std;
#define rep(i,x,to) for(int i=x;i<to;i++)

char score(int m,int f,int r){
	int S=m+f;
	if(m==-1||f==-1) return 'F';
	if(S>=80) return 'A';
	else if(S>=65) return 'B';
	else if((S>=50)||(S>=30&&r>=50)) return 'C';
	else if(S>=30) return 'D';
	else return 'F';
}

int main() {
	int m,f,r;
	while(1){
		cin >> m >> f >> r;
		if(m==-1&&f==-1&&r==-1) break;
		cout << score(m,f,r) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3100
def resolve():
    n, m = map(int, input().split())

    penalties = 0
    wa_counts = [0] * n
    ac_flags = [0] * n

    for _ in range(m):
        line = input().split()
        q = int(line[0])
        r = line[1]

        if ac_flags[q-1] == 0:
            if r == 'WA':
                wa_counts[q-1] += 1

            else:
                ac_flags[q-1] = 1
                penalties += wa_counts[q-1]

    print(sum(ac_flags), penalties)
    
resolve()

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

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

  if(S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" || S == "hihihihihi"){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
print (lambda nzw,c: abs(nzw[2]-c[-1]) if nzw[0] == 1 else (abs(nzw[2]-c[-1]) if abs(nzw[2]-c[-1]) > abs(c[-2]-c[-1]) else abs(c[-2]-c[-1])))(map(int, raw_input().split()), map(int, raw_input().split()))


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  int k = 0;
  cin >> N;
  vector<int> A(N);
  for(int a = 0;a < N;a++)cin >> A[a];
  sort(A.begin(),A.end());
  cout << A[N / 2] - A[(N / 2)-1] << endl;
}

Measured memory_bytes: 3780
// problem: "https://atcoder.jp/contests/abc127/tasks/abc127_e"

#include<bits/stdc++.h>
#define p 1000000007
#define ll long long

using namespace std;

vector<ll>F(200001,-1);

ll fact(ll n)
{
    if(n == 0)
        return 1;

    if(F[n] == -1)
        F[n] = (n*fact(n-1))%p;

    return F[n];
}

ll power(ll a,ll n)
{
    if(n==0)
        return 1;

    ll b = 1;
    if(n%2)
        b = a;

    a = power(a,n/2);
    ll ans = (((a*a)%p)*b)%p;

    return ans;
}

ll nCm(ll n,ll m)
{
    ll a = fact(n);
    ll b = (fact(n-m)*fact(m))%p;       // define

    ll  ans = (a*power(b,p-2))%p;         // define

    return ans;
}

int main()
{
    ll n,m,k;
    cin>>n>>m>>k;

    ll i;
    ll ans = 0;
    for(i=0;i!=n;i++)
        ans = (ans+(((((m*m)%p)*i)%p)*(n-i))%p)%p;
    for(i=0;i!=m;i++)
        ans = (ans+(((((n*n)%p)*i)%p)*(m-i))%p)%p;

    cout<<(ans*nCm(n*m-2,k-2))%p;       // define

    return 0;
}


Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
map<ll, ll> prime_factor(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n]++;
    }
    return res;
}

int N, M;
int divisor[1010101];

int main()
{
    cin >> N >> M;

    int cur = 0;
    for (int i = 1; i * i <= M; i++)
    {
        if (M % i == 0)
        {
            divisor[cur] = i;
            cur++;
            divisor[cur] = M / i;
            cur++;
        }
    }
    sort(divisor, divisor + cur, greater<int>());
    rep(i, 0, cur)
    {
        if (divisor[i] <= M / N)
        {
            cout << divisor[i] << endl;
            return 0;
        }
    }
}

// Mの約数であってM/N以下の最大のもの


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		String sin = sc.nextLine();
		if(sin.charAt(0)=='9' || sin.charAt(1)=='9'){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
    }
}


Measured memory_bytes: 21844
n=int(input())
d=list(map(int,input().split()))
d.sort()
ABC=[]
ARC=[]
for i in range(n):
    if i<n//2:
        ABC.append(d[i])
    else:
        ARC.append(d[i])
if max(ABC)==min(ARC):
    print(0)
else:
    num=abs(max(ABC)-min(ARC))
    print(num)



Measured memory_bytes: 20644
H, W, K = [int(i) for i in input().split()]
p = 10 ** 9 + 7

F = [[0] * W for i in range(W)] #a→bへの写像の個数

def dfs(i, T, flag):
    if i >= W-1:
        for j, t in enumerate(T):
            F[j][t] += 1
        return None
    
    dfs(i+1, T[:], False)
    if not flag:
        T[i], T[i+1] = T[i+1], T[i]
        dfs(i+1, T[:], True)

dfs(0, [i for i in range(W)], False)

A = [[0] * W for i in range(H+1)] #(h, w)の場合の数
A[0][0] = 1

for h in range(H):
    for w in range(W):
        for w2 in range(W):
            A[h+1][w2] += A[h][w] * F[w][w2]
            A[h+1][w2] %= p

print(A[H][K-1])

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

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    if ((n == 1 && b != a) || b < a)
    {
        cout << 0 << "\n";
    }
    else if (a == b)
    {
        cout << 1 << "\n";
    }
    else
    {
        cout << b * (n - 1) + a - (a * (n - 1) + b) + 1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;


double solve(ll x, double p) {
  return (x + 1) / 2 / p;
}

int main(void){
  ll x;
  int p;
  cin >> x >> p;
  if (p == 100) {
    cout << (x + 1) / 2 << endl;
    return 0;
  }
  printf("%.15f\n", solve(x, p / 100.0));
}


Measured memory_bytes: 384
#include <iostream>
#include <set>
#include <tuple>

using namespace std;

int main()
{
	for(int n,h;cin>>n>>h,n|h;){
		set<tuple<int,int,int>> m;
		for(int i=0;i<h;i++){
			string s; cin>>s;
			int a,b; cin>>a>>b;
			a--; b--;
			if(s=="xy")
				for(int j=0;j<n;j++)
					m.insert(make_tuple(a,b,j));
			if(s=="xz")
				for(int j=0;j<n;j++)
					m.insert(make_tuple(a,j,b));
			if(s=="yz")
				for(int j=0;j<n;j++)
					m.insert(make_tuple(j,a,b));
		}
		cout<<n*n*n-m.size()<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 4332
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 998244353
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N,H,W = inpl()
ans = 0
for _ in range(N):
    A,B = inpl()
    if H <= A and W <= B:
        ans += 1

print(ans)


Measured memory_bytes: 4204
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int mod = 998244353;
const int inf = 2e9 + 5;
const int N = 2e5 + 5;

ll n, m, k, fact[N];

ll modexp(ll x, int n) {
    if (n == 0)
        return 1;
    ll ans = modexp((x * x) % mod, n / 2);
    if (n % 2 != 0)
        return (x * ans) % mod;
    return ans;
}

ll modinv(int x) {
    return modexp(x, mod - 2);
}

ll choose(int i, int j) {
    ll num1 = fact[i];
    ll num2 = (fact[i - j] * fact[j]) % mod;
    num2 = modinv(num2);

    return (num1 * num2) % mod;
}

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

    cin >> n >> m >> k;

    fact[0] = 1;
    for (int i = 1; i <= N - 5; i++)
        fact[i] = (i * fact[i-1]) % mod;

    if (k == 0) {
        cout << (m * modexp(m - 1, n - 1)) % mod;
        return 0;
    }

    ll ans = 0;
    for (int i = 0; i <= k; i++) {
        ans = (ans + (choose(n - 1, i) * ((m * modexp(m - 1, n - 1 - i)) % mod)) % mod) % mod;
    }

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

Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int k,x;
    cin >> k >> x;
    for(int i=(x-k+1);i<=(x+k-1);i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
//  Author: Tanuj Johal
//  It's a show time, Enjoy your everyday.

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ini(a,n)    memset(a,n,sizeof(a))
#define ff          first
#define ss          second
#define inf         1e18
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}
#define run_time cout << "\nTIME = " << clock() - tt << endl; tt = clock();

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;
unordered_map<ll,vi> g;
unordered_map<ll,ll> vis;
ll tt;
const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
const ll N = 1e5+10;
ll dx[4]={-1, +1, 0, 0};
ll dy[4]={0, 0, +1, -1};
bool imp = false;


void solve(){

    ll n;cin>>n;
    ll mp[10001];
    ini(mp,0);
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            for(ll k=1;k<=n;k++){
                ll x = i*i + j*j + k*k + i*j + j*k + k*i;
                if(x > n) break;
                mp[x] += 1;
            }
        }
    }

    for(ll i=1;i<=n;i++){
        cout << mp[i] << endl;
    }

}

int main()
{
 #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
 #endif
    fio
    int t=1;
    if(imp) cin>>t;
    tt = clock();
    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        g.clear();
        vis.clear();
        solve();
        // tc++;
    }
//    run_time;

}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
const int oo = 1e9;
const int LOGN = 18;
const int MAX_VAL = 10000000;
const int MAX_N = 400001;
const int MOD = 998244353;

ll N , A , B , K;

ll res = 0;
ll fact[MAX_N];
ll inv[MAX_N];
ll pw(ll a , ll b){
	if(!b)return 1ll;
	ll res = pw(a,b/2);
	res = (res * res)%MOD;
	if(b&1)
		return (res*a)%MOD;
	return res;
}
ll nck(ll n , ll k){
	return ((fact[n]*inv[k])%MOD*inv[n-k])%MOD;
}
int main() {
	fact[0] = 1;
	inv[0] = pw(fact[0],MOD-2);
	for(int i = 1 ; i < MAX_N;++i){
		fact[i] = (i*fact[i-1])%MOD;
		inv[i] = pw(fact[i],MOD-2);
	}
	cin >> N >>  A >> B >> K;
	ll all = 0;
	for (int b = 0; b <= N; ++b) {
		ll r = (K - b*B)/A;
		if(r*A+b*B == K && r>=0 && r <= N){
			all = (all+nck(N,r)*nck(N,b))%MOD;
		}
	}
	cout << all << endl;
	return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>

int main(void){
  char s[10];
  char w[3][10]={"Sunny","Cloudy","Rainy"};
  scanf("%s",s);
  for(int i=0;i<3;i++){
    if(strcmp(s,w[i])==0){
      printf("%s\n",w[(i+1)%3]);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>

int main(void){
	std::int64_t N;
	std::cin >> N;
	std::int64_t a[N+1];

	for(auto i = decltype(N)(1);i<=N;i++){
		std::cin >> a[i];
	}

	std::size_t counter = 1;
	auto tmp = a[1];
	while(tmp != 2){
		tmp = a[tmp];
		counter++;
		if(counter > N){
			break;
		}
	}
	if(tmp == 2){
		std::cout << counter << std::endl;
		return 0;
	}
	else{
		std::cout << -1 << std::endl;
		return 0;
	}

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll n;
    cin >> n;
    map<ll, ll> sum, dis;
    srepn(i,1,n){
        ll a;
        cin >> a;
        sum[i+a]++;
        dis[i-a]++;
    }
    ll ans = 0;
    for(auto e: dis){
    	ans += e.second * sum[e.first];
    }
    cout << ans << endl;
}

Measured memory_bytes: 37816
#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
#define INF 1000000000000 
#define MOD 1000000007 
#define MAXR 100000 
#define PB push_back 
#define MP make_pair 
#define F first 
#define S second 
#define Umap unordered_map
#define Uset unordered_set


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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    sort(A.begin(), A.end(), std::greater<>());

    ll ans = 0;
    int cnt = 0;
    FOR(i, 1, N) {
        ans += A.at(0 + (i/2));
        cnt++;

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int h,n,a,sum=0;
    cin>>h>>n;
    while(cin>>a)
        sum+=a;
    cout<<(sum>=h?"Yes":"No")<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;

    cin >> s;

    bool flag = false;
    if (s.find("a") != string::npos && s.find("b") != string::npos && s.find("c") != string::npos) {
        flag = true;
    }

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

    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if n >= m:
    print(0)
    exit()
if n == 1:
    print(max(x)-min(x))
    exit()
l = [0 for _ in range(m-1)]
for i in range(m-1):
    l[i] = x[i+1] - x[i]
l.sort(reverse=True)
print(sum(l[n-1:]))

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

const ll p = 998244353LL;
map<vector<int>,ll> M;

int main()
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int n;
	cin>>n;

	string s;
	cin>>s;

	vector<int> V;

	for(int i=0; i<n+n+n; i++)
	{
		if(s[i]=='R') V.push_back(0);
		if(s[i]=='G') V.push_back(1);
		if(s[i]=='B') V.push_back(2);
	}

	ll ans=1;

	for(int i=0; i<n+n+n; i++)
	{
		//cout << ans << endl;

		if(M[{min((V[i]+1)%3,(V[i]+2)%3),max((V[i]+1)%3,(V[i]+2)%3)}])
		{
			ans *= M[{min((V[i]+1)%3,(V[i]+2)%3),max((V[i]+1)%3,(V[i]+2)%3)}];
			ans %= p;

			M[{min((V[i]+1)%3,(V[i]+2)%3),max((V[i]+1)%3,(V[i]+2)%3)}]--;
			continue;
		}

		if(M[{(V[i]+1)%3}])
		{
			ans *= M[{(V[i]+1)%3}];
			ans %= p;

			M[{(V[i]+1)%3}]--;
			M[{min((V[i]+1)%3,V[i]),max((V[i]+1)%3,V[i])}]++;
			continue;
		}

		if(M[{(V[i]+2)%3}])
		{
			ans *= M[{(V[i]+2)%3}];
			ans %= p;

			M[{(V[i]+2)%3}]--;
			M[{min((V[i]+2)%3,V[i]),max((V[i]+2)%3,V[i])}]++;
			continue;
		}

		M[{V[i]}]++;
	}

	for(int i=1; i<=n; i++)
	{
		ans *= ll(i);
		ans %= p;
	}

	cout << ans << endl;
}

Measured memory_bytes: 2812