akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
struct dish
{
	int a,b,c;
}s[1000005];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i].a;//吃的第i道菜的品种 
	}
	for(int j=1;j<=n;j++)
	{
		cin>>s[j].b;//第j品种菜的满意度 
	}
	for(int k=1;k<=n-1;k++)
	{
		cin>>s[k].c;//如果连续吃两道菜，前一种的加成 
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		sum+=s[s[i].a].b;
		if(s[i+1].a==s[i].a+1) sum+=s[s[i].a].c;
	}
	cout<<sum;
	return 0;
}

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

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

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

const double eps = 1e-10;

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

constexpr int64 mod = 1e9+7;

int64 fact[1123456] = {}, inv[1123456] = {};

int64 mpow(int64 a, int64 b){
	if(b == 0) return 1;
	if(b%2) return a*mpow(a, b-1)%mod;
	int64 ret = mpow(a, b/2);
	return ret*ret%mod;
}

int64 comb(int64 a, int64 b){
	if(a < b) return 0;
	return fact[a]*inv[b]%mod*inv[a-b]%mod;
}

void init(){
	fact[0] = 1;
	REP(i, 1123455) fact[i+1] = fact[i]*(i+1)%mod;
	inv[1123455] = mpow(fact[1123455], mod-2);
	for(int32 i = 1123454;i >= 0;i--) inv[i] = inv[i+1]*(i+1)%mod;
}

int main(void){
	int64 N;
	cin >> N;
	int64 bef = 0;
	int64 res = 0;
	init();
	REP(k, N){
		int64 now = fact[k]*fact[N-1-k]%mod*comb(k-1, N-1-k)%mod;
		res = (res+(now-bef+mod)%mod*k%mod)%mod;
		bef = now;
	}
	cout << res << endl;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    vector<string> ss = {"SUN", "MON", "TUE", "WED", "THU", 
                   "FRI", "SAT"};
    
    int i = 0;
    while (ss[i] != s) i++;
    
    cout << 7 - i;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;
ll ans=0;

ll s_to_i(string s){
    int n=s.length();
    ll res=0;
    for(int i=n-1;i>=0;i--){
        ll now=s[n-1-i]-'0';
        res+=now*pow(10,i);
    }
    return res;
}

bool che753(string s){
    bool sev=false, fiv=false, thr=false;
    for(char c:s){
        if(c=='3') thr=true;
        if(c=='5') fiv=true;
        if(c=='7') sev=true;
    }
    if(sev && fiv && thr) return true;
    return false;
}
void dfs(string s,ll n){
    if(s_to_i(s)>n){
        //cout<<s<<" ="<<s_to_i(s)<<endl;
        return;
    }
    if(s.length()>0 && che753(s)){
        //cout<<s<<endl;
        ans++;
    }
    string s7=s+"7";
    string s5=s+"5";
    string s3=s+"3";
    dfs(s7,n);
    dfs(s5,n);
    dfs(s3,n);
    return;
}

int main(){
    ll n;
    cin>>n;
    string s="";
    dfs(s,n);
    cout<<ans<<endl;
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<bool>> K(M, vector<bool>(N, 0));
    rep(i, M) {
        int k;
        cin >> k;
        rep(j, k) {
            int s;
            cin >> s;
            K[i][s - 1] = true;
        }
    }

    vector<int> p(M);
    rep(i, M) cin >> p[i];

    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {
        vector<int> res(M, 0);
        rep(i, N) {
            if (!((bit >> i) & 1)) continue; 
            rep(j, M) {
                if (K[j][i]) res[j]++;
            }
        }
        bool flag = true;
        rep(i, M) {
            if (res[i] % 2 != p[i]) flag = false; 
        }
        if (flag) ans++;
    }

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

Measured memory_bytes: 256
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]

now = [0, 0]
for p in txy:
    d = abs(p[1] - now[0]) + abs(p[2] - now[1])
    if p[0] % 2 == d % 2 and p[0] >= d:
        continue
    else:
        print("No")
        exit()

print("Yes")


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int k,s;
    cin>>k>>s;

    LL result = 0;

    REP(i,k+1){
        REP(j,k+1){
            if(i+j <= s && s-i-j <= k){
                result ++;
            }
        }
    }
    cout << result<<endl;



	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

using namespace std;

#define REP(i, N) for (int (i) = 0; (i) < (N); ++(i))
#define READALL(c) for (auto &e : c) { cin >> e; }
#define PRINTALL(c) for (const auto &e : c) { cout << e << "\t"; } cout << "\n";

template <typename T>
using V = vector<T>;

typedef long double ld;

void print(V<int> ans) {
	for (int a : ans) {
		cout << (!a ? 'A' : 'B');
	}
	cout << endl;
}

int cell(const V<int> &S, int loc, int steps) {
	int N = S.size();
	int j = loc+steps;
	int ans;
	if (j < N) {
		ans = S[j];
	} else {
		ans = !((j-N)%2);
	}
	if (steps%2) {
		ans = !ans;
	}
	return ans;
}

V<int> solve(int N, int K, V<int> S) {
	V<int> ans = S;
	int cnt = 0;
	bool flipped = 0;
	int steps_left = 0;
	REP(i, K) {
		if (!cell(S, 0, cnt) && !flipped) {
			flipped = 1;
		} else {
			flipped = 0;
			++cnt;
		}
		if (cnt == N) {
			steps_left = K-i-1;
			break;
		}
	}

	if (steps_left) {
		REP(i, N) {
			ans[i] = (i+1)%2;
		}
		if (N%2) {
			REP(i, N) {
				ans[i] = !ans[i];
			}
			if (steps_left%2)
				ans[0] = !ans[0];
			if (flipped)
				ans[0] = !ans[0];
		}
		return ans;
	}

	if (flipped)
		ans[0] = 1;
	else
		ans[0] = cell(S, 0, cnt);

	for (int i = 1; i < N; ++i) {
		ans[i] = cell(S, i, cnt);
	}
	return ans;
}

V<int> simulate(int N, int K, V<int> S) {
	for (int k = 0; k < K; ++k) {
		int curr = 0, last = -1;
		while (curr < N && curr >= 0) {
			int tmp = last;
			last = curr;
			if (S[curr] == 0) {
				S[curr] = 1;
				curr = tmp;
			} else {
				S[curr] = 0;
				++curr;
			}
		}
	}
	return S;
}

void test() {
	default_random_engine re;
	for (int tc = 0; tc < 100000; ++tc) {
		int N = re()%10+1;
		int K = re()%50+1;
		V<int> A(N);
		for (int& e : A) {
			e = re()%2;
		}
		cout << N << " " << K << endl;
		print(A);
		print(simulate(N, K, A));
		print(solve(N, K, A));
		assert(simulate(N, K, A) == solve(N, K, A));
	}
}

main() {
	// test();
	// return 0;
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	V<int> A(N);
	REP(i, N) {
		A[i] = (S[i] == 'B');
	}
	// print(simulate(N, K, A));
	// cout << endl;
	print(solve(N, K, A));
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N,K; cin>>N; cin>>K;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  int ANS = INF;
  for (int i = 0; i < N - K + 1; i++)
  {
    int L = min(vec[i],0LL);
    int R = max(vec[K - 1 + i],0LL);
    L = abs(L); R = abs(R);
    chmin(ANS,min(L*2 + R , 2*R + L));
  }
  // if(ANS == INF)ANS = 0;
  cout<<ANS<<endl;
  

}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


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

using namespace std;

int d[100005];

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}
	sort(d, d + n);
	cout << d[n / 2] - d[n / 2 - 1] << '\n';
	return 0;
}

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

int main() {
  int x,a,b;
  cin >> x>>a>> b;
  if(b<=a)cout << "delicious" << endl;
  else if(b <= a+x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  
  
}

Measured memory_bytes: 3608
#include<cstdio>
#include<string>
#include<cstring>

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

using namespace std;

typedef long long ll;

ll f(ll n){
	ll T=1;
	int m=0;
	while(T<=n) T*=10, m++;

	ll res=0;
	while(m>0){
		ll a=n-T/10+1;
		ll a3=n/3-(T/10-1)/3;
		ll a5=n/5-(T/10-1)/5;
		ll a15=n/15-(T/10-1)/15;
		res+=(a-a3-a5+a15)*m;
		res+=(a3+a5)*4;

		T/=10;
		n=T-1;
		m--;
	}
	return res;
}

int main(){
	ll s; scanf("%lld",&s);

	ll lo=0,hi=1e17;
	while(lo<hi){
		ll mi=(lo+hi+1)/2;
		ll tmp=f(mi);
		if(tmp>=s){
			hi=mi-1;
		}
		else{
			lo=mi;
		}
	}

	string ans;
	for(ll i=lo+1;i<lo+20;i++){
		if(i%3==0 && i%5==0) ans+="FizzBuzz";
		else if(i%3==0) ans+="Fizz";
		else if(i%5==0) ans+="Buzz";
		else{
			char t[128]; sprintf(t,"%lld",i);
			ans+=t;
		}
	}

	ll p=f(lo)+1;
	rep(i,ans.length()){
		if(s<=p && p<s+20) putchar(ans[i]);
		p++;
	}
	puts("");

	return 0;
}

Measured memory_bytes: 1072
#pragma region Template
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

inline int sqr(int x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion

signed main()
{	
	string S;
	cin >> S;

	if (S == "ABC") COL("ARC");
	else COL("ABC");

	return 0;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<cstdlib>
#define ll long long
#define lowbit(x) (x&(-x))
using namespace std;

int main(){
    int n,h,a=0;
    scanf("%d%d",&h,&n);
    for (int i=1;i<=n;++i){
        int x;scanf("%d",&x);a+=x;
    }
    if (a>=h) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long long LL;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

VLL X;
LL N;

void modinvs(long long N, vector<long long>& inv, vector<long long>& sinv, long long mod = 1e9 + 7) {
	inv.resize(N + 1);
	sinv.resize(N + 1);
	inv[1] = 1;
	sinv[0] = 1;
	sinv[1] = 1;
	for (int n = 2; n <= N; n++) {
		inv[n] = mod - (inv[mod % n] * (mod / n)) % mod;
		sinv[n] = (sinv[n - 1] * inv[n]) % mod;
	}
}

VLL inv, sinv,st;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cin >> N;
	X.resize(N+1);
	for (LL n = 1; n <= N; n++)cin >> X[n];
	modinvs(N, inv, sinv, MOD);
	LL ans = 0;
	st.resize(N + 1,1);
	for (LL n = 2; n <= N; n++) {
		st[n] = (st[n - 1] * n) % MOD;
	}
	LL Q = st[N-1];
	for (LL n = 1; n <= N - 1; n++) {
		LL temp = (Q * (X[n+1] - X[n])) % MOD;
		ans += temp;
		//Q(n)までの和
		if (n == N - 1)break;
		LL q = st[N - 2 - n];
		q = (q * inv[n + 1]) % MOD;
		q = (q * st[N - 1]) % MOD;
		q = (q * sinv[N - n - 2]) % MOD;
		Q = (Q + q) % MOD;
	}
	cout << ans%MOD << "\n";
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }


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

	int n;
	cin >> n;

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

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (p[i] != i + 1) {
			continue;
		}
		
		if (i == n - 1) {
			swap(p[i], p[i - 1]);
		} else {
			swap(p[i], p[i + 1]);
		}
		ans++;
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  map<string, ll> m;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    m[s]++;
  }
  ll ans = 0;
  for (auto kv : m) {
    ans += kv.second * (kv.second - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    li cnt = 0;
    string s;
    cin >> s;
    for (auto && c : s) {
        if (c == 'x')cnt++;
    }
    cout << (cnt < 8 ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 1000000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int main(){
    char c; cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}


Measured memory_bytes: 760
s=input()
cnt=0
if s[0]=="A":
	cnt+=1
if s[2:-1].count("C")==1:
	cnt+=1
for i in range(len(s)):
	if ord(s[i])>=ord("a"):
		cnt+=10
if cnt==2+(10*(len(s)-2)):
	print("AC")
else:
	print("WA")

Measured memory_bytes: 3060
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	a := float64(getInt())
	b := float64(getInt())
	x := float64(getInt())

	V := a * a * b

	theta := 0.0
	if x == V/2 {
		theta = 45.0
	} else if x < V/2 {
		tan := a * b * b / (2 * x)
		rad := math.Atan(tan)
		theta = rad * 180.0 / math.Pi
	} else if x > V/2 {
		tan := 2.0 * (V - x) / math.Pow(a,3)
		rad := math.Atan(tan)
		theta = rad * 180.0 / math.Pi
	}

	fmt.Println(theta)
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 640
#include<stdio.h>
main(void){
    int a,b,c,x;
    scanf("%d %d %d\n",&a,&b,&c);
    if(a>b){
        x=a;
        a=b;
        b=x;

    }
    if(a>c){
        x=a;
        a=c;
        c=x;
    }
    if(b>c){
        x=b;
        b=c;
        c=x;
    }
    printf("%d %d %d\n",a,b,c);
        
    return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

const long long int inf=199999;
long long int mod;


//ダイクストラ(ある一点からの最短経路)
const long long int INF = 99999999999999999;

struct edge {
	long long int  to, cost;
};
typedef pair<long long int, long long int> P;
vector<edge> G[200101];
long long int d[201000],d2[201000];
long long int V, E,S,T;
long long int u[200001],v[200001],a[200001],b[200001],res[200001];

void dijkstra(long long int s) {

	priority_queue<P, vector<P>, greater<P> >que;
	fill(d, d + V, INF);
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty()) {
		P p = que.top();
		que.pop();
		long long int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main() {
    long long int count=0;
	
    map<long long int,long long int>mp;
	cout << fixed << setprecision(10);
    cin>>V>>E>>S>>T;
	S--;
	T--;
	for(int i=0;i<E;i++){
		cin>>u[i]>>v[i]>>a[i]>>b[i];
		u[i]--;
		v[i]--;
		G[u[i]].push_back({v[i],a[i]});
		G[v[i]].push_back({u[i],a[i]});
	}
	E*=2;
   	dijkstra(S);
	for(int i=0;i<V;i++){
		d2[i]=d[i];
		G[i].clear();
	}
	
	E/=2;
	for(int i=0;i<E;i++){

		G[u[i]].push_back({v[i],b[i]});
		G[v[i]].push_back({u[i],b[i]});
	}
	E*=2;
	dijkstra(T);
	long long int memo=909000000009999999;
	for(int i=V-1;i>=0;i--){
		memo=min(d[i]+d2[i],memo);
		res[i]=memo;
	}
	for(int i=0;i<V;i++){
		cout<<1000000000000000-res[i]<<endl;
	}
} 


Measured memory_bytes: 21888
#include <stdio.h>
int main(){

  int a,b,c,x;

  scanf("%d %d %d",&a,&b,&c);

  if (b < a){

    x=a;
    a=b;
    b=x;

  }

    if (c < b){

    x=b;
    b=c;
    c=x;

  }

  if (b < a){

    x=a;
    a=b;
    b=x;

  }

  printf("%d %d %d\n",a,b,c);

  return 0;
  
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		while(true) {
			String str = sc.next();
			if(str.equals("0")) break;

			int n = str.length();
			char[] c = str.toCharArray();
			int num[] = new int[n];
			int sum = 0;

			for(int i = 0; i < n; i++) {
				num[i] = (int)c[i] - 48;
				sum += num[i];
			}
			System.out.println(sum);
		}
	}
}



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

int main() {
    int n;cin>>n;
    int x[n],y[n];
    for(int i=0;i<n;i++) cin>>x[i];
    for(int i=0;i<n;i++) cin>>y[i];
    //p=1
    double sum=0;
    for(int i=0;i<n;i++){
        sum+=abs(x[i]-y[i]);
    }
    cout<<sum<<endl;
    //p=2
    sum=0;
    for(int i=0;i<n;i++){
        sum+=pow(x[i]-y[i],2);
    }
    sum=sqrt(sum);
    printf("%lf\n",sum);
    //p=3
    sum=0;
    for(int i=0;i<n;i++){
        sum+=pow(abs(x[i]-y[i]),3);
    }
    sum=pow(sum,0.33333333333333);
    printf("%lf\n",sum);
    //p=infinite
    int max=0;
    for(int i=0;i<n;i++){
        if(abs(x[i]-y[i])>max) max=abs(x[i]-y[i]);
    }
    cout<<max<<endl;
}


Measured memory_bytes: 3472
#include<stdio.h>


int main(void)
{
    int a,i,n,x,s=0;

    scanf("%d",&a);

    i=a;

    while(i){
        s+=i%10;
        i=i/10;
    }   

    if(a%s==0)
        printf("Yes\n");
    else
        printf("No\n");


    return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;

vector<bool> kmp(string& pattern, string& text) {
  vector<int> kmp_next(pattern.size()+1);
  kmp_next[0] = -1;
  for (int i = 0, j = -1; i < pattern.size(); ) {
    while (j >= 0 && pattern[i] != pattern[j])
      j = kmp_next[j];
    i++; j++;
    if (i < pattern.size() && pattern[i] == pattern[j])
      kmp_next[i] = kmp_next[j];
    else
      kmp_next[i] = j;
  }
  vector<bool> matches(text.size(), false);
  for (int i = 0, j = 0; j < text.size(); ) {
    while (i >= 0 && pattern[i] != text[j])
      i = kmp_next[i];
    i++; j++;
    if (i == pattern.size()) {
      matches[j - i] = true;
      i = kmp_next[i];
    }
  }
  return matches;
};

int main() {
    string s, t; cin >> s >> t;
    const int n = s.size();
    s += s;
    while (s.size() < 2 * t.size()) s += s;
    vector<bool> matches = kmp(t, s);
    vector<int> dp(n, -1);
    function<void(int, int)> dfs = [&](int i, int l) {
      if (l > n) { cout << "-1\n"; exit(0); }
      if (matches[i]) {
        const int j = (i + t.size()) % n;
        if (dp[j] == -1) dfs(j, l+1);
        dp[i] = 1 + dp[j];
      } else
        dp[i] = 0;
    };
    for (int i = 0; i < n; i++) {
      if (dp[i] == -1) dfs(i, 0);
    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

ll a[100010];

int main(){
    cin.sync_with_stdio(false);
    ll n, sum = 0;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
    }

    rep(i, n - 1) {
        sum += a[i] / 2;
        if (a[i + 1] > 0 && a[i] % 2 == 1) {
            sum++;
            a[i + 1]--;
        }
    }

    cout << sum + a[n - 1] / 2 << endl;

    return 0;
}

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

string S;
int P;

long long solve() {
    long long N = S.size();
    vector<long long> val(P, 0);
    long long tenfactor = 1;
    long long cur = 0;
    val[cur]++;
    for (int i = 0; i < N; ++i) {
        cur = (cur + (S[N-i-1]-'0') * tenfactor) % P;
        tenfactor = (tenfactor * 10) % P;
        val[cur]++;
    }
    long long res = 0;
    for (int p = 0; p < P; ++p) res += val[p] * (val[p] - 1) / 2;
    return res;
}

int main() {
    cin >> S;
    P = 2019;
    cout << solve() << endl;
}

Measured memory_bytes: 3764
import java.util.Scanner;

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

        int h,w;

        while(true){
            int count = 0;

            h = scanner.nextInt();
            w = scanner.nextInt();

            if (h == 0 && w == 0){
                break;
            }

            for(int j = 0;j < h;j++){
              count = j % 2;
                for(int i =0; i < w;i++){
                    count++;
                    if(count%2 == 1){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 34792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void go();
int main() {
#ifdef tokitsukaze
    freopen("TEST.txt", "r", stdin);
#endif
    go();
    return 0;
}

/*********************************  head  *********************************/


int n,a[100100],m[100100];
LL ans;
void go() {
    cin>>n;
    getchar();
    char c=0,cc;
    for(int i=1;i<=n;++i){
        cc=getchar();
        if(cc!=c)ans+=1;
        c=cc;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    ll N;cin>>N;
    ll info[N];cin>>info[0];
    set<ll> ans;
    rep(i,N-1){
        ll t;cin>>t;
        info[i+1]=info[i]+t;
    }
    rep(i,N)ans.insert(abs(info[N-1]-info[i]-info[i]));
    cout<<*ans.begin()<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;


int main()
{
	fast;
	int a, b;
	cin >> a >> b;
	int n;
	bool flag = true;
	for (n = 1; n < 1255; n++) {
		int p, q;
		p = 0.08 * n;
		q = 0.1 * n;
		if (p == a && q == b) {
			cout << n << endl;
			flag = false;
		}
		if (!flag) break;
	}
	if (flag) cout << "-1\n";
	return 0;
}


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

using namespace std;

int basemap(char c)
{
	if (c == 'A')
		return 0;
	if (c == 'T')
		return 1;
	if (c == 'C')
		return 2;
	if (c == 'G')
		return 3;
	return -1;
}

string readg(string buf)
{
	string res = "";

	if (buf[0] == '>')
		return res;

	char nowc;

	for (char nowc : buf)
	{
		if (basemap(nowc) >= 0)
			res.push_back(nowc);
	}

	return res;
}

void solve(void)
{
	string s;
	cin >> s;
	int ans = 0, cur = 0;
	s += '^';
	for (char c : s)
	{
		if (basemap(c) >= 0) cur++;
		else
		{
			ans = max(ans, cur);
			cur = 0;
		}
	}
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
int main(){
	int N,W;
	int value[100],weight[100];
	int dp[101][10001];
	scan(N);scan(W);
	rep(i,N){
		scan(value[i]);scan(weight[i]);
	}
	rep(w,W+1){
		dp[0][w]=0;
	}
	rep(i,N){
		rep(w,W+1){
			if(w>=weight[i]) dp[i+1][w]=max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			else dp[i+1][w]=dp[i][w];
		}
	}
	prin(dp[N][W]);
	return 0;
}



Measured memory_bytes: 6996
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int N=5005;
bool p[N][N],s[N][N];
int a[N];
int32_t main(){
    int n,k;
    cin>>n>>k;
    p[0][0]=1;
    for(int i=1;i<=n;++i)cin>>a[i];
    for(int i=1;i<=n;++i){
        forn(j,k){
            p[i][j]=p[i-1][j];
            if(j>=a[i])p[i][j]|=p[i-1][j-a[i]];
        }
    }
    s[n+1][0]=1;
    for(int i=n;i>=1;--i){
        forn(j,k){
            s[i][j]=s[i+1][j];
            if(j>=a[i])s[i][j]|=s[i+1][j-a[i]];
        }   
    }
    int ans=0;
    for(int i=1;i<=n;++i){
        int r=k,l=k,z=0;
        while(l>0&&l>k-a[i])z+=s[i+1][--l];
        int bad=0;
        forn(j,k){
            if(p[i-1][j]&&z){
                bad=1;
                break;
            }
            z-=s[i+1][--r];
            if(l>0)z+=s[i+1][--l];
        }
        ans+=1^bad;
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 52564
N = int(input())
An = list(map(int, input().split()))

for n in range(N):
    An[n] -= (n+1)

An.sort()

if (N-1) % 2 != 0:
    m = N//2 - 1
else:
    m = (N-1)//2

bf = -sum(An[0:m+1:]) + (m+1)*An[m]
af = sum(An[m+1::]) - (N-m-1)*An[m]
ans = bf + af
print(ans)

Measured memory_bytes: 26020
#include <bits/stdc++.h>
#define INF 1e14
typedef long long ll;

using namespace std;

int n,m;

ll d[1001];
bool use[1001];

struct edge {
  int s, t; ll cost;
edge (int ss, int tt, ll c) : s(ss), t(tt), cost(c) {}
};

vector<edge> e;

void solve() {
  d[0] = 0;
 
  int k = n;
  while(k--) {
    for(int i = 0; i < e.size(); i++) {
      edge ee = e[i];
      if(d[ee.s] != -INF && d[ee.t] < d[ee.s] + ee.cost) {
	d[ee.t] = d[ee.s] + ee.cost;
      }
    }
  }
  ll heiro = d[n-1];

   k = n;
  while(k--) {
    for(int i = 0; i < e.size(); i++) {
      edge ee = e[i];
      if(d[ee.s] != -INF && d[ee.t] < d[ee.s] + ee.cost) {
	d[ee.t] = d[ee.s] + ee.cost;
      }
    }
  }
  if(heiro >= d[n-1]) cout << d[n-1] << endl;
  else cout <<"inf"<<endl;
}  

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

  for(int i = 0; i < m; i++) {
    int a,b; ll c;
    cin >> a >> b >> c;
    a--; b--;
    e.push_back(edge(a,b,c));
  }

  fill(d,d+n,-INF);

  solve();
}


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

using namespace std;

int main(){
	int n, h[N], cost[N];

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

	//alg
	cost[0]=0;
	cost[1] = abs(h[1]-h[0]);
	for(int i=2;i<n;i++){
		cost[i] = min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]));
	}

	cout << cost[n-1] << '\n';

	return 0;
}

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

using namespace std;

int main()
{
	string s;
	cin>>s;
	int hugs=0;
	int n=s.size()/2;
	for (int i=0; i<n; i++)
	{
		if (s[i]!=s[s.size()-i-1]) hugs++;
	}
	cout<<hugs<<endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

ll gcd(ll a, ll b) {
	if(!b) return a;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b) {
	return a/gcd(a,b)*b;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll n,m; cin>>n>>m;
	string s,t; cin>>s>>t;
	ll l=lcm(n,m);
	map<int,char> mp;
	for (int i=0; i<n; i++)
		mp[l/n * i] = s[i];
	for (int i=0; i<m; i++) {
		ll cur=l/m * i;
		if(mp.find(cur)!=mp.end()) {
			if(mp[cur]!=t[i]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << l << endl;
	return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>
using namespace std;
int main(void){
    long long int a,b,c,d;
    long long int e,f;
    cin>>a>>b>>c>>d;
    if(a>=d){
        cout<<d<<endl;
        return 0;
    }else{
        f=a;
        d-=a;
    }
    if(b>=d){
        cout<<f<<endl;
        return 0;
    }else{
        d-=b;
    }
    f-=d;
    cout<<f<<endl;
}

Measured memory_bytes: 3620
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
  a = list(map(int, input().split()))
  cal = sum(A*B for A,B in zip(a,b))
  if cal+c>0:
    ans+=1
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)

const ll inf = 1e15;
const ll mod = 1e9+7;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
    bool ok = false;
    if (abs(a-c) <= d) ok = true;
    if (abs(a-b) <= d && abs(b-c) <= d) ok = true;
    
    cout << (ok ? "Yes" : "No") << endl;
    
    return 0;
}


Measured memory_bytes: 764
# https://www.geeksforgeeks.org/knapsack-with-large-weights/

# in this question we are basicallly forced to alter the state so be alble to solve the problem within time constraints
# here W (capacity of knapsak is huge ,like order 10^9)
# but the thing to be considered is the low value of price
# submitted at Atcoder https://atcoder.jp/contests/dp/tasks/dp_e

# here max profit is 10*3 and N<=100

n,W=map(int,input().split())
wt,values=[],[]
for _ in range(n):
    w,val=map(int,input().split())
    wt.append(w)
    values.append(val)
# since for an i we only need look at i-1 row hence 1D array can be used to memoise
# inner loop goes backward since we can take an item more then once (bounded Knapsack)
# dp[j] is gives the min weight required to earn j profit
max_profit=max(values)*n # not neccessary we can take it n*10^3
dp=[float('inf')]*(max_profit+1)
dp[0]=0

for i in range(n):
    for j in range(max_profit,values[i]-1,-1):
        dp[j]=min(dp[j],wt[i]+dp[j-values[i]])
    #print(dp)
ans=0

for i in range(1,max_profit+1):
    if dp[i]<=W:
        ans=i
print(ans)
    







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

using namespace std;

typedef long long int ll;

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

  int n, k;
  cin >> n >> k;
  vector < int > a (n + 1);
  vector < ll > p (n + 2), lt (n + 2), rt (n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }

  for (int i = 1; i <= n; i++) {
    lt[i] = lt[i - 1] + (a[i] > 0 ? a[i] : 0);
  }
  for (int i = n; i >= 1; i--) {
    rt[i] = rt[i + 1] + (a[i] > 0 ? a[i] : 0);
  }

  ll ans = LLONG_MIN;
  for (int i = 1; i <= n - k + 1; i++) {
    ans = max ({ans, lt[i - 1] + rt[i + k] + (p[i + k - 1] - p[i - 1] > 0 ? p[i + k - 1] - p[i - 1] : 0)});
  }

  cout << ans << '\n';
}


Measured memory_bytes: 6028
#include <iostream>
#include <cstdio>
#include <vector>
#define N 100001
using namespace std;
typedef long long ll;

ll n, x, y, ans, cx, cy, v[200005];
vector<ll> gr[200005];

void dfs(int p) {
	v[p] = 1;
	p>=N ? cy++ : cx++;
	for(int i=0; i<gr[p].size(); i++) {
		if(!v[gr[p][i]]) dfs(gr[p][i]);
	}
}

int main() {
	ll i, x, y;
	cin >> n;
	for(i=0; i<n; i++) {
		scanf("%lld%lld", &x, &y);
		gr[x].push_back(y+N);
		gr[y+N].push_back(x);
	}
	for(i=0; i<=2*N; i++) {
		if(!v[i]) {
			cx = cy = 0;
			dfs(i);
			ans += cx * cy;
		}
	}
	cout << ans - n;
	return 0;
}

Measured memory_bytes: 11520
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
vector<ll> getPrime(ll N) {
    vector<ll> p={2};
    for (ll i = 2; i * i <= N; i++) {
        for (ll j = 0; j <= p.size(); j++) {
            
        }
    }
    return p;
}
bool isp(ll N){
    if(N==1)return false;
    for(ll i=2;i*i<=N;i++) {
        if(N%i==0)return false;
    }
    return true;
}
int main(){
    ll N;
    cin>>N;
    
    if(N==1){
        cout<<0;return 0;
    }
    ll soi;
    
    ll ii;
    ll cnt=0;
    for(ii=2;ii<sqrt(N);ii++){
        if(N%ii==0){
            soi=0;
            while(true){
                if(N%ii==0){
                    N/=ii;
                    soi++;
                }else break;
            }
            //sl(ii,soi[ii],N)
            ll t=soi;
            for(ll j = 1; ; j++) {
                if(t >= j) {
                    t -= j;
                    cnt++;
                } else break;
            }
        }
    }
    //sl(N)
    if(N!=1)cnt++;
    cout<<cnt;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    vector<int> hako(N, 0);
    int M = 0;

    // N-1から0まで
    reprev(i, N) {
        int bai = 1;
        int sm = 0;
        while((i+1)*bai <= N) {
            // hakoの中身が1なら足す
            sm += hako[(i+1)*bai-1];
            bai += 1;
        }
        if (a[i] == 0 && sm%2 == 1) {
            // あまりが0の必要があるのに、和のあまりが1の場合
            hako[i] = 1;
            M += 1;
        }
        if (a[i] == 1 && sm%2 == 0) {
            // あまりが1の必要があるのに、和のあまりが0の場合
            hako[i] = 1;
            M += 1;
        }
    }
    cout << M << endl;
    rep(i, N) {
        if (hako[i] == 1) cout << i+1 << " ";
    }
    if (M > 0) cout << endl;
    return 0;
}

Measured memory_bytes: 2432
guideBook = {}
N = int(input())

for index in range(N):
    S, strP = input().split()
    P = int(strP)
    if S in guideBook.keys():
        guideBook[S].setdefault(P,index+1)
    else:
        guideBook.setdefault(S,{P:(index+1)})

citylist = list(guideBook.keys())
citylist.sort()

for city in citylist:
    pointList = list(guideBook[city].keys())
    pointList.sort(reverse=True)
    for point in pointList:
        print(guideBook[city][point])

Measured memory_bytes: 3064