akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	vector<int> vs(n);
	for(auto &x:vs) cin >> x;
	reverse(all(vs));
	bool ans = true;
	int last = *vs.begin();
	for(auto x:vs){
		if(x<last) last = x;
		if(x>last+1) ans=false;
	}
	if(ans)
		cout << "Yes" << endl;
	else 
		cout << "No" << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int main(){
  char step[101];
  int i = 0;
  int flag = 1;
  scanf("%s",step);
  while(step[i]!='\0'){
    if(i%2==0){
      if(step[i] == 'L'){
        flag = 0;
      }
    }else{
      if(step[i] == 'R'){
        flag = 0;
      }
    }
    i++;
  }
  if(flag){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
    
long long inv;
int *B;
    
long long countup(int *A, int p, int r);
    
int main(int argc, char *argv[])
{
  int n, i, j;
  int *A;
    
  inv = 0;
    
  scanf("%d", &n);
  A = (int *)malloc(sizeof(int) * n);
  B = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) scanf("%d", &A[i]);
    
  inv = countup(A, 0, n - 1);
    
  printf("%lld\n", inv);
    
  return 0;
}
    
long long countup(int *A, int p, int r)
{
  int q = p + (r-p)/2;
  int i, j, k, tmp;
  long long ct = 0;
    
  if (r - p < 3) {
    for (i = p; i < r; i++) {
      for (j = r; j > i; j--) {
    if (A[j] < A[j-1]) {
      tmp = A[j-1];
      A[j-1] = A[j];
      A[j] = tmp;
      ct++;
    }
      }
    }
    return ct;
  }
  ct += countup(A, p, q);
  ct += countup(A, q+1, r);
    
  i = p;
  j = q + 1;
  for (k = p; k <= r; k++) {
    if (i >= q + 1 || j >= r + 1) {
      if (i >= q + 1) B[k] = A[j++];
      else B[k] = A[i++];
    } else {
      if (A[i] > A[j]) {
    B[k] = A[j];
    ct += q - i + 1;
    j++;
      } else {
    B[k] = A[i];
    i++;
      }
    }
  }
  for (k = p; k <= r; k++) A[k] = B[k];
  return ct;
}


Measured memory_bytes: 3412
#include <cstdio>
#include <regex>

int LEN = 10;

int main() {
    char s[LEN + 1];
    scanf("%s", s);
    std::regex re("A[a-z]+C[a-z]+");
    if (regex_match(s, re)) {
        printf("AC\n");
    } else {
        printf("WA\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		InputStreamReader isr;
		BufferedReader br;
		try {
			isr = new InputStreamReader(System.in);
	   		br = new BufferedReader(isr);
	        String nstr = br.readLine();
	    	final int n = Integer.parseInt(nstr);
	        if (n < 2 || n > 10) {
	        	throw new IllegalArgumentException();
	        }
	        double sum = 0;
	        for (int i = 0; i < n; i++) {
	        	String str = br.readLine();
	        	StringTokenizer st = new StringTokenizer(str, " ");
	        	double amount = Double.parseDouble(st.nextToken());
	        	String unit = st.nextToken();
	        	if (!unit.equals("JPY") && !unit.equals("BTC")) {
	        		throw new IllegalArgumentException();
	        	}
	        	sum += unit.equals("JPY") ? amount : getJPY(amount);
	        }
	        System.out.println(sum);
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} catch (IllegalArgumentException iae) {
			iae.printStackTrace();
			System.err.println("入力が正しくありません。");
		}
	}

	private static double getJPY(final double amount) {
		final double rate = 380000.0;
		return rate * amount;
	}
}


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

d = {2:0, 4:0, 1:0}

for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1

d[2] = d[2] % 2

if d[2] == 0:
  if d[1] - 1 <= d[4]:
    print("Yes")
  else:
    print("No")
else:
  if d[1] <= d[4]:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string S;
    
    cin >> S;
    
    if(S[0] == S[1] && S[1] == S[2]){
        
        cout<<"No"<<endl;
    }
    
    else{
        cout<<"Yes"<<endl;
    }
}
    

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;

int arr[maxr];

int digits(int x) {
	int count = 0;
	while (x > 0) {
		x /= 10;
		count ++;
	}
	return count - 1;
}

int32_t main()
{
	GO;
	int n;
	cin >> n;
	int product = 1; bool zero = false;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		if (arr[i] == 0)
			zero = true;
	}
	if (zero) {
		cout << 0 << endl;
		return 0;
	}
	int value = 1e18;
	for (int i = 0; i < n; i++) {
		if (digits(product) + digits(arr[i]) >= 18 && product * arr[i] != value) {
			cout << -1 << endl;
			return 0;
		}
		product *= arr[i];
		if (product > value) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << product << endl;
	return 0;
}

//!

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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define tc ll t; cin >> t; while (t--)
#define sz(c) (ll) (c).size()
#define trav(x,c) for(auto &x : c)
#define all(c) (c).begin(), (c).end()
#define rll(c) (c).rbegin(), (c).rend()
#define _for(i,a,n) for(ll i = a ; i < n; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios::sync_with_stdio(0); cin.tie(0);

int main() {
    godspeed;
    string s; cin >> s;
    _for(i,0,sz(s)) cout << 'x';
}

Measured memory_bytes: 3620
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
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
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	int x, a;
	cin >> x >> a;
	if (x < a)cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_N 10000

int par[MAX_N]; // 親
int depth[MAX_N]; // 木の深さ

// n要素で初期化
void init(int n) {
	rep(i, 0, n) {
		par[i] = i;
		depth[i] = 0;
	}
}

// 木の根を求める
int find(int x) {
	if(par[x] == x) return x;
	else return par[x] = find(par[x]);
}

// xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(depth[x] < depth[y]) {
		par[x] = y;
	} else {
		par[y] = x;
		if(depth[x] == depth[y]) depth[x]++;
	}
}

// xとyが同じ集合に属するか否か
bool same(int x, int y) {
	return find(x) == find(y);
}


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

	string S, T;
	cin >> S >> T;

	map<char, int> m1, m2;
	rep(i, 0, S.size()) {
		m1[S[i]]++;
		m2[T[i]]++;
	}

	vector<int> v1, v2;
	for(map<char, int>:: iterator it = m1.begin(); it != m1.end(); it++) {
		v1.push_back(it->second);
	}
	for(map<char, int>:: iterator it = m2.begin(); it != m2.end(); it++) {
		v2.push_back(it->second);
	}

	vsort(v1);
	vsort(v2);

	rep(i, 0, v1.size()) {
		if(v1[i] != v2[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;


}


Measured memory_bytes: 916
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n, x, t;
        cin >> n >> x >> t;
        cout << t * ((n + x - 1) / x);
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <bits/stdc++.h>
#include<string>
using namespace std;
 
int main() {
    long long int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*c,max(a*d,max(b*c,b*d)));
	return 0;   
}


Measured memory_bytes: 3588
#include<stdio.h>

int main(){
    char stu[10000];
    int m,f,r;
    int i=0;
    
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        
        if(m==-1 && f==-1 && r==-1){
            stu[i]='G';
            break;
        }else if(m==-1 || f==-1){
            stu[i]='F';
            i++;
        }else if(m+f>=80){
            stu[i]='A';
            i++;
        }else if(m+f>=65){
            stu[i]='B';
            i++;
        }else if(m+f>=50){
            stu[i]='C';
            i++;
        }else if(m+f>=30){
            if(r>=50){
                stu[i]='C';
            }else{
                stu[i]='D';
            }
            i++;
        }else{
            stu[i]='F';
            i++;
        }
    }
    
    i=0;
    
    while(stu[i]!='G'){
        printf("%c\n",stu[i]);
        i++;
    }
    
    return 0;
}

Measured memory_bytes: 1796
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::{HashMap, HashSet};

fn main() {
    input!{
        n: usize,
        s: chars
    }
    let mut post = HashMap::new();
    for &c in &s {
        *post.entry(c).or_insert(0) += 1;
    }
    let mut pre = HashMap::new();
    let mut tot = HashSet::new();
    *post.get_mut(&s[0]).unwrap() -= 1;
    if post.get(&s[0]) == Some(&0) {
        post.remove(&s[0]);
    }
    for i in 1..n - 1 {
        *pre.entry(s[i - 1]).or_insert(0) += 1;
        *post.get_mut(&s[i]).unwrap() -= 1;
        if post.get(&s[i]) == Some(&0) {
            post.remove(&s[i]);
        }
        for &a in pre.keys() {
            for &c in post.keys() {
                tot.insert((a, s[i], c));
            }
        }
    }
    println!("{}", tot.len());
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>

#define MOD 1000000007
#define INF 2147483647
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std; 

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    bool taka = true;
    while (K--) {
        if (taka) {
            taka = false;
            B += A /= 2;
        }
        else {
            taka = true;
            A += B /= 2;
        }
    }
    cout << A << " " << B << endl;
    getchar(); getchar();
    return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b;
  c=0;
  for (int i=a;i<b+1;i++){
    int d,e,f,g;
    d=i/10000;
    e=i/1000-d*10;
    f=i/10-i/100*10;
    g=i-i/10*10;
    if (d==g&&e==f){
      c++;
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,p[65000],joi[64999],i,j;
	long long MAX,sump,sumc;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		sump=0;
		for(i=0;i<n;i++){
			scanf("%d",&p[i]);
			sump+=p[i];
		}
		for (i=0;i<n-1;i++){
			scanf("%d",&joi[i]);
		}
		sort(joi,joi+n-1,greater<int>());
		MAX=(long long)sump*n;
		for(i=1;i<n/2+1;i++){
			sumc=sump;
			for(j=0;j<i;j++){
				sumc=(long long)sumc+joi[j];
			}
			if(sumc*(n-i)>MAX){
				MAX=sumc*(n-i);
			}
		}
		printf("%lld\n",MAX);
	}
	return 0;
}


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

int main() {
  char S;
  int res = 0;
  int count = 0;
  
  for (int i = 0; i < 3; i++) {
    cin >> S;  
    if (S == 'R') {
      count++;
      if (res < count) {
        res = count;
      }
    }
    else {
      count = 0;
    }
  }

  cout << res << endl;
}



Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>

    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin>>n;
    string s; cin>>s;
    ll q; cin>>q;
    map<int,set<ll>> mp;
    FOR(i,0,n)mp[s[i]-'a'].insert(i);
    FOR(i,0,'z'-'a'+3)mp[i].insert(n+1);

    FOR(time,0,q){
        ll in; cin>>in;
        if(in == 1){
            ll p; char cur;
            cin>>p>>cur;
            p--;
            char pre = s[p];
            s[p] = cur;
            mp[pre-'a'].erase(p);
            mp[cur-'a'].insert(p);
        }
        else{
            ll l,r; cin>>l>>r;
            l--;
            ll res = 0;
            FOR(i,0,'z'-'a'+3){
                if(r>*mp[i].lower_bound(l))res++;
            }
            cout<<res<<endl;
        }
    }
}

Measured memory_bytes: 24220
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 55
#define mod 998244353
using namespace std;

int n;
int x[maxn], y[maxn];
int f[maxn];

int getf(int x)
{
	return (f[x] == x) ? x : f[x] = getf(f[x]);
}

void unite(int x, int y)
{
	x = getf(x);
	y = getf(y);
	if (x == y)
		return;
	f[y] = x;
}

void init()
{
	for (int i = 0; i < n; i++)
		f[i] = i;
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d%d", &x[i], &y[i]);

	if (n == 1)
	{
		printf("1");
		return 0;
	}
	int ans = INT_MAX;
	for (int A = 0; A < n; A++)
	{
		for (int B = A + 1; B < n; B++)
		{
			int p = x[B] - x[A];
			int q = y[B] - y[A];
			init();
			for (int i = 0; i < n; i++)
			{
				for (int j = i + 1; j < n; j++)
				{
					if (x[i] + p == x[j] && y[i] + q == y[j])
						unite(i, j);
					else if (x[i] - p == x[j] && y[i] - q == y[j])
						unite(i, j);
				}
			}
			int cnt = 0;
			for (int i = 0; i < n; i++)
				if (f[i] == i)
					cnt++;
			ans = min(ans, cnt);
		}
	}
	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner stdIn = new Scanner(System.in)) {
			Main m = new Main();
			while (true) {
				int h = stdIn.nextInt();
				int w = stdIn.nextInt();
				if (h > 300 || w > 300) {
					throw new RuntimeException(
							"Error:???????????????0??????300??§??????");
				}
				if (h == 0 && w == 0) {
					break;
				}
				m.setChar('#');
				m.DrawSquare(h, w);
				System.out.println("");
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}

	private Character displayChar;
	/**
	 * ???????????????????????§????§???¢?????????
	 * @param height	????§???¢?????????(int)
	 * @param width		????§???¢??????(int)
	 */
	protected void DrawSquare(int height, int width) {
		if (height < 0 || width < 0) {
			throw new RuntimeException("Error:????????????????????\?????????????????????");
		}
		for (int i = 1; i <= height; i++) {
			for (int j = 1; j <= width; j++) {
				System.out.print(this.displayChar);
			}
			System.out.println("");
		}
	}

	/**
	 * ????§???¢???????????????????¨????
	 * @param displayChar???????????????(char)
	 */
	protected void setChar(Character displayChar) {
		this.displayChar = displayChar;
	}
}

Measured memory_bytes: 36840
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    println(problem022a(s))
}

fun problem022a(s: String): String {
    if (s.length < 26) {
        for (alphabet in 'a'..'z') {
            if (!s.contains(alphabet)) {
                return s + alphabet
            }
        }
    }
    if (s.length == 26) {
        for (i in 24 downTo 0) {
            val si = s[i]
            val siP = s[i + 1]
            if (si < siP) {
                val left = s.take(i)
                val right = s.takeLast(i)
                for (j in 'a'..'z') {
                    if (!left.contains(j)) {
                        if (left + j > s) {
                            return left + j
                        }
                    }
                }
            }
        }
    }
    return "-1"
}

Measured memory_bytes: 31256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int a,b,c,x;cin>>a>>b>>c>>x;
    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(i*500+j*100+k*50==x)ans++;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    double h,a,i;
    cin>>h>>a;
    cout<<ceil(h/a);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define ALL(v) (v).begin(),(v).end()
#define FOR(i, n) for(ll (i)=0; (i)<(n); (i)++)
#define RFOR(i, n) for(ll (i)=(n)-1; (i)>=0; (i)--)
#define REP(i, x, n) for(ll (i)=(x); (i)<(n); (i)++)
#define RREP(i, x, n) for(ll (i)=(n)-1; (i)>=x; (i)--)

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

        ll N, K;
        cin >> N >> K;
        vector<ll> p(N);
        FOR(i, N) cin >> p[i];
        sort(ALL(p));
        ll ans = 0;
        FOR(i, K) ans += p[i];
        cout << ans << endl;

        return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const ll INF = 1e12+1;

//考えるのは4通り
//左の寺、そっからさいちか神社 右の寺、そっからさいちか神社
//にぶたん

int main() {
    int A,B,Q;
    cin >> A >> B >> Q;
    vector<ll> s(A+2), t(B+2), x(Q);
    for (int i = 1; i <= A; i++) cin >> s[i];
    for (int j = 1; j <= B; j++) cin >> t[j];
    for (int i = 0; i < Q; i++) cin >> x[i];
    s[0] = t[0] = -INF;
    s[A+1] = t[B+1] = INF;

    for (int q = 0; q < Q; q++) {
        ll start = x[q];
        ll res = INF;
        
        auto lb = lower_bound(s.begin(),s.end(),start);
        lb--;
        ll node = *lb;
        auto lb2 = lower_bound(t.begin(),t.end(),node);
        chmin(res,abs(node-start)+abs(node-*lb2));
        chmin(res,abs(node-start)+abs(node-*(lb2-1)));
        lb++;
        node = *lb;
        lb2 = lower_bound(t.begin(),t.end(),node);
        chmin(res,abs(node-start)+abs(node-*lb2));
        chmin(res,abs(node-start)+abs(node-*(lb2-1)));

        lb = lower_bound(t.begin(),t.end(),start);
        lb--;
        node = *lb;
        lb2 = lower_bound(s.begin(),s.end(),node);
        chmin(res,abs(node-start)+abs(node-*lb2));
        chmin(res,abs(node-start)+abs(node-*(lb2-1)));
        lb++;
        node = *lb;
        lb2 = lower_bound(s.begin(),s.end(),node);
        chmin(res,abs(node-start)+abs(node-*lb2));
        chmin(res,abs(node-start)+abs(node-*(lb2-1)));

        cout << res << endl;

    }





}

Measured memory_bytes: 3712
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    long long w, h, x, y;
    cin >> w >> h >> x >> y;
    double area = (double)(w * h);
    int means = 0;
    if (x * 2 == w && y * 2 == h) means = 1;
    printf("%.6f %d\n", area/2.0, means);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    Lot[] lot;
    int n, m, ans;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    m = sc.nextInt();
	    if(!(n==0 && m==0)){
		lot = new Lot[n];
		for(int i=0; i<n; i++)
		    lot[i] = new Lot(sc.next(), sc.nextInt());
		ans = 0;
		solve();
	    }
	}
    }

    void solve(){
	for(int i=0; i<m; i++){
	    char[] x = sc.next().toCharArray();
	    for(int j=0; j<n; j++){
		char[] y = lot[j].getNum();
		if(check(x, y, 0)){
		    ans += lot[j].getMoney();
		    j = n;
		}
	    }
	}
	System.out.println(ans);
    }

    boolean check(char[] x, char[] y, int level){
	if(level==x.length)
	    return true;
	if(x[level]==y[level] || y[level]=='*')
	    return check(x, y, level+1);
	else return false;
    }

    class Lot{
	char[] num;
	int money;
	Lot(String s, int m){
	    num = s.toCharArray();
	    money = m;
	}
	char[] getNum(){ return num; }
	int getMoney(){ return money; }
    }
}

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

int N, K, h, ans;

int main() {
    scanf("%d%d", &N, &K);

    for(int i = 0; i < N; i++) {
        scanf("%d", &h);

        if(h >= K) ans++;
    }

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


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
//#include<unordered_map>
//#include<unordered_set>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> P; 
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 200005;
//////////////////////////////

Int n, s;
Int a[3300];
Int dp[3300];

void solve()
{
	cin >> n >> s;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	Int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = s - a[i]; j >= 0; j--) {
			if (j == 0) dp[a[i]] = (dp[a[i]] + (i + 1)) % 998244353;
			else dp[j + a[i]] = (dp[j + a[i]] + dp[j]) % 998244353;
		}
		ans += dp[s];
	}

	cout << ans % 998244353 << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }
#define round(x, y) ((2 * x + y) / (2 * y))
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template <typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
    vector<T> a = vector<T>(n + oneIndexed);

    for (ll i = 0; i < n; i++) {
        T p;
        cin >> p;
        a[i + oneIndexed] = p;
    }

    return move(a);
}

template <typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
    if (end == -1)
        end = sz(a) - 1;
    for (ll i = begin; i <= end; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

map<ll, ll> req;

ll solve(ll n) {
    if (n == 1)
        return 1;
    // if (req[n] != 0) {
    //     return req[n];
    // }

    ll ans = solve(n / 2);
    // req[n / 2] = ans;
    return 2 * ans + 1;
}

void solve() {
    ll h;
    cin >> h;

    req[1] = 1;
    cout << solve(h) << endl;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // freopen("file", "r", stdin);
    // freopen("file", "w", stdout);
    // ll t;cin >> t;while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
int taro[100];
int hanako[100];
void solve(int n, int m){
  int taro_sum = 0;
  for(int i = 0; i < n; i++){
    cin >> taro[i];
    taro_sum += taro[i];
  }
  int hanako_sum = 0;
  for(int i = 0; i < m; i++){
    cin >> hanako[i];
    hanako_sum += hanako[i];
  }

  int ans_sum = INT_MAX;
  int ans1 = -1;
  int ans2 = -1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      if(taro_sum - taro[i] + hanako[j] == hanako_sum + taro[i] - hanako[j]
          && ans_sum > taro[i] + hanako[j]){
        ans1 = taro[i];
        ans2 = hanako[j];
        ans_sum = taro[i] + hanako[j];
      }
    }
  }

  if(ans1 >= 0){
    cout << ans1 << " " << ans2 << endl;
  } else {
    cout << -1 << endl;
  }
}
int main(){
  
  while(true){
    int n;
    int m;
    cin >> n >> m;
    if(n == 0 && m == 0){
      break;
    }

    solve(n, m);
  }

  return 0;
}


Measured memory_bytes: 3012
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	var a, b int
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		fmt.Scan(&a, &b)
		m[a] += b
	}

	keys := make([]int, len(m))
	i := 0
	for key := range m {
		keys[i] = key
		i++
	}
	sort.Ints(keys)

	sum := 0
	for _, v := range keys {
		sum += m[v]
		if k <= sum {
			fmt.Println(v)
			return
		}
	}
}


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

map<int,int> mps[2];


int main(void){
	int n;
	cin>>n;
	for(int i = 0; i < n; i++){
		int t;
		cin>>t;
		mps[i%2][t]++;
	}
	vector<pair<int,int> > v1,v2;
	transform(mps[0].begin(), mps[0].end(), back_inserter(v1), [](pair<int,int> i){return pair<int,int>(i.second, i.first);});
	transform(mps[1].begin(), mps[1].end(), back_inserter(v2), [](pair<int,int> i){return pair<int,int>(i.second, i.first);});
	sort(v1.begin(), v1.end(), greater<pair<int,int> >());
	sort(v2.begin(), v2.end(), greater<pair<int,int> >());
	int r = 0;
	if(v1[0].second == v2[0].second){
		if(v1.size() > 1 && v2.size() > 1){
			r = n - max(v1[0].first + v2[1].first, v1[1].first + v2[0].first);
		}else if(v1.size() > 1){
			r = n - v1[1].first - v2[0].first;
		}else if(v2.size() > 1){
			r = n - v1[0].first - v2[1].first;
		}else{
			r = n - max(v1[0].first, v2[0].first);
		}
	}else{
		r = n - v1[0].first - v2[0].first;
	}

	cout<<r<<'\n';	

	return 0;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
const long double PI = 3.141592653589793238462643383279502884197;

int main() {
	cin.tie(NULL); cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	int L, R, d;
	cin >> L >> R >> d;

	cout << R / d - (L - 1) / d;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <stack>
#include <sstream>
#include <set>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int n,m ;
    cin >> n >> m ;
    vector<char> s(n+1) ;
    for (size_t i = 0; i < n+1; i++)
    {
        cin >> s.at(i) ;
    }
    stack<int> deme ;
    int now = n ;
    while(1){
        for (size_t i = 0; i < m; i++)
        {
            if (now >= m-i)
            {
                
                if (s.at(now-m+i) == '0')
                {
                    now -= m-i ;
                    deme.push(m-i) ;
                    break ;
                }else if (i == m-1)
                {
                    cout << -1 << endl ;
                    return 0 ;
                }
            
            }
        }
        if (now == 0)
        {
            break ;
        }
        
    }
    cout << deme.top() ;
    deme.pop() ;
    while (deme.empty() == 0)
    {
        cout << " " << deme.top() ;
        deme.pop() ;
    }
    cout << endl ;
    
}


Measured memory_bytes: 860
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll inf = 1e9 + 7;
const ll Mod = 998244353;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);


int main(){
  int N, ans = 0; cin >> N;
  for (int i = 0; i < N; i++){
    int A; cin >> A;
    while (A % 2 == 0){
      A /= 2; ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}
ll kw(ll k,ll n){
    
    ll ans  =0;
    ll mi,ma;
    mi= wa(k,0,k-1);
    
    ma = wa(k,n-k+1,n);
    
    return (ma-mi +1)%modd;
}

int main(){
    ll x,k,d;
    cin  >> x >> k >> d;

    x = abs(x);

    ll str = min(k,x/d);
    k -= str;
    x -= str*d;

    if(k%2==0){
        cout << x <<endl;
    }else{
        cout << d-x <<endl;
    }
}





Measured memory_bytes: 3632
#include <iostream>
using namespace std;
 
 
int main()
{	
	long long n, k;
	long long bucket[100001] = { 0 };
	cin >> n >> k;
 
	int i;
	for (i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		bucket[a] += b;
	}
 
	long long sum = 0;
	for (i = 0; i < 100001; i++) {
		sum += bucket[i];
		if (sum >= k) break;
	}
	cout << i << endl;
 
    return 0;
}
 

Measured memory_bytes: 1024
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int sum = 0;
    for(int i = 0; i < k; ++i) {
        sum += a[i];
    }
    cout << sum << endl;
}

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

using namespace std;

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

	vector<int> A(N);
	vector<int> B(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		B.at(i) = A.at(i);
	}
	sort(B.begin(), B.end());
	int Max = B.at(N - 1);
	int SecondMax = B.at(N - 2);

	for (int i = 0; i < N; i++) {
		if (A.at(i) == Max) {
			cout << SecondMax << endl;
			continue;
		}
		else {
			cout << Max << endl;
		}
	}
}

Measured memory_bytes: 3200
a,b,c,d = map(int,input().split())
all_val = b-a+1
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
if a%c == 0:
  c_val = b//c-a//c+1
else:
  c_val = b//c-a//c
if a%d == 0:
  d_val = b//d-a//d+1
else:
  d_val = b//d-a//d
if a%lcm(c,d) == 0:
  lcm_val = b//lcm(d,c)-a//lcm(d,c)+1
else:
  lcm_val = b//lcm(d,c)-a//lcm(d,c)
print(all_val-c_val-d_val+lcm_val)

Measured memory_bytes: 5104
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int n, tmp, ans = 0;
    map<int, int> m;
    cin >> n;
    rep(i, n){
        cin >> tmp;
        m[tmp]++;
    }
    for(auto p : m){
        int x = p.first;
        int n = p.second;
        if(n < x) ans += n;
        else ans += n - x;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <utility>
#include <fstream>
#include <iomanip>
#include <complex>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <queue>

#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const int N = 1e5 + 5, inf = 1e9, mod = 998244353;
using namespace std;

int main()
{
    IO
    string a, b;
    cin >> a >> b;
    for (int i = 0, j = b.size() - 1; i < a.size(); i++, j--)
        if (a[i] != b[j])
            return cout << "NO\n", 0;
    cout << "YES\n";
    return 0;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;
typedef long long ll ;
# define rep (i , n ) for ( int i =0; i < n ; i++)
# define _sort(arg) sort(begin(arg), end(arg))

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

	int N;
	std::vector<int> v;

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}

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


	int total = 0;

	int i = 0;
	for (i = 0; i < N - 1; i++)
	{
		total += v[i];
	}

	total += v[N-1] / 2;

	cout << total << endl;

	return 0;
}

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

int main(void){
  int N;
  cin >> N;
  vector<int> C(N), V(N);
  for(int i = 0; i < N; i++){
    cin >> V[i];
  }
  for(int i = 0; i < N; i++){
    cin >> C[i];
  }
  int sum = 0;
  for(int i = 0; i < N; i++){
    if(V[i] - C[i] > 0){
      sum += V[i] - C[i];
    }
  }
  cout << sum;
  
 return 0;
  
}

Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s;
  cin >> s;
  if (s.back() == 's') {
    s += "es";
  } else {
    s += "s";
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k,ans=0;
	cin>>n>>k;
	vl v(n),sum(n+1);
	rep(i,n)cin>>v[i],sum[i+1]=sum[i]+v[i];
	rep(i,n+1)sum[i]=((sum[i]-i)%k+k)%k;
	map<ll,ll> mp;
	//puta(sum);
	rep(i,n+1){
		ans+=mp[sum[i]];
		if(i-k+1>=0)mp[sum[i-k+1]]--;
		mp[sum[i]]++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 15872
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 3001
#define mdn 1000000007
#define inv 500000004ll 
using namespace std;

int f[N][N],a[N],n,q;
int ksm(int bs,int mi)
{
	int ans=1;
	while(mi)
	{
		if(mi&1)	ans=1ll*ans*bs%mdn;
		bs=1ll*bs*bs%mdn; mi>>=1;// printf("QAQ");
	}
	return ans;
}
int main()
{
	scanf("%d%d",&n,&q); int remq=q;
	for(int i=1;i<=n;i++)	scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)	for(int j=1;j<=n;j++)
		f[i][j]=a[i]>a[j];
	while(q--)
	{
		int x,y; scanf("%d%d",&x,&y);
		f[x][y]=f[y][x]=inv*(f[x][y]+f[y][x])%mdn;
		for(int i=1;i<=n;i++)	if(i!=x&&i!=y)
			f[x][i]=f[y][i]=inv*(f[x][i]+f[y][i])%mdn,
			f[i][x]=f[i][y]=inv*(f[i][x]+f[i][y])%mdn;
	}
	int ans=0; 
	for(int i=1;i<=n;i++)	for(int j=1;j<i;j++)
		ans=(ans+f[j][i])%mdn;
	printf("%d\n",1ll*ans*ksm(2,remq)%mdn);
	return 0;
}

Measured memory_bytes: 35328
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(0);
    ll a, b, t; cin >> a >> b >> t;
    cout << floor((t+0.5)/a)*b << endl;
}

Measured memory_bytes: 256