akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    let mut it = buf.trim().split_whitespace();
    let n: i32 = it.next().unwrap().parse().unwrap();
    let m: i32 = it.next().unwrap().parse().unwrap();
    let mut counter = vec![0; n as usize];
    for _ in 0..m {
        let mut buf = String::new();
        let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
        let mut it = buf.trim().split_whitespace();
        let x: usize = it.next().unwrap().parse().unwrap();
        let y: usize = it.next().unwrap().parse().unwrap();
        counter[x-1] += 1;
        counter[y-1] += 1;
    }
    for x in counter {
        println!("{}", x);
    }
}

Measured memory_bytes: 4352
# youtube
n = int(input())
s = list(map(int, input().split()))
ans = 0
for d in range(1, n - 1):
    ten = 0
    passed = set([0, n - 1])
    l = 0
    r = n - 1
    for _ in range((n - 1) // d):
        l += d
        r -= d
        if l in passed or r in passed or l==r or r < d:
            break
        ten += s[l]
        ten += s[r]
        passed.add(l)
        passed.add(r)
        if ten > ans:
            ans = ten
print(ans)


Measured memory_bytes: 17912
class Node:
    def __init__(self, id):
        self.id = id
        self.left = -1
        self.right = -1
def walk_preorder(node, order_list):
    if node == None:
        return 0
    order_list.append(node.id)
    walk_preorder(nodes.get(node.left), order_list)
    walk_preorder(nodes.get(node.right), order_list)
def walk_inorder(node, order_list):
    if node == None:
        return 0
    walk_inorder(nodes.get(node.left), order_list)
    order_list.append(node.id)
    walk_inorder(nodes.get(node.right), order_list)
def walk_postorder(node, order_list):
    if node == None:
        return 0
    walk_postorder(nodes.get(node.left), order_list)
    walk_postorder(nodes.get(node.right), order_list)
    order_list.append(node.id)

n = int(input())
nodes = {}
for _ in range(n):
    id, left, right = [int(x) for x in input().split(' ')]
    node = Node(id)
    node.left = left
    node.right = right
    nodes[id] = node
is_child_table = {node_id:False for node_id in range(n)}
for id in nodes:
    if nodes[id].left > -1:
        is_child_table[nodes[id].left] = True
    if nodes[id].right > -1:
        is_child_table[nodes[id].right] = True
root_id = [node_id for node_id in is_child_table.keys() if is_child_table[node_id] == False][0]
root_node = nodes[root_id]

preorder_list = []
inorder_list = []
postorder_list = []
walk_preorder(root_node, preorder_list)
walk_inorder(root_node, inorder_list)
walk_postorder(root_node, postorder_list)
print('Preorder')
preorder_str = ' '.join(map(str, preorder_list))
print(' {}'.format(preorder_str))
print('Inorder')
inorder_str = ' '.join(map(str, inorder_list))
print(' {}'.format(inorder_str))
print('Postorder')
postorder_str = ' '.join(map(str, postorder_list))
print(' {}'.format(postorder_str))


Measured memory_bytes: 5616
N = int(input())
D = sorted(list(map(int, input().split())))
M = int(input())
T = sorted(list(map(int, input().split())))

j = -1
for i in T:
	j += 1
	while j<N and D[j]!=i:
		j += 1
	if j == N:
		print('NO')
		exit()
		
print('YES')

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

int main(void) {
  int n, ans = 0;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 1; i < n - 1; i++) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1]) ||
        (p[i - 1] > p[i] && p[i] > p[i + 1]))
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		double x1, y1, x2, y2, xq, yq, ax, ay;
		double m1, m2, l1, l2;
		
		int q;

		x1 = scan.nextDouble();
		y1 = scan.nextDouble();
		x2 = scan.nextDouble();
		y2 = scan.nextDouble();
		
		//Y - y1 =((y2-y1) / (x2-x1)) * (X-x1)
		
		//p1,p2???????????´???????????? m1
		m1 = (y2-y1) / (x2-x1);
		
		//p1,p2??´????????????  l1
		l1 = y1 - (m1 * x1);
		
		//p???????????????????????????m2
		m2 = -1.0 / m1;
		
		q = scan.nextInt();
		
		for(int i = 0; i < q; i++) {
			xq = scan.nextDouble();
			yq = scan.nextDouble();

			if(x1 == x2) { //?????????????????´
				ax = x1;
				ay = yq;
				
			} else if(y1 == y2) { //??????????°´???
				ax = xq;
				ay = y1;
				
			} else {
				//p???????????????????????? l2
				l2 = yq - (m2 * xq);
			
				//??¬????????§?¨????ax, ay)
				ax = (l2 - l1) / (m1 - m2);
				ay = (l2 * m1 - l1 * m2) / (m1 - m2);
			}
			
			System.out.println((ax + ax - xq) + " " + (ay + ay - yq));
		}
		
		scan.close();
	}
}

Measured memory_bytes: 42260
n = int(input())

xyhs = [list(map(int, input().split())) for _ in range(n)]
xyhs.sort(key=lambda i: i[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        x, y, h = xyhs[0]
        ch = h + abs(cy - y) + abs(cx - x)

        if all([h == max(ch - abs(cy - y) - abs(cx - x), 0) for x, y, h in xyhs[1:]]):
            print(cx, cy, ch)
            exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2);
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

//----------------------------------------------------------------

int main(void) {
  double l;
  cin >> l;

  prtd(8, pow(l/3,3));

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define count_of(a, i) count(ALL(a), i)
#define lower(a, i) (int)(lower_bound(ALL(a), i) - begin(a))
#define upper(a, i) (int)(upper_bound(ALL(a), i) - begin(a))
#define binary(a, i) binary_search(ALL(a), i)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define sz(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i >= a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;
int mod_add(int A, int B) { return (A + B) % MOD; }
int mod_sub(int A, int B) { return (A + MOD - B) % MOD; }
int mod_mul(int A, int B) { return ((A % MOD) * (B % MOD)) % MOD; }
int mod_bipow(int X, int Y) {
    if (Y == 0) return 1;
    else if (Y == 1) return X % MOD;
    else if (Y % 2 == 0) {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(Z, Z);
    } else {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(mod_mul(Z, Z), X);
    }
}
int mod_inv(int X) { return mod_bipow(X, MOD - 2); }
int mod_div(int A, int B) { return mod_mul(A, mod_inv(B)); }

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct vertex {
  vector<int> adj = vi(0);
};

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(sz(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n;
  string s;
  int ans = 0;

  cin >> s;
  // vi a(n);
  // REP(i, n) {
  //   cin >> a[i];
  // }

  cout << 700 + 100 * count_of(s, 'o') << endl;
  // REP(i, n) {
  //   cout << a[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_E
#define M_E 2.71828182845904523536
#endif

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x)
#endif

#define pln(x) cout << (x) << endl
#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> T& chmin(T &a, const U &b){return a = (a<=b?a:b);}
template <typename T, typename U> T& chmax(T &a, const U &b){return a = (a>=b?a:b);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

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

  int W,H;
  while(cin >> W >> H){
    vector<LLI> p(W), q(H); cin >> p >> q;
    vector<pair<LLI,int>> v;
    for(auto a : p) v.push_back({a,0});
    for(auto a : q) v.push_back({a,1});

    sort(ALL(v));

    LLI ans = 0;

    int col=0, row=0;

    for(auto &a : v){
      if(a.snd == 0){
	ans += a.fst * (H+1-row);
	++col;
      }else{
	ans += a.fst * (W+1-col);
	++row;
      }
    }


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


Measured memory_bytes: 8432
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n)) + 2):
    if digit(i, n) == s:
        print(i)
        exit()

for p in range(1,int(math.sqrt(n)))[::-1]:
    q = s - p
    b = (n-s)//p +1
    if 1 <= p < b and 0 <= q < b and (n - s)%p == 0:
        if digit(b, n) == s:
            print(b)
            exit()
print(-1)    

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
int n, m, edge[100002], a, b, ans = 0, steps;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll = long long;

vector<vector<int>> hen;
vector<int> dp;

int dfs(int v) {
	if (dp[v])return dp[v];
	for (auto i : hen[v]) {
		dp[v] = max(dp[v], dfs(i) + 1);
	}
	return dp[v];
}


int main()
{
	int n, m;
	cin >> n >> m;
	hen.resize(n);
	dp.resize(n);
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b; a--, b--;
		hen[a].push_back(b);
	}

	for (int i = 0; i < n; i++) dfs(i);
	cout << *max_element(dp.begin(), dp.end()) << endl;
}

Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

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

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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  string s;
  cin>>s;
  int resu=0;
  rep(i,n)
  {
    set<char>l,r,res;
    rep(j,i)l.insert(s[j]);
    repi(j,i,n)r.insert(s[j]);


    set_intersection(all(l),all(r),inserter(res,res.end()));
    chmax(resu,(int)res.size());

  }
  cout<<resu<<endl;




  return 0;

}


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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n ; 
    cin >> n;
    vector<int> v(n,0);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    vector<int> a(n,0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i] = v[i] - a[i];
    }

    sort(a.begin(), a.end());
    int res = 0;
    int i = n - 1;
    while (a[i] > 0) {
        res += a[i];
        --i;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a[1000][1000] = {};
	int r;
	int c;
	cin >> r >> c;

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


	for (int i = 0; i < r; i++)
	{
		for (int n = 0; n < c; n++)
		{
			a[i][c] += a[i][n];

		}

	}

	for (int i = 0; i < c; i++)
	{
		for (int n = 0; n < r; n++)
		{
			a[r][i] += a[n][i];
		}

	}


	for (int i = 0; i < r; i++)
	{
		a[r][c] += a[i][c];
	}

	for (int i = 0; i < r + 1; i++)
	{

		for (int n = 0; n < c + 1; n++)
		{
			cout << a[i][n];
			if (n != c){
				cout << " ";
			}

		}
		cout << endl;


		/*
		for(int j=0;j<5;j++)
		{
		a[0][5]+=a[0][j];

		for(int k=0;k<4;k++)

		k[4][0]+=a[k][0];

		}

		*/




	}
	return 0;
}


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


int main()
{
string s,t;
cin >> s >> t;
int N = stoi(s+t);

rrep(i,N) {
    if(i*i == N){
        cout << "Yes" << endl;
        return 0;
    }
}

cout << "No" << endl;

return 0;
}

Measured memory_bytes: 256
k=int(input())
from collections import deque
q=deque(list(range(1,10)))
for i in range(k):
    p=q.popleft()
    if i==k-1:
        print(p)
        exit()
    a=p%10
    if 0<a<9:
        q.append(p*10+a-1)
        q.append(p*10+a)
        q.append(p*10+a+1)
    elif a==0:
        q.append(p*10)
        q.append(p*10+1)
    else:
        q.append(p*10+a-1)
        q.append(p*10+a)

Measured memory_bytes: 11960
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
ll a[N],d[N];
int main()
{
    ft
    ll t,i,j,n,m,l,r,c;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(i==0)
        {
            d[i]=abs(a[0]);
        }
        else
        {
            d[i]=abs(a[i-1]-a[i])+d[i-1];
        }
    }
    d[n]=d[n-1]+abs(a[n-1]);
    for(i=0;i<n;i++)
    {
        if(i==0)
        {
            c=d[n]-d[1]+abs(a[1]);
        }
        else
        {
            l=d[i-1];
            r=abs(a[i-1]-a[i+1]);
            c=d[n]-d[i+1]+l+r;
        }
        cout<<c<<"\n";
    }
    return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int x;
  cin >> x;
  if(1800 <= x){
    cout << 1;
  } else if(1600 <= x){
    cout << 2;
  } else if(1400 <= x){
    cout << 3;
  } else if(1200 <= x){
    cout << 4;
  } else if(1000 <= x){
    cout << 5;
  } else if(800 <= x){
    cout << 6;
  } else if(600 <= x){
    cout << 7;
  } else {
    cout << 8;

  }
  cout << '\n';
  return 0;
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    long long ans=0;
    
    for(int i=0;i<n;i++){
        int right,left;
        cin>>left>>right;
        ans+=right-left+1;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

int main(){
  string n;
  cin >> n;
  if(n.at(0) == '7' || n.at(1) == '7' || n.at(2) == '7'){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
using namespace std;
int gcd(int a, int b)
{
    if (a < b) {
        int k = a;
        a = b;
        b = k;
    }
    if (b == 0) return a;
    return gcd(b, a%b);
}
int p(int n)
{
    for (int i = 2; i*i <= n; i++) {
        if (n%i == 0) return i;
    }
    return n;
}
int main()
{
    int n, a, s = 0, k;
    bool pwc = true, swc = false;
    vector<bool> f(1'000'001, false);
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a);
        s = gcd(a, s);
        if (s == 1) swc = true;
        while (pwc && (k = p(a)) != 1) {
            if (f[k]) pwc = false;
            f[k] = true;
            while (a%k == 0) a /= k;
        }
    }
    if (pwc)      cout << "pairwise coprime" << endl;
    else if (swc) cout << "setwise coprime" << endl;
    else          cout << "not coprime" << endl;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define vl vector<long long>
#define vs vector<string>
#define vvl vector<vector<long long>>
#define all(A) A.begin(), A.end()

int main() {
    ll n,x,t;
    cin >> n >> x >> t;

    cout << (n+x-1)/x*t << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll X,Y,A,B,C;
    cin >> X>>Y>>A>>B>>C;
    vector<ll> p(A),q(B),r(C);
    rep(i,A){
        cin >> p[i];
      //p[i].second = i;  
    }
    rep(i,B){
        cin >> q[i];
        //q[i].second = i;  
    } 
    rep(i,C){
        cin >> r[i];
        //r[i].second = i;  
    }
    sort(p.begin(),p.end(),greater<ll>());
    sort(q.begin(),q.end(),greater<ll>());
    sort(r.begin(),r.end(),greater<ll>());
    ll sum = 0;
    priority_queue<ll,vector<ll>,greater<ll>> que;
    rep(i,X){
        sum += p[i];
        que.push(p[i]);
        //mp[p[i].second]++;
    }
    rep(i,Y){
        sum += q[i];
        que.push(q[i]);
        //mp[q[i].second]++;
    }
    rep(i,C){
        ll p = que.top();
        que.pop();
        if(p < r[i]){
            sum += r[i] - p;
        }
    }
    cout << sum << endl;



}


Measured memory_bytes: 4724
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
set<string> q;
int main(){
string a;int k;cin>>a>>k;
for (int i=0;i<a.size();++i){
  string tmp="";
  for (int j=i;j<a.size();++j){
    tmp.push_back(a[j]);
    q.insert(tmp);
    if (q.size()>k) q.erase(--q.end());
    } 
  }
cout<<*q.rbegin();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>=x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
	ll N;
	cin>>N;
	vector<pair<ll,ll>> v;
	for(ll i=0;i<N;i++)
	{
	    ll a,b;
	    cin>>a>>b;
	    v.pb({a-b,a+b});
	}
	sort(all(v));
	ll c=1;
	ll y=v[0].ss;
	for(ll i=1;i<N;i++)
	{
	    if(v[i].ff>=y)
	    {
	        y=v[i].ss;
	        c++;
	    }
	    else
	    {
	        y=min(y,v[i].ss);
	    }
	}
	cout<<c<<endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"


int func(int arr[], int n, int k){
  int t[n + 1];
  // init
  t[1] = 0;
  t[2] = abs(arr[1] - arr[0]);
  // logic
  for(int i = 3; i<= n; i++){
    int mn = INT_MAX;
    for(int j = 1; j <= k; j++){
      if(i-j-1 >= 0){
        mn = min(mn, abs(arr[i - 1] - arr[i - (j + 1)]) + t[i - j]);
      }
    }
    t[i] = mn;
  }
  return t[n];
}

void solve() {
  int n, k; cin >> n >> k;
  int arr[n];
  for(int i = 0; i < n; i++) cin >> arr[i];
  int ans = func(arr, n, k);
  cout << ans << endl;
}
int main(){
// #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
// #endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 4380
#include<iostream>
#include<string>
using namespace std;

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

	string p = "No";

	for (int i = 0; i <= 25; i++) {
		for (int j = 0; j < 15; j++) {
			if (4 * i + 7 * j == n) {
				p = "Yes";
				break;
			}
		}
	}

	if (p == "Yes") cout << p << endl;
	else cout << p << endl;

	return 0;
}

Measured memory_bytes: 256
N,M = list(map(int,input().split()))
S = [list(map(int,input().split())) for m in range(M)]

if N==1:
  for n in range(0,10):
    F = M*[0]
    
    for m in range(M):
      if str(n)[S[m][0]-1]==str(S[m][1]):
        F[m] = 1
    
    if sum(F)==M:
      print(n)
      exit()

elif N==2:
  for n in range(10,100):
    F = M*[0]
    
    for m in range(M):
      if str(n)[S[m][0]-1]==str(S[m][1]):
        F[m] = 1
    
    if sum(F)==M:
      print(n)
      exit()

else:
  for n in range(100,1000):
    F = M*[0]
    
    for m in range(M):
      if str(n)[S[m][0]-1]==str(S[m][1]):
        F[m] = 1
    
    if sum(F)==M:
      print(n)
      exit()

print(-1)

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000007LL
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(i=a;i<=b;i++)

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

ll mypow(ll a, ll b) { if(b == 0) return 1; ll temp=mypow(a,b/2); temp=(temp*temp)%INF; if(b%2 == 1) temp=(a*temp)%INF; return temp; }
int mygcd(int a, int b) { if(b==0) return a; return mygcd(b,a%b); }
int cntBits(ll a) { int ret=0; while(a>0) { ret++; a/=2; } return ret; }

long double dp[3002][3002], probs[3002];

int main()
{
	ios::sync_with_stdio(0);
	int tt=1,tcase; 
	//cin >> tt;
	rep(tcase,1,tt)
	{
		int n; cin >> n;
		for(int i=1;i<=n;i++) 
		{
			cin >> probs[i];
		}

		for(int i=0;i<=n;i++)
		{
			for(int j=0;j<=n;j++)
			{
				if(i==0 && j==0) dp[i][j]=1;
				else if(i+j>n) break;
				else if(j==0)
				{
					dp[i][j]=dp[i-1][j]*probs[i+j];
				}
				else if(i==0)
				{
					dp[i][j]=dp[i][j-1]*(1-probs[i+j]);
				}
				else
				{
					dp[i][j]=dp[i-1][j]*probs[i+j] + dp[i][j-1]*(1-probs[i+j]);
				}
			}
		}
		long double ans=0.0;
		for(int i=n;i>=0;i--)
		{
			if(i<n-i) break;
			ans += dp[i][n-i];
		}
		cout << setprecision(10) << fixed << ans << "\n";
	}
	return 0;
}


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

int  main(){
  int n,t;cin>>n>>t;
  vector<int> v(n),vec(n-1);
  int x=t;
  rep(i,n){cin>>v[i];}
  rep(i,n-1){
    vec[i]=v[i+1]-v[i];
    x+=min(t,vec[i]);
  }
  cout<<x;
}

Measured memory_bytes: 1792
list=[]
ans=10
sum=0
for i in range(5):
    list.append(int(input()))
for i in range(5):
    if list[i]%10<ans and list[i]%10!=0:
        ans=list[i]%10
for j in range(5):
    if list[j]%10!=0:
        sum+=list[j]+(10-list[j]%10)
    else:
        sum+=list[j]
print(sum-(10-ans))

Measured memory_bytes: 3064
import java.util.*;

// ABC 6-C
// http://abc006.contest.atcoder.jp/tasks/abc006_3
 
public class Main {
	
	public static void main (String[] args) throws java.lang.Exception {
		Scanner in = new Scanner(System.in);
		
		String s1 = in.next();
		String s2 = in.next();
		String s3 = in.next();
		
		System.out.printf("%s%s%s\n", s1.substring(0, 1).toUpperCase(), s2.substring(0, 1).toUpperCase(), s3.substring(0, 1).toUpperCase());
	}
	
}

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

//region Template
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
 */
//endregion

/* Notes:
 * Farah </3
 */

const int MAXN = 1e6 + 5;
const int INF = 2e9;

ll fact[MAXN];

ll modPow(ll p, ll pow){
	ll ans = 1;
	while(pow){
		if(pow & 1)
			ans = (ans * p) % MOD;
		p = (p * p) % MOD;
		pow >>= 1;
	}
	return ans;
}

int main() {
	//usaco("milkvisits");

#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
#endif

	int n, m;
	cin >> n >> m;

	multiset<int> s;

	for(int i = 0; i < n; i++){
		int t;
		cin >> t;

		s.insert(-t);
	}

	while(m--){
		auto f = s.begin();
		int x = *f / 2;
		s.erase(f);
		s.insert(x);
	}

	ll ans = 0;
	for(auto x : s){
		ans += -x;
	}
	cout << ans;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

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

    ll a, b, t;

    cin >> a >> b >> t;
    
    ans = t / a * b;

    cout << ans << endl;

}

Measured memory_bytes: 256
n=int(input())
large=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
while n!=0:
    vote=list(input().split())
    vote_number=0
    stack=[0]*26
    flag=False
    for i in vote:
        vote_number+=1
        stack[large.index(i)]+=1
        second_max=[i for i in stack]
        second_max[stack.index(max(stack))]=-1
        if max(stack)>max(second_max)+len(vote)-vote_number:
            print(large[stack.index(max(stack))],vote_number)
            flag=True
            break
    if flag==False:
        print("TIE")
    n=int(input())


Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long a,b;
  cin>>a>>b;
  long k,c=0;
  long h=a>b?a:b;
  for(k=0;k<=h;k++)
  {
   	long f1=abs(a-k);
    long f2=abs(b-k);
    if(f1==f2)
    {
      c=1;
      cout<<k<<endl;
      break;
    }
  }
  if(c==0)
  {
    cout<<"IMPOSSIBLE\n";
  }
}

Measured memory_bytes: 256
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	n, k = (int(x) for x in rll())
	exclude = set()
	for _ in range(k):
		d = int(rl())
		for snuke in (int(x) for x in rll()):
			exclude.add(snuke)
	ans = n - len(exclude)
	stdout.write(str(ans));stdout.write("\n")
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 78976
#include <bits/stdc++.h>                                                                                                                                                                                  
using namespace std;
 
int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  bool yes = true;
  if(a > w / 2) yes = false;
  if(b > a / 2) yes = false;
  vector<vector<int>> ans(h, vector<int>(w));
  for(int i=0;i<h;i++) {
    if(i < b) {
      for(int j=0;j<w;j++) {
        if(j < a) ans[i][j] = 0;
        else ans[i][j] = 1;
      }   
    }   
    else {
      for(int j=0;j<w;j++) {
        if(j < a) ans[i][j] = 1;
        else ans[i][j] = 0;
      }   
    }   
  }
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      cout << ans[i][j];
    }   
    cout << endl;
  }
  return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if ((b-1)/(a-1)*(a-1)==(b-1)) cout << (b-1)/(a-1) << endl;
  else cout << (b-1)/(a-1)+1 << endl;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
	vector<int> N(3);
	for (int i = 0; i < 3; ++i)	cin >> N.at(i);
	sort(N.begin(), N.end());
	reverse(N.begin(), N.end());
	cout << N.at(0) * 10 + N.at(1) + N.at(2) << endl;
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  int ans = 0;

  for (int i = a; i <= b; i++) {
    int s = i % 10, t = i / 10000 % 10;
    int u = i / 10 % 10, v = i /1000 % 10;
    if (s == t && u == v) {
      ans++;
    }
  }

  cout << ans << endl;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	int n, m, x;
	int a[101];
	int right = 0, left = 0;

	cin >> n >> m >> x;
	FOR(i, 1, m) {
		cin >> a[i];
		if (a[i] < x) {
			left++;
		}
		else {
			right++;
		}
	}
	cout << min(left, right) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

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

  int n,p[22],c=0;
  cin >> n;
  rep(i, n) cin>>p[i];
  REP(i, 2, n) {
    if((p[i-1]>p[i-2] && p[i-1]<p[i]) || (p[i-1]<p[i-2] && p[i-1]>p[i])) c++;
  }
  cout << c << endl;

}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int64 d(int64 x) {
  return to_string(x).size();
}

int main(void) {
  int64 N, M;
  cin >> N >> M;
  string s, rs;
  cin >> s;
  rs = s; reverse(all(rs));
  vector<int64> dp(N+1, INF_LL);
  deque<PLL> dq;
  dq.emplace_back(0, 0);
  dp[0] = 0;
  FOR(i, 1, N+1) {
    while (dq.size() && i-dq.front().sc > M) dq.pop_front();
    if (rs[i] != '1' && dq.size()) {
      dp[i] = dq.front().fs+1;
    }
    while (dq.size() && dq.back().fs >= dp[i]) dq.pop_back();
    if (dp[i] != INF_LL) dq.emplace_back(dp[i], i);
  }
  if (dp[N] == INF_LL) {
    cout << -1 << endl;
    return 0;
  }
  reverse(all(dp));
  vector<int64> res;
  int64 now = 0;
  while (now != N) {
    FOR(i, now+1, N+1){
      if (dp[i] != INF_LL && dp[i] < dp[now]-1) break;
      if (dp[i] == dp[now]-1) {
        res.push_back(i-now);
        now = i;
        break;
      }
    }
  }
  REP(i, res.size()) {
    cout << res[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 2424
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    ll N;
    cin >> N;
  	ll ans = (N+999)/1000*1000 - N;
    cout << ans << endl;
    return 0;
}


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

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

#define PI 3.141592
int main()
{
  int R;
  cin >> R;
  cout << 2.0*R*PI;
}

Measured memory_bytes: 3736
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

#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 <class T> using Tree = 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<int,int> pii;
typedef pair<ll,ll> pll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-6;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }

// (Integer/Long).bitCount(x)
int pct(int x) { return __builtin_popcount(x); }
int pctll(ll x) { return __builtin_popcountll(x); }

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}

// Binary Exponentiation
ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }



void solve(int tcn) {
	ld d, t, s;
	cin >> d >> t >> s;
	cout << (d / s <= t ? "Yes" : "No") << nl;
}

int main() {
    setIO();

    int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		//cout << "Case #" << i << ": ";
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 5) {
    cout << 0 << endl;
  }
  else if (a <= 12) {
    cout << b / 2 << endl;
  }
  else {
    cout << b << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#define MAX_H   100
#define MAX_W   100
using namespace std;

int H, W;
char field[MAX_H][MAX_W];

// 現在位置(x, y)
void dfs(int x, int y) {
	char mark = field[x][y];
	// 今いるところを.に置き換える
	field[x][y] = '.';

	// 移動する4方向をループ
	for (int dx = -1; dx <= 1; dx++) {
		int nx = x + dx;
		if (0 <= nx && nx < H && field[nx][y] == mark) {
			dfs(nx, y);
		}
	}
	for (int dy = -1; dy <= 1; dy++) {
		int ny = y + dy;
		if (0 <= ny && ny < W && field[x][ny] == mark) {
			dfs(x, ny);
		}
	}
	return;
}

int main(void) {
	int count;
	int i, j;

	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0) {
			break;
		}

		// すべてのマスを'.'で埋める
		for (i = 0; i < MAX_H; i++) {
			for (j = 0; j < MAX_W; j++) {
				field[i][j] = '.';
			}
		}
		count = 0;

		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				cin >> field[i][j];
			}
		}

		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				if (field[i][j] != '.') {
					dfs(i, j);
					count++;
				}
			}
		}
		cout << count << endl;
	}
		return 0;
	}

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

using namespace std;

typedef long long LL;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
priority_queue <string,vector<string>,greater<string> > que;
int main()
{
	int n , ans = 0;
	int max1 = 0;
	char s[MaxN];
	scanf("%d",&n);
	scanf("%s",s);
	for(int i = 0 ; i < strlen(s) ; i++)
	{
		if(s[i] == 'I')ans = ans + 1;
		if(s[i] == 'D')ans = ans - 1;
		max1 = max(max1 , ans);
		}
	cout << max1 << endl;
	return 0;
	}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = (int) (n / (1.08));
		if (((int) ((ans - 1) * 1.08) == n))
			System.out.println(ans - 1);
		else if ((int) ((ans + 1) * 1.08) == n)
			System.out.println(ans + 1);
		else if ((int) (ans * 1.08) == n)
			System.out.println(ans);
		else
			System.out.println(":(");

		sc.close();
	}
}


Measured memory_bytes: 35688
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<climits>
using namespace std;
int a[100100];
int min(int a,int b){
    return (a<b)?a:b;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1;i<=n;i++){
        int tmp = i;
        int tmp2=0;
        while(tmp >0){
            tmp2+=tmp%10;
            tmp/=10;
        }
        a[i] = tmp2;
    }
    int ans = INT_MAX;
    for(int i =1;i<=n/2;i++){
        int tmp = n-i;
        ans = min(ans,a[i]+a[tmp]);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] NX=cin.ArrayInt(2,0);
        int N=NX[0];
        int X=NX[1];
        int[] bound=new int[N+1];
        int[] x=cin.ArrayInt(N,0);
        int ans=0;
        for(int i=0;i<N;i++)
        {
          bound[i+1]=x[i]+bound[i];
        }
        for(int i=0;i<N+1;i++)
        {
          if(bound[i]<=X)ans++;
        }
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#define int long long
const ll INF = 1e9 * 1e9, SIZE = 1e5 + 10;

vector<ll> vec;
vector<tuple<ll, ll, ll>> edges, good;
vector<vector<pair<ll, ll>>> gr;

ll dsu[SIZE], siz[SIZE], sm[SIZE];
vector<pair<ll, ll>> upds;
map<tuple<ll, ll, ll>, ll> ind;

ll find(int v) {
    if (dsu[v] == v) return v;
    return dsu[v] = find(dsu[v]);
}

bool used[SIZE], usedE[SIZE];

void uni(int v, int u) {
    v = find(v);
    u = find(u);
    if (u == v) {
        return;
    }
    if (u != v) {
        sm[v] += sm[u];
        dsu[u] = v;
    }
}

ll cnt = 0;
void dfs(int v, int val, int vl) {
    used[v] = 1;

    for (auto to : gr[v]) {
        ll u1 = v, v1 = to.first;
            if (u1 > v1) swap(u1, v1);
            //cout << ind[{u1, v1, to.second}] << " " << to.second << " " << u1 << " " << v1 << " " << val << "\n";
            if (!usedE[ind[{u1, v1, to.second}]] && (to.second <= val) && to.second <= vl) {
                usedE[ind[{u1, v1, to.second}]] = 1;
                //cout << "br " << to.second << " " << u1 << " " << v1 << " " << val << "\n";
                cnt++;
            }
        if (!used[to.first]) {
            if (to.second <= vl && to.second <= val) dfs(to.first, val, vl);
        }
    }
}

signed main()
{
    fastInp;
    ll n, m;
    cin >> n >> m;
    vec.resize(n);
    for (int i = 0; i < n; i++) cin >> vec[i];

    gr.resize(n);
    for (int i = 0; i < m; i++) {
        ll u, v, c;
        cin >> u >> v >> c;
        u--; v--;
        edges.push_back({c, u, v});
        gr[u].push_back({v, c});
        gr[v].push_back({u, c});
    }

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

    gr.resize(n);
    for (int i = 0; i < n; i++) {
        dsu[i] = i;
        siz[i] = 1;
        sm[i] = vec[i];
    }

    vector<bool> good(m);
    vector<ll> vls(m);
    for (int i = 0; i < edges.size(); i++) {
        ll u = get<1>(edges[i]), v = get<2>(edges[i]);
        if (u > v) swap(u, v);
        ind[{u, v, get<0>(edges[i])}] = i;
        ll k = find(u), k2 = find(v);
    
        ll add = 0;
        if (k != k2) add = sm[k2];
        vls[i] = add + sm[k];
        if (sm[k] + add >= get<0>(edges[i])) good[i] = 1;
        if (find(u) != find(v)) {
            uni(u, v);
        }
    }

    queue<ll> q;
    for (int i = m - 1; i >= 0; i--) {
        if (good[i]) {
            dfs(get<1>(edges[i]), vls[i], get<0>(edges[i]));
            //cout << vls[i] << "\n";
        }
    }

    cout << m - cnt;

    return 0;
}

Measured memory_bytes: 39084