akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
	priority_queue<pair<ll,int>>pq;
	rep(i, 0, A) {
		ll a; cin >> a;
		pq.push({ a,1 });
	}
	rep(i, 0, B) {
		ll a; cin >> a;
		pq.push({ a,2 });
	}
	rep(i, 0, C) {
		ll a; cin >> a;
		pq.push({ a,3 });
	}
	ll ans = 0, x = 0, y = 0, z = 0;
	while (x + y + z < X + Y) {
		auto num = pq.top();
		pq.pop();
		if (num.second == 1) {
			if (x + 1 > X)continue;
			else {
				ans += num.first;
				x++;
			}
		}
		else if (num.second == 2) {
			if (y + 1 > Y)continue;
			else {
				ans += num.first;
				y++;
			}
		}
		else {
			ans += num.first;
			z++;
		}
	}
	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 11616
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

p = int(input())
coeff = [int(i) for i in readline().split()]


def div(t,i): # a/(x-i)
    res = []
    while len(t) > 1:
        c = t.pop()
        t[-1] += c*i
        t[-1] %= p
        res.append(c)
    return res

ans = [0]*p
for i in range(p):
    res = div([0]+[-1]+[0]*(p-2)+[1],i)
#    print(res)
    for j,c in enumerate(res):
        ans[-j-1] += c*(-coeff[i])

for i in range(p):
    ans[i] %= p
    
print(*ans)






Measured memory_bytes: 53668
using System;

namespace AtcoderABC079AA
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            if (a[0] == a[1] && a[1] == a[2])
            {
                Console.WriteLine("Yes");
            }
            else if (a[1] == a[2] && a[2] == a[3])
            {
                Console.WriteLine("Yes");
            }
            else if (a[0] == a[1] && a[1] == a[2] && a[2] == a[3])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            Console.ReadKey();
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == ',') {
			cout << " ";
		}
		else {
			cout << s[i];
		}
	}
	cout << '\n';

	return 0;
}

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

using namespace std;

typedef long long ll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define mp make_pair
#define pb push_back
#define all(name) (name.begin(), name.end())
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) power(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;

class Dsu {
	vector<int> drr;
	vector<int> size_arr;
	public :
	Dsu (int n) {
		rep(i, 0, n+1){
			drr.pb(i);
			size_arr.pb(1);
		}
	}

	int f_p (int a) {
		return drr[a] == a ? a : f_p(drr[a]);
	}

	ll size (int a) {
		return (ll)size_arr[f_p(a)];
	}

	void uni(int a, int b) {
		int ap = f_p(a);
		int bp = f_p(b);
		if(ap == bp)return;
		if(!size_arr[ap] > size_arr[bp])swap(ap,bp);
		drr[bp] = ap;
		size_arr[ap] += size_arr[bp];
	}
};



vector<ll> ft(1, 1LL);
vector<bool> is_prime(1000000, 1);

void sieve();
ll power(ll x, ll y);

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--)
	{
		int n, x, y;
        cin >> n >> x >> y;
        int arr[n+1] = {0};
        for(int i = 1; i <= n; i++){
            for(int j = i + 1; j <= n; j++){
                arr[min(j-i, min(1 + abs(j-y) + abs(i-x), 1 + abs(j-x) + abs(i-y)))]++;
            }
        }
        for(int i = 1; i < n; i++)cout << arr[i] << endl;
	}
}
//
//
//
//
//
//important funct
ll power(ll x, ll y) {
    ll res = 1;x %= mod;
    while (y > 0) {
        if (y & 1)res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
void sieve(){
	is_prime[0] = is_prime[1] = 0;
	for(int i = 2; i*i <= 1000000; i++)
		if(is_prime[i])
			repc(j, i*i, 1000000, i)is_prime[j] = 0;
}

Measured memory_bytes: 384
a, b, c, x, y = gets.split.map &:to_i

# x shoud <= y
if x>y
  x, y = y, x
  a, b = b, a
end

ans = 0
if b>2*c
  ans += (y-x)*2*c
else
  ans += (y-x)*b
end
y = x

if a+b>2*c
  ans += 2*c*x
else
  ans += (a+b)*x
end
puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
long long modpow(long long a, long long n, long long mod=(1LL<<62)){
	long long res = 1;
	while (n > 0){
		if (n & 1)
		res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod                = 1e9 + 7;
const int MAX = 1001000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

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

long long COM(int n, int k){ // 二項係数:nCk計算
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	ll n;
	ll ans=0LL;
	COMinit();
	ll cnt = 0LL;
	ll cnt2 = 0LL;

	cin >> n;
	/*
	ans = modpow(10,n,mod);
	ans -= modpow(8, n,mod);
	ans %= mod;
	ans += mod;
	ans %= mod;
	*/
/*
	ans = n * (n - 1);
	ans %= mod;
	clog << ans << endl;
	
	ans *= modpow(10,n-2,mod);
	ans %= mod;
	*/
	for (int i = 2; i <= n; i++) {  // i;割り当てる0，9の総数
		cnt = modpow( 8,n-i,mod);//他は0,9以外
		cnt2 = modpow(2,i,mod);
		cnt2 += mod-2;//all 0, all 9
		cnt2 %= mod;
	//	clog << cnt << " "<< cnt2 << " " << COM(n, i) << endl;
		cnt = cnt % mod * cnt2 % mod * COM(n, i) % mod;
		//	clog << cnt << " " << cnt2 << endl;
		ans += cnt;
		ans %= mod;
	//	clog << ans << endl;
	}
	    if (n == 1) {
			ans = 0LL;
		}
	cout<<ans%mod<<endl;
}
/*
割り当てる者を考える
1: 0
2; 2
3 6*10
ooooo
*/

Measured memory_bytes: 27096
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

vector<int> G[100000];

int dfs(int cur){
	int ret = 0;
	vector<int> v;
	for(auto e:G[cur]){
		v.pb(dfs(e));
	}
	
	sort(all(v),greater<int>());
	for(int i=1;i<v.size()+1;i++){
		ret = max(i+v[i-1],ret);
	}
	
	return max<int>(ret,(int)G[cur].size());
}

int main(){
	int n;
	cin>>n;
	
	for(int i=1;i<n;i++){
		int a;
		cin>>a;
		a--;
		G[a].pb(i);
	}
	
	
	cout<<dfs(0)<<endl;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

int n;
int ans = 0;

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

    cin >> n;
    set<int> st;
    for(int i = 0; pow(9, i) <= 100000; i++) st.insert(pow(9, i));
    for(int i = 0; pow(6, i) <= 100000; i++) st.insert(pow(6, i));
    vector<int> vec;
    for(auto x: st) vec.pb(x);
    sort(all(vec), greater<int>());
    
    vector<int> dp(100500, INF);
    dp[0] = 0;
    for(int i = 0; i < vec.size(); i++){
        for(int j = vec[i]; j <= 100000; j++){
            dp[j] = min(dp[j], dp[j-vec[i]]+1);
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 640
N=int(input())
ans=1
R=[[0]*2 for _ in range(N)]
flag=0
for i in range(N):
    X,L=map(int,input().split())
    R[i][0]=X-L
    R[i][1]=X+L
R.sort(key = lambda x: x[1])
r=R[0][1]
for i in range(1,N):
    if r<=R[i][0]:
        ans+=1
        r=R[i][1]
print(ans)

Measured memory_bytes: 21288
from itertools import combinations
import math
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n = int(readline())
m = map(int,read().split())
points = [(x, y) for x, y in zip(m, m)]

if n == 2:
  [(a,b),(c,d)]=points
  print(math.hypot(a - c, b - d)/2)
  quit()


def center(a, b, c):
    M = pow(a[0], 2) - pow(b[0], 2) + pow(a[1], 2) - pow(b[1], 2)
    N = pow(a[0], 2) - pow(c[0], 2) + pow(a[1], 2) - pow(c[1], 2)
    Yab = a[1] - b[1]
    Xab = a[0] - b[0]
    Yac = a[1] - c[1]
    Xac = a[0] - c[0]
    d = Yac * Xab - Yab * Xac
    if d == 0:
        lst = [a, b, c]
        lst.sort()
        return ((lst[0][0] + lst[2][0]) / 2, (lst[0][1] + lst[2][1]) / 2,
                math.hypot(lst[0][0] - lst[2][0], lst[0][1] - lst[2][1]) / 2)
    x = (M * Yac - N * Yab) / (2 * d)
    y = - (M * Xac - N * Xab) / (2 * d)
    r = math.hypot(x - a[0], y - a[1])
    return (x, y, r)


centers = []
for a, b, c in combinations(points, 3):
    cen = center(a, b, c)
    centers.append(cen)

for a, b in combinations(points, 2):
    cen = ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2,
           math.hypot(a[0] - b[0], a[1] - b[1]) / 2)
    centers.append(cen)

res = 1000
for cx, cy, cr in centers:
    for x, y in points:
        tr = math.hypot(x - cx, y - cy)
        if tr > cr + 10e-6:
            break
    else:
        if cr < res:
            res = cr
print(res)

Measured memory_bytes: 6388
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    a = [list(input()) for _ in range(n)]
    b = [list(input()) for _ in range(m)]

    for i in range(n - m + 1):
        for j in range(n - m + 1):
            is_exist = True

            for dx in range(m):
                for dy in range(m):
                    if a[i + dx][j + dy] != b[dx][dy]:
                        is_exist = False

            if is_exist:
                print('Yes')
                exit()

    print('No')


Measured memory_bytes: 3064
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

long long n, k[100005], l[100005], ans = 1;
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) { cin >> k[i]; }
	sort(k, k + n);
	for (int i = 0; i < n; ++i) { l[i] = k[i]; }
	for (int i = 1; i < n; ++i) { l[i] += l[i - 1]; }
	for (int i = n - 2; i >= 0; --i) {
		if (2 * l[i] < k[i + 1]) { break; }
		++ans;
	}

	cout << ans << endl;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, B: "List[int]"):
    A = [0] * N
    A[0]=B[0]
    for i in range(1,N-1):
        A[i] = min(B[i-1],B[i])
    A[N-1]=B[-1]

    print(sum(A))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    B = [int(next(tokens)) for _ in range(N - 1)]  # type: "List[int]"
    solve(N, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 21404
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    vpllll conne[n];
    rep(i,0,n-1){
        ll u,v,w;
        cin>>u>>v>>w;
        u--,v--;
        pllll e=make_pair(u,w);
        conne[v].push_back(e);
        e.first=v;
        conne[u].push_back(e);
    }
    vll dist(n,INF);
    dist[0]=0;
    priority_queue<pllll,vpllll,greater<pllll>> q;
    q.emplace(0,0);
    ll cnt=0;
    while(cnt<n&&!q.empty()){
        pllll e=q.top(); q.pop();
        chmin(dist[e.second],e.first);
        cnt++;
        for(auto p:conne[e.second]){
            ll ndist=p.second+e.first;
            ll nidx=p.first;
            if(dist[nidx]!=INF)continue;
            q.emplace(ndist,nidx);
        }
    }
    rep(i,0,n){
        if(dist[i]%2==0)cout<<0<<endl;
        else cout<<1<<endl;
    }
    return 0;
}




Measured memory_bytes: 8704
# diverta2019-2B - Picking Up
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    arr = sorted(tuple(map(int, input().split())) for _ in range(n))
    cnt = {}
    for i in range(n):
        for j in range(i + 1, n):
            dif = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
            cnt.setdefault(dif, 0)
            cnt[dif] += 1
    print(n - max(cnt.values(), default=0))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  int n,k;
  cin>>n>>k;
  vecint a(n);
  for(auto&& e:a)cin>>e;
  vector<bool> dp(k+1);
  dp[0] = false;
  for(auto&& i:irange(1,k+1)) {
    bool win = false;
    for(auto&& e:a) {
      if (i-e >= 0 && dp[i-e] == false) win = true;
    }
    dp[i] = win;
  }
  if (dp[k]) {
    cout<<"First"<<endl;
  } else {
    cout<<"Second"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    writeln(n < 1000 ? "ABC" : "ABD");
}


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


int main() {
  int n;
  cin >> n;
  vector<int>a(n);  
  rep(i,n){
    cin>>a.at(i);
    a.at(i)--;
  }
  
  bool ex=false;
  int co=0;
  rep(i,n){
    int ans;
    ans=a.at(ans);
    co++;
    if(ans==1){     
      ex=true;
      break;
    }
  }
  if(ex){
    cout<<co<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  
}





Measured memory_bytes: 640
<?php
$str = trim(fgets(STDIN));
for($i = 0; $i < strlen($str); $i++){
    $map[$str[$i]] = 1;
}
$flag  = true;
if((isset($map["N"]) + isset($map["S"])) % 2 == 1)$flag = false;
if((isset($map["W"]) + isset($map["E"])) % 2 == 1)$flag = false;
echo $flag ? "Yes" : "No";

Measured memory_bytes: 4604
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	cout << max(0, abs(b - a) - w) << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;




int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	while (1) {
		ll N, M, P; scanf("%lld %lld %lld", &N, &M, &P);
		if (N == 0 && M == 0 && P == 0) break;
		ll res = 0;
		ll cnt = 0;
		ll sum = 0;
		for (ll i = 1; i <= N; i++) {
			ll x; scanf("%lld", &x);
			sum += 100 * x;
			if (i == M) cnt += x;
		}
		if (cnt == 0) res = 0;
		else res = sum * (100 - P) / (100 * cnt);
		printf("%lld\n", res);
	}
	return 0;
}


Measured memory_bytes: 3224
def main():
  n = int(input())
  p = list(map(int, input().split()))
  
  count = 0
  for i in range(1, len(p) - 1):
    if max(p[i-1], p[i], p[i+1]) != p[i] and min(p[i-1], p[i], p[i+1]) != p[i]:
      count += 1
      
  print(count)
  
main()

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;


int main(){
  ll a,b;double x;
  cin>>a>>b>>x;
  double s=x/a,ans;
  if(s*2<a*b){
    ans=atan(b*b/(s*2));
  }
  else{
    ans=atan((2*b-2*s/a)/a);
  }
  cout<<fixed<<setprecision(10)<<(ans*180)/M_PI<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;} return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){a=b; return true;} return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,D; cin >> N >> D;
    D=2*D+1;
    cout << (N+D-1)/D << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b) {a = b; return true;}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b) {a = b; return true;}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;

int main(){
    string s,t; cin >> s >> t;
    ll a,b; cin >> a >> b;
    string u; cin >> u;
    if(s==u) print2(a-1,b);
    else print2(a,b-1);
}

Measured memory_bytes: 256
def main
  a = gets.chomp.split(' ').map(&:to_i).first
  b = gets.chomp.split(' ').map(&:to_i).first

  if (a == 1 && b == 2 )||  (a == 2 && b == 1)
    puts 3
  elsif (a==1 && b== 3) || (a == 3 && b == 1)
    puts 2
  elsif (a == 2 && b == 3) || (a == 3 && b == 2)
    puts 1
  end
end

main


Measured memory_bytes: 1788
import java.util.Scanner;
	class Main{
		public static void main(String[]args){
            
            
        Scanner sc=new Scanner(System.in);
            int a,b,c,d;
            int i;
            a=sc.nextInt();
            b=sc.nextInt();
            c=sc.nextInt();
				if(a>b){
                    d=a;
                    a=b;
                    b=d;
                }
           		if(a>c){
                    d=a;
                    a=c;
                    c=d;
                }
                if(b>c){
                    d=b;
                    b=c;
                    c=d;
                }
         	System.out.println(a+" "+b+" "+c);
        }
    }


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  ll n;cin>>n;
  ll a[n+10];
  ll odd=0;
  rep(i,n){
    cin>>a[i];
    if(a[i]%2==1)odd++;
  }
  if(odd%2==0){
    out("YES");
  }
  else out("NO");

  return 0;
}


Measured memory_bytes: 1152
import sys
N = int(input())
Nlen = len(str(N))
ans = 0
if Nlen == 1:
    ans = N
elif Nlen == 2:
    ans = 9
elif Nlen == 3:
    ans = 9+N-99
elif Nlen == 4:
    ans = 9+900
elif Nlen == 5:
    ans = 9+900+N-9999
elif Nlen == 6:
    ans = 9+900+90000
print(ans)


Measured memory_bytes: 9032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5e3+5;
const int INF = 0x3f3f3f3f;

int main()
{
    int n;
	cin >> n;
	cout << (n+1)/2 << endl; 
    return 0;
}

Measured memory_bytes: 256
/**
 * @Author:      G_bg
 * @DateTime:    2019-07-30 11:28:59
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> ii;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn = 1e5+10;
LL k,x,y;
vector<ii> v;
bool solve(LL x,LL y){
    if(k%2 == 0 && (x+y)%2 != 0) return false;
    LL cx = 0,cy = 0;
    while((x-cx) >= k && (x-cx)+(y-cy) > 2*k){
        cx += k;
        v.push_back(ii(cx,cy));
    }
    while((y-cy) >= k && (x-cx)+(y-cy) > 2*k){
        cy += k;
        v.push_back(ii(cx,cy));
    }
    if(cx == x && cy == y) return true;
    if(x-cx+y-cy == k){
        v.push_back(ii(x,y));
        return true;
    }
    LL yu = x-cx+y-cy;
    if(yu%2){
        if(x-cx >= y-cy){
            LL t = min(k,x-cx);
            cx += t,cy -= (k-t);
        }else{
            LL t = min(k,y-cy);
            cx -= (k-t),cy += t;
        }
        v.push_back(ii(cx,cy));
    }
    yu = x-cx+y-cy;
    if(yu > 0){
        LL t = yu/2;
        if(x-cx >= t)
            cx += t,cy -= (k-t);
        else cy += t,cx -=(k-t);
        v.push_back(ii(cx,cy));
        v.push_back(ii(x,y));
    }
    return true;
}
int main(int argc, char const *argv[]) {
    ios::sync_with_stdio(0);cin.tie(0);
    cin >> k >> x >> y;
    if(solve(abs(x),abs(y))){
        cout << v.size() << endl;
        for(int i = 0;i < v.size();i++){
            if(x < 0) v[i].first *= -1;
            if(y < 0) v[i].second *= -1;
            cout << v[i].first << " " << v[i].second << endl;
        }
    }else cout << -1 << endl;
    //system("pause");
    return 0;
}

Measured memory_bytes: 6384
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, K = lr()
    A = np.sort(np.array(lr(), np.int64))
    z = A[A == 0]
    p = A[A > 0]
    n = A[A < 0]
    
    def count_func(x):
        cnt = 0
        if x >= 0:
            cnt += len(z) * N
        cnt += np.searchsorted(A, x // p, side='right').sum()
        cnt += (N - np.searchsorted(A, -(-x // n), side='left')).sum()
        cnt -= np.count_nonzero(A * A <= x)
        assert cnt % 2 == 0
        return cnt // 2
    
    l = -10 ** 18
    r = 10 ** 18
    while l + 1 < r:
        x = (l + r) // 2
        if count_func(x) >= K:
            r = x
        else:
            l = x
    
    print(r)
resolve()

Measured memory_bytes: 32324
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val ss = Array.fill(n) {
      in.readLine()
    }

    var count = ss.foldLeft(0) {
      case (acc, s) => acc + s.foldLeft((0, false)) {
        case ((acc, stat), c) => if (c == 'A') {
          (acc, true)
        } else if (stat && c == 'B') {
          (acc + 1, false)
        } else {
          (acc, false)
        }
      }._1
    }

    var ab = ss.count(s => s.startsWith("B") && s.endsWith("A"))
    var a = ss.count(s => !s.startsWith("B") && s.endsWith("A"))
    var b = ss.count(s => s.startsWith("B") && !s.endsWith("A"))
    var continuous = true

    while (continuous) {
      if (a > 0 && ab > 0) {
        val diff = Math.min(ab, a)
        ab -= diff
        count += diff
      } else if (b > 0 && ab > 0) {
        val diff = Math.min(ab, b)
        ab -= diff
        count += diff
      } else if (a > 0 && b > 0) {
        val diff = Math.min(a, b)
        a -= diff
        b -= diff
        count += diff
      } else if (ab > 1) {
        count += ab - 1
        ab = 1
      } else {
        continuous = false
      }
    }

    out.println(count)

    out.flush()
  }
}


Measured memory_bytes: 34064
#include<iostream>
using namespace std;
#include<string>
int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] == 'L') {

			cout << "No";
			return 0;
		}

	}

	for (int i = 1; i < s.size(); i += 2) {
		if (s[i] == 'R') {

			cout << "No";
			return 0;
		}

	}

	cout << "Yes";
    return 0;
}


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

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

  char a, b;
  cin >> a >> b;

  if (a < b) cout << "<\n";
  else if (a > b) cout << ">\n";
  else cout << "=\n";

  return (0);
}


Measured memory_bytes: 3616
// Debug : debug template
// Number : number theory 

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define pi pair<int,int>
#define IOS ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);

const int inf = 0x3f3f3f3f;
const ll INF = 0xFFFFFFFFFFFFFFFL;

typedef tree<int,null_type, /*greater<int>,*/
less<int>,rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// find_by_order() and order_of_key() returns pointers
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)

void solve(){
	// your main solution for each testcase
	int type;
	cin >> type;
	if(type==1){
		cout << "Hello World\n";
	}
	else{
		int a,b;
		cin >> a >> b;
		cout << a+b << "\n";
	}
}

int main(){
	IOS;
	int test=1;
	// cin >> test;
	while(test--)
		solve();

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b,i,j;
  while(1)
    {
  scanf("%d %d",&a,&b);
  if(a == 0 && b == 0){
      break;
  }
  for(i = 1; i <= a; i++)
    {
      for(j = 1; j <= b; j++)
 {
   if(j % 2 == 1){
       if(i % 2 == 1)
       printf("#");
       else 
       printf(".");
     }
   else 
     {
              if(i % 2 == 1)
              printf(".");
       else 
       printf("#");
     }
 }
      printf("\n");
    }
  printf("\n");
    }
  return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int h[500000],n;
void maxheapify(int i){
  int l = i*2+1;
  int r = (i+1)*2;
  int largest=0;
  if(l<=n&&h[l]>h[i])largest=l;
  else largest=i;
  if(r<=n&&h[r]>h[largest])largest=r;
  if(largest!=i){
    swap(h[i],h[largest]);
    //cout<<"finished"<<endl;
    maxheapify(largest);
  }
}
void buildmaxheap(){
  int i;
  for(i=n/2;i>=0;i--){
    maxheapify(i);
  }
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>h[i];
  buildmaxheap();
  for(int i=0;i<n;i++)cout<<" "<<h[i];
  cout<<endl;
  
  return 0;
}



Measured memory_bytes: 5080
#include <iostream>
#include <cstdint> 
#include <vector>
#include <algorithm>
#include <numeric>
 
using namespace std;
 
int main(){
    int n;
    cin >> n;
    
    vector<int> score(n);
       
    for(int i = 0; i < n; ++i){
        cin >> score[i];
    }
    
    const int sum = std::accumulate(begin(score), end(score), 0);
    
    if(sum % 10 != 0){
        cout << sum << endl;
        return 0;
    }
    
    int min_key = sum;
    for(int s : score){
        if(s % 10 != 0 && s < min_key) min_key = s;
    }
    
    cout << sum - min_key << endl;   
 
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    Vec b(n);
    cin>>b;
    Vec a;
    while(true){
        bool clear = false;
        per(i,b.size()-1LL){
            if(b[i]==i+1){
                a.pb(i+1);
                b.erase(b.begin()+i);
                clear = true;
                break;
            }
        }
        if(b.size()==0LL)break;
        if(!clear)break;
    }
    if((ll)a.size()!=n){
        cout<<-1<<endl;
        return 0;
    }
    reverse(ALL(a));
    rep(i,n){
        cout<<a[i]<<endl;
    }
    return  0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  st s, t;
  ll a, b;
  st u;
  cin >> s >> t >> a >> b >> u;
  cout << (s == u ? a - 1 : a) << " " << (s == u ? b : b - 1) << endl;
}

Measured memory_bytes: 256
S = input()
n = len(S)

tot = 0

for i in range(2**(n-1)):
  f = S[0]
  for j in range(n-1):
       if ((i >> j) & 1):
        f += " "
       f += S[j+1]
  
  tot += sum(map(int, f.split(" ")))

print(tot)

Measured memory_bytes: 8952
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int total = 700;
		for (int i = 0; i < 3; i++) {
			if (s.charAt(i) == 'o') {
				total += 100;
			}
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 21204
//Ring
#include <iostream>
#include <string>

using namespace std;

int main() {
    string base, str;
    int N;
    cin >> base;
    cin >> N;

    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cin >> str;
        for(int j = 0; j < base.size(); j++) str += str[j];
        int pos = 0;
        int bpos = 0;
        while(pos < str.size() && bpos < base.size()) {
            if(str[pos + bpos] == base[bpos]) {
                bpos++;
            } else {
                pos++;
                bpos = 0;
            }
        }
        if(bpos == base.size()) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3208
let line = readLine()!.split(separator: " ").map({Int($0)!})
var (A, B, C, D) = (line[0], line[1], line[2], line[3])
while A > 0 && C > 0 {
    C -= B
    A -= D
    if C <= 0 {
        print("Yes")
    } else if A <= 0 {
        print("No")
    }
}


Measured memory_bytes: 8236
import java.util.Scanner;

/**
 * Created by khrom on 2017/06/17.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        for (int i = 3; i <= input; i++) {
            if (i % 3 == 0 || String.valueOf(i).contains("3")) System.out.print(" " + i);
        }
        System.out.println();
    }
}

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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,start,end) for(int i=(start);i<=(end);i++)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	a = (b - (b % a)) / a;
	int ans = (a < c) ? a : c;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin >> s;
    int ans[2] = {};
    rep(i, 0, sz(s)) {
        int x = s[i] == '1';
        if (x != i % 2) {
            ans[0]++;
        } else {
            ans[1]++;
        }
    }
    cout << min(ans[0], ans[1]) << endl;
    return (0^_^0);
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])
	{
		cout<<"Yes";
	 } 
	 else
	 {
	 	cout<<"No";
	 }
	 return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int b[100];
  REP(i, n-1) {
    cin >> b[i];
  }

  int ans = 0;
  REP(i, n) {
    if(i == 0) {
      ans += b[i];
    } else if(i == n - 1) {
      ans += b[i-1];
    } else {
      ans += min(b[i-1], b[i]);
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <map>

using namespace std;

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

  long long m = 500 * k;

  if(m >= x){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Split(' ').Select(x=>long.Parse(x)).ToArray();
            var N = t[0];
            var Y = t[1];

            for (int x = 0; x <= N; x++)
            {
                for (int y = 0; y <= N-x; y++)
                {
                    if (9000 * x + 4000 * y < Y - 1000 * N)
                    {
                        continue;
                    }
                    else if (9000 * x + 4000 * y == Y - 1000 * N)
                    {
                        Console.WriteLine("{0} {1} {2}", x, y, N - x - y);
                        return;
                    }
                    else
                    {
                        break;
                    }
                }                
            }

            Console.WriteLine("{0} {1} {2}", -1, -1, -1);
            
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define en         cout<<endl;
#define pb         push_back
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long

int main()
{
    ll t,n,c,res;
    ci>>n;
    string a;
    ci>>a;
    if(a.size()<=n) co<<a;
    else
    {
        string b=a.substr(0,n)+"...";
        co<<b;
    }
}






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


ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}

int main()
{
    ll a,b;
    cin >> a >> b;
    ll ans = 1;
    if (a < b){
        swap(a, b);
    }
    ll x = gcd(a,b);
    ll num = x;
    for(ll i = 2; i * i <= x; i++){
        if(num % i == 0){
            while(num % i == 0){
                num /= i;
            }
            ans++;
        }
    }
    if(num != 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn=1e5+1;
vector<ll> gr[maxn];
ll dp[maxn];
bool vis[maxn];
ll ans,i,m,n,u,v,j;
void dfs(ll node)
{
    vis[node]=true;
    for (auto i:gr[node])
    {
        if (!vis[i]) dfs(i);
        dp[node]=max(dp[node],1+dp[i]);
    }
}
long long find_l()
{
    memset(vis,false,sizeof(vis));
    for (i=1;i<=n;i++) if (!vis[i]) dfs(i);
    ans=0;
    for (i=1;i<=n;i++) ans=max(ans,dp[i]);
    return ans;
}
int main()
{
    cin>>n>>m;
    for (i=1;i<=m;i++)
    {
        cin>>u>>v;
        gr[u].push_back(v);
    }
    cout<<find_l()<<endl;
}


Measured memory_bytes: 12640
import java.util.Scanner;
/**
 * 2018-04-14
 * https://beta.atcoder.jp/contests/abc094/tasks/abc094_b
 */
public class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        int  N = sc.nextInt();
        int  M = sc.nextInt();
        int  X = sc.nextInt();
        int[]A = new int[M];

        for (int i =0; i < M ; i++){
            A[i]= sc.nextInt();
        }

        int chargeZero =0;
        int chargeN=0;

        for (int n = 0; n < A.length ; n++){
            if(A[n]<X){
                chargeZero++;
            }else{
                chargeN++;
            }
        }

        System.out.println(Math.min(chargeZero,chargeN));


    }
}


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

int main() {
	int A,B,C,K;
  	cin>> A >> B >> C >> K;
  
  	if(K<A){
     	cout<<K<<endl; 
    }
  	else if(A<=K && K<A+B){
     	cout<<A<<endl; 
    }
  	else{
     	cout<<A-K+(A+B)<<endl; 
    }
}

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

int main()
{
    long long n, k;
    std::cin >> n >> k;

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    const int mod = 1000000007;
    long long p = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            if (a[i] > a[j]) {
                p++;
                p %= mod;
            }
        }
    }

    p *= k;
    p %= mod;

    long long q = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                q++;
                q %= mod;
            }
        }
    }

    q *= (k * (k - 1) / 2 % mod);
    q %= mod;

    long long ans = p + q;
    ans %= mod;
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256