akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#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__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;ll k;cin>>n>>k;
  int a[n];
  map<int,vector<int>> m;
  rep(i,n){
    cin>>a[i];
    m[a[i]].push_back(i);
  }
  //cout<<a[0]<<endl;
  __int128 db[64][n];
  for(auto it=m.begin();it!=m.end();++it){
    auto v=it->second;
    v.push_back(v.front()+n);
    rep(i,v.size()-1){
      db[0][v[i]]=v[i+1]-v[i]+1;
    }
  }
  rep(i,1,64){
    rep(j,n){
      db[i][j]=db[i-1][j]+db[i-1][(j+db[i-1][j])%n];
    }
  }
  ll now=0;
  for(int i=63;i>=0;--i){
    if(now+db[i][now%n]>=n*k)continue;
    now+=db[i][now%n];
  }
  stack<int> st;
  set<int> e;
  now%=n;
  rep(i,now,n){

    if(e.find(a[i])==e.end()){
      st.push(a[i]);
      e.insert(a[i]);
    }
    else{
      while(e.find(a[i])!=e.end()){
        e.erase(st.top());
        st.pop();
      }
    }
    //cout<<st.top()<<endl;
  }
  vector<int> ans;
  while(st.size()){
    ans.push_back(st.top());
    st.pop();
  }
  reverse(all(ans));
  rep(i,ans.size()){
    if(i)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
}
  


Measured memory_bytes: 235252
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;
enum long MOD = 10L^^9+7;

void main() {
  auto xs = readln.split.to!(long[]).sort!"a<b".array.group.array.sort!"a[1]<b[1]".array;
  if (xs.length == 2 && xs[0][1] == 1) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int main( )
{
	int n;
	std::ios::sync_with_stdio( false );
	using std::cin;
	using std::cout;
	cin >> n;
	std::vector < int > a( n );
	for( int i = 0; i < n; ++i )
		cin >> a[ i ];
	int res = 0x3f3f3f3f;
	for( int i = -100; i <= 100; ++i )
	{
		int ret = 0;
		for( int j = 0; j < n; ++j )
			ret += ( i - a[ j ] ) * ( i - a[ j ] );
		res = std::min( res, ret );
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 3588
def toi(a)
	b = []
	a.each do |n|
		b << n.to_i
	end
	b	
end

def if3(x)
	return incthree(x) || multithree(x)
end

def incthree(x)
	x = x.to_s
	return x.include?"3"
end
def multithree(x)
	return (x % 3 == 0)
end

def f(x)
	if if3(x)
		print(" #{x}")
	end
end



n = gets().to_i
for l in 1 .. n
	f(l)
end

	print("\n")

Measured memory_bytes: 8780
#include<bits/stdc++.h>
#define ll long long
#define INF 10000000000000ll
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i++)
using namespace std;
signed main(){
  ll w=0,n=0,e=0,s=0,sun=0,cun=0;
  string t;
  cin>>t;
  rep(i,t.size()){
    if(t[i]=='W'){
      w++;
    }else if(t[i]=='E'){
      e++;
    }else if(t[i]=='N'){
      n++;
    }else if(t[i]=='S'){
      s++;
    }
  }

  if(n>0 && s>0){
    sun++;
  }else if(n==0 && s==0){
    sun++;
  }

  if(w>0 && e>0){
    cun++;
  }else if(w==0 && e==0){
    cun++;
  }

  if(sun>0 && cun>0){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
}

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

const int blank = 0;
const int red = 1;
const int green = 2;
const int blue = 3;
const int yellow = 4;
const int purple = 5;
const int  ojyama = -1;

int field[8][14];
bool chk[8][14];
bool death[8][14];
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};


int is_sameblocks(int px,int py){
  stack<int> st;
  st.push(py*8+px);
  int s = 0;
  while(!st.empty()){
    px = st.top()%8;
    py = st.top()/8;
    chk[px][py] = true;
    st.pop();
    s++;
    for(int i=0;i<4;i++){
      if(!chk[px+dx[i]][py+dy[i]]&&field[px+dx[i]][py+dy[i]]==field[px][py])
	st.push((py+dy[i])*8+px+dx[i]);
    }
  }
  return s;
}

int main(){
  int n;
  cin>>n;
  vector<string> puyo(12);
  for(;n>0;n--){

    for(int i=0;i<12;i++){
      cin>>puyo[i];
    }
    for(int x=0;x<8;x++){
      field[x][0] = blank;
      field[x][13] = blank;
    }
    for(int y=0;y<14;y++){
      field[0][y] = blank;
      field[7][y] = blank;
    }

    //input
    for(int y=0;y<12;y++){
      for(int x=0;x<6;x++){
	switch(puyo[y][x]){
	case'R':
	  field[x+1][y+1] = red;
	  break;
	case'G':
	  field[x+1][y+1] = green;
	  break;
	case'B':
	  field[x+1][y+1] = blue;
	  break;
	case'Y':
	  field[x+1][y+1] = yellow;
	  break;
	case'P':
	  field[x+1][y+1] = purple;
	  break;
	case'O':
	  field[x+1][y+1] = ojyama;
	  break;
	case'.':
	  field[x+1][y+1] = blank;
	  break;
	default:
	  break;
	}
      }
    }
    int chain = 0;
    while(true){
    //erase
      bool erase = false;
      for(int y=1;y<13;y++){
	for(int x=1;x<7;x++){
	  for(int k=0;k<112;k++)
	    chk[k%8][k/8] = false;
	  if(field[x][y] > 0&&is_sameblocks(x,y)>=4)
	    death[x][y] = true;
	  else
	    death[x][y] = false;
	}
      }
      for(int y=12;y>0;y--){
	for(int x=1;x<7;x++){
	  if(field[x][y] == ojyama){
	    for(int i=0;i<4;i++){
	      if(death[x+dx[i]][y+dy[i]])
		field[x][y] = blank;
	    }
	  }
	}
      }
      for(int y=12;y>0;y--){
	for(int x=1;x<7;x++){
	  if(death[x][y]){
	    field[x][y] = blank;
	    erase = true;
	  }
	}
      }
      
      if(!erase)break;
    //fall
      while(erase){
	erase = false;
	for(int y=12;y>0;y--){
	  for(int x=1;x<7;x++){
	    if(field[x][y] == blank && field[x][y-1]!=blank){
	      field[x][y] = field[x][y-1];
	      field[x][y-1] = blank;
	      erase = true;
	    }
	  }
	}
      }
      chain++;
    }    
    cout<<chain<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut a = vec![0; n];
    for a in &mut a {
        for j in 0..n {
            let b: usize = it.next().unwrap().parse().unwrap();
            *a |= b << j;
        }
    }
    const MOD: u64 = 1_000_000_007;
    let mut dp = vec![0; 1 << n];
    dp[0] = 1;
    for i in 1usize..(1 << n) {
        let k = i.count_ones() as usize - 1;
        let mut b = a[k] & i;
        let mut way = 0;
        while b > 0 {
            let x = b.trailing_zeros() as usize;
            way += dp[i ^ (1 << x)];
            b ^= 1 << x;
        }
        dp[i] = way % MOD;
    }
    println!("{}", dp[(1 << n) - 1]);
}

fn main() {
    run();
}


Measured memory_bytes: 20732
/**
 *    author:  tourist
 *    created: 25.01.2020 21:05:34       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  vector<vector<int>> p(2);
  for (int i = 0; i < m; i++) {
    p[a[i] & 1].push_back(a[i]);
  }
  if (p[1].size() > 2) {
    cout << "Impossible" << '\n';
    return 0;
  }
  if (p[1].size() == 0) {
    for (int i = 0; i < (int) p[0].size(); i++) {
      if (i > 0) cout << " ";
      cout << p[0][i];
    }
    cout << '\n';
    int cnt = (int) p[0].size() + 1 + (p[0].back() > 2);
    cout << cnt << '\n';
    cout << 1;
    for (int i = 0; i < (int) p[0].size() - 1; i++) {
      cout << " " << p[0][i];
    }
    cout << " " << 1;
    if (p[0].back() > 2) {
      cout << " " << p[0].back() - 2;
    }
    cout << '\n';
    return 0;
  }
  if (p[1].size() == 2) {
    cout << p[1][0];
    for (int i = 0; i < (int) p[0].size(); i++) {
      cout << " " << p[0][i];
    }
    cout << " " << p[1][1] << '\n';
    int cnt = (int) p[0].size() + 1 + (p[1][0] > 1) + (p[1][1] > 1);
    cout << cnt << '\n';
    if (p[1][0] > 1) {
      cout << p[1][0] - 1 << " ";
    }
    cout << 2;
    for (int i = 0; i < (int) p[0].size(); i++) {
      cout << " " << p[0][i];
    }
    if (p[1][1] > 1) {
      cout << " " << p[1][1] - 1;
    }
    cout << '\n';
    return 0;
  }
  cout << p[1][0];
  for (int i = 0; i < (int) p[0].size(); i++) {
    cout << " " << p[0][i];
  }
  cout << '\n';
  int cnt = (int) p[0].size() + 1 + (p[1][0] > 1);
  cout << cnt << '\n';
  if (p[1][0] > 1) {
    cout << p[1][0] - 1 << " ";
  }
  for (int i = 0; i < (int) p[0].size(); i++) {
    cout << p[0][i] << " ";
  }
  cout << 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
# 2019 11/16
# ABC 145 B Echo


N = int(input())
S = input()

if N % 2 == 1:
    print('No')

elif N % 2 == 0:
    mid = N // 2
    is_rep = True

    for i in range(mid):
        if(S[i] != S[mid+i]):
            is_rep = False
            break

    if is_rep:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

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

    queue<ll> q;

    for (ll i = 1; i < 10; i++) q.push(i);
    
    rep(i, k-1){
        ll t = q.front(); q.pop();
        if(t %10 != 0) q.push(10*t + t%10 -1);
        q.push(10*t + t%10);
        if(t%10 != 9) q.push(t*10 + t%10 + 1);
    }

    cout << q.front() << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 1792
import itertools
 
 
WAIT, PRESORT, SORTED = 0, 1, 2
cost = 0
 
def swap(w1, w2):
    global cost
    cost += w1[WAIT] + w2[WAIT]
    w1[PRESORT], w2[PRESORT] = w2[PRESORT], w1[PRESORT]
     
 
n = input()
w = [[wi, i, None] for i, wi in enumerate(map(int, input().split()))]
s = sorted(w)
minw = s[0]
for i, wi in enumerate (s):
    wi[SORTED] = i
     
for si in s:
    tmp = si
    t = []
    while tmp[SORTED] != si[PRESORT]:
        tmp = w[tmp[SORTED]]
        t += [tmp]
 
    if len(t ) and minw != si and si[WAIT] * (len(t) - 2) > minw[WAIT] * (len(t) + 2):
        swap(minw, si)
        for ti in t[::-1]:
            swap(minw, ti)
        swap(minw, si)
    else:
        for ti in t[::-1]:
            swap(si, ti)
     
print(cost)


Measured memory_bytes: 5868
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static int N;
    static int M;
    static int Q;
    static int[] a;
    static int[] b;
    static int[] c;
    static int[] d;
    static int[] A;
    static int ans;

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        N = scan.nextInt();
        M = scan.nextInt();
        Q = scan.nextInt();

        a = new int[Q];
        b = new int[Q];
        c = new int[Q];
        d = new int[Q];

        for (int i = 0; i < Q; i++) {
            a[i] = scan.nextInt()-1;
            b[i] = scan.nextInt()-1;
            c[i] = scan.nextInt();
            d[i] = scan.nextInt();
        }

        A = new int[N];
        ans = 0;
        calc(0);

        os.println(ans);
    }

    static void calc(int idx) {
        if(idx == N) {
            max();
            return;
        }
        int startValue = idx == 0 ? 1 : A[idx-1];
        for(int i = startValue; i <= M; i++) {
            A[idx] = i;
            calc(idx+1);
        }
    }

    static void max() {
        int temp = 0;
        for(int i = 0; i < Q; i++) {
            if(A[b[i]]-A[a[i]] == c[i]) {
                temp += d[i];
            }
        }
        ans = Math.max(ans, temp);
    }

}

Measured memory_bytes: 27960
#include <iostream>
#include <string>
using namespace std;
string s;
int n, a;
int main()
{
    cin >> n >> s;

    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] + n >= 91)
        {
            printf("%c", (s[i] + n - 26));
        }
        else
        {
            printf("%c", (s[i] + n));
        }
    }
}

Measured memory_bytes: 384
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2607
//
#include <bits/stdc++.h>
using namespace std;
int n, d, x;
int p[10][10];
int dp[100001];
int s, s2;
int main() {
    scanf("%d%d%d",&n,&d,&x);
    for (int i=0; i<d; i++) for (int j=0; j<n; j++) scanf("%d", &p[i][j]);
    int res = x;
    for (int i=0; i<d-1; i++) {
        memset(dp, 0, sizeof(dp));
        for (int j=0; j<res+1; j++) dp[j]=j;
        int tmp = res;
        for (int j=0; j<n; j++) {
            for (int k=p[i][j]; k<res+1; k++) {
                dp[k] = max(dp[k], dp[k-p[i][j]]+p[i+1][j]);
                tmp = max(tmp, dp[k]);
            }
        }
        res = tmp;
    }
    printf("%d\n",res);
}

Measured memory_bytes: 1588
import math

N = int(input())

ans = 0

for i in range(2, N + 1):
    if i * i > N:
        if N == 2:
            ans += 1
        else:
            ans += 2
        break
    if (N - 1) % i == 0:
        ans += 1
        if (N - 1) // i != i:
            ans += 1
    elif N % i == 0:
        cand = [i]
        if N // i != i:
            cand.append(N // i)
        for c in cand:
            tmp = N
            while tmp % c == 0:
                tmp //= c
            if tmp % c == 1:
                ans += 1

# i = N-1, N
print(ans)


Measured memory_bytes: 41196
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;

long long N, K, C, cl[1000009], cr[1000009];
string S;

int calc(int pos) {
	int pl = pos - (C + 1); pl = max(pl, 0);
	int pr = pos + (C + 1); pr = min(pr, (int)N + 1);
	return cl[pl] + cr[pr];
}

bool solve(int pos) {
	int T1 = calc(pos);
	int T2 = 0;
	for (int i = pos - C; i <= pos + C; i++) {
		if (i <= 0 || i > N || i == pos || S[i - 1] == 'x') continue;
		T2 = max(T2, calc(i) + 1);
	}
	if (max(T1, T2) < K) return true;
	return false;
}

int main() {
	cin >> N >> K >> C >> S;

	vector<int> vec; int pres = -(1 << 30);
	for (int i = 1; i <= N; i++) {
		if (S[i - 1] == 'o' && i - pres > C) { vec.push_back(i); pres = i; }
	}

	vector<int> vec2; int pre2 = (1 << 30);
	for (int i = N; i >= 1; i--) {
		if (S[i - 1] == 'o' && pre2 - i > C) { vec2.push_back(i); pre2 = i; }
	}

	for (int i : vec) cl[i] = 1;
	for (int i : vec2) cr[i] = 1;
	for (int i = 1; i <= N; i++) cl[i] += cl[i - 1];
	for (int i = N; i >= 1; i--) cr[i] += cr[i + 1];

	vector<int> ans;
	for (int i : vec) {
		if (solve(i) == true) ans.push_back(i);
	}
	sort(ans.begin(), ans.end());

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

Measured memory_bytes: 9716
from numba import njit


@njit
def main(N, M, P):
    ma = 0
    for i in range(M):
        for j in range(i, M):
            for k in range(j, M):
                for l in range(k, M):
                    for m in range(l, M):
                        for n in range(m, M):
                            for o in range(n, M):
                                for p in range(o, M):
                                    for q in range(p, M):
                                        for r in range(q, M):
                                            ans = 0
                                            arr = [i, j, k, l,
                                                   m, n, o, p, q, r][:N]
                                            for a, b, c, d in P:
                                                if arr[b-1] - arr[a-1] == c:
                                                    ans += d
                                                ma = max(ma, ans)
    return ma


N, M, Q = map(int, input().split())
P = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    P.append((a, b, c, d))

print(main(N, M, P))


Measured memory_bytes: 116000
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);


int main(){
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	std::vector<ll> rr(a);
	std::vector<ll> gg(b);
	std::vector<ll> cc(c);
	fo(i,a) cin>>rr[i];
	fo(i,b) cin>>gg[i];
	fo(i,c) cin>>cc[i];
	sort(all(rr));
	sort(all(gg));
	sort(all(cc));
	reverse(all(rr));
	reverse(all(gg));
	reverse(all(cc));

    ll ans=0;
	


	vector<ll> final;
	
    fo(i,x) final.pb(rr[i]);
	fo(i,y) final.pb(gg[i]);
	fo(i,c) final.pb(cc[i]);
	sort(all(final));
	reverse(all(final));
	fo(i,x+y) ans+=final[i];
	cout<<ans<<endl;




}


Measured memory_bytes: 8560
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

ll dis[205][205];
int in[10];
int main() {
	int N, M, R, i, j, k;
	scanf("%d %d %d", &N, &M, &R);
	for (i = 0; i < R; i++) scanf("%d", &in[i]);

	for (i = 1; i <= N; i++) for (j = 1; j <= N; j++) if (i != j) dis[i][j] = LL_INF;
	while (M--) {
		int t1, t2, t3;
		scanf("%d %d %d", &t1, &t2, &t3);
		dis[t1][t2] = min(dis[t1][t2], (ll)t3);
		dis[t2][t1] = min(dis[t2][t1], (ll)t3);
	}
	for (k = 1; k <= N; k++) for (i = 1; i <= N; i++) for (j = 1; j <= N; j++) dis[i][j] = min(dis[i][k] + dis[k][j], dis[i][j]);

	sort(in, in + R);

	ll ans = LL_INF;
	do {
		ll ta = 0;
		for (i = 0; i + 1 < R; i++) ta += dis[in[i]][in[i + 1]];
		ans = min(ans, ta);
	} while (next_permutation(in, in + R));
	return !printf("%lld\n", ans);
}

Measured memory_bytes: 512
count = int(raw_input())
lis = map(int, raw_input().split())
mi = lis[0]
ma = lis[0]
su = 0
for i in lis:
    if i < mi:
        mi = i
    if i > ma:
        ma = i
    su += i

print '%d %d %d'%(mi, ma, su)

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

struct Node{
    int sib,p,k,left,right;
    Node(){
        sib=p=k=left=right=-1;
    }
};

int calcHeight(int id,Node* node,int height){
    if(id==-1)return -1;
    if(node[id].k==0)return height;
    if(height>25)return -1;
    else return max(calcHeight(node[id].left,node,height+1),calcHeight(node[id].right,node,height+1));
}

int main(void){
    int n,i,k,id,left,right,depth;
    Node node[25];
    
    cin>>n;

    for(i=0;i<n;i++){
        cin>>id>>left>>right;
        k=0;
        node[id].left=left;
        node[id].right=right;
        if(left!=-1){
            node[left].sib=right;
            node[left].p=id;
            k++;
        }
        if(right!=-1){
            node[right].sib=left;
            node[right].p=id;
            k++;
        }
        node[id].k=k;
    }
    
    for(i=0;i<n;i++){
        id=i;
        depth=0;
        for(int j=0;j<n;j++){
            if(node[id].p==-1)break;
            id=node[id].p;
            depth++;
        }
        /*
        while(node[id].p!=-1){
            id=node[id].p;
            depth++;
        }
        */
        printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
            i,node[i].p,node[i].sib,node[i].k,depth,calcHeight(i,node,0));
        if(depth==0)printf("root\n");
        else if(node[i].k>0)printf("internal node\n");
        else printf("leaf\n");
    }
    return 0;
}




Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <climits>
#include <unistd.h>
#include <cmath>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ar[n][3];
    int special = -1;
    for (int i = 0; i < n; ++i){
        scanf("%d%d%d", &ar[i][0],&ar[i][1],&ar[i][2]);
        if (ar[i][2] != 0)
            special = i;
    }
    int con;
    int i, x, y;
    for (x = 0; x < 101; ++x){
        for (y = 0; y < 101; ++y){
            con = abs(x-ar[special][0])+abs(y-ar[special][1])+ar[special][2];
            for (i = 0; i < n; ++i){
                if (max(0,con-abs(x-ar[i][0])-abs(y-ar[i][1])) != ar[i][2])
                    break;
            }
            if (i == n)
                break;
        }
        if (i==n)
            break;
    }
    cout <<  x <<' '<< y << ' '<<con;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 3724
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String w = scanner.nextLine();
        StringBuilder t = new StringBuilder();

        while(true){
            String input = scanner.nextLine();

            if(input.equals("END_OF_TEXT")){
                break;
            }

            t.append(input);
            t.append(" ");
        }

        String text = t.toString().toLowerCase();
        String[] textArray = text.split("\\s+");
        int count = 0;
        for(String txt : textArray){
            if(txt.equals(w)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
}



Measured memory_bytes: 26124
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

using namespace std;

//arc066 Lining Up
//自分の左に並んでいた人数と自分の右に並んでいた人数の差の絶対値 Ai
//入れ替え可能な箇所が何個あるか数える 絶対値(2人が2箇所)
//Nが奇数の場合は、真ん中以外入れ替われる → 2^(N/2)
//並べない場合もあるので、値は調べる
int main(){
  ll N,res,tmp;
  cin >> N;

  ll a[N+1] = {};

  //うまく散らばっているか調べる
  //N = 3の場合
  //A 1 0 1
  //N = 4の場合
  //A 3 1 1 3
  //N = 5の場合
  //A 4 2 0 2 4
  REP(i,N)
  {
    cin >> tmp;
    a[tmp]++;

  }

  bool isOK = true;
  for(ll i = N-1; i >= 0; i-=2)
  {
    if(i == 0)
    {
      if(a[i] != 1)
      {
        isOK = false; 
        break;
      }
    }
    else
    {
      if(a[i] != 2)
      {
        isOK = false;
        break;
      }
    }
  }

  if(isOK)
  {

    //計算
    res = 1;
    REP(i,N/2)
    {
      res *= 2;
      res %= MOD;
    }
    cout << res << endl;
  }
  else
  {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


a, b = Is()
if a > 2*b:
    print(a-2*b)
else:
    print("0")

Measured memory_bytes: 38256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
N, K = map(int, input().split())

d = [0 for i in range(K)]
A = []
for i in range(K):
  d[i] = int(input())
  A.append(list(map(int, input().split())))

candy = [0 for i in range(N)]
for i in range(K):
  for j in range(d[i]):
    candy[A[i][j]-1] += 1
print(candy.count(0))

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int N;
    u64 A;
    u64 remain = 0;
    u64 ans = 0;

    cin >> N;
    rep (i, N)
    {
        cin >> A;
        ans += (A + remain) / 2;
        remain = A ? (A + remain) % 2 : 0;
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int main(void){
  fast_io
  ll a,b;cin>>a>>b;
  cout<<a*b/gcd(a,b)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=1000000007LL;
typedef pair<int,int> P;

int main() {
	ll k,a[51];
	cin>>k;
	cout<<50<<endl;
	for(int i=0;i<50;++i)a[i]=i+k/50;

	for(int i=0;i<k%50;++i){
		for(int j=0;j<50;++j){
			if(i==j)a[i]+=50;
			else a[j]--;
		}
	}
	for(int i=0;i<49;++i)cout<<a[i]<<" ";
	cout<<a[49]<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_6_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            int n = line[0];
            int m = line[1];

            int[,] matrixA = new int[n, m];
            int[] matrixB = new int[m];

            for(int i = 0; i < n; i++)
            {
                int[] lineA =ReadIntAr();
                for(int j = 0; j < m;j++)
                {
                    matrixA[i, j] = lineA[j];
                }
            }

            for (int i = 0; i < m; i++)
            {
                matrixB[i] = ReadInt();
            }

            long rlt;
            for (int i = 0; i < n; i++)
            {
                rlt = 0;
                for (int j = 0; j < m; j++)
                {
                    rlt += matrixA[i, j] * matrixB[j];
                }
                Console.WriteLine(rlt.ToString());
            }
         
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 16008
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;


int main(void){
    ll s;
    cin>>s;
    ll x1=0,y1=0;
    ll x2=(ll)1000000000,y2=1;
    ll y3=s/x2,x3=s%x2;
    if(s!=1000000000000000000)cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<x2-x3<<" "<<y3+1<<endl;
    else cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<x3<<" "<<y3<<endl;
    return 0;
}

Measured memory_bytes: 384
h, w = gets.split(' ').map(&:to_i)
str = ''
(h + 2).times do |i|
  if i == 0 || i == h + 1
    str += '#' * (w + 2) + "\n"
    next
  end
  row = '#'
  row += gets.chomp.tr(' ', '')
  row += "#\n"
  str += row
end

print(str)  


Measured memory_bytes: 2300
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int h[100010];
    rep(i, N) cin >> h[i];
    int ans = 0;
    rep(i, N) {
        if(h[i] >= K) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4020
package main

import "fmt"

var n, A, B, C int
var l []int

func main() {
	fmt.Scan(&n, &A, &B, &C)
	l = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i])
	}

	ans := dfs(0, 0, 0, 0)
	fmt.Println(ans)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func dfs(a, b, c, i int) int {
	if i == n {
		if a == 0 || b == 0 || c == 0 {
			return 99999999999
		}

		return abs(A-a) + abs(B-b) + abs(C-c) - 30
	}

	r0 := dfs(a, b, c, i+1)
	r1 := dfs(a+l[i], b, c, i+1) + 10
	r2 := dfs(a, b+l[i], c, i+1) + 10
	r3 := dfs(a, b, c+l[i], i+1) + 10

	return min(r0, min(r1, min(r2, r3)))
}


Measured memory_bytes: 512
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	str := nextString()
	q := nextInt()
	for i := 0; i < q; i++ {
		question := nextString()
		if question == "replace" {
			a, b, s := nextInt(), nextInt(), nextString()
			str = str[:a] + s + str[b+1:]
		}
		if question == "reverse" {
			a, b := nextInt(), nextInt()
			var tmp string
			for j := b; j >= a; j-- {
				tmp += string(str[j])
			}
			str = str[:a] + tmp + str[b+1:]
		}
		if question == "print" {
			a, b := nextInt(), nextInt()
			fmt.Println(str[a : b+1])
		}
	}
}



Measured memory_bytes: 3344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_TheNumberofEvenPairs_159
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int n = inputLongArray[0];
            int m = inputLongArray[1];


            int result = 0;
            int even = 1;
            for (int i=n;i >= n-1;i--)
            {
                even = even * i;
            }
            even = even / 2;
            int odd = 1;
            for (int i = m;i >= m-1;i--)
            {
                odd = odd * i;
            }
            odd = odd / 2;

            result = even + odd;

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28100
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, Q = map(int, input().split())
events = []
for i in range(N):
    s, t, x = map(int, input().split())
    events.append((s - x, 0, x))
    events.append((t - x, 1, x))

for i in range(Q):
    d = int(input())
    events.append((d, 2, i))

events = sorted(events)

q = [INF]
cnt = defaultdict(int)
cnt[INF] = 1
ans = [INF] * Q
for a, b, c in events:
    if b == 0:
        heapq.heappush(q, c)
        cnt[c] += 1
    if b == 1:
        cnt[c] -= 1
    if b == 2:
        while cnt[q[0]] == 0:
            heapq.heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0]
for i in range(Q):
    print(ans[i])

Measured memory_bytes: 105452
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= 1

already = [-1 for i in range(n)]
already[0] = 0
mati = 0
num = 0
for _ in range(n):
    num += 1
    mati = a[mati]
    if already[mati] == -1:
        already[mati] = num
        continue
    else:
        roop = num - already[mati]
        break

saisho = already[mati]
if k <= saisho:
    tugi = 0
    for _ in range(k):
        tugi = a[tugi]
    print(tugi+1)
else:
    nokori = k - saisho
    amari = nokori % roop
    for _ in range(amari):
        mati = a[mati]
    print(mati+1)

Measured memory_bytes: 99020
#python3

def main():
    n, k = map(int, input().split())
    R, S, P = map(int, input().split())
    t = input()

    win = {'r': P, 's': R, 'p': S}

    ans = 0
    for i in range(k):
        div = t[i::k] + 'x'
        seq = 1
        for j in range(len(div)-1):
            winHandPoint = win[div[j]]
            if div[j] == div[j+1]: 
                seq += 1 
            else:
                ans += (seq+1)//2 * winHandPoint
                seq = 1
    print(ans) 
main()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define rep(i, n, k) for(int i=k; i<n; ++i)
#define drep(i, n, k) for(int i=n; i>k; --i)
using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans;
  if(a >= b+c) ans = 0;
  else ans = c-a+b;
  cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np


h, w = map(int, input().split())
graph = [[] for _ in range(10)]
for i in range(10):
    graph[i] += list(map(int, input().split()))


graph = np.transpose(np.array(graph))

vst = 1
n = 10
checked = [0] * n
dist = [float('inf')] * n
dist[vst] = 0
for _ in range(n):
    min_dist = float('inf')
    for i in range(n):
        if checked[i] == 0 and dist[i] < min_dist:
            target_v = i
            min_dist = dist[i]
    checked[target_v] = 1
    for to_v in range(n):
        cost = graph[target_v][to_v]
        dist[to_v] = min(dist[target_v] + cost, dist[to_v])



ret = 0
for i in range(h):
    for j in map(int, input().split()):
        if j != -1:
            ret += dist[j]


print(ret)

Measured memory_bytes: 12440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	string a;
	cin>>a;
	if(a.size()%2==1){
		cout<<"No\n";
	}
	else{
		for(ll i=0;i<a.size();i=i+2){
			if(a[i]!='h'||a[i+1]!='i'){
				cout<<"No\n";
				return 0;
			}
		}
		cout<<"Yes\n";
	}
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        double x = (a[0] + a[1]) / 2.0;
        for (int i = 2; i < n; i++) {
            x = (x + a[i]) / 2;
        }
        System.out.printf("%f\n", x);
    }
}


Measured memory_bytes: 23124
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

class order {
public:
	order(const vector<int>& ot);
	~order();
	int main_calc();
private:
	void recursive_func(const vector<int> dot, const int sum);
private:
	const vector<int> order_time;
	vector<int> ans;
};

order::order(const vector<int>& ot) : order_time(ot) {
	ans.clear();
}

order::~order() {
}

void order::recursive_func(const vector<int> dot, const int sum) {
	vector<int> dummy;
	int dsum;
	if (dot.size() == 1) {
		dsum = sum;
		dsum += dot[0];
		ans.push_back(dsum);
	}
	else {
		for (int i = 0; i < dot.size(); i++) {
			dummy = dot;
			dsum = sum;
			auto itr = dummy.begin();
			itr = itr + i;
			dsum += *itr;
			if (dsum % 10 > 0) {
				dsum = (1 + (dsum / 10)) * 10;
			}
			dummy.erase(itr);
			recursive_func(dummy, dsum);
		}
	}
}

int order::main_calc() {
	recursive_func(order_time, 0);
	return *min_element(ans.begin(), ans.end());
}

int main() {

	vector<int> order_time(5, 0);
	for (int i = 0; i < order_time.size(); i++) {
		cin >> order_time[i];
	}

	order od(order_time);
	int ans = od.main_calc();

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

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

constexpr int MOD = 998244353;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
	if(n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main() {

 ios::sync_with_stdio(false);
ll n;
cin>>n;

ll s[4];
for(int i=0;i<=3;i++){
	s[i]=0;
}
for(int i=1;i<=n;i++){
string ss;
cin>>ss;
if(ss=="AC")s[0]++;
if(ss=="WA")s[1]++;
if(ss=="TLE")s[2]++;
if(ss=="RE")s[3]++;

}

for(int i=0;i<=3;i++){
if(i==0)cout<<"AC"<<" "<<'x'<<" "<<s[0]<<endl;
if(i==1)cout<<"WA"<<" "<<'x'<<" "<<s[1]<<endl;
if(i==2)cout<<"TLE"<<" "<<'x'<<" "<<s[2]<<endl;
if(i==3)cout<<"RE"<<" "<<'x'<<" "<<s[3]<<endl;


}


}






Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>

struct RangeUpdateQuery{
    int n, now;
    std::vector<int> dat, time;

    void init(int n_){
        n = 1;
        now = 0;
        while(n < n_) n *= 2;
        dat.resize(2 * n - 1, std::numeric_limits<int>::max());
        time.resize(2 * n - 1, 0);
    }

    void update(int a, int b, int k, int l, int r, int x){
        if(r <= a || b <= l) return;
        if(a <= l && r <= b){
            dat[k] = x;
            time[k] = now;
        }
        else{
            update(a, b, k * 2 + 1, l, (l + r) / 2, x);
            update(a, b, k * 2 + 2, (l + r) / 2, r, x);
        }
    }

    void update(int a, int b, int x){
        now++;
        update(a, b, 0, 0, n, x);
    }

    int query(int k){
        k += n - 1;
        int res = dat[k], recent = time[k];
        while(k > 0) {
            k = (k - 1) / 2;
            if(recent < time[k]){
                recent = time[k];
                res = dat[k];
            }
        }
        return res;
    }
};


using namespace std;

int main(){
    int n, q;
    cin >> n >> q;
    RangeUpdateQuery ruq;
    ruq.init(n);
    while(q--){
        int com;
        cin >> com;
        if(com){
            int i;
            cin >> i;
            cout << ruq.query(i) << "\n";
        }else{
            int s, t, x;
            cin >> s >> t >> x;
            ruq.update(s, t + 1, x);
        }
    }
}


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

const int maxn = 100010;
int n, a[maxn], x;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]), x ^= a[i];
    }
    printf("%s\n", x ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 640