akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 2e3 + 10,mod = 1e9 + 7;

int fa[N],father[N],dep[N],vis[N],val[N];
int to[N << 1],nex[N << 1],beg[N],w[N << 1];
int e;

struct node {
	int x,y,z;
	bool operator < (const node &rhs) const {
		return z < rhs.z;
	}
}G[N];

inline ll read() {
	ll x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline int fpm(int a,int b) {
	int res = 1;
	while(b) {
		if(b & 1) res = 1ll * res * a % mod;
		a = 1ll * a * a % mod,b /= 2;
	}
	return res;
}

inline int find(int x) {
	return fa[x] == x ? x : fa[x] = find(fa[x]);
}

inline void add(int x,int y,int z) {
	to[++e] = y,nex[e] = beg[x],beg[x] = e,w[e] = z;
}

inline void dfs(int x,int f) {
	father[x] = f;
	for(int i = beg[x];i;i = nex[i]) {
		if(to[i] == f) continue;
		dep[to[i]] = dep[x] + 1;
		val[to[i]] = w[i];
		dfs(to[i],x);
	}
}

int main() {
	int n = read(),m = read();ll Lim = read();
	For(i,1,n) fa[i] = i;
	For(i,1,m) {
		int x = read(),y = read(),z = read();
		G[i] = (node){x,y,z};
	}
	sort(G + 1,G + m + 1);

	ll Sum = 0;
	For(i,1,m) {
		int x = find(G[i].x),y = find(G[i].y);
		if(x == y) continue;
		fa[x] = y,Sum += G[i].z,vis[i] = true;
		add(G[i].x,G[i].y,G[i].z),add(G[i].y,G[i].x,G[i].z);
	}

	dfs(1,0);

	if(Sum > Lim) return puts("0"),0;
	else {
		int cnta = 0,cntb = 0;
		For(i,1,m) {
			if(vis[i]) continue;
			int x = G[i].x,y = G[i].y,z = G[i].z,Max = 0;
			if(dep[x] < dep[y]) swap(x,y);
			while(dep[x] > dep[y]) chkmax(Max,val[x]),x = father[x];
			while(x ^ y) {
				chkmax(Max,val[x]),chkmax(Max,val[y]);
				x = father[x],y = father[y];
			}
			if(z - Max == Lim - Sum) cnta++;
			if(z - Max > Lim - Sum) cntb++;
		}
		if(Sum == Lim) {
			int ans = 1ll * (fpm(2,n - 1) - 2 + mod) * fpm(2,m - n + 1) % mod;
			ans = (ans + 2ll * (fpm(2,cnta) - 1) * fpm(2,cntb)) % mod;
			printf("%d\n",ans);
		}
		else printf("%lld\n",2ll * (fpm(2,cnta) - 1) * fpm(2,cntb) % mod);
	}
	return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <algorithm>
using namespace std;
using iL = long long;
using iUL = unsigned long long;
using dL = long double;
#define rep( NAME, NUM ) for( int NAME = 0; NAME < ( NUM ); ++NAME )
#define brep( NAME, NUM ) for( int NAME = ( NUM ) - 1; NAME >= 0; --NAME )
#define DEF_VEC_2( TYPE, A, B, NAME, INIT ) vector< vector< TYPE > > NAME( A, vector< TYPE >( B, ( INIT ) ) )

int main()
{
    //----------------
    iUL cMod = 1000000007L;
    int h, w, k;
    cin >> h >> w >> k;

    DEF_VEC_2( iUL, w, w, vecW2, 0 );
    rep( i, 1 << ( w - 1 ) )
    {
        bool b = false;
        rep( j, w - 2 )
        {
            if( ( i & ( 1 << j ) ) && ( i & ( 1 << ( j + 1 ) ) ) )
            {
                b = true; break;
            }
        }
        if( b ) continue;
        rep( j, w )
        {
            int x;
            if( j != 0 && ( i & ( 1 << ( j - 1 ) ) ) ) x = j - 1;
            else if( j != w - 1 && ( i & ( 1 << j ) ) ) x = j + 1;
            else x = j;
            ++vecW2[j][x];
        }
    }

    DEF_VEC_2( iUL, h + 1, w, vec2, 0 );
    vec2[0][0] = 1L;
    rep( i, h ) rep( j, w ) rep( j2, w )
    {
        vec2[i + 1][j] += vec2[i][j2] * vecW2[j2][j];
        vec2[i + 1][j] %= cMod;
    }
    cout << vec2[h][k-1] << endl;

    //----------------
    return 0;
}

Measured memory_bytes: 256
while True:
  a,op,b = raw_input().split()
  a,b = map(int,[a,b])

  if op == "?":
     break

  if op == "+":
     print (a+b)
  elif op == "-":
     print (a-b)
  elif op == "*":
     print (a*b)
  elif op == "/":
     print (a/b)

Measured memory_bytes: 6380
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

int v[(1<<18)+7];
int w[(1<<18)+7];
int dp[(1<<9)+13][111111];

void solve()
{
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> v[i] >> w[i];

  memset(dp,0,sizeof(dp));

  int C = 9;
  int L = 1e5;

  for (int i = 0; i <= min(n,(1<<C)-1); i++)
  {
    for (int j = 0; j <= L; j++)
    {
      if (i==0 || j== 0)
      {
        dp[i][j] = 0;
      }
      else
      {
        dp[i][j] = max(dp[i/2][j],dp[i][j]);
        if (j-w[i] >= 0)
          dp[i][j] = max(dp[i][j],dp[i/2][j-w[i]]+v[i]);
      }
    }
  }

  int q;
  cin >> q;
  while(q--)
  {
    int u, tot;
    cin >> u >> tot;
    vpii extras;
    while (u > (1<<C)-1)
    {
      extras.pb({v[u],w[u]});
      u >>= 1;
    }

    int ans = 0;
    for (int i = 0; i < (1<<extras.size()); i++)
    {
      int totw = 0, totv = 0;
      for (int j = 0; j < extras.size(); j++)
      {
        if (i&(1<<j))
        {
          totw += extras[j].s;
          totv += extras[j].f;
        }
      }
      if (totw <= tot)
      {
        ans = max(ans,totv+dp[u][tot-totw]);
      }
    }
    cout << ans << endl;
  }


}

int main()
{
  ios_base::sync_with_stdio(false);
  // Remove for interactive problems
  //cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  //cin >> t;
  while (t--)
  {
      solve();
  }
}



Measured memory_bytes: 233528
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >>n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++)
        cin >>arr[i];
    set<pair<int, int>> st;
    for(int i = 0; i < n; i++)
        st.insert({arr[i], i + 1});
    for(auto ele : st)
        cout <<ele.second <<" ";
    return 0;
}


Measured memory_bytes: 5888
#include<stdio.h>

int n,A[2000];

int solve(i,m){
  if(m==0){
    return 1;
  }

  if(i >= n){
    return 0;
  }
  if(solve(i+1,m)|| solve(i+1,m-A[i])){
    return 1;
  }
  else return 0;

}
  

int main () {
  int i,j,m,M,res[200];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&M);

  for(i=0;i<M;i++){
    scanf("%d",&m);
    res[i] = solve(0,m);
    }

  for(i=0;i<M;i++){
    if(res[i]){
      printf("yes\n");
    }
    else printf("no\n");
  }

  return 0;
}
  

  



Measured memory_bytes: 2108
S = input()
T = input()

time = []

S_list = list(S)
T_list = list(T)

Len = (len(S))
listt = list(range(Len))

for ss in listt:
      if S[ss] ==T[ss]:
            None
      else:
            time.append(ss)

print(len(time))






Measured memory_bytes: 22040
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    vector<int> a(s.size() + 1);
    rep(i, s.size()) {
        if(s[i] == '<') a[i + 1] = max(a[i + 1], a[i] + 1);
    }
    for(int i = s.size() - 1; i >= 0; i--) {
        if(s[i] == '>') a[i] = max(a[i], a[i + 1] + 1);
    }
    ll ans = 0;
    rep(i, s.size() + 1) {
        ans += (ll) a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5848
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 1000000001
using ll=long long;

int main(){
    int n,q;cin>>n>>q;
    string s;cin>>s;
    vector<int> t(n,0);
    for(int i=1;i<n;i++){
        t[i]=t[i-1]+((s[i-1]=='A'&&s[i]=='C')?1:0);
    }
    rep(i,q){
        int l,r;cin>>l>>r;
        cout<<t[r-1]-t[l-1]<<endl;
    }
}

Measured memory_bytes: 1472
package main

import (
	"fmt"
	"math"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	var sum int = 0
	W := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &W[i])
		sum += W[i]
	}

	var S1, S2 int
	var min int = 10000
	for T := 1; T < N; T++ {

		S1 += W[T-1]
		S2 = sum - S1

		if min >= int(math.Abs(float64(S1)-float64(S2))) {
			min = int(math.Abs(float64(S1) - float64(S2)))
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1844
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

#define pi 3.141592653589
#define repeat(i,n) for(int i=0;i<n;i++)

int main(){
	int m, f, r;
	char eva;
	while (1)
	{
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1){
			eva = 'F';
		}
		else if (m + f >= 80){
			eva = 'A';
		}
		else if (m + f >= 65){
			eva = 'B';
		}
		else if (m + f >= 50){
			eva = 'C';
		}
		else if (m + f >= 30){
			if (r >= 50) eva = 'C';
			else eva = 'D';
		}
		else {
			eva = 'F';
		}
		cout << eva << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
###############################################################################

from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


###############################################################################


counts_3 = {
  "CAA": 1,
  "CTT": 1,
  "TTT": 1,
  "GGC": 1,
  "CGT": 1,
  "GTG": 1,
  "ACC": 1,
  "GCA": 1,
  "TTC": 1,
  "TCA": 1,
  "GGT": 1,
  "GTT": 1,
  "CAG": 1,
  "AAT": 1,
  "TAA": 1,
  "TAG": 1,
  "CCA": 1,
  "GCT": 1,
  "CTA": 1,
  "TCT": 1,
  "TTG": 1,
  "ATT": 1,
  "CAT": 1,
  "GAA": 1,
  "ATA": 1,
  "CCC": 1,
  "GCG": 1,
  "TTA": 1,
  "ACA": 1,
  "AGT": 1,
  "AGG": 1,
  "AGA": 1,
  "CCG": 1,
  "ATG": 1,
  "GAG": 1,
  "AAA": 1,
  "TCC": 1,
  "AAG": 1,
  "GCC": 1,
  "ACT": 1,
  "TGG": 1,
  "CTC": 1,
  "TCG": 1,
  "TGT": 1,
  "CGC": 1,
  "TAC": 1,
  "TAT": 1,
  "CGG": 1,
  "GGG": 1,
  "TGA": 1,
  "CCT": 1,
  "AAC": 1,
  "CGA": 1,
  "GTC": 1,
  "ATC": 1,
  "GGA": 1,
  "CAC": 1,
  "CTG": 1,
  "GAT": 1,
  "TGC": 1,
  "GTA": 1
}


mod = 10**9 + 7


def main():
    n = intin()

    all_ok = []
    not_c = []
    not_g = []
    for suffix in counts_3:
        if suffix == 'ATG' or suffix == 'AGG' or suffix == 'AAG':
            not_c.append(suffix)
        elif suffix == 'AGT':
            not_c.append(suffix)
        elif 'T' in suffix[1:]:
            all_ok.append(suffix)
        elif suffix[1:] == 'AA' or suffix[1:] == 'GG' or suffix[1:] == 'CC':
            all_ok.append(suffix)
        elif suffix[1:] == 'AG' or suffix[1:] == 'GA':
            not_c.append(suffix)
        elif suffix[1:] == 'AC':
            not_g.append(suffix)
        else:
            all_ok.append(suffix)

    suffix_counts = {3: counts_3}

    for i in range(4, 101):
        prev_count = suffix_counts[i-1]
        suffix_count = {}
        for suffix, count in prev_count.items():
            if suffix in all_ok:
                charlist = ['A', 'C', 'G', 'T']
            if suffix in not_c:
                charlist = ['A', 'G', 'T']
            if suffix in not_g:
                charlist = ['A', 'C', 'T']
            for c in charlist:
                new_suffix = suffix[1:] + c
                suffix_count.setdefault(new_suffix, 0)
                suffix_count[new_suffix] = modadd(suffix_count[new_suffix], count)
        suffix_counts[i] = suffix_count

    suffix_count = suffix_counts[n]

    ans = 0
    for i, count in suffix_count.items():
        ans = modadd(ans, count)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3808
#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() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0, c - max(0, a - b)) << endl;
    return 0;
}


Measured memory_bytes: 256
function myout(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var A = input[0];
  var B = input[1];
  var C = input[2];
  for(var i = 1; i < 10000; i++){
    if(A * i % B == C){
       myout("YES");
      return;
    }
  }
  myout("NO");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, k; cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    ll ans = 0;
    sort(p.begin(), p.end());
    rep(i,k) ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;

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

			long x = sc.nextLong();
			
//			List<Double> compoundIntereset = new ArrayList<>();
			
			long p = 100;
			long i = 0;
			
			while(p < x) {
				
				p = (long)((double)p * 1.01);
				i++;
				
			}
			
			System.out.println(i);
				
		}
	}

}

Measured memory_bytes: 35796
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a%=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll r1,c1,r2,c2;
  cin >> r1 >> c1 >> r2 >> c2;
  //  r1++;c1++;r2++;c2++;
  
  vector<ll> fact(r2+c2+4);
  vector<ll> inv(r2+c2+4);
  fact[0] = 1;
  rep1(i,r2+c2+3) fact[i] = mu(fact[i-1],i);
  rep(i,r2+c2+4){
    inv[i] = dv(1,fact[i]);
  }

  ll ans = 0;

  ans = (mu(fact[r2+c2+2],mu(inv[r2+1],inv[c2+1])) +
	 mu(fact[r1+c1],mu(inv[r1],inv[c1])) -
	 mu(fact[r2+c1+1],mu(inv[r2+1],inv[c1])) -
	 mu(fact[r1+c2+1],mu(inv[r1],inv[c2+1]))); 
  ans = (ans+2*mod)%mod;
  cout << ans << endl;


  
  //  cout << endl << endl;
  //  cout << static_cast<double>(clock()) / CLOCKS_PER_SEC << "s"<<endl;
  return 0;
    

}


Measured memory_bytes: 31488
function main(input) {
  const input = input.trim().split("\n");
  const [H, W] = input[0].split(" ").map(n => Number(n));
  const [h, w] = input[1].split(" ").map(n => Number(n));
  const result = H*W - (H*w + h*W - h*w);
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int T[202];
double V[202];
double M[50000];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	int sum=0;
	FOR(i,50000) M[i]=2020;
	
	FOR(i,N) cin>>T[i];
	FOR(i,N) cin>>V[i];
	FOR(i,N){ 
		T[i]*=2;
		for(x=sum;x<=sum+T[i];x++) M[x]=min(M[x],V[i]);
		sum+=T[i];
	}
	M[0]=M[sum]=0;
	FOR(j,200) {
		FOR(i,sum) M[i+1]=min(M[i+1],M[i]+0.5);
		for(i=sum-1;i>=0;i--) M[i]=min(M[i],M[i+1]+0.5);
	}
	double R=0;
	FOR(i,sum) R+=M[i]+M[i+1];
	_P("%.12lf\n",R/4.0);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 640
k,n=input().split(" ")
k,n=int(k),int(n)

n_list=input().split(" ")

for i in range(len(n_list)):
  n_list[i]=int(n_list[i])
ans=n_list[len(n_list)-1]-n_list[0]
for i in range(1,len(n_list)):
  ans=min(ans, k-n_list[i]+n_list[i-1])
print(ans)

Measured memory_bytes: 18636
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>

using namespace std;

vector<string> &split(const string &s, char delim, vector<string> &elems) {
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
        elems.push_back(item);
    }
    return elems;
}


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    split(s, delim, elems);
    return elems;
}


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

    string str;
    getline(cin, str);

    vector<string> vec = split(str, ' ');
    vector<int> xs;

    for (int i = 0; i < vec.size(); i++) {
        xs.push_back(stoi(vec[i])); 
    }
    
    sort(xs.begin(), xs.end());


    long res;

    for (int i = 0; i < vec.size() / 2; i++) {
        res += xs[i * 2];
    }

    cout << res << endl;

    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  
  vector<int> x(5);
for (int i = 0; i < 5; i++) {
  cin >> x.at(i);
}
  int sw=0;
  for(int i=0;i<5;i++){
    if(x.at(i)==0){
      sw=i+1;
    }
  }
  
  cout<<sw<<endl;
}



Measured memory_bytes: 3592
package main

import (
	"fmt"
)

func main() {
	var wantID, nowID string
	fmt.Scan(&wantID)
	fmt.Scan(&nowID)

	if nowID[:len(wantID)] == wantID {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1748
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
using namespace std;
typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll n, a, b, c; cin >> n >> a >> b >> c;
    vl ls(n, 0); REP(i, n) cin >> ls[i];
    ll ret = LINF;
    FOR(i, 1, pow(4ll, 8)+1){
        vl cs(8, 0); ll tmp = i;
        cs[7] = ((tmp / 16384) % 4); tmp -= cs[7] * 16384;
        cs[6] = ((tmp / 4096) % 4); tmp -= cs[6] * 4096;
        cs[5] = ((tmp / 1024) % 4); tmp -= cs[5] * 1024;
        cs[4] = ((tmp / 256) % 4); tmp -= cs[4] * 256;
        cs[3] = ((tmp / 64) % 4); tmp -= cs[3] * 64;
        cs[2] = ((tmp / 16) % 4); tmp -= cs[2] * 16;
        cs[1] = ((tmp / 4) % 4); tmp -= cs[1] * 4;
        cs[0] = (tmp % 4);
    
        ll la = 0, lb = 0, lc = 0, cost = 0;
        REP(i, n){
            if(cs[i] == 0) continue;
            else if(cs[i] == 1){
                if(la > 0) cost += 10;
                la += ls[i];
            }
            else if (cs[i] == 2){
                if(lb > 0) cost += 10;
                lb += ls[i];
            }
            else if (cs[i] == 3){
                if(lc > 0) cost += 10;
                lc += ls[i];
            }
        }
        if(la == 0 || lb == 0 || lc == 0) continue;
        cost += abs(la - a);
        cost += abs(lb - b);
        cost += abs(lc - c);
        ret = min(ret, cost);
    }
    cout << ret << endstr;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	rest := n % (a + b)
	blue := (n / (a + b)) * a
	if rest <= a {
		blue += rest
	} else {
		blue += a
	}
	fmt.Println(blue)
}


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

bool prime(int n) {
  if(n <= 1) return false;
  for(int i = 2; i*i < n; i++) { 
    if(n%i == 0) return false;
  }
  return true;
}

int main() {
  long long a, b;
  cin >> a >> b;
  long long c = a;
  long long d = b;
  long long e = min(a, b);
  long long gcd = 1;
  for(int i = 2; i <= e; i++) {
    while(prime(i) && c%i == 0 && d%i == 0 && c>0 && d>0) {
      c /= i;
      d /= i;
      gcd *= i;
    }
  }
  cout << a * b / gcd << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define nl '\n'
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

using vi = vector<int>;
using vll = vector<ll>;
#define allOf(x) (x).begin(), (x).end()

template <typename P, typename Q>
ostream&operator<<(ostream&os, const pair<P, Q>&p)
{return os << '(' << p.first << ", " << p.second << ')';}
template <typename K, typename V>
ostream&operator<<(ostream&os, const map<K, V>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const set<T>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const vector<T>&v)
{os << '['; for(const auto&it:v) os << it << ", "; return os << ']';}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

const ll mod = 7+(ll)1e9;
ll exm(ll x, ll n) {
  ll y = 1;
  for(; n>0; n>>=1, x=(x*x)%mod) {
    if( n & 1 ) y = (y*x) % mod;
  }
  return y;
}

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

  ll n, m; cin >> n >> m;

  if( n == 1 ) {
    cout << 1 << nl;
    return 0;
  }

  ll m2 = m;
  vector< pair<int, int> > fct;

  for(ll d=2; d*d<=m; d++) {
    if( m % d == 0 ) {
      fct.emplace_back(d, 0);
      while( m % d == 0 ) {
	fct.back().ss++;
	m /= d;
      }
    }
  }
  if( m > 1 ) fct.emplace_back(m, 1);

  cerr << fct << endl;

  vll fx(n+n), ifx(fx.size());
  fx[0] = ifx[0] = 1;
  for(ll i=1; i<=fx.size(); i++) {
    fx[i] = (fx[i-1] * i)%mod;
    ifx[i] = exm(fx[i], mod-2);
  }

  ll ans = 1;
  for(auto&it:fct) {
    ll pr = it.ff, ex = it.ss;
    ll temp = fx[ex+n-1];
    temp = (temp * ifx[ex]) % mod;
    temp = (temp * ifx[n-1]) % mod;
    ans = (ans * temp)%mod;
  }
  cout << ans << nl;

  return 0;
}

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"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) {
	a := new(big.Int)
	b := new(big.Int)
	fmt.Sscan(getNextString(scanner), a)
	fmt.Sscan(getNextString(scanner), b)
	fmt.Fprintln(writer, a.Mul(a, b))
}



Measured memory_bytes: 7732
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define pld pair <ld, ld>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 1e6 + 100;
const ll inf = 1e16;

ll n, m, k, t;

vector <ll> V[maxn];

ll H[maxn];

ll S[maxn];

ll C[maxn];

ll D[maxn];

string s;

void dfs(ll v, ll p) {
    if (v != p) {
        H[v] = H[p] + 1;
    }
    D[v] = 0;
    S[v] = 0;
    C[v] = s[v] - '0';
    ll mx = 0;

    vector <ll> M, S1;
    for (auto v1 : V[v]) {
        if (v1 == p) {
            M.pb(0);
            S1.pb(0);
            continue;
        }
        dfs(v1, v);
        C[v] += C[v1];
        S[v] += S[v1];
        S[v] += C[v1];
        ll val = D[v1] + C[v1];
        mx = max(mx, val);
        M.pb(mx);
        S1.pb(S[v1] + C[v1]);
        // sum += S[v1] + C[v1];
    }
    D[v] = S[v] % 2;
    for (ll q = 0; q < V[v].size(); q++) {
        ll v1 = V[v][q];
        if (v1 == p) {
            continue;
        }
        D[v] = max(D[v], M[q] - S[v] + S1[q]);
    }
    // if (v == 1) {
    //     cout << mx << " " << S[v] << endl;
    // }
    // D[v] = max(S[v] % 2, 2 * mx - S[v]);
    // cout << v + 1 << " " << S[v] << " " << D[v] << endl;
}

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c, d;
    cin >> n;
    cin >> s;
    for (q = 0; q < n - 1; q++) {
        cin >> a >> b;
        a--; b--;
        V[a].pb(b);
        V[b].pb(a);
    }
    // dfs(1, 1);
    // return 0;
    ll ans = inf;
    for (q = 0; q < n; q++) {
        // for (w = 0; w < )
        H[q] = 0;
        dfs(q, q);
        // cout << S[q] << endl;
        if (D[q] != 0) {
            continue;
        }
        bool fail = 0;
        ll sum = 0;
        for (w = 0; w < n; w++) {
            if (s[w] - '0' == 1) {
                sum += H[w];
            }
        }
        if (sum % 2) {
            continue;
        }
        // cout << sum << " Sum " << endl;
        // cout << q + 1 << " Q " << endl;
        // for (w = 0; w < n; w++) {
        //     // cout << "S " << w + 1 <<  " " << S[w] << endl;
        //     if (w != q && S[w] > sum - H[w] * C[w] - S[w]) {
        //         fail = 1;
        //     }
        // }
        // cout << endl;
        if (fail || sum % 2) {
            continue;
        }
        ans = min(ans, sum / 2);
    }
    if (ans == inf) {
        cout << -1;
        return 0;
    }
    cout << ans;
    return 0;
}


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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

vector<pair<int,int> > AB;
int N;

int main(void) {
    cin>>N;
    
    for(int i = 0;i < N;i++) {
        int a,b;
        cin>>a>>b;
        AB.push_back(make_pair(b,a));
    }

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

    bool fail = false;
    int s = 0;
    for(int i = 0;i < N;i++) {
        s += AB[i].second;
        if(s > AB[i].first) {
            fail = true;
            break;
        }
    }

    if(fail) {
        cout<<"No"<<endl;
    } else {
        cout<<"Yes"<<endl;
    }

    return 0;
}





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

int main(){
    int A , B , K=0 ,c=0 ;
    cin >> A >> B ;
    for(int i=0 ; i<max(A,B) ; i++){
        if(abs(A-K)==abs(B-K)){
            c=1;
            break ;
        }
    K++ ;
    }
    if(c==0) cout << "IMPOSSIBLE" ;
    else cout << K ;


}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  ll x;
  cin >> x;

  while (true) {
    bool is_prime = true;
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        is_prime = false;
      }
    }
    if (is_prime) {
      cout << x << endl;
      return 0;
    }
    x++;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
    return 0;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	sub := [4]string{"dream", "dreamer", "erase", "eraser"}
	n := len(s)
	for i := n - 1; i > 0; {
		for j := 0; j < 4; j++ {
			if strings.HasSuffix(s, sub[j]) {
				k := len(sub[j])
				s = s[:(len(s) - k)]
				i -= k
				break
			} else if j == 3 {
				fmt.Println("NO")
				return
			}
		}
	}
	fmt.Println("YES")
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

struct mint {
    static constexpr long MOD = 1000000007;
    long value;

    constexpr mint(long value = 0) noexcept : value((value % MOD + MOD) % MOD) {}
    constexpr mint operator-() const noexcept {
        return mint(-value);
    }
    constexpr mint& operator+=(const mint& rhs) noexcept {
        if ((value += rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator-=(const mint& rhs) noexcept {
        if ((value += MOD - rhs.value) >= MOD) value -= MOD;
        return *this;
    }
    constexpr mint& operator*=(const mint& rhs) noexcept {
        (value *= rhs.value) %= MOD;
        return *this;
    }
    constexpr mint operator+(const mint& rhs) const noexcept {
        mint res(*this);
        return res += rhs;
    }
    constexpr mint operator-(const mint& rhs) const noexcept {
        mint res(*this);
        return res -= rhs;
    }
    constexpr mint operator*(const mint& rhs) const noexcept {
        mint res(*this);
        return res *= rhs;
    }
    constexpr mint pow(long e) const noexcept {
        if (e == 0) return 1;
        mint a = pow(e >> 1);
        a *= a;
        if (e % 2 == 1) a *= *this;
        return a;
    }
    constexpr mint inv() const noexcept {
        return pow(MOD - 2);
    }
    constexpr mint& operator/=(const mint& rhs) noexcept {
        return *this *= rhs.inv();
    }
    constexpr mint operator/(const mint& rhs) const noexcept {
        mint res(*this);
        return res /= rhs;
    }
    friend constexpr mint pow(const mint& a, const long& b) noexcept {
        return a.pow(b);
    }
    friend ostream& operator<<(ostream& os, const mint& n) noexcept {
        os << n.value;
        return os;
    }
};


int main() {
    int N, K;
    cin >> N >> K;
    mint n = N;
    mint k = K;
    cout << (n + 1) * ((n + 2) * n + 6)/ 6 - ((n + 1) * k * (k - 1) / 2 - k * (k - 1) * (k * 2 - 1) / 6 + k - 1) << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define EPS (1e-7)
#define INF 1000000009
#define PI (acos(-1))

int main(){
    string s;
    cin >> s;
    if (s=="AAA" || s=="BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

int main() {

  while(1) {
    bool end = false;

    int n;
    cin >> n;
    if(n == 0) return 0;
    int w[n];
    for(int i = 0; i < n; i++) {
      string s;
      cin >> s;
      w[i] = s.size();
    }

    // for(int i = 0; i < n; i++) cout << w[i] << " ";
    // cout << endl;
    int tanku[5] = {5, 7, 5, 7, 7};
    for(int i = 0; i < n; i++) {
      if(end) break;
      int k = 0;
      for(int j = 0; j < 5; j++) {
        if(end) break;
        int sum = 0;
        while(sum < tanku[j]) {
          sum += w[i+k];
          k++;
        }
        // cout << sum << " :" << j << " ";
        if(sum != tanku[j]) break;
        if(j == 4) {
          cout << i+1 << endl;
          end = true;
        }
      }
    }
  }
}



Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int n;
int res[510][510];
void dfs(int m, int c, int z) {
  if(m == 1) return ;
  int a = m/2;
  int b = m - a;
  rep(i, a) {
    rep(j, b) {
      res[i + z][a + j + z] = c;
    }
  }
  dfs(a, c + 1, z);
  dfs(b, c + 1, z + a);
}
int main()
{
  cin >> n;
  dfs(n, 1, 0);
  rep(i, n-1) {
    rep(j, n){
      if(i >= j) continue;
      cout << res[i][j] << " ";
    }
    cout  << "\n";
  }

  
  return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    string s[n];
    int p[n];
    vector<pair<string,int>> q(n);
    vector<pair<string,int>> r(n);
    for(int i=0;i<n;i++){
        cin >> s[i] >> p[i];
        q[i]=make_pair(s[i],p[i]);
        r[i]=make_pair(s[i],p[i]);
    }
    sort(q.begin(),q.end());
  
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      
    if(q[i].first == q[j].first && q[i].second<q[j].second) 
   
 swap(q[i],q[j]);
  }
  }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        if(r[j]==q[i])
        cout << j+1 <<endl;
        }
    }
}

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

using namespace std;

const int N = 1e5 + 5;
const int64_t LINF = 1e18;

int n, k, h[N];
int64_t dp[N];

int main()
{
//    freopen("input.inp", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i)
        cin >> h[i];
    dp[1] = 0;
    for (int i = 2; i <= n; ++i)
        dp[i] = LINF;
    for (int i = 1; i <= n; ++i)
        for (int j = i + 1; j <= min(i + k, n); ++j)
            dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]));
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
  int d[10],n,m,a[10][10],i,j,b,c,ans=0,k=0;
  scanf("%d %d\n",&n,&m);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }
  for(i=0;i<m;i++){
    scanf("%d %d\n",&b,&c);
    a[b][c]=1,a[c][b]=1;
  }
  for(i=0;i<n;i++){
    d[i]=1+i;
  }
  do{
    if(d[0]==1){
    for(i=0;i<n-1;i++){
      if(a[d[i]][d[i+1]]==0){
        k=1;
        break;
      }
    }
    if(k==0){
      ans++;
    }
    k=0;
    }
  }while(next_permutation(d,d+n));
  printf("%d\n",ans);
  return 0;
}

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

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

  vector<string> s(n);
  REP(i, n){
    cin >> s[i];
  }
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  int ans = s.size();
  cout << ans << endl;
}

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

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


void solve(std::string S){
    ll a=0;
    rep(i,S.length()/2){
        (S[i]==S[S.length()-i-1])?1:a++;
    }
    cout<<a<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

int dp[1010][1010];

int main(void) {
  for (int i = 0; i < 1010; i++)
    for (int j = 0; j < 1010; j++)
      dp[i][j] = 1e9;

  string s1, s2;
  cin >> s1 >> s2;

  int n = s1.size();
  int m = s2.size();

  for (int i = 0; i <= n; i++) dp[i][0] = i;
  for (int i = 0; i <= m; i++) dp[0][i] = i;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1]) );
      dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
      dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
    }
  }
  
  int ans = 1e9;
  for (int i = 0; i <= m; i++) ans = min(ans, dp[n][i] + abs(m - i) );
  cout << dp[n][m] << endl;
  
  return 0;
}



Measured memory_bytes: 7196
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  vecint x(n);
  for(auto&& e:x)cin>>e;
  int l;
  cin>>l;
  vector<vecint> dp(18, vecint(n));
  vector<vecint> dp2(18, vecint(n));
  int j = 0, k = 0;
  REP(i,n) {
    while (j < n && x[j] - x[i] <= l) ++j;
    while (x[i] - x[k] > l) ++k;
    dp[0][i] = j-1;
    dp2[0][i] = k;
  }
  REP(i,17)REP(j,n) {
    dp[i+1][j] = dp[i][dp[i][j]];
    dp2[i+1][j] = dp2[i][dp2[i][j]];
  }
  int q;
  cin>>q;
  REP(cnt,q) {
    int a,b;
    cin>>a>>b;
    --a;--b;
    int sum = 0;
    if (a < b) {
      for (int j=17; j>=0; --j) {
        if (dp[j][a] < b) {
          sum += 1 << j;
          a = dp[j][a];
        }
      }
      if (a < b) ++sum;
    } else {
      for (int j=17; j>=0; --j) {
        if (dp2[j][a] > b) {
          sum += 1 << j;
          a = dp2[j][a];
        }
      }
      if (a > b) ++sum;
    }
    cout<<sum<<"\n";
  }
  return 0;
}


Measured memory_bytes: 15736
/** Which of the favors of your Lord will you deny ? **/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define MP make_pair
#define F first
#define S second

#define ALL(x) (x).begin(), (x).end()
#define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl
#define READ        freopen("alu.txt", "r", stdin)
#define WRITE       freopen("vorta.txt", "w", stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class TIn>using indexed_set = tree<TIn, null_type, less<TIn>,rb_tree_tag, tree_order_statistics_node_update>;

/**

PBDS
-------------------------------------------------
1) insert(value)
2) erase(value)
3) order_of_key(value) // 0 based indexing
4) *find_by_order(position) // 0 based indexing

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 3e3+7;
const LL LINF = 1e17;

template <class T>
string to_str(T x)
{
    stringstream ss;
    ss<<x;
    return ss.str();
}

//bool cmp(const PII &A,const PII &B)
//{
//
//}

string s1,s2;

int dp[nmax][nmax];

int solve(int i,int j)
{
    if(i<0 || j<0)
        return 0;

    int &ret = dp[i][j];
    if(ret!=-1) return ret;

    if(s1[i]==s2[j])
        ret = 1 + solve(i-1,j-1);
    else
        ret = max(solve(i,j-1) , solve(i-1,j));

    return ret;
}

string solve_string(int i,int j)
{
    if(i<0 || j<0)
        return "";

    if(s1[i]==s2[j])
        return solve_string(i-1,j-1) + s1[i];

    if(solve(i,j-1)>solve(i-1,j))
        return solve_string(i,j-1);
    else
        return solve_string(i-1,j);

}


int main()
{
    optimizeIO();

    cin>>s1>>s2;

    memset(dp,-1,sizeof dp);

    solve(s1.size()-1,s2.size()-1);
    cout<<solve_string(s1.size()-1,s2.size()-1)<<endl;

    return 0;
}

/**

**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Measured memory_bytes: 36096
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

map<vector<int>, int> mymap;

void insert(vector<int> &v)
{
	for (int i = 0; i < 4; i++)
	{
		rotate(v.begin(), v.begin() + 1, v.end());
		mymap[v]++;
	}
}

void remove(vector<int> &v)
{
	for (int i = 0; i < 4; i++)
	{
		rotate(v.begin(), v.begin() + 1, v.end());
		mymap[v]--;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> c[n];
	for (int i = 0; i < n; i++)
	{
		c[i].resize(4);
		for (int j = 0; j < 4; j++)
		{
			cin >> c[i][j];
		}
		insert(c[i]);
	}
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		vector<int> top = c[i];
		remove(top);
		for (int j = i + 1; j < n; j++)
		{
			vector<int> rev_bot = c[j], bot = c[j];
			reverse(bot.begin(), bot.end());
			remove(rev_bot);
			for (int dir = 0; dir < 4; dir++)
			{
				vector<int> req[4];
				for (int num = 0; num < 4; num++)
				{
					req[num].pb(top[num]);
					req[num].pb(top[(num + 1) % 4]);
					req[num].pb(bot[(num + 1) % 4]);
					req[num].pb(bot[num]);
					reverse(req[num].begin(), req[num].end());
				}
				ll temp_ans = 1;
				vector<bool> was_removed(4);
				for (int num = 0; num < 4; num++)
				{
					temp_ans *= mymap[req[num]];
					if (mymap[req[num]] > 0)
					{
						remove(req[num]);
						was_removed[num] = 1;
					}
				}
				for (int num = 0; num < 4; num++)
				{
					if (was_removed[num])
					{
						insert(req[num]);
					}
				}
				ans += temp_ans;
				rotate(bot.begin(), bot.begin() + 1, bot.end());
			}
			insert(rev_bot);
		}
		insert(top);
	}
	cout << ans / 3 << endl;
	return 0;
}

Measured memory_bytes: 143348
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
	int x,y;
	cin >> x >> y;
	cout << (x+y+1)/2 << endl;
	return 0;
}

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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

string a[51];
string b[51];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i = 0; i < n; i++)
	{
		cin>>a[i];
	}
	for(int i = 0; i < m; i++)
	{
		cin>>b[i];
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			bool pos = 1;
			if(i+m>n||j+m>n) continue;
			for(int k=i;k<i+m;k++)
			{
				for(int l=j;l<j+m;l++)
				{
					if(b[k-i][l-j]!=a[k][l])
					{
						pos=0;
						break;
					}
				}
				if(!pos) break;
			}
			if(pos)
			{
				cout<<"Yes\n";
				return 0;
			}
		}
	}
	cout<<"No\n";
}


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

using namespace std;

int solve(vector<int> &A,int p,int r){
  int x = A[r];
  int i = p - 1;

  for(int j = p ; j < r ; j++){
    if(A[j] <= x){
      i++;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);

  return i + 1;
}

int main(){
  int n;

  cin >> n;
  vector<int> v(n);
  for(int i = 0 ; i < n ; i++){
    cin >> v[i];
  }

  int pos = solve(v,0,n-1);
  vector<string> ans(n);

  for(int i = 0 ; i < n ; i++){
    stringstream ss;
    string str;

    ss << v[i];
    ss >> str;

    if(i == pos){
      ans[i] = "[" + str + "]";
    }else{
      ans[i] = str;
    }
  }

  for(int i = 0 ; i < n ; i++){
    if(i != n-1){
      cout << ans[i] << " ";
    }else{
      cout << ans[i] << endl;
    }
  }  

  return 0;
}

Measured memory_bytes: 7080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>x(n);
  int i;
  for(i=0;i<n;i++){
    cin >> x[i];
  }
  int ans = 1<<30;
  for(int p=1;p<=100;p++){
    int tmp = 0;
    for(i=0;i<n;i++){
      tmp += (x[i]-p)*(x[i]-p);
    }
    if(tmp<ans)ans=tmp;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256