akhauriyash/Code-Regression huggingface dataset:
// In The Name Of God
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()

const int maxn = 2e5;
int x[maxn];
int v[maxn];
int dp[maxn];

int32_t main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,C;cin >> n >> C;
    int ans = 0;
    for2(i,0,n) cin >> x[i] >> v[i];
    for2(c,0,2){
        multiset<int> st;
        int sum = 0;
        st.insert(0);
        for2(i,0,n){
            sum += v[i];
            st.insert(sum-2*x[i]);
            dp[i] = sum-2*x[i];
        }
        int cur = 0;
        ans = max(ans,*st.rbegin());

        for(int i = n-1; i >= 0;i--){
            st.erase(st.find(dp[i]));
            cur += v[i];
            ans = max(ans,*st.rbegin() + cur - (C-x[i]));
        }
        for2(i,0,n) x[i] = C-x[i];
        reverse(x,x+n);
        reverse(v,v+n);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin>>a>>b>>c;
  if(b+c<a){
    cout <<0<<endl;
  }
  else{
    d=b+c-a;
    cout <<d<<endl;
  }
}

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

using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
int main() {
const ll INF = 100100100100100100;
string S;
cin >> S;
if(S=="ABC"){
  cout<<"ARC"<<endl;
}
else{
  cout<<"ABC"<<endl;
}
return 0;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder(sc.next());
		int n = sc.nextInt();
		for (int i=0; i<n; i++) {
			String order = sc.next();
			if (order.equals("replace")) {
				int a = sc.nextInt();
				int b = sc.nextInt() + 1;
				String rep = sc.next();
				sb.replace(a,b,rep);
			}
			else if (order.equals("reverse")) {
				int a = sc.nextInt();
				int b = sc.nextInt() + 1;
				String rev = sb.substring(a,b);
				StringBuilder sb2 = new StringBuilder(rev);
				sb2.reverse();
				sb.replace(a,b,sb2.toString());
			}
			else if (order.equals("print")) {
				int a = sc.nextInt();
				int b = sc.nextInt() + 1;
				String print = sb.toString().substring(a,b);
				System.out.println(print);
			}
		}
	}
}


Measured memory_bytes: 29424
#include<bits/stdc++.h>
#include<vector>
#include<deque>
#include<list>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll gcd(ll a2,ll b2){
	ll t;
	while(b2!=0){
		t=a2%b2;
		a2=b2;
		b2=t;
	}
	return a2;
}
ll lcm(ll a1,ll b1){
	if(a1*b1==0){return 0;}
	return (a1*b1/gcd(a1,b1));
}

int main() {

	int n;
	ll h,b[100001];
	ll ma=0;
	cin>>n>>h;
	rep(i,n){
		ll a;
		cin>>a>>b[i];
		ma=max(ma,a);
	}
	sort(b,b+n,greater<ll>());
	ll ans=0;
	rep(i,n){
		if(b[i]>ma){
			h-=b[i];
			ans++;
		}
		if(h<=0||b[i]<=ma)break;
	}
	if(h<=0)cout<<ans<<endl;
	else{
		if(h%ma>0)ans++;
		cout<<ans+h/ma<<endl;
	}

	return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > adj(n + 1);
  vector<pair<int, int> > E;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    E.emplace_back(u, v);
    adj[u].push_back(v);
  }
  vector<int> ans;
  for (auto e: E) {
    vector<int> parent(n + 1), dist(n + 1, n + 1);
    queue<int> q;
    q.emplace(e.second);
    dist[e.second] = 0;
    parent[e.second] = -1;
    while (!q.empty()) {
      int u = q.front(); q.pop();
      for (auto v: adj[u]) {
        if (dist[u] + 1 < dist[v]) {
          dist[v] = dist[u] + 1;
          q.emplace(v);
          parent[v] = u;
        }
      }
    }
    if (dist[e.first] != n + 1) {
      if (ans.empty() || dist[e.first] + 1 < ans.size()) {
        ans.clear();
        int cur = e.first;
        while (cur != -1) {
          ans.push_back(cur);
          cur = parent[cur];
        }
      }
    }
  }
  if (ans.empty()) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans.size() << endl;
  for (auto u: ans) cout << u << endl;
  return 0;
}


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

using namespace std;

int INF = 1000001;

int main() {
    vector<int> dp1(INF, INF);
    vector<int> dp2(INF, INF);

    dp1.at(0) = 0;
    dp2.at(0) = 0;

    for (int i = 0; i < INF; i++) {
        for (int j = 1; j < 201; j++) {
            int k = j*(j+1)*(j+2)/6;
            if (i - k < 0 || INF <= i - k) {
                continue;
            }
            dp1.at(i) = min(dp1.at(i), dp1.at(i-k) + 1);
            if (k % 2 == 1) {
                dp2.at(i) = min(dp2.at(i), dp2.at(i-k) + 1);
            }
        }
    }
    
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        cout << dp1.at(n) << " " << dp2.at(n) << endl;
    }
}


Measured memory_bytes: 10508
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 2e3+ 2, mod = 1e9 + 7;


void solve() {
     int n;
     cin >> n;
     bool ok = false;
     int c = 0;
     for(int i = 0; i < n; i++) {
          int a, b;
          cin >> a >> b;
          if(a == b) {
               c++;
          } else {
               c = 0;
          }
          if(c >= 3) {
               ok = true;
          }
     }
     if(ok) {
          cout << "Yes";
     } else {
          cout << "No";
     }
}    


int main() {
	int tt = 1;
	// cin >> tt;
	for (int tc = 1; tc <= tt; tc++) {
		// cout << "Case #:" << tc << " ";
		solve();
	}
}

Measured memory_bytes: 3588
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    int a=(n-1)/2;
    int b=n-1;
    int found =1;
    for(int i=0;i<a;i++){
        if(s[i]!=s[n-1-i])found=0;
    }
    if(a==2)found=0;
    int l=(a-1)/2;
    for(int i=0;i<l;i++){
        if(s[i]!=s[a-1-i])found=0;
    }
    int m=(a+1+b)/2;
    for(int i=a+1;i<m;i++){
        if(s[i]!=s[n+a-i])found=0;
    }
    if(found)cout<<"Yes";
    else cout<<"No";
    return 0;
}





Measured memory_bytes: 256
d,g = map(int,input().split())
probs = []
for i in range(d):
    p,c = map(int,input().split())
    probs.append([p,c])

probs.reverse()

#compするかどうかは2^10全通りに対して残ったやつからコンプしないように高い順にとってくのが最適
def tobin(x, n):
    return format(x, 'b').zfill(n)

ans = 1e9
for i in range(2**d):
    s = tobin(i,d)
    comp = [c=="1" for c in s]
    tmp = 0
    cos = 0
    for j in range(d):
        if comp[j]:
            tmp += probs[j][0]*(d-j)*100+probs[j][1]
            cos += probs[j][0]

    for j in range(d):
        if comp[j]:
            continue
        else:
            if tmp < g:
                mc = (probs[j][0]-1)*(d-j)*100

                if mc + tmp >= g:
                    rest = g-tmp
                    cos += (g-tmp)//((d-j)*100)
                    if (g-tmp)%((d-j)*100) == 0:
                        break
                    else:
                        cos += 1
                        break
                else:
                    cos += probs[j][0]
                    tmp += mc
            else:
                break
    if ans > cos:
        ans = cos

print(ans)





Measured memory_bytes: 74168
import numpy as np
N = int(input())
A = input().split()
B = [[],[]]
for i in range(N):
  B[0].append(i + 1)
  B[1].append(int(A[i]))

C = np.array(B).T  
C = C.tolist()
D = sorted(C,key=lambda x: x[1])

E = []
for i in range(N):
  E.append(D[i][0])
  print(E[i],end=" ")

Measured memory_bytes: 45760
n,k = map(int, input().split())
a = list(map(int, input().split()))
dic = {}
count = 0
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
v = len(dic.items())
for i in sorted(dic.values()):
    if v <= k:
        break
    v -= 1
    count += i
print(count)

Measured memory_bytes: 32184
package main

import (
	"fmt"
	"os"
)

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	for c:=1; c<=3; c++ {
		tmp := a * b * c
		if tmp % 2 != 0 {
			fmt.Println("Yes")
			os.Exit(0)
		}
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
N = int(input())
X = [[1 if a == "#" else 0 for a in input()] for _ in range(N)]
C = [sum([X[i][j] for i in range(N)]) for j in range(N)]
a = N - max(sum(X[i]) - (0 if C[i] else 1) for i in range(N))
b = N - C.count(N)
print(-1 if sum(C) == 0 else a + b)

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

int main(){
    int n;
    cin >> n;
    int ct = 0, cx = 0, cy = 0;
    for (int i = 0; i < n; i++){
        int t, x, y;
        cin >> t >> x >> y;
        auto d = abs(x - cx) + abs(y - cy);
        auto dt = t - ct;
        if (dt < d or (dt - d) & 1){
            puts("No");
            return 0;
        }
        ct = t, cx = x, cy = y;
    }
    puts("Yes");
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;

const double INF = 1e18;

template <typename T>
struct Edge
{
    int to;
    T cost;
};

template <typename T>
struct WeightedGraph
{
    int n;
    vector<vector<Edge<T>>> g;
    
    WeightedGraph(int n) : n(n){
        g.resize(n);
    }
    
    void init(int n_){
        n = n_;
        g.resize(n_);
    }
    
    void add_edge(int from, int to, T cost){
        g[from].push_back((Edge<T>){to, cost});
    }
};

template <typename T>
vector<T> Dijkstra(WeightedGraph<T> &g, int s){
    int n = g.n;
    vector<T> d(n);
    vector<bool> used(n);
    fill(d.begin(), d.end(), INF);
    fill(used.begin(), used.end(), false);
    d[s] = 0;
    while(true){
        int now = -1;
        for(int i = 0; i < n; i++){
            if(!used[i] && (now == -1 || d[i] < d[now])) now = i;
        }
        if(now == -1) break;
        used[now] = true;
        for(Edge<T> e : g.g[now]) d[e.to] = min(d[e.to], d[now] + e.cost);
    }
    return d;
}

int main()
{
    double x[1005], y[1005], r[1005];
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    r[0] = r[1] = 0;
    int n;
    cin >> n;
    n += 2;
    for(int i = 2; i < n; i++){
        cin >> x[i] >> y[i] >> r[i];
    }
    WeightedGraph<double> g(n);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            g.add_edge(i, j,
                       max(0.0, sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i])) - r[i] - r[j]));
        }
    }
    vector<double> d = Dijkstra(g, 0);
    cout << fixed << setprecision(15) << d[1] << endl;
}


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


using namespace std;
int n;
vector<int> vec;

int meme[100007];

int solve(int index){

    if(index==n-1){
        return 0;
    }
    if(meme[index]!=-1){
        return meme[index];
    }
    
    int ret1 = 100000000;
    int ret2 = 100000000;
    if(index+1<n){
         ret1 = abs (vec[index]- vec[index+1]) + solve(index+1); 
    }
    if(index+2<n){
         ret2 = abs (vec[index]- vec[index+2]) + solve(index+2); 
    }


    return meme[index] = min(ret1,ret2);
}

int main(){
    cin>>n;
    memset(meme,-1,sizeof(meme));
    int num;
    for(int i = 0 ; i<n ; i++){
        cin>>num;
        vec.push_back(num);
    }
    cout<<solve(0)<<endl;
    return 0;
}

Measured memory_bytes: 8840
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

const int INF = 1e9;

int main() {
    int n;
    cin >> n;
    set <int> st;
    st.insert(1);
    for (int i = 1; pow(6, i) <= n; i++) st.insert(pow(6, i));
    for (int i = 1; pow(9, i) <= n; i++) st.insert(pow(9, i));

    vector <int> dp(n + 1, INF);
    dp[0] = 0;
    for (auto & i : st) {
        rep (j, n + 1) {
            if (dp[j] == INF) continue;
            if (j + i > n) continue;
            dp[j + i] = min(dp[j + i], dp[j] + 1);
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#define Lens 200000
#define M 2000000000

using namespace std;
int A[Lens], L[Lens], R[Lens];
int N;


long long merge(int A[], int left, int right)
{
	int mid = (left + right) / 2;
	int n1 = mid - left;
	int n2 = right - mid;
	long long cnt = 0;
	for (int i = 0; i < n1; i++)
	{
		L[i] = A[left + i];
	}
	for (int i = 0; i < n2; i++)
	{
		R[i] = A[mid + i];
	}
	L[n1] = M;
	R[n2] = M;
	int s1 = 0, s2 = 0;
	for (int i = 0; left + i < right; i++)
	{
		if (L[s1] <= R[s2])
		{
			A[left + i] = L[s1++];
		}
		else
		{
			A[left + i] = R[s2++];
			cnt =cnt+ n1 - s1;
		}
	}
	return cnt;
}

long long mergesort(int A[], int left, int right)
{
	long long x1, x2, x3;
	if (right - left > 1)
	{
		int mid = (left + right) / 2;
		x1 = mergesort(A, left, mid);
		x2 = mergesort(A, mid, right);
		x3 = merge(A, left, right);
		return x1 + x2 + x3;
	}
	else	
	return 0;
}
int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	long long m = mergesort(A, 0, N);
	cout << m << endl;

	return 0;
}



Measured memory_bytes: 4632
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test IOS long long t;cin >> t;while(t--)
#define ses   "\n"
#define whp   " "
#define mxi 200003
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)
#define INF 0x3f3f3f3f
#define CLR(a,b) memset(a,b,sizeof(a));
#define PI acos(-1)
#define what_is(x) cout<<x<<ses;
//set <int, greater <int> > ::iterator it;
//vector<pair<int,int> >a;
//memset(arr,0,sizeof(hg));
//priority_queue <int, vector<int>, greater<int> > pq;
///  string single character erase-
///             s.erase(s.begin()+x); where s is st ring name
///               ans x is index;
///    transform(sl.begin(), sl.end(), sl.begin(), ::tolower);
///    transform(su.begin(), su.end(), su.begin(), ::toupper);
typedef long long v99;
typedef unsigned long long ull;
using namespace std;
v99 fx[4]= {1,-1,0,0};
v99 fy[4]= {0,0,1,-1};
v99 ox8[] = {0, 0, 1, 1, 1, -1, -1, -1};
v99 oy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
bool sort2val(const pair<int,int> &a,const pair<int,int> &b)
{
    if(a.second==b.second)return a.first<b.first;
    return a.second<b.second;
}
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
/**
bool prime[1000020];vector<v99>prm;
void SieveOfEratosthenes(v99 n)
{
	memset(prime, true, sizeof(prime));
	for(v99 i=4;i<=n;i+=2)prime[i]=false;
	for (v99 p=3; p*p<=n; p++)
	{
		if (prime[p] == true)
		{
			/// Update all multiples of p
			for (v99 i=p*p; i<=n; i += 2*p)
				prime[i] = false;
		}
	}
	rep1(i,2,n)if(prime[i])prm.push_back(i);

}*/
v99 pw(v99 a, v99 b)
{
	v99 ans = 1;
	for(v99 i = 1; i <= b; ++i)
		ans = (ans * a);
	return ans;
}

template <class T> inline T bigmod(T n,T p,T m)
{
    if(p==0)return 1;
    else if(p%2==0)
    {
        v99 val=bigmod(n,p/2,m);
        return (T)((val*val)%m);
    }
    else return (T)(((v99)n*(v99)bigmod(n,p-1,m))%m);
}


///-------------------------------------------------------------------------------------------------------



int main()
{

    //freopen("data.out","w",stdout);
    //test
    //while(1)
    {
        v99 n,cr_h=0;cin>>n;
        rep1(i,1,n)
        {
            v99 x;cin>>x;
            if(i&1 && x&1)cr_h++;
        }cout<<cr_h<<ses;
    }
    return 0;
}






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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i = (a); i >= (b); i--)
#define FORR(i,a,b) for (int i = (a); i > (b); i--)
typedef unsigned long long ull;
typedef long long ll;

int n,m;
vector<int> G[105];
bool vis[105];

int dfs(int v){
	bool allVisited=true;

	FOR(i,0,n){
		if(!vis[i])
			allVisited=false;
	}
	if(allVisited)
		return 1;
	int res=0;

	for(auto i: G[v]){
		if(vis[i])
			continue;
		if(!vis[i]){
			vis[i]=true;
			res+=dfs(i);
			vis[i]=false;
		}
	}
	return res;
}

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    cin >> n >> m;
    FOR(i,0,m){
    	int a,b;
    	cin >> a >> b;
    	a--;b--;
    	G[a].pb(b);
    	G[b].pb(a);
    }

    memset(vis,false,sizeof(vis));
    vis[0]=true;

    cout << dfs(0) << endl;

    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
h = LIST()
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    a = abs(dp[i-2] + abs(h[i] - h[i-2]))
    b = abs(dp[i-1] + abs(h[i] - h[i-1]))
    dp[i] = min(a, b)
print(dp[-1])




Measured memory_bytes: 16392
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input().split())
print('NYoe s'[a.count(x)==a.count(y)!=0 or b.count(x)==b.count(y)!=0 or c.count(x)==c.count(y)!=0::2])

Measured memory_bytes: 3060
use std::collections::BTreeMap;

const MOD: u64 = 1e9 as u64 + 7;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n = sc.read();
    let mut a = vec![];
    for _ in 0..n {
        let x: usize = sc.read();
        if a.is_empty() || *a.iter().next_back().unwrap() != x {
            a.push(x);
        }
    }

    let n = a.len();
    let mut dp = vec![0; n + 1];
    let mut last = BTreeMap::new();
    dp[0] = 1;
    for (i, a) in a.into_iter().enumerate() {
        dp[i + 1] += dp[i];
        if let Some(&last) = last.get(&a) {
            dp[i + 1] += dp[last];
        }
        last.insert(a, i + 1);
        dp[i + 1] %= MOD;
    }
    println!("{}", dp[n]);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main() {
  int a, b, c;
  cin >> a >> b;
  c = (a * b) % 2;

  if (c == 1) {
    cout << "Odd" << endl;
  }
  else {
      cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long int
#define inf 100000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
using namespace __gnu_pbds;
int main()
{
	IOS
	ll n;
	cin >> n;
	ll i = 1, cnt = 0;
	while (n > 0)
	{
		i *= 26;
		n -= i;
		cnt++;
	}
	n += i - 1;
	vi p(cnt);
	for (int k = 0; k < cnt; k++)
	{
		p[k] = n % 26;
		n /= 26;
	}
	for (int k = 0; k < cnt; k++)
	{
		ll ind = cnt - k - 1;
		char out;
		out = 'a' + p[ind];
		cout << out;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
  int N,K;
  cin>>N>>K;
  string s;
  cin>>s;
  if(s[K-1]=='A'){
    s[K-1]='a';
  }
  else if(s[K-1]=='B'){
    s[K-1]='b';
  }
  else if(s[K-1]=='C'){
    s[K-1]='c';
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//ポイント：配列の通し番号を,入力された好きな食べ物の番号と
//考えることでシンプルになる
int main(){
    int N,M;
    cin>>N>>M;

    //要素数M+1、全ての要素の値0 で初期化
    vector<int> ans(M+1,0);

    for(int i = 0; i < N; i++){
        int K;
        cin >> K;
        for(int j = 0; j < K; j++){
            //なるほど！その行で入力された番号の合計を
            //カウントしてNを超えるかどうかだけをあとで
            //調べればいいのか！
            int a;
            cin >> a;
            
            //ansv
            ans.at(a)++;
        }
    }
    int res = 0;
    //　i = 1; i < M+1かな？ここ注意
    for(int i = 0; i < M+1; i++){
        if(ans.at(i) == N){
            res++;
        }
    }
    cout << res << endl;

}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

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

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

	int y = x - k + 1;
	int z = (k - 1) * 2;

	rep(i, z + 1){
		cout << y + i << " ";
	}


	cout << endl;



    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;

typedef vector<ull> vull;
typedef vector<ll> vll;
typedef vector<ui> vui;
typedef vector<long> vl;
typedef vector<int> vi;

typedef pair<ull, ull> pull;
typedef pair<ll, ll> pll;
typedef pair<ui, ui> pui;
typedef pair<long, long> pl;
typedef pair<int, int> pi;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (a > c) cout << "NO" << endl;
    else       cout << ((a + b >= c) ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

void solve()
{
    int x,y;
    cin>>x>>y;
    if (y-2*x <= 2*x && y%2==0 && y>=2*x) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
}

int main()
{
    fastIO;
    int t=1;
    // cin>>t;
    while (t--) {
        solve();    	
    }
    return 0;
}

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

int main(){
    int N, ans = 0, num = 0, ph = 0;
    cin >> N;
    for (int i = 0; i < N; ++i){
        int h;
        cin >> h;
        if (h <= ph){
            num++;
        }else{
            ans = max(ans, num);
            num = 0;
        }
        ph = h;
    }
    ans = max(ans, num);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
    int n,k,x,y,result=0;
    cin >> n >> k >> x >> y;

    if(k<n){
        result += x*k;
        result += y*(n-k);
        cout << result;
    }else{
        result += x*n;
        cout << result;
    }



}






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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	ll a;
	cin >> a;
	
	string b;
	cin >> b;

	ll hb = 0LL;
	for(auto &elem: b) {
		if(isdigit(elem)){
			hb = 10LL * hb + elem - '0';
		}
	}

	cout << a * hb / 100LL << endl;

	return 0;
}

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

int main()
{
	int n,k,q;
	cin >> n >> k >> q;
	int a[n+1];
	memset(a,0,sizeof(a));
	for(int i = 0;i < q;i++){
		int t;
		scanf("%d",&t);
		a[t]++;
	}
	for(int i = 1;i <= n;i++){
		if(q - a[i] > k - 1)
			printf("No\n");
		else
			printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1024
n = gets.to_i
n.times do
  xa,ya,ra,xb,yb,rb = gets.split.map(&:to_f)
  d = Math.sqrt((xb-xa)**2 + (yb-ya)**2)
  if d+rb<ra
    puts 2
  elsif d+ra<rb
    puts -2
  elsif d<=ra+rb
    puts 1
  elsif
    puts 0
  end
end

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;


int main(){

    string s;
    cin >> s;
    if(s.back() == 's') s += "es";
    else s += "s";
    cout << s << endl;
}

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

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

  int a,b,q; cin >> a >> b >> q;
  vector<int> s(a+2),t(b+2);
  for(int i = 1; i <= a; i++){
    cin >> s[i];
  }
  for(int i = 1; i <= b; i++){
    cin >> t[i];
  }
  s[0] = t[0] = -(1LL << 60);
  s[a+1] = t[b+1] = 1LL << 60;

  vector<int> v;
  for(int i = 0; i < q; i++){
    int x; cin >> x;
    int ans = 1LL << 60;
    auto p = lower_bound(s.begin(),s.end(),x);
    auto l = lower_bound(t.begin(),t.end(),*p);
    ans = min(ans,abs(*p - x) + min(abs(*l - *p),abs(*(l--) - *p)));
    p--;
    l = lower_bound(t.begin(),t.end(),*p);
    ans = min(ans,abs(*p - x) + min(abs(*l - *p),abs(*(l--) - *p)));

    l = lower_bound(t.begin(),t.end(),x);
    p = lower_bound(s.begin(),s.end(),*l);
    ans = min(ans,abs(*l - x) + min(abs(*l - *p),abs(*l - *(p--))));
    l--;
    p = lower_bound(s.begin(),s.end(),*l);
    ans = min(ans,abs(*l - x) + min(abs(*l - *p),abs(*l - *(p--))));
    v.push_back(ans);
  }

  for(int p : v){
    cout << p << endl;
  }

  return 0;
}


Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#define int long long
using namespace std;

signed main() {
	int a, b; cin >> a >> b;
	if (a * 2 > b) {
		cout << b / 2 << endl;
	}
	else {
		int c = a;
		b -= a*2;
		c += b / 4;
		cout << c << endl;
	}
}

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

class Main {

    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        HashMap<String, Integer> HM = new HashMap();
        int N = Input.nextInt();
        for (int I = 0; I < N; I++) {
            int X = Input.nextInt();
            int Y = Input.nextInt();
            for (int J = X; J <= Y; J++) {
                if(!HM.containsKey(J+""))
                HM.put(J+"", 0);
            }
        }
        System.out.println(HM.size());
    }
}


Measured memory_bytes: 53308
#include<stdio.h>

main(){
  int n,a[10],c,d;
  for(n = 0;n<10;n++){
    scanf("%d",&a[n]);
  }
  for(c = 0;c < 3;c++){
    d = 0;
    for(n = 0;n < 10;n++){
      if(a[d] < a[n]){
        d = n;
      }
    }
    printf("%d\n",a[d]);
    a[d] = 0;
  }
  return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std; 
int main(){
  int d;
  cin >> d;
  if(d==25){
    cout << "Christmas";
  }else if(d==24){
    cout << "Christmas"<<" "<< "Eve"; 
  }else if(d==23){
    cout << "Christmas"<<" "<< "Eve"<<" "<< "Eve"; 
  }else if(d==22){
    cout << "Christmas"<<" "<< "Eve"<<" "<< "Eve"<< " "<< "Eve"; 
  }
}

Measured memory_bytes: 256
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

class unionfind():
    def __init__(self, n):
        self.n = n
        # 中身が負の数なら根であり、数字の絶対値はグループ数
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0: return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]
    def union(self, x, y):
        x,y = self.find(x), self.find(y)
        if x == y: return
        if self.parents[x] > self.parents[y]: x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x): return -self.parents[self.find(x)]
    def same(self, x, y): return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self): return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self): return len(self.roots())

a = iinput()
ans = a + a**2 + a**3
print(ans)


Measured memory_bytes: 37760
k = int(input())
que = []
for i in range(1,10):
  que.append(i)
ct = 0
while(len(que) < k):
  ct += 1
  value = que[0]
  que.remove(value)
  for i in [-1,0,1]:
    if 0 <= (value%10) + i and (value%10) + i <= 9:
      tmp = 10*value + (value%10) + i
      que.append(tmp)  
print(que[k-1-ct])

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

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, int> psi;

static const int INF = 1LL << 61;
static const int MOD = 1000000007;
//static const int MAX_N = 100005;

int mem[55][55][50 * 50 + 5], x[55], a, n;

int Dfs(int i, int k, int sum) {
    if (mem[i][k][sum] != -1) return mem[i][k][sum];
    if (i == n) {
        return 0;
    }

    int res = Dfs(i + 1, k, sum) + Dfs(i + 1, k + 1, sum + x[i]);
    if (sum + x[i] == a * (k + 1)) res++;
    return mem[i][k][sum] = res;
}

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

    memset(mem, -1, sizeof(mem));
    cin >> n >> a;
    for (int i = 0; i < n; ++i) cin >> x[i];

    cout << Dfs(0, 0, 0) << endl;
}

Measured memory_bytes: 60028
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
template <typename T>
ll SIZEOF(T a){return (ll)a.size();}
ll xlcm(ll a, ll b){return (a/__gcd(a, b))*b;}

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


const int N = 100005;

void SOLVE(){
    ll n;
    cin >> n;
    vl a, b;
    for(ll i=0; i<n; i++){
        inps(x, y);
        a.pb(x+y);
        b.pb(x-y);
    }
    sort(all(a));
    sort(all(b));
    cout << max(b.back()-b[0], a.back()-a[0]) << endl;
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif

    ll TC = 1;
    // cin >> TC;
    for(ll tc1=1; tc1<=TC; tc1++){
        // cout << "Case #" << tc1 << ": ";
        SOLVE();
    }
    printclock;
}

Measured memory_bytes: 6692
use std::cmp;
use std::io;


fn argmin<T: cmp::Ord>(values: &Vec<T>) -> i32 {
    let min: &T = values.iter().min().unwrap();
    for i in 0..values.len() {
        if values[i] == *min {
            return i as i32;
        }
    }
    panic!("");
}

fn argmax<T: cmp::Ord>(values: &Vec<T>) -> i32 {
    let max: &T = values.iter().max().unwrap();
    for i in 0..values.len() {
        if values[i] == *max {
            return i as i32;
        }
    }
    panic!("");
}

fn read_line() -> String {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line).unwrap();
    return String::from(line.trim());
}

fn positive(values: Vec<i64>) -> () {
    let max = values.iter().max().unwrap();
    let max_index = argmax(&values);
    println!("{}", (values.len() - 1) * 2);
    for i in 0..values.len() {
        if i as i32 != max_index {
            println!("{} {}", max_index + 1, i + 1);
        }
    }
    for i in 0..values.len() - 1 {
        println!("{} {}", i + 1, i + 1 + 1);
    }
}

fn negative(values: Vec<i64>) -> () {
    let min = values.iter().min().unwrap();
    let min_index = argmin(&values);
    println!("{}", (values.len() - 1) * 2);
    for i in 0..values.len() {
        if i as i32 != min_index {
            println!("{} {}", min_index + 1, i + 1);
        }
    }
    for i in (0..values.len() - 1).rev() {
        println!("{} {}", i + 1 + 1, i + 1);
    }
}

fn main() {
    let n = read_line().parse::<i64>().unwrap();
    let values: Vec<i64> = read_line().split_whitespace().map(|v| v.parse::<i64>().unwrap()).collect();
    let min = values.iter().cloned().min().unwrap();
    let max = values.iter().cloned().max().unwrap();
    if 0 < min {
        positive(values);
    } else if max < 0 {
        negative(values);
    } else if -min < max {
        positive(values);
    } else {
        negative(values);
    }
}

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

using namespace std;

int main()
{
    int H,W;
    int dh[4] = {1,0,-1,0};
    int dw[4] = {0,1,0,-1};
    cin >> H >> W;
    vector<vector<char>>c(H,vector<char>(W,' '));
    vector<vector<int>>dist(H,vector<int>(W,-1));
    queue<pair<int,int>>que;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            cin >> c[i][j];
            if(c[i][j] == '#') dist[i][j] = 0,que.push(pair(i,j));
        }
    }
    int ans = 0;
    while(!que.empty())
    {
        pair<int,int>p = que.front();
        que.pop();
        for(int i = 0; i < 4; i++)
        {
            pair<int,int> np = pair(p.first + dh[i], p.second + dw[i]);
            if((np.first < 0)||(np.first >= H)||(np.second < 0)||(np.second >= W)) continue;
            if(dist[np.first][np.second] != -1) continue;
            dist[np.first][np.second] = dist[p.first][p.second] + 1;
            ans = max(ans,dist[np.first][np.second]);
            que.push(np);
        }
    }
    cout << ans << endl;
}

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b && a > c)  cout << "A";
    if(b > a && b > c)  cout << "B";
    if(c > a && c > b)  cout << "C";
    cout << endl;
    return 0;
}


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

int main(int argc, char const *argv[])
{
  char a, b;
  cin >> a >> b;
  if(a == 'H')
    cout << b << flush;
  else if(b == 'H')
    cout << 'D' << flush;
  else
    cout << 'H' << flush;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
vector<pair<int,int> > pairs;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=n-1;i>=2;i--){
		if(a[i]<0) break;
		pairs.push_back(make_pair(a[1],a[i]));
		a[1]-=a[i];
	}
	for(int i=2;i<=n-1;i++){
		if(a[i]>=0) break;
		pairs.push_back(make_pair(a[n],a[i]));
		a[n]-=a[i];
	}
	int ans=a[n]-a[1];
	pairs.push_back(make_pair(a[n],a[1]));
	cout<<ans<<endl;
	for(int i=0;i<pairs.size();i++){
		cout<<pairs[i].first<<" "<<pairs[i].second<<endl;
	}
}

Measured memory_bytes: 3188
num_of_animals, num_of_foot = map(int, input().split())

for i in range(num_of_animals + 1):
    # 鶴の数を0からインクリメント
    if 2 * i + 4 * (num_of_animals - i) == num_of_foot:
        print('Yes')
        exit()

print('No')

Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    string s[100002];
    for(int i = 0; i < n; i++){
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s, s + n);
    ll count = 1;
    ll ans = 0;
    for(int i = 1; i < n; i++){
        if(s[i] != s[i - 1]){
            ans += count * (count - 1) / 2;
            count = 0;
        }
        count++;
    }
    ans += count * (count - 1) / 2;
    cout << ans << endl;
}

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


void solve(long long A, long long B){

}

// 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 a,b;
	cin>> a>>b;
	if(a<=8 && b<=8){
	cout<< "Yay!"<<endl;
}
else{
cout<<":("<<endl;
}

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int count_digit(long long n)
{
    int count = 0;
    while (n != 0) {
        n = n / 10;
        ++count;
    }
    return count;
}

int main() {
    int n; cin >> n;
    vector<vector<int>> table(9, vector<int>(9, 0));

    for (int i = 1; i <= n; i++) {
        if (i % 10 == 0) continue;
        if (i <= 9) {
            table[i - 1][i - 1] = 1;
            continue;
        }
        int count = count_digit(i);
        int most = i / (int)pow(10, count - 1);
        int least = i % 10;
        table[most - 1][least - 1]++;
    }

    long long ans = 0;
    // rep(i, 9) {
    //     rep(j, 9) {
    //         cout << table[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    rep(i, 9) {
        for (int j = i; j < 9; j++) {
            if (i == j) {
                if (table[i][j] == 1) ans += 1;
                else ans += table[i][j] * table[i][j];
            } else {
                ans += table[i][j] * table[j][i] * 2;
            }
        }
        cout << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib> // abs() for integer
#include <cmath>   // abs() for float, and fabs()
using namespace std;

int main(){
    int N;
    cin >> N;
    int ans = 1000 - N % 1000;
    if (ans == 1000)
    {
        cout << 0;
    }else
    {
        cout << ans;
    }
    
}

Measured memory_bytes: 3632
#include<cstdio>

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++){
        bool a = false;
        if(i % 3 == 0){
            a = true;
        }
        else if(i % 10 == 3){
            a = true;
        }
        else if((i / 10) % 10 == 3){
            a = true;
        }
        else if((i / 100) % 10 == 3){
            a = true;
        }
        else if((i /1000) % 10 == 3){
            a = true;
        }
        if(a){
            printf(" %d",i);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2756