akhauriyash/Code-Regression huggingface dataset:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)



        
def main(): #startline--------------------------------------------
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    dp = [[0]*(lt+1) for i in range(ls+1)]
    for i in range(ls):
        for j in range(lt):
            if s[i] == t[j]:
                dp[i+1][j+1] = dp[i][j]+1
            else:
                dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])


    ans = ""
    i = ls
    j = lt
    while dp[i][j] > 0:
        if dp[i-1][j] == dp[i][j]:
            i -= 1
        elif dp[i][j-1] == dp[i][j]:
            j -= 1
        else:
            ans = s[i-1]+ans
            i -= 1
            j -= 1

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
    

Measured memory_bytes: 136408
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int ans = 0;
    for(int i = 1; i <= n; i += 2){
        int k = 0;
        for(int x = 1; x * x <= i; x++){
            if(i % x != 0){
                continue;
            }
            k += 2;

            if(x * x == i){
                k--;
            }
        }

        if(k == 8){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
//cout << x1 << y1 << x2 << y2;
	int x3, y3, x4, y4;
	
	int dx = x2 - x1;
	int dy = y2 - y1;
	x3 = x2 - dy;
	y3 = y2 + dx;
	x4 = x3 - dx;
	y4 = y3 - dy;
	
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005

using namespace std;

vector<ll> adj[MAXN],parent(MAXN,-1),d(MAXN,0);
bool visited[MAXN];
ll dfs(){
    stack<ll> st;
    visited[0]=1;
    st.push(0);
    d[0]=1;
    while(!st.empty()){
        ll u=st.top();
        st.pop();
        forn(v,adj[u].size()){
            if(!visited[adj[u][v]]){
                visited[adj[u][v]]=1;
                st.push(adj[u][v]);
                d[adj[u][v]]=d[u]+1;
            }
            else {
                return adj[u][v];
            }

        }


    }
    return 0;

}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    memset(visited,0,sizeof visited);
    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll N,K;
        cin>>N>>K;
        forn(i,N){
            ll u;
            cin>>u;
            adj[i].push_back(u-1);
        }
        ll start=dfs();
        ll cycle=1,cur=start;
        while(1){
            cur=adj[cur][0];
            if(cur==start && cycle>0){
                break;
            }
            else{
                cycle++;
            }
        }
        K-=d[start]-d[0];
        //cout<<cycle<<start<<endl;
        if(K<0){
            K+=d[start]-d[0];
            cur=0;
            forn(i,K) cur=adj[cur][0];
            cout<<cur+1;
        }
        else{
        K%=cycle;
        cur=start;
        forn(i,K){
            cur=adj[cur][0];
        }
        cout<<cur+1;
        }



    }



    return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll inf = 1e10;


// 1 2 3 4   5 6 7
// A i B C x D E F
// F E D C B y i A
// 1 2 3 4 5 6 7 8

ll solve(ll x, ll y) {



    // Obviously we should assign smallest numbers to larger numbers to minimize product.
    // ABCDEFGH
    // HGFEDCBA
    
    // The maximal product value will be somewhere in the middle, so we wiggle around [cnt/2-10,cnt/2+10]
    // If we come after x, then our ranking for contest 1 will get boosted by 1.
    // And then because smaller are paired with bigger, we reverse this logic to see if our ranking
    // for contest 2 also gets boosted.
    

    function<bool(ll)> ok = [&](ll cnt) {
	ll mx = 0;
	for (ll i=max(1ll, cnt/2 - 10); i<= min(cnt, cnt/2 + 10); i++) {
	    ll lo = i;
	    if (lo >= x) lo++;
	    ll hi = cnt-i+1;
	    if (i <= cnt-y+1) hi++;
	    mx = max(mx, lo*hi);		
	}
	return mx < x*y;
    };


    
    ll lo = 0;
    ll hi = inf;
    while (hi-lo>1) {
	ll mid = (hi+lo)/2;
	if (ok(mid)) {
	    lo = mid;
	} else {
	    hi = mid;
	}
    }

    return lo;
}



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

    int t; cin>>t;
    while (t--) {
	ll a,b;
	cin>>a>>b;
	cout<<solve(a,b)<<"\n";
    }
    
    
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
char a[100];
int main()
{
    int n,m;
    cin>>n>>m;
    cin>>a;
    int sum1=0;
    int sum2=0;
    int len=0;
    len=strlen(a);
    int i=0;
    for(i=0;i<len;i++)
    {
        if(a[i]>='0'&&a[i]<='9')
            sum1++;
        else
            break;
    }
    i++;
    for(i;i<len;i++)
    {
        if(a[i]>='0'&&a[i]<='9')
            sum2++;
        else
            break;
    }
    if(sum1==n&&sum2==m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
class Integer
  def mod_pow(n, mod)
    x = self
    res = 1

    while n > 0
      res = res * x % mod if n[0] == 1
      x = x * x % mod
      n >>= 1
    end

    res
  end

  def mod_inverse(mod)
    mod_pow(mod - 2, mod)
  end
end

N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10 ** 9 + 7

RUI = []

k = 1

1.upto(N) do |i|
  k = k * i % MOD

  if i == 1
    RUI << i.mod_inverse(MOD)
  else
    RUI << RUI.last + i.mod_inverse(MOD)
  end
end

ans = 0

A.each_with_index do |a, i|
  r = 0

  r += RUI[i]
  r += RUI[N - i - 1]

  v = a * k * (r - 1.mod_inverse(MOD))

  ans += v.to_i
  ans %= MOD
end

puts ans


Measured memory_bytes: 12676
#include<stdio.h>
#include<math.h>
int main()
{
   double x1,y1,x2,y2,d1,d2,dt;
   scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
   d1 = (x1-x2)*(x1-x2);
   d2 = (y1-y2)*(y1-y2);
   dt = sqrt(d1+d2);
   printf("%.8lf",dt);
    return 0;
}


Measured memory_bytes: 2120
n = int(input())
lista = []
for i in range(n):
    arr = list(map(int,input().split()))
    lista.append(arr)

dp = [ [0 for i in range(3)] for j in range(n)]

dp[0][1] = lista[0][1]
dp[0][0] = lista[0][0]
dp[0][2] = lista[0][2]

for i in range(1,n):
    for j in range(3):
        for k in range(3):
            if(j != k):
                dp[i][j] = max(dp[i][j] ,dp[i-1][k] + lista[i][j])

ans = 0
for i in range(3):
    ans = max(ans ,dp[n-1][i])
print(ans)


Measured memory_bytes: 47368
#include <stdio.h>

int main(void){
  double v, t, y;
  int n;

  while(scanf("%lf", &v) != EOF){
    t = v / 9.8;
    y = 4.9 * t * t;
    for(n = 1; 5*(n-1) < y; n++);
    printf("%d\n", n);
  }
  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  int n;
  cin>>n;
  
  vector<ll> a(n);
  vector<ll> b(n);
  vector<ll> c(n);
  vector<ll> d(n);  
  rep(i,n){
    cin>>a[i]>>b[i];
    c[i]=min(a[i],b[i]);
    d[i]=max(a[i],b[i]);
  }

  sort(all(c));
  sort(all(d));

  ll smed;
  ll bmed;
  if(n%2==0){
    smed=c[n/2-1]+c[n/2];
    bmed=d[n/2-1]+d[n/2];
  }
  if(n%2==1){
    smed=c[n/2];
    bmed=d[n/2];
  }

  cout << bmed-smed+1 << endl;
}


Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void)
{
    int H, W;

    cin >> H >> W;

    vector<vector<char> > v(H);
    vector<bool> row_print(H, false);
    vector<bool> col_print(W, false);

    for(int i = 0; i < H; ++i)
    {
        v[i].resize(W);
        for(int j = 0; j < W; ++j)
        {
            cin >> v[i][j];
            if('#' == v[i][j])
            {
                row_print[i] = true;
                col_print[j] = true;
            }
        }
    }

    for(int i = 0; i < H; ++i)
    {
        if(!row_print[i]) continue;
        for(int j = 0; j < W; ++j)
        {
            if(!col_print[j]) continue;
            cout <<  v[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string>
#include<vector>
#define pb push_back
using namespace std;
typedef pair<int,int> P;
int n;
vector<P> rt;
//map<vector<vector<int> >,bool> mp;
int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
bool inf(int y,int x){
	if(y>=0&&y<n&&x>=0&&x<n)
		return true;
	return false;
}
bool cal(vector<vector<int> >&,int);
bool f(vector<vector<int> > &v,int y,int x,int left,int now){
	if(!left){
		return cal(v,now+1);
	}
	for(int i=0;i<4;i++){
		int ny=dy[i]+y,nx=dx[i]+x;
		if(inf(ny,nx)&&v[ny][nx]>0&&left-v[ny][nx]>=0){
			int temp=v[ny][nx];
			v[ny][nx]=0;
			if(f(v,ny,nx,left-temp,now)){
				return true;
			}
			v[ny][nx]=temp;
		}
	}
	return false;
}

bool cal(vector<vector<int> > &v,int now){
	if(now==rt.size()){
		for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
		if(v[i][j]!=0)
			return false;
		return true;
	}
	int y=rt[now].first;
	int x=rt[now].second;
	int temp=v[y][x];
	v[y][x]=0;
	if(f(v,y,x,-temp,now))
		return true;
	v[y][x]=temp;
	return false;
}
int main(){
	while(cin>>n,n){
		vector<vector<int> > v(n,vector<int>(n));
		rt.clear();
		for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
			cin>>v[i][j];
			if(v[i][j]<0)
			rt.pb(P(i,j));
		}
		if(cal(v,0))
		cout<<"YES"<<endl;
			else
		cout<<"NO"<<endl;
	}
	return 0;
}

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

int main() {

	int N;
	cin >> N;

	string S;
	cin >> S;

	if (N % 2 != 0) {
		cout << "No" << endl;
	}
	else {
		string T = S.substr(0, N / 2);
		if (S == (T + T)) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n;
  bool can = true;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0){
        can = false;
      }
    }
  }
  if(can) cout <<"APPROVED\n";
  else cout <<"DENIED\n";
}


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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))

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

template <class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); }
template <class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); }
template <class T> inline T ison(T n, T pos) { return (bool)(n & ((T)1 << pos)); }
template <class T> inline T gcd(T a, T b) { while (b) { a = a%b; swap(a, b); } return a; }
template <class T> inline T bigmod(T p, T e, T m) { T ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % m; p = (p * p) % m; } return (T)ret; }



void solve() {

	int n;
	cin >> n;

	vector<int> items;

	for (int i = 0; i < n; i++) {
		int item;
		cin >> item;
		items.push_back(item);
	}


	int res = 1e8;

	int t = 200;

	for (int i = 0; i <= t; i++)
	{

		int sum1 = 0;
		int sum2 = 0;


		for (int j = 0; j < n; j++) {
			
			if (j > i) {
				sum2 += items[j];
			}
			else {
				sum1 += items[j];
			}
		}

		res = min(res, abs(sum1 - sum2));
	}

	cout << res << endl;
}

int main()
{

	ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); cout.tie(nullptr); cin.tie(nullptr);

	int t = 1;

	while (t--) {

		solve();
	}



	return 0;
}

Measured memory_bytes: 256
fileprivate struct Scanner {
    private var elements = [String]()
    private var index = 0
    
    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }
    
    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }
    
    mutating func nextInt() -> Int {
        return Int(next())!
    }
    
    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

func main() {
    var scanner = Scanner()
    let X = scanner.nextInt()
    print(10 - X / 200)
}

main()


Measured memory_bytes: 7880
n = int(input())
v = list(map(int,input().split()))
v.sort()

while len(v) > 2:
    v_new = (v[0]+v[1])/2
    v_newlist = v[2:]
    v_newlist.append(v_new)
    v_newlist.sort()
    v = v_newlist
print((v[0] + v[1])/2)

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

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int sum=0;
    for(int i=0;i<n;i++)
        sum+=a[i];
    float d=(1/(4.0*m))*sum;
    int c=0;
    for(int i=0;i<n;i++)
        if(a[i]>=d)
        c++;
    if(c>=m)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  string s, t;
  cin >> s >> t;
  if (t.substr(0, s.size()) == s)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
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 long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	bool a[1001]={false};
	int x,i,j;
//	for(i=0;i<1001;i++)a[i]=false;
	for(i=1;i<=35;i++){
		for(j=2;j<=10;j++){
			ll tmp=pow(i,j);
			if(tmp<=1000)a[tmp]=true;
		}
	}
	cin>>x;
	for(i=x;i>=0;i--){
		if(a[i]){
			cout<<i<<endl;
			return 0;
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 256
def comparison(A: int, B: int) -> str:
    if A < B:
        return 'LESS'
    if B < A:
        return 'GREATER'
    return 'EQUAL'


if __name__ == "__main__":
    A, B = int(input()), int(input())
    ans = comparison(A, B)
    print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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 n,x;
  cin >> n >> x;
  int ans = 1;
  int d = 0;
  rep(i,n){
    int l;
    cin >> l;
    d += l;
    if(d<=x) ++ans;
  }
  cout << ans << endl;
}


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

int main() {
	
	int n;
	cin >> n;
	vector<ll> a(n);
	ll left = 0, right = 0;
	rep(i, n){
		cin >> a[i];
		right += a[i];
	}
	ll diff = abs(right - left);
	rep(i, n){
		left += a[i];
		right -= a[i];
		ll tmp = abs(right - left);
		if(diff > tmp) diff = tmp;
	}
	cout << diff << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<int,int> M;
	REP(i,n){
		int d;
		cin >> d;
		M[d]++;
	}
	int m;
	cin >> m;
	REP(i,m){
		int t;
		cin >> t;
		M[t]--;
		if(M[t]<0){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

int n,k,d[2][1001][2002],m=0;

int f(int z, int y, int x, int w, int v){
    int u=d[z][y][x];
    if(w<=0&&v<=0)return u;
    if(v>0)u-=f(z, y, v-1, w, 0);
    if(w>0)u-=f(z, w-1, x, 0, v);
    if(v>0&&w>0)u-=f(z, w-1, v-1, 0, 0);
    return u;
}

int main(void){
    int w=0;
    cin>>n>>k;
    for(int i=0;i<k;i++){
        fill(d[0][i], d[0][i]+k*2, 0);
        fill(d[1][i], d[1][i]+k*2, 0);
    }
    for(int i=0;i<n;i++){
        int x,y;
        char c;
        cin>>y>>x>>c;
        x%=k*2;
        y%=k*2;
        if(y>=k){
            y-=k;
            x=(x+k)%(k*2);
        }
        if(c=='B'){
            d[0][y][x]++;
        }else{
            d[1][y][x]++;
            w++;
        }
    }
    for(int i=0;i<k;i++){
        for(int j=1;j<k*2;j++){
            d[0][i][j]+=d[0][i][j-1];
            d[1][i][j]+=d[1][i][j-1];
        }
    }
    for(int j=0;j<k*2;j++){
        for(int i=1;i<k;i++){
            d[0][i][j]+=d[0][i-1][j];
            d[1][i][j]+=d[1][i-1][j];
        }
    }
    for(int i=0;i<k;i++){
        for(int j=0;j<k*2;j++){
            int v=0;
            for(int l=0;l<2;l++){
                int p=0;
                if(i==k-1){
                    if(j<k){
                        p=f(l, k-1, j, 0, 0)+f(l, k-1, k*2-1, 0, k+j+1);
                    }else{
                        p=f(l, k-1, j, 0, j-k+1);
                    }
                }else{
                    if(j<k){
                        p=f(l, i, j, 0, 0)+f(l, k-1, j+k, i+1, j+1);
                        if(j<k-1)p+=f(l, i, k*2-1, 0, j+k+1);
                    }else{
                        p=f(l, i, j, 0, j-k+1)+f(l, k-1, j-k, i+1, 0);
                        if(j<k*2-1)p+=f(l, k-1, k*2-1, i+1, j+1);
                    }
                }
                if(l==0){
                    v=p;
                }else{
                    v+=w-p;
                }
            }
            m=max(m,v);
        }
    }
    cout<<m<<endl;
}


Measured memory_bytes: 15872
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-04-29(Wed)
   note   
**********************************************************************/

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  if (A < 6) {
    cout << 0 << endl;
  }
  else if (6 <= A && A <= 12) {
    cout << B / 2 << endl;  
  }
  else {
    cout << B << endl;
  }
}



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

int main() {
  int h, w;
  std::string s;
  std::cin >> h >> w;
  for (int y = 0; y < h; ++y) {
    for (int x = 0; x < w; ++x) {
      std::cin >> s;
      if (s == "snuke") {
        std::cout << char('A' + x) << y + 1 << std::endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 504
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()

    a_list = []
    for i in range(k):
        ninsu = int(input())
        a_list.append(set(map(int, input().split())))

    all_sunukes = set([i + 1 for i in range(n)])

    ret = all_sunukes
    for a in a_list:
        ret -= a

    return len(ret)


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9636
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 305
#define INF 1000000005

using namespace std;

char str[SIZE];
int dp[SIZE][SIZE];
int nxt[SIZE][SIZE];

int main()
{
	scanf("%s",&str);
	int K;
	scanf("%d",&K);
	int n=strlen(str);
	for(int i=0;i<n;i++)
	{
		for(int j=i;j<n;j++)
		{
			dp[i][j]=0;
		}
	}
	int mx=1;
	for(int i=0;i<=n;i++)
	{
		for(int l=0;l<n;l++)
		{
			for(int r=l;r<n;r++)
			{
				nxt[l][r]=INF;
				if(dp[l][r]>K) dp[l][r]=INF;
			}
		}
		for(int l=0;l<n;l++)
		{
			for(int r=n-1;r>=l;r--)
			{
				if(l<r) dp[l][r-1]=min(dp[l][r-1],dp[l][r]);
				if(l+1<=r) dp[l+1][r]=min(dp[l+1][r],dp[l][r]);
			}
		}
		for(int l=0;l<n;l++)
		{
			for(int r=l;r<n;r++)
			{
				if(dp[l][r]!=INF)
				{
					if(l==r) mx=max(mx,2*i+1);
					else
					{
						mx=max(mx,2*i);
						if(str[l]==str[r])
						{
							mx=max(mx,2*i+2);
							nxt[l+1][r-1]=min(nxt[l+1][r-1],dp[l][r]);
						}
						else if(dp[l][r]<K)
						{
							mx=max(mx,2*i+2);
							nxt[l+1][r-1]=min(nxt[l+1][r-1],dp[l][r]+1);
						}
					}
				}
			}
		}
		for(int l=0;l<n;l++)
		{
			for(int r=l;r<n;r++)
			{
				dp[l][r]=nxt[l][r];
			}
		}
	}
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n; ll tmp, cur;
	cin >> n >> tmp;
	--tmp;
	bool flag = true;
	while (--n) {
		cin >> cur;
		if (cur >= tmp + 1)
			--cur;
		flag &= (cur >= tmp);
		tmp = cur;
	}
	cout << (flag? "Yes": "No") << '\n';
	return 0;
}

Measured memory_bytes: 256
N = gets.to_i

L = gets.chomp.split.map(&:to_i)

i = 0

L.sort!

sum = 0

while i < N-1 do
  sum += L[i]
  i += 1
end

if  L[N-1] < sum
	puts "Yes"
else
	puts "No"
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a,b;
  cin>>a>>b;
  double t1=max(a,b),t2=min(a,b);
  if(abs(360-t1)+t2>=t1-t2)printf("%.5f",(a+b)/2);
  else{
    if((a+b-360)<0)printf("%.6f",t1-(t1-t2-360)/2);
    else printf("%.6f",(a+b-360)/2);
  }
  cout<<endl;
}

Measured memory_bytes: 3228
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO()	{cin.tie(0);	cout.sync_with_stdio(false);}
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<(int)n;i++)
#define REP(i,n)	for(int i=0;i<=(int)n;i++)
#define srep(i,a,n)	for(int i=a;i<(int)n;i++)
#define SREP(i,a,n)	for(int i=a;i<=(int)n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll gcd(ll a, ll b) {
	return a%b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	cout<<"case #" << x << ": " << endl
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-15;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };

int main() {
	int n;	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n)	cin >> a[i];
	rep(i, n)	cin >> b[i];
	sort(all(a));
	sort(all(b));
	int ret = 0;
	vector<ll> amod(n), bmod(n);
	rep(i, 29) {
		rep(j, n)	amod[j] = a[j] % (2LL << i);
		rep(j, n)	bmod[j] = b[j] % (2LL << i);
		sort(all(bmod));
		int cnt = 0;
		rep(j, n) {
			if (amod[j] & (1LL << i)) {
				// ooxxxxxxoo
				cnt += lower_bound(all(bmod), (2LL << i) - amod[j]) - bmod.begin();
				cnt += bmod.end() - lower_bound(all(bmod), (3LL << i) - amod[j]);
			}
			else {
				// xxxxoooooxx
				auto s = lower_bound(all(bmod), (1LL << i) - amod[j]);
				auto t = lower_bound(all(bmod), (2LL << i) - amod[j]);
				cnt += t - s;
			}
		}
		ret ^= ((cnt&1) << i);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 8576
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<queue>
#include<utility>
using namespace std;
int main() {
	long long int n, k = 0,s=1;
	cin >> n;
	vector<long>vec(n);

	for (long int i = 0; i < n; i++) {
		cin >> vec.at(i);
		//cout << vec.at(i) << endl;
	}

	for (long int i = 0; i < n; i++) {
		if (vec.at(i) > s) {
			vec.at(i)--;
			s = vec.at(i);
			//cout << vec.at(i) << endl;
		}
		if (vec.at(i) < s) {
			cout << "No" << endl;
			exit(0);
		}
	}
	cout << "Yes" << endl;

}

	


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll asc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
ll max(ll x,ll y){return x>y?x:y;}
ll min(ll x,ll y){return x>y?y:x;}

typedef struct{
    ll a;
    ll b;
}groupab;
ll asc_gp(const void *p,const void *q){
    return ((groupab*)p)->b-((groupab*)q)->b;
}
int main(){
    static ll n,a[200000],b[200000],sum=0,max=-1;
    int i,j,k;
    static groupab gp[200000];
    scanf("%lld",&n);
    for(i=0;i<n;i++){
        scanf("%lld %lld",&gp[i].a,&gp[i].b);
    }
    
    qsort(gp,n,sizeof(groupab),asc_gp);
    //for(i=0;i<n;i++)printf("%lld %lld\n",gp[i].a,gp[i].b);
    for(i=0;i<n;i++){
        sum+=gp[i].a;
        if(gp[i].b<sum){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;

}

Measured memory_bytes: 6396
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  int a,b; cin>>a>>b;
  cout << ((b%a==0) ? a+b : b-a) << endl;
}


Measured memory_bytes: 256
N,K = list(map(int,input().split()))
S = input()
#print(S)
char = S[K-1]
#print(char)
if char == "A":
  print(S[:K-1]+"a"+S[K:])
elif char == "B":
  print(S[:K-1]+"b"+S[K:])
else:
  print(S[:K-1]+"c"+S[K:])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
#define MOD 1000000007
using namespace std;
int main(){
    int n,ans;
    cin>>n;
    ans=n/2;
    if(n%2)ans++;
    cout<<ans<<endl;
}

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

int main() {
  string s,t;
  cin >> s >> t;
  int ans = 0;
  rep(i,3){
    if(s[i] == t[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    dp = [False]*(K+1)

    for i in range(K+1):
        for j in range(N):
            if i - A[j] >= 0:
                dp[i] |= ~dp[i-A[j]]
    if dp[K]:
        print("First")
    else:
        print("Second")


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9576
N = int(input())
x=[0]*N
u=[0]*N
ans = 0
rate = 380000.0
for i in range(N):
    x[i],u[i] = input().split()
    if u[i]=='JPY':
        x[i]= int(x[i])
        ans += x[i]
    elif u[i]=='BTC':
        x[i] = float(x[i])
        ans += x[i]*rate
    else:
        raise AssertionError
print(ans)



Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<numeric>
#include<map>
#include<string>
using namespace std;

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

	int n = s.length();
	int i = 0;
	for (; i < n; i++) {
		int j = 0;
		for (; j < n; j++) {
			if (s[j] != t[(i+j) % n]) break;
		}
		if (j == n) break;
	}

	printf("%s\n", (i == n) ? "No" : "Yes");

	return 0;
}


Measured memory_bytes: 256
/*#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int hash(int key, int i){ return (h1(key)+i*h2(key))%M;}

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for ( i = 0;; i++){
    h = hash(key, i);
    if( strcmp(H[h],str) == 0 ) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for ( i = 0; ; i++ ){
    h = hash(key, i);
    if( strcmp(H[h],str) == 0 ) return 1;
    else if ( strlen(H[h]) == 0 ){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}


int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);

    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str) ){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}
*/








#include<stdio.h>
#include<iostream>
using namespace std;
#define m 1046527
long long Hash[m]={0};
int getdata(char a){
    if(a=='A')return 1;
    else if(a=='C')return 2;
    else if (a=='G')return 3;
    else return 4;
}
long long getstring(char *a){
    long long re=0;
    for(int i=0;a[i]!='\0';i++){
        re*=5;
        re+=getdata(a[i]);
    }
    return re;
}
int h1(long long a){
    int re;
    re=a%m;
    return re;
}
int h2(long long a){
    int re;
    re=1+a%(m-1);
    return re;
}
int h(long long key,int i){
    int re;
    re=(h1(key)+i*h2(key))%m;
    return re;
}
int Insert(char* a){
    long long key=getstring(a);
    int i=0;
    int p;
    while(1){
        p=h(key,i);
        if(Hash[p]==0){
            Hash[p]=key;
            return 0;
        }
        i++;
    }
    return 1;
}
int Find(char * a){
    long long key=getstring(a);
    int i=0;
    int p;
    while(1){
        p=h(key,i);
        if(Hash[p]==key){
            return 1;
        }
        if(Hash[p]==0){
            return 0;
        }
        i++;
    }
}
int main()
{
    int n;
    scanf("%d",&n);
    char cmd[9],temp[14];
    for(int i=0;i<n;i++){
        scanf("%s %s",&cmd,&temp);
        if(cmd[0]=='i'){
            Insert(temp);
        }
        else{
            int re=Find(temp);
            if(re==1)
                printf("yes\n");
            else
                printf("no\n");
        }
    }
    return 0;
}



Measured memory_bytes: 11284
#include <iostream>

using namespace std;

int main()
{
  string s;
  cin >> s;
  int n = (int)(s.length());
  int half = n / 2;
  int cond1 = (n - 1) / 2;
  int cond2 = (n + 3) / 2 - 1;
  bool isStrong = true;

  for (int i = 0; i < half; i++)
  {
    if (s[i] != s[n - i - 1])
    {
      isStrong = false;
      break;
    }
  }

  for (int i = 0; i < cond1; i++)
  {
    if (s[i] != s[cond1 - i - 1])
    {
      isStrong = false;
      break;
    }
  }

  for (int i = cond2; i < n; i++)
  {
    if (s[i] != s[n - i - 1])
    {
      isStrong = false;
      break;
    }
  }

  if (isStrong)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }

  return 0;
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define ten(n) ((int)1e##n)
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T> bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
ll ri(){ll l;cin>>l;return l;} string rs(){string s;cin>>s;return s;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
ostream&operator<<(ostream&o,const vb&t){forr(e,t)o<<"#."[e];return o;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";forr(e,t)o<<e<<",";o<<"}"<<endl;return o;}
#ifdef LOCAL
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}
#else
#define out(args...)
#endif

void Main() {
  int n = ri();
  vs S(n);
  rep(i, n) S[i] = rs();

  string ans;

  rep(i, 26) {
    char c = 'a' + i;
    int mi = 1000;
    rep(j, n) {
      int co = 0;
      forr(a, S[j]) if (a == c) co++;
      amin(mi, co);
    }
    rep(j, mi) ans += c;
  }

  cout << ans << endl;
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int N;
	cin >> N;
	
	set<int> v;
	for (int a = 0; a < N; ++a)
	{
		int val;
		cin >> val;
		auto it = v.find(val);

		if (it == v.end())
			v.insert(val);
		else 
			v.erase(it);
		
	}
	cout << v.size() << endl;

	return 0;
}

Measured memory_bytes: 4864
package main

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

// 辞書
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	m := make(map[string]bool, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ary := strings.Split(sc.Text(), " ")
		key := ary[1]
		switch ary[0] {
		case "insert":
			if _, ok := m[key]; !ok {
				m[key] = true
			}
		case "find":
			if _, ok := m[key]; ok {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		}
	}
}



Measured memory_bytes: 73776
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#define rep(i, n) for (int i{ 0 }; i < n; ++i)

using namespace std;

int main() {
    int i_s;
    cin >> i_s;
    vector<int> v(4);

    rep(i, 4) {
        v.at(3 - i) = i_s % 10;
        i_s = (i_s - v.at(3 - i)) / 10;
    }

    // printf("%d %d %d %d", a,b,c,d);

    rep(i, 1 << 3) {
        int tmp = v.at(0);
        string s[3];

        rep(j, 3) {
            if (i & 1 << j) {
                tmp += v.at(j + 1);
                s[j] = '+';
            } else {
                tmp -= v.at(j + 1);
                s[j] = '-';
            }
        }
        if (tmp == 7) {
            printf("%d%s%d%s%d%s%d=7\n", v[0], s[0].data(), v[1], s[1].data(), v[2], s[2].data(), v[3]);
            break;
        }
    }
}


Measured memory_bytes: 3724
#include <stdio.h>

int main(){
    long long int n,x;
    scanf("%lld %lld",&n,&x);
    long long int a[n+2];
    int q;
    for(q=1;q<=n;q++)scanf("%lld",&a[q]);
    long long int ans=0;
    
    if(a[1]>x){
        ans+=a[1]-x;
        a[1]=x;
    }
    if(a[n]>x){
        ans+=a[n]-x;
        a[n]=x;
    }
    
        long long int i;
        for(i=1;i<=n/2;i++){
            if(a[i]+a[i+1]>x){
                ans+=a[i]+a[i+1]-x;
                a[i+1]=x-a[i];
            }
            if(a[n-i+1]+a[n-i]>x){
                ans+=a[n-i+1]+a[n-i]-x;
                a[n-i]=x-a[n-i+1];
            }
        }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 896
#include "iostream"
using namespace std;

int main()
{
	int A, B, C, X, Y,money;
	cin >> A >> B >> C >> X >> Y;
	
	if (A + B < 2 * C) money=(A*X + B*Y);
	else if (X < Y) {
		if (C * 2 * X + (Y - X)*B < C*2*Y)money = C * 2 * X + (Y - X)*B;
		else money = 2*C*Y;
	}
	else {
		if (C * 2 * Y + (X - Y)*A < C*2*X)money = C * 2 * Y + (X - Y)*A;
		else money = 2*C*X;
	}
	cout << money << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M && N >= 0; ++i)
	{
		int tmp;
		scanf("%d", &tmp);
		N -= tmp;
	}
	printf("%d\n", N >= 0 ? N : -1);
	return 0;
}

Measured memory_bytes: 1724
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#define  ll  long long
#define ull unsigned long long
#define  sl(a)  scanf("%lld",&a)
using namespace std;
ll a[100005][4];
int main()
{
    ll i,j,k,l,m,n,ma,ma1,ma2;
    //cin>>n;
    while(sl(n)!=EOF)
    {
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=3;j++)
        {
            cin>>a[i][j];
            if(i>1)
            {
                if(j==1)
                {
                    ma=max(a[i-1][2],a[i-1][3]);
                }
                if(j==2)
                {
                    ma=max(a[i-1][1],a[i-1][3]);
                }
                if(j==3)
                {
                    ma=max(a[i-1][2],a[i-1][1]);
                }
                a[i][j]=a[i][j]+ma;
            }
        }
    }
    ma1=max(a[n][1],a[n][2]);
    ma2=max(a[n][2],a[n][3]);
    ma=max(ma1,ma2);
    cout<<ma<<endl;
    }
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

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

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second




int main() {
	int n, a[100010], cnt[100010] = { 0 };
	cin >> n;
	bool b[100010] = { 0 };
	ll ans = 0;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		b[a[i]] = 1;
	}
	for (int i = 0;i < 100005;i++) {
		if (b[i])ans++;
	}
	if (ans % 2 == 0)cout << ans - 1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768