akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(){
	int n, ok = 1;
	char memo[100][11] = { "\0" };
	char w[11];
	char old;

	scanf("%d", &n);
	scanf("%s", w);
	old = w[strlen(w) - 1];

	for (int i = 0; i < strlen(w); ++i) {
		memo[0][i] = w[i];
	}

	for (int i = 1; i < n; ++i) {
		scanf("%s",w);

		if (old != w[0]) {
			ok = 0;
		}
		old = w[strlen(w) - 1];

		for (int k = 0; k < strlen(w); ++k) {
			memo[i][k] = w[k];
		}
	}

	for (int i = 0; i < n; ++i) {
		for (int k = i + 1; k < n; ++k) {

			if (strlen(memo[i]) == strlen(memo[k])) {
				int same = 0;

				for (int j = 0; j < strlen(memo[i]); ++j) {
					if (memo[i][j] == memo[k][j]) {
						same += 1;
					}
				}

				if (same == strlen(memo[i])) {
					ok = 0;
				}
			}
		}
	}

	printf("%s", ok ? "Yes" : "No");


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>S;
    vec a(3,0);
    rep(i,3) ++a[S[i] - 'a'];
    cout<<((a[0] & a[1] & a[2]) == 1 ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=100100;
int n,ans=0;
ll m,v,p;
ll a[MAXN],pref[MAXN];
int main()
{
    cin>>n>>m>>v>>p;
    ans=p;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);//6 5 4 3 2 1
    for(int i=0; i<n; i++)
    {
        pref[i+1]=pref[i]+a[i];
    }
    for(int i=p; i<n; i++)
    {
        if(a[i]+m<a[p-1]) break;
        ll cur=v-(n-(i-p+1));
        if(cur<=0) 
        {
            ans++;
            continue;
        }
        if(cur*m<=(i-p+1)*(a[i]+m)-(pref[i]-pref[p-1]))
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
a = list(map(int, input().split()))
print(
    min(
    [abs(a[0]-a[1])+abs(a[1]-a[2]), abs(a[0]-a[2])+abs(a[1]-a[0]), abs(a[0]-a[2])+abs(a[1]-a[2])]
    )
)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define gc getchar
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define repo(i, n) for (__typeof(n) i = 1; i <= n; i++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define lc 2 * x // if tree index id 0 based
#define lr 2 * x + 1
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 1e6 + 6;
/*

bool comp(string a, string b)
{
    return a.size() < b.size();
}
*/

ll a[10005], tree[100005], ans[10005];
void build(ll l, ll r, ll x)
{
    if (l == r)
        tree[x] = a[l];
    else
    {
        ll mid = (l + r) >> 1;
        build(l, mid, lc);
        build(mid + 1, r, lr);
        tree[x] = tree[lc] & tree[lr];
    }
}
ll query(ll lx, ll ly, ll l, ll r, ll x)
{
    if (l > r || lx > r || ly < l)
        return 1122343442;
    if (lx <= l && r <= ly)
        return tree[x];
    ll mid = (l + r) >> 1;
    ll ans;
    ans = query(lx, ly, l, mid, lc);
    ans &= query(lx, ly, mid + 1, r, lr);
    return ans;
}
int main()
{
    ll n, cnt = 0;
    cin >> n;
    string s;
    cin >> s;
    rep(i, n)
    {
        while (i + 1 < n && s[i] == s[i + 1])
            i++;
        cnt++;
    }
    c(cnt)
}

Measured memory_bytes: 512
use POSIX;
($N,$A,$B,@@)=glob`dd`;
$a=($%=1<<30)-1;
map{
  $==$i=$a-$%;
  $=-=ceil(($-=$_-$B*$i)/($A-$B))for@@;
  $a-=$%*($=>=0);
  $%/=2;
  # print"$% $a $i $=$/";
}1..35;
print$i;

Measured memory_bytes: 28700
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_N 200

int top, S[MAX_N];

void push(int x) {
    S[++top] = x;
}

int pop(void) {
    return S[top--];
}


int main(void) {
    top = 0;
    char line[20];

    int a, b;
    while (scanf("%s", line) != EOF) {
        if (line[0] == '+') {
            a = pop();
            b = pop();
            push(b+a);
        } else if (line[0] == '-') {
            a = pop();
            b = pop();
            push(b-a);
        } else if (line[0] == '*') {
            a = pop();
            b = pop();
            push(b*a);
        } else {
            push(atoi(line));
        }
    }

    printf("%d\n", pop());

    return 0;
}

Measured memory_bytes: 548
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

using namespace std;

//===================================== template =========================================================

int main()
{
    int N; string S; cin >> N >> S;
    vector<vector<int>> dp(N, vector<int>(N, 0));
    REP(j, N) dp[N-1][j] = S[N-1] == S[j];
    REP(i, N) dp[i][N-1] = S[N-1] == S[i];
    for (int i = N-2; i > 0; --i)
        REP(j, N-1)
            if(S[i] == S[j]) dp[i][j] = dp[i+1][j+1] + 1;
    int mlen = 0;
    REP(i, N) REP(j, N) chmax(mlen, min(abs(i-j), dp[i][j]));
    cout << mlen << endl;
}


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

vector<int> a(1000000);
int func(int);
bool check(int);

int main() {
  cin >> a.at(0);

  int answer = -1;
  //iに対して、i+1を計算する。
  //i+1でcheckを呼び出す
  for (int i=0;i<1000000-1;i++){
    a.at(i+1)= func(a.at(i));
    if (check(i+1)){
      answer = i+1;
      break;
    }
  }

  cout << answer << endl;
}

int func(int n){
  if (n%2==0){
    return n/2;
  } else {
    return 3*n+1;
  }
}

bool check(int length){
  if (length==1) return false;
  for (int i=0;i<length-1;i++){
    if (a.at(i)== a.at(length-1)){
      return true;
    }
  }
  return false;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("nocross.in","r",stdin)
#define OUT freopen("nocross.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define ROF(i,a,b) for(i=a ; i>=b ; i--)
#define DBG pf("Hi\n")
#define INF 2000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
// #define off 1000000
#define sq(x) ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

template <class T>  inline void smax(T &x,T y){ x = max((x), (y)); }
template <class T>  inline void smin(T &x,T y){ x = min((x), (y)); }

// typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
    string s ;

    cin>>s ;

    for(int i=s.size() - 1 ; i>=1 ; i--)
    {
        if(s[i]=='C' && s[i-1]=='A')
        {
            printf("Yes\n") ;
            return 0 ;
        }
    }
    printf("No\n") ;
    return 0 ;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  ll M, K;
  cin >> M >> K;
  // We can meke 0..(2**M-1).
  // So if K >= 2**M, it can't be made.
  if (K >= 1<<M) {
    cout << -1 << endl;
    return 0;
  }

  // Treat M=1
  if ((M == 1) && (K == 1)) {
    cout << -1 << endl;
    return 0;
  }
  if ((M == 1) && (K == 0)) {
    cout << "0 0 1 1" << endl;
    return 0;
  }

  vector<ll> tmp;
  rep(i, 1<<M) {
    if (i != K) {
      tmp.push_back(i);
    }
  }
  for (auto x : tmp) {
    cout << x << " ";
  }
  cout << K << " ";
  rep(i, (1<<M)-1) {
    cout << tmp[tmp.size() - 1 - i] << " ";
  }
  cout << K << endl;;
}


Measured memory_bytes: 2932
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

ans = "No"

for i in range(N - M + 1):
    for j in range(N - M + 1):
        c = 0
        for x in range(M):
            if A[x + i][j:j + M] == B[x]:
                c += 1
        if c == M:
            ans = "Yes"
            break
    else:
        continue
    break

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define optimize ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define INF 2000000020LL
#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define POS(n, x) (lower_bound(ALL(n), x) - (n).begin())
#define ll long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define PB push_back
#define EB emplace_back
#define MOD 1000000007
#define PRIME 101 
#define MAXN 200020
#define MAXL 23
#define endl '\n'

using namespace std;

// (1 + sqrt(5)) / 2
const ld GOLDEN_RATIO = 1.6180339887498949025257388711906969547271728515625;
const ld PI = acos(-1.0);
const int BLOCK = 333;

ll arvore[4 * MAXN];

struct Flower
{
	int h, a;

	Flower(int h = 0, int a = 0) : h(h), a(a) {}

	bool operator < (const Flower &a) const
	{
		return h < a.h;
	}
};

vector<Flower> flowers;

void update(int no, int l, int r, int pos, ll v)
{
	if(pos < l || pos > r) return;

	if(l == r) return (void)(arvore[no] = v);

	int e = 2 * no;
	int d = e + 1;
	int m = (l + r) / 2;

	update(e, l, m, pos, v);
	update(d, m + 1, r, pos, v);

	arvore[no] = max(arvore[e], arvore[d]);
}

ll query(int no, int l, int r, int a, int b)
{
	if(b < l || a > r || b < a) return -INF;

	if(a <= l && r <= b) return arvore[no];

	int e = 2 * no;
	int d = e + 1;
	int m = (l + r) / 2;

	return max(query(e, l, m, a, b), query(d, m + 1, r, a, b));
}

int main(int argc, char const *argv[])
{
	optimize;
	
	int N, h, a;

	cin >> N;

	for(int i = 0; i < N; i++)
	{
		cin >> h;

		flowers.EB(h);
	}

	for(int i = 0; i < N; i++)
	{
		cin >> a;

		flowers[i].a = a;
	}

	// sort(ALL(flowers));

	for(auto &f : flowers)
	{
		ll best = query(1, 1, N, 1, f.h);
		update(1, 1, N, f.h, best + f.a);
	}

	cout << arvore[1] << endl;

	return 0;
}

Measured memory_bytes: 9084
rect = [(i**2+j**2, i, j) for i in range(1,150) for j in range(i+1, 150)]
rect.sort()
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0: break
    _, n_h, n_w = rect[rect.index((h**2+w**2, h, w))+1]
    print(n_h, n_w)

Measured memory_bytes: 8028
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
4
101 9901 999999000000 1000000000000000000
*/

bool over=false;
ll n,a,p=1;
double pd=1;

int main(void){
	cin>>n;
	rep(i,n){
		cin>>a;
		p *= a;
		pd *= a;
	}
	cout<<(pd>5e18 || (pd<=5e18 && p>1000000000000000000LL) ? -1 : p)<<endl;
	return 0;
}

Measured memory_bytes: 3548
#include<stdio.h>

int n, A[50];

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

int main()
{
	int q, M, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &A[i]);
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &M);
		if (solve(0, M)) printf("yes\n");
		else printf("no\n");
	}

	return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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;
}

signed main() {
  int N, K;
  int R, S, P;
  string T;

  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> T;
  int ans = 0;
  rep(i, N) {
    if (T[i] == 'r') ans += P;
    if (T[i] == 's') ans += R;
    if (T[i] == 'p') ans += S;
  }

  PRINT(ans);
  for (int i = 0; i < K; i++) {
    char lastData = 'x';
    for (int j = i; j < N; j += K) {
      if (lastData == T[j]) {
        if (lastData == 'r') ans -= P;
        if (lastData == 's') ans -= R;
        if (lastData == 'p') ans -= S;
        PRINT(j)
        PRINT(ans)
        PRINT(lastData)
        lastData = 'x';
      } else {
        lastData = T[j];
      }
    }
  }
  cout << ans << endl;
}

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

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  constexpr ModInt() : x(0) {}
  constexpr ModInt(int64_t y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  constexpr ModInt &operator+=(const ModInt &p) noexcept {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt &p) noexcept {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt &p) noexcept {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  constexpr ModInt &operator/=(const ModInt &p) noexcept {
    *this *= p.inverse();
    return *this;
  }
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt operator+(const ModInt &p) const noexcept {
    return ModInt(*this) += p;
  }
  constexpr ModInt operator-(const ModInt &p) const noexcept {
    return ModInt(*this) -= p;
  }
  constexpr ModInt operator*(const ModInt &p) const noexcept {
    return ModInt(*this) *= p;
  }
  constexpr ModInt operator/(const ModInt &p) const noexcept {
    return ModInt(*this) /= p;
  }
  constexpr bool operator==(const ModInt &p) const noexcept { return x == p.x; }
  constexpr bool operator!=(const ModInt &p) const noexcept { return x != p.x; }
  constexpr ModInt inverse() const noexcept {
    int a = x, b = mod, u = 1, v = 0, t = 0;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  constexpr ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend constexpr ostream &operator<<(ostream &os, const ModInt &p) noexcept {
    return os << p.x;
  }
  friend constexpr istream &operator>>(istream &is, ModInt &a) noexcept {
    int64_t t = 0;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  constexpr int get_mod() { return mod; }
};

int n, s = 0;
vector<int> a;

ModInt<> solve();

int main() {
  cin >> n;
  a.resize(n);
  for (auto &p : a) {
    cin >> p;
    s ^= p;
  }
  cout << solve() << endl;
  return 0;
}

ModInt<> solve() {
  ModInt<> res;
  // zero
  if (!s) {
    int now = 0, zero = 0;
    for (int i = 0; i < n; ++i) {
      now ^= a[i];
      if (!now) ++zero;
    }
    res += ModInt<>(2).pow(zero - 1);
  }
  // nonzero
  {
    int now = 0, zero = 0;
    vector<int> cnt(1 << 20, 0);
    vector<vector<ModInt<>>> dp(2, vector<ModInt<>>(1 << 20, 1));
    dp[1].assign(1 << 20, 0);
    for (int i = 0; i < n; ++i) {
      now ^= a[i];
      if (now) {
        dp[0][now] += dp[1][now] * (zero - cnt[now]);
        dp[1][now] += dp[0][now];
        cnt[now] = zero;
      } else
        ++zero;
    }
    if (!s)
      for (auto p : dp[1]) res += p;
    else
      res = dp[0][s];
  }
  return res;
}


Measured memory_bytes: 21700
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;

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

	bool twinFlg = false;
	while (true) {
		C -= B;
		if (0 >= C) {
			twinFlg = true;
			break;
		}
		A -= D;
		if (0 >= A) {
			twinFlg = false;
			break;
		}
	}
	if (twinFlg) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


}




Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int a, b, c; cin >> a >> b >> c;
	int p = max(a, max(b, c)) * 3 - (a + b + c);
	if (p % 2 == 1)p += 3;
	cout << p / 2 << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1000000000;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    int h[n];
    int hmax = 0;
    for(int i=0;i<n;i++){
        cin >> h[i];
        hmax = max(h[i], hmax);
    }
    int cnt = 0;
    for(int i=1;i<=hmax;i++){
        bool conn = false;
        for(int j=0;j<n;j++){
            if(h[j] >= i && !conn){
                cnt++;
                conn = true;
            }else if(h[j] < i){
                conn = false;
            }
        }
        // cout << cnt << endl;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int num[100000];
int tmp[3];
int main()
{
	int count=0;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&num[i]);
	}
	//printf("TEST");
	
	for(int i=1;i<n-1;i++)
	{
		tmp[0]=num[i-1];
		tmp[1]=num[i];
		tmp[2]=num[i+1];
		sort(tmp,tmp+3);
		if(num[i]==tmp[1])
		count++;
	}
	printf("%d",count);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}


const int N = 200005;
vector<int> seen(N);
vector<int> use(N); // 辺
vector<vector<pii> > G(N);
vector<int> x;

int dfs(int v) {
  seen[v] = 1;
  int c = x[v];
  for (pii p : G[v]) {
    int nv = p.F;
    if (seen[nv]) continue;
    // cout << nv << endl;
    int d = dfs(nv);
    c ^= d;
    // その下の頂点を 0 に
    use[p.S] = d;
  }
  // cout << "c " << v << " " << c << endl;
  return c;
}

// youtube editorial
void solve() {
  int n, m;
  cin >> n >> m;

  vector<pii> v(n);
  rep(i, n) cin >> v[i].F >> v[i].S;
  sort(all(v));

  // 差をとる
  // 差なら, 2 箇所を変えるだけ
  x.eb(v[0].S);
  rep(i, n - 1) x.eb(v[i].S ^ v[i + 1].S);
  x.eb(v[n - 1].S);
  // cout << x << endl;

  // 辺を作る
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    l = lb(v, pii(l, 0));
    r = ub(v, pii(r, 1));

    G[l].eb(r, i);
    G[r].eb(l, i);
  }

  rep(i, n + 1) {
    // どこから dfs してもいい
    if (seen[i]) continue;

    if (dfs(i)) {
      cout << -1 << endl;
      return;
    }
  }
  cout << accumulate(all(use), 0) << endl;
  rep(i, m) if (use[i]) cout << i + 1 << " "; cout << endl; // debuged, n to m
}


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

#define int long long

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

#define len(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    t.pop_back();
    cout << (s == t ? "Yes\n" : "No\n");
    return 0;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

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

    int i,n,x;
    LL ans=0;
    cin >> n;
    int monsters[n+1],heroes[n];
    for(i=0;i<=n;i++)cin >> monsters[i];
    for(i=0;i<n;i++)cin >> heroes[i];
    for(i=0;i<n;i++)
    {
        x=min(heroes[i],monsters[i]);
        ans+=x;
        heroes[i]-=x,monsters[i]-=x;
        if(heroes[i] > 0)
        {
            x=min(heroes[i],monsters[i+1]);
            ans+=x;
            monsters[i+1]-=x;
        }
    }
    cout << ans;
    return 0;
}


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

using namespace std;

vector<long long> pat[51][51];

int f(int n, int a, int b, int k, long long bit) {
  if (n == b) {
    pat[a][b].push_back(bit);
    return 1;
  }
  if (n < b) return 0;
  int res = 0;
  for (int i = k - 1; i >= 1; i--) {
    if (i <= n) {
      res += f(n % i, a, b, i, bit | 1LL << i);
    }
  }
  return res;
}

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

  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    f(a[i], a[i], b[i], 51, 0);
    if (pat[a[i]][b[i]].empty()) {
      cout << -1 << endl;
      return 0;
    }
  }

  long long ans = 0;
  for (int i = 50; i >= 1; i--) {
    bool all = true;
    for (int j = 0; j < n; j++) {
      bool ex = false;
      for (long long k : pat[a[j]][b[j]]) {
        if (~k >> i & 1) {
          ex = true;
        }
      }
      if (!ex) all = false;
    }
    if (!all) {
      ans |= 1LL << i;
    } else {
      for (int j = 0; j < n; j++) {
        auto &v = pat[a[j]][b[j]];
        auto it = remove_if(v.begin(), v.end(), [&](long long k) { return k >> i & 1; });
        v.erase(it, v.end());
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
A, B, C = map(int,input().split())
L = [A%2,B%2,C%2]
ALL = [A,B,C]
cnt = 0

if L.count(0) == 3 or L.count(0) == 0:
    cnt += 0
elif L.count(0) == 2:
    for i in range(3):
        if L[i] == 0:
            ALL[i] += 1
    cnt += 1
elif L.count(0) == 1:
    for i in range(3):
        if L[i] == 1:
            ALL[i] += 1
    cnt += 1

ans = 3*max(ALL)- sum(ALL)

print(ans//2+cnt)

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

int main() {
  int w,h,n; cin>>w>>h>>n;
  vector<int> x(n),y(n),a(n);
  rep(i, n) cin>>x[i]>>y[i]>>a[i];
  int sx=0, gx=w;
  int sy=0, gy=h;
  rep(i, n) {
    if (a[i]==1) sx=max(sx, x[i]);
    if (a[i]==2) gx=min(gx, x[i]); 
    if (a[i]==3) sy=max(sy, y[i]);
    if (a[i]==4) gy=min(gy, y[i]);
  }
  if (sx>=gx||sy>=gy) cout<<0<<endl;
  else cout<<(gx-sx)*(gy-sy)<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main (String[] args) {
        Scanner in = new Scanner(System.in);
        int K = in.nextInt();
        int X = in.nextInt();
        
        int MIN = -1000000;
        int MAX = 1000000;
        
        int min = MIN < X-K+1 ? X-K+1 : MIN;
        int max = MAX > X+K-1 ? X+K-1 : MAX;
        
        for(int i=min; i<=max; i++) {
            System.out.print(i+" ");
        }
    }
}

Measured memory_bytes: 22868
#include<iostream>

using namespace std;

int main() {
	int x =0 , y = 0 , obj = 0;
	cin >> x >> y >> obj;
	int count = 0;
	for (int i = x; i <= y;i++) {
		if (obj%i == 0) {
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

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

using namespace std;
#define ll long long
const int Max=1e6+7;
ll a,b,c,k;

int main(){
    ios::sync_with_stdio(0);
    scanf("%lld%lld%lld",&a,&b,&c);
    scanf("%lld",&k);
    if(k%2==0) printf("%lld\n",a-b);
    else printf("%lld\n",b-a);
    return 0;
}

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

int main(){
  int CurrencyNum, result;
  cin >> CurrencyNum >> result;
  for(int i = 0; i <= CurrencyNum; i++){
     for(int ii = 0; ii <= CurrencyNum - i; ii++){
       int z = CurrencyNum - (i + ii);
        if(CurrencyNum == i + ii + z && 
           10000*i + 5000*ii + 1000*z == result){
            cout << i << " " << ii <<  " " << z;
           return 0;
        }
     }
  }
  std::cout << "-1 -1 -1";
  return 0;
}

Measured memory_bytes: 256
def main():
    S, T = input().split(" ")
    A, B = map(int, input().split(" "))
    U = input()

    if U == S:
        A -= 1
    elif U == T:
        B -= 1
    
    ans = str(A) + " " + str(B)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		String c1 = scan.next();
		String c2 = scan.next();

		if (c1.charAt(0) == c2.charAt(2) && c1.charAt(2) == c2.charAt(0) && c1.charAt(1) == c2.charAt(1)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 23252
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for (int i = 0; i < h; ++i) {
        cin >> a[i];
    }
    int x = 0;
    int y = 0;
    a[0][0] = '.';
    while (!(y == h - 1 && x == w - 1)) {
        if (y < h - 1 && a[y + 1][x] == '#') {
            a[y + 1][x] = '.';
            y++;
        } else if (x < w - 1 && a[y][x + 1] == '#') {
            a[y][x + 1] = '.';
            x++;
        } else {
            break;
        }
    }
    bool ok = true;
    for (int i = 0; i < h; ++i) {
        if (a[i] != string(w, '.')) {
            ok = false;
            break;
        }
    }
    if (ok) {
        cout << "Possible"
             << "\n";
    } else {
        cout << "Impossible"
             << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 110000;
long long w[MAXN], v[MAXN], dp[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int N, W;
  cin >> N >> W;
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }
  for(int i = 0; i < N; i++){
    for(int j = W; j >=0; j--){
      if(j + w[i] <= W) dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
    }
  }
  long long ans = 0;
  for(int i = 0; i <= W; i++)
    ans = max(dp[i], ans);
  cout << ans;
  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<ctype.h>
using namespace std;
int main()
{
    int a;
    int b;
    int c;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        if(!isdigit(a)&&!isdigit(b))
        {
            c=2*b-a;
            printf("%d",c);
        }
    }
}


Measured memory_bytes: 256
#include <iostream>

 

 

 

using namespace std;

 

 

 

int main()
{
    int i, x;
    
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if(x == 0)
          cout << ""<< endl;
          else
        
        cout << "Case" <<" "<< i <<  ":" << " " << x << endl;
    }
}


Measured memory_bytes: 2968
def match(s, i, t)
  t.size.times do |j|
    if i + j >= s.size then
      return false
    end
    
    if s[i + j] != t[j] && s[i + j] != '?' then
      return false
    end
  end
  
  return true
end

def replace(s, i, t)
  t.size.times do |j|
    s[i + j] = t[j]
  end
  return s
end

def fill(s, c)
  s.size.times do |i|
    if s[i] == '?' then
      s[i] = c
    end
  end
  return s
end

def main(argv)
  s = gets.chomp
  t = gets.chomp
  
  n = s.size
  m = t.size
  
  v = []
  (n - m + 1).times do |i|
    if match(s, i, t) then
      v.push( fill(replace(s.dup, i, t), 'a') )
    end
  end
  
  if v.size > 0 then
    puts v.sort{|a, b| a <=> b}[0]
  else
    puts 'UNRESTORABLE'
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

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

int main()
{

	int a,b,n;
	cin>>a>>b;
	
if(b/10 == 0) n=10;
else if(b/100==0) n=100;
else n=1000;

ll s=a*n+b,q;
q=sqrt(s);
if(q*q==s) cout<<"Yes"<<endl;
else cout<<"No"<<endl;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N;
  cin >> N;
  vector <int> W(N);
  int sum = 0;

  rep(i,N){
    cin >> W[i];
    sum += W[i];
  }

  int mini = sum;
  int prefix_sum = 0;
  rep(i, N){
    cin >> W[i];
    prefix_sum += W[i];
    mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
  }

  cout << mini << endl;
}


Measured memory_bytes: 3656
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;

template< typename T >
struct Edge {
  int from, to;
  T cost;
  Edge() {}
  Edge(int f, int t) : from(f), to(t), cost(1) {}
  Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

template< typename T >
using Edges = std::vector< Edge< T > >;
template< typename T >
using Graph = std::vector< Edges< T > >;

map<int, int> e2id;
int _id(int a, int b){
  if (a > b) swap(a, b);
  return a*51+b;
}

bool dfs(Graph<int> &g, int s, int goal, int par, ll &keiro) {
  if (s == goal) {
    keiro |= (1LL<<(e2id[_id(s,par)]));
    return true;
  }
  for (auto e: g[s]) {
    if (e.to == par) continue;
    bool ok = dfs(g, e.to, goal, s, keiro);
    if (ok) {
      if (par != -1) {
        keiro |= (1LL<<(e2id[_id(s,par)]));
      }
      return true;
    }
  }
  return false;
}

int count(ll mask) {
  ll t = 1;
  int ret = 0;
  for (int i = 0; i < 55; ++i) {
    if (t & mask) ++ret;
    t *= 2;
  }
  return ret;
}

int main() {
  int n; cin >> n;
  Graph<int> g(n);
  for (int i = 0; i < n-1; ++i) {
    int a, b;
    cin >> a >> b; --a; --b;
    g[a].emplace_back(a, b);
    g[b].emplace_back(b, a);
    e2id[_id(a, b)] = i;
  }
  int m; cin >> m;
  vector<ll> lm;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b; --a; --b;
    ll keiro = 0;
    dfs(g, a, b, -1, keiro);
    lm.push_back(keiro);
    assert(keiro > 0);
  }
  vector<ll> pow2;
  ll p2 = 1;
  for (int i = 0; i <= 51; ++i) {
    pow2.push_back(p2);
    p2 *= 2;
  }
  ll dp[1<<21];
  ll ans = 0;
  for (int mask = 0; mask < (1<<m); ++mask) {
    int cnt = __builtin_popcount(mask);
    assert(cnt >= 0 && cnt <= m);
    dp[mask] = 0;
    for (int i = 0; i < m; ++i) {
      int flag = 1<<i;
      if (flag & mask) dp[mask] |= lm[i];
    }
    int v = count(dp[mask]);
    assert(n-1-v >= 0);
    ll val = pow2[n-1-v];
    if (cnt % 2 == 0) { ans += val; }
    else { ans -= val; }
    // cout << mask << " " << cnt << " " << v << " " << dp[mask] << " " << val << " " << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi pair<int, int>
#define M 1000000007

// pi.first is the no. of ways if root is white
// pi.second is the no. of ways if root is black
pi dfs(vector<int> edges[], int sv, int parent){

    // We have 2 options: make the current 'sv' as black or white
    // If we make it black, then all of its children must be white
    // If we make it white, then either all children are white or
    // some children are black

    // Take example of tree
    //           1
    //         / | \
    //        2  3  4
    // B1 is the no. of ways if the root node is to be black
    // W1 is the no. of ways if the root node is to be white
    // B1 = W2*W3*W4
    // W1 = W2*W3*W4 + B2*W3*W4 + W2*B3*W4 + W2*W3*B4 + B2*B3*W4 + B2*W3*B4 +
    //      W2*B3*B4 + B2*B3*B4

    // Suppose we are at the third child (4)
    // We already have these values
    // B1 = W2*W3
    // W1 = W2*W3 + B2*W3 + W2*B3 + B2*B3
    // Now we get B4 and W4 from the recursion for the third child
    // Then B1 = B1*W4
    //      W1 = W1*(W4 + B4)
    // (If the current node is to be black, then child must be white)
    // (If the current node is to be white, then child can be either black or white)
    // On expanding, we get the above values

    ll w = 1, b = 1;

    for(int child: edges[sv]){
        if(child == parent)
            continue;
        pi childAns = dfs(edges, child, sv);
        ll childW = childAns.first, childB = childAns.second;
        b = (b*childW)%M;
        w = (w*((childW + childB)%M))%M;
    }

    pi ans = {w, b};
    return ans;
}

int independentSet(vector<int> edges[], int n){

    pi rootAns = dfs(edges, 0, -1);
    ll ans = (rootAns.first + rootAns.second)%M;
    return ans;
}

int main()
{
 int n;
 cin>>n;
 vector<int> edges[n];
 int u, v;
 for(int i=0; i<n-1; i++){
    cin>>u>>v;
    edges[u-1].push_back(v-1);
    edges[v-1].push_back(u-1);
 }
 int ans = independentSet(edges, n);
 cout<<ans;
 return 0;
}


Measured memory_bytes: 16028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	bool f = true;
	string s; cin >> s;
	int l = s.length() / 2;
	rep(i, l)if(s[i] != s[s.length() - i - 1]) f = false;
	rep(i, l / 2)if(s[i] != s[l - i - 1]) f = false;
	rep(i, l / 2)if(s[l + i + 1] != s[s.length() - i - 1]) f = false;
	Yes(f);
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int Gcd(int a, int b)
{
    if (b > 0) {
        return Gcd(b, a % b);
    } else {
        return a;
    }
}

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

    vector<int> xi(n, 0);
    vector<int> diff(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> xi[i];
        diff[i] = abs(xi[i] - x);
    }

    if (n == 1) {
        cout << diff[0] << endl;
        return 0;
    }

    int ret = Gcd(diff[0], diff[1]);
    for (int i = 2; i < n; i++) {
        ret = Gcd(ret, diff[i]);
    }

    cout << ret << endl;

    return 0;
}


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

#define print(x) cout << #x << '=' << x << endl


int main()
{
	string s1,s2,s3;
	cin >> s1 >> s2 >> s3;

	cout << s1[0] << s2[1] << s3[2] << endl;

	
	return 0;
}


Measured memory_bytes: 3592
import collections

n = int(input())
v = list(map(int, input().split()))

if len(list(set(v))) == 1:
    print(int(n/2))
    exit()
    
v1 = []
v2 = []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
v1 = collections.Counter(v1)
v2 = collections.Counter(v2)

v1_cnt = v1.most_common()
v2_cnt = v2.most_common()

if len(v1_cnt) > 1:
    e1 = v1_cnt[0]
    e2 = v1_cnt[1]
else:
    e1 = v1_cnt[0]
    e2 = e1
if len(v2_cnt) > 1:
    d1 = v2_cnt[0]
    d2 = v2_cnt[1]
else:
    d1 = v2_cnt[0]
    d2 = d1

if e1[0] != d1[0]:
    print(n - e1[1] - d1[1])
else:
    more = max(e1[1] + d2[1], e2[1] + d1[1])
    print(n - more)



Measured memory_bytes: 23772
#include <stdio.h>

int gcd(int a, int b) {
	while(b) { int t = b; b = a % b; a = t; }
	return a;
}

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b)!=EOF) {
		int g = gcd(a, b);
		printf("%d %d\n", g, a/g*b);
	}
	return 0;
}

Measured memory_bytes: 0
N, Q =map(int, input().split())

data = [0]*(N+1)
def add(k, x):
  while k <= N:
    data[k] += x
    k += k & -k
def get(k):
  s = 0
  while k:
    s += data[k]
    k -= k & -k
  return s

ans = []
for q in range(Q):
  a = input()
  if a[0] == "1":
    ans.append(str(get(int(a[2:]))))
  else:
    s, t, x = map(int, a[2:].split())
    add(s, x)
    if t < N:
      add(t+1, -x)
for i in ans:
  print(i)


Measured memory_bytes: 12956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100010;
ll x[N],y[N];
int n;
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; ++i){
		scanf("%lld%lld",&x[i],&y[i]);
	}
	x[0]=-1e17;
	y[0]=0;
	for (int c=61; c>=0; c--){
		ll p=1ll<<c;
		bool light=0;
		for (int i=1; i<=n; ++i){
			ll disx=x[i]-x[0];
			ll disy=(y[0]|p)-y[i];
			if (disy<0||disy>disx) continue;
			light^=((disx&disy)==disy);
		}
		if (light) y[0]|=p;
	}
	cout<<x[0]+y[0];
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define LL(x) ll x; scanf("%lld",&x)
#define INPUT(x) cin >> x
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF_INT 2147483647
#define INF_LL 9223372036854775807

typedef long long ll;

int main(){
    map<string, bool> ma;
    INT(N);
    REP1(i,N){
        string s;
        cin >> s;
        ma[s] = true;
    }
    int count = ma["P"] + ma["W"] + ma["G"] + ma["Y"];
    cout << ((count == 4)? "Four": "Three") << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
   
// g++ -std=c++11 prac.cpp
        
int main(){
    int a,b,c,n,x,y,m=0,k,w,sum=0,ans=0,Max=-1e9,count=0,Min=1e9+1;
    string s,t,u;
    bool ok=true;
    cin >> s;
    rep(i,s.size()/2){
        if(s[i]!=s[s.size()-1-i])
            ans++;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back

using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

template<class T,class U>
void chmin(T& t,U u){
	if(ll(t)>ll(u))
		t=u;
}

template<class T,class U>
void chmax(T& t,U u){
	if(ll(t)<ll(u))
		t=u;
}

//?????????????????????????????????
int main(){
	int n,m;
	cin>>n>>m;
	ll ans=0;
	REP(i,n){
		cout<<"lst "<<i<<endl;
		ll k;
		cin>>k;
		REP(_,k){
			ll tmp;
			cin>>tmp;
		}
		ans+=k*(k-1);
	}
	cout<<"ans "<<ans<<endl;
}

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

int main(){
  int h, w; cin >> h >> w;
  char grid[h+1][w+1];

  int cnt = 0;
  for(int y=1; y<=h; y++){
    for(int x=1; x<=w; x++) {
      cin >> grid[y][x];
      if(grid[y][x] == '#') cnt++;
    }
  }

  if(cnt == h+w-1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;

  return 0;
}


Measured memory_bytes: 256