akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int X;
    cin >> X;
    
    vector<int> yasui = {100, 101, 102, 103, 104, 105};
    vector<int> dp(X + 1, 0);
    dp[0] = 1;
    rep(i, X + 1) rep(j, 6) {
        if (i + yasui[j] <= X) {
            if (dp[i]) dp[i + yasui[j]] = 1;
        }
    }
    cout << dp[X] << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int N;
long long int A[200005];

vector<long long int >V, W;

int main(void) {
	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		V.push_back(-i - A[i]);
		W.push_back(i - A[i]);
	}

	long long int ans = 0;

	sort(V.begin(), V.end());
	sort(W.begin(), W.end());

	for (int i = 1; i <= N; i++) {
		ans += upper_bound(V.begin(), V.end(), A[i] - i) - lower_bound(V.begin(),V.end(), A[i] - i);
		ans += upper_bound(W.begin(), W.end(), A[i] + i) - lower_bound(W.begin(), W.end(), A[i] + i);
	}
	cout << ans/2 << endl;

	return 0;
}

Measured memory_bytes: 8124
c,v,d,f,a="w kstnhmyr","aiueo",["T","L","U","R","D"],"",input()
for i in range(0,len(a),2):
    b=int(a[i])
    e=d.index(a[i+1])
    if b==0 and e==2: f+='nn'
    elif b==1: f+=v[e]
    else:f+=c[b]+v[e]
print(f)

Measured memory_bytes: 7696
a, b, c, x, y = map(int, input().split())
result = 0
if a+b > 2*c:
    if x > y:
        result += 2*c*y
        if a > 2*c:
            result += 2*c*(x-y)
        else:
            result += a*(x-y)
    else:
        result += 2*c*x
        if b > 2*c:
            result += 2*c*(y-x)
        else:
            result += b*(y-x)
else:
    result += a*x + b*y
print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 2019;
const int MAXN = 1e5+5;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	vector<int> sum(1e5+5, 0);
	for(int &i : v) {
		cin >> i;
		sum[i]++;
	}
	for(int i = 1; i < MAXN; i++)
		sum[i] += sum[i-1];
		
	int ans = 0;
	for(int i = 1; i < MAXN; i++)
		if(sum[i] == n/2) ans++;
	cout << ans << endl;
	
}



Measured memory_bytes: 1152
// finish date: 2018/01/27
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define bigmod 1000000007
#define INF 1050000000


int main() {
    int N, A;
    cin >> N >> A;
    vi x(N);
    rep(i, N) {
        cin >> x[i];
        x[i] -= A;
    }
    vvl DP(N + 1, vl(5001, 0));
    DP[0][DP[0].size() / 2] = 1;
    rep(i, N) {
        rep(j, 5001) {
            DP[i + 1][j] += DP[i][j];
            DP[i + 1][j + x[i]] += DP[i][j];
        }
    }
    cout << DP[N][DP[0].size() / 2] - 1 << endl;

    return 0;
}



Measured memory_bytes: 2304
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

l = []
for i in range(x):
    for j in range(y):
            l.append(a[i] + b[j])

l = sorted(l,reverse=True)
ll = []
for i in range(min(len(l),k)):
    for j in range(z):
        ll.append(l[i] + c[j])

ll = sorted(ll,reverse=True)
for i in range(k):
    print(ll[i])


Measured memory_bytes: 148864
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int u = 0;
	int n = 0;
	scanf("%d", &u);
	int arr[100][100] = { 0 };
	
	for (int i = 0; i < u; i++)
	{
		int k = 0;
		scanf("%d", &k);
		scanf("%d", &n);
		while (n--)
		{
			int v = 0;
			scanf("%d", &v);
			arr[k - 1][v - 1] = 1;
		}
	}	
	for (int i = 0; i < u; i++)
	{
		for (int j = 0;  j < u; j++)
		{
			if (j == u - 1){
				printf("%d\n", arr[i][j]);
				break;
			}
			printf("%d ", arr[i][j]);
		}
	}
}


Measured memory_bytes: 2144
# coding: utf-8
# Your code here!
n,H=map(int,input().split())
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])

maxa=max(a)    
for i in range(n):
    if(maxa<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
lenb=len(b)
while H>0:
    if lenb>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//maxa
        if(H%maxa!=0):
            count+=1
        H=0

print(count)


Measured memory_bytes: 29332
// TOPSIC001_0

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;


int main(){
    double N,T,A; cin >> N >> T >> A;
//    T *= 1000;

    vi H(N); REP(i, N) cin >> H.at(i);

    double ans,temp = 10000;
    REP(i,N){
        double tm = abs((T - H.at(i) * 0.006) - A);
        if(tm  < temp){
            ans = i;
            temp = tm;
        }
    }

    cout << ans + 1;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int a,b,c;
    std::cin >> a >> b >> c;
    
    int cnt =0;
    for(int i=a;i<=b;i++)
    {
        if(c%i == 0)
            cnt++;
    }
    
    std::cout << cnt << std::endl;
}


Measured memory_bytes: 3104
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    size_t N, X, L[100];

    scanf("%zu %zu\n", &N, &X);
    for (size_t i = 0; i < N; i++) {
        scanf("%zu", &(L[i]));
        if (i < N - 1) {
            scanf(" ");
        }
    }

    size_t sum = 0;
    size_t cnt = 0;
    while(true) {
        sum += L[cnt];
        if (X < sum) {
            break;
        }
        cnt++;
    }

    printf("%zu", cnt + 1);

    return 0;
}


Measured memory_bytes: 128
from collections import deque

n,m = map(int,input().split())

V =[deque([]) for _ in range(n)]
color = [0 for _ in range(n)]

for _ in range(m):
    a,b = map(int,input().split())
    V[a].append(b)
    V[b].append(a)

friend = 1

def dfs(u,f):
    global color
    color[u] = f
    stack = []
    stack.append(u)
    while len(stack) != 0:
        now = stack[-1]
        # print(now,V,color)
        if len(V[now]) != 0:
            nb = V[now].popleft()
            if color[nb] == 0:
                stack.append(nb)
                color[nb] = f
        else :
            stack.pop()

# print("")

for i in range(n):
    if color[i]==0:
        dfs(i,friend)
        friend += 1

# print("")
# print(V)
# print(color)
q = int(input())
for _ in range(q):
    a,b = map(int,input().split())
    if color[a] == color[b]:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 78256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
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; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}

int main ()
{
    int D,N;cin>>D>>N;
    ll ans;
    if(N==100){
        ans = pow(100,D)*101;
    }else{
        ans = pow(100,D)*N;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s.size()%2){
        no;
        return 0;
    }
    for(int i=0;i<s.size();i+=2){
        if(s[i]=='h'&&s[i+1]=='i'){

        }
        else{
            return no,0;
        }
    }
    yes;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
typedef long long lli;
const lli INF = 1e18 + 18;
lli n;

void ReadInput()
{
    cin >> n;
}

void Solve()
{
    lli ans = INF;
    for(int i = 1; 1LL * i * i <= n; ++i)
        if(n % i == 0)
        {
            lli j = n / i;
            ans = min(ans, (lli)i + j - 2);
        }
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<limits.h>
#include<stack>
#include<string>
using namespace std;

struct Vertex{
	int deg;
	vector<int> adj;
	int checked;
	int parent;
};

int out(vector<int> &A){
	int n=A.size();
	int i;
	if (n==0){
		cout << "nothing" <<endl;
	}else if(n==1){
		cout << A[0] << endl;
	}else{
		for (i=0;i<=n-2;i++){
			cout << A[i] << " ";
		}
		cout << A[n-1] <<endl;
	}
}

int Next(vector<Vertex> &L,vector<int> &d, vector<int> &f, int cur, int count){
	int next,i,v;
	if(L[cur].deg==0){
		next=L[cur].parent;
		f[cur]=count;
		return next;
	}
	
	for (i=0;i<L[cur].deg;i++){
		v=L[cur].adj[i];
		if(L[v].checked==0){
			break;
			}
		}
		if(i==L[cur].deg){
			next=L[cur].parent;
			f[cur]=count;
		}else{
			next=v;
			L[next].parent=cur;
			L[next].checked=1;
			d[next]=count;
		}
	return next;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,i,j;
	cin >> n;
	
	vector<Vertex> L(n);
	vector<int> d(n);
	vector<int> f(n);
	
	int id,de,v;
	for (i=0;i<n;i++){
		cin >> id >> de;
		L[id-1].deg=de;
		for (j=0;j<de;j++){
			cin >> v;
			L[id-1].adj.push_back(v-1);
		}
		L[id-1].checked=0;
		L[id-1].parent=-1;
	}
	
	int cur=0;
	int next,count=0;
	
	while(1){
		count++;
		for (i=0;i<n;i++){
			if(L[i].checked==0){
				break;
			}
		}
		if (i==n){
			break;
		}
		L[i].checked=1;
		d[i]=count;
		cur=i;
		while(1){
			count++;
			next=Next(L,d,f,cur,count);
			if (next==-1){
				break;
			}
			cur=next;
		}
		}
	for (i=1;i<n+1;i++){
		cout << i << " " << d[i-1] << " " << f[i-1] <<endl;
	}
	return 0;
}
	

Measured memory_bytes: 1224
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
ll a[10001];
int b[1000001];
ll mod = 1e9 + 7;

ll go(ll x, ll y) {
    if (y == 0)return 1;
    else if (y == 1)return x % mod;
    if (y & 1) {
        return (x * go(x, y - 1)) % mod;
    }
    else {
        ll tmp = go(x, y / 2);
        return (tmp * tmp) % mod;
    }
}

ll gcd(ll x, ll y) {
    if (y == 0)return x;
    else return gcd(y, x % y);
}

int main() {
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        int t = a[i];
        for (int j = 2; j * j <= t; j++) {
            int cnt = 0;
            while (t % j == 0) {
                cnt += 1; t /= j;
            }
            b[j] = max(b[j], cnt);
        }
        b[t] = max(b[t], 1);
    }

    ll ret = 1;
    for (int i = 1; i <= 1000000; i++) {
        if (b[i]) {
            ret *= go(i, b[i]); ret %= mod;
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll tmp = ret * go(a[i], mod - 2); tmp %= mod;
        ans += tmp; ans %= mod;
    }
    cout << ans << '\n';




}


Measured memory_bytes: 2944
#include <iostream>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main() {
int flag=1;
char str;
cin>>str;
string vowel = "oaiue";
for(int i=0;i<vowel.size();i++){
    if(str==vowel[i]){
        flag=0;
        break;}
}
if(flag==0){
    cout<<"vowel";
}
else
    cout<<"consonant";
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);


int main() {
	int ans = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		ans += s[i] - '0';
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
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*2];  
  
  for(int i=0; i<l.length; i++){
   l[i]=sc.nextInt();
}

sc.close();
  Arrays.sort(l);
  
  int ans=0;
  for(int j=0; j<l.length; j+=2){
    ans +=Math.min(l[j],l[j+1]);
}
System.out.println(ans);


}}

Measured memory_bytes: 9684
//include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <utility>
#include <string>
#include <set>
#include <map>
#include <cassert>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pf push_front
#define pof push_front
#define pb push_back
#define pob pob_back
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_(i, n) for (int i = n; i >= 0; i--)
#define FOR1(i, n) for(int i = 1; i <= n; i++)
#define FOR2(i, a, b) for (int i = a; a <= b; i++)
#define FOR2_(i, b, a) for (int i = b; i >= a; i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#ifdef momo
#define  debug(...) do{\
fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_do(__VA_ARGS__);\
}while(0)
template<typename t> void _do(t &&_x){cerr<<_x<<endl;}
template<typename t,typename ...T> void _do(t &&_x,T &&...tail){cerr<<_x<<", ";_do(tail...);}
#else
#define debug(...)
#endif


const int MXN = 8 + 5;

int N, M;

vector<int> E[MXN];

bool vis[MXN];

int dfs(int now, int cnt) {
    //cout << now << '\n';
    vis[now] = true;
    if (cnt == N) {
        vis[now] = false;
        return 1;
    }
    int ans = 0;
    for (int i : E[now]) if (!vis[i])
        ans += dfs(i, cnt+1);
    vis[now] = false;
    return ans;
}

int main(void)
{
    IOS;
    
    cin >> N >> M;
    FOR(i, M) {
        int a, b; cin >> a >> b;
        E[a].pb(b), E[b].pb(a);
    }
    cout << dfs(1, 1) << endl;
    return 0;
}

Measured memory_bytes: 256
n, y = (int(x) for x in input().split())
ans = 0
m = y // 10000 + 1
for i in reversed(range(m)):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            ans = [i, j, n-i-j]
            break
    if ans != 0:
        break
if ans == 0: print(*[-1, -1, -1])
else: print(*ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>

using namespace std;

int main() {
    string data;
    getline(cin, data);
    if (data.find("A") != string::npos && data.find("B") != string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
int N;
long int Y;
cin >>N >> Y;
int x,y,z;
x=Y/10000;
y=Y/5000;
z=Y/1000;
int l,ans=0;


    for(int i=0;i<=x;i++){
        ans=0;
        for(int k=0;i+k<=N;k++){
            l=N-i-k;
            if(10000*i+5000*k+1000*l==Y){
                ans++;
                y=k;
                break;
            }
        }
        if(ans>0){
            cout <<i<<" "<<y<<" "<<l<<endl;
            break;
        }
        
    }

if(ans==0 ||Y>10000*N || Y<1000*N){
    x=-1;
    y=-1;
    z=-1;
    cout <<x<<" "<<y<<" "<<z<<endl;
}


 return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<stack>

using namespace std;
const int maxn=1e6+5;
typedef long long ll;
char str[maxn];
int main(){
    scanf("%s",str+1);
	int len=strlen(str+1);
    ll ans=0;
	str[0]='0';
	for(int i=len;i>=1;i--){
	   int x=str[i]-'0';
       if(x<5){
		   ans+=x;
	   }
	   else if(x==5){
		   if(str[i-1]-'0'>=5){
			   ans+=10-x;
			   str[i-1]++;
		   }
		   else{
			   ans+=x;
		   }
	   }
	   else{
		   ans+=10-x;
		   str[i-1]++;
	   }
	}
	ans+=str[0]-'0';
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    cin >> N >> K;
    cout << (K <= (N + 1) / 2 ? "YES" : "NO") << endl;
}


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

using namespace std;

struct Dsu {
    int n;
    vector<int> p;
    
    Dsu(int _n) { n = _n; p.resize(n); init(); }
    inline void init() {
        for (int i = 0; i < n; i++) {
            p[i] = i;
        }
    }
    inline int find(int x) {
        return p[x] == x ? x: p[x] = find(p[x]);
    }
    inline bool join(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        p[y] = x; return true;
    }
    inline bool check(int x, int y) {
        return find(x) == find(y);
    }
};

void solve() {
    int n,m;
    cin >> n >> m;
    vector<pair<int, int>> e(m);
    for (int i = 0; i < m; i++) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        e[i]= {x,y};
    }
    int cnt = 0;
    for (int i = 0; i < m; i++) {
        Dsu d(n);
        for (int j = 0; j < m; j++) {
            if (j!=i) {
                int x,y;
                tie(x,y) = e[j];
                d.join(x,y);
            }
        }
        int x,y;
        tie(x,y) = e[i];
        if (!d.check(x,y)) cnt++;
    }
    cout << cnt;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(a>=k){
        ans+=k;
        k=0;
    }else{
        ans+=a;
        k-=a;
    }
    if(k){
        if(b>=k){
            //ans-=k;
            k=0;
        }else{
            //ans-=b;
            k-=b;
        }
    }
    if(k){
        if(c>=k){
            ans-=k;
            k=0;
        }else{
            ans-=c;
            k-=c;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
def digit_sum(n:int) -> int:
    res = n
    ans = 0
    while res > 0:
        ans = ans + res%10
        res //= 10
    
    return ans

def keta(n:int) -> int:
    res = n
    ans = 0
    while res > 0:
        ans += 1
        res //= 10
    return ans

n = int(input())
n_keta = keta(n)

ans = 0
if n >= 2*10**(n_keta-1):
    ans = n // 10**(n_keta-1) - 1
    ans += 9 * (n_keta-1)
    
elif n == 2*10**(n_keta-1) - 1:
    ans = digit_sum(n)
    
else:
    ans = 9 * (n_keta-1)
    
ans = max(ans, digit_sum(n))
print(ans)

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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;
  bool f = true;
  for(int i = 0; i < a; i++){
    if(!isdigit(s[i])){
      f = false;
    }
  }

  // if(!("-" == s.substr(a,1))){
  //  f = false;
  // }

  if(!('-' == s[a])){
    f = false;
  }

  for(int i = a+1; i < a+b; i++){
    if(!isdigit(s[i])){
      f = false;
    }
  }

  if(f){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>

int main(){

  while(true){
    int a, b;
    char op;
    std::cin >> a;
    std::cin >> op;
    std::cin >> b;

    if(op == '?'){
      break;
    }else if(op == '+'){
      std::cout << (a + b) << std::endl;
    }else if(op == '-'){
      std::cout << (a - b) << std::endl;
    }else if(op == '*'){
      std::cout << (a * b) << std::endl;
    }else if(op == '/'){
      std::cout << (a / b) << std::endl;
    }
  }
  
  return 0;
}



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

void fnInput(vector<int>& rvnNum)
{
  for (int& rnElm : rvnNum)
    cin >> rnElm;
}

int fnSameIntTimes(const vector<int>& cnrvnNum)
{
  auto itMaxNum = max_element(begin(cnrvnNum), end(cnrvnNum));

  int  nSum = 0;
  for (int nElm : cnrvnNum)
    nSum += nElm;

  int nSameIntTimes;
  if (*itMaxNum * 3 % 2 == nSum % 2)
    nSameIntTimes = (*itMaxNum * 3 - nSum) / 2;
  else
    nSameIntTimes = ((*itMaxNum + 1) * 3 - nSum) / 2;

  return nSameIntTimes;
}

int main()
{
  vector<int> vnNum(3);

  fnInput(vnNum);
  cout << fnSameIntTimes(vnNum) << endl;

  return 0;
}

Measured memory_bytes: 256
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():

    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5


    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])


    def get_Top(self):
        return self.number[0]
        
    def query(self, top_num, front_num):
        self.save_data = [i for i in range(6)]
        for i in range(6):
            self.save_data[i] = self.number[i]
            
        ret = -1
        
        for i in range(len(self.order)):
            self.roll(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break
            
        for i in range(6):
            self.number[i] = self.save_data[i]
            
        return ret
        
    def equals(self, another):
        for i in range(len(self.order)):
            self.roll(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != another.number[k]:
                    FLG = False
                    break
            if FLG == True:
                return True

        return False

n = int(input())
dice = []
for i in range(n):
    tmp_dice = Dice()
    table = list(map(int,input().split()))
    tmp_dice.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])
    dice.append(tmp_dice)

FLG = True
for i in range(n-1):
    for j in range(i+1, n):
        if dice[i].equals(dice[j]):
            FLG = False
            break

if FLG == True:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 6400
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
   ll n ; cin>>n;
   vector<pair<ll,ll> > v;
   for(int i=0;i<n;i++){
    ll l , r;
    cin>>l>>r;
    v.push_back(make_pair(r,l));
   }
   ll sum = 0;
   sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
      //  cout<<v[i].second<<" " <<v[i].first<<endl;
        sum+=v[i].second;
        if(sum > v[i].first){
            cout<<"No"<<endl;
            return 0 ;
        }
      //  cout<<sum<<endl;
    }
    cout<<"Yes"<<endl;
    return 0 ;
}


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
const int N=21;
const int mod=1e9+7;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,m,k,c[N][N],f[2][N][1<<20],nxt[1<<20][N];
void inc(int &a,int b) {
    a+=b;if(a>=mod) a-=mod;
}
int main() {
    n=gi()-1,m=gi(),k=gi();
    memset(c,-1,sizeof(c));
    while(k--) {
        int x=gi(),y=gi();
        c[x][y]=gi()^1;
    }
    for(int i=0;i<(1<<n);i++) {
        k=-1;
        for(int j=n-1;j>=0;j--) {
            nxt[i][j]=k;
            if(i>>j&1) k=j;
        }
    }
    int now=0,lst=1;
    f[lst][n][0]=1;
    for(int i=1;i<=m;i++) {
        memset(f[now],0,sizeof(f[now]));
        memcpy(f[now][0],f[lst][n],sizeof(f[now][0]));
        for(int j=0;j<n;j++)
            for(int k=0;k<(1<<n);k++)
                if(f[now][j][k]) {
                    for(int t=(k>>j&1);t<2;t++)
                        if(c[i][j+1]!=t) {
                            if(t==(k>>j&1)) inc(f[now][j+1][k],f[now][j][k]);
                            else if(nxt[k][j]!=-1) inc(f[now][j+1][k+(1<<j)-(1<<nxt[k][j])],f[now][j][k]);
                            else inc(f[now][j+1][k+(1<<j)],f[now][j][k]);
                        }
                }
        swap(now,lst);
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++) inc(ans,f[lst][n][i]);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 217472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

const ll INF = numeric_limits<ll>::max() / 2;
struct edge {
  int to, cost;
};
struct node {
  int id, distance;
  node(int id, int distance) : id(id), distance(distance) {}
  bool operator<(const node &theOther) const {
    return distance < theOther.distance;
  }
  bool operator>(const node &theOther) const {
    return distance > theOther.distance;
  }
};

vector<ll> dijkstra(vector<vector<edge>> &G, int source) {
  int V = G.size();
  vector<ll> distance(V, INF);
  priority_queue<node, vector<node>, greater<node>> que;
  distance[source] = 0;
  que.push(node(source, 0));

  while (!que.empty()) {
    node n = que.top();
    que.pop();
    if (distance[n.id] < n.distance) continue;
    for (edge e : G[n.id]) {
      if (distance[e.to] > distance[n.id] + e.cost) {
        distance[e.to] = distance[n.id] + e.cost;
        que.push(node(e.to, distance[e.to]));
      }
    }
  }
  return distance;
}

int N, K, Q;
vector<vector<edge>> G;

int main() {
  cin >> N;
  G.resize(N);
  rep(i, N - 1) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    G[a].push_back(edge{b, c});
    G[b].push_back(edge{a, c});
  }

  cin >> Q >> K;
  K--;
  vector<ll> distance = dijkstra(G, K);

  rep(i, Q) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    cout << distance[x] + distance[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 8820
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int acm[10][1000];
int main(){
    int h,w,K;
    cin >> h >> w >> K;
    rep(i,h)rep(j,w){
        char a;
        cin >> a;
        acm[i][j] = (int)(a-'0');
    }
    int ans = h*w;
    for(int i=0; i<1<<(h-1); i++){
        int row = 0;
        int mat[10][1000];
        rep(k,10)rep(j,1000) mat[k][j]=0;
        for(int j=0; j<h; j++){
            for(int k=0; k<w; k++){
                mat[row][k] += acm[j][k];
            }
            if(i>>j&1) row++;
        }
        int now = row;
        row++;
        int tmp[h];
        rep(j,h) tmp[j] = 0;
        rep(k,w)rep(j,row){
            if(tmp[j]<=K && tmp[j]+mat[j][k]>K){
                now++;
                rep(l,row) {
                    if(mat[l][k]>K) {
                        now=h*w;
                        break;
                    }
                    tmp[l] = mat[l][k];
                }
                break;
            }
            tmp[j] += mat[j][k];
        }
        chmin(ans,now);
    }
    cout << ans << endl;

    return 0;
}

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

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

    ll N, K;
    cin >> N >> K;

    ll m1 = N % K;
    ll m2 = K - m1;
    cout << min(m1, m2) << endl;
}


Measured memory_bytes: 256
point = []

for i in range(5) :
    point.append(int(input()))

k = int(input())

for i in range(5) :
    for j in range(5) :
        if abs(point[i] - point[j]) > k :
            print(':(')
            break
    else :
        continue
    break
else :
    print('Yay!')

Measured memory_bytes: 3060
#include<iostream>
 #include<algorithm>
 using namespace std;
 
 int main()
 {
   int a,b,c,d;
   while(cin>>a>>b>>c>>d)
   {
     if((a+b)<(c+d)) cout<<"Right"<<endl;
     else if((a+b)==(c+d)) cout<<"Balanced"<<endl;
     else cout<<"Left"<<endl;                     
   }
   return 0;    
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  vector<int> a(3);
  REP(i, 3) {
    cin >> a[i];
  }
  SORT(a);
  if (a[0] != a[2] && (a[0] == a[1] || a[1] == a[2])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if ( A + B > C + D ) {
    cout << "Left" << endl;
  }
  else if ( A + B == C + D ) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int S,W;
    scanf("%d", &S);
    scanf("%d", &W);
    if( 1 <= S && S <= 100 && 1<= W && W<=100){
           if(W>=S){
                 printf("unsafe");
           }
           else{
             printf("safe");
           }
    }
    return 0;
}

Measured memory_bytes: 2156
import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = solve <$> readLn <*> f >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: Int -> [Int] -> Int
solve n = g . fst . foldl' f (0, 1)
  where
    f (ct, i) x
      | i == x = (ct, i + 1)
      | otherwise = (ct + 1, i)
    g x
      | x == n = -1
      | otherwise = x

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ \s -> do
  (n, s') <- f s
  return (n, B.dropWhile isSpace s')


Measured memory_bytes: 4348
#include<iostream>
using namespace std;
int main(void)
{
    int n,m,l,sum=0;
    int k,a[35];
    cin >> n >> m;
    l=n;
    int cnt[35]={0};
    while(l--){
        cin >> k;
        while(k--) {
            int t;
            cin >> t;
            cnt[t]++;
        }
    }
    for(int i=1;i<=m;i++)
        if(cnt[i]==n)
            sum++;
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;



int main() {
    vector<string> c(3);
    rep(i, 3) cin >> c.at(i);
    cout << c[0][0] << c[1][1] << c[2][2] << endl;
    return 0;
}


Measured memory_bytes: 256
//When I wrote this only God and I knew what it is
//Now, only The_Blitz knows...
#pragma GCC optimize ("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define pb push_back
#define FER(i,a,b) for(int i =int(a); i < int(b); ++ i)
#define IFR(i,a,b) for(ll i = ll(a); i >= ll(b); -- i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 +4;
ll A[N], B[N], C[N];

int main(){
	fastio;
	ll x,y,a,b,c; cin >> x >> y >> a >> b >> c;
	FER(i, 0, a) cin >> A[i];
	FER(i, 0, b) cin >> B[i];
	FER(i, 0, c) cin >> C[i];
	sort(A, A + a); sort(B, B + b); sort(C, C + c);
	reverse(A, A + a); reverse(B, B+b);
	priority_queue<ll, vector<ll>, greater<ll> > ans;
	priority_queue<ll> add;
	FER(i, 0, x) ans.push(A[i]);
	FER(i, 0, y) ans.push(B[i]);
	FER(i, 0, c) add.push(C[i]);
	while(!add.empty()){
		ll addt = add.top(); add.pop();
		ll anst = ans.top();
		if(anst < addt){
			ans.pop();
			ans.push(addt);
		}
		else break;
	}
	ll ret = 0;
	while(!ans.empty()){
		ret += ans.top();
		ans.pop();
	}
	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 5872
#!/usr/bin/env python3
import sys


def solve(S: str):
    if S == "ABC":
        print("ARC")
    else:
        print("ABC")
    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()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61648
#include<stdio.h>
int main()
{
    int a[100000],n,k,l,j=0,i;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>=k)
            j++;
    }
    printf("%d\n",j);
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
	string num,revnum;

	cin >> num;

	for (int i = 2; i >= 0; i--) {
		revnum += num[i];
	}

	if (num == revnum) {
		cout << "Yes" << '\n';
	}
	else {
		cout << "No" << '\n';
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val X = sc.next().toInt()
        pw.println(8 - (X - 400) / 200)
    }
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define filename "lynext"
#define freop freopen(filename ".cik","w",stdout);freopen(filename ".gir","r",stdin)
const long long int N = ((long long int)1e5) + 5;
const long long int M = ((long long int)1e3) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
typedef long long int lli;

lli a,b;

int main ()
{
	fast;
	//freop;
	cin >> a >> b;
	if (a <= 0 && b >= 0)
		return cout << "Zero\n",0;
	if (a > 0 && b > 0)
		return cout << "Positive\n",0;
	if (a < 0 && b < 0)
	{
		if ((b - a) % 2 == 0)
			return cout << "Negative\n",0;
		return cout << "Positive\n",0;
	}
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    println!("{}", (n+1)/2);
}


Measured memory_bytes: 8572
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main () {

 double rad, are, len;

 cin >> rad;

 are = M_PI * rad * rad;
 len = M_PI * 2 * rad;
 
 printf("%lf %lf\n", are, len);

 return 0;
}

Measured memory_bytes: 1236
use proconio::input;

fn main() {
    input! {
    n: usize,
    k: usize,
    mut h: [usize; n],
    }

    if n <= k {
        println!("{}", 0);
    } else {
        h.sort();
        let mut count = 0;
        for i in 0..(n - k) {
            count += h[i];
        }
        println!("{}", count);
    }
}


Measured memory_bytes: 6236
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    h,w = LI()
    shortest = h+w-1
    cnt = 0
    for i in range(h):
        line = S()
        cnt += line.count("#")
    ans = shortest==cnt 
    print("Possible" if ans else "Impossible")
main()            


Measured memory_bytes: 68212
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    cout << min(b / a, c) << endl;

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll score(ll rank){
    if (rank == 1){
        return 300000;
    } else if (rank == 2){
        return 200000;
    } else if (rank == 3){
        return 100000;
    } else {
        return 0;
    }
}

void Main() {
    ll X, Y; cin >> X >> Y;
    ll ans = 0;
    ans += score(X);
    ans += score(Y);
    if (X == 1 && Y == 1){
        ans += 400000;
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3636
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class AXORCircle {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> a(N);

        int d = 0;
        REP(i, N) {
            cin >> a[i];
            d ^= a[i];
        }
        cout << (d == 0 ? "Yes" : "No") << endl;

    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    AXORCircle solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1024