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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

void solve ( int test_case )
{
    int n ; cin >> n ;

    vi v ( n + 1 ) ;
    for ( int i=0 ; i < n + 1 ; i++ ) cin >> v[i] ;

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

    ll def = 0 ;
    for ( int i=0 ; i < n ; i++ )
    {
        ll t = min ( b[i] , v[i] ) ;
        def += t ;

        b[i] -= t ;
        t = min ( b[i] , v[i+1] ) ;

        def += t ;
        v[i+1] -= t ;
    }

    cout << def ; line
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 1024
// in the name of Allah

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

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

#define inf 1e9
#define max_n 123456
#define mod 1000000007

ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

int n, k;
ll a[123456];
ll dp[123456];

ll memo(int idx) {
	if(idx < 0) return 1e18;
	if(idx == 0) return 0;
	if(dp[idx] != -1) return dp[idx];
	ll res = 1e18;
	for(int i=1; i<=k; i++) res = min(res, memo(idx-i) + abs(a[idx] - a[idx-i]));
	return dp[idx] = res;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for(int i=0; i<n; i++) cin >> a[i];
	memset(dp, -1, sizeof dp);
	cout << memo(n-1) << endl;
	return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

template <class T>
T GCD(T a, T b) { return b == 0 ? a : GCD(b, a%b); }

int N, A, B, C;
vector<int> l;

int main()
{
  int N; cin >> N;

  int ans = 0;
  while (N--) {
    int a; cin >> a;
    ans = GCD(ans, a);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
from math import gcd

def factorization(n):
    pf_cnt = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                cnt += 1
                temp //= i
            if i != 1: pf_cnt[i] = cnt

    if temp != 1: pf_cnt[temp] = 1
    if not pf_cnt and n != 1: pf_cnt[n] = 1

    return pf_cnt

a,b = map(int, input().split())
ab_gcd = gcd(a,b)
fac = factorization(ab_gcd)
print(len(fac)+1)

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

int main() {
  int i, j, v;
  int A[3];
  int result;
  cin >> A[0] >> A[1] >> A[2];

  for( i = 1; i < 3; i++ ) {
    v = A[i];
    j = i - 1;
    while( j >= 0 && A[j] > v ) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
  }
  result = (A[1] - A[0]) + (A[2] - A[1]);
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int,int>
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,b,a) for (int i=(b);i>=(a);--i)
typedef long long LL;
inline int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const int MAXN=200005,Mo=1000000007;
char s[MAXN],t[MAXN];
int n,m,l,f[MAXN];
int power(LL x,LL y){
	int z=1; x%=Mo;
	while (y) {
		if (y&1) z=1LL*z*x%Mo;
		x=1LL*x*x%Mo; y>>=1;
	}
	return z;
}
int main(){
	n=read();
	scanf("%s",s+1);
	scanf("%s",t+1);
	m=0;
	FOR(i,1,n) if (s[i]==t[i]) m++;
	l=(n-m)/2;
	LL ans=1;
	for (int i=1,j=0;i<=n;++i) {
		if (s[i]==t[i]) {
			if (j==0) ans=ans*3%Mo;
			else if (j==1) ans=ans*2%Mo;
			j=1;
		}
		else {
			if (j==0) ans=ans*6%Mo;
			else if (j==1) ans=ans*2%Mo;
			else if (j==2) ans=ans*3%Mo;
			j=2; ++i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

/*
*/


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
	string a[3] = {"Sunny", "Cloudy", "Rainy"};
	string s;
	cin >> s;
	for(int i = 0; i < 3; ++i) {
		if(a[i] == s) {
			cout << a[(i + 1) % 3];
			break;
		}
	}
  
return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int y = sc.nextInt();

		String ans = "Yes";

		if (y % 2 != 0) {
			ans = "No";
		} else if (y < 2 * x || 4 * x < y) {
			ans = "No";
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 35760
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  while (true)
  {
    int h, w;
    cin >> h >> w;
    if (h == 0 && w == 0)
      break;

    REP(i, w)
    {
      cout << "#";
    }
    cout << endl;

    REP(i, h - 2)
    {
      cout << "#";

      REP(i, w - 2)
      {
        cout << ".";
      }
      cout << "#" << endl;
    }

    REP(i, w)
    {
      cout << "#";
    }
    cout << endl;
    cout << endl;
  }
}



Measured memory_bytes: 3116
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int MOD = 1e9 + 7;
vector<int> a , f;
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  string s;
  cin >> s;
  
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]){
    cout << "Bad" << '\n';
  }
  else cout <<"Good" << '\n';
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
int main(){
  std::string S;
  std::string tasi;
  int j = 0;
  std::cin >> S;
  tasi.push_back(S.at(0));
  int count = 0;
  for(int i =1;i <S.length();i++){

      if( tasi.at(j)==S.at(i) ){
        count++;
        S.at(i) == '1'?tasi.push_back('0'):tasi.push_back('1');
      }else{
        tasi.push_back(S.at(i));
      }
      j++;

  }

  std::cout << count << std::endl;



  }


Measured memory_bytes: 640
from collections import deque
n,m=map(int,input().split())
edge = [[] for i in range(n+1)]
#edge[i] : iから出る道の[行先]の配列
for _ in range(m):
    u, v = map(int, input().split())
    edge[u].append(v)
s,t = map(int, input().split())
queue = deque()
queue.append((s, 0))
visited = [[False] * 3 for _ in range(n+1)]
while queue:
    u, d = queue.popleft()
    if visited[u][d % 3]:
        continue
    visited[u][d % 3] = True
    if d % 3 == 0 and u == t:
        print(d // 3);exit()
    for v in edge[u]:
        queue.append((v, d+1))
print(-1)

Measured memory_bytes: 69792
#include<iostream>
#include<algorithm>
using namespace std;
#define N 100010
int main(){
  int n,m,h[N],ma[N];
  cin>>n>>m;
  for(int i=1;i<=n;i++){
    cin>>h[i];
    ma[i]=0;
  }
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    ma[a]=max(ma[a],h[b]);
    ma[b]=max(ma[b],h[a]);
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    ans+=h[i]>ma[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000

int main(){
	int n,d;cin>>n>>d;
	vector<vector<int>> x(n,vector<int>(d,0));

	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>x[i][j];
		}
	}

	int ans=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int sum=0;
			for(int k=0;k<d;k++){
				sum+=((x[i][k]-x[j][k])*(x[i][k]-x[j][k]));
			}
			for(int k=1;k<=200;k++){
			if(sum==k*k){ans++;}
			}
		}
	}

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

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

signed main()
{
    int n;
    cin >> n;
    set<string> s;
    string st;
    for(int i = 0;i < n;i++) {
        cin >> st;
        s.insert(st);
    }   

    cout << s.size() << endl;
}

Measured memory_bytes: 19180
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vii         vector<pair<int,int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define endl '\n'
#define int long long int
#define TIME (chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
bool is(string a){
    int i = 0;
    int j = a.length() -1;
    while(i < j){
        if(a[i] != a[j])return false;
        i++;
        j--;
    }
    return true;
}
int c2(int x){
    return (x * (x-1))/2;
}

void solve(){

    int n;cin >> n;
    map<int, int> cnt;
    vi in(n);
    FOR(i, n)cin >> in[i], cnt[in[i]]++;
    int ans = 0;
    for(auto val: cnt){
        ans += c2(val.second);
    }
    FOR(i, n){
        ans -= c2(cnt[in[i]]);
        ans += c2(cnt[in[i]]- 1);
        cout << ans << endl; 
        ans -= c2(cnt[in[i]]- 1);
        ans += c2(cnt[in[i]]);
    }
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    int t = 1;
   // cin >> t;
    while(t--)solve();
}




Measured memory_bytes: 11364
#include <stdio.h>
#define n_MAX 20
#define q_MAX 200
int solve(int ,int,int);
int a[n_MAX];
int b[q_MAX];
int main(){
  int i,n,q;
  scanf("%d" ,&n);
  for(i = 0;i<n;i++){
    scanf("%d",&a[i]);    
  }
  scanf("%d" ,&q);
  for(i = 0;i<q;i++){
    scanf("%d",&b[i]);    
  }
  for(i =0;i<q;i++){
    if(solve(0,b[i],n)==0)
      printf("no\n");
      else printf("yes\n");
  }
  return 0;
}

int solve(int i,int m,int n){
  int res1,res2;
  if(m ==0)
    return 1;
  if(i>=n)
    return 0;
  if(solve(i+1,m-a[i],n) ==0 && solve(i+1,m,n) ==0){
    return 0;
  }
  else return 1;
}






Measured memory_bytes: 2108
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		System.out.println(n * n);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 23764
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var nk = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
			int n = (int)nk[0];
			int k = (int)nk[1];

			var dic = new Dictionary<long, long>();
			for (int i = 1; i <= n; i++) {
				int target = n / i;
				int ok = i;
				int ng = n + 1;
				while (ng - ok > 1) {
					var mid = (ok + ng) / 2;
					if (n / mid == target) {
						ok = mid;
					} else {
						ng = mid;
					}
				}

				dic[i] = ok - i + 1;
				i = ok;
			}

			int m = dic.Count();
			var keys = dic.Keys.OrderBy(x => x).ToArray();

			var mul = new ModInt[m];
			var dp = new ModInt[k + 1, m];
			for (int i = 0; i < m; i++) {
				mul[i] = dic[keys[m - 1 - i]];
				dp[0, i] = 1;
			}

			for (int i = 0; i < k; i++) {
				for (int j = 0; j < m; j++) {
					if (j == 0) {
						dp[i + 1, j] += dp[i, m - 1 - j] * mul[m - 1 - j];
					} else {
						dp[i + 1, j] += dp[i + 1, j - 1] + dp[i, m - 1 - j] * mul[m - 1 - j];
					}
				}
			}

			ModInt ans = dp[k, m - 1];
			Console.WriteLine(ans);
		}
	}

	public struct ModInt
	{
		public static long Mod { get; set; } = (long)1e9 + 7;

		public static ModInt Pow(ModInt value, long k)
		{
			return Pow(value.Value, k);
		}

		public static ModInt Pow(long value, long k)
		{
			long ret = 1;
			for (k %= Mod - 1; k > 0; k >>= 1, value = value * value % Mod) {
				if ((k & 1) == 1) {
					ret = ret * value % Mod;
				}
			}
			return new ModInt(ret);
		}

		public static ModInt Inverse(ModInt value)
		{
			return Pow(value, Mod - 2);
		}

		public long Value;

		public ModInt(long value)
		{
			Value = value;
		}

		public static ModInt operator +(ModInt lhs, ModInt rhs)
		{
			lhs.Value += rhs.Value;
			if (lhs.Value >= Mod) {
				lhs.Value -= Mod;
			}
			return lhs;
		}

		public static ModInt operator -(ModInt lhs, ModInt rhs)
		{
			lhs.Value -= rhs.Value;
			if (lhs.Value < 0) {
				lhs.Value += Mod;
			}

			return lhs;
		}

		public static ModInt operator *(ModInt lhs, ModInt rhs)
		{
			return new ModInt(lhs.Value * rhs.Value % Mod);
		}
		public static ModInt operator /(ModInt lhs, ModInt rhs)
		{
			long exp = Mod - 2;
			while (exp > 0) {
				if (exp % 2 > 0) {
					lhs *= rhs;
				}

				rhs *= rhs;
				exp /= 2;
			}

			return lhs;
		}

		public static implicit operator ModInt(long n)
		{
			n %= Mod;
			if (n < 0) {
				n += Mod;
			}

			return new ModInt(n);
		}

		public override string ToString()
		{
			return Value.ToString();
		}
	}
}

Measured memory_bytes: 70368
#include <iostream>
#include <string>
#include <list>
#include <queue>
#define llint long long
#define inf 1e18

using namespace std;

llint n;
string s, t;
llint a[15], d[15];

llint dfs(llint p)
{
	if(p >= n) return 0;
	
	if(d[p] == 0) return dfs(p+1);

	llint ret = inf;
	for(int i = p+1; i <= n; i++){
		llint org = d[i];
		d[i] += d[p], d[i] %= 10;
		ret = min(ret, dfs(p+1));
		d[i] = org;
	}
	ret++;
	return ret;
}

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		cin >> s >> t;
		
		for(int i = 0; i < n; i++) a[i+1] = (t[i]-s[i]+10) % 10;
		for(int i = 1; i <= n+1; i++) d[i] = (a[i]-a[i-1]+10) % 10;
		n++;
		
		cout << dfs(1) << endl;
	}
	return 0;
}


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

int main(void){
    int n;
    cin >> n;
    int num[n];
    int ans;
    for(int i = 0; i < n; i++)
        cin >> num[i];
    sort(num, num+n);
    if(num[n/2]==num[n/2-1])
        ans = 0;
    else
    ans = num[n/2]-num[n/2-1];
    cout << ans << endl;
   return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#define int long long
#define mod 1000000007
using namespace std;

int b[26];
signed main() {
	string a; cin >> a>>a;
	for (char i : a) {
		b[i - 'a']++;
	}
	int ans = 1;
	for (int i = 0; i < 26; i++) {
		ans *= (b[i] + 1);
		ans %= mod;
	}
	ans--;
	ans += mod;
	ans %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 1020
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] l = new int[n];
		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}

		Arrays.sort(l);
		int count = 0;
		for (int i = 0; i < n - 2; i++) {
			for (int j = i + 1; j < n - 1; j++) {
				int ab = l[i] + l[j];
				int idx = lowerBound(l, ab);
				count += (idx - j - 1);
			}
		}

		System.out.println(count);
	}

	private static int lowerBound(int[] a, int x) {
		int l = 0;
		int r = a.length;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (a[m] < x) {
				l = m;
			} else {
				r = m;
			}
		}
		return r;
	}
}


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

int main()
{
	int n;
	cin >> n;
	vector<vector<pair<int,int>>> M(n);
	for(int i =0;i<n-1;i++)
	{
		int u,v,w;
		cin >> u >> v >> w;
		u--;
		v--;
		M[u].emplace_back(v,w);
		M[v].emplace_back(u,w);
	}
	vector<int> color(n,-1);
	stack<int> s;
	s.push(0);
	color[0] = 0;
	while (!s.empty())
	{
		int now = s.top();
		s.pop();
		for(auto i:M[now])
		{
			if(color[i.first]==-1)
			{
				s.push(i.first);
				color[i.first] = (color[now]+i.second+2)%2;
			}
		}
	}
	for(auto i:color)cout<<i<<endl;
	return 0;
}

Measured memory_bytes: 6784
#include<iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    string i,j;
    cin>>i;
    cin>>j;
    int l=i.length();
    if(j.substr(0,l)==i)
    {
        if (j.length()==i.length()+1)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }    
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3040
#include<bits/stdc++.h>
#define ll long long
#define dd double

using namespace std;


int main(){
    int N;
    cin >> N;
    if(int(N) % 2 == 0) cout << 0.500000 << endl;
    else cout << fixed << setprecision(15) << dd(N / 2 + 1) / dd(N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
  vector<int> a(3);
  for(ll i=0;i<3;i++)cin>>a[i];
  sort(a.begin(),a.end());
  if( a[0] != a[2] &&( a[0] == a[1] || a[1]==a[2] ) )cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

def longest_path(s):
    global dp
    if dp[s-1]<1:
        if edge[s]:
            dp[s-1]=max((longest_path(t)+1)for t in edge[s])
        else:
            dp[s-1]=0
    return dp[s-1]

N,M=map(int,input().split())
edge={}
for i in range(1,N+1):
    edge.setdefault(i,[])
for _ in range(M):
    x,y=map(int,input().split())
    edge[x].append(y)
dp=[0]*N
for i in range(1,N+1):
    if dp[i-1]==0:
        longest_path(i)

print(max(dp))

Measured memory_bytes: 134828
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
const int N=1e5+5,mod=1e9+7;
typedef long long ll;
ll n,d,ans;
int main()
{
    Elhabashy
    input();

    cin>>n>>d;
    d*=d;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        ll z=(x*x)+(y*y);
        if(z<=d)ans++;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define con_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define con_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>T gcd(T u,T v);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);

int main(){
    ll n,a,b,d1,d2;
    cin>>n>>a>>b;
    ll ans;
    if((b-a)%2==0)ans=(b-a)/2;
    else{
        d1=a-1;
        d2=n-b;
        ans=min(d1,d2)+1+(b-a-1)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
nums = []
nums<<gets.to_i
nums<<gets.to_i
nums<<gets.to_i
nums<<gets.to_i
nums<<gets.to_i
nums2 = nums.map {|n| a=10-n%10; a == 10 ? 0 : a }
nums2.sort!
nums2= nums2[0..-2]
sum=nums.inject(:+) + nums2.inject(:+)
puts sum

Measured memory_bytes: 1788
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define STR(x) string x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

lint calc(string &a)
{
	if ('1' <= a.front() && a.front() <= '9')
	{
		stringstream ss;
		while ('0' <= a.front() && a.front() <= '9')
		{
			ss << a.front();
			a.erase(a.begin());
		}
		lint ans; ss >> ans;
		return ans/2+1;
	}
	else if(a.front()=='[')
	{
		vl v;
		a.erase(a.begin());
		while (a.front() != ']')
		{
			v.push_back(calc(a));
		}
		a.erase(a.begin());
		sort(ALL(v));
		lint ans = 0;
		FOR(i, v.size() / 2 + 1)
		{
			ans += v[i];
		}
		return ans;
	}
}

int main()
{
	INT(n);
	FOR(data, n)
	{
		STR(x);
		lint ans = calc(x);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3224
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BOrdinaryNumber solver = new BOrdinaryNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class BOrdinaryNumber {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            int[] arr = new int[n];
            int i = 0;
            for (i = 0; i < n; i++)
                arr[i] = ni();
            int cnt = 0;
            for (i = 1; i < n - 1; i++) {
                if (arr[i] < arr[i - 1] && arr[i] > arr[i + 1])
                    cnt++;
                else if (arr[i] > arr[i - 1] && arr[i] < arr[i + 1])
                    cnt++;
            }
            pn(cnt);

        }

        int ni() {
            return in.nextInt();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 21332
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
#define ll long long

int main(void){
    int N;
    cin>>N;
    int a,b,c,d;
    d=N%10;
    c=(N%100)/10;
    b=(N%1000)/100;
    a=N/1000;
    if(a+b+c+d==7) cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;
    else if(a+b+c-d==7) cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;
    else if(a+b-c+d==7) cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;
    else if(a+b-c-d==7) cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;
    else if(a-b+c+d==7) cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<7<<endl;
    else if(a-b+c-d==7) cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7<<endl;
    else if(a-b-c+d==7) cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7<<endl;
    else if(a-b-c-d==7) cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7<<endl;
    return 0;
}


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

counts = [0] * 10001
for i in range(1, 101):
    for j in range(1, i + 1):
        for k in range(1, j + 1):
            result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if result > 10000:
                continue
            if i == j and j == k:
                counts[result] += 1
            elif i == j or j == k:
                counts[result] += 3
            else:
                counts[result] += 6

for n in range(1, N + 1):
    print(counts[n])

Measured memory_bytes: 9168
#include <iostream>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
    int n, total;
    int s[1000];
    while (true) {
        cin >> n;
        if (n == 0) {
            return 0;
        }
        for (int i=0; i<n; i++) {
            cin >> s[i];
        }
        sort(s, s+n);
        total = accumulate(s+1, s+n-1, 0);
        cout << total/(n-2) << endl;
    }
}

Measured memory_bytes: 1176
#include <stdio.h>
int main()
{
	int A1,A2,A3,hasil;
	scanf("%d",&A1);
	getchar();
	scanf("%d",&A2);
	getchar();
	scanf("%d",&A3);
	getchar();
	
	if(A1+A2+A3 >= 22 ){
		
		hasil = A1+A2+A3;
		
			printf("bust\n");
		
	}
	
	else
	{
		hasil = A1+A2+A3;
		
			printf("win\n");
	}
	
	
	
	return 0;
}

Measured memory_bytes: 1660
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <fstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second

#define MM INT_MAX/5
#define MIM INT_MIN/2

int di[] = { 1,-1,0,0 };
int dj[] = { 0,0,1,-1 };

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define v vector
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

#define MAX 3001

v<int> values;
ll dp[MAX][MAX];

int main()
{
	int N;
	cin >> N;
	values.assign(N, 0);
	for (int i = 0; i < N; i++)
		cin >> values[i];
	for (int i = 0; i < N; i++)
		dp[i][i] = values[i];
	for (int size = 2; size <= N; size++)
		for (int l = 0;  l + size - 1 < N; l++)
		{
			int r = size + l - 1;
			dp[l][r] = max(values[l] - dp[l + 1][r], values[r] - dp[l][r - 1]);
		}
	cout << dp[0][N - 1];
}


Measured memory_bytes: 70144
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {

	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	_, _ = fmt.Fscan(reader, &n)
	u := make([]int, n - 1)
	v := make([]int, n - 1)
	for i := 0; i < n - 1; i++ {
		_, _ = fmt.Fscan(reader, &u[i], &v[i])
	}
	ans := n * (n + 1) * (n + 2) / 6
	for i := 0; i < n - 1; i++ {
		if u[i] > v[i] {
			u[i], v[i] = v[i], u[i]
		}
		u[i]--
		ans -= (u[i] + 1) * (n - v[i] + 1)
	}
	_, _ = fmt.Fprintln(writer, ans)
}


Measured memory_bytes: 7540
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int s, w;
	cin >> s >> w;
	if(w >= s)
		cout << "unsafe" << endl;
	else cout << "safe" << endl;			
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false), cin.tie(0)
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; ++i)
    {
        int x;
        cin >> x;
        if (mp[x])
        {
            cout << "NO\n";
            return 0;
        }
        mp[x] = 1;
    }
    cout << "YES\n";
}

Measured memory_bytes: 9600
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int N, M;
	cin >> N >> M;
	vector<ll> A(N);
	for(int i=0;i<N;i++) cin >> A[i];
	
	map<ll, ll> d;
	ll tot = 0;
	for(int i=0;i<N;i++){
		tot += A[i]; tot %= M;
		d[tot]++;
	}
	
	ll ans = 0;
	tot = 0;
	for(int i=0;i<N;i++){
		ans += d[tot];
		tot += A[i]; tot %= M;
		d[tot]--;
	}
	
	cout << ans << endl;
	
	
	
	
	
    return 0;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner stdIn = new Scanner(System.in);

		long initA = stdIn.nextLong();
		long v = stdIn.nextLong();

		long initB = stdIn.nextLong();
		long w = stdIn.nextLong();

		long t = stdIn.nextLong();

		stdIn.close();

		if(v - w <= 0) {
			System.out.println("NO");
			return;
		}

		long dist = Math.abs(initB - initA);

		long diffSpeed = v-w;

		if(diffSpeed * t >= dist) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 35768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	fast_io();
	int n;
	cin >> n;
	vector<vector<int>> v(n + 1, vector<int>(3));
	fu(i,1,n)fu(j,0,2)cin >> v[i][j];
	vector<vector<int>> dp(n + 1, vector<int>(3));
	fu(i,1,n){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + v[i][0];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + v[i][1];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + v[i][2];
	}
	cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << '\n';
}


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

int main(){
  string s;
  cin >> s;
  if( (s.at(0) == s.at(1)) && (s.at(1) == s.at(2)) && (s.at(2) == s.at(3)) ){
    cout << "No" << endl;
  }
  else if( (s.at(0) == s.at(1) && s.at(2) == s.at(3)) ||
      (s.at(0) == s.at(2) && s.at(1) == s.at(3)) ||
      (s.at(0) == s.at(3) && s.at(1) == s.at(2)) ){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main() {
	int a, b, ab, x, y, ans=0;

	scanf("%d %d %d %d %d", &a, &b, &ab, &x, &y);

	if (a + b < ab * 2) {
		printf("%d\n", a * x + b * y);
	}
	else {
		ans += min(x, y) * ab*2;
		int work = (x < y ? x : y);
		x -= work; y -= work;
		if (y > 0) x = y, a = b;
		ans += min(x*a, x*ab*2);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll maxn = 1e2 + 20;
ll res , sum[7][maxn] , w[maxn] , v[maxn];
vector<ll> a[7];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n , V;
    cin >> n >> V;
    for(ll i = 0; i < n; i++)
        cin >> w[i] >> v[i] , a[w[i] - w[0]].pb(v[i]);
    for(ll i = 0; i < 4; i++)
        sort(a[i].begin() , a[i].end());
    for(ll i = 0; i < 4; i++)
        for(ll j = 0; j < a[i].size(); j++)
        {
            if(j)
                sum[i][j] = sum[i][j - 1] + a[i][j];
            else
                sum[i][j] = a[i][j];
        }
    for(ll i = 0; i <= a[0].size(); i++)
        for(ll j = 0; j <= a[1].size(); j++)
            for(ll z = 0; z <= a[2].size(); z++)
                for(ll k = 0; k <= a[3].size(); k++)
                {
                    if(w[0] * (i + j + z + k) + j + 2 * z + 3 * k > V)
                        continue;
                    ll s = 0;
                    for(ll k1 = 0; k1 < 4; k1++)
                    {
                        ll l;
                        if(k1 == 0)
                            l = i;
                        else if(k1 == 1)
                            l = j;
                        if(k1 == 2)
                            l = z;
                        if(k1 == 3)
                            l = k;
                        if(l != a[k1].size())
                            s += sum[k1][a[k1].size() - 1] - sum[k1][a[k1].size() - l - 1];
                        else
                            s += sum[k1][a[k1].size() - 1];
                    }
                    res = max(res , s);
                }
    cout << res;
    return 0;
}

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

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

typedef long long LL;
typedef unsigned long UL;

using namespace std;

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

    int x1, x2, x3, x4, y1, y2, y3, y4;

    cin >> x1 >> y1 >> x2 >> y2;

    x3 = (y1 - y2) + x2;
    y3 = -1 * (x1 - x2) + y2;

    x4 = -1 * (y2 - y1) + x1;
    y4 = (x2 - x1) + y1;

    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

    return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef long long lint;

int N, A, B, S;
lint h[100000];

bool able(lint C) {
	lint damage = C * B;
	for_(i,0,N) {
		if (h[i] <= damage) break;
		lint need = h[i] - damage;
		lint use = need / S + (need % S == 0 ? 0 : 1);
		C -= use;
		if (C < 0) return false;
	}
	return true;
}

int main() {
	cin >> N >> A >> B;
	S = A - B;
	
	for_(i,0,N) cin >> h[i];
	sort(h, h+N, greater< int >());
	
	lint lb = 0, ub = 1e9;
	while (ub - lb > 1) {
		lint med = (ub + lb) / 2;
		if (able(med)) ub = med;
		else lb = med;
	}
	cout << ub << endl;
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt();
		int D[] = {A+B, A-B, A*B};
		Arrays.sort(D);
		System.out.println(D[2]);
		sc.close();
	}

}

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

int main(void){
  int N;
  int buf,ans=0;
  cin >> N;
  vector<int> L;
  
  for(int i=0;i<2*N;i++){
    cin >> buf;
    L.push_back(buf);
  }
  
  sort(L.begin(),L.end());
  
  for(int i=2*N-1;i>0;i-=2){
    ans += L[i-1];
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    x,n = mi()
    p = li()
    for i in range(100):
        if not x-i in p:
            print(x-i)
            exit()
        elif not x+i in p:
            print(x+i)
            exit()



main()




Measured memory_bytes: 10028
LIMIT = 10**9

def solve():
    S = int(raw_input())
    c = S / LIMIT
    b = S % LIMIT
    x1minusx3 = LIMIT
    x2minusx3 = b
    y2minusy3 = c
    y1minusy3 = -1
    x3 = 0
    y3 = 1
    x1 = x1minusx3 + x3
    x2 = x2minusx3 + x3
    y1 = y1minusy3 + y3
    y2 = y2minusy3 + y3
    if S == 10**18:
        y3 = 0
        y1 = 0
        y2 = y2minusy3
    # print (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3)
    print x1, y1, x2, y2, x3, y3

if __name__ == '__main__':
    solve()


Measured memory_bytes: 28012
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

void solve() {
	int n, m, k;
    sc(n, m, k);
    fr(i, 0, n) {
        fr(j, 0, m) {
            int c = m * i + n * j - 2 * i * j;
            debug(i, j, c);
            debug(c);
            if(c == k) {
                cout << "Yes";
                return;
            }
        }
    }
    cout << "No";
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3616
import java.io.*;
import java.util.StringTokenizer;
import java.util.Arrays;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while ((buf = br.readLine())!=null) {
				StringTokenizer st = new StringTokenizer(buf,",");
				int card[] = new int[5];
				for (int i=0;i<5;i++) {
					card[i] = Integer.parseInt(st.nextToken());
				}
				Arrays.sort(card);
				if (isFourCard(card)) System.out.println("four card");
				else if (isFullHouse(card)) System.out.println("full house");
				else if (isStraight(card)) System.out.println("straight");
				else if (isThreeCard(card)) System.out.println("three card");
				else if (isTwoPair(card)) System.out.println("two pair");
				else if (isOnePair(card)) System.out.println("one pair");
				else System.out.println("null"); 
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static boolean isOnePair(int c[]) {
		if (c[0]==c[1]||c[1]==c[2]||c[2]==c[3]||c[3]==c[4]) return true;
		else return false;
	}

	public static boolean isTwoPair(int c[]) {
		if (c[0]==c[1]) {
			if (c[2]==c[3]||c[3]==c[4]) return true;
		} else if (c[1]==c[2]) {
			if (c[3]==c[4]) return true;
		}
		return false;
	}

	public static boolean isThreeCard(int c[]) {
		for (int i=0;i<3;i++) {
			if (c[i]==c[i+1]&&c[i+1]==c[i+2]) return true;
		}
		return false;
	}

	public static boolean isStraight(int c[]) {
		if (c[0]==1&&c[1]==10) {
			if (c[2]==11&&c[3]==12&&c[4]==13) return true;
		}
		for (int i=0;i<4;i++) {
			if (c[i]+1==c[i+1]) continue;
			else return false;
		}
		return true;
	}

	public static boolean isFullHouse(int c[]) {
		if (c[0]==c[1]&&c[1]==c[2]) {
			if (c[3]==c[4]) return true;
		} else if (c[2]==c[3]&&c[3]==c[4]) {
			if (c[0]==c[1]) return true;
		}
		return false;
	}

	public static boolean isFourCard(int c[]) {
		if (c[0]==c[1]&&c[2]==c[3]&&c[0]==c[2]) return true;
		else if (c[1]==c[2]&&c[3]==c[4]&&c[1]==c[3]) return true;
		else return false;
	}
}

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

using namespace std;

const int MAX_N = 2000, MAX_VAL = 1000000000;
long long INF = (long long)(MAX_VAL) * (long long)(MAX_N);

int n, x, a[MAX_N + 1], mina[MAX_N + 1][MAX_N];
long long ans;

int main() {
    cin >> n >> x;

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    for (int i = 1; i <= n; i++) {
        mina[i][0] = a[i];
    }

    for (int j = 1; j < n; j++) {
        for (int i = 1; i <= n; i++) {
            mina[i][j] = min(mina[i][j - 1], mina[(i + n - 2) % n + 1][j - 1]);
        }
    }

    ans = INF;
    for (int j = 0; j < n; j++) {
        long long anst = (long long)(j) * (long long)(x);
        for (int i = 1; i <= n; i++) {
            anst += mina[i][j];
        }

        ans = min(ans, anst);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15872
#include <stdio.h>
#define mod 1000000007
typedef long long ll;

ll exp(ll a, ll b) {
  ll ans = 1;
  while(b) {
    if(b & 1) ans *= a;
    a *= a, b >>= 1, a %= mod, ans %= mod;
  }
  return ans;
}

int main(void) {
  ll i, j, k, n, a;
  scanf("%lld", &n);
  ll f[n];
  for(i = 0; i < n; ++i) f[i] = 0;
  for(i = 0; i < n; ++i) scanf("%lld", &a), f[a]++;
  for(i = 0; i < n; ++i) {
    if(n & 1) {
     if(i & 1) {
       if(f[i]) {
         printf("0");
         return 0;
       }
     } else {
       if((i && f[i] != 2) || (!i && f[i] != 1)) {
         printf("0");
         return 0;
       }
     }
    } else {
     if(i & 1) {
       if(f[i] != 2) {
          printf("0");
          return 0;
        }
      } else {
        if(f[i]) {
          printf("0");
          return 0;
        }
      }
    }
  }
  printf("%lld", exp(2, n / 2));
  return 0;
 }

Measured memory_bytes: 896