akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, k, p[5005] = {}, c[5005] = {}, ans = -1e10, score[5005][5005] = {};
bool visited[5005][5005] = {};

int main() {
	cin >> n >> k;
	rep(i, n)cin >> p[i];
	rep(i, n)cin >> c[i];
	rep(i, n) {
		ll cur = i, maxscore[5005] = {};
		for (int j = 1; j <= k && !visited[i][cur]; j++) {
			visited[i][cur] = true;
			score[i][j] = score[i][j - 1] + c[p[cur] - 1];
			maxscore[j] = max(maxscore[j - 1], score[i][j]);
			ans = max(ans, score[i][j]);
			cur = p[cur] - 1;
			if (visited[i][cur] && score[i][j] > 0)ans = max(ans, max(score[i][j] * (k / j) + maxscore[k % j], score[i][j] * (k / j - 1) + maxscore[j]));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 223688
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int L, R, d;
    cin >> L >> R >> d;
    int res = 0;
    FOR(i, L, R + 1) {
        res += (i % d) == 0;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3628
H,W = map(int, input().split())

m = []

for _ in range(H):
    S = list(input())
    m.append(S)
a = [[-1,1],[0,1],[1,1],[-1,0],[1,0],[-1,-1],[0,-1],[1,-1]]
for i in range(H):
    for j in range(W):
        if m[i][j]=="#":
            continue
        count = 0
        for k in range(len(a)):
            x = a[k][0]
            y = a[k][1]
            if (x+j)<0 or (y+i)<0 or (x+j)>=W or (y+i)>=H:
                continue
            if m[y+i][x+j]=="#":
                count = count + 1
        m[i][j]=count

for i in range(H):
    print(*m[i],sep="")

Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int[] map = new int[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextInt();
		}
		
		if (check(map)) {
			System.out.println("YES");
			return;
		}
		
		for (int i = 0; i < map.length-1; i++) {
			for (int j = i+1; j < map.length; j++) {
				
				int tmp = map[i];
				map[i] = map[j];
				map[j] = tmp;
				
				if (check(map)) {
					System.out.println("YES");
					return;
				}
				
				map[j] = map[i];
				map[i] = tmp;
				
			}
		}
	
		System.out.println("NO");
	}
	
	static boolean check(int[] map) {
		int pre = 0;
		for (int i : map) {
			if (pre > i) {
				return false;
			}
			pre = i;
		}
		return true;
	}
	
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


lint solve(int H, int W, int K)
{
    lint ret = 0;
    REP(dh, H - 1)
    {
        FOR(w, 1, W)
        {

            lint R = 2 * K - 2 + __gcd(W, dh) - 1LL * w * dh;
            if (R < 0) break;

            lint lo = min<lint>(R / W, H - 1 - dh); // hs <= lo なら必ず成立
            lint hi = min<lint>((R + W * 2) / W, H - dh); // hs >= hi なら必ず不成立

            lint ret_tmp = lo;
            FOR(hs, lo + 1, hi)
            {
                lint x = hs * W - __gcd(w, hs) - __gcd<int>(W - w, hs + dh);
                if (x <= R) ret_tmp++;
            }
            ret += ret_tmp * (1 + (dh != 0));
        }
    }
    return ret * 2;
}

int main()
{
    int W, H, K;
    cin >> W >> H >> K;
    lint ret = solve(W, H, K) + solve(H, W, K);
    cout << ret << '\n';
}


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var s = cin.Read;
            var t = cin.Read;

            var st = new StringBuilder();

            for (int i = 0; i < n; i++)
            {
                st.Append(s[i]);
                st.Append(t[i]);
            }

            Console.WriteLine(st.ToString());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) 
                {
                    return inputStream.Dequeue();
                }

                string[] tmp = _stream.ReadLine().Split(_separator);
                
                for (int i = 0; i < tmp.Length; ++i)
                {
                    inputStream.Enqueue(tmp[i]);
                }
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    string s;
    cin >> s;

    switch (s[0]) {
        case 'S':
            cout << "Cloudy";
            break;
        case 'C':
            cout << "Rainy";
            break;
        case 'R':
            cout << "Sunny";
            break;
    }
    cout << endl;

    return 0;
}


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

using namespace std;

string ns[]={"1","1","2","6","24","120","720","5040","40320","362880","3628800","39916800","479001600","6227020800","87178291200","1307674368000","20922789888000","355687428096000","6402373705728000","121645100408832000","2432902008176640000"};

int main(){
  int n;
  cin >> n;
  cout << ns[n] << endl;
}

Measured memory_bytes: 1196
#include <cstdio>
#include <cmath>
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
int main( void ){
	int a, b;
	if (!scanf( "%d%d", &a, &b )){
		return 1;
	}
	int ans = a-2*b;
	if (ans<0)
		ans = 0;
	printf("%d\n", ans);
	return 0;
}


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

int main(){
    string S;cin>>S;
    int A[4];char op[3];
    for(int i=0;i<4;i++){
        A[i]=S.at(i)-'0';
    }int sum;
    for(int j=0;j<(1<<3);j++){
        sum=A[0];
        for(int k=2;k>=0;k--){
            if(j&(1<<k)){
                op[2-k]='+';
                sum+=A[3-k];
            }else{
                op[2-k]='-';
                sum-=A[3-k];
            }
        }//cout<<sum<<endl;
        if(sum==7){
            cout<<A[0]<<op[0]<<A[1]<<op[1]<<A[2]<<op[2]<<A[3]<<"=7"<<endl;
            break;
        }
    }
}

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

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

using namespace std;

int main() {
    vector<int> hand(5);
    while(1) {
        cin >> hand[0];
        if (hand[0] == 0)break;
        for (int i = 1; i < 5; i++) {
            cin >> hand[i];
        }
        bool used[3] = {false};
        rep(i,5) {
            used[hand[i]-1] = true;
        }
        int count = 0;
        rep(i,3) {
            if (used[i])count++;
        }
        if (count == 1 || count == 3) {
            rep(i,5) {
                cout << 3 << endl;
            }
        } else {
            int win, lose;
            if (used[0] && used[1]) {
                win = 1;
            } else if (used[1] && used[2]) {
                win = 2;
            } else {
                win = 3;
            }
            rep(i,5) {
                if (hand[i] == win) {
                    cout << 1 << endl;
                } else {
                    cout << 2 << endl;
                }
            }
        }
    }
}

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

int main(void){
    int N, M; cin >> N >> M;
    vector<int> X(N);
    vector<int> X_count(100001);
    vector<int> XmodM_count(100001);
    vector<int> XmodM_HitoriBocchi(100001);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
        X_count[X[i]]++;
    }
    
    for (int i = 0; i < 100001; i++) {
        if (X_count[i] % 2) {
            XmodM_HitoriBocchi[i % M]++;
        }
        XmodM_count[i % M] += X_count[i];
    }
    
    int ans = XmodM_count[0]/2;
    int limit = M/2;
    if (M%2 == 0) {
        ans += XmodM_count[M/2]/2;
        limit = M/2-1;
    }
    for (int i = 1; i <= limit; i++) {
        int cnt = min(XmodM_HitoriBocchi[i], XmodM_HitoriBocchi[M-i]);
        ans += cnt;
        XmodM_HitoriBocchi[i] -= cnt;
        XmodM_HitoriBocchi[M-i] -= cnt;
        XmodM_count[i] -= cnt;
        XmodM_count[M-i] -= cnt;
        cnt = min(min(XmodM_count[i], XmodM_count[M-i]), max(XmodM_HitoriBocchi[i], XmodM_HitoriBocchi[M-i]));
        ans += cnt;
        if (XmodM_HitoriBocchi[i] != 0) XmodM_HitoriBocchi[i] -= cnt;
        else XmodM_HitoriBocchi[M-i] -= cnt;
        XmodM_count[i] -= cnt;
        XmodM_count[M-i] -= cnt;
        ans += max((XmodM_count[i] - XmodM_HitoriBocchi[i])/2 + (XmodM_count[M-i] - XmodM_HitoriBocchi[M-i])/2, 0);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#balls and boxes 7
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,k = map(int,readline().split())
mod = 10**9+7
def pow(n,p,mod=mod):
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod
def factrial_memo(n=10**5,mod=mod): # [1,n)までの階乗と逆元の階乗
    fact = [1, 1]  # fact[n] = (n! mod mod)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod mod)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    return fact,factinv # warning:1-indexed list

fact,factinv = factrial_memo()

#ベル数O(k)
def bell(n,r): #nBr
    if r > n:r = n

    memo = [0]*(r+2)
    for i in range(r+1):
        if even(i):memo[i+1] = memo[i] + factinv[i]
        else:memo[i+1] = memo[i] - factinv[i]
    res = 0
    for i in range(r+1):
        res += pow(i,n)*factinv[i]*memo[r-i+1]%mod
        res %= mod
    return res

print(bell(n,k))


Measured memory_bytes: 17396
N,M = map(int,input().split())
A = list(map(int,input().split()))

A.sort(reverse=True)

# 各数字に必要なマッチの本数
num  = [0,2,5,5,4,5,6,3,7,6]
# dp : i本のマッチで実現できる最大の桁数
dp = [-1*float("inf")]*(N+1000)
# dp初期化 (0本では0桁, 各数字を1つ作る場合は1桁)
dp[0] = 0
for a in A:
    dp[num[a]] = 1

for i in range(1,N+1):
    for a in A:
        if i - num[a] >= 0:
            dp[i] = max(dp[i], dp[i-num[a]] + 1)

ans = ""
for i in range(dp[N]):
    for a in A:
        if dp[N-num[a]] == dp[N]-1  and  N-num[a] >= 0:
            ans += str(a)
            N -= num[a]
            break

print(ans)

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const int INF = 1e9;

struct EdgeF{
  int to, cap, rev;
  EdgeF(int to_=0, int cap_ = 0, int rev_ = 0)
	:to(to_), cap(cap_), rev(rev_){}
};
using GraphF = vector<vector<EdgeF>>;

void add_edge(GraphF& G, int from, int to, int cap){
  G[from].emplace_back(to, cap, G[to].size());
  G[to].emplace_back(from, cap, G[from].size()-1);
}

int max_flow(GraphF& G, int s, int t, int maximum = INF){
  const int V = G.size();
  vector<bool> used(V);
 
  function<int(int,int,int)> dfs = [&](int v, int t, int f){
    if(v == t) return f;
    used[v] = true;
    for(auto& e: G[v]){
      if(!used[e.to] && e.cap > 0){
        int d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  };
 
  int flow = 0;
  while(true){
    fill(used.begin(), used.end(), false);
    int f = dfs(s, t, maximum);
    if(f == 0) return flow;
    flow += f;
	maximum -= f;
	if(maximum == 0)
	  return flow;
  }
}

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

  int V, E;
  cin >> V >> E;

  GraphF G(V);
  vector<PII> es;
  REP(i,E){
	int s, t, c;
	cin >> s >> t >> c;
	add_edge(G, s, t, c);
	if(c == 1){
	  es.EB(s, SZ(G[s])-1);
	  es.EB(t, SZ(G[t])-1);
	}
  }
  int S = 0, T = V - 1;

  int ans = max_flow(G, S, T);
  for(auto& p: es){
	auto& e = G[p.FF][p.SS];
	if(e.cap == 0){
	  G[e.to][e.rev] = 0;
	  if(max_flow(G, p.FF, e.to, 1) == 0){
		--ans;
		break;
	  }
	  G[e.to][e.rev] = 1;
	}
	else{
	  
	}
  }

  cout << (ans <= 10000? ans: -1) << endl;

  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector< ll > vi;
typedef vector< vi > vvi;
typedef pair< ll,ll > ii;
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define tr(x,i) for(vi::iterator i = x.begin() ; i != x.end() ; i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define T ll t;cin>>t;while(t--)
ll powmod(ll a,ll b){ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
signed main() 
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin>>s;
	ll len = s.length();
	if(len % 2 == 0){
		cout<<"No\n";
		return 0;
	}
	ll f=0;
	for(ll i=0;i<len;i++)
	{
		if(s[i] != s[len-1-i])
		{
				f=1;break;
		}
	}
	for(ll i=0;i<len/2;i++)
	{
		if(s[i] != s[len/2-1-i])
		{
				f=1;break;
		}
	}
	for(ll i=len/2;i<len;i++)
	{
		if(s[i] != s[len-1-i])
		{
				f=1;break;
		}
	}
	if(f == 1)
	{
		cout<<"No\n";
		return 0;
	}
	else
	{
		cout<<"Yes\n";
		return 0;
	}
	


}


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

int main (void) {
    int N, K;
    cin >> N >> K;
    int d[K] = {0};
    set<int> s;
    int tmp = 0;

    for (int i = 0; i < K; ++i) {
        cin >> d[i];
        for (int j = 0; j < d[i]; ++j) {
            cin >> tmp;
            s.insert(tmp);
        }
    }
    cout << to_string(N-s.size()) << endl;

}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n), b(m);
  ll cur = 0;
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i], cur += b[i];
  int j = m - 1;
  int res = 0;
  for (int i = 0; i <= n; i++) {
    while (j >= 0 && cur > k) {
      cur -= b[j];
      j--;
    }
    if (cur <= k) res = max(res, i + j + 1);
    if (i < n) cur += a[i];
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 4780
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  int od = 0;
  rep(i, n){
    int in;
    cin >> in;
    if(in % 2 == 1) od++;
  }
  od %= 2;
  if(od == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

using namespace std;

const int maxn = 65;
bool ch[maxn];
long long mask[maxn];
long long a[100005], all;
void Insert(long long t){
    for(int i=60;i>=0;i--){
        if(ch[i]) continue;
        if((t>>i)&1){
            if(mask[i]==0){
                mask[i] = t;
                return;
            }
            t^=mask[i];
        }
    }

}


int main()
{

    int n;
    scanf("%d", &n);
    all = 0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld", &a[i]);
        all^=a[i];
    }
    for(int i=0;i<=60;i++){
        if((all>>i)&1) ch[i] = 1;
        else ch[i] = 0;
    }
    for(int i=1; i<=n; i++){
        Insert(a[i]);
    }
    long long ans = 0;
    for (int i = 60; i >= 0; i--) {
		if (!mask[i]) continue;

		if (ans & (1LL<<i)) continue;

		ans ^= mask[i];
	}
    printf("%lld\n", ans + (all ^ ans));

    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

long long n,m;

bool ispalin(string S) {
	int n = S.size();
	REP(i, n) if(S[i] != S[n-1-i]) return false;
	return true;
}

void solve(istream& cin, ostream& cout) {
	string S;
	cin >> S;
	int n = S.size();
	if(ispalin(S) && ispalin(S.substr(0, (n-1)/2)) && ispalin(S.substr((n+1)/2)))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

int32_t main(){
	fastio;
	string s;
	cin>> s;
	for(int i = 0; i< s.size(); ++i) cout<< 'x';
	cout<< endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char s[111111];
int sz,cnt,pos,cur;
int main()
{
	scanf("%s",s);
	sz=strlen(s);
	pos=sz-1;
	while(pos>=0)
	{
		cur=pos;
		while(s[pos]==s[cur] && pos>=0) pos--;
		cnt++;
	}
	printf("%d\n",cnt-1);
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int x[] = {7,5,3};
        String w[] = {"YES","NO"};
        		
	    		if(a == x[0] || a == x[1] || a == x[2]){
	    			System.out.println(w[0]);
	    		}else{
	    			System.out.println(w[1]);
	    		}
	    		
	    }
	}


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

int n,a[100]={0};

void insertionsort(){
	int i,v=0,j=0;
	for(i=1;i<=n-1;i++){
		v=a[i];
		j=i-1;
		while(j>=0&&a[j]>v){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;
		for(j=0;j<n;j++){
			if(j!=n-1){
				cout<<a[j]<<" ";
			}
			else{
				cout<<a[j]<<endl;
			}
		}
		
	}
}

int main() {
	// your code goes here
	int i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=0;i<n;i++){
		if(i!=n-1){
			cout<<a[i]<<" ";
		}
		else{
			cout<<a[i]<<endl;
		}
	}
	insertionsort();
	return 0;
}

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

ll op(ll a, ll b) {
    return a + b;
}
ll e() {
    return 0;
}

int main() {
    ll N, Q;
    cin >> N >> Q;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    segtree<ll, op, e> seg(a);
    rep(i, Q) {
        int q;
        cin >> q;
        if (q == 0) {
            ll p, x;
            cin >> p >> x;
            seg.set(p, seg.get(p) + x);
        } else {
            ll l, r;
            cin >> l >> r;
            cout << seg.prod(l, r) << endl;
        }
    }
}

Measured memory_bytes: 16448
from bisect import bisect_left, bisect_right
import sys

def solve():
    numChar = 26
    ordA = ord('a')

    Ss = input().rstrip()
    Ts = input().rstrip()

    lenS = len(Ss)
    Ss = [ord(S)-ordA for S in Ss]
    Ts = [ord(T)-ordA for T in Ts]

    setS, setT = set(Ss), set(Ts)
    for T in setT:
        if T not in setS:
            print(-1)
            sys.exit()

    posChs = [[] for _ in range(numChar)]
    for i, S in enumerate(Ss+Ss):
        posChs[S].append(i)

    ans = 0
    i = -1
    for T in Ts:
        iPos = bisect_right(posChs[T], i)
        i2 = posChs[T][iPos]
        ans += i2 - i
        i = i2 % lenS

    print(ans)


solve()


Measured memory_bytes: 14700
N = int(input())
A = list(map(int, input().split()))

irekae_sum = 0
for idx, a in enumerate(A):
    if idx % 2 == 0:    
        irekae_sum += a
    else:
        irekae_sum -= a
        
ans = []
for i in range(N):
    ans.append(str(irekae_sum))
    irekae_sum = - irekae_sum + 2*A[i]
            
print(" ".join(ans))

Measured memory_bytes: 17220
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
struct UnionFind {
	vector<int> par;
	int size;
	UnionFind(int n) :size(n) {
		par.resize(size);
		for (int i = 0; i < size; i++) par[i] = i;
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		par[y] = x;
	}
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]);
	}
	bool same(int x, int y) {
		x = find(x);
		y = find(y);
		return x == y;
	}
};
bool marked[100000];
int par[100000];
int main() {
	int N, Q;
	while (cin >> N >> Q, N) {
		vector<P> query;
		memset(marked, 0, sizeof(marked));
		marked[0] = 1;
		for (int i = 1; i < N; i++) {
			cin >> par[i];
			par[i]--;
		}
		UnionFind U(N);
		for (int i = 0; i < Q; i++) {
			string t;
			int v;
			cin >> t >> v; v--;
			if (t == "M") {
				if (marked[v]) continue;
				marked[v] = 1;
			}
			query.emplace_back(t == "M", v);
		}
		for (int i = 1; i < N; i++) {
			if (!marked[i]) U.unite(par[i], i);
		}
		ll ans = 0;
		for (int i = query.size() - 1; i >= 0; i--) {
			if (query[i].first) {
				U.unite(par[query[i].second], query[i].second);
			}
			else {
				ans += U.find(query[i].second) + 1;
			}
		}
		cout << ans << endl;
	}
}


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

int main()
{
        long long N;
        cin >> N;
        long long ans = 0;
        for (int i = 1; i < N+1; ++i) {

                if (i % 3 == 0 || i % 5 == 0) {

                }
                else {
                        ans += i;
                }
        }
        cout << ans << endl;


}


Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <stdexcept>
#include <vector>
using namespace std;


#define abs(N) ((N>0)?N:-1*N)
#define lt(A,B) ((A>B)?B:A)
#define gt(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)
#define ll long long int

int BinarySearch(ll * S, int n, ll key){
//	println("=============================");
	int l=0,r=n,c;
	while(l<r){
		c = (l+r)/2;
		if(key > S[c]){
			l = c+1;
		}else if(S[c] > key){
			r = c;
		}else{
			return c;
		}
	}
//	printf("S[%d](=%lld) - S[%d](=%lld)\n",r,S[r],l,S[l]);

	return -1;
}

int main(){
	int n,q;
	cin >> n;
	ll S[n+1];
	for (int i = 0; i < n; ++i) {
		cin >> S[i];
	}
	cin >> q;
	int cnt=0;
	for (int i = 0; i < q; ++i) {
		ll Q;
		cin >> Q;
		if(BinarySearch(S,n,Q)!=-1) cnt++;
	}
	println(cnt);

	return 0;
}



Measured memory_bytes: 3768
#include <cstdio>
#include <cstring>

#define MAX_N 8
#define abs(x) ((x) > 0 ? (x) : -(x))

/* -----------------------------------------------------------------------------
	型とクラス定義
----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
	大域データ
----------------------------------------------------------------------------- */

int N;
int P[MAX_N], Q[MAX_N];	// 数列

int fact(int n) {
	return n == 0 ? 1 : n * fact(n - 1);
}

int encode(int X[], int N) {

	int b[MAX_N] = {0}, c = 0;

	for(int i = 0; i < N; i++) {
		int nth = 0;
		b[X[i]-1] = 1;
		for(int j = 0; j <= X[i] - 1; j++) if(b[j] == 0) nth++;
		c += nth * fact(N - i - 1);
	}
	return c;

}
int main () {

	// 長さの読込み
	scanf("%d", &N);

	// 配列の読込み
	for(int i = 0; i < N; i++) scanf("%d", P + i);
	for(int i = 0; i < N; i++) scanf("%d", Q + i);

	printf("%d\n", abs(encode(P, N) - encode(Q, N)));

	return 0;
}


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

int main() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		int cnt = 0;
		for (int j = i; j < s.size(); j++) {
			if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') cnt++;
			else break;
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	int mh = 0;
	int ans = 0;
	int H;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> H;
		if (mh <= H)
		{
			mh = H;
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

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

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#define lli long long int
#define N 4
#define pb push_back
using namespace std;


int main()
{
    int n,m;
    int x,temp;
    cin>>n;
    vector<vector<int>>test(n+1,vector<int>(n+1,-1));
    for(int i=1;i<=n;i++)
    {
        cin>>m;
        while(m--)
        {
            cin>>x>>temp;
            test[i][x] = temp;
        }
    }
    
    
//    for(int i=1;i<=n;i++)
//      {
//          for(int j=1;j<=n;j++)
//              cout<<test[i][j]<<" ";
//          cout<<endl;
//      }
//
    vector<int>honest(n+1,0);
    int s = (1<<n);
    bool posi;
    int mymax = 0;
    int ct;
    for(int j=0;j<s;j++)
    {
        ct = 0;
        posi = true;
        honest.assign(n+1,0);
        
        for(int k=0;k<n;k++)
            if(((1<<k)&j)>0)
            {
                ct++;
                honest[k+1]  = 1;
            }
        
        for(int k=1;k<=n;k++)
        {
            if(honest[k]==1)
                for(int j=1;j<=n;j++)
                {
                    if(test[k][j]==0 and honest[j]==1) posi = false;
                    if(test[k][j]==1 and honest[j]==0) posi = false;
                }
            
        }
        
        
        if(posi)  mymax = max(mymax,ct);
        
    }
    
    cout<<mymax<<endl;
    
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i,m,n) for(int i = m;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
int main() {
  lli A,B,C=0,D=0,E=0,F=0,G=0,H=0,N,M;
  cin >> A >> B >> C;
  A-=C;
  B+=C;
  Out(A/B);
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int> > v(n);
    for(int i=0; i<n; ++i)
        cin >> v[i].first >> v[i].second;
    sort(v.rbegin(), v.rend());

    int ans = v[0].first + v[0].second;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
// AOJ 1175: And Then. How Many Are There?
// 2017.12.21 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

typedef struct { int s, del, m; } Q;
Q q[100000]; int top;
typedef struct { int x, y, r, c; } T;
T d[25]; int n;
typedef struct { int n, id[25]; } S;
S up[25];			// ?????????????????????????????°??¨??????
char visited[16777216];

int main()
{
	int i, j, k, a, s, del, m, ans;

	while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) scanf("%d%d%d%d", &d[i].x, &d[i].y, &d[i].r, &d[i].c);
		memset(up, 0, sizeof(up));
		for (i = 0; i < n; i++) for (j = i+1; j < n; j++) {
			if (hypot(d[i].x-d[j].x, d[i].y-d[j].y) < d[i].r+d[j].r) {
				up[j].id[up[j].n++] = i;
			}
		}

		ans = 0;
		memset(visited, 0, sizeof(visited));
		q[0].s = 0, q[0].del = 0, q[0].m = n, top = 1;
		while (top) {
			s = q[--top].s, del = q[top].del, m = q[top].m;

			if (m == 1 || visited[s]) continue;
			visited[s] = 1;
			for (i = 0; i < n; i++) {
				if (s & (1<<i)) continue;
				for (k = 0; k < up[i].n; k++) {
					a = up[i].id[k];
					if (!(s & (1<<a))) goto next;
				}

				for (j = i+1; j < n; j++) {
					if (s & (1<<j)) continue;
					if (d[j].c != d[i].c) continue;
					for (k = 0; k < up[j].n; k++) {
						a = up[j].id[k];
						if (!(s & (1<<a))) goto next2;
					}

					if (del+2 > ans) ans = del+2;
					q[top].s = s|(1<<i) | (1<<j), q[top].del = del+2, q[top++].m = m-2;

					next2:;
				}
				next:;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

using namespace std;

int main(){
	//~ freopen("input.txt", "r", stdin);
	//~ freopen("output.txt", "w", stdout);
	long long n;
	cin >> n;
	string s = "";
	while (n > 0){
		int c = n % 26;
		n /= 26;
		if (c == 0)
			c = 26, n--;
		s += ('a' + c - 1);
	}
	for (int i = s.size() - 1; i >= 0; i--){
		cout << s[i];
	}
	printf("\n");
}


Measured memory_bytes: 3624
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const input = stdin.split('\n')

const [S, T] = input

const ans = () => {
  let count = 0
  for (let i = 0; i < 3; i++) {
    if (S[i] === T[i]) count++
  }
  console.log(count)
}

ans()


Measured memory_bytes: 7500
N,K=map(int,input().split())
a=list(map(int,input().split()))

ans=10**11

for i in range(N-K+1):
    ans=min(ans, abs(a[i])+a[i+K-1]-a[i], abs(a[i+K-1])+a[i+K-1]-a[i] )

print(ans)

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

int main(){
    string a,b;
    cin >> a >> b;
    auto len = a.length();
    for(int i = 0;i<len;i++){
        if(a[i]!=b[i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

int main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(NULL);
    cout << fixed << setprecision(10);

    ULL n = 0;
    cin >> n;
    unordered_map<string, ULL> S;

    for(ULL i=0; i<n; i++)
    {
        string temp;
        cin >> temp;
        if(S.count(temp) == 0)
        {
            S.emplace(temp, 1);
        }
        else
        {
            S.at(temp)++;
        }
    }

    vector<string> v_res;
    ULL max = 0;
    for(auto it : S)
    {
        // cout << it.first << ": " << it.second;
        if(it.second == max)
        {
            // cout << "add" << endl;
            v_res.push_back(it.first);
        }
        else if(it.second > max)
        {
            // cout << "reset" << endl;
            v_res.clear();
            v_res.push_back(it.first);
            max = it.second;
        }
    }

    sort(v_res.begin(), v_res.end());
    for(auto it : v_res)
    {
        cout << it << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 26692
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
Min = h[K] - h[0]
for i in range(N-K+1):
  if h[K+i-1] - h[i] < Min:
    Min = h[K+i-1] - h[i]
    
print(Min)

Measured memory_bytes: 7384
import heapq

n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for _ in range(m)]
heapq.heapify(a)
bc.sort(key=lambda x:-x[1])
br=0
for b,c in bc:
    for _ in range(b):
        a_mn=heapq.heappop(a)
        if a_mn>=c:
            heapq.heappush(a,a_mn)
            br=1
            break
        heapq.heappush(a,c)
    if br:break
print(sum(a))

Measured memory_bytes: 36176
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using vi = vector<int>;
using vl = vector<int64_t>;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64_t INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n; cin >> n;
  
  vector<int> a(n);
  map<int, int> mp;

  rep(i, n) {
    cin >> a[i];
    ++mp[a[i]];
  }

  sort(all(a));
  a.erase(unique(all(a)), a.end());

  int SIZE = a.size();

  int ans = 0;

  rep(i, SIZE) {
    if (mp[a[i]] >= a[i]) {
      ans += mp[a[i]] - a[i];
    } else {
      ans += mp[a[i]];
    }
  }

  cout << ans << '\n';

  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b; cin>>a>>b;

	if (a>b){
		cout << "a > b\n";
	}else if(a<b){
		cout << "a < b\n";
	}else{
		cout << "a == b\n";
	}
	return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	int b;
	cin >> b;
	for (int a = 1; a < 10; ++a) {
		if (b % a == 0 && b / a > 0 && b / a < 10) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

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

typedef long long ll;

int main(){
    ll Q,H,S,D,N,ans;
    cin >> Q >> H >> S >> D >> N;
    vector<pair<ll,ll>> tanka(4);
    tanka[0] = make_pair(Q*8,4);
    tanka[1] = make_pair(H*4,2);
    tanka[2] = make_pair(S*2,1);
    tanka[3] = make_pair(D,100);
    sort(tanka.begin(),tanka.end());
    if (N % 2 == 0){
        ans = tanka[0].first * N / 2;
    }else if (N % 2 != 0 && tanka[0].second == 100){
        ans = (tanka[0].first * (N-1) + tanka[1].first)/2;
    }else{
        ans = (tanka[0].first * N)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

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

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}


//Variables Declaration

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
  ll count=0;
  ll r=0,g=0,b=0;
  char RGB[4004];
	cin >> n;
  cin >>RGB;
  for(int i=0 ; i< n ; ++i){
    if(RGB[i]=='R')r++;
    else if(RGB[i]=='G')g++;
    else if(RGB[i]=='B')b++;
  }
  count=r*g*b;
  for(int i=0 ; i<n-1 ; ++i){
    for (int j = i+1; j < n-1; j++) {
      if(RGB[i]!=RGB[j]){
          if((2*j)-i<n && RGB[(2*j)-i]!=RGB[j] && RGB[i]!=RGB[(2*j)-i])count--;
      }
    }
  }
  cout<<count;
	return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
/*

*/
int main(){
  ll N; cin>>N;
  vector<ll> C(4,0);
  for(ll i=0; i<N; i++){
    string S; cin>>S;
    if(S[0]=='A')
      C[0]++;
    else if(S[0]=='W')
      C[1]++;
    else if(S[0]=='T')
      C[2]++;
    else
      C[3]++;
  }
  cout<<"AC x "<<C[0]<<endl;
  cout<<"WA x "<<C[1]<<endl;
  cout<<"TLE x "<<C[2]<<endl;
  cout<<"RE x "<<C[3]<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;

int gcd(int a,int b)
{
    int r;
    if(a < b){
        swap(a, b);
    }
    while(b>0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

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

    int x, y, ans;
    cin>>x>>y;

    if(x >= y){
        ans = gcd(y, x%y);
    }
    else{
        ans = gcd(x, y%x);
    }

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


Measured memory_bytes: 3176
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n;
    int w=0;
    cin >> n;
    vector<int> A(n,0);
    for(int i=0 ;i<n; i++){
        cin >> A[i];
        if(i%2==0) w+= A[i];
        else w-= A[i];
    }
    //M[i]= A[i-1]-A[i-2]+A[i-3]-..A[0].A[n-1]...+A[i] となる。(環状)
    // cerr << w << endl;
    for(int i=0; i<n; i++){
        if(i!=0){
            w=-w+2*A[i-1];
        }
        cout << w;
        if(i!=n-1) cout << " ";
    }
    cout << endl;

}

Measured memory_bytes: 1664