akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	sc := NewScanner()

	_ = sc.NextInt()
	m := sc.NextInt()

	ac := 0
	wa := 0
	wamp := map[int]int{}
	acmp := map[int]bool{}

	for i := 0; i < m; i++ {
		p := sc.NextInt()
		s := sc.NextLine()
		if acmp[p] {
			continue
		}
		if s == "WA" {
			wamp[p]++
		}
		if s == "AC" {
			ac++
			wa += wamp[p]
			acmp[p] = true
		}
	}
	fmt.Printf("%v %v\n", ac, wa)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x;
    cin>>n>>x;
    Vec v(n);
    ll d = 0;
    ll ans = 1;
    rep(i,n){
        ll c;
        cin >> c;
        d += c;
        if(d<=x){
            ans ++;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a =s.nextInt(),b=s.nextInt(),c=s.nextInt(),k=s.nextInt();
        long sum=0;
        int min = Math.min(a,k);
        a-=min;k-=min;
        sum += min*1;
         min = Math.min(b,k);
        b-=min;k-=min;

         min = Math.min(c,k);
        c-=min;k-=min;
        sum += (min*-1);
        System.out.println(sum);
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

using namespace std;

int n, a[205];

int main()
{
    cin >> n;
    for (int i = 1; i <= 2 * n; ++i) cin >> a[i];
    sort(a + 1, a + 2 * n + 1);
    int ans = 0;
    for (int i = 1; i <= 2 * n; i += 2) ans += a[i];
    cout << ans;
}


Measured memory_bytes: 256
s = input()
ans_list = []
for i in s:
    if i == "B":
        if len(ans_list) != 0:
            ans_list.pop(-1)
    elif i == "1":
        ans_list.append("1")
    elif i == "0":
        ans_list.append("0")
print("".join(ans_list))


Measured memory_bytes: 38256
N = int(input())
S = [int(x) for x in list(input())]
total = 0
for a in range(1000):
  tmp = [a//100,a//10%10,a%10]
  i = 0
  for x in range(N):
    if tmp[i] == S[x]:
      i+=1
    if i==3:
      total+=1
      break
print(total)

Measured memory_bytes: 42860
class DisjointSets:
    def __init__(self,n):
        self.parent = [i for i in range(n)]
        self.siz = [1]*n
        self.grp = n

    def root(self,x):
        if x != self.parent[x]: 
            self.parent[x] = self.root(self.parent[x])
        return self.parent[x]

    def same(self,x,y): 
        return self.root(x) == self.root(y)

    def unite(self,x,y): 
        x = self.root(x)
        y = self.root(y)
        if x == y: 
            return
        if self.siz[x] < self.siz[y]: 
            x,y = y,x
        self.parent[y] = x
        self.siz[x] += self.siz[y]
        self.grp -= 1

    def size(self,x):
        return self.siz[self.root(x)]

n,m = map(int,input().split())
ds = DisjointSets(n)
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ds.unite(a,b)
print(max(ds.siz))

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

bool exist(int num, int i);

int a[1000000];

int main() {
  int s;
  
  cin >> s;
  
  bool first = false;
  bool end = false;
  
  a[0] = s;
  
  int i = 0;
  while(!end)
  {
    //cout << a[i] << endl;
    
    if(a[i] % 2 == 0) a[i+1] = a[i] / 2;	// 偶数なら半分
    else a[i+1] = 3*a[i] + 1;	// 奇数なら3倍+1
    
    i++;
    
    if(!first && exist(a[i],i)) first = true;
    if(first && exist(a[i],i)) end = true;
  }
  
  cout << i+1 << endl;
  
  return 0;
}

bool exist(int num, int i)
{
  for(int k = 0; k < i; k++)
  {
    if(a[k] == num) return true;
  }
  return false;
}

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

template <typename t>
void mi(t& a, const t& b) { a = min(a, b); }

template <typename t>
void ma(t& a, const t& b) { a = max(a, b); }

constexpr int si = 1024 * 1024, mod = static_cast<int>(1e9) + 7;

template <typename t, typename u>
void ad(t& a, const u& b)
{
  a += b;
  if (mod <= a) a -= mod;
}

template <typename t, typename u>
void mu(t& a, const u& b)
{
  a = (a * b) % mod;
}

constexpr long double eps = 1.0e-9;
//printf("%0.9f\n", p);
int n, m, k, ar[si], br[si];
char bar[si], car[si];
vector<int> gr[si], gr2[si];

void vi(const int pa)
{
  bar[pa] = 1;
  for(const auto &v : gr[pa])
  {
    if(!bar[v])
    {
      ar[v] = pa;
      vi(v);
    }
  }
}

int sol(const int x, const int y)
{
  int r = 0;
  memset(ar, 0, 8*(n + 5));
  memset(bar, 0, n + 5);

  ar[x] = x;
  vi(x);

  return r;
}

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

  int64_t n, m, k;
  while (2 == scanf("%lld%lld", &n, &m))
  {
    k = n;
    int s = 0;
    for(;;)
    {
      ++s;
      k *= 2;
      if (m < k)
        break;
    }

    //auto s =     sol();
    //puts(s ? "YES" : "NO");
    cout << s << '\n';
#ifndef _DEBUG
    break;
#else
    for (int i = 0; i <= n + 2; i++)
    {
      gr[i].clear();
      gr2[i].clear();
    }
    memset(bar, 0, sizeof bar);
    memset(car, 0, sizeof car);
    memset(ar, 0, sizeof ar);
    memset(br, 0, sizeof br);
#endif
  }
  return 0;
}


Measured memory_bytes: 51456
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int g[9],j[9];
  int t,wg,wj,n;

  cin >> t;
  while(t--){
    for(int i=0;i<9;i++)cin >> g[i];
    for(int i=0;i<9;i++)cin >> j[i];
    sort(g,g+9);
    n = wg = wj = 0;

    do{
      n++;
      int sg,sj;
      sg = sj = 0;
      for(int i=0;i<9;i++){
	if(g[i] > j[i])sg += g[i] + j[i];
	else sj += g[i] + j[i];
      }
      if(sg > sj)wg++;
      if(sg < sj)wj++;
    }while(next_permutation(g,g+9));

    printf("%.5lf %.5lf\n",(double)wg/n,(double)wj/n);
  }
}

Measured memory_bytes: 0
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()
#define dump(x) cout << #x << " = " << (x) << endl

int main() {
  int N, M;
  cin >> N >> M;
  priority_queue<int> que;
  int tmp = 0;
  rep(i, N) {
    cin >> tmp;
    que.push(tmp);
  }

  rep(i, M) {
    tmp = que.top();
    que.pop();
    que.push(tmp / 2);
  }

  long long sum = 0;
  while (!que.empty()) {
    tmp = que.top();
    que.pop();
    sum += tmp;
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
using namespace std;
int main() {
  int a, b, c, d;
  string r;
  cin >> a >> b >> c >> d;
  if (a + b > c + d) {
    r = "Left";
  } else if (a + b < c + d) {
    r = "Right";
  } else {
    r = "Balanced";
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll n;
ll a[100010];
int main(){
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	sortdown(a,n);
	ll x=0,y=0;
	for(ll i=0;i<n;i++){
		if(a[i]==a[i+1]){
			if(x==0)x=a[i];
			else if(y==0)y=a[i];
			i++;
		}
	}
	printf("%lld\n",x*y);
}

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
lol gcd(lol x,lol y){//最大公約数
  if(y>x) swap(x,y);
  lol r=x%y;
  while(r!=0){
    x=y;
    y=r;
    r=x%y;
  }
  return y;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,m,k;
  string s,w;
  lol a,b,c,x,y;
  cin >>n>>m;
  if(n==0||m==0){
    if(n==0) cout <<"0\n";
    else cout <<n<<'\n';
    return 0;
  }
  if(m==1){
    cout <<"0\n";
    return 0;
  }
  if(n>m){
    lol ans=n%m;
    cout <<min(ans,m-ans)<<'\n';
  }else{
    cout <<min(n,m-n)<<'\n';
  }
  return (0);
}


Measured memory_bytes: 256
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]

a, b = fetch_int_input()

strs = []
strs.append("".join([str(a) for _ in range(b)]))
strs.append("".join([str(b) for _ in range(a)]))

print(sorted(strs)[0])


Measured memory_bytes: 38384
/*
 * Author: FreeIdea
 * Created Time:  2011/8/24 14:57:58
 * File Name: D.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}
const int maxn = 150;

int n, w, h, cnt, q;

struct Button {
    int x1, y1, x2, y2, to_id;
    Button() {}
    Button(int _x1, int _y1, int _x2, int _y2, int _to_id):x1(_x1), y1(_y1), x2(_x2), y2(_y2), to_id(_to_id){}
};

struct Page {
    vector<Button> buttons;
    string name;
}page[maxn];

map<string, int> idx;

int hash(const string &str) {
    if(idx.count(str))  return idx[str];
    return idx[str] = ++cnt;
}

vector<int> buffer;
int pt;

bool in_button(int x, int y, int x1, int y1, int x2, int y2) {
    return x1 <= x && x<= x2 && y1 <= y && y <= y2;
}

void click(int x, int y) {
    int to_page = -1;
    int cur = buffer[pt];
    for(int i = 0; i < page[cur].buttons.size(); i++) {
        if(in_button(x, y, page[cur].buttons[i].x1, page[cur].buttons[i].y1, page[cur].buttons[i].x2, page[cur].buttons[i].y2)) {
            to_page = page[cur].buttons[i].to_id;
        }
    }
    if(to_page == -1)   return;
    int sz = buffer.size();
    for(int i = pt + 1; i < sz; i++) {
        buffer.pop_back();
    }
    buffer.push_back(to_page);
    pt = buffer.size() - 1;
}

void back() {
    if(pt != 0) pt--;
}

void forward() {
    if(pt + 1 < buffer.size()) {
        pt++;
    }
}

void show() {
    int cur = buffer[pt];
    cout << page[cur].name << endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    while(cin >> n) {
        if(!n)  break;
        cin >> w >> h;
        idx.clear();
        cnt = 0;
        for(int i = 1; i <= n; i++) {
            string name;
            cin >> name;
            int id = hash(string(name));
            page[id].name = name;
            page[id].buttons.clear();
            int m;
            cin >> m;
            for(int i = 1; i <= m; i++) {
                int x1, y1, x2, y2, to_id;
                string to;
                cin >> x1 >> y1 >> x2 >> y2 >> to;
                to_id = hash(to);
                page[id].buttons.push_back(Button(x1, y1, x2, y2, to_id));
            }
        }
        cin >> q;
        string op;
        int x, y;
        buffer.clear();
        buffer.push_back(1);
        pt = 0;
        for(int i = 1; i <= q; i++) {
            cin >> op;
            if(op == "click") {
                cin >> x >> y;
                click(x, y);
            }
            else if(op == "back") {
                back();
            }
            else if(op == "forward") {
                forward();
            }
            else if(op == "show") {
                show();
            }
        }
    } 
    return 0;
}

Measured memory_bytes: 0
#include <iostream>

int main() {
    int n;
    int* arr = NULL;
    std::cin >> n;
    if (n > 0) {
        arr = new int[n];
        for (int i = 0; i < n; ++i)
            std::cin >> arr[i];
    }
    std::sort(arr, arr + n, std::greater<int>());
    long int s = arr[0];
    const int k = (n - 2)/2;
    for (int i = 1; i <= k; ++i)
        s += 2 * arr[i];
    if ((n - 2) % 2 == 1)
        s += arr[k + 1];
    std::cout << s;
    if (arr != NULL)
        delete [] arr;
    return 0;
}



Measured memory_bytes: 3672
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

void yay(bool x){cout << (x ? "Yay!" : ":(") << endl;}

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

  int N, K; cin >> N >> K;
  if(K == 1){
    cout << 0 << endl;
    return 0;
  }
  N -= K-1;
  cout << N - 1 << endl;
}

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

/* クイックソートを行う */
void QSort(int *x, int *y, int left, int right)
{
	int i, j;
	int pivot;
	i = left;                      /* ソートする配列の一番小さい要素の添字 */
	j = right;                     /* ソートする配列の一番大きい要素の添字 */

	pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

	while (1) {                    /* 無限ループ */

		while (x[i] < pivot)       /* pivot より大きい値が */
			i++;                   /* 出るまで i を増加させる */

		while (pivot < x[j])       /* pivot より小さい値が */
			j--;                   /*  出るまで j を減少させる */
		if (i >= j)                /* i >= j なら */
			break;                 /* 無限ループから抜ける */

		int temp;

		temp = x[i];
		x[i] = x[j];
		x[j] = temp;            /* x[i] と x[j]を交換 */
		temp = y[i];
		y[i] = y[j];
		y[j] = temp;
		i++;                       /* 次のデータ */
		j--;
	}

	if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
		QSort(x, y, left, i - 1);     /* 左の配列を Q ソートする */
	if (j + 1 < right)            /* 基準値の右に 2 以上要素があれば */
		QSort(x, y, j + 1, right);    /* 右の配列を Q ソートする */
}

int main() {
	int num[5] = {};
	int num2[5] = {};
	int numID[5] = {};
	int min = 0;
	int sum = 0;
	int flag = 0;
	for (int i = 0; i < 5; i++) {
		std::cin >> num[i];
		num2[i] = num[i] % 10;
		numID[i] = i;

	}



	QSort(num2, numID, 0, 4);
	for (int i = 0; i < 5; i++) {
		if (num[numID[i]] % 10 == 0) {

		}
		else if (num[numID[i]] % 10 != 0 && flag == 0) {
			flag++;
		}
		else {
			num[numID[i]] += 10 - (num[numID[i]] % 10);
		}
	}



	int count = 0;
	for (int i = 0; i < 5; i++) {
		if (num2[i] == 0) {
			sum += num[numID[i]];
			count++;
		}
	}

	for (int i = 4; i >= 0; i--) {
		if (num2[i] != 0) {
			sum += num[numID[i]];
		}
		
	}
	
	std::cout << sum << std::endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll a,b,v,w,t; cin>>a>>v>>b>>w>>t;
	if(t*(v-w)>=abs(a-b)){
		cout<<"YES\n";
	}
	else cout<<"NO\n";
	
	return 0;
}


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

template <class T, class F = multiplies<T>>
T power(T a, long long n, F op = multiplies<T>(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long a = 0) : v((a %= M) < 0 ? a + M : a) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m r) { if ((v += r.v) >= M) v -= M; return *this; }
  m& operator-=(m r) { if (v < r.v) v += M; v -= r.v; return *this; }
  m& operator*=(m r) { v = (uint64_t)v * r.v % M; return *this; }
  m& operator/=(m r) { return *this *= power(r, M - 2); }
  friend m operator+(m l, m r) { return l += r; }
  friend m operator-(m l, m r) { return l -= r; }
  friend m operator*(m l, m r) { return l *= r; }
  friend m operator/(m l, m r) { return l /= r; }
  friend bool operator==(m l, m r) { return l.v == r.v; }
  friend string to_string(m a) { return to_string(a.v); }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int mx = 0;
  vector<mint> dp(mx + 1, 0), way(mx + 1, 1);
  for (int i = n; i; --i) {
    mx += 1 + mx / i;
    vector<mint> ndp(mx + 1), nway(mx + 1);
    for (int j = 0; j < (int)dp.size(); ++j) {
      for (int x = 0; x <= m; ++x) {
        if (x <= i) {
          int nj = j + (x + j) / i;
          ndp[nj] += (x + j) / i * way[j] + dp[j];
          nway[nj] += way[j];
        } else {
          ndp[j] += dp[j];
          nway[j] += way[j];
        }
      }
    }
    swap(dp, ndp);
    swap(way, nway);
  }
  mint res = power(mint(m + 1), n) * n * m / 2 - accumulate(begin(dp), end(dp), mint(0));
  cout << res.v << '\n';
}


Measured memory_bytes: 256
#include<stdio.h>

int WHITE = 0;
int GRAY = 1;
int BLACK = 2;
int INFTY = 100000000;

int i, j, v, n, M[100][100];

void dijkstra(){
    int minv;
    int d[100], color[100];

    for(i=0;i<n;i++){
        d[i] = INFTY;
        color[i] = WHITE;
    }

    d[0] = 0;
    color[0] = GRAY;
    while( 1 ){
        minv = INFTY;
        int u = -1;
        for(i=0;i<n;i++){
            if(minv > d[i] && color[i] != BLACK){
                u=i;
                minv = d[i];
            }
        }
        if(u==-1)
        break;
        color[u] = BLACK;
        for(v=0;v<n;v++){
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > d[u] + M[u][v]){
                    d[v] = d[u] + M[u][v];
                    color[v] = GRAY;
                }
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d %d\n", i, d[i] == INFTY ? -1 : d[i]);
    }
}

int main(){
    int k, c, u, v;

    scanf("%d", &n);
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            M[i][j] = INFTY;
        }
    }
    for(i=0;i<n;i++){
        scanf("%d %d", &u, &k);
        for(j=0;j<k;j++){
            scanf("%d %d", &v, &c);
            M[u][v] = c;
        }
    }

    dijkstra();

    return 0;
}

Measured memory_bytes: 1768
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=5005;
ll dp[4][N*N],c[2][4],wt[4],val[4];
ll solve(ll n,ll w){
    memset(dp,0,sizeof(dp));
    for(ll i=0;i<n;i++){
        for(ll j=0;j<=w;j++){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
            if(j+wt[i+1]<=w)dp[i][j+wt[i+1]]=max(dp[i][j+wt[i+1]],dp[i][j]+val[i+1]);
        }
    }
    ll ans = 0;
    for(ll j=0;j<=w;j++)ans=max(ans , dp[n][j]);
    return ans;
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n;cin>>n;
    for(ll i=0;i<2;i++)for(ll j=1;j<=3;j++)cin>>c[i][j];
    for(ll j=1;j<=3;j++)wt[j]=c[0][j],val[j]=c[1][j]-c[0][j];
    n=n+solve(3,n);
    for(ll j=1;j<=3;j++)wt[j]=c[1][j],val[j]=c[0][j]-c[1][j];
    n=n+solve(3,n);
    cout<<n;
}





Measured memory_bytes: 783104
import math
n = int(input())
a = list(map(int,input().split()))
p = 0
if sum(a) % n == 0:
    b = sum(a) // n
    for i in range(n):
        p += abs(a[i]-b) ** 2
    print(p)
else:
    b = sum(a) / n
    x = math.floor(b)
    y = math.ceil(b)
    q = 0
    for i in range(n):
        p += abs(a[i]-x) ** 2
        q += abs(a[i]-y) ** 2
    print(min(p,q))

Measured memory_bytes: 9100
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f3f;
const int M=200005;
const int N=603;
struct Edge {
	int v;
	Edge *nxt;
}edge[M];
Edge *NIL=&edge[0];
Edge *ecnt=&edge[1];
Edge *head[N],*best[N];
Edge *ban;
int n,m,du[N];
double ans;
double p[N];
inline void AddEdge(int u,int v) {
	ecnt->v=v;
	ecnt->nxt=head[u];
	head[u]=ecnt++;
}
double Prework(int u) {
	if(p[u]!=-1) return p[u];
	p[u]=0;
	for(Edge *e=head[u];e!=NIL;e=e->nxt) {
		p[u]+=Prework(e->v)+1;
		if(best[u]==NIL||p[e->v]>p[best[u]->v])
			best[u]=e;
	}
	p[u]/=du[u];
	return p[u];
}
double Dfs(int u) {
	if(p[u]!=-1) return p[u];
	p[u]=0;
	for(Edge *e=head[u];e!=NIL;e=e->nxt)
		if(e!=ban)
			p[u]+=Dfs(e->v)+1;
	p[u]/=du[u];
	return p[u];
}
int main() {
	NIL->v=0; NIL->nxt=NIL;
	scanf("%d %d",&n,&m);
	for(int i=0;i<=n;i++) {
		best[i]=head[i]=NIL;
		p[i]=-1;
	}
	for(int i=1,s,t;i<=m;i++) {
		scanf("%d %d",&s,&t);
		du[s]++;
		AddEdge(s,t);
	}
	p[n]=0;
	ans=Prework(1);
	for(int j=1;j<=n;j++) {
		if(best[j]==NIL||du[j]<=1) continue;
		p[n]=0;
		for(int i=1;i<n;i++)
			p[i]=-1;
		ban=best[j];
		du[j]--;
		ans=min(ans,Dfs(1));
		du[j]++;
	}
	printf("%.10lf\n",ans);
	return 0;
}

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

using namespace std;
using ll = long long;
 
int main() {
cout<<fixed<<setprecision(10);

int N;
cin >> N;
  if (N==1) cout <<1;
  else {
  ll a=2;
  ll b=1;
  ll c=0;
  for (int i=0; i<N-1 ; i++){
    c=a+b;
    a=b;
    b=c;
  }
  cout << c;
  }
    
	
}

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

using namespace std;


bool invalid(string s){
  char c = s[0];

  for(int i = 0; i < s.length(); i++)
    if(s[i] != c) return false;

  return true;
}

string tos(int n){
  string out = "";

  for(int i = 0; i < 4; i++){
    out += n%10+'0';
    n/=10;
  }
  reverse(out.begin(),out.end());
  return out;
}

string solve(string s){
  string A,B;

  sort(s.begin(),s.end());
  A = s;
  reverse(s.begin(),s.end());
  B = s;

  int a,b;
  stringstream s1(A),s2(B);

  s1 >> a;
  s2 >> b;
  return tos(b-a);
}

int main(){
  string s;
  while(cin >> s && s != "0000"){
    int ans = 0;

    if(invalid(s)){
      cout << "NA" << endl;
      continue;
    }

    while(s!="6174"){
      s = solve(s);
      ans++;
    }

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

Measured memory_bytes: 1248
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        _R: u32,
        G: u32,
        B: u32,
    }
    println!("{}", if (G*10+B)%4==0{"YES"}else{"NO"});
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  ll a,v,b,w,t; cin >> a >> v >> b >> w >> t;
  int dist = abs(a-b);
  ll velo = (v-w);
  ll move = velo * t;
  bool ok;
  if (dist <= move) ok = true;
  else ok = false;
  if (dist == 0) ok = true;
  puts(ok?"YES":"NO");
  return 0;
}

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define pb push_back

const long long MOD = 1000000007;


int main(){
    ll n;
    cin >> n;
    ll as[n];
    ll bs[n];
    ll cs[n];
    rep(i, n){
        cin >> as[i];
    }
    rep(i, n){
        cin >> bs[i];
    }
    rep(i, n-1){
        cin >> cs[i];
    }

    ll score = 0;
    ll before_index = -2;
    rep(i, n){
        score += bs[as[i]-1];
        if(as[i] == before_index+1){
            score += cs[as[i]-2];
        }
//        debug(before_index);
        before_index = as[i];
    }

    cout << score << endl;

    return 0;
}


Measured memory_bytes: 256
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	m := stdin.ReadInt()

	d := [][]string{}
	for i := 0; i < n; i++ {
		d = append(d, []string{})
	}

	for i := 0; i < m; i++ {
		p := stdin.ReadInt() - 1
		s := stdin.Read()
		d[p] = append(d[p], s)
	}

	a := 0
	b := 0
	for i := 0; i < n; i++ {
		c := 0
		for j := 0; j < len(d[i]); j++ {
			if d[i][j] == "AC" {
				a++
				b += c
				break
			}

			if d[i][j] == "WA" {
				c++
			}
		}
	}

	stdout.Println(fmt.Sprintf("%d %d", a, b))
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


Measured memory_bytes: 10752
N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
inf = float('inf')
dp = [inf]*N
dp[0] = 0
for i in range(N-1):
    R = min(K,N-1-i)
    M=[]
    for j in range(1,R+1):
        X = dp[i]+abs(H[i]-H[i+j])
        dp[i+j]=min(dp[i+j],X)
print(dp[-1])


Measured memory_bytes: 55904
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string c;
    cin>>c;
    if(c=="a"||c=="e"||c=="i"||c=="o"||c=="u"){
        cout<<"vowel"<<endl;
    }
    else{
        cout<<"consonant"<<endl;
    }
}


Measured memory_bytes: 3636
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop, core.thread;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


int N;
real[] P;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      P = new real[N];
      foreach (i; 0 .. N) {
        P[i] = readReal();
      }
      auto dp = new real[][](N + 1, N + 1);
      foreach (i; 0 .. N + 1) {
        dp[i][] = 0.0;
      }
      dp[0][0] = 1.0;
      foreach (i; 0 .. N) {
        foreach (j; 0 .. i + 1) {
          dp[i + 1][j] += dp[i][j] * (1.0 - P[i]);
          dp[i + 1][j + 1] += dp[i][j] * P[i];
        }
      }
      real ans = 0.0;
      foreach (j; 0 .. N + 1) {
        if (j > N - j) {
          ans += dp[N][j];
        }
      }
      writefln("%.10f", ans);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 146300
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
using namespace std;


typedef long long ll;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)

const int mod = 1000000007;

int main(){
    ll h, n;
    cin >> h >> n;

    vector<ll> a(n), b(n);
    rep(i, n)   cin >> a[i] >> b[i];
    vector<ll> dp(h + 1, INT_MAX);
    dp[0] = 0;
    for(int i = 1; i <= h; ++i){
        for(int j = 0; j < n; ++j){
            dp[i] = min(dp[i], dp[max(i - a[j], (ll)0)] + b[j]);
        }
    }

    cout << dp[h] << endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline
import random
import time
import copy
from operator import itemgetter
time0=time.time()

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]


CI=sorted([(v,i) for i,v in enumerate(C)],key=itemgetter(0),reverse=True)
CHO=[i for v,i in CI[:5]]

CHOICES=[[0]]
for i in range(1,D+1):
    SI=sorted([(v,i) for i,v in enumerate(S[i])],key=itemgetter(0),reverse=True)
    CHOICES.append([i for v,i in SI[:5]])
    
ANS=0
T=[0]
LAST=[0]*27
for day in range(1,D+1):
    SCORE=[-1<<30]*27
    for j in range(1,27):
        SC=0
        SC+=S[day][j]

        for k in range(1,27):
            if j==k:
                continue
            SC-=C[k]*(day-LAST[k])
        SCORE[j]=SC

    choose=SCORE.index(max(SCORE))
    T.append(choose)
    LAST[choose]=day

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

MAX=ANS
MAXT=copy.deepcopy(T)
d=0
after_t=0

while time.time()-time0<1.8:
    BT=copy.deepcopy(T)
    BLAST=copy.deepcopy(LAST)
    BANS=ANS
    
    d=random.randint(1,D)
    after_t=random.choice(CHO+CHOICES[d])

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    memolast=[]

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            memolast.append((day,before_t,LAST[day][before_t]))
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    memolast.append((d,after_t,LAST[d][after_t]))
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            memolast.append((day,after_t,LAST[day][after_t]))
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS*10000<MAX*9999:
        T=BT
        ANS=BANS
        for dd,tt,ll in memolast:
            LAST[dd][tt]=ll
    elif ANS>MAX:
        MAX=ANS
        MAXT=copy.deepcopy(T)

print(*MAXT[1:])


Measured memory_bytes: 179484
#include<stdio.h>
int main(void)
{
	int a1,a2,a3,a4,b1,b2,b3,b4,s,t;
	scanf("%d %d %d %d %d %d %d %d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4);
	s=a1+a2+a3+a4;
	t=b1+b2+b3+b4;
	if(s<t){
		printf("%d\n",t);
	}
	else if(t<s){
		printf("%d\n",s);
	}
	else if(s==t){
		printf("%d\n",s);
	}
	return 0;
}


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if((A==B&&B!=C)||(B==C&&C!=A)||(C==A&&A!=B))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int N, M, X;
	int un = 0, sum = 0, ans = 0;
	scanf("%d%d%d", &N, &M, &X);
	int *A = (int*)malloc(sizeof(int)*M);
	for (int i = 0; i < M; i++) {
		scanf("%d", &A[i]);
		sum += 1;
		if (A[i] < X) {
			un += 1;
		}
	}
	ans = Min(un, sum - un);
	printf("%d\n", ans);





#ifdef DEBUGF
	getch();
#endif
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;

int main(){
    map<int,int> space;
    int a_size;

    while(cin >> a_size, a_size != 0){
        space.clear();
        for(int i=1; i<=a_size; i++){
            int n;
            cin >> n;
            space[n]++;
        }
        map<int, int>::iterator it = space.begin();
        bool flug = false;
        while(it != space.end()){
            if((*it).second > a_size/2){
                cout << (*it).first << endl;
                flug = true;
                break;
            }
            it++;
        }
        if(flug == false){
            cout << "NO COLOR" << endl;
        }
    }
    return 0;
}

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

using namespace std;

#define LLI long long int

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LLI a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k%2 == 0){
        cout << (a-b) << endl;
    }else{
        cout << (b-a) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    ll x,y;
    scanf("%lld%lld",&x,&y);
    int s=0;
    while(x <= y)
    {
        s++;
        x *= 2;
    }
    printf("%d\n",s);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>


typedef long long ll;
#define fi first
#define se second
const ll mod = 1000000007;
//              123456789

using namespace std;

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

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

int A;
int B;
int C;

int main(){
  
  cin>>A>>B>>C;
  
  if( A <= C && C <= B ) puts("Yes");
  else{                  puts("No");}
  
  return 0;
}

Measured memory_bytes: 256
(*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*)

open System

let n = int(Console.ReadLine())
let s = Console.ReadLine()

let count i =
    let rec left itr lset =
        if itr <= i then left (itr+1) (Set.add s.[itr] lset)
        else 
        (let rec right itr2 rset =
            if itr2 < n then right (itr2+1) (Set.add s.[itr2] rset)
            else Set.count (Set.intersect lset rset)
            in right (i+1) Set.empty)
    in left 0 Set.empty

let ans =
    let rec loop i tmpans =
        if i < n then loop (i+1) (max tmpans (count i))
        else tmpans
    in loop 0 0

Console.WriteLine(ans)

Measured memory_bytes: 14176
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long ll;
const int MAXN = 1e5 + 10;
int N; ll E, T;
ll A[MAXN];

namespace Subtask1 {
	ll f[MAXN];
	inline int main() {
		register int i, j;
		for(i = 1; i <= N; ++i)
			for(f[i] = 1e18, j = 0; j < i; ++j)
				f[i] = min(f[i], f[j] + A[i] - A[j] + max(T, 2 * (A[i] - A[j + 1])));
		printf("%lld\n", f[N] + abs(A[N] - E));
		return 0;
	}
}

namespace Subtask2 {
	ll q[MAXN], ql = 1, qr = 1;
	ll f[MAXN], res = 1e18;
	inline int main() {
		register int i, j = 0;
		for(i = 1; i <= N; ++i) {
			while(ql <= qr && 2 * (A[i] - A[(j = q[ql]) + 1]) > T) res = min(res, f[j] - A[j] - 2 * A[j + 1]), ++ql;
			j = q[ql]; f[i] = min(A[i] + 2 * A[i] + res, f[j] + A[i] - A[j] + T);
			while(j = q[qr], ql <= qr && f[j] - A[j] >= f[i] - A[i]) --qr;
			q[++qr] = i;
		}
		printf("%lld\n", f[N] + abs(A[N] - E));
		return 0;
	}
}

int main() {
	register int i;
	scanf("%d%lld%lld", &N, &E, &T);
	for(i = 1; i <= N; ++i)
		scanf("%lld", A + i);
	if(N <= 10000) return Subtask1::main();
	Subtask2::main();
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int dp[300000][2];
int main(){
	int n;string s;cin>>n>>s;
	memset(dp,0x3f,sizeof(dp));
	dp[0][0]=dp[0][1]=0;
	for(int i=0;i<n;i++){
		int a=(s[i]=='#'?1:0);
		rep(j,2){
			rep(k,2){
				if(j==1&&k==0)continue;
				dp[i+1][k]=min(dp[i+1][k],dp[i][j]+(a!=k));
			}
		}
	}
	cout<<min(dp[n][0],dp[n][1])<<endl;
}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

ll dp[111][111][256];
void Main() {
  ll n,m;
  cin >> n >> m;
  ll a[n];
  rep(i,n) R a[i];
  mem(dp);
  dp[0][0][0]=1;
  rep(i,n) {
    rep(k,n+1) {
      rep(j,256) {
        dp[i+1][k+1][j^a[i]]+=dp[i][k][j];
        dp[i+1][k+1][j^a[i]]%=MAX;
        dp[i+1][k][j]+=dp[i][k][j];
        dp[i+1][k][j]%=MAX;
      }
    }
  }
  ll ans=0,x=1;
  REP(i,1,n+1) {
    x*=i;
    x%=MAX;
    ans+=dp[n][i][m]*x;
    ans%=MAX;
  }
  pr(ans);
}

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


Measured memory_bytes: 24960