akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll a,b,c;
  cin >> a >> b >> c;
  if(a+b>=c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/node
// Generated by CoffeeScript 1.3.3
// manually optimized. Base for CodeIQ341.
(function() {
  var a=[];
  var stdin = process.openStdin();
  stdin.setEncoding('utf8');

  var proc = function(s){
    var bidx=s.indexOf('('),count,eidx,m;
    while(bidx!=-1){
      eidx=bidx+1;
      for(count=1;count;eidx++){
        if(s[eidx]=='(')count++;
        if(s[eidx]==')')count--;
      }
      s=s.substring(0,bidx)+proc(s.substring(bidx+1,eidx-1))+s.substring(eidx);
      bidx=s.indexOf('(');
    }
    while(m = /^(.*?)(-?\d+)([*/])(-?\d+)(.*)$/.exec(s)){
      if (m[3] == '*') {
        s = m[1] + (parseInt(m[2]) * parseInt(m[4])) + m[5];
      } else {
        s = m[1] + (parseInt(m[2]) / parseInt(m[4]) ^ 0) + m[5];
      }
    }
    while(m = /^(.*?)(-?\d+)([+Z])(-?\d+)(.*)$/.exec(s)){
      if (m[3] == '+') {
        s = m[1] + (parseInt(m[2]) + parseInt(m[4])) + m[5];
      } else {
        s = m[1] + (parseInt(m[2]) - parseInt(m[4])) + m[5];
      }
    }
    return s;
  };

  stdin.on('data', function(input) {
    var i=0,len,ref,x=[];
    ref=input.split("\n");
    for(len=ref.length;i<len;i++)x.push(ref[i]);
    if(x.length>2||!isNaN(x[1]))a=x;
    else a.push(x[0]);
  });

  stdin.on('end', function(z) {
    var i,n,s;
    n = parseInt(a[0]);
    for(i=1;i<=n;i++){
      s=a[i].substring(0,a[i].indexOf('=')).replace(/-/g,'Z');
      console.log(proc(s));
    }
  });

}).call(this);

Measured memory_bytes: 9220
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    int a, b;
    cin >> a >> b;

    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6) {
        cout << b/2 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    ll n;
    cin >> n;
    vector<vector<pair<ll, ll>>> e(n);
    rep(i, 0, n - 1) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        e[a].push_back(make_pair(b, c));
        e[b].push_back(make_pair(a, c));
    }

    ll q, k;
    cin >> q >> k;
    k--;

    queue<ll> que;
    que.push(k);
    ll dist[n] = {};
    bool visited[n] = {};
    visited[k] = true;
    while (!que.empty()) {
        ll now_v = que.front();
        que.pop();
        for (auto i : e[now_v]) {
            ll next_v = i.first;
            ll next_c = i.second;
            if (visited[next_v]) continue;
            que.push(next_v);
            visited[next_v] = true;
            dist[next_v] = dist[now_v] + next_c;
        }
    }

    rep(i, 0, q) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}


Measured memory_bytes: 10112
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			if(4*i+7*j==n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())

evidences = [[] for _ in range(N)]
for i in range(N):
  A = int(input())
  for j in range(A):
    x,y = map(int, input().split())
    evidences[i].append((x - 1, y))
#print(evidences)

result = 0
for i in range(1, 2**N):
  consistent = True
  for j in range(N):
    if (i >> j) & 1 == 0:
      #print(bin(i >> j))
      #print(i,j)
      continue
    #print(i,j)
    for x,y in evidences[j]:
      if (i >> x) & 1 != y:
        consistent = False
        break
    if not consistent:
      break
  if consistent:
    #print(i)
    #print(bin(i)[2:])
    result = max(result, bin(i)[2:].count('1'))
print(result)
        

Measured memory_bytes: 3064
def bubble_sort(A,N):
    for i in range(N):
        for j in range(N-1,i+1-1,-1):
            if int(A[j][1:])<int(A[j-1][1:]):
                A[j],A[j-1] = A[j-1],A[j]
    return A    

def selection_sort(A,N):
    for i in range(N):
        minj = i
        for j in range(i+1,N):
            if int(A[j][1:])<int(A[minj][1:]):
                minj = j
        if minj != i:
            A[minj],A[i] = A[i],A[minj]
    return A
    
N = int(input())
A = input().split()

A_bubble = bubble_sort(A.copy(), N)
A_select = selection_sort(A.copy(), N)

print(*A_bubble)
print('Stable')
print(*A_select)
if A_select == A_bubble:
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string.h>
#include <cmath>
 
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i))
 
int main()
{
    int n;
    while(cin >> n , n)
    {
        vector<int> w(n,0);
        for(int i = 0;i < n;i++)
        {
            cin >> w[i];
        }
         
        vector<vector<int>> dp(n + 1,vector<int>(n + 1,0));
 
        for(int W = 2;W <= n;W++)
        {
            //left
            for(int l = 0;l < n;l++)
            {
                int r = l + W;
                if(r > n) continue;
 
                if(dp[l + 1][r - 1] == W - 2 && abs(w[l] - w[r - 1]) <= 1)
                    dp[l][r] = W;
 
                for(int mid = l;mid <= r;mid++)
                {
                    dp[l][r] = max(dp[l][r] , dp[l][mid] + dp[mid][r]);
                }
 
            }
 
        }
 
        cout << dp[0][n] << endl;
    }
    return 0;
}


Measured memory_bytes: 3192
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct Train {
	ll t;
	int is_in;
	Train(ll _t, int _is_in) :t(_t), is_in(_is_in) {}
	bool operator< (const Train& tr) {
		if (t == tr.t) {
			return is_in < tr.is_in;
		}
		else {
			return t < tr.t;
		}
	}
};
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	while (1) {
		ll n; scanf("%lld", &n);
		if (n == 0) break;
		vector<Train> vt;
		vt.reserve(n * 2);
		for (ll i = 0; i < n; i++) {
			ll sh, sm, ss, eh, em, es;
			char c;
			cin >> sh >> c >> sm >> c >> ss >> eh >> c >> em >> c >> es;
			vt.emplace_back(sh * 3600 + sm * 60 + ss, 1);
			vt.emplace_back(eh * 3600 + em * 60 + es, 0);
		}
		sort(vt.begin(), vt.end());
		n *= 2;
		ll res = 0;
		ll now = 0;
		for (ll i = 0; i < n; i++) {
			if (vt[i].is_in) {
				now++;
				chmax(res, now);
			}
			else {
				now--;
			}
		}
		printf("%lld\n", res);
	}
	return 0;
}


Measured memory_bytes: 3380
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  i64 a, b; cin >> a >> b;
  if (a < b) swap(a, b);
  cout << a + max(a - 1, b) << '\n';
  return 0;
}


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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
    if(l >= r) return;
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m+1, r);
    post.push_back(root);
}

void solve() {
    pos = 0;
    rec(0, pre.size());
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << post[i];
    }
    cout << endl;
}

int main() {

    int k;
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> k;
        pre.push_back(k);
    }

    for (int i = 0; i < n; i++) {
        cin >> k;
        in.push_back(k);
    }

    solve();
    
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  double b=0;
  for(int i=0;i<n;i++){
    b+=1.0/a[i];
  }
  cout<<1/b<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int n = sc.nextInt();
		int[] a = sc.nextIntArray(n);
		long[][] dp = new long[n - 1][21];
		dp[0][a[0]] = 1;
		for (int i = 1; i < n - 1; i++) {
			for (int j = 0; j <= 20; j++) {
				if (j + a[i] <= 20) {
					dp[i][j + a[i]] += dp[i - 1][j];
				}
				if (j - a[i] >= 0) {
					dp[i][j - a[i]] += dp[i - 1][j];
				}
			}
		}
		System.out.println(dp[n - 2][a[n - 1]]);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

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

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}
	}
}

Measured memory_bytes: 17264
N = int(input())
S = list(input())
d = []

for i in range(N+1):
    partial = S[:i]
    d.append(partial.count('(') - partial.count(')'))

a = -min(d)
b = d[-1]

print('(' * a + "".join(S) + ')' * (b + a))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
const int mod = 1000 * 1000 * 1000 + 7;
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define clr(x) x.clear()
#define LOG(x) std::cout << x << std::endl;
 
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265359;
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


int main(){
   int a,b,c;
   cin>>a>>b>>c;
   cout<<c<<" "<<a<<" "<<b<<endl;
   return 0;
}

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	xx := make([]int, 0)
	yy := make([]int, 0)
	sx := make([]int, n)
	tx := make([]int, n)
	sy := make([]int, n)
	ty := make([]int, n)
	for i := 0; i < n; i++ {
		sx[i] = getNextInt(scanner)
		sy[i] = getNextInt(scanner)
		tx[i] = getNextInt(scanner)
		ty[i] = getNextInt(scanner)
		xx = append(xx, sx[i])
		xx = append(xx, tx[i])
		yy = append(yy, sy[i])
		yy = append(yy, ty[i])
	}
	xm, rxm := compress(xx)
	ym, rym := compress(yy)
	imos := makeGrid(len(ym), len(xm))
	for i := 0; i < n; i++ {
		imos[ym[sy[i]]][xm[sx[i]]]++
		imos[ym[ty[i]]][xm[sx[i]]]--
		imos[ym[sy[i]]][xm[tx[i]]]--
		imos[ym[ty[i]]][xm[tx[i]]]++
	}
	for y := 0; y < len(ym); y++ {
		for x := 0; x < len(xm)-1; x++ {
			imos[y][x+1] += imos[y][x]
		}
	}
	for x := 0; x < len(xm); x++ {
		for y := 0; y < len(ym)-1; y++ {
			imos[y+1][x] += imos[y][x]
		}
	}
	var ans int64
	for y := 0; y < len(ym)-1; y++ {
		for x := 0; x < len(xm)-1; x++ {
			if imos[y][x] == 0 {
				continue
			}
			ans += int64(rym[y+1]-rym[y]) * int64(rxm[x+1]-rxm[x])
		}
	}
	fmt.Fprintln(writer, ans)

}
func makeGrid(h, w int) [][]int {
	index := make([][]int, h, h)
	data := make([]int, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}
func compress(xx []int) (map[int]int, []int) {
	m := map[int]int{}

	for _, x := range xx {
		m[x] = 1
	}
	yy := make([]int, 0)
	for x := range m {
		yy = append(yy, x)
	}
	sort.Ints(yy)
	for i := 0; i < len(yy); i++ {
		m[yy[i]] = i
	}
	return m, yy
}



Measured memory_bytes: 132812
#include<iostream>

int main(){
  while(true){
    std::string str;
    std::cin >> str;

    if(str == "0") break;

    int s = 0;
    for(int i = 0; i < str.size(); i++){
      s += str[i] - '0';
    }

    std::cout << s << std::endl;
  }
  
  return 0;
}



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

int main() {
  int k,s,ans = 0;
  cin >> k >> s;
  for(int x = 0;x <= k;x++){
    for(int y = 0;y <= k;y++){
      int z = s-x-y;
      if(z >= 0 && z <= k){
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	int rock=0, paper =0, ans =0;
	for(auto it:s)
	{
		if(it=='g')
		{
			if(rock>paper)
			{
				ans++;
				paper++;
			}
			else
				rock++;
		}
		else
		{
			if(rock>paper)
				paper++;
			else
			{
				rock++;
				ans--;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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



Measured memory_bytes: 3116
#include<stdio.h>
int main(){
  int a,b=0,c=0;
  scanf("%d",&a);
  for(int i=0; i<a; i++){
    int d;
    scanf("%d",&d);
    if(b<d){
      c+=b;b=d;
    }
    else{
      c+=d;
    }
  }
  printf(c>b?"Yes":"No");
  return 0;}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int N, k[10000], i, j=0,p=0;
	for (;;)
	{
		scanf("%d", &N);
		if (N == 0)
			break;
		for (i = 0; i < N; i++)
		{
			scanf("%d", &k[i]);
			if (k[i] == 0)
				j++;
			if (k[i] <= 1)
				p++;
		}
		if (N == p)
			printf("NA\n");
		else
			printf("%d\n", N + 1 - j);
		j = 0;
		p = 0;
	}
	return 0;
}

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

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

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

    ll s = 0;
    priority_queue<int> pq;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        s += a;
        pq.push(a);
    }

    for (int j = 0; j < m; j++) {
        int a = pq.top(); pq.pop();
        pq.push(a / 2);
        s += a / 2 - a;
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 892
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && a!=c) || (a==c && a!=b) || (b==c && a!=b))
     cout<<"Yes"<<endl;
  else
     cout<<"No"<<endl;
  return 0;
}

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

using namespace std;

struct BIT
{
  vector< int > data;

  BIT(int sz) : data(++sz, 0) {}

  void set(int k, int x)
  {
    for(++k; k < data.size(); k += k & -k) data[k] = max(data[k], x);
  }

  int query(int k)
  {
    int ret = 0;
    for(++k; k > 0; k -= k & -k) ret = max(ret, data[k]);
    return (ret);
  }
};

int main()
{
  int N, A[100000], B[100000];
  vector< int > nums;

  cin >> N;
  for(int i = 0; i < N; i++) {
    scanf("%d %d", &A[i], &B[i]);
    nums.push_back(A[i]);
    nums.push_back(B[i]);
  }

  sort(begin(nums), end(nums));
  nums.erase(unique(begin(nums), end(nums)), end(nums));

  vector< vector< int > > add1(nums.size()), add2(nums.size());
  for(int i = 0; i < N; i++) {
    A[i] = lower_bound(begin(nums), end(nums), A[i]) - begin(nums);
    B[i] = lower_bound(begin(nums), end(nums), B[i]) - begin(nums);
    add1[A[i]].push_back(B[i]);
    add2[B[i]].push_back(A[i]);
  }

  BIT latte(nums.size()), malta(nums.size());
  for(int i = 0; i < nums.size(); i++) {
    vector< pair< int, int > > beet, uku;
    for(auto &s : add1[i]) beet.emplace_back(s, malta.query(s - 1) + 1);
    for(auto &s : add2[i]) uku.emplace_back(s, latte.query(s - 1) + 1);
    for(auto &s : beet) latte.set(s.first, s.second);
    for(auto &s : uku) malta.set(s.first, s.second);
  }

  printf("%d\n", max(latte.query(nums.size() - 1), malta.query(nums.size() - 1)));
}

Measured memory_bytes: 21648
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int re[555][555];

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,m,a,b;
  cin>>n>>m>>a>>b;
  int t=((int)1e9-1)/max(1,a*b-1);
  rep(i,n)rep(j,m)
    if(i%a==a-1 && j%b==b-1) re[i][j]=-t*max(1,a*b-1)-1;
    else re[i][j]=t;
  if(accumulate(re[0],re[555],0ll)>0){
    cout<<"Yes"<<endl;
    rep(i,n){rep(j,m) cout<<re[i][j]<<" ";cout<<endl;}
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    for(int i=1;i<=3500;i++){
        for(int j=1;j<=3500;j++){
            if(4*i*j-n*i-n*j <= 0){
                continue;
            }
            double res = (double)n*i*j/(4*i*j-n*i-n*j);
            if(res <= 3500 && abs(res-round(res)) < EPS){
                cout << i << " " << j << " " << round(res) << endl;
                return 0;
            }
        }
    }
    return 0;
}


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

const int INF = 1e9;

int n,k,s;

int main(){
	scanf("%d%d%d",&n,&k,&s);
	if(k==0){
		for(int i=1;i<=n;i++){
			if(i>1) printf(" ");
			if(s != INF){
				printf("%d",INF);
			} else {
				printf("1");
			}
		}
		printf("\n");
		return 0;
	}
	printf("%d",s);
	for(int i=2;i<=k;i++){
		printf(" %d",s);
	}
	for(int i=k+1;i<=n;i++){
		if(s==INF){
			printf(" 1");
		} else {
			printf(" %d",s+1);
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 1280
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int ans = INF;
vector<int> l;
int A,B,C;
int N;
void rec(int a,int b,int c,int n,int cnt_a,int cnt_b,int cnt_c){
	if(n == N){
		if(a > 0 && b > 0 && c > 0)ans = min(ans,10 * (cnt_a+cnt_b+cnt_c-3) + abs(A-a)+abs(B-b)+abs(C-c));
		return;
	}
	rec(a+l[n],b,c,n+1,cnt_a+1,cnt_b,cnt_c);
	rec(a,b+l[n],c,n+1,cnt_a,cnt_b+1,cnt_c);
	rec(a,b,c+l[n],n+1,cnt_a,cnt_b,cnt_c+1);
	rec(a,b,c,n+1,cnt_a,cnt_b,cnt_c);//どれにも合成しない場合.
}
int main(){
	cin >> N >> A >> B >> C;
	l.resize(N);
	for(int i = 0;i < N;i++)cin >> l[i];
	rec(0,0,0,0,0,0,0);

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int W,H,x,y,r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  if(r <= x && x <= W-r && r <= y && y <= H-r ){
    printf("Yes\n");}
  else printf("No\n");
  return 0;

}

Measured memory_bytes: 584
s=input()
n=len(s)
ans=0
a=0
if n%2==1:
    a=n/2
else:
    a=n/2
# print(a)
n-=1
for i in range(int(a)):
    # print(s[i] , s[n-i])
    if s[i] != s[n-i]:
        ans+=1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

int main(){
  int n,k; cin >> n >> k;
  string s; cin >> s;
  if(s[k-1] == 'A') s[k-1] = 'a';
  if(s[k-1] == 'B') s[k-1] = 'b';
  if(s[k-1] == 'C') s[k-1] = 'c';
  cout << s << endl;
  return 0;
}


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

using namespace std;

long long func(long long b, long long n) {
  if (b > n) return n;

  return func(b, n / b) + (n % b);
}

int main() {
  long long n;
  long long s;

  cin >> n;
  cin >> s;

  if (n == s) {
    cout << n + 1 << endl;
    return 0;
  }

  bool found = false;
  double root_n = sqrt(n);
  long long b;
  for (b = 2; b <= root_n; b++) {
    if (s == func(b, n)) {
      found = true;
      break;
    }
  }

  if (found) {
    cout << b << endl;
    return 0;
  }

  for (long long p = root_n; p >= 1; p--) {
    b = (n - s) / p + 1;
    if (b >= 2 && s == func(b, n)) {
      found = true;
      break;
    }
  }

  if (found) {
    cout << b << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int a[200005];
int b[200005];
int nxt[200005];
vector<int> G[200005];

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&a[i],&b[i]);
		a[i]--;
		b[i]--;
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}
	memset(nxt,-1,sizeof(nxt));
	nxt[0]=0;
	queue<int> que;
	que.push(0);
	while(que.size()){
		int v=que.front();
		que.pop();
		for(int i=0;i<G[v].size();i++){
			int nv=G[v][i];
			if(nxt[nv]==-1){
				nxt[nv]=v;
				que.push(nv);
			}
		}
	}
	for(int i=1;i<n;i++){
		if(nxt[i]==-1){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	for(int i=1;i<n;i++){
		printf("%d\n",nxt[i]+1);
	}
	return 0;
}


Measured memory_bytes: 14792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<P>> v(n);
    rep(i,n){
        int a;
        cin >> a;
        rep(j,a){
            int x,y;
            cin >> x >> y;
            v[i].push_back(P(x-1,y));
        }
    }
    int ans = 0;
    for(int i =0;i<(1<<n);i++){
        int cnt = 0;
        bool flag = true;
        for(int j = 0;j<n;j++){
            if(i&(1<<j)){
                cnt++;
                for(auto p:v[j]){
                    if((!p.second) && i&(1<<p.first)){
                        flag = false;
                    }
                    if (p.second && !(i & (1 << p.first))){
                        flag = false;
                    }
                }
            }
        }
        if(flag){
            ans = max(ans,cnt);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class C
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var a = read();
		int n = h[0], k = 1;

		for (; k < n && a[k - 1] + a[k] < h[1]; k++) ;
		if (k == n) { Console.WriteLine("Impossible"); return; }
		Console.WriteLine("Possible");
		Console.WriteLine(string.Join("\n", Enumerable.Range(1, k - 1).Concat(Enumerable.Range(k + 1, n - k - 1).Reverse()).Concat(new[] { k })));
	}
}


Measured memory_bytes: 34780
#include <stdio.h>
int main(void){
    int N,K;
    scanf("%d",&N);
    scanf("%d",&K);
    int num[N-1];
    int i;
    for(i=0; i<N; i++){
        scanf("%d", &num[i]);
        
    }
    
    printf("%d",(N-2)/(K-1)+1);
        
    return 0;
}


Measured memory_bytes: 512
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

ll dp[1000001],dpo[1000001];

const ll MAX=LONG_MAX/10;

ll pol(ll n){
	return n*(n+1)*(n+2)/6;
}

ll dfs(ll n,bool odd,int size){
	ll (&dpp)[1000001]=(odd?dpo:dp);
	if(dpp[n]!=MAX){
		return dpp[n];
	}
	if(n==0){
		return 0;
	}
	if(size>100){
		return MAX;
	}
	ll ret=MAX;
	for(ll j=1,i=pol(j);i<=n;j++,i=pol(j)){
		if(odd&&(!(i&1)))continue;
		ret=min(ret,dfs(n-i,odd,size+1)+1);
	}
	return dpp[n]=ret;
}

int main(){
	ll n;
	REP(i,1000001){
		dp[i]=MAX;
	}
	REP(i,1000001){
		dpo[i]=MAX;
	}
	REP(i,1000000){
		dp[i]=dfs(i,false,0);
		dpo[i]=dfs(i,true,0);
	}
	while(cin>>n,n){
		cout<<dfs(n,false,0);
		cout<<" "<<dfs(n,true,0)<<endl;
	}
	
}

Measured memory_bytes: 16780
#include <iostream>
#include <cstring>
#include <cstdio>

#define LL long long

using namespace std;

inline LL read() {
    LL x = 0, f = 1;
    char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while('0' <= c && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

LL a, b, n;

int main() {
    a = read(); b = read(); n = read();
    LL x = min(n, b - 1);
    LL sub1 = a * x / b, sub2 = (x / b) * a;
    cout << sub1 - sub2 << endl;
    return 0;
}

Measured memory_bytes: 3624
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll X;
    in >> X;
    ll ans = X/500* 1000;
    X -= X/500*500;
    ans += X/5*5;
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


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

using namespace std ;

int main(){

    string s ;
    cin >> s ;
    int sum = 0 ;
    for(int i=0;i < s.size();i++){
        sum += s[i] - '0' ;
    }
    if(sum % 9 == 0)
        cout << "Yes" << endl ;
    else
        cout << "No" << endl ;


    return 0 ;
    }


Measured memory_bytes: 3704
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstdio>
using namespace std;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dix = x2 - x1;
    int diy = y2 - y1;
    int x3 = x2 - diy;
    int y3 = y2 + dix;
    int x4 = x3 - dix;
    int y4 = y3 - diy;
    cout << x3 << " " << y3 << " " << x4 << " "  << y4 << endl;
}



Measured memory_bytes: 256
from collections import defaultdict,deque
v,n=map(int,input().split())
es=[[int(x)for x in input().split()]for _ in range(n)]
outs=defaultdict(list)
ins=defaultdict(int)
for v1,v2 in es:
    outs[v1].append(v2)
    ins[v2]+=1
q=deque(v1 for v1 in range(v+1)if ins[v1]==0)
res=[]
p=[0]*-~v
while q:
    v1=q.popleft()
    res.append(v1)
    for v2 in outs[v1]:
        ins[v2]-=1
        if ins[v2]==0:
            q.append(v2)
            p[v2]=v1
dp=[0]*-~v
for i in res[1:]:
  dp[i]=dp[p[i]]+1
print(max(dp)-1)

Measured memory_bytes: 104792
#include<bits/stdc++.h>
using namespace std;
const int inf=1e7+9;
int main()
{
    int num[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>num[i][j];
        }
    }
    int a1,a2,a3,b1,b2,b3;
    int x11,x12,x13,x21,x22,x23,x31,x32,x33;
    x11=num[0][0];
    x12=num[0][1];
    x13=num[0][2];
    x21=num[1][0];
    x22=num[1][1];
    x23=num[1][2];
    x31=num[2][0];
    x32=num[2][1];
    x33=num[2][2];
    int ans1,ans2,ans3;
    ans1=x11-x12;
    ans2=x21-x22;
    ans3=x31-x32;
    if(ans1!=ans2 || ans1!=ans3){
        cout<<"No"<<endl;
        return 0;
    }
    ans1=x11-x13;
    ans2=x21-x23;
    ans3=x31-x33;
    if(ans1!=ans2 || ans1!=ans3){
        cout<<"No"<<endl;
        return 0;
    }
    ans1=x12-x13;
    ans2=x22-x23;
    ans3=x32-x33;
        if(ans1!=ans2 || ans1!=ans3){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
}

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

int main() {
	int A, B;
	cin >> A >> B;

	int ans;
	if (A - B * 2 <= 0) ans = 0;
	else ans = A - B * 2;
	cout << ans << endl;
}


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

typedef long long ll;
const int N = 555;
int n, mod, f[N], g[N], dp[N][N];
vector<pair<int, int>> a;

int main() {
  scanf("%d%d", &n, &mod);
  for (int i = 0; i < n << 1; i++) {
    for (int j = 0; j < n << 1; j++) if (i * i + j * j < n * n) f[i] = j + 1;
    for (int j = 0; j < n << 1; j++) if (i * i + j * j <= (n << 1) * (n << 1)) g[i] = j + 1;
  }
  for (int i = 0; i < n; i++) {
    a.emplace_back(f[i], i);
  }
  for (int i = n; i < n << 1; i++) {
    a.emplace_back(g[i], i);
  }
  sort(a.begin(), a.end(), [&](pair<int, int> &a, pair<int, int> &b){return a.first == b.first ? a.second > b.second : a.first < b.first;});
  int ans = 0;
  for (int k = 0; k <= n; k++) {
    memset(dp, 0, sizeof dp);
    dp[0][0] = 1;
    for (int i = 0; i < n << 1; i++) {
      for (int j = 0; j <= i; j++) if (dp[i][j]) {
        dp[i + 1][j] = (dp[i + 1][j] + (ll) dp[i][j] * max(0, a[i].first - (i - j))) % mod;
        if (a[i].second < n) {
          dp[i + 1][j + 1] = (dp[i + 1][j + 1] + (ll) dp[i][j] * max(0, g[a[i].second] - (k + n + j))) % mod;
        }
      }
    }
    if (k & 1) {
      ans = (ans + mod - dp[n << 1][n - k]) % mod;
    } else {
      ans = (ans + dp[n << 1][n - k]) % mod;
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 1408
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class BPalindromePhilia {
public:
	void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        int slen = s.length();
        string t = s.substr(0, slen/2);

        int res = 0;
        rep(i, t.length()){
            if(t[i] != s[slen-1-i]) res++;
        }
        out << res << endl;
	}
};


int main() {
	BPalindromePhilia solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b && a != c || a == c && a != b || a != b && b == c)
    cout << "Yes" << endl;
  else cout << "No" << endl;
}
  

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

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint a, b, c;
    cin >> a >> b >> c;
    lint ans;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
        ans = 0;
    }
    else {
        lint cut_a, cut_b, cut_c;
        cut_a = b * c;
        cut_b = c * a;
        cut_c = a * b;
        ans = min(cut_a, min(cut_b, cut_c));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	string s;
	cin>>s;
	int count=0;
	for(int i=0;i<3;i++){

		if(s[i]=='R')
			count++;
	}
	if(count<=1 || count==3)
		cout<<count;
	else
	{
		if(s[0]=='R' && s[2]=='R')
			cout<<1<<endl;
		else
		{
			cout<<2<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3576
// ref: https://img.atcoder.jp/abc121/editorial.pdf
// ref: https://drken1215.hatenablog.com/entry/2019/03/09/224100

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

uint64 oddsolver(uint64 num){
    if( num / 2 % 2 == 0){ return 0ull;
    }        else        { return 1ull; }
}
uint64 solver(uint64 rhs){
    uint64 num = rhs+1;
    if(num%2==0){ return oddsolver(num  );
    }    else   { return oddsolver(num-1)^rhs; }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    uint64 A, B; cin >> A >> B;
    cout << ( solver(A-1) ^ solver(B) ) << endl;
    
    return 0;
}


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

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

	pair<pair<string, int>, int> restaurants[110];

	for (int i = 0; i != N; ++i)
	{
		string s;
		int p;
		cin >> s >> p;
		restaurants[i] = make_pair(make_pair(s, -p), i+1);
	}
	sort(restaurants, restaurants + N);
	
	for (int i = 0; i != N; ++i)
	{
		std::cout << restaurants[i].second << endl;
	}

}

Measured memory_bytes: 256
using System;

class D
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static void Main()
	{
		var h = Read();
		var m = h[1];
		var a = Array.ConvertAll(Read(), x => x / 2);

		long l = a[0];
		for (int i = 1; i < a.Length; i++)
			if ((l = Lcm(l, a[i])) > m) { Console.WriteLine(0); return; }

		Console.WriteLine(Array.Exists(a, x => l / x % 2 == 0) ? 0 : (m / l + 1) / 2);
	}

	static long Gcd(long x, long y) { for (long r; (r = x % y) > 0; x = y, y = r) ; return y; }
	static long Lcm(long x, long y) => x / Gcd(x, y) * y;
}


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

int main()
{
ll n ;
cin >> n ;
vector<ll> p(n);
rep(i, n){
  cin >> p[i];
}
vector<ll> v(n+2);
rep(i,n){
    v[p[i]+1]=v[p[i]]+1;
}
ans=n-*max_element(v.begin(),v.end());
cout << ans << endl;
return 0;
}


Measured memory_bytes: 3328
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]

from heapq import heapify, heappush, heappop
def dijkstra(path, N, start):
    visited = [False] * N
    que = [(0, start)]
    heapify(que)  # 始点aから各頂点への(距離, 頂点ID)
    dist = [-1] * N  # 始点aから各頂点への距離
    dist[start] = 0  # 始点aからaへの距離は0
    while que:
        d, v = heappop(que)  # 始点から最短距離の頂点を(確定ノード)を取り出す
        visited[v] = True  # 確定フラグを立てる
        # 接続先ノードの情報を更新する
        for d, to in path[v]:
            cost = dist[v] + d
            if dist[to] < 0 or cost < dist[to]:
                dist[to] = cost
                if not visited[to]:
                    heappush(que, (cost, to))
    return dist
N = z()
# 0 を頂点とする根付き木を考える
path = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = zz()
    path[u-1].append((w, v-1))
    path[v-1].append((w, u-1))
dist = dijkstra(path, N, 0)
# print(dist)
ans = [0] * N
for i, d in enumerate(dist):
    if (d % 2 == 0):
        ans[i] = 0 
    else:
        ans[i] = 1

print(*ans, sep='\n')
            


Measured memory_bytes: 67460