akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>

using namespace std;

typedef long long LL;

const int N = 200010;

int k;

int C(int a, int b)
{
    int up = 1, down = 1;
    for(int i = a, j = b; j; i --, j --)
        up *= i, down *= j;
    return up / down;
}

int main()
{
    string s;
    cin >> s >> k;
    
    vector<int> nums;
    for(int i = s.size() - 1; i >= 0; i --)  nums.push_back(s[i] - '0');
    
    LL res = 0, last = 0;
    for(int i = nums.size() - 1; i >= 0; i --)
    {
        //printf("%d\n", nums[i]);
        if(nums[i] > 0)
        {
            LL x = C(i, k - last);      //  当前位置0
            for(int j = 0; j < k - last; j ++)  x *= 9;
            res += x;
            
            x = C(i, k - last - 1);     //  当前位置[1, nums[i] - 1]
            for(int j = 0; j < k - last - 1; j ++)  x *= 9;
            x *= nums[i] - 1;
            res += x;
            
            last ++;
            if(last >= k)
            {
                res ++;
                break;
            }
        }
    }
    printf("%lld", res);
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    int h[100100];
    REP(i,N) cin >> h[i];
    bool can = true;
    int m = h[0];
    REP(i,N-1){
        m = max(m,h[i]);
        if(m - h[i+1] >= 2) can = false;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
char a[105];
int main()
{
    while(cin>>a)
    {
        int f=1;
        for(int i=0; i<strlen(a); ++i)
        {
            if(i%2!=0)
            {
                if(a[i]!='L'&&a[i]!='U'&&a[i]!='D')
                    f=0;
            }
            else
            {
                if(a[i]!='R'&&a[i]!='U'&&a[i]!='D')
                    f=0;
            }
        }
        if(f)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }



int main() {
  int n,m; cin >>n >>m;
  vector<pair<int,int>> p(m);
  rep(i, m){
    cin >>p.at(i).second >>p.at(i).first;
  }
  sort(all(p));

  int res = 0;
  int pos = 0; // pos番目の橋を落としている(1-indexed)

  for (int i=0; i<m; i++){
    if (p.at(i).second > pos){
      pos = p.at(i).first - 1;
      res++;
    }
  }
  cout <<res <<endl;
}

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

// Union-Find
struct UnionFind {
    vector<int> par;
    vector<int> scale1;
    // par[i]はiの親の番号
    // scale[i]はiが根の時にのみ意味を持ち, その木の要素の数

    //最初は全てが根であるとして初期化
    UnionFind(int N) : par(N), scale1(N,1){
        for(int i = 0; i < N; i++) par[i] = i;
    }

    // データxが属する木の根を再帰で得る
    int root(int x){
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    // xの属する木の要素の数
    int scale(int x){
        return scale1[root(x)];
    }

    // xとyの木を, xの根rxをyの根ryにつけて併合
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
        scale1[ry] += scale1[rx];
    }

    // 2つのデータx, yが属する木が同じならtrueを返す関数
    bool same(int x, int y){
        return root(x) == root(y);
    }
};


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

    UnionFind tree(N);
    vector<ll>ans(M);
    ll temp = N;
    temp = (temp * (temp-1)) / 2;
    for(int i = M - 1; i >= 0; --i){
        ans[i] = temp;
        if(! tree.same(A[i]-1, B[i]-1)){
            ll aS = tree.scale(A[i]-1);
            ll bS = tree.scale(B[i]-1);
            temp = temp - aS * bS;
            tree.unite(A[i]-1, B[i]-1);
        }
    }

    for (int i = 0; i < M; ++i) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if (u.equals(s))
            a--;
        else
            b--;
        out.println(a + " " + b);
        
        out.flush();
    }
}


Measured memory_bytes: 21716
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//絶対値
long long int change_plus(long long int a) {
	if (a < 0) { return -a; }
	if (a >= 0) { return a; }
}
//大小比較(大)
long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}

//大小比較(小)
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}

int main() {
	long long int n, m, k = 0;
	char str[5];
	scanf("%lld%lld%lld",&n,&m,&k);
	if (k >= n && k <= m) { printf("Yes"); return 0; }
	
	printf("No");
}

Measured memory_bytes: 128
import sys
input=sys.stdin.readline
import copy
 
def WarshallFloyd(Map):
    Dist=copy.deepcopy(Map)
    l=len(Dist)
    for k in range(l):
        for i in range(l):
            for j in range(l):
                Dist[i][j]=min(Dist[i][j],Dist[i][k]+Dist[k][j])
    return Dist

def solve(n,A):
    B=WarshallFloyd(A)
    for i in range(n):
        for j in range(n):
            if A[i][j]>B[i][j]:
                return -1
    for k in range(n):
        for i in range(n):
            if i==k:
                continue
            for j in range(n):
                if j==k:
                    continue
                if A[i][j]==A[i][k]+A[k][j]:
                    B[i][j]=0; B[j][i]=0
    ret=0
    for i in range(n):
        ret+=sum(B[i])
    ret//=2
    return ret

n=int(input())
A=[list(map(int,input().split())) for _ in range(n)]
print(solve(n,A))

Measured memory_bytes: 56284
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        //freopen("input.txt","r",stdin);
    #endif // TarekHasan

    int k,n; cin >> k >> n;

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

    int min_distance = INT_MAX;

    for(int i=0;i<n;i++)
    {
        int start = v[i];
        int endmark;
        //clock
        if(i)
        {
            endmark=v[i-1];
            min_distance=min(min_distance,abs(start-k)+abs(0-endmark));
        }
        else
        {
            endmark=v[n-1];
            min_distance=min(min_distance,abs(start-endmark));
        }
        //anticlock
        /*if(i!=n-1)
        {
            endmark=v[i+1];
            min_distance=min(min_distance,abs(start-0)+abs(k-endmark));
        }
        else
        {
            endmark=v[0];
            min_distance=min(min_distance,abs(start-endmark));
        }*/
    }

    cout << min_distance << endl;

    //main();
    return 0;
}


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

#define int long long

int n;
vector<int> a;

signed main()
{
	cin >> n;
	a.resize(n);

	for(int& x : a) cin >> x;

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

	vector<int> memo;

	for(int i = 1;i < n;i++)
	{
		if(a[i - 1] == a[i])
		{
			memo.push_back(a[i]);
			a[i] = -1;
		}
	}

	int result = 0;

	if(memo.size() >= 2)
	{
		result = memo[memo.size() - 1] * memo[memo.size() - 2];
	}

	cout << result << endl;
	return 0;

}



Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n;
  cin >> n;
  map<P, ll> g;
  V<V<ll>> e(n);
  rep(i, n - 1) {
    ll u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    g[{u, v}] = w;
    g[{v, u}] = w;
    e[u].push_back(v);
    e[v].push_back(u);
  }

  V<int> c(n, -1);
  c[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    auto i = q.front();
    q.pop();
    for (auto node : e[i]) {
      if (c[node] != -1) continue;
      if (g[{i, node}] % 2 == 0) {
        c[node] = c[i];
      } else {
        c[node] = !c[i];
      }
      q.push(node);
    }
  }
  rep(i, n) printf("%d\n", c[i]);
}


Measured memory_bytes: 22076
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()
	c := nextInt()

	if a == b && b == c {
		fmt.Println("No")
		return
	}

	if a != b && a != c && b != c {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
	return
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
<?php
$n=trim(fgets(STDIN));
$s=trim(fgets(STDIN));
$ans=0;
$i=0;
while($i<$n-2){
  $a=$s[$i];
  if(!isset($key1[$a])){
    $key1[$a]=1;
    $j=$i+1;
    while($j<$n-1){
      $b=$s[$j];
      if(!isset($key2[$a][$b])){
        $key2[$a][$b]=1;
        $k=$j+1;
        while($k<$n){
          $c=$s[$k];
          if(!isset($key3[$a][$b][$c])){
            ++$ans;
            $key3[$a][$b][$c]=1;
          }
          if(count($key3[$a][$b])==10){
            $k=$n;
          }
          ++$k;
        }
      }
       ++$j;
    }
  }
  ++$i;
}

echo $ans;

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

int main()
{
  ll N; cin >> N;
  ll K; cin >> K;
  string S; cin >> S;
  string T = S;

  vector<int> a;
  int x = 0;
  int cnt = 0;
  for (int i=0; i<N; i++) {
    if (i == 0) {
      cnt++;
      continue;
    }
    if (S[i-1] != S[i]) x++;
    if (S[i]==S[i-1]) {
      cnt++;
    } else {
      a.push_back(cnt-1);
      cnt = 1;
    }
  }
  a.push_back(cnt-1);
  int sum = 0;
  for (auto v: a) {
    sum += v;
  }
  for (int i=0; i<K; i++) {
    if (x > 1) {
      sum += 2;
      x -= 2;
    }
    else if (x == 1) {
      sum++;
      x--;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1148
#include <stdio.h>
int main(void){
int a,b;
scanf("%d %d", &a, &b);
int d,r;
  d = a/b;
  r = a%b;
double f;
  f = 1.0*a/b;
printf("%d %d %.8f\n", d, r, f);
return 0;
}



Measured memory_bytes: 2136
#include <stdio.h>
int main(void) {
    long aa, bb, a, b, tmp, r;
    scanf("%ld", &aa);
    scanf("%ld", &bb);


    if (aa<bb) {
        tmp = aa;
        aa = bb;
        bb = tmp;
    }
    a=aa;
    b=bb;

    r = a%b;
    while (r!=0) {
        a = b;
        b = r;
        r = a%b;
    }

    printf("%ld", aa*bb/b);
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N; cin >> N;
    vector<ll> A(N); REP(i,N) cin >> A[i];
    vector<ll> num(N+1,0); REP(i,N) num[A[i]]++;
    ll all = 0;
    REP(i,N) if(num[i+1]>0) all += num[i+1]*(num[i+1]-1)/2;
    REP(i,N){
        ll n = num[A[i]];
        ll dif = n*(n-1)/2 - (n-1)*(n-2)/2;
        cout << all - dif << en;
    }
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll n, k; cin >> n >> k;
	vector<pii> v;
	REP(i, n)
	{
		ll t, d; cin >> t >> d;
		v.emplace_back(d, t);
	}
	sort(v.rbegin(), v.rend());
	set<ll> st;
	priority_queue<ll, vector<ll>, greater<ll>> que;
	ll tmp = 0;
	REP(i, k)
	{
		ll t = v[i].second;
		ll d = v[i].first;
		tmp += v[i].first;
		if (st.count(t))
		{
			que.push(v[i].first);
		}
		else st.insert(t);
	}
	ll ans = tmp + ll(st.size()) * ll(st.size());
	FOR(i, k, n)
	{
		ll d = v[i].first;
		ll t = v[i].second;
		if (st.count(t) > 0) continue;
		if (que.empty()) break;
		ll p = que.top();
		que.pop();
		tmp -= p;
		tmp += d;
		st.insert(t);
		chmax(ans, tmp + ll(st.size()) * ll(st.size()));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];
std::vector<int> adj[N];

int main()
{
   int n,m;
   Int(n,m);

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

   for(int i=1;i<=m;++i){
    int u,v;
    Int(u,v);
    adj[u].push_back(v);
    adj[v].push_back(u);
   }
    int res=0;
   for(int i=1;i<=n;++i){
     bool f=true;
    for(auto v: adj[i]){
        if(a[i] <= a[v]){
            f=false;
            break;
        }

    }
    if(f)++res;
   }

   printf("%d\n", res);
    return 0;
}



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

using namespace std;

int main() {
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> a(n);

    for(int i = 0; i < n; i++) {
        int c, s;
        cin >> c >> s;
        a[i] = make_pair(c, s);
    }

    vector<int>b(n);

    for(int i = 0; i < n; i++) {
        if(a[i].second <= t){
            b[i] = a[i].first;
        }
    }
    sort(b.begin(), b.end());


    for(int i = 0; i < n; i++) {
        if(b[i] != 0){
            cout << b[i] << endl;
            break;
        }
    }
    if(b[n-1] == 0){
        cout << "TLE" << endl;
    }
   
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int main()
{
    char s[11];
    scanf("%s",s);

    int len = strlen(s);
    long long ymd = 0,mul = 1;

    for (int i = len - 1; i >= 0; i--)
    {
        if(s[i] == '/')
        {
            continue;
        }
        else
        {
            ymd += mul * (int)(s[i] - '0');
            mul *= 10;
        }
    }
    if(20190430 >= ymd)
    {
        printf("Heisei");
    }
    else
    {
        printf("TBD");
    }
    
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

ll dp[100010][2];

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    rep(i,100010){
        rep(j,2){
            dp[i][j] = 0;
        }
    }
    const ll INF = 1e17;

    dp[0][0] = 0;
    dp[0][1] = -INF;
    rep(i,n){
        dp[i+1][0] = max(dp[i][0]+a[i],dp[i][1]-a[i]);
        dp[i+1][1] = max(dp[i][0]-a[i],dp[i][1]+a[i]);
    }

    cout << dp[n][0] << endl;
    return 0;
}

Measured memory_bytes: 5212
#include <iostream>
#include <string>
#include <vector>

using namespace std;
const int JOY500 = 1000;
const int JOY5   = 5;

int main()
{
    int x = 0;

    cin >> x;

    int a = x / 500;
    int b = (x-a*500) / 5;


    cout << (a * JOY500) + (b * JOY5) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
// b-a <=2 いみなし -> k+1
// k >=2 & a >= s -> 
int main() {
    ll k, a, b;
    cin >> k >> a >> b;
    ll s = 1;
    if(b-a <= 2) {
        cout << k+1 << endl;
        return 0;
    }
    
    rep(i,k) {
        if(s < a) { s++; continue;}
        else if(k-i>=2){
            s-=a;
            s+=b;
            i++;
            continue;
        }
        else s++;

    }   
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>

int main(void){
        int a, b, x;
        scanf("%d %d %d", &a, &b, &x);

        while(x%500) x++;
        x /= 100;
        if(a<b*2){
                if(a>=b) printf("%d\n", x/10*a + (x%10)/5*b);
                else printf("%d\n", (x/10+!!(x%10))*a);
        }else printf("%d\n", x/5*b);
        return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
int h[N], n, k;
int main() {
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) {
        scanf("%d", h + i);
    }
    sort(h, h + n);
    ll ans = 0;int pc = max(n - k, 0);
    for (int i = 0; i < pc; ++i) {
        ans += (ll)h[i];
    }
    cout << ans;
    return 0;
}

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

using namespace std;

#define rep(i,n)  for(int i=0;i<n;++i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)

int main(){
    int n,m,ans=0;
    sc2(n,m);
    int k[15][15];
    int p[15]={0};
    rep(i,15) rep(j,15) k[i][j]=0;
    rep(i,m) {
        sc1(k[i][0]);
        rep(j,k[i][0]) sc1(k[i][j+1]);
    }
    rep(i,m) sc1(p[i]);
    rep(i,pow(2,n)) {
        int x=i;
        int s[15]={0};
        rep(j,n) {
            if (x&1)  s[j]=1;
            x=x>>1;
        }
        int chk=0;
        rep(j,m) {
            int cnt=0;
            rep(a,k[j][0]) if (s[k[j][a+1]-1]==1) cnt=(cnt+1)%2;
            if (cnt==p[j]) chk++;
        }
        if (chk==m) ans++;
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 4116
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N, K;
	cin >> N >> K;

	ll ans = K;
	REPN(i, 1, N) {
		ans *= (K - 1);
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define gap cout<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    fo(i,n) cin>>a[i];
    int avg=accumulate(all(a),0)/n;
    vector<int> nn{avg,avg-1,avg+1};
    
    int maax=INT_MAX;
    for(auto j:nn){
        int tmp=0;
        fo(i,n){
            tmp=tmp+(a[i]-j)*(a[i]-j);
            
            
        }
        maax=min(maax,tmp);
    }
    cout<<maax<<endl;
    
}

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

using namespace std;

int n, m, v, p, a[100015];

int main() {
  cin >> n >> m >> v >> p;
  for (int i = 1; i <= n; ++i)
    cin >> a[i];
  sort(a + 1, a + n + 1);
  long long sum = 0;
  for (int i = 1; i <= n - p + 1; ++i)
    sum += a[i];
  int res = p;
  for (int i = 1; i <= n - p; ++i) {
    sum -= a[i];
    if (a[i] + m < a[n - p + 1])
      continue;
    if (v - i < p) ++res;
    else if (1ll * (a[i] + m) * (n - i - p + 1) - sum >= 1ll * m * (v - i - p + 1))
      ++res;
  }
  cout << res;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

public class Main {

//	public static int[] ans;
//	public static int c=0;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		while(true) {
			n = sc.nextInt();
			if(n == 1) {break;}
			int[] ans = new int[500];
			int c=0;
			
			c = calc1(n,c,ans);
			c = calc6(n,c,ans);
			
			Arrays.sort(ans);
			
			System.out.print(n + ":");
			for(int i=500-c; i<500;i++) {
				System.out.print(" " + ans[i]);
			}
			System.out.println("");
		}
		sc.close();
	}
	

	static int calc1(int n, int c,int[] ans) {
		
		for(int i=8;i<=n; i+=7) {
			if(n % i == 0) {
				if(check(i)) {
					ans[c++] = i;
				}
			}
		}
		
		return c;
	}

	static int calc6(int n, int c,int[] ans) {

		for(int i=6;i<=n; i+=7) {
			if(n % i == 0) {
				if(check(i)) {
					ans[c++] = i;
				}
			}
		}
		
		return c;
	}
	
	static boolean check(int n) {

		for(int i=8;i<n; i+=7) {
			if(n % i == 0) {
				return false;
			}
		}
		for(int i=6;i<n; i+=7) {
			if(n % i == 0) {
				return false;
			}
		}
		
		return true;
	}

}


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

	#define en "\n"
	#define INF (int) 9e18
	#define HELL 998244353LL
	#define int long long
	#define double long double
	#define uint unsigned long long
	#define pii pair<int, int>
	#define pb push_back
	#define fs first
	#define sc second
	#define size(a) (int) a.size()
	#define deb(x) cerr << #x << " => " << x << en
	#define debp(a) cerr << #a << " => " <<"("<<a.fs<<", "<<a.sc<<") " << en;
	#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
	#define debpa(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
	#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
	#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
	#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	#define pout cout << fixed << setprecision(10)
	int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
	while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
	#define inv(a) fastpow(a, HELL - 2)
	#define mul(a, b) ((a % HELL) * (b % HELL)) % HELL

	int n;
	const int maxN = 2e5 + 5;
	int tree[maxN];

	void update(int index, int val) {
	    while (index <= n) {
	        tree[index] = (tree[index] + val) % HELL;
	        index += (index & -index);
	    }
	}

	int read(int index) {
	    int sum = 0;
	    while (index) {
	        sum = (sum + tree[index]) % HELL;
	        index -= (index & -index);
	    }
	    return sum;
	}

	int getSum(int low, int high) {
		if (high <= 0) {
			return 0;
		}
		if (low <= 1) {
			return read(high);
		}
		return (read(high) - read(low - 1) + HELL) % HELL;
	}

	int32_t main() { fastio;
		int k, a, b;
		cin >> n >> k;
		vector<vector<int>> s;
		while (k--) {
			cin >> a >> b;
			s.pb({ a, b });
		}
		update(1, 1);
		for (int i = 2; i <= n; i++) {
			for (auto x : s) {
				update(i, getSum(i - x[1], i - x[0]));
			}
		}
		cout << (read(n) - read(n - 1) + HELL) % HELL << endl;
		return 0;
	}

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

using namespace std;
 
const long long inf = 1e9;
#define ll long long
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;

ll n, m, k;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	m = n % 10;
	if (m == 2 || m == 4 || m == 5 || m == 7 || m == 9) {
		cout << "hon" << endl;
	}
	else if (m == 3) {
		cout << "bon" << endl;
	}
	else {
		cout << "pon" << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    string t = "yuiophjklnm";
    while(1){
        cin >> s;
        if(s == "#") break;
        int ans = -1;
        int pre = -1;
        rep(i, 0, s.size()){
            int now = 0;
            if(t.find(s[i]) != string::npos) now = 1;
            if(pre != now){
                ans++;
            }
            pre = now;
        }
        cout << ans << endl;
    }
}


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

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

    for(long long a = 1; a < 1e3; a++) {
        for(long long b = -a; b <= a; b++) {
            if(pow(a, 5) == x + pow(b, 5)) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B, X;
    cin >> A >> B >> X;
    ll b = B / X;
    ll a = (A - 1) / X;
    if (A == 0)
        a = -1;
    cout << b - a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	int c =0;
	for(int i=0;i<n/2;i++)
	{
		if(s[i]!=s[n-1-i])c++;
	}	
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lim 2e9
#define on 100005
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR for(int i=1;i<=n;i++)
typedef long long int lo; 
typedef pair<int,int> PII;
lo n,m,a[200005],cev=-lim,buy,kuc,say,k,z,x,y,mn=lim;
char c;
string s;
stack<int> st;
vector<int> v;
int main(){
	scanf("%lld %lld %lld %lld",&n,&m,&k,&z);
	for(int i=1;i<=n;i++){
		scanf("%lld",&x);
		cev=max(cev,x);
	}
	cev=max(cev,k);
	for(int i=1;i<=m;i++){
		scanf("%lld",&y);
		mn=min(mn,y);
	}
	mn=min(mn,z);
	if(mn<=cev){
		printf("War");
		return 0;
	}
	printf("No War");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm> 
using namespace std;
typedef long long ll;
const int maxn=5e5+10;
int a[maxn];

int main()
{
	int n;cin>>n;ll ans=0;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n,greater<int>());
	ans+=a[0];int f=0,c=1;
	for(int i=1;i<n;){
		if(c>=n-1) break;
		f++;ans+=a[i];c++;
		if(f==2) f=0,i++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4400
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
 int n;
  cin >> n;
 vector<long> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  
  
  long odd=0,even=0,sum=0;
    
  for(int i=0;i<n;i++){ //+-
     sum+=a[i];
    if(i%2==0&&sum<=0){ 
     odd+=abs(sum)+1;
     sum=+1; 
    }
    else if(i%2==1&&sum>=0){
     odd+=abs(sum)+1;
     sum=-1; 
    }
  }
  
   sum=0;
  for(int i=0;i<n;i++){ //-+
     sum+=a[i];
    if(i%2==1&&sum<=0){
     even+=abs(sum)+1;
     sum=+1; 
    }
    else if(i%2==0&&sum>=0){
     even+=abs(sum)+1;
     sum=-1; 
    }
  }
  
 cout << min(odd,even) << endl;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

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

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;

int i,n,a[N],b[N];

void solve()
{
    cin>>n;
    for(i=1;i<=n;++i)
    {
        cin>>a[i]>>b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    if(n&1)
    {
        int m1=a[(n+1)/2],m2=b[(n+1)/2];
        cout<<m2-m1+1;
    }
    else
    {
        int m1=a[n/2]+a[n/2+1],m2=b[n/2]+b[n/2+1];
        cout<<m2-m1+1;
    }
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6616
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int ll;
vector<vector<ll>> adj;
vector<bool> vis,act; vector<ll> dp; const ll INF =1e18+5;

void dfs(ll u)
{
    vis[u]=1;
    for(ll v:adj[u])
    {
        if(!vis[v]) dfs(v);
        if(adj[v].empty()) dp[v]=0;
        dp[u]=max(dp[u],dp[v]+1);
    }
}



int main()
{
    fast
    ll n,m; cin>>n>>m;
    adj.resize(n);
    for(ll i=0;i<m;i++)
    {
        ll a,b; cin>>a>>b; a--;b--;
        adj[a].push_back(b);
    }
    vis.resize(n,false); act.resize(n,false);
    dp.resize(n,-INF);
    for(ll i=0;i<n;i++)
    {
        if(!vis[i]) dfs(i);
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 12080
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int n;cin>>n;
    vector<string> s(n);
    for(int i=0;i<n;++i)cin>>s[i];
    int res = 0;
    for(int i=0;i<n;++i){
        bool b = true;
        for(int k=0;k<n;++k){
            for(int l=0;l<k;++l){
                if(s[(i+k)%n][l]!=s[(i+l)%n][k])b=false;
            }
        }
        if(b)res+=n;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 384
n,k=map(int,raw_input().split())
a=[0]*(n+1)
for i in range(k):
    d=input()
    b=map(int,raw_input().split())

    for j in range(d):
        a[b[j]]=1

    
a[0]=1
c=0
for i in range(len(a)):
    if a[i]==0:
        c+=1
print c

Measured memory_bytes: 69904
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>

using namespace std;

int main(void) {
    int n;
    int h=0, t;
    int times=0;

    scanf("%d", &n);
    for(int i=0; i<n; i++) {
        scanf("%d", &t);
        times += max(t-h, 0);
        h = t;
    }

    printf("%d\n", times);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int h = scanner.nextInt();
        int w = scanner.nextInt();
        char[][] canvas = new char[h + 2][w + 2];
        for (int i = 1; i <= h; i++) {
            canvas[i] = ('.' + scanner.next() + '.').toCharArray();
        }

        String ans = "Yes";
        for (int i = 1; i <= h; i++) {
            for (int j = 1; j <= w; j++) {
                if (canvas[i][j] == '#' && canvas[i - 1][j] != '#' && canvas[i + 1][j] != '#'
                        && canvas[i][j - 1] != '#' && canvas[i][j + 1] != '#') {
                    ans = "No";
                    break;
                }
            }
            if (ans.equals("No")) break;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define MAX (1<<17)
using namespace std;

typedef long long ll;

ll n;
ll st[MAX*2]={};

void init(){
  int tmp=1;
  while(tmp<n)tmp*=2;
  n=tmp;
  for(int i=0;i<n*2;i++)st[i]=0;
}

void update(int k,ll x){
  k+=n-1;
  st[k]=x;
  while(k>0){
    k=(k-1)/2;
    st[k]=max(st[k*2+1],st[k*2+2]);
  }
}

ll find(int a,int b,int k,int l,int r){

  if(r<=a || b<=l)return 0;

  if(a<=l && r<=b)return st[k];

  ll v1=find(a,b,k*2+1,l,(l+r)/2);
  ll v2=find(a,b,k*2+2,(l+r)/2,r);
  return max(v1,v2);
}

int main()
{
  ll a,ans=0,m;

  cin>>n;

  m=n;
  ans=n*(n+1)/2;
  init();

  for(int i=0;i<m;i++){
    cin>>a;
    ll res=find(1,a,0,0,n);
    update(a,a+res);
  }

  ans-=find(1,m+1,0,0,n);

  cout<<ans<<endl;

  return 0;
}

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

using namespace std;
typedef long long int ll;
int main() {
    
    ll a, v, b, w, t;
    cin>>a>>v>>b>>w>>t;
    
    if(v<=w)
    cout<<"NO";
    else if((v-w)*t>=((((long long int)abs(a-b)))))
    cout<<"YES";
    else
    cout<<"NO";
    
    
    return 0;
}

Measured memory_bytes: 3592
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

right = 0
left = a[-1]*f[0]

while right!=left:
    mid = (right+left)//2
    syu = 0
    
    for i in range(n):
        if a[i]*f[i]>mid:
            syu += a[i] - mid//f[i]
    
    if syu <= k:
        left = mid
    else:
        right = mid + 1
        
print(right)

Measured memory_bytes: 120908
#include<bits/stdc++.h>
     
    using namespace std;
     
    #define all(x) x.begin(), x.end()
    typedef vector<int> vi;
    typedef pair<int,int> ii;
    typedef long long ll;
     
    const ll inf = 3e18 + 5;
     
    const int MAXN = 1 << 19;
    int N = 400000;
    int seg[2 * MAXN], A[MAXN];
    typedef vector<vi> vvi;
    
    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
    
        int a,b;
        char op;
        cin >> a >> op >> b;
        if(op=='+')
            cout << a+b;
        else
            cout << a-b;
    }

Measured memory_bytes: 256
def myAnswer(X:int)-> int:
   # 100より下なら0
   if(X < 100) : return 0

   total = 0 #合計金額
   first = X % 10 #1桁目の数値
   secand = ((X // 10) % 10) *10 #2桁目の数値
   if(first <=5 and first >=1): # １桁目が0以上5以下なら1個で済む
      total += 100 + first
   elif(first >= 6):
      total += 200 + first #1桁目が6以上なら2個必要

   total += (secand//5)*105 # 2桁目は105円から作る
   # Xがtotal以上なら合計金額がちょうどになる。
   return 1 if(total <= X) else 0



def modelAnswer():
   tmp=1
def main():
   X = int(input())
   print(myAnswer(X))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

#define v(T) vector<T>
#define vv(T) v(v(T))

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

char field[1010][1010];
int d[1010][1010];

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

queue<P> que;

void bfs() {
    while(!que.empty()) {
        P p = que.front(); que.pop();
        int x = p.fi;
        int y = p.se;
        field[y][x] = '#';
        rep(i, 4) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if (nx<0 || nx>=W || ny<0 || ny>=H) continue;
            if (field[ny][nx]=='#') continue;
            if (d[ny][nx]!=INF) continue;
            d[ny][nx] = d[y][x] + 1;
            que.push(P(nx,ny));
        }
    }
}

int main() {
    cin >> H >> W;
    rep(y,H)rep(x,W) {
        cin >> field[y][x];
        d[y][x] = INF;
    }
    rep(y,H)rep(x,W) {
        if (field[y][x] == '#') {
            que.push(P(x,y));
            d[y][x] = 0;
        }
    }
    bfs();
    int ans = 0;
    rep(y,H)rep(x,W) ans = max(ans, d[y][x]);
    cout << ans << endl;
    return 0;
}




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

int main(){
    int n,y;

    while(scanf("%d%d",&n,&y)==2){
        int a=-1,b=-1,c=-1;
        bool found = false;

        for(int i=0; i<=n && !found; i++){
            for(int j=0; j<=n-i && !found; j++){
                int k = n-i-j;
                if(i*10000 + j*5000 + k*1000 == y)
                    a=i, b=j, c=k, found = true;
            }
        }

        printf("%d %d %d\n",a,b,c);
    }

    return 0;
}


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

using namespace std;
using ld = long double;

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}

int N;
vector<ld> psum;

ld rec(int l, int r) {
    if (l == r) return psum[r] - psum[l - 1];
    static auto dp = Vec<ld>((N + 1) * 2, (N + 1) * 2, -1.L);
    if (dp[l][r] >= 0) return dp[l][r];

    dp[l][r] = 1e30;
    for (int p = l + 1; p < r; p += 2) {
        dp[l][r] = min(dp[l][r], rec(l, p - 1) + rec(p + 1, r));
    }
    return dp[l][r] += psum[r] - psum[l - 1];
}

int main() {
    cin >> N;
    psum.resize((N + 1) * 2);
    psum[0] = 0;
    for (int i = 1; i <= N; ++i) cin >> psum[i * 2];
    for (int i = 0; i <= N; ++i) cin >> psum[i * 2 + 1];
    for (int i = 1; i < (N + 1) * 2; ++i) psum[i] += psum[i - 1];

    cout << fixed << setprecision(10) << rec(1, N * 2 + 1) << endl;
    return 0;
}



Measured memory_bytes: 18836
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int ans = n - k + 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
/*
 * Author : Sadi
 * Mon 20/07/2020
 * 13:29:18.39
 */
#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    set<int> s;
    for(int i = 0; i < n; ++i) {
        int num;
        cin >> num;
        s.insert(num);
    }
    if((int) s.size() == n) {
        cout << "YES" << "\n";
    }
    else {
        cout << "NO" << "\n";
    }
    return 0;
}


Measured memory_bytes: 12996
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef signed long long ll;
typedef long double ld;

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

#define __INT_MAX__ 2147483647

//#define DEBUG

int main()
{
	//input
	int n, k, q;
	cin >> n >> k >> q;

	int check = q - k;

	int a[q];
	rep(i, q)
	{
		cin >> a[i];
	}

	int point[n];
	rep(i, n)
	{
		point[i] = 0;
	}

	//solve
	rep(i, q)
	{
		point[a[i]-1]++;
	}

	#ifdef DEBUG
		rep(i,n)
		{
			cout << point[i];
		}
	#endif
	
	rep(i, n)
	{
		if(point[i] > check)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  string n;
  cin >> n;
  REP(i, n.size()) {
    if (n[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
s=sorted([i for i in input()])
t=list(reversed(sorted([i for i in input()])))
flg="same"
for i in range(min(len(s),len(t))):
  if s[i]<t[i]:
    flg="large" 
    break
  elif s[i]>t[i]:
    flg="small"
    break
    
if flg=="same" and len(s)<len(t):
  flg="large"
print("Yes" if flg=="large" else "No")  
    
               




Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\n'
//#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    int n;
    cin>>n;
    int d=n%10;

    if(d==3) cout<<"bon"<<endl;
    else if(d==0 || d==1 || d==6 || d==8) cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
    return 0;
}


Measured memory_bytes: 3632