akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  // 貪欲法
  ll n;cin>>n;
  vector<ll> a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(all(a));
  deque<ll> ans;
  ll head_cnt=1,back_cnt=1;
  ans.pb(a[0]);
  ans.pb(a[n-1]);
  vector<int> temp(4);
  ll ans_num=abs(a[0]-a[n-1]);
  rep(i,n-2){
    temp[0]=abs(a[head_cnt]-ans.front());
    temp[1]=abs(a[n-1-back_cnt]-ans.front());
    temp[2]=abs(a[head_cnt]-ans.back());
    temp[3]=abs(a[n-1-back_cnt]-ans.back());
    auto maxIt = max_element(temp.begin(), temp.end());
    size_t maxIndex = distance(temp.begin(), maxIt);
    if(maxIndex==0){
      ans.push_front(a[head_cnt]);
      head_cnt++;
      ans_num+=temp[maxIndex];
    }else if(maxIndex==1){
      ans.push_front(a[n-1-back_cnt]);
      back_cnt++;
      ans_num+=temp[maxIndex];
    }else if(maxIndex==2){
      ans.pb(a[head_cnt]);
      head_cnt++;
      ans_num+=temp[maxIndex];
    }else{
      ans.pb(a[n-1-back_cnt]);
      back_cnt++;
      ans_num+=temp[maxIndex];
    }
  }
  cout<<ans_num<<endl;
  return 0;
}

Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll a[100100],x[100100];

int main(void){
	int n,i;
	ll s=0,t=0;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
		s += a[i];
		if(i%2){
			continue;
		}
		t += a[i];
	}
	x[0] = t - s/2;
	for(i=1; i<n; ++i){
		x[i] = a[i-1] - x[i-1];
	}
	for(i=0; i<n; ++i){
		x[i] *= 2;
		cout << ((i)?" ":"") << x[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 2816
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
dp=[0]*n
if 1 not in a:
    dp[0]=1
else:
    dp[0]=0
a=set(a)
for i in range(1,n):
    if i+1 in a:
        continue
    if i==1:
        dp[i]=dp[i-1]+1
        continue
    dp[i]=dp[i-1]+dp[i-2]
print(dp[-1]%((10**9)+7))

Measured memory_bytes: 460020
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    var a int
	var sum int
 
	for i := 0; i < 3; i++ {
        a = nextInt()
		if a != 5 && a != 7 {
			fmt.Println("NO")
			os.Exit(0)
		}
		sum += a
	}
	if sum == 17 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}
 
/* templates */
 
func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}
 
func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}
 
func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


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

long long h,w,x,y,X,Y,cnt=0;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string s[100];
bool B[100][100];

int bfs(){
  queue<tuple<int,int,int>> q;
  q.push(tuple<int,int,int>(0,0,0));
  tuple<int,int,int> p;
  int d;
  while(q.size()){
    tie(y,x,d)=q.front();q.pop();
    if(x==w-1&&y==h-1){
      return d;
    }
    for(int i=0;i<4;i++){
      X=x+dx[i];
      Y=y+dy[i];
      if(X>=0&&X<w&&Y>=0&&Y<h&&s[Y][X]!='#'&&B[Y][X]==0){
        q.push(tuple<int,int,int>(Y,X,d+1));
        B[Y][X]=1;
      }
    }
  }
  return 0;
}

int main(){
  cin >> h >> w;  
  for(int i=0;i<h;i++){
    cin >> s[i];
    for(int j=0;j<s[i].size();j++){
      if(s[i][j]=='.'){
        cnt++;
      }
    }
  }  
  long long tmp=bfs();
  if(B[h-1][w-1]){
    cout << cnt-tmp-1 << endl;
  }else{
    cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;

const double PI = acos(-1.0);
string S,T;
vector<vector<int>> alpha(30);
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cin>>S>>T;
    int N = S.size();
    int M = T.size();
    rep(i,N){
        alpha[S[i]-'a'].push_back(i);
    }
    rep(i,N)alpha[S[i]-'a'].push_back(INF);
    ll ans = 0;
    int preidx = -1;
    rep(i,M){
        //auto v = alpha[T[i]-'a'];
        if((int)alpha[T[i]-'a'].size() == 0){
            ans = -1;
            break;
        }
        //cerr<<preidx<<endl;
        //print(v);
        auto x = upper_bound(all(alpha[T[i]-'a']),preidx) - alpha[T[i]-'a'].begin();
        if(alpha[T[i]-'a'][x] == INF){
            ans += N-preidx-1;
            ans += alpha[T[i]-'a'][0] + 1;
            preidx = alpha[T[i]-'a'][0];
            continue;
        }
        ans += alpha[T[i]-'a'][x] - preidx;
        preidx = alpha[T[i]-'a'][x];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int N;
  cin >> N;
  int exp = 1;
  for(int i=2; i<=N; i++){
    for(int j=2; pow(i,j)<=N; j++){
      if(pow(i,j) > exp){
        exp = pow(i,j);
      }
    }
  }
  cout << exp << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int A, B, C, K,i;
	scanf("%d %d %d", &A, &B, &C);
	scanf("%d", &K);

	if (A > B&&A > C)
	{
		for (i = 0; i < K; i++)
		{
			A = A * 2;
		}
	}
	else if (B>A&&B > C)
	{
		for (i = 0; i < K; i++)
		{
			B = B * 2;
		}
	}
	else
	{
		for (i = 0; i < K; i++)
		{
			C = C * 2;
		}
	}

	printf("%d", (A + B + C));

	return 0;
}

Measured memory_bytes: 128
n = gets.to_i

a = 0
w = 0
t = 0
r = 0

texts = []
n.times do |text|
  text = gets.chomp
  case
  when text == "AC"
    a += 1
  when text == "WA"
    w += 1
  when text == "TLE"
    t += 1
  else
    r += 1
  end
end

puts "AC x #{a}"
puts "WA x #{w}"
puts "TLE x #{t}"
puts "RE x #{r}"


Measured memory_bytes: 14392
# ABC 088 C

from collections import deque

def resolve():
    def all_same(a, b, c):
        if a ==b and b ==c:
            return True
        return False

    c = []
    for _ in range(3):
        c.append(list(map(int, input().split())))
    ans = True

    if not all_same(c[0][0]-c[1][0], c[0][1] - c[1][1], c[0][2]-c[1][2]):
        ans = False
    if not all_same(c[0][0]-c[2][0], c[0][1] - c[2][1], c[0][2]-c[2][2]):
        ans = False
    if not all_same(c[0][0] - c[0][1], c[1][0] - c[1][1], c[2][0] - c[2][1]):
        ans = False
    if not all_same(c[0][0] - c[0][2], c[1][0] - c[1][2], c[2][0] - c[2][2]):
        ans = False

    if ans:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    int m = 1e5 + 1;
    vector<bool> is_prime(m, true);
    is_prime[0] = false;
    is_prime[1] = false;
    rep(i, 2, sqrt(m) + 1){
        if (!is_prime[i]) continue;
        for (int j = i * 2; j < m; j+=i) is_prime[j] = false;
    }

    vector<int> s(m, 0);
    rep(i, 1, m){
        s[i] = s[i - 1];
        if (is_prime[i] && is_prime[(i + 1) / 2]) s[i]++;
    }

    int Q;
    cin >> Q;
    int a, b;
    vector<int> ans(Q);
    REP(i, Q){
        cin >> a >> b;
        ans[i] = s[b] - s[a-1];
    }
    REP(i, Q) cout << ans[i] << endl;

    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep (i, n) cin >> a[i];
	sort(a.begin(), a.end());
	vector<bool> check(a[n - 1] + 10);
	vector<int> cnt(a[n - 1] + 10);
	int res = 0;
	rep (i, n) {
	  if (check[a[i]]) continue;
	  cnt[a[i]]++;
	  res++;
	  for (int j = a[i] + a[i]; j <= a[n - 1] + 1; j += a[i]) check[j] = true;
	  
	}
	rep (i, n) {
	  if (cnt[a[i]] != 1) {
		res -= cnt[a[i]];
		cnt[a[i]] = 0;
	  }
	}
	cout << res << endl;
    
    return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()


using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 998244353;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

struct Bitree {
	typedef ll btT;
	vector<btT> bv;
	Bitree() : bv(100) {}
	Bitree(int n) : bv(n + 3) {}
	btT sum(int i) {
		btT res=0; for(i++; i>0; i -= i & -i) res += bv[i]; return res;
	}
	btT sum(int a, int b) {return sum(b) - (a? sum(a-1): 0);}
	void add(int i, btT x){for(i++; i<(int)bv.size(); i += i & -i) (bv[i] += x); }
	void updt(int i, btT x){ add(i, x - sum(i,i));}
};


void ff_bit(int n, const VI& l, const VI& r){
	
	int k = sz(l);
	Bitree bt(n+5); bt.add(1, 1);

	rep2(i, 2, n+1){
		ll cnd = 0;
		rep(j, k){
			int lf = max(0, i - r[j]), rt = max(0, i-l[j]);
			(cnd += bt.sum(lf, rt)) %=MD;
			//dbg(i, j, lf, rt, bt.sum(lf, rt), cnd);
		}
		bt.updt(i, cnd);
	}
	dbg("bit", bt.sum(n,n)%MD);
	//rep(i, n+1) cerr<<bt.sum(i,i)<<" "; dbg("bt");
	
}

void ff_m(int n, const VI& l, const VI& r){
	int k = sz(l);
	VL dp(n+5), sm(n+5);
	dp[1] = sm[1] = 1;
	rep2(i, 2, n+1){
		rep(j, k){
			int lf = max(0, i - r[j]-1), rt = max(0, i-l[j]);
			(dp[i] += sm[rt] - sm[lf] +MD) %=MD;
			if(n<20) dbg(i,j, rt, lf, sm[rt] - sm[lf]);
		}
		sm[i] = (sm[i-1] + dp[i]) %MD;
	}
	
	dbg("ans", dp[n]);
	//for(auto x :dp) cerr<<x<<" "; dbg();
	//for(auto x :sm) cerr<<x<<" "; dbg();

}

void ff_imos(int n, const VI& l, const VI& r){
	int k = sz(l);
	VL dp(n+10);
	dp[1] =1; dp[2] =   -1;
		rep2(i, 0, n+1){
		rep(j, k) {
			if(i+l[j] <=n) (dp[i+l[j]] += dp[i]) %=MD;
			if(i+r[j]+1 <=n) (dp[i+r[j]+1] += MD - dp[i]) %=MD;
			
		}
		(dp[i+1] += dp[i]) %=MD;
	}
	//dbg("ims", dp[n]);
	cout << dp[n] <<"\n";
	//for(auto x :dp) cerr<<x<<" "; dbg("imos");
}
void ff_bul(int n, const VI& l, const VI& r){
	int k = sz(l);
	VL dp(n+5); dp[1] =1;
		rep(i, n+1) rep(j, k) rep2(t, l[j], r[j]+1){
		if(i+t <=n) (dp[i+t] += dp[i]) %=MD;
	}
	dbg("bul", dp[n]);
}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VI l(k), r(k);
	rep(i, k) cin >>l[i] >>r[i];
	
	//ff_m(n, l, r);
	//ff_bul(n, l, r);
	//ff_bit(n, l, r);
	ff_imos(n, l, r);
	return 0;
}

Measured memory_bytes: 4788
#人のコードを参考にしたやつ
suits = ["S","H","C","D"]
check = [[False]*14 for _ in range(4)]

def getTrue(aSuit):
    for s in range(len(suits)):
        if aSuit == suits[s]:
            return s

numOfCards = int(input())
for i in range(numOfCards):
    aCard = input().split()
    check[getTrue(aCard[0])][int(aCard[1])] = True

for row in range(4):
    for col in range(1, 14):
        if check[row][col] == False:
            print("%s %d"%(suits[row],col))



Measured memory_bytes: 5608
program making_palindrome
  implicit none
  integer(8), parameter :: inf = 1e18
  integer :: n, i, l
  character(20) :: s(50, 0:1) = ''
  integer(8) :: c(50) = 0, m(50, 21, 0:1) = 0, x = inf
  logical :: u(50, 21, 0:1) = .false.
  read(*,*) n
  do i = 1, n
    read(*,*) s(i, 0), c(i)
    l = len_trim(s(i, 0))
    s(i, 1)(1:l) = reverse(s(i, 0)(1:l))
  end do
  do i = 1, n
    x = min(x, solve(i, 1, 0) + c(i))
  end do
  write(*,'(i0)') merge(x, -1_8, x < inf)
contains
  function reverse(s) result(res)
    character(*), intent(in) :: s
    character(len_trim(s)) :: res
    integer :: n, i
    n = len_trim(s)
    do i = 1, n
      res(i:i) = s(n - i + 1:n - i + 1)
    end do
  end
  recursive integer(8) function solve(i, j, k) result(res)
    integer, intent(in) :: i, j, k
    integer :: l, r, t, l1, l2
    logical :: f
    res = m(i, j, k)
    if (u(i, j, k)) return
    u(i, j, k) = .true.
    m(i, j, k) = inf
    l = j
    r = len_trim(s(i, k))
    f = .true.
    do while (l < r)
      if (s(i, k)(l:l) /= s(i, k)(r:r)) then
        f = .false.
        exit
      end if
      l = l + 1
      r = r - 1
    end do
    if (f) then
      m(i, j, k) = 0
      res = 0
      return
    end if
    l1 = len_trim(s(i, k))
    do t = 1, n
      l = j
      r = 1
      l2 = len_trim(s(t, 1 - k))
      do while (l <= l1 .and. r <= l2)
        if (s(i, k)(l:l) /= s(t, 1 - k)(r:r)) exit
        l = l + 1
        r = r + 1
      end do
      if (l == l1 + 1) then
        m(i, j, k) = min(m(i, j, k), solve(t, r, 1 - k) + c(t))
      end if
      if (r == l2 + 1) then
        m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))
      end if
    end do
    res = m(i, j, k)
  end
end program making_palindrome

Measured memory_bytes: 2944
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

const int P = 1000 * 1000 * 1000 + 7;
const int MAXN = 500;

int sum (int x, int y) {
	return (x + y) % P;
}

int mult (int x, int y) {
	return (x * (long long) y) % P;
}

int myPow (int x, int k) {
	if (k == 0) {
		return 1;
	}
	
	int res = myPow(x, k / 2);
	res = mult(res, res);
	if (k % 2 == 1) {
		res = mult(res, x);
	}

	return res;
}

int a[MAXN], b[MAXN];
int pows[MAXN][MAXN];
int sumDeg[MAXN][MAXN];
int d[MAXN][MAXN];

int main () {
    ios_base::sync_with_stdio(0);
	//freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);

	for (int i = 0; i < MAXN; ++i) {
		for (int j = 0; j < MAXN; ++j) {
			pows[i][j] = myPow(i, j);
		}
	}

	int n, c;
	cin >> n >> c;
	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; ++i) {
		for (int ci = 0; ci <= c; ++ci) {
			sumDeg[i][ci] = 0;
			for (int j = a[i]; j <= b[i]; ++j) {
				sumDeg[i][ci] = sum(sumDeg[i][ci], pows[j][ci]);
			}
		}
    }

    d[0][0] = 1;
    for (int ci = 1; ci <= c; ++ci) {
    	d[0][ci] = 0;
    }

    for (int i = 0; i < n; ++i) {
    	for (int ci = 0; ci <= c; ++ci) {
    		d[i + 1][ci] = 0;
    		for (int cj = 0; cj <= ci; ++cj) {
    			d[i + 1][ci] = sum(d[i + 1][ci], mult(d[i][cj], sumDeg[i][ci - cj])); 
    		}
     	}
    }

    cout << d[n][c] << endl;

	return 0;
}


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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define MOD (long)(1e9 + 7)

long long modPow(int x, int n){
  if(n == 0) return 1;
  if(n % 2 == 0) {
    long long sqrtX = modPow(x,n/2);
    return sqrtX * sqrtX % MOD ;
  }else{
    return x * modPow(x,n-1) % MOD;
  }
}

long long kaizyou(long long x){
  long long res = 1;
  for(int i = 1; i <= x; i++){
    res = (res * i) % MOD;
  }
  return res;
}

long long modCombi(long long a, long long b){
  if(b > a/2) return modCombi(a,a-b);
  return ((kaizyou(a) * modPow(kaizyou(b),MOD - 2)) % MOD)* modPow(kaizyou(a-b),MOD - 2) % MOD;
}

ll calc(ll n, ll m){
  ll res = 0;
  rep(i,n){
    res += i * (n-i) * m * m;
    res %= MOD;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m,k;
  cin >> n >> m >> k;
  ll com = modCombi(n*m-2, k-2);
  ll ans = com * calc(n,m);
  ans %= MOD;
  ans += calc(m,n) * com ;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> vec (N);
	for(int i = 0;i < N;i++){
		cin >> vec.at(i);
	}
	long long unsigned mini = 9999999999;
	for(int i = -100;i < 101;i++){
		long long unsigned thistime = 0;
		for(int j = 0;j < N;j++){
			thistime += (vec.at(j)-i)*(vec.at(j)-i);
		}
		mini = min(mini,thistime);
	}
	cout << mini << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <iomanip>
#include <limits>
using namespace std;

int main()
{
    double r;
    double a ,b;
    cin >> r;
    a = r * r * M_PI;
    b = 2 * r * M_PI;
    cout << fixed << setprecision(6) << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 3228
#include<stdio.h>
#include<stdlib.h>

int n,h,w;
char map[101][101];
int cost[100][100];

int main(void){
	int i,j,tmp_m,tmp1,tmp2;
	scanf("%d %d%*c",&h,&w);
	for(i=0;i<h;i++){
		scanf("%s%*c",map[i]);
		for(j=0;j<w;j++) cost[i][j]=999;
	}
	//for(i=0;i<h;i++) puts(map[i]);
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			tmp1=tmp2=999;
			if(i==0 && j==0){
				cost[i][j]=(map[i][j]=='.')?0:1;
			}else{
				if(i>0){
					tmp1=cost[i-1][j];
					if(map[i-1][j]!=map[i][j] && map[i-1][j]=='.') tmp1++;
				}
				if(j>0){
					tmp2=cost[i][j-1];
					if(map[i][j-1]!=map[i][j] && map[i][j-1]=='.') tmp2++;
				}
				tmp_m=(tmp1<tmp2)?tmp1:tmp2;
				if(cost[i][j]>tmp_m) cost[i][j]=tmp_m;
			}
		}
	}
	printf("%d\n",cost[h-1][w-1]);
	return 0;
}


Measured memory_bytes: 256
/**********************************************
 *Author*        :coderdz
 *Created Time*  : 2020/3/19 10:46:46
 *Ended  Time*  : 2020/3/19 12:14:38
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
#define IO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define rep(i,n) for(int i=1;i<=n;i++)
#define m(a,b) memset(a,b,sizeof(a))
typedef pair<int, int> PII;
typedef long long LL;
const int MAXN=1e5+10;

char Left[3][7], Right[3][7];//天平左右两边硬币
char result[3][7];

/*
1
ABCD EFGH even
ABCI EFJK up
ABIJ EFGH even
K is the counterfeit coin and it is light.
*/

//称硬币
bool IsFake(char c, bool flag){
	//flag为true时表示轻,false表示为重
	for(int i = 0; i < 3; i++){
		char *pLeft, *pRight;//指向天平两边的字符串
		if (flag){
			pLeft = Left[i];
			pRight = Right[i];
		}
		else{
			pLeft = Right[i];
			pRight = Left[i];
		}
		switch(result[i][0]){
			case 'u'://右边轻
				if (strchr(pRight, c) == NULL) return false;
				break;
			case 'e'://两边一样重(此次称量无假币)
				if (strchr(pLeft, c) || strchr(pRight, c)) return false;
				break;
			case 'd'://左边轻
				if (strchr(pLeft, c) == NULL) return false;
				break;
		}
	}
	return true;
}

int main(){
	//IO;
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int gcd(int a, int b) {
  if (a > b) {
	  return gcd(b, a);
	}
  if (a == 0) {
	  return b;
	}
  return gcd(b % a, a);
}

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
	  int A;
	  cin >> A;
	  ans = gcd(ans, A);
	}
  cout << ans << endl;
  return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

map<string,lli> cnt;

void func(long long N, std::vector<std::string> S){

    REP(i,0,N){
        cnt[S[i]]++;
    }

    cout<<"AC x "<<cnt["AC"]<<endl;
    cout<<"WA x "<<cnt["WA"]<<endl;
    cout<<"TLE x "<<cnt["TLE"]<<endl;
    cout<<"RE x "<<cnt["RE"]<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    func(N, std::move(S));
    return 0;
}


Measured memory_bytes: 6452
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string n;
  cin>>n;
  int l=n.size();
  int m=0;
  
  for(int i=0; i<l; i++){
     if(n.at(i)=='o'){
       m++;}}
  
  if(15-n.size()>=8-m){
    cout<<"YES"<<endl;}
  else{cout<<"NO"<<endl;}
  
}

Measured memory_bytes: 256
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
const int maxn=35;
int main()
{
    long long n,m;
    cin>>n>>m;
    if(2*n>m)
    {
        cout<<max(m/4,m/2)<<endl;
    }
    else
    {
        long long ans=m-2*n ;
        cout<<max(n+ans/4,m/4)<<endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n;
    cin >> n;
    vector<pair<ll, int>> a(n);
    for (int i=0; i<n; ++i) {
        cin >> a.at(i).first;
        a.at(i).second = i;
    }

    sort(a.begin(), a.end(), greater<pair<ll, int>>());
    vector<vector<ll>> dp(n+1, vector<ll>(n+1, -1));
    dp.at(0).at(0) = 0;
    ll res = 0;
    for (int i=1; i<n+1; ++i) {
        for (int j=0; j<i+1; ++j) {
            if (j > 0) chmax(dp.at(j).at(i-j), dp.at(j-1).at(i-j) + a.at(i-1).first * abs(a.at(i-1).second - j + 1));
            if (i - j > 0) chmax(dp.at(j).at(i-j), dp.at(j).at(i-j-1) + a.at(i-1).first * abs(n - (i - j) - a.at(i-1).second));
            chmax(res, dp.at(j).at(i-j));
        }
    }

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 34616
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var a = ReadLine().Split().Select(int.Parse).ToArray();
        WriteLine(a[0]<=a[2]&&a[2]<=a[0]+a[1]?"YES":"NO");
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;


int main() {
    ios_base::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    ll mod = 1e9 + 7;
    ll flim = max(n, m);
    vector<ll> fact(flim + 1);
    fact[0] = 1;
    ll i = 0;
    for(i = 1; i <= flim; i++) {
        fact[i] = (i * fact[i - 1]) % mod;
    }
    if(abs(n - m) <= 1) {
        ans = (fact[n] * fact[m]) % mod;
        if(n == m) {
            ans *= 2;
            ans %= mod;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 1024
n = int(input())
s = [input() for _ in range(n)]
d = {}
for w in s:
    if w not in d:
        d[w] = 0
    d[w] += 1
d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxcnts = [w[0] for w in d2 if w[1] == d2[0][1]]
maxcnts.sort()
for ans in maxcnts:
    print(ans)

Measured memory_bytes: 50048
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

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

  cout << n*n-a << endl;

  return 0;
}


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

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long> vll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
typedef map<int, int> mi;
typedef map<long long, long long> mll;
typedef map<string, int> msi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define B begin()
#define E end()
// for (auto it = .B; it < .E; it++) {

int main() {
    string a;
    cin >> a;
    if (a == "ABC") {
        cout << "ARC\n";
    } else {
        cout << "ABC\n";
    }

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cout << ceil((double)(n - 1) / (k - 1)) << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int A, B;
        public long MOD = 1000000007;

        public void Run()
        {

            {
                var line = Input.ReadIntArray();
                A = line[0];
                B = line[1];
            }

            if (B % A == 0)
            {
                Console.WriteLine(A + B);
            }
            else
            {
                Console.WriteLine(B - A);
            }

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
from collections import deque
def main():
	N,M,*AB=map(int,open(0).read().split())
	to=[[] for _ in range(N)]
	for a,b in zip(*[iter(AB)]*2):
		to[a-1].append(b-1)
		to[b-1].append(a-1)
	q=deque([0])
	r=[None]*N
	while q:
		x=q.popleft()
		for i in to[x]:
			if not r[i]:
				q.append(i)
				r[i]=x+1
	print("Yes",*r[1:],sep="\n")
if __name__=='__main__':
	main()

Measured memory_bytes: 56580
#include <stdio.h>

#define N 100000

int A[N],q;

int Partition(int ,int);
void Print(int n);

main(){
  
  int i,n=0,p=0,r=0;
 
  scanf("%d",&n);
  
  if(N < n || n < 0) return 0;
  
  r = n-1;
  
  for(i=0;i < n;i++){
    scanf("%d",&A[i]);
  }
  
  q = Partition(p,r);
  
  Print(n);
  
  return 0;
}

Partition(int p,int r){
  int x=0,j;
  x = A[r];
  int i = p-1;
  int tmp=0;
  
  for(j=p;j <= r-1;j++){
    if(A[j] <= x){
      i=i+1;
      tmp = A[j];
      A[j] = A[i];
      A[i] = tmp;
    }
  }
  tmp =0;
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  
  return i+1;
}

void Print(int n){
  int i;
  
  for(i=0;i < n;i++){
    if(i == q) printf("[%d] ",A[i]);
    if(i == n-1) printf("%d",A[i]);
    else if(i != q) printf("%d ",A[i]);
  }
  printf("\n");
}

Measured memory_bytes: 992
N, K = map(int, input().split())
MOD=10**9+7

def cmb(n, r):
    if n < r: return 0 #date added
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

for i in range(1,K+1):
    ans=cmb(N-K+1, i)%MOD*cmb(K-1, i-1)%MOD
    # cmb(N-K+i, i) -> cmb(N-K+1, i)
    #if N==K and 1 < i: ans=0
    print(int(ans%MOD))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
const long long INF = MOD*MOD;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k,ans;
string s;

int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
  if(a < c) cout << "1\n";
  else cout << "0\n";
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;
ll dp;

int main(){
   ll n,m,h[101010];
   bool f[101010]={};
   cin>>n>>m;
   rep(i,n)cin>>h[i];
   rep(i,m){
      ll a,b;
      cin>>a>>b;
      if(h[a-1]==h[b-1])f[a]=f[b]=1;
      else if(h[a-1]<h[b-1])f[a]=1;
      else f[b]=1;
      //f[min(h[a-1],h[b-1])]=1;
   }
   ll ans=0;
   rep(i,n){
      if(f[i+1]==0)ans++;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 4460
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	for (int a, b, c; cin >> a >> b >> c;) {
		set<int> set;
		set.insert(a);
		set.insert(b);
		set.insert(c);
		cout << set.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
taro = 0
hanako = 0
for i in range(N):
    a,b = input().split()
    if a < b:
        hanako += 3
    elif a == b:
        taro += 1
        hanako += 1
    else:
        taro += 3

print(taro,hanako)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// mp::cpp_int
// mp::cpp_dec_float_100



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  string s;
  ll n;
  cin >> s;
  
  //vector<ll> a(n);  rep(i, 0, n) cin >> a[i];
  
  cout << (s[1]=='R' ?"ABC" :"ARC") << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";

}

Measured memory_bytes: 3612
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    int D;
    string Xmas="Christmas";
    cin >> D;
    
    for(int i=0; i<25-D;i++){
        Xmas+=" Eve";
    }
    cout << Xmas <<endl;
    return 0;
}



Measured memory_bytes: 256
N = input()
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print('pon')
else:
    print('bon')


Measured memory_bytes: 61856
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
mt19937 rng(high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rngll(high_resolution_clock::now().time_since_epoch().count());
template<typename T> T ctmax(T &x, const T &y){ return x = max(x, y); }
template<typename T> T ctmin(T &x, const T &y){ return x = min(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> cnt(n);
	for(auto &x: a){
		cin >> x, -- x;
		++ cnt[x];
	}
	long long sum = 0;
	for(auto x: cnt){
		sum += 1LL * x * (x - 1) / 2;
	}
	for(int i = 0; i < n; ++ i){
		int x = a[i];
		cout << sum - 1LL * cnt[x] * (cnt[x] - 1) / 2 + 1LL * (cnt[x] - 1) * (cnt[x] - 2) / 2 << "\n";
	}
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char s[125252][25];
const char t[] = "MARCH";

int cnt[26];
int c2[5];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%s",s[i]);
  REP(i,n){
    cnt[s[i][0]-'A']++;
  }
  REP(i,5)c2[i] = cnt[t[i]-'A'];
  ll ans = 0;
  REP(i,32)if(__builtin_popcount(i)==3){
    ll add = 1;
    REP(j,5)if((i>>j)&1)add *= c2[j];
    ans += add;
  }
  cout<<ans<<endl;
  return 0;
}


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


#define ll long long
#define MOD 1000000007
#define PI 3.1415


int main(){
    int n,m;
    cin>>n>>m;
    int sum=0;

    int a;
    for(int i=0;i<m;i++){
        cin>>a;sum+=a;
    }

    if(sum<=n)cout<<n-sum<<endl;
    else cout<<-1<<endl;




}



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

#define pb push_back

using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;


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

    int n;
    cin >> n;
    vi xs(n);
    int f1 = -1;
    int f2 = -1;
    bool possible = true;
    for (int i=0; i<n; ++i) {
        cin >> xs[i];
        if (xs[i] != i+1) {
            if (f1 == -1)
                f1 = i;
            else if (f2 == -1)
                f2 = i;
            else
                possible = false;
        }
    }
    if (!possible)
        cout << "NO\n";
    else
        cout << "YES\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

int x,s,t;

int main(){
	for(int i=0;i<2;i++){
		for(int j=0;j<4;j++){
			cin>>x;
			if(i==0){s+=x;}
			else{t+=x;}
		}
	}
	cout<<max(s,t)<<endl;
	return 0;
}

Measured memory_bytes: 1164
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
check=[1 for i in range(m)]
ans=n

for i in range(m):
  count=[0]*m
  for j in range(n):
    for k in range(m):
      if check[l[j][k]-1]==1:
        count[l[j][k]-1]+=1
        break
  if max(count)<ans:
    ans=max(count)
  check[count.index(max(count))]=0
print(ans)

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

using namespace std;

int main()
{
  int N, M;
  int p[101];
  memset(p, -1, sizeof(p));

  cin >> N >> M;
  while(M--) {
    int a, b;
    cin >> a >> b;
    --a;
    p[a] = max(p[a], b);
  }
  int ret = 0, last = 0, maximum = -1;
  for(int i = 0; i < N; i++) {
    maximum = max(maximum, p[i]);
    if(last == i) {
      if(maximum <= i) {
        cout << "Impossible" << endl;
        exit(0);
      } else {
        last = maximum;
        maximum = -1;
        ++ret;
      }
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;


string S;
ll dp[100001][13];
ll keta[100001];

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

	keta[0] = 1;
	FOR(i, 1, 100001) {
		keta[i] = (keta[i - 1] * 10) % 13;
	}

	cin >> S;
	ll N = S.length();
	if (S[N - 1] == '?') {
		FOR(i, 0, 10)dp[0][i] = 1;
	}
	else {
		dp[0][ll(S[N - 1] - '0')] = 1;
	}

	FOR(i, 1, N) {
		ll cur = N - 1-i;
		if (S[cur] == '?') {
			FOR(j, 0, 13) {
				FOR(k, 0, 10) {
					dp[i][(j + k*keta[i])%13] += dp[i - 1][j];
					dp[i][(j + k * keta[i]) % 13] %= mod;
				}
			}
		}
		else {
			ll num = ll(S[cur] - '0');
			FOR(j, 0, 13) {
				dp[i][(j + keta[i] * num) % 13] += dp[i - 1][j];
				dp[i][(j + keta[i] * num) % 13] %= mod;
			}
		}

	}

	cout << dp[N - 1][5] << endl;

}


Measured memory_bytes: 14604
#include<stdio.h>
int main()
{
    int a,i,x,m,n;
    m=0,n=0;
    scanf("%d",&a);
    for(i=1;i<=a;i++)
    {
        scanf("%d",&x);
        if(x%2==0)
        {
            m++;
            if(x%3==0 || x%5==0)
            {
                n++;
            }
        }
    }
    if(m==n)
    {
        printf("APPROVED\n");
    }
    else
    {
        printf("DENIED\n");
    }
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;

public class Program
{
    static void Main()
    {   
        int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int a = input[0];
        int b = input[1];
        int c = input[2];
        int k = input[3];
        long ans = 0;
        if(k - a > 0)
        {
            ans += a;
            k -= a;
        }
        else
        {
            ans += k;
            Console.WriteLine(ans);
            return;
        }

        if(k - b > 0)
        {
            k -= b;
        }
        else
        {
            Console.WriteLine(ans);
            return;
        }


        if(k - c > 0)
        {
            ans -= c;
        }
        else
        {
            ans -= k;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27544
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    string s; cin >> s;
    stack<char> st;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') st.push('0');
        if (s[i] == '1') st.push('1');
        if (s[i] == 'B' && !st.empty()) st.pop(); 
    }

    string ans;
    while (!st.empty()) {
        ans += st.top();
        st.pop();
    }
    reverse(ans.begin(), ans.end());

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

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

    solve();

    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string.h>

int a, b, c, N, parts[3][1123], r[1123];
int ans[312];

int main(void) {
	while (true) {
		scanf("%d%d%d", &a, &b, &c);
		if (a == 0 && b == 0 && c == 0) { break; }
		scanf("%d", &N);
		for (int i = 0; i < N; ++i) { scanf("%d%d%d%d", &parts[0][i], &parts[1][i], &parts[2][i], &r[i]); }

		memset(ans, -1, sizeof(ans));
		for (int i = 0; i < N; ++i) {
			if (r[i] == 1) {
				ans[parts[0][i] - 1] = 1;
				ans[parts[1][i] - 1] = 1;
				ans[parts[2][i] - 1] = 1;
			}
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (ans[parts[j][i] - 1] == -1) {
					if (ans[parts[(j + 1) % 3][i] - 1] == 1 && ans[parts[(j + 2) % 3][i] - 1] == 1) { ans[parts[j][i] - 1] = 0; }
				}
			}
		}

		for (int i = 0; i < a + b + c; ++i) {
			if (ans[i] == -1) { printf("2\n"); }
			else { printf("%d\n", ans[i]); }
		}
	}
	return 0;
}

Measured memory_bytes: 2724