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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

int rec(int level, int n, int a)
{
	if(level==n)
	{
		return a;
	}

	rec(level+1, n, a);
	for(int i = a+1; i<=n; i++)
	{
		rec(level+1, n, a+1);
	}
	// ans.pb()
	// rec(level+1, n, a+1);
}

int best = imn;
int q, m, n;
int rec_fn(int i, int pivot, vector<int>& arr, vector<vector<int> >& mat)
{
	// cout<<i<<endl;

	// for(auto i: arr) cout<<i<<" ";
		// cout<<endl;
	if(i==n+1)
	{
		int sum = 0;
		for(int k = 0; k < q; k++)
		{
			if(arr[mat[k][1]-1]-arr[mat[k][0]-1]==mat[k][2])
				sum+=mat[k][3];
		}
		// cout<<sum<<endl;
		best = max(best, sum);
		// return;
		return best;
	}

	for(int j = pivot; j<=m; j++)
	{
		arr[i]=j;
		// rec_fn(i+1, j, arr, mat);//
		best = max(rec_fn(i+1, j, arr, mat), best);
		// cout<<" best "<<best<<" j "<<j<<endl;
		// return best;
	}
	return best;

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// ll x;
	// cin>>x;
	// ll start =100;
	// int i = 0;
	// while(start < x)
	// {
	// 	start= (start+(start*1)/100);
	// 	i++;
	// }
	// cout<<i<<endl;
	// int a, b, c, d;
	ll sum = 0, maxim = 0;
	cin>>n>>m>>q;
	// for(int vector<)
	vector<vector<int> > mat(q+1, vector<int> (4));
	vector<int> ans(n+1, imx);
	for(int i = 0; i < q; i++)
		for(int j = 0; j < 4; j++)
			cin>>mat[i][j];

	// for(int i = 0; i < n; i++)
	// {
	// 	for(int j = 0; j < 4; j++)
	// 	{
	// 		cout<<mat[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	// rec_fn(0, 1, ans, mat);
	// p(best);
		int an = rec_fn(0, 1, ans, mat);
		p(an);
		// p(best);
	// rec(0, n, 1);
	// while(q--)
	// {
		// cin>>a>>b>>c>>d;

	// }
}

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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

int dp[50];

int fib(int n) {
  dp[0] = dp[1] = 1;
  for (int i=2; i<=n; i++) {
    dp[i] = dp[i-1] + dp[i-2];
  }
  return dp[n];
}

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

  int ans = fib(n);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3108
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define repr(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define all(x) (x).begin(),(x).end()
//#define DEBUG
#ifdef DEBUG
#include "debug.cpp"
#endif
using namespace std;

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

    int n; cin >> n;
    long long* a = new long long[n];
    long long sum = 0;
    long long m = 10000000000;
    bool odd = false;
    rep(i, n)
    {
        cin >> a[i];
        if (a[i] < 0) odd = !odd;
        a[i] = abs(a[i]);
        m = min(m, a[i]);
        sum += a[i];
    }
    cout << sum - (odd ? 2 * m : 0) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define swap(x,y) {x^=y,y^=x,x^=y;}
using namespace std;
const int maxn=2e5+10;
int N,L,f[maxn][35],t,Q,x[maxn];
inline long long read()
{
    long long s=0,f=1; char ch; for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+ch-'0'; return s*f;
}
void Work_preparing()
{
    for(int i=1;i<=N;++i)
    {
        f[i][0]=upper_bound(x+1,x+N+1,1LL*(x[i]+L))-x-1;
        //printf("He can reach %d ,from %d in a day.\n",x[pos],x[i]);
    }
    for(int j=1;j<=t;++j)
    {
        for(int i=1;i<=N;++i)
        f[i][j]=f[f[i][j-1]][j-1];
    }
}
ll solve(int l,int r)
{
    ll ans=0;
    for(int i=t;i>=0;--i)
    {
        if(f[l][i]<r) ans+=(1<<i),l=f[l][i];
    }
    return ans+1;
}
void Input()
{
    N=read(); t=(int)(log(N)/log(2));
    for(int i=1;i<=N;++i) x[i]=read();
    L=read(); Work_preparing(); Q=read();
    while(Q--)
    {
        int a,b; a=read(),b=read();
        if(a>b)          swap(a,b);
        printf("%lld\n", solve(a,b));
    }
}
int main()
{
    Input(); return 0;
}


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

using namespace std;

int main(){
	int n, x;
	int sum = 0;
	cin >> n >> x;
	vector<int>M(n);
	for(int i = 0; i < n; i++){
		cin >> M[i];
		sum += M[i];
	}

	x -= sum;
	int ans = n;
	sort(M.begin(), M.end());
	int min = M[0];

	while(x >= min){
		x -= min;
		ans++;
	}

	cout << ans << endl;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }

    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int a = ri();
	int b = ri();
	if (b%a) cout << b-a;
	else cout << a+b;
	
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int min=100000;
int N, K;
int D[11];
int TMP;

void f(int m,int L){
	if(L>5) return;
	if(N<=m){
		if(min>m){
			min=m;
			return;
		}
	}
	for(int i=0;i<10;i++){
		if(D[i]!=0)
			continue;
		TMP=i;
		for(int j=0;j<L;j++)
			TMP*=10;
		f(m+TMP,L+1);
	}
	return;
}

int main(){
	scanf("%d %d\n",&N,&K);
	for(int i=0;i<K;i++){
		scanf("%d",&TMP);
		D[TMP]=1;
    }
	f(0,0);
	
	printf("%d\n",min);
	
	return 0;
}

Measured memory_bytes: 128
s = input()
s1 = []
s2 = []
n = len(s)

for i in range(n//2):
        s1.append(s[i])
        s2.append(s[n-i-1])

ans = 0
for i in range(len(s1)):
    if s1[i] != s2[i]:
        ans += 1

print(ans)

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

int main()
{
    int N;
    vector<int> P;
    cin >> N;
    while(N--) {
        int p;
        cin >> p;
        P.push_back(p);
    }

    int ct = 0;
    for (int i=1; i<P.size()-1; i++) {
        if (P[i-1] < P[i]) {
            if (P[i] < P[i+1]) ct++;
        } else {
            if (P[i] > P[i+1]) ct++;
        }
    }
    cout << ct << endl;

    return 0;
}

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


int main() {
  int N;
  cin >> N;
  vector <long long> L(N);
  for (long long i=0; i<N; i++) cin >> L.at(i);
  long long ans=0;
  for (long long i=0; i<N-2; i++) {
    for (long long j=i+1; j<N-1; j++) {
      for (long long k=j+1; k<N; k++) {
        if (L.at(i)!=L.at(j) && L.at(i)!=L.at(k) && L.at(j)!=L.at(k)) {
              if (L.at(i)+L.at(j)>L.at(k) && L.at(j)+L.at(k)>L.at(i) && L.at(k)+L.at(i)>L.at(j)) {
                  ans++;
              }
        }
      }
    }
  }
  cout << ans;
}

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

int n,sw=0;
vector<int> g;
int A[1000010];

void makeg(void){
  int i=0;
  for(int h=1;;){
    if(h>n){
      break;
    }
    g.push_back(h);
    h=3*h+1;
  }
}

void  insertsort(int g){
  for(int i=g;i<n;i++){
    int v=A[i];
    int j=i-g;
    while(j>=0&&A[j]>v){
      A[j+g]=A[j];
      j-=g;
      sw++;
    }
    A[j+g]=v;
  }
}

void shell(){
  for(int i=g.size()-1;i>=0;i--){
    insertsort(g[i]);
  }
}



int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  makeg();
  shell();
  cout <<g.size()<<endl;
  for(int i=g.size()-1;i>=0;i--){
    if(i!=g.size()-1){cout << " ";}
    cout << g[i];
  }
  cout << endl<<sw<<endl;
  for(int i=0;i<n;i++){
    cout << A[i]<<endl;
  }
}


Measured memory_bytes: 6896
#include <iostream>
#include <string>
//#include <cstdio>
int main()
{
  int N, K;
  char s[N+1];
  //std::string s;
  std::cin >> N >> s >> K;
  //scanf("%d\n%s\n%d", N, s, K);

  for (int i=0; i<N; i++) {
    if (s[i] != s[K-1]) s[i] = '*';
  }
  std::cout << s;
  //printf("%s", s);
  return 0;
}


Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int n;
struct node
{
    long long x, y;
}nod[100010];
struct nodex
{
    int id;
    long long x;
    friend bool operator < (const nodex &a,const nodex &b)
    {
        return a.x<b.x;
    }
}nodx[100010];
struct nodey
{
    int id;
    long long y;
    friend bool operator < (const nodey &a,const nodey &b)
    {
        return a.y<b.y;
    }
}nody[100010];
struct edge
{
    long long val;
    int u,v;
    friend bool operator < (const edge &a,const edge &b)
    {
        return a.val<b.val;
    }
}e[300010];
int k=0;

void init()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        cin>>nod[i].x>>nod[i].y;
        nodx[i].id=i+1;nodx[i].x=nod[i].x;
        nody[i].id=i+1;nody[i].y=nod[i].y;
    }
    sort(nodx,nodx+n);
    sort(nody,nody+n);
    for(int i=0;i<n-1;i++)
    {
        int next_i=i;
        for(int j=i+1;j<n;j++)
        {
            if(nodx[i].x!=nodx[j].x)
            {
                next_i=j-1;
                break;
            }
            e[k].u=nodx[i].id;
            e[k].v=nodx[j].id;
            e[k++].val=0;
            if(j==n-1)
            {
                next_i=j;
                break;
            }
        }
        if(next_i==n-1)break;
        e[k].u=nodx[i].id;
        e[k].v=nodx[next_i+1].id;
        e[k++].val=nodx[next_i+1].x-nodx[i].x;
        i=next_i;
    }
    for(int i=0;i<n-1;i++)
    {
        int next_i=i;
        for(int j=i+1;j<n;j++)
        {
            if(nody[i].y!=nody[j].y)
            {
                next_i=j-1;
                break;
            }
            e[k].u=nody[i].id;
            e[k].v=nody[j].id;
            e[k++].val=0;
            if(j==n-1)
            {
                next_i=j;
                break;
            }
        }
        if(next_i==n-1)break;
        e[k].u=nody[i].id;
        e[k].v=nody[next_i+1].id;
        e[k++].val=nody[next_i+1].y-nody[i].y;
        i=next_i;
    }
    sort(e,e+k);
}

int father[100010];
long long ans;

int findfather(int x)
{
    if(father[x]==x)return x;
    else return father[x]=findfather(father[x]);
}

void kruskal()
{
    for(int i=0;i<k;i++)
    {
        int u=e[i].u,v=e[i].v;
        int fu=findfather(u);
        int fv=findfather(v);
        if(fu==fv)continue;
        if(fu<fv)father[fv]=fu;
        else father[fu]=fv;
        ans+=e[i].val;
    }
}

int main()
{
    ans=0;
    init();
    for(int i=1;i<=n;i++)father[i]=i;
    kruskal();
    cout<<ans;
    return 0;
}





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

int main() {
    int h, w; cin >> h >> w;
    int n; cin >> n;
    vector<vector<int>> obs(h);
    while (n--) {
        int i, j; cin >> i >> j, i--, j--;
        obs[i].emplace_back(j);
    }
    int mi = h, cnt = 0;
    for (int i = 0; i < h; i++) {
        sort(begin(obs[i]), end(obs[i]));
        for (int j: obs[i]) {
            if (i - cnt == j) cnt++;
            if (i - cnt > j) mi = min(mi, i);
        }
    }
    cout << mi << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> v(N);

  rep(i, N) cin >> v[i];

  const int n = min(N, K);
  int ans = -2e9;
  for (int a = 0; a <= n; a++) {
    for (int b = 0; a + b <= n; b++) {
      const int c = K - a - b;
      vector<int> t;
      for (int i = 0; i < a; i++) t.push_back(v[i]);
      for (int i = 0; i < b; i++) t.push_back(v[N - i - 1]);
      sort(t.begin(), t.end());
      int s = 0;
      for (int& x : t) s += x;
      for (int i = 0; i < c && i < t.size() && t[i] < 0; i++) s -= t[i];
      ans = max(ans, s);
    }
  }
  cout << ans;
  return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> A(n);
    int x = 0;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        x += i % 2 == 0 ? A[i] : -A[i];
    }
    x /= 2;
    
    cout << 2 * x << ' ';
    for (int i = 0; i < n - 1; i++) {
        x = A[i] - x;
        cout << 2 * x << ' ';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
int main(void){
	int n,l,tun[102],pos[21],dir[21],sec,i,j,last,exit;
	char x[9];
	while(1){
		for(i=0;i<102;i++){
			tun[i]=0;
		}
		for(i=0;i<21;i++){
			pos[i]=dir[i]=0;
		}
		sec=0;
		exit=0;
		scanf("%d %d",&n,&l);
		if(n==0&&l==0){
			break;
		}
		for(i=1;i<=n;i++){
			scanf("%s %d",&x,&pos[i]);
			if(x[0]=='R'){
				dir[i]=1;
			}
			else{
				dir[i]=-1;
			}
		}
		while(1){
			sec++;
			for(i=1;i<=n;i++){
				if(pos[i]==1000){
					continue;
				}
				pos[i]+=dir[i];
				tun[pos[i]]++;
			}
			for(i=1;i<l;i++){
				if(tun[i]>1){
					for(j=1;j<=n;j++){
						if(pos[j]==i){
							dir[j]=dir[j]*(-1);
						}
					}
				}
			}
			if(tun[l]!=0||tun[0]!=0){
				for(i=1;i<=n;i++){
					if(pos[i]==l){
						pos[i]=1000;
						dir[i]=0;
						last=i;
						exit++;
						break;
					}
				}
				if(exit==n){
					break;
				}
				for(i=1;i<=n;i++){
					if(pos[i]==0){
						pos[i]=1000;
						dir[i]=0;
						last=i;
						exit++;
						break;
					}
				}
				if(exit==n){
					break;
				}
			}
			for(i=0;i<102;i++){
				tun[i]=0;
			}
		}
		printf("%d %d\n",sec,last);
	}
	return 0;
}

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

using namespace std;

int main(){
	string word[100];
	string most, many;
	int cut[100] = {0}, num = 0, i = 0, j, k = 0, max = 0, max1 = 0;

	while(cin >> word[i]){
		bool flag = 0;

		cut[i] ++;
		if(i == 0) num = word[i].size();
		else{
			if(word[i].size() > num){
				num = word[i].size();
				most = word[i];
			}
		}
		i++;
	}

	for(i = 0; i < num; i ++){
		k = 0;
		for(j = 0; j < num; j ++){
			if(word[i] == word[j]) k ++;
		}
		if(k > max){
			max1 = i;
			max = k;
		}
	}

	cout << word[max1] << " " << most << endl;

	return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> product(n);
  int a;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    product.at(i) = a;
    sum += a;
  }
  
  int popular = (sum + 4 * m - 1) / (4 * m);
  
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (product.at(i) >= popular) {
      count++;
    }
  }
  
  if (count >= m) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        s: chars,
        t:chars
    }

    let mut ans = MAX;

    for i in 0..(s.len() - t.len()) + 1 {
        let mut count = t.len();
        let mut s_index = i;
        let mut t_index = 0;
        while s_index < s.len() && t_index < t.len() {
            //println!("{} {} {}", s[s_index], t[t_index], count);
            if s[s_index] == t[t_index] {
                count -= 1;
            }
            s_index += 1;
            t_index += 1;
        }

        ans = cmp::min(count, ans);
        //println!();
    }

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 2212
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 1000001;
const int MOD = 1000000007;
   
        signed main() {
         int n;
         cin>>n;
         int a[n];
         for(int i=0;i<n;i++)cin>>a[i];
         sort(a,a+n);
         for(int i=0;i<n-1;i++){
             if(a[i]==a[i+1]){
                 cout<<"NO";
                 return 0;
             }
         }
         cout<<"YES";

        }


Measured memory_bytes: 1920
S=input()
a=len(S)
b=S[:int((a-1)//2)]
c=b[::-1]
d=S[int((a+3)//2)-1:]
e=d[::-1]
f=S[::-1]
if b==c and d==e and S==f:
  print('Yes')
else:
  print('No')

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

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

	vector<int> D(N);
	Rep(i, N) cin >> D[i];

	int sum;
	Rep(i, N-1){
		For(j, i+1, N){
			sum += D[i] * D[j];
		}
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int inf = 1e9;
int main() {
  int n;
  int k;
  cin >> n >> k;
  vector<int> x(n);
  for (auto&& w : x) cin >> w;
  x.push_back(inf);

  int i0 = lower_bound(begin(x), end(x), 0) - begin(x);
  int ans = inf;
  for (int i = 0; i <= k; i++) {
    if (i0 - 1 + i < n && i0 - 1 + i - (k - 1) >= 0)
      ans = min(ans, abs(x[i0 - 1 + i]) +
                         abs(x[i0 - 1 + i] - x[i0 - 1 + i - (k - 1)]));
    if (i0 - i >= 0 && i0 - i + k - 1 < n)
      ans = min(ans, abs(x[i0 - i]) + abs(x[i0 - i] - x[i0 - i + k - 1]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
n = gets.to_i
vs = gets.chomp.split.map(&:to_i)
cs = gets.chomp.split.map(&:to_i)
as = [0]

(0..n-1).each do |i|
  if vs[i] - cs[i] > 0
    as << vs[i] - cs[i]
  end
end
puts as.inject(:+)


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

#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
#define FOR_ITER(x, a) for(auto x = a.begin(); x != a.end(); ++x)



using namespace std;
typedef unsigned char byte;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<llong, llong> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }

using namespace std;


int main(){
//    int n, l;
//    cin >> n >> k;
//    vector<bool> dislike(10, false);
//
//    FOR(i, 0, k) {
//        int t;
//        cin >> t;
//        dislike[t] = true;
//    }

    char rs = 'A';
    map<int, queue<int> > qs;

    FO(i, 3) {
        string str;
        cin >> str;
        FO(j, str.size()) {
            qs[i].push(str.at(j));
        }
    }

    int curPlayer = 0;
    while(!qs[curPlayer].empty()) {
        char ch = qs[curPlayer].front();
        qs[curPlayer].pop();
        curPlayer = ch - 'a';
    }
    rs += curPlayer;
    cout << rs << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    long long int MOD = 1000000007;
    int n, m, a;
    int i;

    scanf("%d%d", &n, &m);
    long long int dp[n + 1];
    dp[0] = 1;
    dp[1] = 1;
    for (i = 2; i < n + 1; i++)
        dp[i] = -1;
    for (i = 0; i < m; i++)
    {
        scanf("%d", &a);
        dp[a] = 0;
    }

    for (i = 2; i < n + 1; i++)
        if (dp[i] == -1)
            dp[i] = (dp[i - 2] + dp[i - 1]) % MOD;

    printf("%lld\n", dp[n]);

    return 0;
}

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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll n, m;
	ll x;
	ll a;
	string s;
	ll l_ans = 0;
	double d_ans = 0;
	
	cin >> x;

	ll tmp;

	tmp = x / 11;
	l_ans = tmp * 2;
	tmp = x % 11;
	if (tmp != 0) {
		if (tmp <= 6) l_ans += 1;
		else l_ans += 2;
	}

	cout << l_ans << "\n";
}

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

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

line = input_line.split(' ')
a = int(line[0])
b = int(line[1])
c = a + b

if c > 2 and c % 3 == 0:
	print('Possible')
elif a > 2 and a % 3 == 0:
	print('Possible')
elif b > 2 and b % 3 == 0:
	print('Possible')
else:
	print('Impossible')


Measured memory_bytes: 3060
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N : usize,
        A : [isize; N]
    }

    let parity = A.iter().fold(0, |sum, x| if *x < 0 {sum + 1} else {sum + 0}) % 2;

    let mut a:Vec<usize> = A.iter().map(|x| x.abs() as usize).collect();
    a.sort();
    let sum = a.iter().fold(0, |sum, x| sum + x);

    println!("{}", if parity == 0 {sum} else {sum - a[0] * 2});
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  REP(i, h) cin >> s[i];

  ll cnt = 0;
  REP(i, h) REP(j, w) {
    if(s[i][j] == '#') cnt++;
  }
  if(cnt == h+w-1) cout << "Possible" << endl;
  else cout << "Impossible" << endl;

  return 0;
}

Measured memory_bytes: 256
# N = gets.chomp.to_i
N, M = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

# odd + odd => even
# even + even => even

# N. even
# M. odd
odd = M * (M-1) / 2
even = N * (N-1) / 2

p (odd + even)

Measured memory_bytes: 1916
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	s := make([]string, n)
	for i := range s {
		s[i] = nextLine()
	}

	// slice copy
	b := append([]string{}, s...)
	b = bubbleSort(n, b)
	fmt.Println(strings.Join(b, " "))
	fmt.Println(isStable(n, s, b))

	// slice copy
	se := append([]string{}, s...)
	se = selectionSort(n, se)
	fmt.Println(strings.Join(se, " "))
	fmt.Println(isStable(n, s, se))
}

func isStable(n int, in, out []string) string {
	for i := 0; i <= n-1; i++ {
		for j := i + 1; j <= n-1; j++ {
			for a := 0; a <= n-1; a++ {
				for b := a + 1; b <= n-1; b++ {
					if in[i][1:] == in[j][1:] && in[i] == out[b] && in[j] == out[a] {
						return "Not stable"
					}
				}
			}
		}
	}
	return "Stable"
}

func bubbleSort(n int, s []string) []string {
	f := true
	for f {
		f = false
		for i := n - 1; 1 <= i; i-- {
			if s[i][1:] < s[i-1][1:] {
				v := s[i]
				s[i] = s[i-1]
				s[i-1] = v
				f = true
			}
		}
	}

	return s
}

func selectionSort(n int, s []string) []string {
	for i := range s {
		min := i
		for j := i; j <= n-1; j++ {
			if s[j][1:] < s[min][1:] {
				min = j
			}
		}
		if s[i][1:] != s[min][1:] {
			s[i], s[min] = swap(s[i], s[min])
		}
	}

	return s
}

func swap(a, b string) (string, string) {
	return b, a
}

func convertIntToString(s []int, d string) string {
	b := make([]string, len(s))
	for i, v := range s {
		b[i] = strconv.Itoa(v)
	}

	return strings.Join(b, d)
}

// =================================
// I/O util
// =================================

var sc = bufio.NewScanner(os.Stdin)

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

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

// =================================



Measured memory_bytes: 1100
#include<stdio.h>
using namespace std;
int x,y,z = 0;

int main() {
	scanf("%d %d", &x, &y);
	while (1) {
	if (x == 0 && y == 0) {
			break;
		}
		if (x > y) {
			z = x;
			x = y;
			y = z;
		}
		printf("%d %d\n", x, y);
		scanf("%d %d", &x, &y);
	}
}


Measured memory_bytes: 2708
# -*- coding: utf-8 -*-
n = int(input())
sl = [input() for _ in range(n)]

xa = []
bx = []
ba = []
x = []
for s in sl:
    if s[0]=="B" and s[-1]=="A":
        ba.append(s)
    elif s[-1]=="A":
        xa.append(s)
    elif s[0]=="B":
        bx.append(s)
    else:
        x.append(s)

if len(xa)>0:
    xa = xa[:-1]+[xa[-1]+"".join(ba)]
elif len(bx)>0:
    bx = bx[:-1]+["".join(ba)+bx[-1]]
else:
    x.append("".join(ba))

if len(xa)>=len(bx):
    for i in range(len(bx)):
        x.append(xa[i]+bx[i])
    x = x+xa[len(bx):]
else:
    for i in range(len(xa)):
        x.append(xa[i]+bx[i])
    x = x+bx[len(xa):]

res = "".join(x)
print(res.count("AB"))


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

int main(){
vector<char> S(4);
for (int i = 0; i < 4; i++) {
    cin >> S.at(i);
}
sort(S.begin(), S.end());
if (S.at(0) == S.at(1) && S.at(2) == S.at(3) && S.at(0) != S.at(2)){
    cout << "Yes" << endl;
} else {
    cout << "No" << endl;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

const int dy[] = {-1, 0, 0, 1};
const int dx[] = {0, -1, 1, 0};
const int INF = 1 << 30;
using P = pair<int, int>;
int w, h;
string c[20];
int dis[20][20], d[11][11];
vector<P> ps;
int dp[1 << 11][11];

int dfs(int S, int v) {
    if (dp[S][v] != INF) return dp[S][v];
    if (S == (1LL << ps.size()) - 1) return dp[S][v] = 0;
    int res = INF;
    REP (i, ps.size()) if (!(S >> i & 1)) {
        res = min(res, dfs(S | (1LL << i), i) + d[v][i]);
    }
    return dp[S][v] = res;
}

void bfs(int idx) {
    REP (i, h) REP (j, w) dis[i][j] = INF;
    dis[ps[idx].first][ps[idx].second] = 0;
    queue<P> que;
    que.emplace(ps[idx]);
    while (!que.empty()) {
        int y, x;
        tie(y, x) = que.front(); que.pop();
        REP (i, 4) {
            int ny = y + dy[i];
            int nx = x + dx[i];
            if (ny >= 0 && ny < h && nx >= 0 && nx < w && c[ny][nx] != 'x' && dis[ny][nx] == INF) {
                dis[ny][nx] = dis[y][x] + 1;
                que.emplace(ny, nx);
            }
        }
    }
    REP (i, ps.size()) d[idx][i] = dis[ps[i].first][ps[i].second];
}

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

    while (cin >> w >> h, w) {
        P s;
        ps.clear();
        REP (i, h) {
            cin >> c[i];
            REP (j, w) {
                if (c[i][j] == 'o') {
                    s = P(i, j);
                } else if (c[i][j] == '*') {
                    ps.emplace_back(i, j);
                }
            }
        }
        ps.insert(ps.begin(), s);
        REP (i, ps.size()) bfs(i);
        REP (i, 1 << 11) REP (j, 11) dp[i][j] = INF;
        int ans = dfs(1, 0);
        cout << (ans == INF ? -1 : ans) << endl;
    }
}


Measured memory_bytes: 3352
#include<stdio.h>
int main(void)
{
	long long  N,D,i,d,t=0,m,M;
	scanf("%lld %lld",&N,&d);
	D=d*d;
	for(i=0;i<N;i++){
		scanf("%lld %lld",&m,&M);
		if(m*m+M*M<=D){
			t++;
		}
	}
	printf("%lld\n",t);
	return 0;
}

Measured memory_bytes: 1724
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;

const int maxn = 3010;
char s[maxn], t[maxn], ans[maxn];
int n, m, dp[maxn][maxn];

int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.precision(10);
   cout << fixed;
   cin >> s >> t;
   n = strlen(s), m = strlen(t);
   for (int i = 0; i < n; ++i){
      for (int j = 0; j < m; ++j){
         dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
         if (s[i] == t[j])
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], 1 + dp[i][j]);
      }
   }
   int i = n, j = m, pos = 0;
   while (true){
      while (i > 0 && dp[i][j] == dp[i - 1][j])
         --i;
      while (j > 0 && dp[i][j] == dp[i][j - 1])
         --j;
      if (i == 0 || j == 0)
         break;
      ans[pos++] = s[i - 1];
      --i, --j;
   }
   reverse(ans, ans + pos);
   cout << ans << '\n';
   return 0;
}

Measured memory_bytes: 35584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        KnapsackProblem solver = new KnapsackProblem();
        solver.solve(1, in, out);
        out.close();
    }

    static class KnapsackProblem {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int weightLimit = in.nextInt();
            KnapsackProblem.Product[] products = new KnapsackProblem.Product[n];
            for (int i = 0; i < n; i++) products[i] = new KnapsackProblem.Product(in.nextInt(), in.nextInt());
            int[] dp = new int[weightLimit + 1];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j <= weightLimit; j++) {
                    if (j >= products[i].weight)
                        dp[j] = Math.max(dp[j], dp[j - products[i].weight] + products[i].value);
                }
            }

            out.println(dp[weightLimit]);
        }

        static class Product {
            int weight;
            int value;

            public Product(int x, int y) {
                value = x;
                weight = y;
            }

        }

    }
}




Measured memory_bytes: 26964
a,l="+<"
f,r=print,range(29,-1,-1)
f(60451,l,4,0,3)
for i in r:f(a,3,4,7,*[a,7,7,7]*i,a,5,7,7,l,0,7,7,l,7,3,7,a,4,4,6);[f(a,3,4,8,*[a,8,8,8]*j,a,6,8,8,l,1,8,8,l,8,3,8,l,7,8,9,l,9,8,9,*[a,9,9,9]*(i+j),a,2,9,2,*[a,8,8,8]*j,a,6,8,6)for j in r];f(*[a,7,7,7]*i,a,5,7,5)

Measured memory_bytes: 9512
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC109_C
{
    class Program{
        static long Gcd(long a,long b){
            while(a % b != 0){
                var temp = a % b;
                a = b;
                b = temp;
            }
            return b;
        }
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = long.Parse(input[0]) + 1;
            var x = long.Parse(input[1]);
            var distances = new List<long>();

            var cities = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
            cities.Add(x);
            cities.Sort();

            for(var i = 1;i < n;i++){
                distances.Add(cities[i] - cities[i - 1]);
            }
            var ans = distances[0];
            for(var i = 0;i < distances.Count();i++){
                ans = Gcd(ans,distances[i]);
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 21984
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int MOD = 1000000007;

struct Pony
{
    long a, b;
 
    Pony(long a_, long b_)
    {
        a = a_;
        b = b_;
    }
 
    bool operator<(const Pony &another) const
    {
        return b < another.b;
    };
};

int fac(int k){
    int sum = 0;
    for (int i = 1; i <= k; ++i)
    {
        sum += i;
    }
    return sum;
}

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

  int  n, k;
  cin >> n >> k;

  if (fac(n-2) < k) {
    cout << "-1" << endl;
  } else {
    int cnt = fac(n-2)-k;
    cout << (n-1+cnt) << endl;

    rep(i, n-1) {
      printf("%d %d\n", i+1, n);
    }

    rep(i, n-1) {
      for(int j = i+1; j < n-1; j++) {
        if (!cnt) break;
        printf("%d %d\n", i+1, j+1);
        cnt--;
      }
      if(!cnt)break;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long i[300000];
int main(){
  string s;
  int a=1,b[100000]={};
  cin>>s;
  for(int i=0;i<s.size();i++){
    b[s[i]]++;
  }
  for(int i=0;i<1000;i++){
    if(b[i]%2==1) a=0;
  }
  if(a!=0){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i,N) { cin >> A[i]; }

  set<ll> seen;
  REP(i,N) {
    if (seen.find(A[i]) != seen.end()){
      cout << "NO" << "\n";
      return 0;
    }
    seen.insert(A[i]);
  }

  cout << "YES" << "\n";
  return 0;
}


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

long double X, Y;

const ll M = 1000000007;

vector<ll> fac(3000001); //n!(mod M)
vector<ll> ifac(3000001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main(){
  cin >> X >> Y;
  ll A, B, C;

  A = (2.0 * X - Y);
  B = (2.0 * Y - X);
  C = (X + Y);
  ll result;


  if(A < 0 || B < 0){
    result = 0;
  }else if(A % 3 != 0){
    result = 0;
  }else if(B % 3 != 0){
    result = 0;
  }else if(C % 3 != 0){
    result = 0;

  }else{
    // cout << "yes" <<endl;

    // A /= 3;
    // B /= 3;
    // C /= 3;
    // ll up = 1;
    // ll b1 = 1;
    // ll b2 = 1;
    // for(int i = C; i>B; i--){
    //   up *= i;
    //   // up %= 1000000007;
    //
    // }
    // cout << up << endl;
    // for(int i = 1; i<=A; i++){
    //   up /=i;
    //   // b1 *=i;
    //   // b1 %= 1000000007;
    //
    // }
    // cout << up << endl;
    // for(int i = 1; i<=B; i++){
    //   b2 *=i;
    //   b2 %= 1000000007;
    //
    // }
    // cout << b2 << endl;
    // result = up / b1;
    // result = up;
    // cout << result << endl;
    //
    // result %= 1000000007;

    ll n = C /3;
    ll k = B/ 3;

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<max(n+1, k+1); i++){
      fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
      ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    ll ans=0;
    ans = comb(n, k) % M;
    cout << ans << endl;
    return 0;
  }
  cout << result << endl;





}


Measured memory_bytes: 47104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        out.println(6 - a - b);
    }


}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer      tokenizer;

    public InputReader(InputStream stream){
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

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

}


Measured memory_bytes: 21460
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
        // code
        string s;
        ll k;
        cin >> s >> k;

        REP(i, min((ll)s.size(), k)) {
                if (s[i] >= '2') {
                        cout << s[i] << endl;
                        return 0;
                }
        }

        cout << '1' << endl;

        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    vector<vector<int>> a(26),b(26);
    rep(i,s.length()){
        a[s[i]-'a'].push_back(i);
        b[t[i]-'a'].push_back(i);
    }
    SORT(a);
    SORT(b);
    bool ok = 1;
    rep(i,26){
        if (a[i].size() != b[i].size()) ok = 0;
        else{
            rep(j,a[i].size()){
                if (a[i][j] != b[i][j]) ok = 0;
            }
        }
    }
    if (ok) PRINT("Yes");
    else PRINT("No");
}


Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(String[] args)
    {
        var l = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var a = l[0]; var b = l[1]; var k = l[2];
        var ares = 0L;
        var bres = 0L;
        if (k <= a)
        {
            ares = a - k;
            k = 0;
            Console.WriteLine($"{ares} {b}");
            return;
        }
        else
        {
            ares = 0;
            k = k - a;
        }
        if (k <= b)
        {
            bres = b - k;
            k = 0;
            Console.WriteLine($"{ares} {bres}");
            return;
        }
        else
        {
            bres = 0;
            k = k - b;
            Console.WriteLine($"{ares} {bres}");
        }
    }
}

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

using namespace std;

int main(){
 int n, t, a, in, ans;
 double mindis;
  cin >> n;
  cin >> t;
  cin >> a;  
  cin >> in;
  mindis = fabs(a - (t - in * 0.006));
  ans = 1;
  for (int i = 0; i < n - 1; i++){
  	cin >> in;
    double tmp = fabs(a - (t - in * 0.006));
    if(tmp < mindis){
     mindis = tmp;
     ans = i + 2;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256