akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<vector>
#include<cstring>
using namespace std;

const int S_MAX = 100005;

int Sn[S_MAX];
char S[S_MAX];

int main(){
    int n;
    cin >> S;
    n = strlen(S);
    for(int i = 0; i < n; i++){
        if (S[i] == '0') Sn[i] = 0;
        else Sn[i] = 1;
    }

    int lb = n/2;
    int ub = n+1;
    while(ub - lb > 1){
        int mid = (lb + ub) / 2;

        bool able = true;
        int same = Sn[n - mid];
        for(int i = n-mid; i < mid; i++){
            if (same != Sn[i]) able = false;
        }
        if (able) lb = mid;
        else ub = mid;
    }
    cout << lb << endl;
    return 0;
}

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

int main() {
    int a, b, ans;
    cin >> a >> b;
    ans = a * b;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld double
#define ff first
#define ss second
ll sum(ll x,ll b){
	ll add=0;
	while(x){
		add+=x%b;
		x/=b;
	}
	return add;
}
int main(){
	ll n,s;
	scanf("%lld %lld",&n,&s);
	if(n==s){
		printf("%lld\n",n+1);
		exit(0);
	}
	for(ll i=2;i*i<=n;++i){
		if(sum(n,i)==s){
			printf("%lld\n",i);
			exit(0);
		}
	}
	for(ll i=(ll)sqrtl(n-s);i>=1;--i){
		if((n-s)%i==0 and sum(n,(n-s)/i+1)==s){
			printf("%lld\n",((n-s)/i+1));
			exit(0);
		}
	}
	printf("-1\n");
	return 0;
}


Measured memory_bytes: 3744
#include<stdio.h>
int gcd(int a,int b)
{
    int r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
} 
int main(void)
{
    int k,h,i,j,t=0;
    scanf("%d", &k); 
    for(h=1;h<=k;h++){
        for(i=1;i<=k;i++){
            for (j=1;j<=k;j++){
                t+=gcd(gcd(h,i),j);
            }
        }
    }
    printf("%d\n",t);
    return 0;
}

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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll x,y;
  cin>>x>>y;

  ll res=0;
  res+=(x-y)*100+1900*y;
  res*=pow(2,y);
  cout<<res<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#define MAX_V 100000
#define MAX_E 500000
#define INF 1e9
using namespace std;

int V;//頂点の数
int E;//辺の数

struct edge {
	int from, to, cost;
};
edge es[MAX_E];
int d[MAX_V];


bool find_negative_loop(int s) {
	d[s] = 0;
	
	int count = 0;
	while (true) {
		bool update = false;
		count++;
		
		for (int i = 0; i < E; i++) {
			
			if (d[es[i].from] != INF && d[es[i].to] > d[es[i].from] + es[i].cost) {
				if (count == V) {
					return true;
				}
				d[es[i].to] = d[es[i].from] + es[i].cost;
				update = true;
			}
		}
		if (update == false) {
			return false;
		}
	}
}

int main() {
	int r;
	cin >> V >> E >> r;
	for (int i = 0; i < E; i++) {
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	for (int i = 0; i <V; i++) {
		d[i] = INF;
	}
	if (find_negative_loop(r)) {
		cout << "NEGATIVE CYCLE" << endl;
	}
	else {
		for (int i = 0; i < V; i++) {
			if (d[i] == INF) {
				cout << "INF" << endl;
			}
			else {
				cout << d[i] << endl;
			}
		}
	}
	return 0;
}









Measured memory_bytes: 9100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_20180929
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var v = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int x = v.Count(a => a == v[0]);

            if (v.Count(a => a == v[0]) == n)
            {
                Console.WriteLine(n / 2);
                return;
            }
            List<int> vOdd = new List<int>();
            List<int> vEve = new List<int>();
            Dictionary<int, int> vOddD = new Dictionary<int, int>();
            Dictionary<int, int> vEveD = new Dictionary<int, int>();
            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                {
                    vEve.Add(v[i]);
                    if (vEveD.ContainsKey(v[i]))
                    {
                        vEveD[v[i]]++;
                    }
                    else
                    {
                        vEveD[v[i]] = 1;
                    }
                }
                else
                {
                    vOdd.Add(v[i]);
                    if (vOddD.ContainsKey(v[i]))
                    {
                        vOddD[v[i]]++;
                    }
                    else
                    {
                        vOddD[v[i]] = 1;
                    }
                }
            }
            var vOddDSorted = vOddD.OrderByDescending((a) => a.Value);
            var vEveDSorted = vEveD.OrderByDescending((a) => a.Value);
            var vOdd1 = vOddDSorted.First();
            var vEve1 = vEveDSorted.First();

            if(vOdd1.Key != vEve1.Key)
            {
                Console.WriteLine(vOdd.Count(a => a != vOdd1.Key)
                    + vEve.Count(a => a != vEve1.Key));
            }
            else
            {
                var vOdd2 = vOddDSorted.Skip(1).First();
                var vEve2 = vEveDSorted.Skip(1).First();

                var x1 = vOdd.Count(a => a != vOdd2.Key) + 
                    vEve.Count(a => a != vEve1.Key);
                var x2 = vOdd.Count(a => a != vOdd1.Key) +
                    vEve.Count(a => a != vEve2.Key);
                Console.WriteLine(Math.Min(x1, x2));
            }
        }
    }
}


Measured memory_bytes: 30432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	ll t,a;cin >> t >> a;
	vector<ll> h(n);
	rep(i,n) cin >> h.at(i);
	ll d=100000000000000;
	int ans=0;
	a*=1000;
	t*=1000;
	rep(i,n){
		if(abs(a-(t-h.at(i)*6))<d){
			d=abs(a-(t-h.at(i)*6));
			ans=i;
		}
	}
	cout << ans+1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int A,B,C,X,Y;  
int main() {
  cin >> A >> B >> C>>X>>Y;
  ll ans = LINF;
  for (int ab = 0; ab <= 2*max(X,Y); ab+=2) {
    int need_a = max(0, X-ab/2);
    int need_b = max(0, Y-ab/2);
    ll cost = need_a * A + need_b * B + ab * C;
    chmin(ans, cost);
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
using namespace std;

int num(vector<int> e,int m)
{
	vector<int> list;
	int e_size = e.size();
	for(int i=0; i<e_size; i++)
	{
		if(e[i]>=m-1)
		{
			list.push_back(e[i]);
		}
	}
	return list.size();
}
int main()
{

	int max_N = 100;
	cin>>max_N;
	vector<int> e(max_N+1);
	for(int i=2; i<=max_N; i++)
	{
		int cur = i;
		for(int j=2; j<=i; j++)
		{
			while(cur % j == 0)
			{
				e[j] += 1;
				cur /= j;
			}
		}
	}

	int count = num(e,75) +num(e,25)*(num(e,3)-1)+num(e,15)*(num(e,5)-1)+num(e,5)*(num(e,5)-1)*(num(e,3)-2)/2;

	cout<<count<<endl;

}


Measured memory_bytes: 256
def solve(i, m, array, n)
  return true if m.zero?
  return false if i >= n
  solve(i + 1, m, array, n) || solve(i + 1, m - array[i],array, n)
end

n = gets.to_i
input = gets.split(' ').map(&:to_i)
gets.to_i
hope = gets.split(' ').map(&:to_i)

hope.each do|hope_value|
  case solve 0, hope_value, input, n
  when true
    puts 'yes'
  when false
    puts 'no'
  end
end


Measured memory_bytes: 6868
s = input()

while s:
    if s.endswith('dream'):
        s = s[:-5]
        continue
    if s.endswith('erase'):
        s = s[:-5]
        continue
    if s.endswith('dreamer'):
        s = s[:-7]
        continue
    if s.endswith('eraser'):
        s = s[:-6]
        continue
    print('NO')
    exit()
print('YES')


Measured memory_bytes: 3244
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> l(2 * n); REP(i, 2 * n) cin >> l[i];
  sort(ALL(l));
  int ans = 0;
  for (int i = 0; i < 2 * n; i += 2) ans += l[i];
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        int ans = 0;
        while(x <= y){
            ans++;
            x *= 2;
        }

        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 21460
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

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

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h(N);
	rep(i, N) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());
	int ans = numeric_limits<int>::max();
	for (int i = 0; i < N - K + 1; i++) {
		ans = min(ans, h[i + K - 1] - h[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
lst = [True]*n
for _ in range(m):
    a, b = [int(i) for i in input().split()]
    if h[a-1] > h[b-1]:
        lst[b-1] = False
    elif h[a-1] < h[b-1]:
        lst[a-1] = False
    elif h[a-1] == h[b-1]:
        lst[a-1] = False
        lst[b-1] = False
ans = 0
for i in lst:
    if i:
        ans += 1
print(ans)

Measured memory_bytes: 85164
#include <bits/stdc++.h>
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> c(M);
    for (int i = 0; i < M; i++) { std::cin >> c[i]; }
    std::vector<int> dp(N + 1, INF<int>());
    dp[0] = 0;
    for (int i = 0; i < M; i++) {
        for (int j = 0; j <= N; j++) {
            if (j >= c[i]) { dp[j] = std::min(dp[j], dp[j - c[i]] + 1); }
        }
    }
    std::cout << dp[N] << std::endl;
    return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

int main() {
    vector<int> a, m;
    int n, t, k, mn;
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
        cin >> t;
        a.push_back(t);
    }
    vector<int> dp = {0, abs(a[0]-a[1])};
    for(int j = 2; j < n; ++j){
        m.clear();
        for(int i = 1; i <= min(k,j); i++){
            m.push_back(abs(a[j]-a[j-i]) + dp[j-i]);
        }
        mn = m[0];
        for(int i = 0; i < m.size(); ++i){
            if (m[i] < mn)
                mn = m[i];
        }
        dp.push_back(mn);
    }
    cout << dp[n - 1];
}

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

int main() {
  int N;
  cin >> N;
  
  int arr[N];
  for(int i=0;i<N;i++){
    cin >> arr[i];
  }
  
  int count = 0;
  bool flg = true;
  
  while(flg){
    for(int i=0;i<N;i++){
      if(arr[i]%2!=0){
        flg = false;
        break;
      }
      else{
        arr[i] /= 2;
      }
      
      if(i==N-1){
        count++;
      }
    }
  }
  
  cout << count << endl;
    
}

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


int main(){
                                                                     

    long long n, m, i;

    long long k = 1;


    cin >> n >> m;


    for( i = 1 ; i <= m ; i = i + 1 ){

         k *= 2;

         }


    cout << ( 1900 * m + 100 * ( n - m ) ) * k << endl;
    

    return 0;

    }

Measured memory_bytes: 256
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int 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 int MAX =3001;
const int MOD =998244353;


  
signed main(){
  int n,k;
  cin>>n>>k;
  int l[k],r[k];
  for(int i=0;i<k;i++){
    cin>>l[i]>>r[i];
  }
  int dp[n]={};
  dp[0]=1;
 
  for(int i=1;i<n;i++){
    if(i!=1)dp[i]=dp[i-1];
    else dp[i]=0;
    for(int j=0;j<k;j++){
      if(i-r[j]-1>=0)dp[i]=(MOD+dp[i]-dp[i-r[j]-1])%MOD;
      if(i-l[j]>=0)dp[i]=(dp[i]+dp[i-l[j]])%MOD;
    }
  }
  cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 5140
#include <stdio.h>
#include <ctype.h>

int main()
{
 int i,dem[26]={};
 char c;
while(scanf("%c",&c)!=EOF){
  c = tolower(c);
  if ('a' <= c && c <= 'z') dem[c - 'a']++;
}
for (i = 0; i < 26; i++)
    printf("%c : %d\n", 'a' + i, dem[i]);
 return 0;
}

Measured memory_bytes: 544
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a % 2 != 0 &&b % 2 != 0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;

#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

li n, a[100007], res;
multiset <int, greater <int>> mt;


int main () {
    fastIO;
    cin >> n;
    for(li i = 0; i < n; i ++) cin >> a[i];
    res=1;
    mt.insert(a[0]);
    for(li i = 1; i < n; i ++) {
        auto it = mt.upper_bound(a[i]);
        if(it==mt.end()) {
            res++;
            mt.insert(a[i]);
        } else {
            mt.erase(it);
            mt.insert(a[i]);
        }
    }
    cout << res;
}


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

int main(){
  string S;
  long long int K;
  cin >> S;
  cin >> K;
  int igai1 = 10000;
  char num;
  for(int i=0; i<S.size(); i++){
    if(S.at(i) != '1'){
      igai1 = i;
      num = S.at(i);
      break;
    }
  }
  if(K <= igai1){
    cout << 1 << endl;
  }else{
    cout << num << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define YESNO(i) if((i)) puts("YES");else puts("NO");
#define YesNo(i) if((i)) puts("Yes");else puts("No");
#define yesno(i) if((i)) puts("yes");else puts("no");
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll k,a,b;cin>>k>>a>>b;
  bool isok=false;
  for(ll i=a;i<=b;++i) if(i%k==0) {isok=true;break;}
  print(isok?"OK":"NG");
  return 0;
}

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

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

    for(int i=0; i<26; i++){
        if(s.find('a' + i) == s.npos){
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

int h,w;
int c[1500][1500];
int ans;

int main(){
  ans=0;
  memset(c,-1,sizeof(c));

  scanf(" %d %d",&h,&w);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      scanf(" %d",&c[i][j]);
      if(c[i][j]==1)c[i][j]=-1;
      else if(c[i][j]==0)c[i][j]=1;
    }
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(i>0 && j>0 &&c[i][j]!=-1 && c[i][j-1]!=-1 &&
         c[i-1][j]!=-1 && c[i-1][j-1]!=-1){
        c[i][j]=min(c[i][j-1],min(c[i-1][j],c[i-1][j-1]))+1;
      }
      ans=max(ans,c[i][j]);
    }
  }

  printf("%d\n",ans*ans);

  return 0;
}

Measured memory_bytes: 12004
S="0"+input()
dig=len(S)


#dp[i][j]は下からi桁みたときの最小で，jは繰り下がりの有無
#自分が出す:a お釣り:b
inf=10**10
dp=[[inf,inf] for _ in range(dig+1)]
dp[0]=[0,0]

for i in range(dig):
    for j in range(2):
        if i==0 and j==1:
            break
        x=int(S[dig-i-1])
        for a in range(10):
            jj=0#次のj,繰り下がるかどうか
            b=(a-j)-x#j=1なら，繰り下がっているためaが1下がっている
            if b<0:
                b+=10
                jj=1
            dp[i+1][jj]=min(dp[i+1][jj] , dp[i][j]+a+b)
            
print(dp[-1][0])






Measured memory_bytes: 138336
(defun solve (n)
  (loop for i from (isqrt n) downto 1
        do (multiple-value-bind (quotient remainder)
               (truncate n i)
             (when (zerop remainder)
               (return (- (+ quotient i) 2))))))

#-swank
(let* ((n (read)))
  (format t "~A~%" (solve n)))


Measured memory_bytes: 14568
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	x := scanInt()
	ans := x / 11 * 2
	if x%11 > 0 {
		ans++
	}
	if x%11-6 > 0 {
		ans++
	}
	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 1776
#include<stdio.h>
int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(abs(a-c)<=d){
        printf("Yes");
    }else if(abs(a-b)<=d&&abs(b-c)<=d){
        printf("Yes");
    }else{
        printf("No");
    }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;

inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    int n, m;
    cin >> n >> m;

    vector<vector<bool> > path(n, vector<bool>(n));

    rep(i,m){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        path[a][b] = true;
        path[b][a] = true;
    }

    vector<int> p(n-1);
    iota(all(p), 1);

    int res = 0;

    do{
        int now = 0;
        rep(i,n-1){
            if(path[now][p[i]]){
                now = p[i];
            }else{
                goto ng;
            }
        }
        ++res;
        ng:;
    }while(next_permutation(p.begin(), p.end()));

    cout << res << '\n';

    return (0);
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;


struct m {
	int n;
	int h, w;
	bool operator<(const m& r) const {
		return n < r.n;
	}
};

int main() {
	int h, w, d;
	cin >> h >> w >> d;

	vector<m> b;

	for (int ih = 0; ih < h; ih++) {
		for (int iw = 0; iw < w; iw++) {
			m tt;
			cin >> tt.n;
			tt.h = ih;
			tt.w = iw;
			b.push_back(tt);
		}
	}
	sort(b.begin(), b.end());

	vector<int> a(h*w, 0);

	for (int i = d; i < h * w; i++) {
		int ll = i - d;
		int rr = i;
		a[rr] = a[ll] + abs(b[rr].h - b[ll].h) + abs(b[rr].w - b[ll].w);
	}

	int q;
	cin >> q;

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		cout << a[r] - a[l] << endl;
	}

	return 0;
}


Measured memory_bytes: 2796
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

struct mint {

  ll x; 

  mint(ll x=0):x((x%mod+mod)%mod){} //コンストラクタを呼んで自動的にmodを取っている。

  mint operator-() const { return mint(-x);}

  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    //メンバ関数にはthisポインタがある。メンバ変数の値を返す。
    return *this;
  }

  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }

  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }

  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }

  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }

  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }

  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1); //a=x/2
    a *= a; //繰り返し二乗法
    if (t&1) a *= *this; //tが奇数のときはxを1回かける
    return a;
  }



  // for prime mod

  mint inv() const {
    return pow(mod-2);
  }

  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }

  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
    
};

struct combination{
  vector<mint> fact, ifact; //ifactはinverse factorial
  combination(ll n):fact(n+1), ifact(n+1){
    assert(n<mod);
    fact[0]=1;
    for(ll i=1;i<=n;i++) fact[i]=fact[i-1]*i;
    ifact[n]=fact[n].inv();
    for(ll i=n;i>=1;--i) ifact[i-1]=ifact[i]*i; // 1/(i-1)!=(1/i!)*i
  }
  mint operator()(ll n,ll k){
    if(k<0 || k>n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main()
{
    ll x,y;
    cin >> x >> y;
    bool ok=true;
    ll s=0,t=0;
    if((-x+2*y)%3!=0){
        ok=false;
    }
    else{
        s=(-x+2*y)/3;
    }
    if((2*x-y)%3!=0){
        ok=false;
    }
    else{
        t=(2*x-y)/3;
    }
    if(!ok){
        cout << 0 << endl;
        return 0;
    }
    combination c=combination(1000005);
    mint ans=c(s+t,s);
    cout <<  ans.x << endl;
    return 0;
} 

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()
{

    ll n;
    set<char> v;
    cin >> n;
    while(n--)
    {

        char c;
        cin >> c;
        v.insert(c);
    }
    if(v.size()==3) cout << "Three";
    else cout << "Four";
}


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

using namespace std;
const int INF = 0x3f3f3f3f;


int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i<M; i++){
		int t;
		cin >> t;
		N -= t;
	}
	if (N>-1){
		cout << N << endl;
	} else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int K, X;
  while (cin >> K >> X) {
    bool res = 500 * K >= X;
    cout << (res ? "Yes" : "No") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.Array.IArray
import Data.List (nub)

type Vertex a  = a
type Graph a   = Array (Vertex a) [Vertex a]
type Bounds a  = (Vertex a, Vertex a)
type Edge a    = (Vertex a, Vertex a)

graph :: (Ix a) => Bounds a -> [Edge a] -> Graph a
graph (b,e) = accumArray (flip (:)) [] (b,e)

graphU :: (Ix a) => Bounds a -> [Edge a] -> Graph a
graphU bs lst = graph bs $ nub (lst ++ map swap lst)
  where swap (a,b) = (b,a)

solve :: Int -> Graph Int -> [[Int]]
solve s g = concatMap (next [s]) (g!s)
  where
    next :: [Int] -> Int -> [[Int]]
    next v p = let v' = (p:v)
                   xs = filter (`notElem` v') (g!p)
                in case xs of
                    [] -> [reverse v']
                    _  -> concatMap (next v') xs

main :: IO ()
main = do
    [n,_] <- map read . words <$> getLine :: IO [Int]
    a <- map ((\[a,b] -> (a,b)) . map (fst . fromJust . BS.readInt) . BS.words)
        . BS.lines <$> BS.getContents :: IO [(Int,Int)]
    print . length . filter (==n) . map length . solve 1 $ graphU (1,n) a

Measured memory_bytes: 1020
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	static long mod = (long)(1e9+7);
	public static void main(String[] args) { //Ball out 
		/*
		 * */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long a  = I.nextLong();
		long b  = I.nextLong();
		long c  = I.nextLong();
		long d  = I.nextLong();
		long ans = Long.MIN_VALUE;
		ans=max(ans,a*c);
		ans=max(ans,b*c);
		ans=max(ans,a*d);
		ans=max(ans,b*d);
		O.pln(ans);
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x) {return Math.abs(x);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] input = new int[N];
		for (int i = 0; i < N; i++) {
			input[i] = sc.nextInt();
		}
		int min = Integer.MAX_VALUE;
		int res = 0;
		for (int i = 0; i < input.length; i++) {
			if (input[i] < min) {
				min = input[i];
				res++;
			}
		}
		System.out.print(res);
	}
}

Measured memory_bytes: 65360
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextLong();
			}
			Arrays.sort(a);
			long ans = 0;
			for (int i = 1; i < n; i++) {
				int cnt = (i + 2) / 2;
				ans += a[n - cnt];
			}
			System.out.print(ans);
		}
	}
}

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

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

  vector<int> p(n);
  rep(i, n) {
    cin >> p[i];
  }

  int min_ans = 100000000;
  int ans = -1;
  for(int i=0;i<=101;i++) {
    bool is_in = false;
    int min_abs = 100000000;
    for(auto v : p) {
      if(i == v) {
        is_in = true;
        break;
      }
    }
    if(!is_in) {
      min_abs = min(min_abs, abs(x - i));
      if(min_abs < min_ans) {
        min_ans = min_abs;
        ans = i;
      }
    }
  }

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


Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main(){
  int n;
  
  cin >> n;
  
  for(int i = 0;i * 4 <= n;i++){
    if((n - i * 4) % 7 == 0){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl; 
  
  return 0;
}

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

int main(){
	int r;
	cin >> r;
	cout << 3*r*r << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

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

int main(){
  int i,j,n,ans,x;
  while(cin >> n){
    ans = n;
    for(i=1;i<4;i++){
      cin >> n;
      ans += n;
    }
    x = ans / 60;
    ans -= x * 60;

    cout << x << endl;
    cout << ans << endl;

  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int n,m,cc,vis[705],col[705],num[705][2],f[705][705],e[705][705];
void dfs(int x,int c)
{
	num[cc][c]++;col[x]=c;vis[x]=1;
	for(int i=1;i<=n;i++)if(!vis[i]&&!e[x][i])dfs(i,c^1);else if(!e[x][i]&&col[i]==c){puts("-1");exit(0);}
}
int main()
{
	scanf("%d%d",&n,&m);f[0][0]=1;
	for(int i=1,u,v;i<=m;i++)scanf("%d%d",&u,&v),e[u][v]=e[v][u]=1;
	for(int i=1;i<=n;i++)e[i][i]=1;
	for(int i=1;i<=n;i++)if(!vis[i])cc++,dfs(i,0);
	for(int i=1;i<=cc;i++)for(int j=0;j<=n;j++)if(f[i-1][j])f[i][j+num[i][0]]=f[i][j+num[i][1]]=1;
	int ans=1e9;
	for(int i=0;i<=n;i++)if(f[cc][i])ans=min(ans,i*(i-1)/2+(n-i)*(n-i-1)/2);
	printf("%d\n",ans);return 0;
	
}

Measured memory_bytes: 4096
#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 4500000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7880
#include<stdio.h>
#define MAX 100
#define INFTY 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

int prim(){
  int u,minv,i,v;
  int d[MAX],p[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }

  d[0]=0;

  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v]!=INFTY){
	if(d[v]>M[u][v]){
	  d[v]=M[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  int sum=0;
  for(i=0;i<n;i++){
    if(p[i]!=-1) sum+=M[i][p[i]];
  }

  return sum;
}

int main(){
  int i,j,e;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e==-1) M[i][j]=INFTY;
      else M[i][j]=e;
    }
  }
  printf("%d\n",prim());
  return 0;
}



Measured memory_bytes: 2104
N = int(input())
L = [2, 1]


def Lucas(n):
    """
    >>> Lucas(5)
    11
    >>> Lucas(86)
    939587134549734843
    """
    if len(L) > n:
        return L[n]
    else:
        L.append(Lucas(n - 1) + Lucas(n - 2))
        return L[n]


print(Lucas(N))


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000000

int n, A[MAX];

void maxHeapify(int i)
{
    int l, r, largest, temp;
    l = 2 * i;
    r = 2 * i + 1;

    if (l <= n && A[l] > A[i])
         largest = l;
    else
         largest = i;
    
    if (r <= n && A[r] > A[largest]) 
        largest = r;
    
    if (largest != i)
    {
        temp = A[i];
        A[i] = A[largest];
        A[largest] = temp;
        maxHeapify(largest);
    }
}

int main()
{
    int i;

    scanf("%d", &n);

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

    for (i = n / 2; i >= 1; i--)
        maxHeapify(i);

    for (i = 1; i < n + 1; i++)
        printf(" %d", A[i]);
    
    printf("\n");

    return 0;
}



Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1000000000000000000;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vl a,b,c;

int f(ll l,ll r){
	return lower_bound(c.begin(),c.end(),r)-lower_bound(c.begin(),c.end(),l);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	a=b=c=vl(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	ll res=0;
	for(int i=0;i<30;i++){
		ll A=1<<i;
		for(int j=0;j<n;j++) c[j]=b[j]%(A*2);
		sort(c.begin(),c.end());
		int t=0;
		for(int j=0;j<n;j++){
			ll N=a[j]%(A*2);
			(t+=f(A-N,A*2-N)+f(3*A-N,4*A-N))%=2;
		}
		res+=(1<<i)*t;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 4992
N = int(input())
S = input()
S_list = list(S)
if N%2 == 0:
    first_s = ','.join(S_list[0:int(N/2)]) 
    last_s =  ','.join(S_list[int(N/2):int(N)]) 
    if first_s == last_s:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
#include<iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

int main(){
  int N, M;
  priority_queue<unsigned long long, vector<unsigned long long>, greater<unsigned long long> > A;
  priority_queue<pair<unsigned long long, int> > CB; 
  cin >> N >> M;
  for (int i = 0; i < N; i++){
    unsigned long long tmp;
    cin >> tmp;
    A.push(tmp);
  }

  for (int i = 0; i < M; i++){
    pair<unsigned long long, int> tmp;
    cin >> tmp.second >> tmp.first;
    CB.push(tmp);
  }

  while (!CB.empty()) {
    pair<unsigned long long, int> tmp = CB.top();
    if(A.top() >= tmp.first) break;
    for (int i = 0; i < tmp.second; i++){
      if (A.top() >= tmp.first) break;
      A.pop();
      A.push(tmp.first);
    }
    CB.pop();
  }
  
  unsigned long long ans = 0;
  while (!A.empty()) {
    ans += A.top();
    A.pop();
  }
  printf("%llu\n", ans);
  
}


Measured memory_bytes: 6064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	int flag=0;
	for(int i=1; i<=1000; i++) {
		if(c==i*a%b) {
			flag=1;
			break;
		}
	}
	if(flag) {
		cout<<"YES"<<endl;
	} else {
		cout<<"NO"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
// C + T = X
// 2 * C + 4 * T = Y
// T = X - C
// 2 * C + 4 * (X - C) = Y
// - 2 * C = Y - 4 * X
// C = 2 * X - Y / 2
// T = -X + Y / 2

import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        int X, Y;
        X = Integer.parseInt (arr[0]);
        Y = Integer.parseInt (arr[1]);
        int C, T;
        C = 2 * X - Y / 2;
        T = -X + Y / 2;
        System.out.println (0 <= C && 0 <= T && 2 * C + 4 * T == Y && C + T == X
                                ? "Yes"
                                : "No");
        return;
    }
}

Measured memory_bytes: 32612
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 100000;
const ll INF = (1ll<<60);
ll dp[MAXN + 5], a[MAXN + 5], T;
int que[MAXN + 5], s, t;
ll f1(int x) {
	return dp[x] - a[x] - 2*a[x+1];
}
ll f2(int x) {
	return T + 2*a[x+1];
}
int main() {
	int N, M;
	scanf("%d%d%lld", &N, &M, &T);
	for(int i=1;i<=N;i++)
		scanf("%lld", &a[i]);
	a[N+1] = M; ll p = INF;
	s = 1, t = 0;
	for(int i=1;i<=N+1;i++) {
		dp[i] = INF;
		while( s <= t && f1(que[t]) + f2(que[t]) >= f1(i-1) + f2(i-1) )
			t--;
		que[++t] = i-1;
		while( s <= t && f2(que[s])-2*a[i] <= 0 ) {
			p = min(p, f1(que[s]));
			s++;
		}
		dp[i] = min(p, f1(que[s]) + f2(que[s]) - 2*a[i]) + 3*a[i];
	}
	printf("%lld\n", min(dp[N+1], dp[N]+M-a[N]));
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>


int max(int a, int b) {
  return (a > b)?a:b;
}

int solve(char *a, char *b, int al, int bl) {
  int i,j;
  int table[al+1][bl+1];
  for (i = 0; i <= al; i++) {
    table[i][0] = 0;
  }
  for (i = 0; i <= bl; i++) {
    table[0][i] = 0;
  }
  for (i = 1; i <= al; i++) {
    for (j = 1; j <=
	   bl; j++) {
      if(a[i-1] == b[j-1]) table[i][j] = table[i-1][j-1]+1;
      else table[i][j] = max(table[i-1][j], table[i][j-1]);
    }
  }
  return table[al][bl];
}

int main()
{
  int i,q,al,bl;
  char a[1001],b[1001];
  scanf("%d ",&q);
  for (i = 0; i < q; i++) {
    scanf("%s %s",a,b);
    al = strlen(a);
    bl = strlen(b);
    printf("%d\n",solve(a,b,al,bl));
  }
  return 0;
}

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

using namespace std;

int n,a,b,f[1<<20];

void solve(int l,int r,int x,int y,int s){
	if (l+1==r){f[l]=x; f[r]=y; return;}
	int mid=(l+r)>>1;
	int k=0;
	for (;k<n;++k)
		if ((s>>k&1)&&((x>>k&1)^(y>>k&1))){s^=1<<k; break;}
	int t=s;
	for (;__builtin_popcount(t)%2==0;t=(t-1)&s);
	solve(l,mid,x,x^t,s);
	solve(mid+1,r,x^t^(1<<k),y,s);
}

int main(){
	scanf("%d%d%d",&n,&a,&b);
	if (__builtin_popcount(a^b)%2==0){puts("NO"); return 0;}
	solve(0,(1<<n)-1,a,b,(1<<n)-1);
	puts("YES");
	for (int i=0;i<1<<n;++i) printf(i==(1<<n)-1?"%d\n":"%d ",f[i]);
	
	return 0;
}
			

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

int main() {
  ll n,k;
  cin >> n >> k;
  vector<double> p(n);
  for(ll i=0;i<n;i++) {
    ll temp;
    cin >> temp;
    p[i]=(1+temp)/2.0;
  }
  vector<double> sp(n);
  for(ll i=0;i<n;i++) {
    if(i==0) {
      sp[i]=p[i];
    }
    else {
      sp[i]=sp[i-1]+p[i];
    }
  }
  double ans=sp[k-1];
  for(ll i=k;i<n;i++) {
    ans=max(ans,sp[i]-sp[i-k]);
  }
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 3328
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
const int IMAX = 100000;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

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


	int N, a, b;
	cin >> N >> a >> b;

	ll kotae = modpow(2, N) - 1;
	
	ll tmp1 = 1;
	ll waru = 1;
	rep(i, a) {
		tmp1 = tmp1 * (N - i) % mod;
		waru = waru * (i + 1) % mod;
	}
	kotae -= tmp1 * modpow(waru, mod - 2) % mod;
	tmp1 = 1;
	waru = 1;
	rep(i, b) {
		tmp1 = tmp1 * (N - i) % mod;
		waru = waru * (i + 1) % mod;
	}
	kotae -= tmp1 * modpow(waru, mod - 2) % mod;

	kotae %= mod;
	kotae += mod;
	co(kotae% mod);




	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int n,k,q,val;
  cin>>n>>k>>q;
  vector<int>scores(n,k);
  for(int i=0;i<q;i++){
  	cin>>val;
  	scores[val-1]++;
  }
  for(int i=0;i<n;i++){
  	if(scores[i]-q<=0){
  		cout<<"No"<<endl;
  	}else{
  		cout<<"Yes"<<endl;
  	}
  }
}



Measured memory_bytes: 1152
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int n=in.nextInt();
    String arr[]=new String[2];
    for(int i=0;i<2;i++)
    {
        arr[i]=in.next();
    }
    for(int i=0;i<n;i++)
    {
        System.out.print(arr[0].charAt(i)+""+arr[1].charAt(i));
    }
}
}


Measured memory_bytes: 38904
#include <iostream>
#include <cstdio>

using namespace std;

long long X;
long long S, i;

int main() {
    cin >> X;

    S = 0;
    i = 0;

    while(S < X) {
        ++i;
        S += i;
    }

    cout << i << '\n';

    return 0;
}


Measured memory_bytes: 256
def main():
    n, k, *x = map(int, open(0).read().split())
    f = lambda i: x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))
    l = f(0)

    for i in range(n - k + 1):
        y = f(i)
        if y < l:
            l = y

    print(l)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14052
# 105, 135, 165, 189, 195

n = int(input())
ans = 0

if n >= 105: #3 5 7
    ans+=1
if n >= 135: # 3 3 3 5
    ans+=1
if n >= 165: # 3 5 11
    ans+=1
if n >= 189: # 3 3 3 7
    ans+=1
if n >= 195: # 3 5 13
    ans+=1
print(ans)


Measured memory_bytes: 2940
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>

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

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;



int main() {
    int N; cin>>N;
    string s, t; cin>>s>>t;
    int res = 2*N;

    for (int i = 1; i <= N; i++) {
       if(s.substr(N-i,i)==t.substr(0, i))res=min(res, 2*N-i);
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256