akhauriyash/Code-Regression huggingface dataset:
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        final MyScanner sc = new MyScanner();
        final double n = sc.nextDouble();
        final double k = sc.nextDouble();
        
        double answer = 0;
        for (int i = 1; i <= n; i++) {
            double temp = 1.0 / n;
            int now = i;
            while (now < k) {
                now *= 2;
                temp /= 2;
            }
            answer += temp;
        }
        
        System.out.println(answer);
    }
}

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int pointer = 0;
    private int bufLength = 0;

    private boolean hasNextByte() {
        if (pointer < bufLength) {
            return true;
        } else {
            pointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (bufLength <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[pointer++];
        } else {
            return -1;
        }
    }

    private static boolean isNumberChar(int c) {
        return '0' <= c && c <= '9';
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[pointer])) {
            pointer++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long num = 0;
        boolean isNegative = false;
        int b = readByte();
        if (b == '-') {
            isNegative = true;
            b = readByte();
        }
        if (!isNumberChar(b)) {
            throw new NumberFormatException();
        }
        while (true) {
            if (isNumberChar(b)) {
                num *= 10;
                num += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return isNegative ? -num : num;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long temp = nextLong();
        if (temp < Integer.MIN_VALUE || Integer.MAX_VALUE < temp) {
            throw new NumberFormatException();
        }
        return (int) temp;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 33136
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int N,n;
	int a[10000];
	cin>>N;
	for(int i=0;i<N;i++) cin>>a[i];
	cin>>N;
	while(N--){
		int sign,b,e;
		cin>>sign>>b>>e;
		int Max=*max_element(a+b,a+e);
		int Min=*min_element(a+b,a+e);
		if(sign) cout<<Max<<endl;
		else cout<<Min<<endl;
		
	}
	return 0;
}


Measured memory_bytes: 3140
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int X = int.Parse(Console.ReadLine());
		int K = 0;
		int a = 0;
		while(true){
			a += X;
			K++;
			if(a%360==0){
				break;
			}
		}
		Console.WriteLine(K);
	}
}

Measured memory_bytes: 17632
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define CMAX(m, x)  m = max(m,x);
#define CMIN(m, x)  m = min(m,x);
#define itn int
typedef long long lint;
const int INF = 1e9;
const lint LINF = 1e18;
int main(){
    int n,k;
    cin >> n >> k;
    lint len = LINF;
    vector<lint> height(n);
    vector<int> digit(n,0);
    vector<int> val(n,1);
    REP(i,n)
        cin >> height[i];
    
    int cnt = 0;
    lint sum = 0;
    while(1){
        if(cnt >= k){
            lint first = 0;
            REP(i,n){
                if(digit[i] == 1){
                    if(first == 0){
                        first = height[i];
                        REP(j,i){
                            CMAX(first,height[j]);
                        }
                        sum += (first - height[i]);
                    }
                    else{
                        if(first >= height[i]){
                            sum += (first - height[i] + 1);
                            first++;
                        }else{
                            first = height[i];
                        }
                    }
                }
                CMAX(first,height[i]);
            }
            CMIN(len,sum);
        }
        sum = 0;
        cnt = 0;

        if(digit == val)
            break;

        digit[0] += 1;
        REP(i,n){
            if(digit[i] == 2){
                digit[i] = 0;
                digit[i + 1] += 1;
            }
            if(digit[i] == 1){
                cnt++;
            }
        }

    }
    cout << len << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<map>
#include<stack>
#include<string>
#include<set>
using namespace std;
const int MAXN = 2e5 + 5;
int main() {
	long long n;
	cin >> n;
	long long last = 0;
	long long  mo = 1000;
	cin >> last;
	for (int i = 2;i <= n;i++) {
		long long a;
		cin >> a;
		if (a > last) {
			long long num = mo / last;
			mo = mo + num * (a - last);
		}
		last = a;
	}
	cout << mo << endl;
}

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

int main() {
  long long int a,b,k;
  cin>>a>>b>>k;
  if(a+b<k) cout<<"0"<<" "<<"0"<<endl;
  else if(a+b>=k&&a>=k) cout<<a-k<<" "<<b<<endl;
  else cout<<"0"<<" "<<b-(k-a)<<endl;
}

Measured memory_bytes: 3636
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
main()
{
	fast();
	int t=1;
//	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int arr[n];
		for(int i=0;i<n;i++)
		cin>>arr[i];
		int x=0;
		for(int i=0;i<n;i++)
		{
			x=x xor arr[i];
		}
		for(int i=0;i<n;i++)
		{
			int a=arr[i] xor x;
			cout<<a<<" ";
		}
	}
	
}




Measured memory_bytes: 5076
package main

import(
    "fmt"
)

func main() {
    var H,W int
    fmt.Scan(&H, &W)
    A := make([]string, H)

    for i:=0; i<H; i++ {
        fmt.Scan(&A[i])
    }

    dx := []int {1, 0, -1, 0, 1, -1, -1, 1}
    dy := []int {0, 1, 0, -1, 1, 1, -1, -1}

    for y:=0; y<H; y++ {
        for x:=0; x<W; x++ {
            if A[y][x:x+1] == "#" {
                fmt.Print("#")
                continue
            }
            n := 0
            for d:=0; d<8; d++ {
                nx := x + dx[d]
                ny := y + dy[d]
                if nx < 0 || ny < 0{
                    continue
                }
                if nx >= W || ny >= H {
                    continue
                }
                if A[ny][nx:nx+1] == "#" {
                    n++
                }
            }
            fmt.Print(n)
        }
        fmt.Println()
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

ll n;

signed main() {

    cin >> n;
    if(n&1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    n/=2;
    while(n >= 5) {
        ans += n/5;
        n/=5;
    }

    cout << ans << endl;
  
    return 0;
}



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


void insertion_sort(int A[], int N) {
    for (int i=1; i<N; ++i) {
        int v = A[i];
        int j = i - 1;
        while (j>=0 && A[j]>v) {
            A[j+1] = A[j];
            --j;
        }
        A[j+1] = v;

        for(int i=0; i<N; ++i) {
            if(i==0) cout << A[i];
            else cout << " " << A[i];
        }
        cout << endl;
    }
}


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

    for(int i=0; i<N; ++i) {
        if(i==0) cout << A[i];
        else cout << " " << A[i];
    }
    cout << endl;

    insertion_sort(A, N);
}


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

int main() {
    int A, B; cin >> A >> B;
    string s; cin >> s;
    for (int i = 0; i < A; i++) {
        if (!isdigit(s[i])) {
            cout << "No" << endl;
            return 0;
        }
    }
    if (s[A] != '-') {
        cout << "No" << endl;
        return 0;
    }
    for (int i = A + 1; i <= A + B; i++) {
        if (!isdigit(s[i])) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3596
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
C = (10**5+1)*[0]
T = sum(A)

for a in A:
  C[a]+=1

for q in range(Q):
  b,c = map(int,input().split())
  T+=C[b]*(c-b)
  C[c]+=C[b]
  C[b]=0
  print(T)

Measured memory_bytes: 21044
#include <stdio.h> 
int main() 
{
	int ansA, ansB;
	scanf("%d %d", &ansA, &ansB);
	(ansA != 1 && ansB != 1) ? printf("%d", 1) : 0;
	(ansA != 2 && ansB != 2) ? printf("%d", 2) : 0;
	(ansA != 3 && ansB != 3) ? printf("%d", 3) : 0;
	return 0;
}

Measured memory_bytes: 1684
package main

import (
	"fmt"
)

func main() {
	var s int
	fmt.Scan(&s)
	
	a := make(map[int]bool)
	a[s] = true
	
	for i := 2; ; i++ {
		if s % 2 == 0 {
			s = s / 2
		} else {
			s = 3 * s + 1
		}
		
		if a[s] {
			fmt.Println(i)
			return
		}
		a[s] = true
	}
}

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

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

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

    ll ans = INT64_MAX;
    for (int bit = (1 << (k - 1)) - 1; bit < (1 << n); ++bit)
    {
        if (!(bit & 1))
            continue;
        int count = 0;
        rep(i, n) if (bit & (1 << i)) count++;
        if (count < k)
            continue;

        ll min_height = a[0];
        ll sum = 0;
        for (int i = 1; i < n; ++i)
        {
            if (bit & (1 << i))
            {
                if (a[i] <= min_height)
                    min_height += 1;
                else
                    min_height = a[i];
                sum += min_height - a[i];
            }
            else if (a[i] >= min_height)
            {
                sum = INT64_MAX;
                break;
            }
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from collections import Counter
import numpy as np

read = sys.stdin.read
readline = sys.stdin.readline

N, *A = map(int, read().split())
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in a.values())
val = np.array([a[i] for i in A], np.int64)
answer = s - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2
print('\n'.join(map(str, answer.tolist())))


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

int main() {
    int N = 0, K = 0;
    cin >> N >> K;
    int point = 0;
    int sum = 0;

    for(int i = 0; i < N; i++) {
        cin >> point;
        if(point < K - point) {
            sum += 2 * point;
        } else {
            sum += 2 * (K - point);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#define rep(i,n) for(int i=0;i<n;++i)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
int main() {
	int n;	cin >> n;
	vector<string> S(n);
	vector<int> Spos(n);
	string ans;
	int shortest = mod;
	rep(i, n) {
		cin >> S[i];
		if (shortest > S[i].size())shortest = S[i].size();
		sort(S[i].begin(), S[i].end());
	}
	bool loop = true;
	while(loop) {
		char c = S[0][Spos[0]];
		char bigC = c;
		bool ok = true;
		rep(j, n) {
			if (c != S[j][Spos[j]]) ok = false;
			if (bigC < S[j][Spos[j]]) bigC = S[j][Spos[j]];
		}

		if (ok) {
			ans += c;
			rep(j, n) {
				Spos[j] += 1;
				if (Spos[j] >= S[j].size()) loop = false;
			}
		}
		else {
			rep(j, n) {
				if (bigC > S[j][Spos[j]]) Spos[j] += 1;
				if (Spos[j] >= S[j].size()) loop = false;
			}
		}
	}
	if (ans.size() > 0) {
		cout << ans << endl;
	}
	else {
		cout << endl;
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <iostream> 
using namespace std;
 
pair<int, int> P[200005];
 
int p, r, t;
 
int ned[305][305];
int num[305];
 
int grid[305][305];
int used[305];
int bo[305];
 
int check(int t) {
    memset(used, 0, sizeof(used));
    memset(grid, 0, sizeof(grid));
    memset(bo, 0, sizeof(bo));
    for (int i = 1; i <= t; ++i) {
        ++used[P[i].second];
        ++grid[P[i].first][P[i].second];
    }
    int tot = 0;
    while (1) {
        int flag = 0;
        for (int i = 1; i <= p; ++i)
            if (!bo[i]) {
                int mark = 0;
                for (int j = 1; j <= r; ++j)
                    if (grid[i][j] + max(num[j] - used[j], 0) < ned[i][j])
                        mark = 1;
                if (mark == 0) {
                    flag = i;
                    break;
                }
            }
        if (flag == 0) break;
        bo[flag] = 1;
        ++tot;
        for (int j = 1; j <= r; ++j)
            used[j] -= grid[flag][j];
    }
    return tot == p;
}
 
int main() {
    scanf("%d%d%d", &p, &r, &t);
    for (int i = 1; i <= r; ++i) {
        scanf("%d", &num[i]);
    }
    for (int i = 1; i <= p; ++i)
        for (int j = 1; j <= r; ++j)
            scanf("%d", &ned[i][j]);
    for (int i = 1; i <= t; ++i) {
        scanf("%d%d", &P[i].first, &P[i].second);
    }
    // cout << check(0) << endl;
    if (check(t)) {
        puts("-1");
    }
    else {
        int head = 0, tail = t;
        while (head < tail - 1) {
            int mid = (head + tail) >> 1;
            if (check(mid)) head = mid;
            else tail = mid;
        }
        cout << tail << endl;
    }
    return 0;
}

Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

int main() {
  vector<vector<char>> v(3, vector<char>(3));
  for (auto &e : v)
    for (auto &ee : e) cin >> ee;

  for (int i = 0; i < sz(v); ++i) cout << v.at(i).at(i);
  puts("");

  return 0;
}

Measured memory_bytes: 256
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

int32_t main()
{
   // shuru_krte_hai_bina_kisi_bakchodi_ke();
    int n;
    cin >> n;
    int a[n + 1];
    int k;
    cin>>k;
    int dp[n + 1] = {0};
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        dp[i] = INT_MAX;
    }
    
    dp[1] = 0;
    for(int i=2;i<=n;i++){
        for(int j=i-1;j>=max(i-k,1ll);j--){
            dp[i] = min(dp[j]+abs(a[i]-a[j]),dp[i]);
        }
    }
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 5188
N = int(input())
P = "".join(list(input().split()))
Q = "".join(list(input().split()))

Z = [(0,"",[0]*N)]
A = []
while Z:
    z = Z.pop(0)
    if z[0]==N:
        A.append(z[1])
        continue
    for i in range(N):
        if z[2][i]==0:
            zz = z[2][::]
            zz[i]=1
            Z.append((z[0]+1,z[1]+str(i+1),zz))
A.sort()
a,b = 0,0
for i in range(len(A)):
    if A[i]==P:
        a = i
    if A[i]==Q:
        b = i
print(abs(a-b))

Measured memory_bytes: 14452
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int n, m, k;

int main()
{
	cin >> n >> m >> k;
	int ope = 0;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (i*m + j*n - 2*i*j == k)ope++;
		}
	}
	if (ope != 0)cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
 
int main(){
	long long N,D;
  	std::cin >> N >> D;
  	D = D*D;
  	int count = 0;
  	long long X,Y;
  	while (std::cin >> X >> Y){
      	if (X*X + Y*Y <= D) count++;
    }
  	std::cout << count << std::endl;
  
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N,M;
    cin>>N>>M;
    VEC(ll,X,M);
    REP(i,M){
        cin>>X[i];
    }
    sort(ALL(X));
    if(N>M){
        cout<<0;return 0;
    }
    ll a=X[0],m=X[M-1]-a;
    X[0]=0;
    VECi(ll,d,M,0);
    REP1(i,M-1){
        X[i]-=a;
        d[i]=X[i]-X[i-1];
    }
    sort(ALL(d),greater<ll>());
    REP(i,N-1){
        m-=d[i];
    }
    cout<<m;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1792
s = input()
if s[0]==s[1]:	print(1, 2); exit()
for i in range(2,len(s)):
	if s[i-1]==s[i]:	print(i, i+1); exit()
	if s[i-2]==s[i]:	print(i-1, i+1); exit()
print(-1, -1)

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

int abs(int a)
{
    if(a<0) return -a;
    else return a;
}
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d) cout<<"Yes";
    else
    {
        if(abs(a-b)<=d&&abs(b-c)<=d) cout<<"Yes";
        else cout<<"No";
    }
}


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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  int D;
  cin >> D;

  if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  } else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
  } else {
    cout << "Christmas" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def a(n):
  return 2**(n+2)-3
def b(n):
  return 2**(n+1)-1
N,X= [int(s) for s in input().split()]
count=0
while X>0:
  if X==a(N):
    count+=b(N)
    X-=a(N)
  elif X<a(N):
    X-=1
    N-=1
  else:
    X-=a(N)+1
    count+=b(N)+1
print(count)

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

#define ASORT(arr, n)          sort(arr,arr+n)
#define SORT(v)             sort(v.begin(), v.end())
#define REV(v)              reverse(v.begin(), v.end())
#define FOR(i, n)           for (int i=0; i<n; i++)
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI                  acos(-1.0)

using namespace std;

typedef long long              ll;
typedef unsigned long long     ull;
typedef vector<int>            vi;

const double eps = 1e-9;


int main()
{
  fastIO();
  
  ll a;
  cin>>a;
  cout<<a + (a*a) + (a*a*a) << '\n';
  
  
 return 0;
  }


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MOD = 1e9 + 7 ;
const ll dx[4] = { -1,1,0,0 };
const ll dy[4] = { 0,0,-1,1 };
const ll MAX =  1e5 + 10 ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
long long gcd(long long  a, long long  b) { return (b == 0 ? a : gcd(b, a % b)); }
ll n , m , x , k , Q , ans ; string s,t;
double dp[3000][3000];
int want = 0;
double p[3000];
double solve(int i , int have){

    if(have == want)
        return 1.0;

    if(i == n)
        return 0.0;

    double & ret = dp[have][i];

    if(ret != -1)
        return ret;

    ret = (1.0 - p[i])*solve(i + 1,have) + p[i]*solve(i + 1,have + 1);

    return ret  ;

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);
//    freopen("test.in","r",stdin);

    cout<<setprecision(10)<<fixed;
    cin>>n;
    want = (n + 1)/2;

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

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


    cout<<solve(0,0)<<'\n';


    return 0;
}


Measured memory_bytes: 37248
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long N;
vector<long long>a;
int main(){
	cin >> N;
	for(int i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		a.push_back(tmp);
	}

	long long ret = INT_MAX;

	for(int i = -100; i <= 100; i++){
		long long tmp = 0;
		for(int j = 0; j < a.size(); j++){
			tmp+=(i-a[j])*(i-a[j]);
		}
		ret = min(ret, tmp);
	}
	cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>tmp;
    a.push_back(tmp);
  }

  b.assign(a.begin(),a.end());

  for(i=0;i<n-1;i++)
  {
   for(int j=n-2;j!=i-1;j--) 
   {
    if(a[j][1]>a[j+1][1])
    {
     swap(a[j],a[j+1]);
    }
   }
  }
  for(i=0;i<n-1;i++) cout<<a[i]<<" ";
  cout<<a[n-1]<<endl<<"Stable"<<endl;
 
  for(i=0;i<n-1;i++){
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  swap(b[i],b[now]);
  }
 
  for(i=0;i<n-1;i++) cout<<b[i]<<" ";
  cout<<b[n-1]<<endl;
  if(a==b) cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;
 
  return 0;
 
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
using pii = pair <int, int>;
#define int ll
#define INF 0x7f7f7f7f7f7f7f7f
const bool debug = false;

int h, w;
int32_t main()
{
    cin >> h >> w;
    if (w == 1 || h == 1)
        cout << "1\n";
    else
        cout << (h*w/2)+(h*w%2);
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
counter = 0

for i in range(N):
	if A[i] >= B[i]:
		counter += B[i]
		A[i] -= B[i]
	else:
		counter += A[i]
		B[i] -= A[i]
		A[i] = 0
		
		if B[i] > A[i + 1]:
			counter += A[i + 1]
			B[i] -= A[i + 1]
			A[i + 1] = 0
		else:
			counter += B[i]
			A[i + 1] -= B[i]
			
print(counter)
		

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

int main() {
    int x;
    int y;
    int escape;
    for(int i = 1 ; i <= 3000 ; i ++){
        cin >> x >> y;
        if(x == 0 && y == 0){
            break;
        }

        if(x > y){
            escape = x;
            x = y;
            y = escape;
        }

        cout << x << " "<< y << endl;
    }
}


Measured memory_bytes: 3076
import sys
input = sys.stdin.buffer.readline

n = int(input())

x = []
y = []
for i in range(n):
    a,b = map(int,input().split())
    x.append(a+b)
    y.append(a-b)

x.sort()
y.sort()

res = max(x[-1]-x[0],y[-1]-y[0])

print(res)

Measured memory_bytes: 88300
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x3fffffffffffffffll;

/*
11111
= 99999 / 9
= (10 ^ 6 - 1) / 9

(10 ^ n - 1) / 9

*/

ll n;

inline ll get_phi(ll x)
{
    ll res=x;
    for(int i=2;i<=x/i;i++)
        if(x%i==0)
        {
            res-=res/i;
            while(x%i==0)x/=i;
        }
    if(x>1)res-=res/x;
    return res;
}

ll qmi(ll k,ll mod)
{
    ll res=1,a=10;
    while(k)
    {
        if(k&1)res=res*a%mod;
        a=a*a%mod;
        k>>=1;
    }
    return res%mod;
}

int main()
{
    scanf("%lld",&n);
    if(n&1)
    {
        if(n%7==0)n/=7;
        n*=9;
        ll phi=get_phi(n),res=INF;
        for(ll i=1;i<=phi/i;i++)
            if(phi%i==0)
            {
                if(qmi(i,n)==1)res=min(res,i);
                else if(qmi(phi/i,n)==1)res=min(res,phi/i);
            }
        printf("%lld\n",res==INF?-1:res);
    }
    else puts("-1");
    return 0;
}

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

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 110;

int n, cnt[N];
int Mx;

void fail(){
	puts("Impossible");
	exit(0);
}

int main(){
	scanf("%d", &n);
	For(i, 1, n){
		int x;
		scanf("%d", &x);
		cnt[x]++;
		Mx = max(Mx, x);
	}

	if(Mx & 1){
		int mid = Mx / 2 + 1;
		For(i, 0, mid - 1) if(cnt[i]) fail();
		if(cnt[mid] != 2) fail();
		For(i, mid + 1, Mx) if(cnt[i] < 2) fail();
	}
	else{
		int mid = Mx / 2;
		For(i, 0, mid - 1) if(cnt[i]) fail();
		if(cnt[mid] != 1) fail();
		For(i, mid + 1, Mx) if(cnt[i] < 2) fail();
	}

	puts("Possible");
	return 0;
}

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


void solve(int N, int Q, std::string S, std::vector<int> l, std::vector<int> r){
  vector<int> t(N+1); // 1文字目からi文字目までで、ACであるAの数。
  t[0] = 0;
  for (int i=0;i<N+1;i++) {
    if (S[i] == 'A' && S[i+1] == 'C') {
      t[i+1] = t[i] + 1;
    } else {
      t[i+1] = t[i];
    }
  }

  for (int i=0;i<Q;i++) {
    cout << t[r[i]-1] - t[l[i]-1] << endl;
  }
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N;
    scanf("%d",&N);
    int Q;
    scanf("%d",&Q);
    std::string S;
    std::cin >> S;
    std::vector<int> l(Q);
    std::vector<int> r(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%d",&l[i]);
        scanf("%d",&r[i]);
    }
    solve(N, Q, S, std::move(l), std::move(r));
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
using namespace std;
#include<cmath>
#include<math.h>

int main() {
        double a, b, angle, rad, h, area, c, pi;
        cin >> a >> b >> angle;
        rad = angle * (M_PI / 180);
        h = b*sin(rad);
        c = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(rad));
        area = ((a * b) / 2) * sin(rad);
        cout << fixed;
        cout << area << endl;
        cout << a + b + c << endl;
        cout << h << endl;
}

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

int main()
{
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> s( H );
	for( int i = 0; i < H; i++ ) {
		cin >> s[i];
	}

	vector<int> cnt( H );
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			if( s[i][j] == '#' ) cnt[i]++;
		}
	}
	vector<int> v;
	v.push_back( 0 );
	for( int i = 0; i < H; i++ ) {
		if( cnt[i] ) v.push_back( i + 1 );
	}
	v.pop_back();
	v.push_back( H );
	typedef tuple<int, int, int, int> T;
	vector<T> rect;
	for( int i = 0; i < v.size() - 1; i++ ) {
		int sy = v[i];
		int ey = v[i + 1];
		vector<int> h;
		h.push_back( 0 );
		for( int y = sy; y < ey; y++ ) {
			for( int x = 0; x < W; x++ ) {
				if( s[y][x] == '#' ) h.push_back( x + 1 );
			}
		}
		sort( h.begin(), h.end() );
		h.pop_back();
		h.push_back( W );
		for( int j = 0; j < h.size() - 1; j++ ) {
			int sx = h[j];
			int ex = h[j + 1];
			rect.push_back( T( sx, sy, ex, ey ) );
		}
	}
	vector<vector<int>> a( H, vector<int>( W ) );
	for( int i = 0; i < rect.size(); i++) {
		int sx, sy, ex, ey;
		tie( sx, sy, ex, ey ) = rect[i];
		for( int y = sy; y < ey; y++ ) {
			for( int x = sx; x < ex; x++ ) {
				a[y][x] = i + 1;
			}
		}
	}

	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			if( j ) cout << " ";
			cout << a[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 5396
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    cin >> n>>k;
    int arr[n];
    for(int i = 0;i<n;i++)
    {
        cin >> arr[i];
    }
    sort(arr,arr+n);
    
    int ans = 0;
    for(int i = 0;i< k;i++)
    {
        ans+=arr[i];
    }
    cout<< ans << endl;
}


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

#define int long long int

const int mod = 998244353;

#undef int
int main()
{
#define int long long int
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin>>n;
	vector<int> v(n);
	for(int i = 0;i<n;i++)
		cin>>v[i];
	int ans = 0;
	while(1)
	{
		bool done = true;
		for(int i = 0;i<n;i++)
		{
			if(v[i] >= n)
			{
				int inc = v[i]/n;
				v[i]%=n;
				ans += inc;
				for(int j = 0;j<n;j++)
					if(i!=j)
						v[j]+=inc;
				if(inc)
					done = false;
			}
		}
		if(done)
			break;
	}
	cout<<ans<<endl;

	return 0;
}

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

constexpr long long int M = 1000000007;

template<int N>
struct Fact{
  long long int val[N];
  long long int v2[N];
  constexpr Fact() : val(), v2() {
    val[0] = 1;
    for(int i = 1; i < N; ++i)val[i] = val[i - 1] * i % M;
    for(int i = 1; i < N; ++i)v2[i] = val[i - 1] * val[i] % M;
  }
};

template<int N, long long F>
struct IFact{
  long long int val[N];
  constexpr IFact() : val() {
    val[N - 1] = F;
    for(int i = N - 1; i > 0; --i)val[i - 1] = val[i] * i % M;
  }
};

long long int N, ans;
constexpr auto fact = Fact<1000001>();
constexpr auto ifact = IFact<1000001, 397802501>();

int main(){
    scanf("%lld", &N);
    for(int i = N / 2; i < N - 1; ++i){
        ans += fact.v2[i] * ifact.val[i * 2 - N] % M;
    }
    ans = fact.val[N] - fact.val[N - 1] - ans;
    ans %= M;
    cout << (ans > 0 ? ans : M + ans) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 101


int main(){

  int n;
  scanf("%d%*c", &n);

  int a[MAX], b[MAX];
  int i,j,k;
  for(i = 0; i < n; i++){
    scanf("%d%*c", &a[i]);
  }

  int count = 0;

  int tmp;
  for(i = 0; i < n-1; i++){
    for(j = n-1; j >= 1; j--){
      if(a[j-1] > a[j]){
	tmp = a[j-1];
	a[j-1] = a[j];
	a[j] = tmp;
	count++;
      }
    }
  }

  for(i = 0; i < n-1; i++){
    printf("%d ", a[i]);
  }
  printf("%d\n%d\n", a[n-1], count);
  
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int n,m,i,a,c;
int main() {
  scanf("%d%d",&m,&n);
  for (i=0; i<n; i++) {
    scanf("%d",&a);
    c=max(a,c);
  }
  c-=m-c+1;
  printf("%d\n",max(0,c));
  return 0;
}


Measured memory_bytes: 384
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, x = map(int, input().split())
    l = tuple(map(int, input().split()))

    d = 0
    for i in range(1, n+1):
        d += l[i-1]
        if d > x:
            print(i)
            quit()
    else:
        print(n+1)

if __name__ == '__main__':
    main()


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

using namespace std;

void fast()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
}
const int mxA = 1e7;
int freq [mxA+1] ;
int pref [mxA+1];

int main()
{
    fast();
    int n ;
    cin >> n ;
    string arr[n];
    for (int i = 0 ; i< n; i++)
    {
        cin  >> arr[i];
    }
    int y = 0 ;
    for (int i = 1 ; i< n; i++)
    {
        string temp = arr[i];
        string tempe = arr[i-1];
        if(temp[0]!=tempe[tempe.length()-1]) return cout << "No" ,0;
        for (int j = 0 ; j< i ;j++)
        {
            if (arr[i] == arr[j])
            {
                return cout << "No" ,0;
            }
        }


    }
    cout << "Yes";



}



Measured memory_bytes: 256
import sys
import os

def file_input():
    f = open('ABC168/input.txt', 'r')
    sys.stdin = f

def main():
    if os.getenv("ENV")=='LOCAL':
        file_input()

    K=int(input())
    S=input()

    if len(S)<=K:
        print(S)
    else:
        print(str(S[:K])+"...")

if __name__ == '__main__':
    main()


Measured memory_bytes: 9132
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    ll x, y;
    cin >> x >> y;
    vector<int> a = {1, 1, -1, -1};
    vector<int> b = {1, -1, 1, -1};

    ll minv = LINF;
    rep(i, 4) {
        ll cnt = 0;
        ll c = x, d = y;
        if(a[i] == -1) {
            cnt++;
            c *= -1;
        }
        if(b[i] == -1) {
            cnt++;
            d *= -1;
        }
        if(d >= c) cnt += d - c;
        else continue;
        
        minv = min(minv, cnt);
    }
    cout << minv << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] num = new int[200000];
    for (int i = 0; i < N; i++) {
      int tmp = sc.nextInt();
      num[tmp]++;
      num[tmp + 1]++;
      num[tmp + 2]++;
    }
    Arrays.sort(num);
    System.out.println(num[num.length - 1]);
  }
}

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

using namespace std;

int k,f[100005],d[200005],e[100005],l,r;

int main()
{
	scanf("%d",&k);
	for (int i=0;i<k;++i) f[i]=50;
	for (int i=9;i;--i) f[i%k]=i,e[i%k]=1;
	l=r=1;
	for (int i=1;i<=9;++i) if (f[i]) d[r++]=i;
	while (l!=r)
	{
		for (int i=0,j;i<=9;++i)
		if (f[j=(d[l]*10+i)%k]>f[d[l]]+i)
		{
			f[j]=f[d[l]]+i;
			if (!e[j]) e[j]=1,d[r++]=j;
			if (r==200000) r=1;
		}
		e[d[l++]]=0; if (l==200000) l=1;
	}
	printf("%d\n",f[0]);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    a = (a == 1 ? 100 : a);
    b = (b == 1 ? 100 : b);

    cout << (a > b ? "Alice" : (a < b ? "Bob" : "Draw"));
    
    return 0;
}


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

int main() {
  int s; cin >> s;
  int judge = 0;

  int a = s/100;
  int b = s%100;

  if(1 <= a && a <= 12) {
    if(1 <= b && b <= 12) cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  } else {
    if(1 <= b && b <= 12) cout << "YYMM" << endl;
    else cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
import re
import collections

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

c = collections.Counter(b)

c = sorted(c.items(), key=lambda x: x[1])
ans = 0
for i in range(len(c)-int(a[1])):
    ans += c[i][1]
print(ans)

Measured memory_bytes: 44316
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin>>N;
    int nab=0,xa=0,bx=0,bxa=0;
    int ans = 0;
    bool a=false;
    int ssize;
    rep(i,N){
        S = ' ';
        cin>>S;
        ssize=S.size();
        if(S.at(0) == 'B') bx++;
        if(S.at(ssize-1) == 'A') xa++;
        if(S.at(0) == 'B' && S.at(ssize-1) == 'A') bxa++;
        rep(j,ssize){
            if(S.at(j) == 'A'){
                a = true;
                if(j != ssize-1){
                    continue;
                }
                a = false;
            }
            if(a && S.at(j) == 'B'){
                nab++;
            }
            a = false;
        }
    }
    
    ans = nab + min(xa,bx);
    if(bx == xa && bx == bxa) { 
      if(bx != 0) ans--;
    } 
    cout<<ans<<endl; 
}


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

vector<string> SplitWord(const string str){
  int size=str.length();
  string buf=str;
  for(int i=0;i<size;i++){
    if(buf[i]==','||buf[i]=='.'){
      buf[i]=' ';
    }
  }

  istringstream iss(buf);
  vector<string> wordarray;
  string word;
  while(iss>>word){
    wordarray.push_back(word);
  }
  wordarray.erase(unique(wordarray.begin(),wordarray.end()),wordarray.end());
  wordarray.erase(remove_if(wordarray.begin(),wordarray.end(),[](string word){
        return word.length()<3||6<word.length();}),wordarray.end());
  return wordarray;
}
  
int main(){
  string str;
  getline(cin,str);
  vector<string> wordarray=SplitWord(str);
  cout<<wordarray[0];
  for(int i=1;i<wordarray.size();i++){
    cout<<" ";
    cout<<wordarray[i];
  }
  cout<<endl;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define maxn 105

using namespace std;

int n;
int x, y;
int a[maxn];
long long f[maxn];

int main(){
	scanf("%d", &n);
	f[0] = 1000;
	for(int i = 1;i <= n;i++){
		scanf("%d", &a[i]);
		f[i] = f[i - 1];
		for(int j = 1;j < i;j++){
			f[i] = max(f[i], f[j - 1] / a[j] * a[i] + f[j - 1] % a[j]);
		}
	}
	printf("%lld", f[n]);
}

Measured memory_bytes: 3808
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


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

int main(){
    int n;
    cin >> n;
    vector<int> x(n+1),y(n+1);
    for (int i = 0;i < 2;i++){
        for (int j = 0;j < n;j++){
            int a;
            cin >> a;
            if (i == 0){
                x[j+1] = x[j] + a;
            }
            else{
                y[j+1] = y[j] + a;
            }
        }
    }

    int sum = 0;
    for (int i = 1;i <= n;i++){
        sum = max(sum,x[i] + y[n] - y[i-1]);
    }

    cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
/*    #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll a,b;
  cin>>a>>b;
  cout << a*b - (a+b-1)<<endl;

  
  

}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 2e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

ll dp[MAXM][MAXM];

int main()
{
    int n,m,k,a,b,x,y;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n>>k;

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

    for(int i=1;i<=n;i++)
        for(int j=1;j<=k;j++)
            dp[i][j] = (dp[i-1][j]+dp[i-1][j-1])%MOD;
    ll res;
    for(int i=1;i<=k;i++){
        if(n-k<i-1)cout<<"0\n";
        else {
            cur = (n-k)-(i-1);
            //cout<<dp[cur+i][i]<<" "<<dp[k-1][i-1]<<"\n";
            res = dp[cur+i][i]*dp[k-1][i-1];
            res %= MOD;
            cout<<res<<"\n";
        }
    }

    return 0;
}


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


map <vector <int>, int> mp;


int f(vector <vector <int> > v) {
	int res = 1;
	for(auto &z: v) {
		vector <int> x = z, y = z; int cnt = 0;
		for(int j = 0; j < 4; j++) {
			rotate(x.begin(), x.begin() + 1, x.end());
			cnt += x == z;
			y = min(x, y);
		}
		res *= cnt * mp[y];
		mp[y]--;
		z = y;
	}
	for(auto z: v) {
		mp[z]++;
	}

	return res;
}

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n; vector <vector <int> > a(n, vector <int> (4));
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 4; j++) {
			cin >> a[i][j];
		}
		vector <int> b = a[i];
		for(int j = 0; j < 4; j++) {
			rotate(b.begin(), b.begin() + 1, b.end());
			a[i] = min(a[i], b);
		}
	}

	
	int ans = 0;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < i; j++) {
			mp[a[j]]--;
			for(int k = 0; k < 4; k++) {
				rotate(a[j].begin(), a[j].begin() + 1, a[j].end());
				vector <int> x = a[i], y = a[j]; 
				y = {y[1], y[0], y[3], y[2]};
				vector <vector <int> > v = {
					{x[0], y[0], y[1], x[1]},
					{x[1], y[1], y[2], x[2]},
					{x[2], y[2], y[3], x[3]},
					{x[3], y[3], y[0], x[0]}
					
				};
				ans += f(v);
			}
			mp[a[j]]++;
		}
		mp[a[i]]++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 163212
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli a,b,c;
    cin>>a>>b>>c;
    if((a==b && (c!=a || c!=b))||(b==c && (a!=c || a!=b))||(a==c && (b!=a || b!=c)))
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";
}
    
    
    

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
//------------------------------------------------------------
		int h = sc.nextInt();
		int n = sc.nextInt();
		int maxAttack=0;
		for (int i=0;i<n;i++){
			maxAttack += sc.nextInt();
		}
		sc.close();
		if (maxAttack>=h) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		//------------------------------------------------------------
	}
}


Measured memory_bytes: 47740
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pii acos(-1)
#define fo(i0n) for(i=0;i<n;i++)
#define fo(i1n) for(i=1;i<=n;i++)
#define fo(j0n) for(j=0;j<n;j++)
#define fo(j1n) for(j=1;j<=n;j++)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define pu push
#define bg begin
#define en end
using namespace std;

int main()
{
    fast();
    ll i,j,k,c,d,a,b,e,f,p,q,n,t,m,r,u,g,x,y,l;
    ld bb,cc,aa;
    string st,et,ft;
    priority_queue<ll,vector<ll>,greater<ll> > pq,aq,dq;
    map<ll,ll> ma,ta;
    map<ll,ll,greater<ll> >sa;
    set<ll> se,pe,me;
    vector<ll > vv,v,s,ss;


    cin>>a>>b;
    c = 0;
    d = 0;
    f = 0;
    for(i=0;i<=a;i++){
        c = i;
        d = a-i;
        c = c*2;
         d= d*4;
         if(c+d==b){f=1;break;}
    }
    if(f==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3648