akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
using ld = long double;
const int MAXN = 55;
bool a[MAXN][MAXN];
int n,m;

void enter()
{
    memset(a, false,sizeof(a));
    cin >> n >> m;
    for(int i=1; i<=n; ++i)
    for(int j=1; j<=m; ++j)
    {
        char t;
        cin >> t;
        if (t=='#') a[i][j] = true;
    }
    bool ans=true;
    for(int i=1; i<=n; ++i)
    {
        if (ans==false) continue;
        for(int j=1; j<=m; ++j)
        {
            if (ans==false) continue;
            if (a[i][j])
            {
                int flag=false;
                flag=flag|a[i][j-1];
                flag=flag|a[i][j+1];
                flag=flag|a[i+1][j];
                flag=flag|a[i-1][j];
                if (flag==false) ans=false;
            }
        }
    }
    if (ans) cout << "Yes"; else cout << "No";
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    enter();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n); rep(i,n) cin >> a[i];
    ld bunbo=0.0;
    rep(i,n)bunbo+=1.0/a[i];
    cout<<1.0/bunbo<<endl;
}

Measured memory_bytes: 3800
enemy_num, dethblow_num, *enemy_hp = map(int, open(0).read().split())

if enemy_num >= dethblow_num:
    enemy_hp.sort(reverse=True)
    del enemy_hp[:dethblow_num]
else:
    enemy_hp.clear()
    enemy_hp = [0]
    
print(sum(enemy_hp))

Measured memory_bytes: 25180
#include<iostream>
using namespace std;
#include<string>
#define REP(i,a,b) \
for(int i=a; i<b; i++)
#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define present(c,x) ((c).find(x) != (c).end())
#define tr(c,i) for(typeof(c.begin()) i = (c).begin(); i != (c).end();i++)

int main()
{
	int n,ans=0;
	cin >> n;
	int arr[n];
	REP(i,0,n)cin >> arr[i];
	REP(i,1,n)
	{
		if(arr[i] == arr[i-1])
		{
			ans++;
			arr[i] = 1000000;
		}
	}
	cout << ans;
}


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

using namespace std;

int main(){
  string title_1, title_2, title_3, abbreviation;
  cin >> title_1 >> title_2 >> title_3;
  
  abbreviation += title_1.at(0);
  abbreviation += title_2.at(0);
  abbreviation += title_3.at(0);
  
  cout << abbreviation << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	long double A, B;
	cin >> A >> B;
	LL ans=floor(A*B);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3732
#include<stdio.h>
int main(void){
	int x,y,n;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0)break;
		if(x>y){
			n=x;
			x=y;
			y=n;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

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


using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	vector<long> v(N), vec(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
		vec[i] = v[i] - i - 1;
	}
	sort(vec.begin(), vec.end());
	long b;
	if ((N % 2) == 0) {
		b = (vec[N/2] + vec[N/2-1]) / 2;
	} else {
		b = vec[N/2];
	}

	long ans = 0;
	for (int i = 0 ; i < N; i++) {
		ans += abs(v[i] - b - i - 1);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char ch[105];
int n,hsh[225],Ans;
int main(){
	scanf("%d",&n);gets(ch);gets(ch);
	for(int i=0;i<n;i++){
		int Num=0;
		memset(hsh,0,sizeof(hsh));
		for(int j=0;j<=i;j++) hsh[ch[j]]=1;
		for(int j=i+1;j<n;j++)
		if(hsh[ch[j]]) Num++,hsh[ch[j]]=0;
		Ans=max(Ans,Num);
	}
	printf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    st=[split(readline()) for i in 1:n]
    x=chomp(readline())
    ans=0
    flg=false
    for i in 1:n
        if flg
            ans+=parseInt(st[i][2])
        end
        if st[i][1]==x
            flg=true
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 172976
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;

int main() {
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
}


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

int main(){
  
  int N, K; cin >> N >> K;
  int h = 0;
  int count = 0;
  for(int i = 0; i < N; i++){
    cin >> h;
    if(h >= K) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
function main(input) {
  const args = input.split('\n');
  const N = parseInt(args[0], 10);
  let ary = args[1].split(' ').map(n => parseInt(n, 10));
  let count = 0;
  let ans = 0;
  
  ary = ary.sort((a, b) => a - b);
  
  if (N === 1) {
  	ans = ary[1];
  } else {
    while(true) {
      ans += ary[N + (2 * count)];
      count++;
      if (count === N) { break; }
    }
  }
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 56756
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n = ii()
    d = defaultdict(int)
    for _ in range(n):
        s = input()
        d[s] += 1
    max_num = - float('inf')
    for k, v in d.items():
        max_num = max(max_num, v)
    L = list(d.items())
    L.sort(key=lambda x: x[0])
    for elm in L:
        if elm[1] == max_num:
            print(elm[0])

if __name__ == "__main__":
    main()

Measured memory_bytes: 46900
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=20;

int n,ans,t,x,y;
vector<pair<int,int> > v[N];

void dpf(int i,int mask,int cnt){
	if(i==n+1){
		for(int p=1;p<=n;p++){
			if(((mask&(1<<p))!=0)){
				//cout<<mask<<" "<<p<<endl;
				for(int j=0;j<v[p].size();j++){
					if((v[p][j].s2==0 && (mask&(1<<v[p][j].f1))!=0))return;
					else if(v[p][j].s2==1 && (mask&(1<<v[p][j].f1))==0)return;
				}
			}
		}
		ans=max(ans,cnt);
		//cout<<cnt<<" "<<mask<<endl;
		return;
	}
	dpf(i+1,(mask|(1<<i)),cnt+1);
	dpf(i+1,mask,cnt);
}

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t;
		for(int j=0;j<t;j++){
			cin>>x>>y;
			v[i].pb({x,y});
		}
	}
	dpf(1,0,0);
	cout<<ans<<endl;


return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int>d1(n,0),d2(n,0);
  rep(i,n)cin>>d1.at(i)>>d2.at(i);
  int a=0;
  for(int i=0;i<n-2;i++){
    if(d1.at(i)==d2.at(i)&&d1.at(i+1)==d2.at(i+1)&&d1.at(i+2)==d2.at(i+2)){
      a=1;
    }
  }
  if(a)cout<<"Yes";
  else cout<<"No";
  
  }


Measured memory_bytes: 3628
#include<bits/stdc++.h>
    using namespace std;
	
    int main(){
    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		string s;
		cin>>s;
		if(s[2]==s[3] and s[4]==s[5] and s.size()==6){
			cout<<"Yes\n";
		}
		else{
			cout<<"No\n";
		}
        return 0;
    }

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

using namespace std;
typedef long long ll;

int main() {
  ll N, x, ans=0;
  cin >> N >> x;
  vector<ll> a(N+1);
  for (ll j=0; j < N; ++j) {
    cin >> a[j];
  }
  for (ll j=0; j < N; ++j) {
    ll left = a[j], right = a[j+1];
    ll sum = left+right;
    if (sum > x) {
      ll d = sum - x; ans += d;
      right -= d;
      if (right < 0) {
        left += right;
        a[j] = left;
        a[j+1] = 0;
      } else {
        a[j+1] = right;
      }
    }
  }
  cout << ans << endl;
}

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

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

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

template<class T>
struct UnionFind {
    vector<T> par,rank,large;

    void init(T N){
        rank.assign(N,0);
        large.assign(N,1);
        par.resize(N);
        for(T i= 0; i < N; i++){
            par[i]=i;
        }
    }

    T root(T x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(T x, T y) {
        T rx = root(x);
        T ry = root(y);
        if (rx == ry) return;
        if(rank[rx]<rank[ry]) {
            par[rx]=ry;
            large[ry]+=large[rx];
            large[rx]=0;
        }
        else {
            par[ry]=rx;
            large[rx]+=large[ry];
            large[ry]=0;
            if(rank[rx]==rank[ry])rank[x]++;
        }
    }

    bool same(T x, T y) {
        T rx = root(x);
        T ry = root(y);
        return rx == ry;
    }

    T size(int x) {
        return large[root(x)];
    }
};
int main(){
    ll N;
    cin>>N;
    vector<tuple<ll,ll,ll>> X(N),Y(N);
    rep(i,N){
        ll x,y;
        cin>>x>>y;
        X[i]=make_tuple(x,y,i);
        Y[i]=make_tuple(y,x,i);
    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    vector<vector<P>> g(N);
    rep(i,N-1){
        ll cost = min(abs(get<0>(X[i])-get<0>(X[i+1])),abs(get<1>(X[i])-get<1>(X[i+1])));
        g[get<2>(X[i])].push_back(make_pair(cost,get<2>(X[i+1])));
        g[get<2>(X[i+1])].push_back(make_pair(cost,get<2>(X[i])));
        cost = min(abs(get<0>(Y[i])-get<0>(Y[i+1])),abs(get<1>(Y[i])-get<1>(Y[i+1])));
        g[get<2>(Y[i])].push_back(make_pair(cost,get<2>(Y[i+1])));
        g[get<2>(Y[i+1])].push_back(make_pair(cost,get<2>(Y[i])));
    }
    rep(i,N){
        sort(g[i].begin(),g[i].end());
    }
    ll ans = 0;
    UnionFind<ll> tree;
    tree.init(N);
    priority_queue<P,vector<P>,greater<P>> ed;
    for(auto x:g[0]) ed.push(x);
    rep(i,N-1){
        while(!ed.empty()){
            P p = ed.top();
            ed.pop();
            if(!tree.same(0,p.second)){
                ans += p.first;
                for(auto x:g[p.second]){
                    ed.push(x);
                }
                tree.unite(0,p.second);
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 25304
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

class UnionFind {
    vector<int> uni;
    int n;
public:
    explicit UnionFind(int n) : uni(static_cast<u32>(n), -1) , n(n){};

    int root(int a){
        if (uni[a] < 0) return a;
        else return (uni[a] = root(uni[a]));
    }

    bool unite(int a, int b) {
        a = root(a);
        b = root(b);
        if(a == b) return false;
        if(uni[a] > uni[b]) swap(a, b);
        uni[a] += uni[b];
        uni[b] = a;
        return true;
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    UnionFind U = UnionFind(n);
    for (int i = 0; i < q; ++i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        if(a == 0) {
            U.unite(b, c);
        }
        else cout << (U.root(b) == U.root(c)) << "\n";
    }
    return 0;
}



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

const int MAXN = 2005;

int a[MAXN], n, x;
int f[MAXN][MAXN];

int main()
{
	scanf("%d%d", &n, &x);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	long long ans = 1e18;
	for (int i = 0; i < n; i++) {
		f[i][0] = a[i];
		for (int j = 1; j < n; j++)
			f[i][j] = min(f[i][j-1], a[(i-j+n)%n]);
	}
	for (int i = 0; i < n; i++) {
		long long cur = (long long)x*i;
		for (int j = 0; j < n; j++)
			cur += f[j][i];
		ans = min(ans, cur);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15872
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt();

        int left = 0;
        int right = (int)1e9+100;

        while (left<right) {
            int mid = (left+right) / 2;
            long cnt = 0;
            if (mid!=0) {
                for (int i=0; i<n; i++) {
                    cnt += (arr[i] - 1) / mid;
                }
            } else {
                cnt = Long.MAX_VALUE;
            }
            if (k < cnt) {
                left = mid+1;
            } else {
                right = mid;
            }
//            System.out.println(left);
        }

        System.out.println(left);
    }


}



Measured memory_bytes: 61252
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

int main() {

	int H1, H2, M1, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	int T = 60 * (H2 - H1) + (M2 - M1) - K;

	cout << T << endl;

	return 0;
}


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

long used[2000000];
long x[10];
long a,b,i,j,l;
bool flag;

void seperate (long a)
{
  long i,j,m;
  
  m=0;
  while (a!=0)
  {
    m++;
    x[m]=a % 10;
    a=a / 10;
    
    /*cout <<a<<endl;*/
  }
  
  m++;
  for (i=m;i<=l;i++) x[i]=0;
}

void doit(long a,long num)
{
  flag=false;
  while (flag==false)
  {
    seperate(a);
    
    for (i=1;i<=l;i++)
      for (j=i+1;j<=l;j++)
        if (x[i]<x[j]) swap(x[i],x[j]);
        
    int maxi,mini,temp;
    maxi=0;mini=0;
    
    for (i=1;i<=l;i++) maxi=maxi*10+x[i];
    for (i=l;i>=1;i--) mini=mini*10+x[i];
    temp=maxi-mini;
    
    if  (used[temp]!=-1) 
    {
      cout <<used[temp]<<" "<<temp<<" "<<num+1-used[temp]<<endl;
      flag=true;
      return;
    }  
    else
    {
      used[temp]=num+1;
      doit(temp,num+1);
    }  
  }
}
 
int main()
{
  while (true)
  {
    cin >>a>>l;
    if ((a==0)&&(l==0)) break;
    
    memset(used,-1,sizeof(used));
    used[a]=0;
    doit(a,0);
  }
  return 0;
}

Measured memory_bytes: 8684
use proconio::input;

fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut odd_count: usize = 0;

    for a in aa {
        if a % 2 == 1 {
            odd_count += 1;
        }
    }

    if odd_count > 0 {
        println!("first");
    } else {
        println!("second");
    }
}


Measured memory_bytes: 3720
s = input()
n = len(s)

#RRLRL=(R2L),(RL)
#ランレングス圧縮でRLを圧縮し、数の偶奇で分配する
#n<=10**5なので、10**5移動させた後の値でも求められる
v=[]
def RLE(s,v):
    for i in range(len(s)):
        if len(v)==0 or v[-1][0]!=s[i]:
            v.append([s[i],1])
        else:
            v[-1][1]+=1
    return v
rle_li = RLE(s,v)

string_li = [0]*n
for i in range(1,n):
    if s[i-1]=='R' and s[i]=='L':
        x = rle_li.pop(0)[1]
        y = rle_li.pop(0)[1]
        if x==1 and y==1:
            string_li[i-1]=1
            string_li[i]=1
        else:
            if y%2==0:
                string_li[i-1]+=y//2
                string_li[i]+=y//2
            else:
                string_li[i-1]+=y//2
                string_li[i]+=y//2+1
            if x%2==0:
                string_li[i-1]+=x//2
                string_li[i]+=x//2
            else:
                string_li[i-1]+=x//2+1
                string_li[i]+=x//2
print(' '.join(map(str,string_li)))



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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
#define HYPP(x) hypot(x.first,x.second)

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;



int main() {
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		ans += min(x, abs(K - x)) * 2;
	}
	cout << ans << endl;
	return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  string s, t; cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3800
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-10;

template <typename T> void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}

ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}

// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};
// ll pas[5001][5002];

ld add(ld a, ld b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
	return a + b;
}

struct Point {
	ld x, y;
	int num;
	Point() {}
	Point(ld x, ld y) : x(x), y(y) {}
	Point(ld x, ld y, int n) : x(x), y(y), num(n) {}
	Point operator+(const Point &p) { return Point(add(x, p.x), add(y, p.y)); }
	Point operator-(const Point &p) {
		return Point(add(x, -p.x), add(y, -p.y));
	}
	bool operator==(const Point &p) { return x == p.x && y == p.y; }
	bool operator!=(const Point &p) { return *this == p; }
	bool operator<(const Point &p) {
		if (x != p.x)
			return x < p.x;
		else
			return y < p.y;
	}
	friend Point operator*(ld k, const Point &p) {
		return Point(k * p.x, k * p.y);
	}
	ld dot(const Point &p) { return add(x * p.x, y * p.y); }
	ld det(const Point &p) { return add(x * p.y, -y * p.x); }
};

vector<Point> convex_hull(vector<Point> p) {
	sort(p.begin(), p.end());
	int n = p.size();
	int k = 0;
	vector<Point> q(2 * n);
	for (int i = 0; i < n; i++) {
		while (k > 1 && (q[k - 1] - q[k - 2]).det(p[i] - q[k - 1]) <= 0) k--;
		q[k++] = p[i];
	}
	for (int i = n - 2, t = k; i >= 0; i--) {
		while (k > t && (q[k - 1] - q[k - 2]).det(p[i] - q[k - 1]) <= 0) k--;
		q[k++] = p[i];
	}
	q.resize(k - 1);
	return q;
}

ld dist(Point p1, Point p2) { return (p1 - p2).dot(p1 - p2); }
ld dif(Point p1, Point p2) { return sqrt(dist(p1, p2)); }

ld longestdist(vector<Point> t) {
	int n = t.size();
	ld M  = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) { M = max(M, dist(t[i], t[j])); }
	}
	return M;
}

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<Point> p(n);
	vector<ld> ans(n, 0);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		p[i] = Point(x, y, i);
	}

	vector<Point> q = convex_hull(p);

	int m = q.size();
	for (int j = 0; j < m; j++) {
		ld costh = (q[mod(j - 1, m)] - q[j]).dot(q[mod(j + 1, m)] - q[j]);
		costh /= dif(q[mod(j - 1, m)], q[j]) * dif(q[mod(j + 1, m)], q[j]);
		if (abs(costh - 1) <= EPS) costh = 1.0;
		if (abs(costh + 1) <= EPS) costh = -1.0;
		ans[q[j].num] = (M_PI - acos(costh)) / (2 * M_PI);
	}
	for (int i = 0; i < n; i++) { dumpf(ans[i], 8); }
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int SIZE_FACT = 500010;
vector<ll> fact, invfact;
ll comb(int n, int k) {
	return fact[n] * invfact[k] % mod * invfact[n-k] % mod;
}
ll modpow(ll n, int k) {
	ll r = 1;
	while (k > 0) {
		if (k&1) (r *= n) %= mod;
		(n *= n) %= mod;
		k >>= 1;
	}
	return r;
}
int main() {
	fact.resize(SIZE_FACT);
	invfact.resize(SIZE_FACT);
	fact[0] = invfact[0] = 1;
	for (int i = 1; i < SIZE_FACT; ++ i) {
		fact[i] = fact[i-1] * i % mod;
		invfact[i] = modpow(fact[i], mod-2);
	}

	int N, M;
	cin >> N >> M;
	ll res = fact[M] * invfact[M-N] % mod;
	res = res * res % mod;
	for (int i = 1; i <= N; ++ i) {
		ll r1 = comb(N, i) * fact[M] % mod * invfact[M-i] % mod;
		ll r2 = fact[M-i] * invfact[M-N] % mod;
		ll rr = r1 * r2 % mod * r2 % mod;
		if (i % 2) {
			(res += mod - rr % mod) %= mod;
		} else {
			(res += rr) %= mod;
		}
	}
	cout << res << endl;
}


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

int main(void)
{

    int n, k, q, a;
    cin >> n >> k >> q;
    vector<int> v(n);

    for (int i = 0; i < q; i++)
    {
        cin >> a;
        v[a - 1]++;
    }

    for (int i = 0; i < n; i++)
    {
        if ((v[i] - q + k) > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }

    return 0;
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

int a, b;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;:w
#endif
  cin >> a >> b;
  cout << (a - 1) * (b - 1) << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())
print("U"*(ty-sy)+"R"*(tx-sx)+"D"*(ty-sy)+"L"*(tx-sx)+"L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U")


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
	int N,K,i,j,S[100],B,a;
	while(a=1,scanf("%d %d",&N,&K),N||K){
		for(i=K;i--;)scanf("%d",S+i);
		for(i=N;i--;)for(j=K;j--;)scanf("%d",&B),S[j]-=B,S[j]<0?a=0:0;
		puts(a?"Yes":"No");
	}
}

Measured memory_bytes: 1012
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX_N 100100
using namespace std;
int main(){
int n;
long long h;
cin >> n >> h;
vector<pair<int,bool> > a(MAX_N*2);
rep(i,n){
  cin >> a[i*2].first;
  a[i*2].second = true;
  cin >> a[i*2+1].first;
  a[i*2+1].second = false;
}
sort(a.rbegin(),a.rend());

long long c = 0;
rep(i,n*2){
  h -= a[i].first;
  c++;
  if(h <= 0){
    cout << c << endl;
    return 0;
  }
  if(a[i].second){
    c += ceil((double)h/a[i].first);
    cout << c << endl;
    return 0;
  }
}
return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>

using namespace std;

typedef complex<double> P;

double dot(P p1,P p2){
	return p1.real() * p2.imag() - p1.imag() * p2.real();
}


int main(){

	double x1,x2,x3,y1,y2,y3;
	double xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P  p1(x1,y1),p2(x2,y2),p3(x3,y3),po(xp,yp);
		bool f = true;
		if( dot(p2-p1,p3-p1) * dot(p2-p1,po-p1) < 0)
			f = false;
		else if(dot(p3-p1,p2-p1) * dot(p3-p1,po-p1) < 0)
			f = false;
		else if(dot(p2-p3,p1-p3) * dot(p2-p3,po-p3) < 0)
			f = false;

		cout << (f ? "YES" : "NO") << endl;

	}

	return 0;
}

Measured memory_bytes: 0
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=0
c=[]
for i in range(1,n):
  if l[i]==a:
    b+=1
  else:
    c.append(b)
    b=0
  a=l[i]
c.append(b)
for i in range(len(c)):
  c[i]=(c[i]+1)//2
print(sum(c))

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

int f(int x)
{
    if (!x)
    {
        return 0;
    }
    return f(x / 10) + x % 10;
}

int main()
{
    int n;
    cin >> n;
    int ans = 100000;
    for (int i = 1; i <= n - 1; i++)
    {
        ans = min(ans, f(i) + f(n - i));
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

bool win(const vector<int>& A){
    int even = count_if(A.begin(), A.end(), [](int t){ return t%2 == 0; });
    if(even%2 == 1) return true;
    if(even != A.size() - 1) return false;

    auto B = A;
    int g = B[0];
    for(auto& t : B){
        if(t%2 == 1){
            if(t == 1) return false;
            --t;
        }
        g = gcd(g, t);
    }
    for(auto& t : B) t /= g;
    return !win(B);
}

int main(){
    int N;
    while(cin >> N){
        vector<int> A(N);
        for(auto& t : A) cin >> t;
        cout << (win(A) ? "First" : "Second") << endl;
    }
}

Measured memory_bytes: 9600
N,W = map(int,input().split())
item = [list(map(int,input().split())) for i in range(N)]

dp = [0] * (W + 1)

for w in range(W + 1):
  for i in range(N):
    if w >= item[i][1]:
      dp[w] = max(dp[w - item[i][1]] + item[i][0],dp[w])
      
print(dp[-1])


Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  int n;
  cin >> n;
  vector<vi> v(n,vector<int>(200,0));
  rep(i,n) {
    string s;
    cin >> s;
    rep(j,s.size()) v[i][(int)s[j]]++;
  }
  vector<int> ans(200);
  for(int i = (int)'a'; i <= (int)'z'; i++) {
    rep(j,n) {
      if(j==0) ans[i] = v[j][i];
      else ans[i] = min(ans[i],v[j][i]);
    }
  }
  for(int i = (int)'a'; i <= (int)'z'; i++) {
    rep(j,ans[i]) cout << (char)i;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using ll = long long;

struct entry {
    int m, d, ts, id;
    string a;

    entry() {}
};

char exist[1000][1440];

int main() {
    char ch;
    string t, id;
    while (true) {
        int N;
        cin >> N; if (N == 0) break;
        vector<entry> v(N);
        for (int j = 0; j < N; ++j) {
            int h, s;
            cin >> v[j].m >> ch >> v[j].d >> h >> ch
                >> s >> v[j].a >> v[j].id;
            v[j].ts = h * 60 + s;
        }

        const int END = 24*60;

        int count[1000], since[1000], until[1000];
        fill(count, count+1000, 0);
        for (int j = 0; j < 1000; ++j) fill(exist[j], exist[j]+END, 0);

        for (int j = 0; j < N; ++j) {
            if (j > 0 && (v[j-1].m != v[j].m || v[j-1].d != v[j].d)) {
                for (int t = 0; t < 24*60; ++t) {
                    for (int j = 1; j < 1000; ++j) {
                        count[j] += exist[0][t] * exist[j][t];
                    }
                }
                for (int j = 0; j < 1000; ++j) fill(exist[j], exist[j]+END, 0);
            }

            const entry e = v[j];

            if (e.a == "I") {
                since[e.id] = e.ts;
            } else {
                until[e.id] = e.ts;
                fill(exist[e.id]+since[e.id], exist[e.id]+until[e.id], 1);
            }
        }
        for (int t = 0; t < 24*60; ++t) {
            for (int j = 1; j < 1000; ++j) {
                count[j] += exist[0][t] * exist[j][t];
            }
        }

        int a = 0;
        for (int j = 1; j < 1000; ++j) {
            a = max(a, count[j]);
        }
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 4532
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int d = scanner.nextInt();
        int t = scanner.nextInt();
        int s = scanner.nextInt();
        System.out.println(t * s >= d ? "Yes" : "No");
    }
}

Measured memory_bytes: 35716
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner (System.in);
        String s = sc.nextLine();
        int k = sc.nextInt();
        long tot = 0;
        if (s.length() == 1) System.out.println(k/2);
        else if (s.length() == 2){
            if (s.charAt(0) == s.charAt(1)) System.out.println(k);
            else System.out.println(0);
        }
        else {
            boolean same = true;
            for (int i=1; i<s.length(); i++){
                if (s.charAt(i) != s.charAt(i-1)) same = false;
            }
            if (same) {
                tot = s.length();
                tot *= k;
                tot /= 2;
                System.out.println(tot);
            }
            else {
                int cont = 0;
                boolean first = true;
                int firstCont = 0;
                for (int i = 1; i < s.length(); i++) {
                    if (s.charAt(i) == s.charAt(i - 1)) {
                        cont++;
                    } else {
                        if (first) {
                            first = false;
                            firstCont = cont;
                        }
                        tot += (cont + 1) / 2;
                        cont = 0;
                    }
                }
                tot += (cont + 1) / 2;
                tot *= k;
                if (s.charAt(0) == s.charAt(s.length() - 1) && (cont+firstCont) % 2 == 0) tot += k - 1;
                System.out.println(tot);
            }
        }
    }
}


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

int main() {
	ll Q, a, b, j, x = -1, acnt = 0, bcnt = 0;
	cin >> Q;
	multiset<ll> qr;
	auto mid = qr.end();
	for (ll i = 0;i < Q;i++) {
		cin >> j;
		if (j - 2) {
			x++;
			cin >> a >> b;
			bcnt += b;
			qr.insert(a);
			if (x % 2) {
				acnt += abs(*mid - a);
				if (a < *mid)
					mid--;
			}
			else {
				if (x) {
					if (a >= *mid) {
						auto mids = mid;
						mid++;
						acnt -= (*mid - *mids);
						acnt += a - *mids;
					}
					else
						acnt += *mid - a;
					continue;
				}
				else {
					mid = qr.begin();
				}
			}
		}
		else {
			cout << *mid << " " << acnt + bcnt << endl;
		}
	}
}

Measured memory_bytes: 9600
n, m = map(int, input().split())
tl, tr = 1, n
for _ in range(m):
    l, r = map(int, input().split())
    if tr<l or tl>r:
        tl, tr = 1, 0; break
    else:
        tl = l if tl<l else tl
        tr = r if tr>r else tr
print(tr-tl+1)


Measured memory_bytes: 3060
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>
#include <fstream>


#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(int (i)=(a);(i)<=(int)(n);(i)++)
#define lpd(i,n,a) for(int (i)=(n);(i)>=(a);--(i))
#define mp make_pair
#define clr(a, b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define eps 1e-8
#define infi 2e9
#define infll 1e18
#define MX 1000000
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
//#define rotate(a, theta) (a) * (polar(1.0, (theta) ))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 37
#define base2 31
#define PI acos(-1)
#define sz(a) (int) (a).size()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef complex<long double> point;
typedef pair<point, point> line;
typedef pair<double , point> Circle;
typedef long double ld;


const int N = 1000002;
int n, sum[N];
char a[N];


int main() {
    scanf("%d%s",&n,a+1);
    
    lp(i, 1, n) sum[i] = sum[i-1] + (a[i] == 'W');
    
    int ans = n;
    lp(i, 1, n)
        ans = min(ans, sum[i-1] + (n-i-sum[n]+sum[i]));
    
    
    printf("%d",ans);
    
    
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int64_t N,C,K; cin>>N>>C>>K;
    vector<int64_t> T(N);
    rep(n,0,N) cin>>T.at(n);
    sort(ToEnd(T));

    int idx=0,ans=0;
    while(idx<N){
        auto new_idx=upper_bound(ToEnd(T),T.at(idx)+K);
        idx+=min(C,new_idx-T.begin()-idx);
        ans++;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import math

a,b,h,m=map(int,input().split( ))

a_deg = h*30 + m*0.5
b_deg = m*6

deg = max(a_deg-b_deg,b_deg-a_deg)

cos = math.cos(math.radians(deg))

c2 = a*a + b*b - 2*a*b*cos

print(math.sqrt(c2))

Measured memory_bytes: 9508
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
    long W, H, x, y; cin >> W >> H >> x >> y;
    if ((2 * x == W) && (2 * y == H)) {
        cout << (W * H) / 2.0 << " " << 1 << endl;
    } else {
        cout << (W * H) / 2.0 << " " << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

int main(){
  int n;
  string s;
  cin >> n >> s;
  if(n%2==1){
    cout << "No" << endl;
    return 0;
  }
  string t=s.substr(0,n/2) ,u=s.substr(n/2);
  if(t!=u) cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,q,b[N],mx[N<<2],mxcnt[N<<2],se[N<<2],tag[N<<2],tagmx[N<<2],val[N];
vector<int> vec[N];

#define ls (x<<1)
#define rs (x<<1|1)

void up(int x) {
	mx[x]=max(mx[ls],mx[rs]);
	mxcnt[x]=0;
	if(mx[x]==mx[ls]) mxcnt[x]+=mxcnt[ls];
	if(mx[x]==mx[rs]) mxcnt[x]+=mxcnt[rs];
	se[x]=max(mx[x]==mx[ls]?se[ls]:mx[ls],mx[x]==mx[rs]?se[rs]:mx[rs]);
}

void mdf(int x,int v,int vmx) {
	mx[x]+=v+vmx;se[x]+=v;tag[x]+=v;tagmx[x]+=vmx;
}	

void down(int x) {
	if(tag[x]||tagmx[x]) {
		mdf(ls,tag[x],mx[x]==mx[ls]+tag[x]+tagmx[x]?tagmx[x]:0);
		mdf(rs,tag[x],mx[x]==mx[rs]+tag[x]+tagmx[x]?tagmx[x]:0);
		tag[x]=tagmx[x]=0;
	}
}

void build(int x=1,int l=1,int r=n+1) {
	if(l==r) { se[x]=-1e9;mxcnt[x]=1;return; }
	int mid=(l+r)>>1;
	build(ls,l,mid),build(rs,mid+1,r);
	up(x);
}

void modify_min(int L,int R,int v,int x=1,int l=1,int r=n+1) {
	if(mx[x]<=v) return;
	if(L<=l&&r<=R&&se[x]<v) { mdf(x,0,v-mx[x]);return; }
	down(x);
	int mid=(l+r)>>1;
	if(L<=mid) modify_min(L,R,v,ls,l,mid);
	if(R>mid) modify_min(L,R,v,rs,mid+1,r);
	up(x);
}
	
void modify_add(int L,int R,int v,int x=1,int l=1,int r=n+1) {
	if(L<=l&&r<=R) return mdf(x,v,0);
	down(x);
	int mid=(l+r)>>1;
	if(L<=mid) modify_add(L,R,v,ls,l,mid);
	if(R>mid) modify_add(L,R,v,rs,mid+1,r);
	up(x);
}

int query(int p,int x=1,int l=1,int r=n+1) {
	if(l==r) return mx[x];
	down(x);
	int mid=(l+r)>>1;
	return p<=mid?query(p,ls,l,mid):query(p,rs,mid+1,r);
}

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) b[i]=gi();
	cin>>q;
	for(int i=1,l;i<=q;i++) l=gi(),vec[gi()].push_back(l);
	build();
	for(int i=1;i<=n;i++) {
		for(auto k:vec[i]) val[k]=query(k);
		modify_add(i+1,i+1,query(i)+b[i]);
		if(!b[i]) modify_add(1,i,1);
		for(auto k:vec[i]) modify_min(k,i+1,val[k]+(!b[i]));
		//for(int j=1;j<=i+1;j++) cerr<<query(j)<<' ';
		//cerr<<endl;
	}
	cout<<query(n+1);
	return 0;
}


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

int main() {
	int a, b;
	int ans = 0;
	cin >> a >> b;
	for (int i=0;i <2; i++) {
	if (a <= b) {
		ans = ans + b;
		b--;
	}
	else if (b < a) {
		ans = ans + a;
		a--;
	}
}
	cout<<ans<<endl;
}

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

int pmem[1300000];
vector<int> prime;
void init()
{
  for(int i = 2; i < 1300000; i++)
  {
    if(pmem[i])
      continue;
    pmem[i] = 1;
    prime.push_back(i);
    for(int j = i + i; j < 1300000; j += i)
      pmem[j] = -1;
  }
}

int main()
{
loop:
  init();
  int n;
  cin >> n;
  if(!n)
    return 0;
  for(int i = 0; i < prime.size(); i++)
  {
    if(prime[i] == n)
    {
      cout << 0 << endl;
      goto loop;
    }
    if(prime[i] > n)
    {
      cout << prime[i] - prime[i - 1] << endl;
      goto loop;
    }
  }
}

Measured memory_bytes: 6792
n, m, L = map(int, input().split())
 
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
c = [[sum(ak * bk for ak, bk in zip(ai,bj)) for bj in zip(*b)] for ai in a]
 
for ci in c:
    print(*ci)

Measured memory_bytes: 9136
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int w,h,n,x,y,k;
    vector<int> a[111];
    cin >> w >> h >> n;
    for (int i=0; i<w; i++)
        a[i].resize(h,1);
    for (int q=0; q<n; q++) {
        cin >> x >> y >> k;
        if (k==1) {
            for (int i=0; i<x; i++)
                for (int j=0; j<h; j++)
                    a[i][j]=0;
        }
        if (k==2) {
            for (int i=x; i<w; i++)
                for (int j=0; j<h; j++)
                    a[i][j]=0;
        }
        if (k==3) {
            for (int i=0; i<w; i++)
                for (int j=0; j<y; j++)
                    a[i][j]=0;
        }
        if (k==4) {
            for (int i=0; i<w; i++)
                for (int j=y; j<h; j++)
                    a[i][j]=0;
        }
    }
    int ans=0;
    for (int i=0; i<w; i++)
        for (int j=0; j<h; j++)
            if (a[i][j]==1) ans++;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
from sys import exit, stdin

# import copy
from collections import deque, Counter

# import numpy as np
input = stdin.readline

H, W, M = map(int, input().split())

col = Counter()
row = Counter()
D = Counter()
for i in range(M):
    h, w = input().split()
    row.update([h])
    col.update([w])
    D.update([h + w])

rtop = row.most_common(1)[0]
ctop = col.most_common(1)[0]


for c in col.most_common():
    if c[1] < ctop[1]:
        break
    else:
        if D[rtop[0] + c[0]] == 0:
            ans = rtop[1] + c[1]
            break
        else:
            ans = rtop[1] + c[1] - 1

for r in row.most_common():
    if r[1] < rtop[1]:
        break
    else:
        if D[r[0] + ctop[0]] == 0:
            ans2 = r[1] + ctop[1]
            break
        else:
            ans2 = r[1] + c[1] - 1

print(max(ans, ans2))



Measured memory_bytes: 120736
/*Templates are for weak. -invictus_123*/
#include <bits/stdc++.h>
using namespace std;
int main() {
 	int n;
 	scanf("%d", &n);
 	vector <int> dp(3);
 	for(int day = 0; day < n; day ++) {
 		vector <int> new_dp(3, 0), c(3);
 		for(int i = 0; i < 3; i ++) {
 			scanf("%d", &c[i]);
 		}
 		for(int i = 0; i < 3; i ++) {
 			for(int j = 0; j < 3; j ++) {
 				if(i != j) {
 					new_dp[j] = max(new_dp[j], dp[i] + c[j]);
 				}
 			}
 		}
 		dp = new_dp;
 	}   
 	printf("%d", max({dp[0], dp[1], dp[2]}));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const signed INF_=1001001001; const int INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
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(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin>>s;
    s[3]='8';
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
ok = True
for i in range(n-1, 0, -1):
	if h[i-1] > h[i]+1:
		ok = False
	elif h[i-1] > h[i]:
		h[i-1] -= 1
if ok:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 14396