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

int main()
{
    long long n, h, ma, ans=0;
    cin >> n >> h;
    vector<long long> a(n), b(n);
    for(long long i=0; i<n; i++)
    {
        cin >> a[i] >> b[i];
    }
    
    ma = *max_element(a.begin(),a.end());
    sort(b.begin(), b.end());

    while(b[n-1] > ma && n>=1)
    {
        h -= b[n-1];
        n--;
        ans++;
        if(h<=0) break;
    }
    
    if(h>0)
    {
        ans += (h/ma);
        if(h%ma!=0) ans ++;
    }
    
    cout << ans;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define N 200005
long long n,O[N],X[N],Pow[N],mo=998244353,ans;
struct V {
	long long x,y;
	bool operator <(const V a)const {
		return y<a.y;
	}
} A[N];
long long _1[N],_2[N],_3[N],_4[N];
void ADD(int o) {
	while(o<=n)O[o]++,o+=o&-o;
}
int SUM(int o) {
	int sum=0;
	while(o)sum+=O[o],o-=o&-o;
	return sum;
}
int main() {
	scanf("%lld",&n);
	for(int i=1; i<=n; i++)scanf("%lld %lld",&A[i].x,&A[i].y),X[i]=A[i].x;
	sort(A+1,A+n+1);
	sort(X+1,X+n+1);
	for(int i=1; i<=n; i++) {
		A[i].x=lower_bound(X+1,X+n+1,A[i].x)-X;
		_3[i]=SUM(A[i].x),_4[i]=i-1-_3[i];
		ADD(A[i].x);
	}
	memset(O,0,sizeof(O));
	for(int i=n; i; i--) {
		_2[i]=SUM(A[i].x),_1[i]=n-i-_2[i];
		ADD(A[i].x);
	}
	Pow[0]=1;
	for(int i=1; i<=n; i++) Pow[i]=Pow[i-1]*2%mo;
	for(int i=1; i<=n; i++) {
		ans+=((Pow[_1[i]]-1)*(Pow[_3[i]]-1)%mo)*(Pow[_2[i]]+Pow[_4[i]]-1)%mo;
		ans+=((Pow[_2[i]]-1)*(Pow[_4[i]]-1)%mo)*(Pow[_3[i]]+Pow[_1[i]]-1)%mo;
		ans+=((((Pow[_2[i]]-1)*(Pow[_4[i]]-1)%mo)*(Pow[_3[i]]-1)%mo)*(Pow[_1[i]]-1))%mo;
		ans+=Pow[n-1];//1
		ans%=mo;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>

int main()
{
    int i, j, k, n = 0;
    int h, t, w, m;
    char s;
    scanf("%d %d", &n, &m);
    int array_a[n][m] = {0};
    int array_b[m] = {0};
    int array_c[n] = {0};
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            scanf("%d", &array_a[i][j]);
        }
    }
    for (i = 0; i < m; i++)
    {
        scanf("%d", &array_b[i]);
    }

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < m; j++)
        {
            array_c[i] += array_a[i][j] * array_b[j];
        }
    }
    for (i = 0; i < n; i++)
    {
        printf("%d\n", array_c[i]);
    }
    return 0;
}


Measured memory_bytes: 2752
//#include <GOD>

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define si size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define E end()
#define B begin()
#define pi pair<int, int>
#define en cout << endl
#define cn const
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

cn int maxn = 1e5 + 10;
int w[maxn];
ll v[maxn];
ll dp[150][maxn];

int main(){
	fast_io;
	int n, W;
	cin >> n >> W;
	for(int i = 0; i < n; i ++){
		cin >> w[i];
		cin >> v[i];	
	}

	for(int i = 0; i < n; i ++){
		for(int j = 1; j <= W; j ++){
			if(i == 0){
				if(w[i] <= j){
					dp[i][j] = v[i];	
				}
			}else if(w[i] <= j){
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
			}else{
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	
	cout << dp[n - 1][W];
	
	return 0;
}



Measured memory_bytes: 80128
#include<stdio.h>
using namespace std;

int main(){
    int a,b,c,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d = a/b;
    r = a%b;
    f = static_cast<double>(a) / static_cast<double>(b);
    printf("%d %d %.5f",d,r,f);
    return 0;
}


Measured memory_bytes: 2716
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int par[maxn],sz[maxn],x[maxn],y[maxn],n,m;
long long now,ans[maxn];
int find(int x)
{
	if(par[x]==x)return x;
	else return par[x]=find(par[x]);
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		par[i]=i;
		sz[i]=1;
	}
	for(int i=1;i<=m;i++)
	scanf("%d %d",&x[i],&y[i]);
	now=(long long)n*(n-1)/2;
	for(int i=m;i>=1;i--)
	{
		ans[i]=now;
		int X=x[i],Y=y[i];
		X=find(X);Y=find(Y);
		if(X==Y)continue;
		now-=sz[X]*sz[Y];
		par[X]=Y;
		sz[Y]+=sz[X];
	}
	for(int i=1;i<=m;i++)
	printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 6360
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
using namespace std;



int main(){
  ll A,B;
  ll ANS;
  cin>>A>>B;
  if(A>9||B>9){
    cout<<"-1"<<endl;
    return 0;
  }
  ANS=A*B;
  cout<<ANS<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())

k = (1 + (1 + 8 * n)** 0.5) * 0.5
if k.is_integer():
    k = int(k)
    print('Yes')
    print(k)
    num,ans = 1,[[] for _ in range(k)]
    for i in range(k):
        for j in range(i + 1, k):
            ans[i].append(num)
            ans[j].append(num)
            num += 1
        print(k - 1, *ans[i])
else:
    print('No')


Measured memory_bytes: 77148
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

int main(){
	
	int a,b;
	cin>>a>>b;
	cout<<max(a+(a-1),max(b+(b-1),a+b))<<endl;	


	

	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int max = *max_element(a.begin(), a.end());
    int min = *min_element(a.begin(), a.end());
    cout << max - min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n;
  std::cin>>n;

  std::vector<ll> x(n);

  rep(i,0,n)std::cin>>x[i];

  ll ans=MOD;

  rep(i,0,101){
    ll temp=0;
    rep(j,0,n){
      temp+=(x[j]-i)*(x[j]-i);
    }
    chmin(ans,temp);
  }

  std::cout<<ans<<"\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int H,N;cin >> H >> N;
    vector<int> A(N);
    vector<int> B(N);
    rep(i,N)cin >> A[i] >> B[i];

    vector<LL> dp(100000,INF);
    dp[0] = 0;
    rep(i,H){
        rep(j,N){
            chmin(dp[i+A[j]],dp[i] + B[j]);
        }
    }
    LL ans = INF;
    for(int i = H;i < 100000;i++){
        ans = min(ans,dp[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	string s, t; cin >> s >> t;
	int a, b; cin >> a >> b;
	string u; cin >> u;
	if( s == u ) --a;
	else --b;
	cout << a << ' ' << b << endl;
}

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

using namespace std;

int main() {
    int n, c; cin >> n >> c;
    
    vector<long long> dp(n * 1000 + 1, 2e18);
    dp[0] = 0;

    for (int i = 0; i < n; ++i) {
        int w, v; cin >> w >> v;
        for (int j = (int)dp.size() - 1 - v; j >= 0; --j) {
            dp[j + v] = min(dp[j + v], dp[j] + w);  
        }
    }


    for (int i = (int)dp.size() - 1; i >= 0; --i) {
        if (dp[i] <= c) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=(map(int,input().split()) for _ in range(M))
A,B=(list(i) for i in zip(*AB))
import numpy as np
C=np.ones(N)
d=0
def m(a,b):
  if H[b-1]>H[a-1]:
    return [a,a]
  if H[a-1]>H[b-1]:
    return [b,b]
  if H[b-1]==H[a-1]:
    return [a,b]
for i in range(M):
  C[m(A[i],B[i])[0]-1]=0
  C[m(A[i],B[i])[1]-1]=0
for j in range(N):
  d=d+C[j]
print(int(d))

Measured memory_bytes: 66120
from sys import stdin, exit, setrecursionlimit
setrecursionlimit(100000000)

input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()


def dfs(node):
    if len(graph[node]) == 0:
        dp[node] = 0
        return 0
    if dp[node] != -1: return dp[node]
    ans = 0
    for i in graph[node]:
        ans = max(ans, dfs(i)+1)
    dp[node] = ans
    return ans


n, m = mi()
graph= [[] for i in range(n+1)]
for i in range(m):
    a, b = mi()
    graph[a].append(b)
dp = [-1]*(n+1)
for i in range(1, n+1):
    if dp[i] == -1:
        dfs(i)
print(max(dp))

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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s, t, u; cin >> s >> t >> u;

  cout << s[0] << t[1] << u[2] << endl;
  
  return (0);
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;

    int w=0,r=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='W')
        {
            w++;
        }
        else
        {
            r++;
        }
    }







    int ans=0;
    for(int i=0;i<r;i++)
    {
        if(s[i]=='W')
        {
            ans++;
        }
    }


    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3716
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void fill(ref int[][] m, int x, int y) {
	if(m[x][y] == 1) {
		m[x][y] = 0;
		for(int i = -1; i <= 1; ++i) {
			for(int j = -1; j <= 1; ++j) {
				fill(m, x+i, y+j);
			}
		}  
	}
}

void main(){
	while(true){
		auto wh = readInts();
		auto w = wh[0];
		auto h = wh[1];
		if(w == 0) {
			return;
		}
		int[][] m;
		for(int i; i < h; ++i) {
			m ~= [0] ~ readInts() ~ [0];
		}
		m = [new int[](w+2)] ~ m;
		m ~= new int[](w+2);
		int ans;
		for(int i; i < h; ++i) {
			for(int j; j < w; ++j) {
				if(m[i+1][j+1] == 1) {
					++ans;
					fill(m, i+1, j+1);
				}
			}
		}
		writeln(ans);
	}
}

Measured memory_bytes: 3488
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

struct UnionFind {
	VI par, s;
	UnionFind(int N) :par(N), s(N) {
		REP(i, N)par[i] = i;
		REP(i, N)s[i] = 1;
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		if (!(same(x, y)))s[ry] += s[rx];
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
	int size(int x) {
		return s[root(x)];
	}
};

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

	int N; cin >> N;
	VP A(N);
	UnionFind uni(N);
	REP(i, N) {
		cin >> A[i].first >> A[i].second;
		A[i].first--;
		A[i].second--;
	}
	

	set<int>S;
	VI to(N);
	REP(i, N)to[A[i].second] = i;
	SORT(A);
	REP(i, N) {
		int now = A[i].second;
		auto it = S.begin();

		VI tmp;
		bool f = 1;
		while (it != S.end() && *it < now) {
			uni.unite(to[now], to[*it]);
			tmp.push_back(*it);
			it++;
			f = false;
		}
		
		if (f)S.insert(now);
	}



	REP(i, N) cout << uni.size(i) << '\n';
	return 0;
}



Measured memory_bytes: 16012
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX 100
#define NUM '0'
void push(double);
int getop(char []);
double pop(void);
int main(){
  int type;
  double op2;
  char s[MAX];

  while((type = getop(s)) != EOF) {
    switch (type) {
    case NUM:
      push(atof(s));
      break;
    case '+':
      push(pop() + pop());
      break;
    case '*':
      push(pop() * pop());
      break;
    case '-':
      op2 = pop();
      push(pop() - op2);
      break;
    case '/':
      op2 = pop();
      if (op2 != 0.0)
	push(pop() / op2);
      else
	printf("error: zero divisor\n");
      break;
    case '\n':
      printf("%.8g\n", pop());
      break;
    default:
      printf("error: unknown command %s\n", s);
      break;
    }
  }
  return 0;
}
#define MAXVALUE 100
int sp = 0;
double val[MAXVALUE];
void push(double f){
  if (sp < MAXVALUE)
    val[sp++] = f;
  else
    printf("error: stack full, can't push %g\n", f);
}
double pop(void){
  if (sp > 0)
    return val[--sp];
  else {
    printf("error: stack empty\n");
    return 0.0;
  }
}
#include <ctype.h>
int getch(void);
void ungetch(int);
int getop(char s[]){
  int i, c;

  while ((s[0]= c = getch()) == ' ' || c == '\t')
    ;
  s[1] = '\0';
  if (!isdigit(c) && c != '.')
    return c;
  i = 0;
  if (isdigit(c))
    while (isdigit(s[++i] = c = getch()));
  if (c == '.')
    while (isdigit(s[++i] = c = getch()));
  s[i] = '\0';
  if (c != EOF)
    ungetch(c);
  return NUM;
}
#define BUF 100
char buf[BUF];
int bufp =0;
int getch(void) 
{
  return (bufp > 0) ? buf[--bufp] : getchar();
}

void ungetch(int c){
  if (bufp >= BUF)
    printf("ungetch: too many characters\n");
  else
    buf[bufp++] = c;
}



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

int main(){

    int x,y;
    int r=0;

    cin >> x >> y;

    if(x > y){
        r += x;
        x--;
    } else {
        r += y;
        y--;
    }

    if(x > y){
        r += x;
        x--;
    } else {
        r += y;
        y--;
    }

    cout << r << endl;

    

}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	result := 0

	for i := 1; i <= n; i++ {
		tmp := 0
		if i%2 == 1 {
			for j := 1; j <= i; j++ {
				if i%j == 0 {
					tmp = tmp + 1
				}
			}
			if tmp == 8 {
				result = result + 1
			}
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 1772
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979

using namespace std;
typedef pair<int, int> P;

int main(void) {
	string s;
	int p, q, r;

	cin >> s;
	p = 0;
	q = s.size() - 1;


	FOR(i, p, q-1) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			break;
		}
		else if (i <= q - 2) {
			if (s[i] == s[i + 2]) {
				cout << i+1 << " " << i + 3 << endl;
				break;
			}
		}
		if (i == q - 1) {
			cout << -1 << " " << -1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define endl "\n"
#define MOD 1000000007
#define DEB(x) cout<<"##"<<x<<"##"<<endl;
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
void solve1()
{
	int r;
	cin>>r;
	cout<<2*((double)(r))*(3.141592653589793238);
}
void solve()
{
	int n;
	cin>>n;
	int ar[n+1];
	map<int,int>mp;
	for(int i=1;i<n;i++)
	{
		cin>>ar[i+1];
		mp[ar[i+1]]++;
	}
	for(int i=1;i<=n;i++)
		cout<<mp[i]<<endl;
}
int main()
{
	fastio();
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	solve();


	return 0;

	
}

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

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;

    vector<int> ans(N - 1, 0);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (min(j - i, abs(X - 1 - i) + 1 + abs(Y  - 1 - j)) > 0) {
                ans.at(min(j - i, abs(X - 1 - i) + 1 + abs(Y - 1 - j)) - 1)++;
            }
        }
    }

    for (int i = 0; i < N - 1; i++) {
        cout << ans.at(i) <<endl;
    }
}

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

int main() {
  int N;
  string S;
  string kekka = "Three"; //3種類の場合で初期化
  cin >> N;
  
  for (int i=0;i<N;i++) {
    cin >> S;
    if (S=="Y") {
      //黄色が見つかったら4種類で確定
      kekka = "Four";
      break;
    }
  }
  cout << kekka << endl;
}


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




int main()
{
	ll n;
	cin>>n;
	ll v[n];
long double x[n],y[n];
	long double sum=0.0000000;
	ll f=0;
	for(ll i=0;i<n;i++)cin>>x[i]>>y[i],v[i]=i;
	bool flag=true;
	while(flag)
	{	f++;
		for(ll i=0;i<n-1;i++)
		{
			 long double dx = x[v[i + 1]] - x[v[i]];
            long double dy = y[v[i + 1]] - y[v[i]];
			sum+=sqrt(dx*dx+dy*dy);
			
		}
		flag=next_permutation(v,v+n);
	}

cout<<setprecision(12)<<sum/f;
}

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

class UnionFind {
private:
  int sz;
  vector<int> par, siz;
public:
  UnionFind() {}
  UnionFind(int n) : sz(n), par(sz), siz(sz, 1) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    if (par.at(x) == x) return x;
    else return par.at(x) = root(par.at(x));
  }
  void unit(int x,int y) {
    x = root(x), y = root(y);
    if (x == y) return;
    if (siz.at(x) < siz.at(y)) swap(x, y);
    par.at(y) = x;
    siz.at(x) += siz.at(y);
  }
  int size(int x) {
    x = root(x);
    return siz.at(x);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  UnionFind UF(N);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--, B--;
    if (!UF.same(A, B)) UF.unit(A, B);
  }
  int mx = 0;
  for (int i = 0; i < N; i++) {
    mx = max(mx, UF.size(i));
  }
  cout << mx << "\n";
}

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

int n, m;
vector<int> e[100005];
int d[100005];

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

	cin >> n >> m;
	for (int i=1; i<=m; i++) {
		int u, v;
		cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}

	fill(d+1, d+n+1, -1);

	queue<int> q;
	q.push(1);
	while (!q.empty()) {
		int x = q.front(); q.pop();
		for (int y : e[x]) {
			if (d[y] == -1) {
				d[y] = d[x] + 1;
				q.push(y);
			}
		}
	}

	bool bip = true;

	long long c[2] = {0, 0};

	for (int x=1; x<=n; x++) {
		c[d[x] % 2]++;
		for (int y : e[x]) {
			if (d[x] % 2 == d[y] % 2) {
				bip = false;
			}
		}
	}

	if (!bip) {
		cout << n*(n-1ll) / 2 - m;
	} else {
		cout << c[1]*c[0] - m;
	}

	
}

Measured memory_bytes: 6272
<?php
  $stdin = fopen('php://stdin', "r");

  fscanf($stdin, "%s", $s);

  $price = 700;

  if ($s[0] == 'o') {
    $price += 100;
  }
  if ($s[1] == 'o') {
    $price += 100;
  }
  if ($s[2] == 'o') {
    $price += 100;
  }

  echo $price.PHP_EOL;


Measured memory_bytes: 4732
import scala.io.StdIn._
import scala.annotation.tailrec

object Main {

  def sieve(top: Int): Iterator[Int] = {
    val topNdx = (top - 3) / 2 + 1
    val (cmpsts, sqrtLmtNdx) = (new Array[Int]((topNdx >>> 5) + 1), (Math.sqrt(top).toInt - 3) / 2)

    @inline def isCmpst(ci: Int): Boolean =
      (cmpsts(ci >>> 5) & (1 << (ci & 31))) != 0

    @inline def setCmpst(ci: Int): Unit =
      cmpsts(ci >>> 5) |= 1 << (ci & 31)

    @tailrec def forCndNdxsFrom(cndNdx: Int): Unit =
      if(cndNdx <= sqrtLmtNdx){
        if(!isCmpst(cndNdx)){
          val p = cndNdx + cndNdx + 3

          @tailrec def cullPrmCmpstsFrom(cmpstNdx: Int): Unit =
          if(cmpstNdx <= topNdx){
            setCmpst(cmpstNdx)
            cullPrmCmpstsFrom(cmpstNdx + p)
          }
          cullPrmCmpstsFrom((p * p - 3) >>> 1)
        }
        forCndNdxsFrom(cndNdx + 1)
      }
      forCndNdxsFrom(0)

    @tailrec def getNxtPrmFrom(cndNdx: Int): Int =
      if ((cndNdx > topNdx) || !isCmpst(cndNdx)) 2 * cndNdx + 3
      else getNxtPrmFrom(cndNdx + 1)

    Iterator.single(2) ++ Iterator.iterate(3)(p => getNxtPrmFrom((p - 1) >>> 1)).takeWhile(_ <= top)
  }

  @tailrec
  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(sieve(n).size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit ={
    loop(readLine)
  }
}

Measured memory_bytes: 65460
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  string s;cin>>s;

  ll l=0,r=0;
  ll ans=0;
  while(1){
    ll lc=0,rc=0;
    for(l=r;s[l]=='<'&&l<s.size();l++);
    lc=l-r;
    for(r=l;s[r]=='>'&&r<s.size();r++);
    rc=r-l;
    // out("l:"<<l<<" r:"<<r<<" lc:rc"<<lc<<" "<<rc);
    if(max(lc,rc)==0)break;
    ans+=max(lc,rc)+lc*(lc-1)/2+rc*(rc-1)/2;
    // ans+=max(lc,rc)+lc*(lc-1)/2+rc*(rc-1)/2;
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    int n;
    std::cin>>n;
    std::vector<int> v(n);
    for (int i=0; i<n; i++) std::cin>>v[i];
    std::sort(v.begin(),v.end());
    bool p=true;
    for (int i=0; i<v.size()-1; i++)
        if (v[i]==v[i+1]) p=false;
    if (p) std::cout<<"YES";
    else std::cout<<"NO";
    return 0;
}

Measured memory_bytes: 3948
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
#include <iomanip>

#define MOD (1000000007)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {

    ll N;
    cin >> N;

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

    sort(L.begin(), L.end());

    ll ret = 0;
    for(int a = 0; a < N-2; a++) {
        for(int b = a+1; b < N-1; b++) {
            auto itr = lower_bound(L.begin() + b + 1, L.end(), L[a] + L[b]);
            ret += itr - (L.begin() + b + 1) ;
        }
    }

    cout << ret << endl;

    return 0;
}


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

int main()
{
char in[32];;
char out[32]={};
gets(in);
memcpy(out, in, 4);
memcpy(out+5, in+4, 8);
out[4]=' ';
out[13]='\n';
printf(out);
}

Measured memory_bytes: 128
import sys
N,M,X,Y=[int(x) for x in input().rstrip().split()]
x_n=[int(x) for x in input().rstrip().split()]
y_m=[int(x) for x in input().rstrip().split()]
x_max=max(x_n)
y_max=min(y_m)
for z in range(X+1,Y+1):
  if x_max<z and z<=y_max:
    print("No War")
    sys.exit()
print("War")


Measured memory_bytes: 3060
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;


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

	cin >> N;
	string s;
	cin >> s;
	vector<int>three(N + 1, 1);
	for (int i = 1; i <= N; i++) {
		three[i] = three[i - 1] * 3;
	}
	vector<vector<vector<int>>>place(N + 1);
	vector<vector<int>>ed(N + 1);
	for (int i = 1; i <= N; i++) {
		place[i].resize(three[i]);
		ed[i].resize(three[i]);
	}
	s = 'A' + s;
	place[0].resize(1);
	for (int i = 0; i < s.size(); i++) {
		if(s[i]=='R')place[0][0].push_back(i);
	}
	vector<int>sum(s.size());
	for (int i = 1; i < s.size(); i++) {
		sum[i] = s[i] == 'S';
		sum[i] += sum[i - 1];
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j<three[i]; j++) {
			int p = j / three[i - 1];
			int md = j % three[i - 1];
			int cn = 0;
			for (auto k : place[i - 1][md]) {
				if (sum[k] % 2 != sum[cn] % 2) {
					p = (3 - p) % 3;
				}
				cn = k;
				p++;
				if (p == 3) {
					p = 0;
					place[i][j].push_back(k);
				}
			}
			if (sum.back() % 2 != sum[cn] % 2) {
				p = (3 - p) % 3;
			}
			ed[i][j] = p;
		}
	}
	for (int i = 0; i < three[N]; i++) {
		int ans = 0;
		for (int j = N; j > 0; j--) {
			ans *= 3;
			ans += ed[j][i%three[j]];
		}
		cout << ans << " ";
	}
	cout << endl;
}

Measured memory_bytes: 50848
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    println!("{}", a.iter().sum::<usize>() - n);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

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

int main() {
    string s; ll k; cin >> s >> k;
    set<string> st;
    for(char c = 'a'; c <= 'z'; c++){
        rep(i, 0, sz(s)){
            if(s[i]==c){
                Rep(j, 1, k){
                    if(i+j <= sz(s)) st.insert(s.substr(i, j));
                }
            }
        }
        if(sz(st) >= k) break;
    }
    auto it = st.begin();
    rep(i, 1, k) it++;
    co(*it);

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


h, w = map(int, input().split())
A = []

for i in range(h):
    line = list(map(int, input().split()))
    A.append(line)

for i in range(h):
    line = list(map(int, input().split()))
    for j, num in enumerate(line):
        A[i][j] = abs(A[i][j] - num)

const = 6400
bitset = 1 << const
DP = [[0]*w for _ in range(h)]
DP[0][0] = bitset >> A[0][0]


def slide_down(y, x):
    bit = DP[y][x]
    delta = A[y+1][x]
    new1 = bit << delta
    new2 = bit >> delta
    DP[y+1][x] |= new1 | new2


def slide_right(y, x):
    bit = DP[y][x]
    delta = A[y][x+1]
    new1 = bit << delta
    new2 = bit >> delta
    DP[y][x+1] |= new1 | new2


for y in range(h):
    for x in range(w):
        if y < h-1:
            slide_down(y, x)
        if x < w-1:
            slide_right(y, x)

ans = DP[h-1][w-1]
for i in range(81):
    if (ans >> const+i) & 1 or (ans >> const-i) & 1:
        print(i)
        exit()


Measured memory_bytes: 14964
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define es cout<<" "
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;
template<class T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<class T, class... Ts> 
auto make_vec(size_t a, Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}

int main(void) {
    vector<int> v(3);
    repeat(i, 3) cin >> v[i];
    sort(v.begin(), v.end());
    cout << v[0] + v[1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, k;
int len[110];
int main(){
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> len[i];
    }
    sort(len, len + n);
    int sum = 0;
    for (int i = 0; i < k; ++i) {
        sum += len[n - i - 1];
    }
    cout << sum <<endl;
    return 0;
}

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

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> ans(n + 1, 0);
    for (int x = 1; x * x <= n; ++x) {
        for (int y = 1; y * y <= n; ++y) {
            for (int z = 1; z * z <= n; ++z) {
                int s = x * x + y * y + z * z +
                        x * y + y * z + z * x;
                if (s <= n) ++ans[s];
            }
        }
    }

    for (int i = 1; i <= n; ++i) {
        std::cout << ans[i] << "\n";
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int k;
    cin >> k;
    if (s.size()==1){
        cout << k/2 << endl;
        return 0;
    }
    long long ans = 0;
    vector<int> str;
    int cnt = 1;
    for (int i=0;i<s.size()-1;i++){
        if (s[i]==s[i+1]){
            cnt += 1;
        } else {
            str.push_back(cnt);
            cnt = 1;
        }
        if (i+1==s.size()-1 && cnt!=1){
            str.push_back(cnt);
        }
    }
    if (str.size()==1){
        if (s.size()%2==0){
            cout << (s.size()/2)*k << endl;
            return 0;
        }
        if (k%2==0){
            cout << s.size()*(k/2) << endl;
            return 0;
        } else {
            cout << s.size()*(k/2)+s.size()/2 << endl;
            return 0;
        }
    }
    for (int i=0;i<str.size();i++){
        if (str[i]!=1){
            ans += str[i]/2*k;
        }
    }
    if (s[0]==s[s.size()-1]){
        if ((str[0]+str[str.size()-1])%2==0){
            if (str[0]%2!=0){
                ans += k-1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  i64 H;
  cin >> H;
  i64 ans = 0;
  i64 cnt = 1;
  while(H > 0) {
    ans += cnt;
    H /= 2;
    cnt = cnt * 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>

const int64_t MAX = 100005;

int64_t N[MAX];
int64_t L[MAX];
struct Query
{
    int64_t a,b,c;
} Q[MAX];
int64_t n,m,q;

int64_t Find(int64_t a)
{
    if (N[a] == a) return a;
    else return N[a] = Find(N[a]);
}

void Union(int64_t l, int64_t r)
{
    if (L[l] < L[r]) Union(r, l);
    else {
        ++L[l];
        N[r] = l;
    }
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin >> n >> m >> q;
    for (int64_t i=0;i<n;++i) N[i] = i;
    for (int64_t i=0;i<q;++i) std::cin >> Q[i].a >> Q[i].b >> Q[i].c;
    bool result = true;
    bool any = false;
    for (int64_t i=0;i<q;++i)
    {
        if (Q[i].c == 0)
        {
            Union(Find(Q[i].a), Find(Q[i].b));
        }
        else any = true;
    }
    for (int64_t i=0;i<q;++i)
    {   
        if (Q[i].c == 1)
        {
            result &= Find(Q[i].a) != Find(Q[i].b);
        }
    }
    std::map<int64_t, int64_t> C;
    for (int64_t i=0;i<n;++i) C[Find(i)]++;
    int64_t nn = C.size();
    int64_t r = nn*(nn-1)/2;;
    for (auto it : C)
    {
        if (it.second >= 2) r += it.second-1;
    }
    int64_t l = any ? n : n-1;
    result &= l <= m && m <= r;
    std::cout << (result ? "Yes" : "No") << std::endl;

    return 0;
}

Measured memory_bytes: 9600
package main

import "fmt"

func main() {
	var N, cnt int
	fmt.Scan(&N)
	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}
	for i := 0; i < len(arr); i++ {
		if arr[i]%2 > 0 {
			fmt.Println(cnt)
			return
		}
	}
	for {
		cnt++
		for i := 0; i < len(arr); i++ {
			w := arr[i] / 2
			if w%2 > 0 {
				fmt.Println(cnt)
				return
			}
			arr[i] = w
		}
	}
}

Measured memory_bytes: 512
def main():
    N = int(input())
    max_value = 10 ** 9 * -1
    min_value = int(input())
    for n in range(N - 1):
        now_value = int(input())
        if max_value < now_value - min_value:
            max_value = now_value - min_value
        if min_value > now_value:
            min_value = now_value
    print(max_value)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5612
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

bool G[8][8] = {false};
bool use[8] = {false};
int n, m;
ll dfs(int now){
  int i, j;
  rep(i, n)if(i != now)if(!use[i])break;
  if(i == n)return 1LL;

  ll res = 0LL;
  rep(i, n)if(G[now][i])if(!use[i]){
    use[now] = true;
    res += dfs(i);
    use[now] = false;
    //pri(res);
  }
  return res;
}

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    scanf("%d %d", &n, &m);
    rep(i, m){
      int2(a, b);
      --a; --b;
      G[a][b] = true;
      G[b][a] = true;
    }

    printf("%lld\n", dfs(0));


/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
#define INF 999999999
const int MX=1e5+10;
using namespace std;  
int main()
{
    int n,val[MX];
	cin>>n;
	int flag=0;
	for(int i=0;i<n;i++)
		scanf("%d",&val[i]);
	int ans=1;
	int up=0,dn=0;
	for(int i=0;i<n-1;i++){
		if(val[i]>val[i+1])dn=1;
		if(val[i]<val[i+1])up=1;
		if(dn&&up){ans++;up=dn=0;}
	}
		printf("%d\n",ans);
	//system("pause");
    return 0;
}

Measured memory_bytes: 640
#include<iostream>

int main(){
	long long sum = 0;
  	int t;
  std::cin >> t;
  long long tmp;
  long long max = 0;
  for(int i = 1; i <= t; i++){
  	std::cin >> tmp;
    if (tmp > max) max = tmp;
    sum += tmp;
  }
  sum -= max;
  if(max >= sum) return !(std::cout << "No");
  else return !(std::cout << "Yes");
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a,b,i,c;
	int d=0;
	while(0<=scanf("%d%d",&a,&b)){
		if(a==0 && b==0) break;
		if(d>0){
			printf("\n");
		}
		++d;
		c=0;
		for(i=a;i<=b;i++){
			if(i%400==0 || i%100!=0 && i%4==0){
				++c;
				printf("%d\n",i);
			}
		}
		if(c==0){
			printf("NA\n");
		}else{
			printf("");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main()
{
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if(a >= b){
    printf("No\n");
  }
  else if(b >= c){
    printf("No\n");
  }
  else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
const int mod = 1000000007;
int f[2][maxn], pi[maxn];
vector<int> e[maxn];
int solve(int c, int x){
  if(f[c][x] != -1) return f[c][x];
  int ans = 1;
  for(int v : e[x]){
    if(v == pi[x]) continue;
    pi[v] = x;
    int naq = 0;
    for(int i = 0; i <= c; i++) {
      naq += solve(1 - i, v);
      if(naq >= mod) naq -= mod;
    }
    ans = 1ll * ans * naq % mod;
  }
  return f[c][x] = ans;
}
int main(){
  memset(f, -1, sizeof(f));
  int n; cin >> n;
  for(int i = 0; i < n - 1; i++){
    int x, y; cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  int ans = solve(0, 1) + solve(1, 1);
  if(ans >= mod) ans -= mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15232
import sys

q="hi"

S=input()

def check_hitachi(query):
    n=len(query)
    if n % 2 == 1:
        return False
    if query.find(q)==0:
        if n==2:
            return True;
        else:
            return check_hitachi(query[2:])
    else:
        return False

result=check_hitachi(S)
if result:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,K;
  cin >> A >> B >> K;
  
  vector<int> a;
  for(int i=1;i<=A;i++){
    if(A%i==0){
      a.push_back(i);
    }
  }
  vector<int> b;
  for(int j=1;j<=B;j++){
    if(B%j==0){
      b.push_back(j);
    }
  }
  vector<int> c;
  for(int k=0;k<a.size();k++){
    for(int l=0;l<b.size();l++){
    if(a.at(k)==b.at(l)){
      c.push_back(a.at(k));
    }
  }
  }
 
  cout << c.at(c.size()-K) <<endl;
 
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {

	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int[][] match=new int[n][n];
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				match[i][j]=s.nextInt();
			}
		}
		long[][] dp=new long[n][(1<<n)];
		for(int i=0;i<n;i++)
			Arrays.fill(dp[i], -1);;
		System.out.println((int)ways(0,n,match,0,dp));

	}
	public static long ways(int idx,int n, int[][] match,int paired,long[][] dp) {
		if(idx==n)
			return 1;
		if(dp[idx][paired]!=-1)
			return dp[idx][paired];
		long max=0;
		for(int i=0;i<n;i++) {
			if(match[idx][i]==1 && (paired & (1<<i)) !=(1<<i)) {
				max+=ways(idx+1,n,match,paired |(1<<i),dp);
			}
		}
		max=max%1000000007;
		return dp[idx][paired]=max;
	}

}


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

int main()
{
	int x,a,b;
	cin >> x >> a >> b;
	if (abs(x-a) < abs(x-b))
	{
		cout << "A" << endl;
	}
	else cout << "B" << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()


e0=e1=o0=o1=0
for i in range(len(s)):
    if s[i]=="0" :
        if i%2!=0 :
            e0+=1
        else:
            o0+=1
    else:
        if i%2!=0 :
            e1+=1
        else:
            o1+=1

# print(e0,e1,o0,o1)
ot = len(s)//2 if len(s)%2==0 else (len(s)+1)//2
et = len(s)//2

ans = min(abs(e0-et)+abs(o1-ot),abs(e1-et)+abs(o0-ot))
print(ans)



Measured memory_bytes: 9148