akhauriyash/Code-Regression huggingface dataset:
#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 ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int a[N],b[N];
void solve(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        b[i] = a[i];
    }// 1 2 3 4
    sort(b + 1,b + n + 1);
    int ml = b[n / 2] , mr = b[n / 2  + 1]; 
    for(int i = 1; i <= n; ++i) {
        int l = 1, r = n;
        int f = -1;
        while(l <= r) {
            int md = (l + r) / 2; 
            if(b[md] < a[i]) {
                l = md + 1;
            }
            else {
                f = md;
                r = md - 1;
            } // 2 4 4 3        2 3 4 4
        }
        if(f <= n / 2){
            cout << mr << "\n";
        }
        else {
            cout << ml << "\n";
        }
    }
}
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#define MAX 8004
using namespace std;
typedef long long ll;
bool dp[MAX][MAX*2];
int len,x,y,c1;
char route[MAX];
void update(int q){
    for(int i=0;i<MAX*2;i++) if(dp[c1][i]){
        int t1=i+q,t2=i-q;
        if(0<=t1&&t1<MAX*2) dp[c1+1][t1]=1;//printf("%d ",t1-MAX);
        if(0<=t2&&t2<MAX*2) dp[c1+1][t2]=1;//printf("%d ",t2-MAX);
    }
    printf("\n");
    c1++;
}
int main(){
    scanf(" %s %d %d",route,&x,&y);
    x+=MAX,y+=MAX;
    len=strlen(route);
    int i=0;
    dp[0][MAX]=1;
    for(;i<len;i++){
        int cnt;
        for(cnt=0;route[i]=='F';i++,cnt++);
        i++;
        for(cnt=0;route[i]=='F';i++,cnt++);
        update(cnt);
    }
    if(dp[c1][y]==0){
        printf("No\n");
        return 0;
    }
    for(int i=0;i<=c1;i++) for(int j=0;j<MAX*2;j++) dp[i][j]=0;
    for(i=0;route[i]=='F';i++);
    dp[0][MAX+i]=1,c1=0,i++;
    for(;i<len;i++){
        int cnt;
        for(cnt=0;route[i]=='F';i++,cnt++);
        i++;
        for(cnt=0;route[i]=='F';i++,cnt++);
        update(cnt);
    }
    if(dp[c1][x]==0){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
}


Measured memory_bytes: 63616
s = gets.chomp
n = gets.to_i
n.times do
  xs = gets.chomp.split
  a = xs[1].to_i
  b = xs[2].to_i
  len = b - a + 1
  case xs[0]
  when "replace"
    x = s.slice(0, a)
    y = s.slice(a+len, s.length)
    s = x + xs[3] + y
  when "reverse"
    x = s.slice(0, a)
    y = s.slice(a, len).reverse
    z = s.slice(a+len, s.length)
    s = x + y + z
  when "print"
    puts s.slice(a, len)
  end
end

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

signed main() {

  int N;
  cin >> N;

  int NN = N % 10;

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


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct P {
    bool operator<(const P &p) const {
        return g > p.g;
    }
    int k, g;
};

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

    int T;
    cin >> T;

    while (T--) {
        int n;
        cin >> n;

        ll s = 0;
        vector<P> p[2];
        for (int i = 0; i < n; i++) {
            int k, l, r;
            cin >> k >> l >> r;

            s += min(l, r);
            int g = l - r;
            p[g < 0].push_back({ g < 0 ? n - k : k, abs(g) });
        }
        for (int h = 0; h < 2; h++) {
            sort(p[h].begin(), p[h].end());
            int m = p[h].size();
            set<int> st;
            for (int i = 0; i < m; i++) {
                st.insert(st.end(), i);
            }
            for (int i = 0; i < m; i++) {
                auto it = st.lower_bound(p[h][i].k);
                if (it == st.begin()) continue;
                st.erase(--it);
                s += p[h][i].g;
            }
        }
        cout << s << '\n';
    }

    return 0;
}

Measured memory_bytes: 9560
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        int x = Integer.parseInt(input[1]);
        int moto[] = new int[n];
        for(int i = 0; i < n; i++){
            moto[i] = Integer.parseInt(br.readLine());
            x -= moto[i];
        }
        int ans = n;
        Arrays.sort(moto);
        ans += x / moto[0];
        System.out.println(ans);
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)2e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int n, d;
    cin>>n>>d;
    int ans = 0;
    d *= d;
    f(i, n) {
        int x, y;
        cin>>x>>y;
        int tt = x * x + y * y;
        if(tt <= d) ans++;
    }
    cout<<ans;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
from collections import Counter
N = int(input())
a = Counter(map(int, input().split()))
h, w = 0, 0
for k, v in sorted(a.items(), key=lambda x: -x[0]):
    if v >= 4 and not h and not w:
        h, w = k, k
        break
    elif v >= 2:
        if not h:
            h = k
        elif not w:
            w = k
            break

print(h * w)

Measured memory_bytes: 24740
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int k1 = a*c;
int k2 = a*d;
int k3 = b*c;
int k4 = b*d;
int ans = max(k1,max(k2,max(k3,k4)));
cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0

for i in range(N):
    x -= a[i]
    if x < 0:
        break
    else:
        ans += 1

if x > 0:
    ans -= 1
else:
    pass

print(ans)

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll K, X; cin >> K >> X;
    if (K * 500 >= X) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}

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

int main()
{
    int n, a[2000];
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            int pos = 0;
            for (int k = n - 1; k >= 1; k /= 2)
            {
                while ((pos + k) < n && a[pos + k] < a[i] + a[j]) 
                {
                    pos += k;
                    if (k == n - 1) break;
                }
            }
            // pos++;
            if (pos > j && pos < n && a[pos] < a[i] + a[j]) ans += pos - j;
            // cout << i << ' ' << j << ' ' << pos << ' ' << ans << "\n";
        }
    }
    cout << ans << "\n";
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007


typedef long long ll;
typedef pair<ll,ll> P;

int main()
{
	int a,b;cin >> a >> b;
	if(a > b){
		cout << max(1,a-1) << endl;
	}
	else{
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
typedef long long int ll;
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<m;j++) 
#define pb push_back 
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<"\n" 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
const ll MOD = 1e9 + 7;
const int N = 1005;
const ll INF = 1e9;
using namespace std;
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m;
	cin >> n >> m;
	n += 2;
	m += 2;
	char g[24][24];
	for (int i = 1; i< n - 1; i++) for (int j = 1; j< m - 1; j++) cin >> g[i][j];
	//+++++++++++++++
	form g[0][j] = '#';
	form g[n - 1][j] = '#';
	forn{ g[i][0] = '#'; g[i][m - 1] = '#'; }
		//+++++++++++++++
	bool used[23][23];
	queue<pair<int, int>> q;
	int d[23][23];
	int ans = 0;
	for (int i = 1; i< n - 1; i++) for (int j = 1; j< m - 1; j++)
	{
		if (g[i][j] == '#') continue;
	forn form { used[i][j] = 0; d[i][j] = 0; }
	forn form if (g[i][j] == '#') { d[i][j] = 0; used[i][j] = 1; }
	used[i][j] = 1;
	d[i][j] = 0;
	q.push({ i,j });
	while (!q.empty())
	{
		int l = q.front().f;
		int k = q.front().sc;
		q.pop();
		//++++++++++
		if (!used[l + 1][k]) {
			used[l+1][k] = 1;
			d[l + 1][k] = d[l][k] + 1;
			q.push({ l + 1,k });
		}
		//++++++++
		if (!used[l - 1][k]) {
			used[l-1][k] = 1;
			d[l - 1][k] = d[l][k] + 1;
			q.push({ l - 1,k });
		}
		//++++++++
		if (!used[l][k + 1]) {
			used[l][k+1] = 1;
			d[l][k + 1] = d[l][k] + 1;
			q.push({ l ,k + 1 });
		}
		//++++++++
		if (!used[l][k - 1]) {
			used[l][k-1] = 1;
			d[l][k - 1] = d[l][k] + 1;
			q.push({ l ,k - 1 });
		}
	}
	//forn{ form  cout << d[i][j] << " "; kek; }
	//kek;
	for (int i = 1; i<n - 1; i++) for (int j = 1; j< m - 1; j++)   ans = max(ans,d[i][j]);

	}
	cout << ans;
	return 0;


}

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

#define lson rt << 1
#define rson rt << 1 | 1
#define mid ((l + r) >> 1)
#define Lson l, mid, lson
#define Rson mid + 1, r, rson
const int MAXN = 1e5 + 20;
using pa = pair<int, int>;
using ll = long long;


int dp[MAXN][9][9];
const int MOD = 1e9 + 7;
int main() {
    int x;
    cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,m,sum=0;
	cin>>n>>m;
	long long int arr[m];
	for(int i=0;i<m;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	if(n-sum>=0)
		cout<<n-sum<<endl;
	else
		cout<<"-1"<<endl;
	return 0;
}


Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static ConsoleApplication.Utils;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var nl = ReadInts().ToArray();
            var res = ReadLines(nl[0]).OrderBy(s => s).Aggregate(new System.Text.StringBuilder(), (acc, succ) => acc.Append(succ));
            WriteLine(res);
        }
    }

    public static class Utils
    {
        #region Extensions for IO

        public static int ReadInt()
            => ReadInts().First();

        public static IEnumerable<int> ReadInts()
            => ReadStrings().Select(int.Parse);

        public static IEnumerable<string> ReadStrings()
            => ReadLine().Split(' ');

        public static IEnumerable<string> ReadLines(int n)
        {
            foreach (var i in Enumerable.Range(0, n))
            {
                yield return ReadLine();
            }
        }

        #endregion

        #region Extensions of int

        public static bool IsOdd(this int n)
            => !n.IsEven();

        public static bool IsEven(this int n)
            => n % 2 == 0;

        public static bool CanDivideWith(this int n, int divisor)
            => n % divisor == 0;

        #endregion

        #region Extensions of string

        public static int ToInt(this string str)
            => int.Parse(str);

        public static long ToLong(this string str)
            => long.Parse(str);

        public static bool IsNullOrEmpty(this string str)
            => string.IsNullOrEmpty(str);

        #endregion

        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }

        public static IEnumerable<T> Peek<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
            return source;
        }
    }
}


Measured memory_bytes: 3416
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;

int main(){
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D;
    cin >> S;
    A--;
    B--;
    C--;
    D--;
    bool ans = true;
    for(int i=A; i<max(C, D)-1; i++){
        if(S[i]=='#'&&S[i+1]=='#') ans = false;
    }
    // cout << (ans?"Yes":"No") << endl;
    if(C > D){
        bool tmp = false;
        for(int i=B-1; i<D; i++){
            if(S.substr(i, 3) == "...") tmp = true;
        }
        ans = ans && tmp;
    }
    cout << (ans?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 640
from collections import deque

n,m=list(map(int,input().split()))
graph=[[] for _ in range(n)]

for _ in range(m):
  a,b=list(map(int,input().split()))
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
#print(graph)

dist=[-1]*n
dist[0]=0

queue=deque([0])

while queue:
  v=queue.popleft()
  for nv in graph[v]:
    if (dist[nv]!=-1):
      continue
    dist[nv]=v
    queue.append(nv)

print("Yes")

for i in dist[1:]:
  print(i+1)
  

Measured memory_bytes: 34740
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++) cin>>arr[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(arr[0]-arr[1]);
  for(int i=2;i<n;i++){
      dp[i]= dp[i-1]+abs(arr[i]-arr[i-1]);
      for(int j=2;j<=k;j++){
          if(i-j<0)
          break;
          dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
      }
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 4368
#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 = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


int N;
const int MAX_N = 3010;

int main() {
  cin >>N;
  vector<int> A(N); rep(i, N) cin >>A[i];
  vector<vector<ll>> dp(MAX_N, vector<ll>(MAX_N, 0));
  rep(i, N) dp[i][i] = 0;

  for (int len=1; len<=N; len++){
    for (int i=0; i+len<=N; i++){
      int j = i + len;
      if ((N-len)%2 == 0){
        dp[i][j] = max(dp[i+1][j] + A[i], dp[i][j-1] + A[j-1]);
      }else{
        dp[i][j] = min(dp[i+1][j] - A[i], dp[i][j-1] - A[j-1]);
      }
    }
  }
  cout <<dp[0][N] <<endl;
}


Measured memory_bytes: 71168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main(void){
    ll n, m;
    cin >> n >> m;
    if(n == 1 && m == 1) cout << 1 << endl;
    else if(n == 1 && m != 1) cout << m - 2 << endl;
    else if(n != 1 && m == 1) cout << n - 2 << endl;
    else{
        ll ans = (n - 2) * (m - 2);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    vi a(4);
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
        vi b(4);
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hit=0, blow=0;
        rep(i,4) {
            if(a[i]==b[i]) hit++;
            else {
                rep(j,4) if(a[i]==b[j]) blow++;
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main() {
    char c;
    cin >> c;
    if('A' <= c && c <= 'Z'){
        cout << "A"<<endl;
    }
    else{
        cout << "a" << endl;
    }
    return 0;
}

Measured memory_bytes: 3564
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
#ball
X = [0] * (N + 1)
for i in range(N, 0, -1):
    # num = i+1
    tmp = A[i-1]
    # ここから上のボール
    for j in range(i, N+1, i):
        #これなかった
        if j == i:
            continue
        # AではなくボールXと
        # tmp ^= A[j-1]
        tmp ^= X[j]
    # X[i] = tmp ^ A[i]
    X[i] = tmp
    
    # if tmp == 0:
    #     X[i] = 0
    # else:
    #     X[i] = 1
# print(X)
# if sum(X) == 0:
#     print(sum(X))
#     exit()
print(sum(X))
ans = []
for i in range(N):
    if X[i+1] == 1:
        ans.append(i+1)
print(*ans)


Measured memory_bytes: 16184
A, B, M = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
x = []
y = []
c = []
for _ in range(M):
    xt, yt, ct = [int(x) for x in input().split()]
    x.append(xt)
    y.append(yt)
    c.append(ct)

# 割引券を使わない場合の最小値
ret = min(a) + min(b)

# 割引券を使った場合
for i in range(len(x)):
    t = a[x[i] - 1] + b[y[i] - 1] - c[i]
    if ret > t:
        ret = t

print(ret)

Measured memory_bytes: 24692
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int q,h,s,d,n;cin>>q>>h>>s>>d>>n;
	h = min(h,2*q);
	s = min(s,2*h);
	d = min(d,2*s);
	cout<<(n/2)*d+(n&1)*s;
}


Measured memory_bytes: 384
#include <cstdio>
#include <vector>
using namespace std;

vector<int> sort(vector<int> &array);

int main(){
	int n, hoge1, sum, hoge2;
	while(scanf("%d", &n) != EOF){
		vector<int> array;
		for(int i = 0; i < n; i++){
			scanf("%d", &hoge1);
			array.push_back(hoge1);
		}
		sort(array);
		sum = hoge2 = 0;
		for(int i = 0; i < n; i++){
			hoge2 += array[i];
			sum += hoge2;
		}
		printf("%d\n", sum);
	}
	return 0;
}

vector<int> sort(vector<int> &array){
    int temp = 0;
    for(int i = 0; i < array.size(); i++){
        for(int j = 0; j < array.size() - i - 1; j++){
            if(array[j] > array[j + 1]){
                temp = array[j];
                array[j] = array[j + 1];
                array[j + 1] = temp;
            }
        }
    }
    return array;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define loop(i, n) for(int i = 0 ; i < n ; ++i)
#define LOOP(i, a, b) for(int i = a ; i < b ; ++i)
#define max3(a, b, c) max(a, max(b,c))
#define max4(a, b, c, d) max3(a, b, max(c, d))
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18
#define inf 1e9
#define MOD 1000000007 //check
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int n, v[3002];
ll dp[3002][3002][2];
ll val(int l, int r, int i)
{
	if(l == r) return pow(-1, i)*v[r];
	ll &ans = dp[l][r][i];
	if(ans != -1) return ans;
	if(i == 0) ans = max(v[l]+val(l+1, r, i^1), v[r]+val(l, r-1, i^1));
	else ans = min(-v[l]+val(l+1, r, i^1), -v[r]+val(l, r-1, i^1));
	return ans;
}
int main() {
	_69e27;
	cin >> n;
	loop(i, n) cin >> v[i];
	memset(dp, -1, sizeof(dp));
	cout << val(0, n-1, 0);
	return 0;
}

Measured memory_bytes: 141312
#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
using namespace atcoder;

struct S {
    ll zero, one, inv;
};

typedef bool F;

S op(S l, S r) {
    return S{ l.zero + r.zero, l.one + r.one, l.inv + r.inv + l.one * r.zero };
}

S e() { return S{0, 0, 0}; }

S mapping(F l, S r) {
    if (!l) return r;
    return S{ r.one, r.zero, r.one * r.zero - r.inv };
}

F composition(F l, F r) {
//    return (l && !r) || (!l && r); // l ^ r;
    return l ^ r;
}

F id() {
    return false;
}

void Main()
{
    ll n, Q;
    cin >> n >> Q;

    vector<S> a(n);
    rep(i, n) {
        int ai;
        cin >> ai;
        if (ai) {
            a[i] = S{0, 1, 0};
        }
        else {
            a[i] = S{1, 0, 0};
        }
    }
    
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    rep(i, Q) {
        int t;
        cin >> t;
        if (t == 1) {
            int l, r;
            cin >> l >> r;
            l--;
            seg.apply(l, r, true);
        }
        else {
            int l, r;
            cin >> l >> r;
            l--;
            put(seg.prod(l, r).inv);
        }
    }
}
signed main(){ Main();return 0;}

Measured memory_bytes: 20472
S = list(input())
S = S[::-1]
is_NO = 0
i = 0
while i<len(S):
    if S[i] == 'm':
        if S[i+1] == 'a' and S[i+2] == 'e' and S[i+3] == 'r' and S[i+4] == 'd':
            i += 5
        else:
            is_NO = 1
            break
    elif S[i] == 'r' and S[i+1] == 'e' and S[i+2] == 'm':
        if  S[i+3] == 'a' and S[i+4] == 'e' and S[i+5] == 'r' and S[i+6] == 'd':
            i += 7
        else:
            is_NO = 1
            break
    elif S[i] == 'e':
        if S[i+1] == 's' and S[i+2] == 'a' and S[i+3] == 'r' and S[i+4] == 'e':
            i += 5
        else:
            is_NO = 1
            break
    elif S[i] == 'r' and S[i+1] == 'e' and S[i+2] == 's':
        if S[i+3] == 'a' and S[i+4] == 'r' and S[i+5] == 'e':
            i += 6
        else:
            is_NO = 1
            break
    else:
        is_NO = 1
        break
print("NO" if is_NO else "YES")


Measured memory_bytes: 4780
from operator import itemgetter
n, m = list(map(int, input().split() ))
values = list(map(int, input().split() ))
values.sort()

card_change = [list(map(int, input().split() )) for _ in range(m)]
card_change.sort(key = itemgetter(1))
# 変更後の数をkeyとしてソート

# X枚書き換えるとして、Xを全探索する方針で書いてみる
now = sum(values)
ans = sum(values)
idx = m - 1
for x in range(n):
	now -= values[x]

	card_change[idx][0] -= 1 # 変更可能枚数
	now += card_change[idx][1] # 変更後の値

	if now > ans:
		ans = now

	if card_change[idx][0] == 0:
		idx -= 1
		if idx < 0:
			break

print(ans)


Measured memory_bytes: 32976
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int n,i;
  cin >> n >> i;

  cout << n-i+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str,s;
	int i,m;
	while(cin >> str){
		s="";
		for(i=0;i<str.size();i++){
			if(str[i]=='@'){
				m=str[i+1]-'0';
				s.append(m,str[i+2]);
				i=i+2;
			}else{
				s+=str[i];
			}
		}
		cout << s <<endl;
	}
	return 0;
}

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

#define SIZE (200005)

int main() {
    char s[SIZE], t[SIZE];
    cin >> s >> t;
    int ans = 0;
    for (int i = 0;i < strlen(s);i++) if (s[i] != t[i]) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3956
n = int(input())
b = list(map(int, input().split()))

a = sorted(b)

a.sort()

max_i = 0
min_i = 0
maxv = -1<<60
minv = 1<<60
for i in range(n):
    if maxv < b[i]:
        maxv = b[i]
        max_i = i
    if minv > b[i]:
        minv = b[i]
        min_i = i

if (a[0] >= 0):
    print(n-1)
    for i in range(n-1):
        print(i+1,i+2)
elif (a[-1] <= 0):
    print(n-1)
    for i in reversed(range(n-1)):
        print(i+2,i+1)
elif (abs(a[0]) < abs(a[-1])):
    print(2*n-2)
    for i in range(n):
        if max_i == i:continue;
        print(max_i+1, i+1)
    for i in range(n-1):
        print(i+1,i+2)
else:
    print(2*n-2)
    for i in range(n):
        if min_i == i:continue;
        print(min_i+1, i+1)
    for i in reversed(range(n-1)):
        print(i+2,i+1)
        

Measured memory_bytes: 3064
#define DEBUG 0

/**
 * File    : C2.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-21 22:20:49
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
vector<int> V[200010];
int visited[200010];

void dfs(int v, int d)
{
  if (visited[v] >= 0)
  {
    return;
  }
  visited[v] = d;
  for (auto x : V[v])
  {
    dfs(x, d + 1);
  }
}

int main()
{
  cin >> N;
  for (auto i = 0; i < N - 1; i++)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    V[a].push_back(b);
    V[b].push_back(a);
  }
  fill(visited, visited + N, -1);
  dfs(0, 0);
  int maxi = 0;
  int ind = 0;
  for (auto i = 0; i < N; i++)
  {
    if (visited[i] > maxi)
    {
      maxi = visited[i];
      ind = i;
    }
  }
  fill(visited, visited + N, -1);
  dfs(ind, 0);
  maxi = 0;
  for (auto i = 0; i < N; i++)
  {
    if (visited[i] > maxi)
    {
      maxi = visited[i];
    }
  }
  if (maxi % 3 == 1)
  {
    cout << "Second" << endl;
  }
  else
  {
    cout << "First" << endl;
  }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    // vector<vector<int>> dp(n, vector<int>(3));
    // dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0];
    for(int i = 1; i < n; i++) {
        a[i] = a[i] + max(b[i-1], c[i-1]);
        b[i] = b[i] + max(a[i-1], c[i-1]);
        c[i] = c[i] + max(a[i-1], b[i-1]);
    }
    // cout << *max_element(dp[n-1].begin(), dp[n-1].end()) << endl;
    cout << max(max(a[n-1], b[n-1]), c[n-1]) << endl;
    return 0;
}

Measured memory_bytes: 1408
/**
 * code generated by Junayed Kader
 * Student of Computer Science
 * @author
 */
///Bismillahir Rahmanir Rahim///
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

using namespace std;
using namespace __gnu_pbds;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007


template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;//*(x.find_by_order(i)),x.order_of_key(k)

/*************** #Template FUNCTIONS# **************/


#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

/// Check all 8 direction co-ordinates.
/// N, NE, E, SE, S, SW, W, NW
static int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};
static int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu ()
{
    cerr << endl;
}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}

ll gcd ( ll a, ll b )
{
    return __gcd ( a, b );
}
ll lcm ( ll a, ll b )
{
    return a * ( b / gcd ( a, b ) );
}
ll max(ll a,ll b)
{
    return a>b?a:b;
}
ll min(ll a,ll b)
{
    return a<b?a:b;
}
/********************** START **********************/

void _case()
{
    ll a,b, x;
    cin>>a>>b>>x;
     ll number1 , number2, total_number;
    if(a%x==0)
    {
        number1 = a/x;
    }else{
    number1 = (a/x)+1;
    }
    number2 = b/x;
    total_number = (number2-number1)+1;
    cout<<total_number<<endl;
}

int main()
{
    optimize();

    _case();

    return 0;
}
/*****************  ALHAMDULILLAH  *****************/


Measured memory_bytes: 3644
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const long long INFL = 2e18;
const int MOD = 1000000007;
int main(){
	int n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);
	for(int i = 0;i < n;i++)cin >> a[i] >> b[i];

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

	if(n % 2 == 1){
		cout << b[n/2] - a[n/2] + 1 << endl;
	}
	else{
		ll ans = 0;
		ll l = (a[n/2] + a[n/2-1] + 1) / 2,r = (b[n/2] + b[n/2-1] + 1) / 2 - 1;
		if((a[n/2] + a[n/2-1]) % 2 == 1)ans++;
		if((b[n/2] + b[n/2-1]) % 2 == 0)ans++;
		cout << (r - l + 1) * 2 + ans << endl;
	}
}


Measured memory_bytes: 6344
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

using namespace std;

long long A[200001];

int main()
{
    // 文字列の入力
    int N;
	long long A[200001];
	cin >> N;
	
	long long sum = 0;
	
	cin >> A[0];
	int max = A[0];
	for(int i = 1; i < N; i++) {
		cin >> A[i];
		
		if(A[i] < max) {
			sum += (max - A[i]);
		}
		
		if(A[i] > max) {
			max = A[i];
		}
	}
	
	printf("%lld\n", sum);
	
    return 0;
}

Measured memory_bytes: 5260
import os, sys, re, math

(A, B) = [int(n) for n in input().split()]

(A, B) = (A, B) if A < B else (B, A)
if (B - A) % 2 == 0:
    c = (B - A) // 2
    print(B - c)
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>
 
using namespace std;
typedef long long int ll;

//０以上N以下の整数で、ある条件を満たすものの個数を求めよ

int main(){

    ll N = 0;
    cin >> N;

    vector<ll > A(N+1);
    for(ll i = 0; i < N + 1; i++){
        cin >> A[i];
    }

    vector<ll > B(N);
    for(ll i = 0; i < N; i++){
        cin >> B[i];
    }

    //反転
    //reverse(A.begin(), A.end());
    //reverse(B.begin(), B.end());

    ll ans = 0;
    for(ll i = 0; i < N; i++){
        if(A[i] >= B[i]){
            ans += B[i];
        }else{
            ans += A[i];
            B[i] -= A[i];

            if(A[i + 1] >= B[i]){
                ans += B[i]; 
                A[i + 1] -= B[i];              
            }else{
                ans += A[i + 1]; 
                A[i + 1] = 0;     
            }
            
        }
    }

    cout << ans << endl;
} 

Measured memory_bytes: 1792
#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 << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 3604
re = input().split()
a = int(re[0])
b = float(re[1])
for i in range(10):
    if i <= b <i+1:
        c = int(i)
        #d = int(100 * (b - i))
        d = int(round(100 * (b - i)))
        break
    
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)

Measured memory_bytes: 9076
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        int[] a = ReadIntArray();
        Array.Sort(a);
        WriteLine(a[0]+a[1]);
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	int n,m;
	cin>>n>>m;
	int a[n+1];
	int sum=0;
	f(i,1,n){
		cin>>a[i];
		sum+=a[i];
	}
	int cnt=0;
	f(i,1,n){
		if(sum<=a[i]*(4*m))
		cnt++;
	}
	if(cnt>=m)
	cout<<"Yes";
	else
	cout<<"No";
}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}




Measured memory_bytes: 256
#!/mnt/c/Users/moiki/bash/env/bin/python

from collections import Counter

N,K = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort(key=lambda x:-x[1])

selected = Counter()
ans = 0
stack = []

for t,d in src[:K]:
    ans += d
    selected[t] += 1
    stack.append((t,d))


ans += len(selected)**2
# exit(0)

tmp = ans
for t,d in src[K:]:
    if t in selected: continue
    while stack:
        t0,d0 = stack.pop()
        if selected[t0] > 1:
            tmp += d - d0 + 2*len(selected)+1
            ans = max(ans, tmp)
            selected[t0] -= 1
            selected[t] += 1
            break
print(ans)



Measured memory_bytes: 28096
#include <iostream>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>V(N);
	for (int i = 0; i < N; i++)cin >> V[i];
	sort(V.begin(), V.end());
	double ans = V[0];
	for (int i = 1; i < N; i++)
	{
		ans = (ans + double(V[i])) / 2;
	}
	cout << ans;
}

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

long long int gcd(long long int a, long long int b){ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 


long long int lcm(long long int a, long long int b) 
{ 
	return (a*b)/gcd(a, b); 
} 

int main() 
{ 
	long long int a, b;
	cin>>a>>b;
	cout<<lcm(a, b); 
	return 0; 
} 


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

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll x = 0, y = 0, z = 0;
  for (int i = 0, k; i < n; i++){
    cin >> k;
    if (k<= a) x++;
    else if (k<=b) y++;
    else z++;
  }
  cout << min(x,min(y,z)) << '\n';
  return 0;
}

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

int main(){

	int n, answer, a;
	std::cin >> n;
	std::vector<int> number(n-1);
	std::vector<long int> move(21,0),moving(21,0);

	for(int i=0;i<n-1;++i){
		std::cin >> number[i];
	}
	std::cin >> answer;

	move[number[0]]=1;

	for(int i=1;i<n-1;i++){
		for(int j=0;j<21;j++){
			if(move[j]!=0){
				if((a=j+number[i])<=20){
					moving[a]+=move[j];
				}
				if((a=j-number[i])>=0){
					moving[a]+=move[j];
				}
				move[j]=0;
			}
		}
		for(int j=0;j<21;j++){
			move[j] = moving[j];
			moving[j]=0;
		}
	}
	std::cout << move[answer] << std::endl;

	return 0;
}


Measured memory_bytes: 3100
n = int(input())
a = list(map(int, input().split()))

mod = 10**9 + 7
ans = 1
cnt = [0] * 3
for i in range(n):
    t = 0
    first = True
    for j in range(3):
        if cnt[j] == a[i]:
            t += 1
            if first:
                first = False
                cnt[j] += 1
    ans = (ans * t) % mod
print(ans)

Measured memory_bytes: 14020
def main():
    n = int(input())
    a = sorted(list(map(int,input().split())),reverse=True)
    ans = a[0]
    for i in range(3,n+1):
        if i%2==0:
            ans += a[i//2-1]
        else:
            ans += a[(i-1)//2]
    print(ans)

if __name__ == "__main__":
    main()


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

using namespace std;

int main(){
    int N; cin >> N;
    if(!(N&(N-1))){
        cout << "No" << endl;
        return 0;
    }
    vector<int> add(N+1, 0);
    vector<int> a;
    if(N%2 == 0){
        for(int i=N-2;i>=2;i-=2){
            if(N^i > i){
                a.push_back(i+1);
                a.push_back(i);
                add[i] = add[i+1] = 1;
                a.push_back(N^i);
                a.push_back((N^i)+1);
                add[N^i] = add[(N^i)+1] = 1;
                break;
            }
        }
   }
   for(int i=2;i<=N;i++) if(!add[i]) a.push_back(i);
   if(N%2 == 0 && a.back() == N) a.pop_back();
   cout << "Yes" << endl;
   cout << 1 << " " << a[0] << endl;
   cout << 1 << " " << N+a[1] << endl;
   cout << a[1] << " " << N+1 << endl;
   bool checked = false;
   for(int i=1;i<a.size();i++){
       cout << a[i-1] << " " << a[i] << endl;
       cout << N+a[(i-1)^1] << " " << N+a[i^1] << endl;
       if(!checked && N%2 == 0 && (a[i-1]^a[i]) == N){
           checked = true;
           cout << N << " " << a[i-1] << endl;
           cout << 2*N << " " << a[i] << endl;
       }
   }
}

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

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

    int ans = 0;
    for (int i = 1; i <= n; i++) ans += i;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, strong = -1;
  srand((unsigned)time(NULL));
  cin >> N;
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    if(count(s.begin(), s.end(), 'x') == 0) strong = i + 1;
  }
  for(int i = 0; i < 1000; i++){
    cout << (~strong ? strong : rand() % N + 1) << endl;
  }
}

Measured memory_bytes: 1332
#include<stdio.h>
int main(){
  int p[110],m[110],x,n,t,i;
  scanf("%d%d",&x,&n);
  for(i=0;i<110;i++)p[i]=m[i]=1;
  for(i=0;i<n;i++){scanf("%d",&t);if(x<t)p[t-x]=0;else if(x>t)m[x-t]=0;else p[0]=m[0]=0;}
  for(i=0;i<110;i++){if(m[i]){printf("%d",x-i);return 0;}if(p[i]){printf("%d",x+i);return 0;}}
}


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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n, a, b;
   cin >> n >> a >> b;
   int sum = 0;
   for(int i = 1; i <= n; i++)
   {
      int x = i;
      int tmp =0;
      while(x)
      {
         tmp += x%10;
         x /= 10;
      }
      if(tmp >= a && tmp <= b)
         sum += i;
   }
   cout << sum << nl;
   return 0;
}


Measured memory_bytes: 3660