akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    using namespace std;
    const int N=300010;
    int n;
    int a[N],h[N],cnt,b[N];
    int s[N<<2];
    int lowbit(int k){return k&-k;}
    void add(int k)
    {
    	for(int i=k;i<=600010;i+=lowbit(i))
    		s[i]++;
    }
    int query(int k)
    {
    	int res=0;
    	for(int i=k;i;i-=lowbit(i))
    		res+=s[i];
    	return res;
    }
    bool check(int mid)
    {
    	long long res=0;
    	for(int i=1;i<=n;i++)
    		b[i]=(a[i]<=mid)?1:-1;
    	int sum=300010;
    	memset(s,0,sizeof(s));
    	add(300010);
    	for(int i=1;i<=n;i++)
    	{
    		sum+=b[i];
    		add(sum); res+=query(sum-1);
    	}
    	if(res<((1ll*n*(n-1)/2+n)/2+1))
    		return 0;
    	else
    		return 1;
    }
    int main()
    {
    	scanf("%d",&n);
    	for(int i=1;i<=n;i++)
    		scanf("%d",&a[i]),h[i]=a[i];
    	sort(h+1,h+n+1); cnt=unique(h+1,h+n+1)-h-1;
    	for(int i=1;i<=n;i++)
    		a[i]=lower_bound(h+1,h+cnt+1,a[i])-h;
    	int l=1,r=cnt;
    	while(l<r)
    	{
    		int mid=l+r>>1;
    		if(check(mid))r=mid;
    		else
    			l=mid+1;
    	}
    	printf("%d",h[l]);
    	return 0;
    }

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int a;
	string s;
	cin>>a>>s;

	if(a>=3200)
	{
		cout<<s<<endl;
	}
	else
	{
		cout<<"red"<<endl;
	}

}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    string s;
    cin >> s;
    if (s == "AAA" || s=="BBB")
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[50][50],k[50];
int like[100];
int main()
{
	int n,m;
	cin>>n>>m;
	memset(like,0,sizeof(like));
	for(int i=1;i<=n;i++){
		cin>>k[i];
		for(int j=1;j<=k[i];j++)
		{
			cin>>a[i][j];
			like[a[i][j]]++;
		}
	}
	int cnt=0;
	for(int i=1;i<=m;i++)
	   if(like[i]==n)
	      cnt++;
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [deque([(i, x) for x in lr()]) for i in range(1, N+1)]
day = 0
candidate = {A[i][0] for i in range(N)}
match = 0

while candidate:
    day += 1
    used = set()
    next = set()
    for a, b in candidate:
        if a in used or b in used:
            continue
        if A[b-1][0] == (b, a):
            match += 1
            A[a-1].popleft()
            A[b-1].popleft()
            if A[a-1]:                
                next.add(A[a-1][0])
            if A[b-1]:
                next.add(A[b-1][0])
            used |= {a, b}
    if match == N * (N-1) // 2:
        break
    candidate = next
    if not used:
        print(-1); exit()

print(day)
# 10


Measured memory_bytes: 84956
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
  int i;
  bool ans;
  string s;
  cin >> s;
  ans=(s[1]==s[2]) && (s[0]==s[1] || s[2]==s[3]);
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimization_level 3
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

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

    string p[4] = {"dream", "dreamer", "erase", "eraser"};

    reverse(all(s));

    rep(i, 4) { reverse(all(p[i])); }

    bool ans = true;

    for(size_t i = 0; i < s.size();) {
        bool can = false;
        rep(j, 4) {
            string q = p[j];
            if(s.substr(i, q.size()) == q) {
                can = true;
                i += q.size();
            }
        }
        if(!can) {
            ans = false;
            break;
        }
    }

    if(ans) {
        cout << "YES";
    } else {
        cout << "NO";
    }
}


Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		int a, b;
		String op;

		ArrayList<String> buf = new ArrayList<String>();


		a = sc.nextInt();
		op = sc.next();
		b = sc.nextInt();


		while (!op.equals("?")) {

			switch (op) {

			case ("+"):
				buf.add(String.valueOf(a+b));
			break;

			case ("-"):
				buf.add(String.valueOf(a-b));
			break;

			case ("*"):
				buf.add(String.valueOf(a*b));
			break;

			case ("/"):
				buf.add(String.valueOf(a/b));
			break;

			}

			a = sc.nextInt();
			op = sc.next();
			b = sc.nextInt();

		}

//		System.out.println(buf);

		for(int i = 0; i < buf.size(); i++) {
			System.out.println(buf.get(i));
		}


	}

}





Measured memory_bytes: 26300
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));

typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
//-0.4620981203755741
int main(){
    itn n;
    std::cin >> n;
    VEC(int,a,n);
    
    std::vector<int> b(n+1);
    rep(i,n){
        b[a[i]]=b[a[i]-1]+1;
    }
    int ans=n;
    rep(i,n+1){
        ans=min(ans,n-b[i]);
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N;
  invec<ll> A(N);
  ll r = 0;
  
  REP(i,N){
    if (i%2 == 0 && A[i]%2 == 1)
      r++;
  }


  return r;
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



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

int main(){
	int n,cnt=0;
	int p;
	cin >> n;
	for(int i = 1; i < n; i++){
		cin >> p;
		if(p != i){
			cnt++;
		}
	}
	cout << (cnt<=2?"YES":"NO") << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define endl '\n'
typedef long long LL;
using namespace std;

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

  LL a, b, n; cin >> a >> b >> n;
  LL x = min(b - 1, n);
  LL ans = (a * x) / b - a * (x / b);
  cout << ans << endl;
}


Measured memory_bytes: 3640
n = int(input())
s = input()
r_num = len([x for x in s if x == 'R'])
g_num = len([x for x in s if x == 'G'])
b_num = n - r_num - g_num
ans = r_num * g_num * b_num
for interval in range(0, (n - 3) // 2 + 1):
    for left_index in range(0, n - (2 * interval + 3) + 1):
        letter0 = s[left_index]
        letter1 = s[left_index + interval + 1]
        letter2 = s[left_index + 2 * interval + 2]
        if len(set([letter0, letter1, letter2])) == 3:
            ans -= 1
print(ans)

Measured memory_bytes: 68576
let readCharArray () = stdin.ReadLine().ToCharArray()

()
|> readCharArray
|> fun arr ->
    let a =
        [| arr.[0]; arr.[0]; arr.[0] |]
        |> System.String
        |> int

    let b = arr |> System.String |> int
    if a >= b then
        a
    else
        let n = arr.[0] |> string |> int |> (+) 1
        n * 100 + n * 10 + n
|> printfn "%d"


Measured memory_bytes: 29812
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int N; cin >> N;
  vector<int> a(N);
  for(int i=0; i<N; i++) cin >> a[i];
  
  string ans = "second";
  for(auto ai: a)
    if(ai%2 != 0) ans = "first";
  
  cout << ans << endl;
  return 0;
}

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

amount = 1000
MX = A[0]
MN = A[0]

for i in range(1, N):
	a = A[i]
	if a < MX:
		if MN < MX:
			s = amount // MN
			t = amount % MN
			amount = MX * s + t
		MN = a
		MX = a
	else:
		if a > MX:
			MX = a
		if a < MN:
			MN = a

	if i == N - 1 and MN < MX:
		s = amount // MN
		t = amount % MN
		amount = MX * s + t

print(amount)

Measured memory_bytes: 9108
#include <iostream>
using namespace std;
using ll = long long;

int main(){
  ll a, b, x;
  cin >> a >> b >> x;
  auto f = [x](ll n)->ll{
    if(n<0){
    return 0;
    }else{
    return n/x+1;
    }
  };
  cout << f(b)-f(a-1);
  return 0;
}

Measured memory_bytes: 3628
a[6],x;main(i,j){for(;~j;++i)i<6?x|=1<<(gets(a+i),j=a[i]-=49):i>10?x=i=0:printf("%d\n",x^x&-x&&x-7?j=a[i-5],x&2?x&1?j+1:j:j?1:2:3);}

Measured memory_bytes: 524
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================


	ll H, W;
	cin >> H >> W;

	if ((H * W) % 3 == 0)
	{
		cout << 0 << endl;
		return 0;
	}


	ll ans = LLINF;

	// 縦に分割  ooo|ooo|oo
	{
		ll first = W / 3;
		ll second = (W - first) / 2;
		ll third = W - first - second;

		ll max_W = max(first, max(second, third));
		ll min_W = min(first, min(second, third));

		ans = min(ans, (max_W - min_W) * H);
	}

	// 横
	{
		ll first = H / 3;
		ll second = (H - first) / 2;
		ll third = H - first - second;

		ll max_H = max(first, max(second, third));
		ll min_H = min(first, min(second, third));

		ans = min(ans, (max_H - min_H) * W);
	}

	// 縦横１回ずつ

	// T型
	for (int h = 0; h <= H; h++)
	{
		// 上からh個
		ll first = h * W;
		ll second = (H - h) * (W / 2);
		ll third = W * H - first - second;

		ll max_S = max(first, max(second, third));
		ll min_S = min(first, min(second, third));

		ans = min(ans, max_S - min_S);
	}

	// |-型
	for (int w = 0; w <= W; w++)
	{
		ll first = w * H;
		ll second = (W - w) * (H / 2);
		ll third = W * H - first - second;

		ll max_S = max(first, max(second, third));
		ll min_S = min(first, min(second, third));

		ans = min(ans, max_S - min_S);
	}

	cout << ans << endl;
}





Measured memory_bytes: 256
class DisjointSet:
    def __init__(self, size):
        self.parent = list(range(size))
        self.rank = [0]*size
    
    def find(self, x):
        stack = []
        parent = self.parent
        while parent[x] != x:
            stack.append(x)
            x = parent[x]
        for y in stack:
            parent[y] = x
        return x

    def union(self, x, y):
        xr, yr = self.find(x), self.find(y)
        
        if self.rank[xr] > self.rank[yr]:
            self.parent[yr] = xr
        elif self.rank[xr] < self.rank[yr]:
            self.parent[xr] = yr
        elif xr != yr:
            self.parent[yr] = xr
            self.rank[xr] += 1

from collections import Counter

N,M = map(int,input().split())

ds = DisjointSet(N)

for _ in range(M):
    a,b = map(lambda x: int(x)-1, input().split())
    ds.union(a,b)

c = Counter(ds.find(i) for i in range(N))

print(max(c.values()))


Measured memory_bytes: 102540
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
int N,X;
  cin >>N>>X;
  vec a(N);
  for(int i=0;i<N;i++) cin >> a[i];
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<N;i++){
  if(i == N-1 && a[i] == X) ans++;
    else if(i == N-1);
  else if(X >= a[i]){
ans++;
    X -= a[i];
  }
    else break;
  }
  printf("%d\n",ans);
}
  


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,i;
  scanf("%d",&n);
  long int a[n],sum=0;
  for(i=0;i<n;i++){
  	scanf("%ld",&a[i]);
  }
  for(i=0;i<n-1;i++){
  	if(a[i]>a[i+1]){
    	sum += a[i]-a[i+1];
      	a[i+1] += a[i]-a[i+1];
    }
  }
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  vector<int> x(3);
  cin>>x.at(0)>>x.at(1)>>x.at(2);
  sort(x.begin(), x.end());
  
  if(x.at(0)+x.at(1)==x.at(2)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

int main(){
  int N;
  cin>>N;
  if (N==7){
    cout<<"YES";
  }
  else if (N==5){
    cout<<"YES";
  }
  else if (N==3){
    cout<<"YES";
  }
  else{
    cout<<"NO";
  }
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import numpy as np

MOD = 10 ** 9 + 7
S = input().rstrip()

ten = np.zeros(13, dtype=np.uint64)
ten[:10] += 1
add_all = [ten]
for _ in range(5):
  add_all.append(add_all[-1][np.arange(0,52,4)%13])

add_single = [[x * 10 ** i for x in range(10)] for i in range(6)]

add_all_count = [0] * 6
constant_term = 0
for i,s in enumerate(S[::-1]):
  if s == '?':
    add_all_count[i%6] += 1
  else:
    constant_term += add_single[i%6][int(s)]

def convolve(x,y):
  z = np.convolve(x,y) % MOD
  z[:12] += z[13:25]
  return z[:13] % MOD

def nth_convolve(arr,n):
  if n == 1:
    return arr
  x = nth_convolve(arr,n>>1)
  x = convolve(x,x)
  return convolve(arr,x) if n & 1 else x

dp = np.zeros(13, dtype=np.uint64)
dp[constant_term % 13] = 1
for arr,n in zip(add_all, add_all_count):
  if n > 0:
    dp = convolve(dp, nth_convolve(arr,n))

print(dp[5])


Measured memory_bytes: 12728
#include<bits/stdc++.h>
#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=100000000000000001;
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;
}

int main() {

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int t1=a/d,t2=c/b;
	if(a%d>0)t1++;
	if(c%b>0)t2++;
	if(t1<t2)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3624
z = input()
d = {}
c = 0

L = ['S','H','C','D']
for i in L:
    for j in range(1,14):
        d[i] = d.get(i,[]) + [j]


while c < z:
    x = raw_input().split()
    d[x[0]].remove(int(x[1]))
    c += 1


for i in L:
    for j in sorted(d[i]):
        print i + " " + str(j)

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

int main(int argc, char const *argv[])
{
	int n,m;
	cin>>n>>m;
	int s[m],c[m];
	for (int i = 0; i < m; ++i)
	{
		cin>>s[i]>>c[i];
	}
	if (n==1)
	{
		int f=1;
		for (int j = 0; j < m; ++j)
		{
			if (c[j]!=0)
			{
				f=0;
			}
		}
		if (f==1)
		{
			cout<<"0\n";
			return 0;
		}
	}
	for (int i = 0; i < 1000; ++i)
	{
		int d=0,now=i;;
		while (now>0)
		{
			++d;
			now/=10;
		}
		if (n!=d)
		{
			continue;
		}
		int f=1;
		for (int j = 0; j < m; ++j)
		{
			int t=i;
			for (int k = 0; k < max(0,n-s[j]); ++k)
			{
				t/=10;
			}
			t%=10;
			if (t!=c[j])
			{
				f=0;
			}
		}
		if (f==1)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<"-1\n";
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// const int MOD = 998244353;
const int MOD = 1000000007;


/*----------------------------------------------------------------*/
signed main(){
	
	int x;
	cin >> x;
	if(x >= 30)cout << "Yes" << endl;
	else cout << "No" << endl;
	

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_b
// rm -r -f test;oj dl https://abc174.contest.atcoder.jp/tasks/abc174_a

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
#define inf 2147483647
ll mod_pow(ll a,ll b){
	if(b==0)return 1;
	ll next=mod_pow(a,b/2);
	int num=1;
	if(b%2) num=a*(b%2)%mod;
	return num*(next*next%mod)%mod;
}
ll extGCD(ll a,ll b,ll &x,ll &y) {
    if(b==0){
       x=1;
       y=0;
       return a;
    }
    ll d=extGCD(b,a%b,y,x); // 再帰的に解く
    y-=a/b*x;
    return d;
}

ll mod_inv(ll a){//aの逆元
	ll x,y;
	extGCD(a,mod,x,y);
	return x%mod;
}

ll mod_conbination(ll a, ll b){//aCbの計算
    ll n=1,m=1;
	rep(i,b)n=n*(a-i)%mod;//分母
	rep(i,b)m=m*(i+1)%mod;//分子
	return n*mod_inv(m)%mod;
}
	
int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	ll count=0;
	count=(mod_pow(2,n)-1-mod_conbination(n,a)-mod_conbination(n,b))%mod;
	if(count<0)count+=mod;
	cout<<count;
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
using namespace std;
int main(){
  int sum;
  string s;
  cin >> s;
  if (s[0]=='1'){
    sum++;
  }
  if (s[1]=='1'){
    sum++;
  }
  if (s[2]=='1'){
    sum++;
  }
  cout << sum;
}



Measured memory_bytes: 256
H, W, A, B = [int(_) for _ in input().split()]
mod = 10**9 + 7
 
X = [i for i in range(H + W + 1)]
X[0] = 1
for i in range(2, H + W + 1):
    X[i] = X[i - 1] * i % mod
 
Y = X.copy()
Y[-1] = pow(Y[-1], mod - 2, mod)
for i in range(H + W, 1, -1):
    Y[i - 1] = i * Y[i] % mod
 
 
def comb(x, y):
    return X[x] * Y[y] * Y[x - y] % mod
 
 
ans = 0
for i in range(B, min(B + H - A, W)):
    ans += comb(H - A + B - 1, i) * comb(W + A - B - 1, W - i - 1)
    ans %= mod
print(ans)


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

using namespace std;

#define endl '\n'

const int nax = 1e7;
long long divs[nax+5];
bitset <nax> is_prime;

void sieve(){
  is_prime.set();
  for(int i=1;i<=nax;i++)
      divs[i] = 1;
  for(long long i=2;i<=nax;i++){
    if(is_prime[i]){
      for(long long j=i;j<=nax;j+=i){
        is_prime[j] = 0;
        int qtd = 0;
        long long temp = j;
        while(temp % i == 0)
          temp/=i,qtd++;
        divs[j] *= (qtd+1);
      }
    }
  }
}

int main(){

  ios_base :: sync_with_stdio(false);
  cin.tie(NULL);

  int n;
  cin >> n;
  long long ans = 0;
  sieve();
  for(int i=1;i<=n;i++){
    ans += i*divs[i];
  }

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

Measured memory_bytes: 82988
#C消費税
h,j = map(int,input().split())
s=int(h*(25/2))
while True:
    hh=int(s*(2/25))
    jj=int(s/10)
    if(hh==h and jj==j):
        print(s)
        exit()
    if(hh>h and jj>j):
        print(-1)
        exit()
    s+=1


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
using namespace std;

int main() {
    int i,n;
    cin>>n;
    int a[n];
    int b[10000];
    for(i=0;i<n;i++){
        cin>>a[i];

    }

    for (i = 0; i < 10000; ++i) {
        b[i]=0;
    }

    for (i = 0; i < n; ++i) {
        b[a[i]]++;
    }

    for (i = 1; i < 10000; ++i) {
        b[i]=b[i]+b[i-1];
    }

    int c[n];
    for (i = n-1; i >=0; --i) {
        c[b[a[i]]-1]=a[i];
        b[a[i]]--;

    }

    for (i = 0; i < n; ++i) {
       if(i !=0)cout<<" ";
        cout<<c[i];
    }

cout<<endl;


    return 0;
}


Measured memory_bytes: 18756
#include<iostream>
#include<iomanip>
#include<cmath>

int main(){
    double pi = acos(-1);
    double r;
    double circle, area;

    std::cin>>r;

    circle=2*pi*r;
    area=pi*r*r;

    std::cout<<std::fixed;
    std::cout<<std::setprecision(6)<<area<<std::flush;
    std::cout<<" "<<std::setprecision(6)<<circle<<std::endl;

    return 0;
}


Measured memory_bytes: 3280
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define int long long
using namespace std;

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
#define ford(i,n) for (int i = n-1; i >= 0; i--)
#define ford2(i,a,b) for (int i = a-1; i >= b; i--)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
#define BIG 1000000000000000000

#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sllll(n,m,k,o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf(" %c", &c)
#define ss(s) scanf("%s", s)
#define sal(t,n) fin(iz,n) { scanf("%lld", &t[iz]); }
#define sad(t,n) fin(iz,n) { scanf("%lf", &t[iz]); }
#define gl(t) scanf(" %[^\n]", t);

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pss(s) printf("%s\n", s.c_str())
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pal(t,n) fin(rz,n) { printf("%lld ", t[rz]); } printf("\n")
#define pad(t,n) fin(rz,n) { printf("%lf ", t[rz]); } printf("\n")

#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
 
#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")

#define ll int
#define vl vector<ll>
#define vvl vector<vl>
#define vvvl vector<vvl>

#define dll pair<ll, ll>
#define vdll vector<dll>
#define vvdll vector<vdll>

#define vb vector<bool>
#define vvb vector<vb>
#define vd vector<double>
#define vvd vector<vd>
#define vc vector<char>
#define vvc vector<vc>

#define all(v) v.begin(), v.end()
#define vlen(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second

bool dp[(int)(1e5) + 5];

signed main()
{
    int n, k;
    sll(n, k);
    vl x(n);
    sal(x, n);
    fin(c, k+1) {
        fin(i, n) {
            if (c >= x[i]) dp[c] |= (! dp[c-x[i]]);
        }
    }
    if (dp[k]) ps("First");
    else ps("Second");
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int m = max({a, b, c});
  int x = 0;
  if(m == a) x = b + c;
  else if(m == b) x = a + c;
  else x = a + b;

  cout << m * 10 + x << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int s[5][105];
int dp[5][105];
int n;
int main()
{
	read(n);
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			read(s[i][j]);
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			dp[i][j]=max(dp[i-1][j],dp[i][j-1])+s[i][j];
	cout<<dp[2][n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  for(int i = 0; i < s.length(); i++) {
    if(0 == i % 2 && 'L' == s[i]) {
      cout << "No" << endl;
      return 0;
    }
    if(1 == i % 2 && 'R' == s[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  int k;
  cin >> k;
  ll p;
  queue<ll> q;
  rep(i,9){
    q.push(i+1);
  }
  rep(i,k){
    p = q.front();
    q.pop();
    if(p%10==9){
      q.push(p*10+p%10-1);
      q.push(p*10+p%10);
    }else if(p%10==0){
      q.push(p*10+p%10);
      q.push(p*10+p%10+1);
    }else{
      q.push(p*10+p%10-1);
      q.push(p*10+p%10);
      q.push(p*10+p%10+1);
    }
  }
  cout << p << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a,b);
  
 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,k,dg,c[105][105],ans;
int main(){
           cin>>n;
           dg=1;
           for(k=1;k<=n;k++){
            if(k/dg>9){
                       dg*=10;
            }         
            
            if(k/dg==k%10) ans++;
                       ans+=c[k%10][k/dg]*2;
            c[k/dg][k%10]++;
          //  cout<<k<<" "<<ans<<endl;
           }
           cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define endl '\n'
typedef long long ll;
const int _N = 1e5 + 11;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll n, pos[_N], bair[_N], cnt[_N], res = 1;

int main() {
	boost();
	#ifndef ONLINE_JUDGE
//		freopen("in", "r", stdin);
	#endif
	cin >> n;
	for (int i = 0; i < n; i++) cin >> pos[i];
	bair[0] = 1; bair[1] = 1;
	for (int i = 2; i < n; i++) {
		int need = i - bair[i - 1];
		int bga = pos[i - 1] - (i - bair[i - 1] + 1);	
		if (bga >= need) bair[i] = bair[i - 1];
		else bair[i] = bair[i - 1] + 1;
	}
	for (int i = 0; i < n; i++) cnt[bair[i]] += 1;
	for (ll i = 1; i <= n; i++) {
		cnt[i] += cnt[i - 1];
		res = (res * (cnt[i] - (i - 1))) % MOD;
	}
//	for (int i = 0; i < n; i++) cout << bair[i] << " "; cout << endl;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2688
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<59;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010

ll d[2][N], wg[2][N];
ll n, m, s, t;
vp g[N];

void dijk(int u, ll d[N], ll wg[N]){
	fill(d, d+N, INF);
	fill(wg, wg+N, 0);
	d[u] = 0; wg[u] = 1;
	PQ(P) q;
	q.push(P(0, u));
	while(!q.empty()){
		P p = q.top(); q.pop();
		ll v = p.snd, ttt = p.fst;
		if(d[v]<ttt) continue;
		for(auto &&x: g[v]){
			ll w = x.fst, tt = ttt+x.snd;
			if(d[w]>tt){
				d[w] = tt;
				wg[w] = wg[v];
				q.push(P(d[w], w));
			} else if(d[w]==tt) (wg[w]+=wg[v])%=mod;
		}
	}
}

int main(){
	cin>>n>>m>>s>>t; s--; t--;
	rep(i, m){
		ll u, v, l;
		cin>>u>>v>>l; u--; v--;
		g[u].pb(P(v, l));
		g[v].pb(P(u, l));
	}
	dijk(s, d[0], wg[0]);
	dijk(t, d[1], wg[1]);
	ll len = d[0][t];
	ll res = wg[0][t]*wg[0][t]%mod;
	cerr<<res<<endl;
	rep(i, n){
		for(auto &&x: g[i]){
			ll j = x.fst, l = x.snd;
			if(d[0][i]+d[1][j]+l!=len) continue;
			if(d[0][i]>=(len+1)/2||d[1][j]>=(len+1)/2) continue;
			(res-=wg[0][i]*wg[1][j]%mod*wg[1][j]%mod*wg[0][i]%mod)%=mod;
			//cerr<<"edge "<<i<<" "<<j<<" "<<wg[0][i]<<" "<<wg[1][j]<<endl;
		}
		if(d[0][i]+d[1][i]!=len||d[0][i]!=d[1][i]) continue;
		(res-=wg[0][i]*wg[1][i]%mod*wg[1][i]%mod*wg[0][i]%mod)%+mod;
		//cerr<<"vertex "<<i<<" "<<wg[0][i]<<" "<<wg[1][i]<<endl;
	}
	res+=mod;
	res%=mod;
	cout<<res<<endl;
	//rep(i, n) cerr<<wg[0][i]<<endl;
	//rep(i, n) cerr<<d[0][i]<<endl;
	return 0;
}


Measured memory_bytes: 18920
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(" ").Select(long.Parse).ToList();

        A.Sort();
        A.Reverse();

        var sorted = new LinkedList<long>(A);

        long res = 0;
        while (true)
        {
            if (sorted.Count == 0) break;

            sorted.RemoveFirst();
            res += sorted.First.Value;
            sorted.RemoveFirst();
            sorted.RemoveLast();
        }
        
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 72944
n = int(input())
listA = list(map(int, input().split()))
colorL = [0, 0, 0, 0, 0, 0, 0, 0]
min=0
max=0
index=0
while index < len(listA):
    if listA[index] >0 and listA[index]<400 and colorL[0]==0:
        colorL[0]=1
        min+=1
        max+=1
    elif listA[index] >399 and listA[index]<800 and colorL[1]==0:
        colorL[1]=1
        min += 1
        max += 1
    elif listA[index] > 799 and listA[index] < 1200 and colorL[2] == 0:
        colorL[2] = 1
        min += 1
        max += 1
    elif listA[index] > 1199 and listA[index] < 1600 and colorL[3] == 0:
        colorL[3] = 1
        min += 1
        max += 1
    elif listA[index] > 1599 and listA[index] < 2000 and colorL[4] == 0:
        colorL[4] = 1
        min += 1
        max += 1
    elif listA[index] > 1999 and listA[index] < 2400 and colorL[5] == 0:
        colorL[5] = 1
        min += 1
        max += 1
    elif listA[index] > 2399 and listA[index] < 2800 and colorL[6] == 0:
        colorL[6] = 1
        min += 1
        max += 1
    elif listA[index] > 2799 and listA[index] < 3200 and colorL[7] == 0:
        colorL[7] = 1
        min += 1
        max += 1
    elif listA[index] > 3199:
        max+=1
    index+=1
if min ==0:
    min=1
print(str(min)+" "+str(max))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;
 
 
 
int main() 
{
    ll n, x, m;
    cin >> n >> x >> m;
    vector<int> id(m, -1);
   
    vector<int> a;
   
    int len = 0;
    ll tot = 0;
   
    while (id[x] == -1) 
	{
        a.push_back(x);
        id[x] = len;
        len++;  //total len till next cycle
       
	    tot = tot + x;
        x = (x*x)%m;
    }
 
    int c = len-id[x];  //cycle len
    ll s = 0;
    for (int i = id[x]; i < len; i++) s += a[i];  //cycle sum
 
    ll ans = 0;
  
  
    if (n <= len) 
	{
        rep(i,n) ans += a[i];
    }
    else 
	{
        
		ans =  ans+ tot;
        n = n- len;
        ans = ans+ s*(n/c);
        n = n% c;
       
	   
	    rep(i,n) ans += a[id[x]+i];
    }
    cout << ans << endl;
  
}

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


int main(){
    long long power = 1;
    long long mod = 1000000000+7;
    int n;
    cin >> n;

    for(int i=1;i<=n;i++){
        power *=i;
        power %= mod;
    }

    cout << power << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <queue>
#include <cstdio>
using namespace std;

const int INF = 1000000000;
const int MAX_N = 1000;
const int MAX_M = 1000;
typedef pair<int, int> P;
typedef long long ll;

char mize[MAX_N][MAX_M+1];
int N, M;
int sx, sy, gx, gy;

int d[MAX_N][MAX_M];

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

int bfs() {
    queue<P> que;

    for (int i=0; i<N; i++) {
        for(int j=0; j<M; ++j) {
            d[i][j] =INF;
        }
    }
    que.push(P(sx, sy));
    d[sx][sy] = 0;

    while(que.size()) {
        P p = que.front(); que.pop();
        if (p.first == gx && p.second == gy) {
            break;
        }

        for(int i=0; i< 4; ++i) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];

            if (0 <= nx && nx < N && 0 <= ny && ny < M && mize[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }

    return d[gx][gy];
}

int main() {
    cin >> N >> M;
    int i, j;
    for(i=0; i<N; ++i) {
        for(j=0; j<M; ++j) {
            cin >> mize[i][j];
        }
    }

    ll ans = -1;

    for(sx=0; sx<N; ++sx) {
        for(sy=0; sy<M; ++sy) {
            for(gx=0; gx<N; ++gx) {
                for(gy=0; gy<M; ++gy) {
                    if (mize[sx][sy] == '#' or mize[gx][gy] == '#') continue;
                    ll res = bfs();
                    if (res > ans) ans = res;
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 2432
#include<queue>
#include<cstdio>

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

using namespace std;

const int INF=1<<29;

int bed[10][10],maxair;

struct Info{
	int y,x,air,l,r,cost;
	Info(int Y,int X,int A,int L,int R,int C):y(Y),x(X),air(A),l(L),r(R),cost(C){}
	bool operator>(const Info &in)const{
		return cost>in.cost;
	}
};

int refillAir(int air,int x,int y){
	if(air==0)	return 0;
	return min(air+bed[y][x],maxair);
}

int main(){
	for(int w,h;scanf("%d%d",&w,&h),w;){
		int budget,iniair;	scanf("%d%d%d",&budget,&maxair,&iniair);
		rep(i,h)rep(j,w)	scanf("%d",bed[i]+j);

		int ans=-1;
		static int cmin[10][10][51][10][10];
		rep(y,h)rep(x,w)rep(a,maxair+1)rep(r,w)rep(l,r+1)	cmin[y][x][a][l][r]=INF;
		priority_queue< Info,vector<Info>,greater<Info> > pq;
		rep(x,w){
			int nextair,nextcost;
			if(bed[0][x]<0){
				nextair=iniair-1;
				nextcost=-bed[0][x];
			}
			else{
				nextair=refillAir(iniair-1,x,0);
				nextcost=0;
			}
			cmin[0][x][nextair][x][x]=nextcost;
			pq.push(Info(0,x,nextair,x,x,nextcost));
		}
		while(!pq.empty()){
			Info a=pq.top();	pq.pop();
			int y=a.y,x=a.x,air=a.air,l=a.l,r=a.r,cost=a.cost;
			if(air<=0 || cost>budget)	continue;
			if(y==h-1){ ans=cost; break; }

			if(cmin[y][x][air][l][r]<cost)	continue;

			int nextair,nextcost;
			if(bed[y+1][x]<0){
				nextair=air-1;
				nextcost=cost-bed[y+1][x];
			}
			else{
				nextair=refillAir(air-1,x,y+1);
				nextcost=cost;
			}
			if(nextcost<cmin[y+1][x][nextair][x][x]){
				cmin[y+1][x][nextair][x][x]=nextcost;
				pq.push(Info(y+1,x,nextair,x,x,nextcost));
			}

			if(x>0){
				int nextl;
				if(x==l){
					nextl=x-1;
					if(bed[y][x-1]<0){
						nextair=air-1;
						nextcost=cost-bed[y][x-1];
					}
					else{
						nextair=refillAir(air-1,x-1,y);
						nextcost=cost;
					}
				}
				else{
					nextl=l;
					nextair=air-1;
					nextcost=cost;
				}
				if(nextcost<cmin[y][x-1][nextair][nextl][r]){
					cmin[y][x-1][nextair][nextl][r]=nextcost;
					pq.push(Info(y,x-1,nextair,nextl,r,nextcost));
				}
			}

			if(x<w-1){
				int nextr;
				if(x==r){
					nextr=x+1;
					if(bed[y][x+1]<0){
						nextair=air-1;
						nextcost=cost-bed[y][x+1];
					}
					else{
						nextair=refillAir(air-1,x+1,y);
						nextcost=cost;
					}
				}
				else{
					nextr=r;
					nextair=air-1;
					nextcost=cost;
				}
				if(nextcost<cmin[y][x+1][nextair][l][nextr]){
					cmin[y][x+1][nextair][l][nextr]=nextcost;
					pq.push(Info(y,x+1,nextair,l,nextr,nextcost));
				}
			}
		}

		if(ans!=-1)	printf("%d\n",ans);
		else		puts("NA");
	}

	return 0;
}

Measured memory_bytes: 0
while True:
    W, H = map(int, input().split())
    room = []
    for i in range(H):
        room.append(input())
    
    for i in range(H):
        for j in range(W):
            if room[i][j] == '@':
                (sx, sy) = (j, i)
            
    dx = (-1, 0, 1, 0)
    dy = (0, -1, 0, 1)
    visited = [[False] * W for i in range(H)]

    def rec(x, y):
        visited[y][x] = True
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < W and 0 <= ny < H and room[ny][nx] == '.':
                if not visited[ny][nx]:
                    rec(nx, ny)

    if W == 0 or H == 0:
        break
    rec(sx, sy)
    ans = 0
    for a in visited:
        for b in a:
            if b:
                ans += 1
    print(ans)


Measured memory_bytes: 5752
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int ans = inf;
    REP(i, s.size()) {
        if (i + t.size() - 1 >= s.size()) break;

        int tmp = 0;
        REP(j, t.size()) {
            if (s[i + j] != t[j]) tmp++;
        }
        ans = min(ans, tmp);
    }

    print(ans);
    
}


Measured memory_bytes: 3656
N = int(input())
A_LI = sorted(map(int, input().split()))
a_dict = {}
ans = 0
pre = None
for a in A_LI:
    if a not in a_dict:
        if pre in a_dict:
            # 出揃った値について取り除く個数を求める
            if a_dict[pre] < pre:
                ans += a_dict[pre]
            else:
                ans += a_dict[pre] - pre
        pre = a
        a_dict[a] = 1
    else:
        a_dict[a] += 1
# 最後の値について取り除く個数を求める
if a_dict[pre] < pre:
    ans += a_dict[pre]
else:
    ans += a_dict[pre] - pre
print(ans)


Measured memory_bytes: 99376
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(2e5) +5;



int main()
{
    idfc;
    int n;
    int mx=INT_MAX;
    cin>>n;
    int i;
    int e;
    int ans=0;
    for(i=0;i<n;i++)
    {
        cin>>e;
        if(mx>=e)ans++;
        mx=min(mx,e);
    }
    cout<<ans;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if ((i + 1) % 2) if (A.at(i) % 2) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3628
class TreeNode {
	TreeNode left_  = null;
	TreeNode right_ = null;
	public TreeNode left{
		get {
			return left_;
		}
		set {
			left_ = value;
		}
	}
	public TreeNode right{
		get {
			return right_;
		}
		set {
			right_ = value;
		}
	}
	
	int key_;
	public int key {
		get {
			return key_;
		}
	}
	public TreeNode(int i) {key_ = i;}
};

interface ITraverser {
	void run(TreeNode start);
};
class PreOrderTraverser : ITraverser {
	public void run(TreeNode visitedNode) {
		if (visitedNode != null) {
			System.Console.Write(" {0}", visitedNode.key);
			run(visitedNode.left);
			run(visitedNode.right);
		}
	}
};
class MidOrderTraverser : ITraverser {
	public void run(TreeNode visitedNode) {
		if (visitedNode != null) {
			run(visitedNode.left);
			System.Console.Write(" {0}", visitedNode.key);
			run(visitedNode.right);
		}
	}
};

class BinarySearchTree {
	
	static void insert (ref TreeNode root, TreeNode newNode)
	{
		TreeNode y = null;
		TreeNode x = root;
		while (x != null) {
			y = x; //???????¨????
			if (newNode.key < x.key) {
				x = x.left;
			}
			else {
				x = x.right;
			}
		}
		
		if (y == null) {// T???????????´???
		    root = newNode;
			//System.Console.WriteLine("root Assign: {0}",newNode.key); 
		}
		else if (newNode.key < y.key) {
			y.left = newNode; // newNode???y?????????????????????
			//System.Console.WriteLine("insert left: {0} -> {1}",y.key, newNode.key); 
		}
		else {
			y.right = newNode; // newNode???y?????????????????????
			//System.Console.WriteLine("insert right: {0} -> {1}",y.key, newNode.key); 
		}
	}

	public static void Main() {
		var line = System.Console.ReadLine();
		int inputCount = int.Parse(line);
		
		TreeNode root = null;
		ITraverser[] traverser = new ITraverser[2];
		traverser[0] = new MidOrderTraverser();
		traverser[1] = new PreOrderTraverser();
		for (int i = 0; i < inputCount; ++i) {
			line = System.Console.ReadLine();
			string[] input = line.Split(' ');
			switch (input[0]) {
			  case "insert":
				int value = int.Parse(input[1]);
				insert(ref root, new TreeNode(value));
				break;
			  case "print":
				traverser[0].run(root);
				System.Console.WriteLine("");
				traverser[1].run(root);
				System.Console.WriteLine("");
				break;
			  default: //bkyk
				System.Console.WriteLine("What?? readline = {0}", line);
				break;
			}
		}
	}
};

Measured memory_bytes: 40372
def SLE(a,b):
    if a == b:
        print('a == b')
    elif a < b:
        print('a < b')
    else:
        print('a > b')

def main():
    a, b= map(int, input().split())
    SLE(a,b)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5600