akhauriyash/Code-Regression huggingface dataset:
//Catchharsh
    //I Luv Kunj017
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (int x,int n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    int main()
    {   
         IOS;
         ll n,m,i,j,d;
         cin>>n>>d;
         ll ans=0;
         ll ch=1+2*d;
         if(n%ch==0)
         cout<<(n/ch);
       else
        cout<<(n/ch)+1;
         
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll N;
    cin >> N;
    ll ans=0;
    for(int i=1;i<=N;i++){
        ll tmp=i;
        ll ct=0;
        while(tmp!=0){
            tmp/=10;
            ct++;
        }
        if(ct%2==1)ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    #define ll  long long
    #define mod 1000000007
    #define pb push_back
    ll a[13][13],c[13];

    
    void rec(ll i,ll n,ll m,ll x,vector<ll> &v,ll ct,vector<ll> &ans)
    {
        if(i>=n)
            return;
        vector<ll> vp(v);  
        ll lg=0,cp=ct;
        ct+=c[i];

        for(ll j=0;j<m;j++){
            v[j]+=a[i][j];
            if(v[j]>=x)
                lg++;
        }
        if(lg==m)
        {
            ans.push_back(ct);
             rec(i+1,n,m,x,vp,cp,ans);
        }
        else
        {
        rec(i+1,n,m,x,vp,cp,ans);

        
        rec(i+1,n,m,x,v,ct,ans);
        }
        
       

    }
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
 
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
 
        ll i,n,n2,m,t,j,l,pos,mpos,f=0,k,p,n1,z,q,x,y,x1,y1,x2,y2;
      
        /*cin>>t;
        
      
       while(t--)
    {
 
        
    }*/
        cin>>n>>m>>x;
        vector<ll> ans;
        for(i=0;i<n;i++)
        {
            cin>>c[i];
            
            for(j=0;j<m;j++){
                cin>>a[i][j];
                
            }
        }

        vector<ll> v(j,0);
        rec(0,n,m,x,v,0,ans);
        // vector<ll> v2(n,0);
       // rec(1,n,m,x,v2,0,ans);
        if(ans.size()==0)
            cout<<"-1";
        else
            cout<<*min_element(ans.begin(),ans.end());
       
      return 0;
   }

Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll n;
string s;
bool hogege=true;
bool check(ll mid){
  map<string,pair<ll,ll>>MP;
  for(ll i=0;i<=s.size()-mid;i++){
    string ss=SUBS(s,i+1,i+mid);
    ll num=MP[ss].F,num2=MP[ss].S;
    if(num == 0){
      MP[ss] = mp(i+1,i+1);
    }else{
      MP[ss] = mp(min(i+1,num),max(i+1,num2));
    }
  }
  for(auto a:MP){
    ll po=a.S.F,po2=a.S.S;
    if(po+mid<=po2){
      return true;
    }
  }
  return false;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>s;
  ll le=0,ri=n/2+1;
  while(ri-le>1){
    ll mid=(le+ri)/2;
    if(check(mid)){
      le=mid;
    }else ri=mid;
  }
  cout<<le<<endl;
  return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n, k;
	cin >> n >> k;
	int a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	rep(i, k) ans += a[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  if(a%2==0 || b%2==0 || c%2==0){
    cout << 0 << endl;
    return 0;
  }
  ll x,y,z;
  if(a%2 == 1){
    ll s = (a%2)*b*c;
    ll t = (a%2+1)*b*c;
    x = llabs(s-t);
  }
  if(b%2 == 1){
    ll s = (b%2)*a*c;
    ll t = (b%2+1)*a*c;
    y = llabs(s-t);
  }
  if(c%2 == 1){
    ll s = (c%2)*a*b;
    ll t = (c%2+1)*a*b;
    z = llabs(s-t);
  }
  ll m = min(x,y);
  m = min(m,z);
  cout << m << endl;
}

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

using namespace __gnu_pbds;
using namespace std;

template <class T>
using ordered_set =
       tree <T,null_type,less <T>,rb_tree_tag,tree_order_statistics_node_update> ;
///find_by_order()
///order_of_key()

template <class T,class U>
void maximize(T &x,U y){
    if(x < y)x=y;
}
template <class T,class U>
void minimize(T &x,U y){
    if(x > y)x=y;
}
template <class T>
T Abs(T x){
    return (x < (T)0 ? -x : x);
}
template <class T>
T safe_sqrt(T x){
    return sqrt(max(x,(T)0));
}
template <class T,class U,class V>
T addmod(T x,U k,V MOD){
    return ((x+k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T submod(T x,U k,V MOD){
    return ((x-k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T mul(T x,U y,V MOD){
    return ( (x % MOD) * (y % MOD) ) % MOD;
}

#define ll long long
#define pll pair <ll,ll>
#define pii pair <int,int>
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define emp emplace_back
#define MASK(i) ((1LL)<<(i))
#define BIT(x,i) (((x)>>(i))&1)
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)((c).size())
#define fn "test"    ///FILE_NAME_HERE

/*------------------------------------------END_OF_TEMPLATE------------------------------------------*/

namespace task{

	const int N = 3e3 + 3;
	int f[N][N];
	pii tr[N][N];
	int n,m;
	string s,t;

    void solve(){
    	cin>>s>>t;
    	n = sz(s),m = sz(t);
    	s = " " + s,t = " " + t;
    	for(int i = 1;i <= n;++i){
    		for(int j = 1;j <= m;++j){
    			if(s[i] == t[j]){
    				if(f[i][j] < f[i - 1][j - 1] + 1){
    					f[i][j] = f[i - 1][j - 1] + 1;
    					tr[i][j] = mp(i - 1,j - 1);
    				}
    			} else {
    				if(f[i][j] < f[i - 1][j]){
    					f[i][j] = f[i - 1][j];
    					tr[i][j] = mp(i - 1,j);
    				}
    				if(f[i][j] < f[i][j - 1]){
    					f[i][j] = f[i][j - 1];
    					tr[i][j] = mp(i,j - 1);
    				}
    				if(f[i][j] < f[i - 1][j - 1]){
    					f[i][j] = f[i - 1][j - 1];
    					tr[i][j] = mp(i - 1,j - 1);
    				}
    			}
    		}
    	}
    	pii p(0,0);
    	int maxLen = 0;
    	vector <char> ans;
    	for(int i = 1;i <= n;++i){
    		for(int j = 1;j <= m;++j){
    			if(maxLen < f[i][j]){
    				maxLen = f[i][j];
    				p = mp(i,j);
    			}
    		}
    	}
    	while(p.fir and p.sec){
    		int u,v;
    		if(s[p.fir] == t[p.sec]){
                ans.emp(s[p.fir]);
    		}
    		u = tr[p.fir][p.sec].fir;
    		v = tr[p.fir][p.sec].sec;
    		p = mp(u,v);
    	}
    	reverse(all(ans));
    	for(auto c : ans){
    		cout<<c;
    	}
    }
}

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    task::solve();
}


Measured memory_bytes: 105856
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i = (begin); i < (end); i++)
#define rep(i, n) FOR(i, 0, n)
using ll = long long;
using namespace std;
#define all(x) (x).begin(),(x).end()
using pii = pair<int, int>; using vi = vector<int>; using vl = vector<ll>;

signed main() {
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
char c[1000][1000],s[1000];
int ans=0;
bool ok[610][610][311];
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		for(int j=1;j<=n;j++)c[i][j]=s[j-1];
	}
	for(int i=n+1;i<n+n;i++)
	for(int j=1;j<=n;j++)c[i][j]=c[i-n][j];
	for(int i=1;i<=n;i++)
	for(int j=n+1;j<n+n;j++)c[i][j]=c[i][j-n];
	for(int i=n+1;i<n+n;i++)
	for(int j=n+1;j<n+n;j++)c[i][j]=c[i-n][j-n];
	//for(int k=n;k<=3*n-2;k++)
	//for(itn )
	for(int i=1;i<n+n;i++)
	for(int j=1;j<n+n;j++)
	{
		for(int k=0;i+k<n+n&&j+k<n+n&&k<n;k++)
		{
			if(k==0)ok[i][j][k]=1;
			else ok[i][j][k]=ok[i][j][k-1]&(c[i][j+k]==c[i+k][j]);
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		bool okk=0;
		for(int k=0;k<n;k++)
		{
			if(!ok[i+k][j+k][n-k-1]){okk=1;break;}
		}
		if(!okk)ans++;
	}
	printf("%d",ans);
	return 0;
 } 

Measured memory_bytes: 113280
n = int(input())
ans = set()
limit_num = float('inf')
total = 0
for i in range(1, n + 1):
    total += i
    if total >= n:
        limit_num = i
        break
remove_num = total - n
for i in range(1, limit_num + 1):
    if i != remove_num:
        ans.add(i)
print(*ans, sep='\n')

Measured memory_bytes: 3700
#include <stdio.h>

void Add(int n, int s, int cnt, int num, int sum);

int answer;
int ocu[10];
int main(void){
	int n, s, sum, cnt;
	int factrial;
	int i;
	
	while(1){
		for(i=0; i<10; i++){
			ocu[i] = 0;
		}
		answer = 0;
		sum = 0;
		cnt = 0;
		factrial = 1;
		scanf("%d %d", &n, &s);
		if(n == 0 && s == 0) break;

		for(i=n; i >= 1; i--){
			factrial *= i;	
		}

		for(i=0; i<10; i++){
			ocu[i] = 1;
			cnt++;
			Add(n, s, cnt, i, sum);	
			ocu[i] = 0;
			cnt--;
		}
		printf("%d\n", answer / factrial);
	}
}

void Add(int n, int s, int cnt, int num, int sum){
	int i;
	sum += num;
	if(cnt == n){
		if(sum == s){
		   	answer++; 	
		}
	}else{
		for(i=0; i<10; i++){
			if(ocu[i] == 0){
				ocu[i] = 1;
			}else{
				continue;
			}
			cnt++;
			Add(n, s, cnt, i, sum);
			ocu[i] = 0;
			cnt--;
		}
	}
	return;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N)
{
    ll ans = 0;
    bool kuriagari = false;
    while (N >= 10)
    {
        ll tmp = N%10;
        N /= 10;

        if (tmp != 9)
            kuriagari = true;
        ans += 9;
    }
    if (kuriagari)
    {
        ans += N - 1;
    }
    else
    {
        ans += N;
    }
    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (s == u) {
    cout << a - 1 << " " << b << endl;
  } else {
    cout << a << " " << b - 1 << endl;
  }
}

signed main() {
  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int a,b,s;
int main(){
    string s1;
    cin>>a>>b;
    cin>>s1;
    if(s1[a]!='-'){
        cout<<"No"<<endl;
        return 0;
    }
    s1[a]='1';
    for(int i=0;i<=a+b;i++){
        if(s1[i]<'0'||s1[i]>'9'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
} 

Measured memory_bytes: 256
/*
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<complex>
*/

#include<bits/stdc++.h>

#define X real()
#define Y imag()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define FastF freopen("in.txt","r",stdin); freopen("out.txt","w",stdout)
#define Fast cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0)
using ll = long long;
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vi::iterator vii;
typedef vector<ll> vl;
typedef vl::iterator vli;
typedef long double C;
typedef complex<C> P;
const int INF = 1e9 + 5;
const ll INFF = 1e18 + 5;
const int M = 1e9 + 7;
const double pi = acos(-1);

int main()
{
	//FastF;
	//Fast;
	int n;
	cin >> n;
	double p;
	vector<double> dp(n + 1);
	dp[0] = 1;
	for (int i = 1; i <= n; ++i) {
		cin >> p;
		for (int j = n; j >= 0; --j) {
			dp[j] = ((j < 1) ? 0 : dp[j - 1] * p) + dp[j] * (1 - p);
		}
	}
	double ans = 0;
	for (int i = n / 2 + 1; i <= n; ++i) ans += dp[i];
	printf("%.10lf\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> vs(n);
    for (auto& v : vs)
    {
        cin >> v;
    }
    vector<int> ans;
    for (int i = 0; i < n; i++)
    {
        int max_index = -1;
        for (int j = 0; j < vs.size(); j++)
        {
            if (j + 1 == vs[j])
            {
                max_index = j + 1;
            }
        }
        if (max_index == -1)
        {
            break;
        }
        else
        {
            ans.push_back(max_index);
            vs.erase(vs.begin() + (max_index - 1));
        }
    }
    if (ans.size() == n)
    {
        reverse(ans.begin(), ans.end());
        for (auto v : ans)
        {
            cout << v << endl;
        }
    }
    else
    {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=1000000007;
int a[100010];
int main(){
	LL n,k;
	LL ans=0;
	cin>>n>>k;	
	for(LL i=k;i<=n+1;i++)
	{
		ans=(ans+(n+1-i)*i+1)%MOD;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3624
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0549
#include<vector>
#include<iostream>
#include<cmath>
using namespace std;
//宿場町はn個　m日間
int n, m, pos = 0, a;
long long ans = 0;
long long t[100000];
int main()
{
	cin >> n >> m;
	t[0] = 0;
	//累積和
	for (int i = 1; i < n; i++)
	{
		cin >> t[i];
		t[i] += t[i - 1];
	}
	pos = 0;
	for (int i = 0; i < m; i++)
	{
		cin >> a;
		ans += abs(t[pos] - t[pos + a]);
		ans %= 100000;
		pos += a;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S,T;
  bool an = true;
  cin >> S >> T;
  for(int i=0;i<S.size();i++){
    if(S.at(i) == T.at(i)){
    }
    else{
      an = false;
    }
  }

  if(S.size() + 1 == T.size()){
  }
  else{
    an == false;
  }
  if(an){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3596
#入力
A=(input())
B=(input())
C=(input())
D=(input())
E=(input())

dishs=[A,B,C,D,E]
time=[]
time1=[]
for henkan in dishs:
    time.append(int(henkan))
    time1.append(int(henkan[-1]))

#計算
def shori(n):
    if n==0 :
        k=0
    else:
        k=10-n
    return k
time1a=list(map(shori,time1))
last=max(time1a)
totaltime=sum(time)+sum(time1a)-last

print(totaltime)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <stdlib.h>

using namespace std;

int main(void){
    int N, M;
    cin >> N >> M;

    int A[N+5];
    int a, b;
    for(int i=1;i<=N;i++){
        A[i] = 0;
    }
    for(int i=0;i<M;i++){
        cin >> a >> b;
        A[a] = A[a] + 1;
        A[b] = A[b] + 1;
    }
    for(int i=1;i<=N;i++){
        if(A[i] % 2 > 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int m,d,a,b;
  cin>>m>>d;
  
  int c=0;
  if(m<4 || d<22) co(0);
  else{
    rep(i,4,m+1){
      rep(j,22,d+1){
        a=j/10;
        b=j%10;
        if(a>=2 && b>=2 && i==a*b){
          c++;
        }
      }
    }
    co(c);
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int i,j,c=0;s.hasNext();System.out.println(c),c=0){int[]a=new int[156];for(i=0;i<12;++i){z=s.next().split("");for(j=0;j<12;++j)a[i*13+j]=z[j+1].charAt(0);}for(i=0;i<12;++i)for(j=0;j<12;++j)if(a[i*13+j]>48)f(a,i*13+j,c++);}}static void f(int[]a,int x,int c){if(0<=x&&x<156&&a[x]>48){a[x]=(byte)-c;for(int i:new int[]{-13,-1,1,13})f(a,x+i,c);}}}

Measured memory_bytes: 12000
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int a,b;
	cin>>a>>b;
	if(a*2<=b&&b<=a*4&&b%2==0)yes;
	else no;

}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>

using namespace std;
using int64 = long long;

int main() {
    int x;
    cin >> x;
    for (int64 a=200; a>=0; a--) {
        for (int64 b=a-1; b>=-200; b--) {
            if (pow(a, 5)-pow(b, 5) == x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3548
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;

LL ans = 0;

string send_query(int i){
	cout << i << endl << flush;
	string s;
	cin >> s;
	return s;
}

void solve(){
	vector<string> seat(N,"none");
	int left = 0;
	int right = N;
	seat[0] = send_query(0);
	if(seat[0]=="Vacant") return;
	while(left+1<right){
		int center = (right+left)/2;
		seat[center] = send_query(center);
		if(seat[center]=="Vacant") return;
		if((center-left)%2==0){
			if(seat[left]==seat[center]) left = center;
			else right = center;
		}else{
			if(seat[left]!=seat[center]) left = center;
			else right = center;
		}
	}
}
 
int main(){
    cin >> N;
 
    solve();

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

Measured memory_bytes: 1620
n = int(input())
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

up = A[0][0]
bottom = A[1][0] + up
for i in range(n-1):
    up += A[0][i+1]
    bottom = max(up, bottom) + A[1][i+1]

print(bottom)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 998244353;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll c[1100000];
int main() {
  ll h,a;
  cin>>h>>a;
  cout<<ceil((ld)h/a);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

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

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

/*------------------------------------/
for library*/

/*------------------------------------*/
ll dp[12345];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int H,N;
    cin>>H>>N;
    vector<int> A(N),B(N);
    vector<pair<ll,ll>> BA(N);
    rep(i,N){
        cin>>A[i]>>B[i];
    }
    rep(i,H+1){
        dp[i] = INFLL;
    }
    dp[0] = 0;
    rep(i,N)rep(j,H+1){
        chmin(dp[min(H,j+A[i])],dp[j]+B[i]);
    }
    cout<<dp[H]<<endl;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<long long> a(n,0);
  long long prevTestk=1;
  long long imaTestk=1;

  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }

  /*for(int i=0;i<k;i++){
    prevTestk=prevTestk*a.at(i);
  }*/

  for(int i=k;i<n;i++){
    //imaTestk=(prevTestk/a.at(i-k))*a.at(i);
    if(a.at(i-k)<a.at(i)){
      cout << "Yes" << endl;
    }else{
      cout << "No" <<endl;
    }
    //prevTestk=imaTestk;
  }


  return(0);
}


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

int main(){
  int n;
  cin >> n;
  int cnt=0;
  for(int i=n;i>0;i--){
    if(i>0 && i<10){
      cnt++;
    }else if(i>=100 && i<1000){
      cnt++;
    }else if(i>=10000 && i<100000){
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,k=0;
  int N;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;i++)
    scanf("%d ",&A[i]);
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      k+=A[i]*A[j];
    }
  }
printf("%d\n",k);
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  map<ll,ll> m;
  rep(i,n) {
    ll x;
    R x;
    m[x]++;
  }
  ll ans=0;
  tr(it,m) {
    ans+=it->F*it->S;
  }
  ll T;
  R T;
  while(T--) {
    ll b,c;
    cin >> b >> c;
    ll x=m[c];
    m[c]=0;
    ll y=m[b];
    m[b]=0;
    ans-=x*c;
    ans-=y*b;
    m[c]=x+y;
    ans+=c*(x+y);
    pr(ans);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 9608
#include<iostream>
#include<algorithm>
using namespace std;
int n,a,b,t[100];
int main(){
  while(cin>>n){
    for(int i=0;i<n;i++)cin>>t[i];
    sort(t,t+n);
    a=b=0;
    for(int i=0;i<n;i++){
      b+=t[i];
      a+=b;
    }
    cout<<a<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1176
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:i32 = read();
    let b:i32 = read();
    let c:i32 = read();
    let mut k:i32 = read();
    let mut cnt = 0;

    loop {
        let m1 = min(k, a);
        cnt += m1;
        k -= m1;
        if k <= 0 {
            break;
        }
        k -= min(k, b);
        if k <= 0 {
            break;
        }
        cnt -= min(k, c);
        break;
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2148
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0;H=[[0,S]]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:F[v]=t;heappush(H,[t,v])
 return-1
def s(n,k):
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r();p=map(int,f[2:-1].split())
  if'0'==f[0]:print(g(n,E,*p))
  else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))


Measured memory_bytes: 6308
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

string S;
set<char> st;

int main() {
  cin >> S;
  for (auto c : S) {
    st.insert(c);
  }

  for (char c = 'a'; c <= 'z'; ++c) {
    if (st.count(c) != 1) {
      cout << c;
      return 0;
    }
  }

  cout << "None";
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MINF -1e18
#define MOD 1000000007
#define FAST_IO {ios::sync_with_stdio(0);cin.tie(0);}
using namespace std;
signed main() {
  int N, a, mi = INF, ma = MINF, sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a;
    sum += a;
    mi = min(mi, a);
    ma = max(ma, a);
  }
  cout << mi << " " << ma << " " << sum << endl;
}




Measured memory_bytes: 3088
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int sum = 0;
        int[] l = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
        }
        Arrays.sort(l);
        for (int i = n - 1; i >= n - k; i--) {
            sum += l[i];
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 22612
#define _GLIBCXX_DEBUG
#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 fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  
  for(int i=a; i<=b; i++) {
    if(i<a+k || b-k<i) cout << i << endl;
  }
  
}

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e9;
const int MB = 30;
const int MOD = 1e9 + 7;

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(all(a));
	int ans = 0;
	for (int i = 0; i < k; i++) ans += a[i];
	cout << ans;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 3644
import numpy as np

d=int(input())
c=np.array(list(map(int,input().split())))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))
#lastd=[[0]*26 for _ in range(d)]
lastd=np.zeros(26)

ans=[0]*d
for i in range(d):  
  a=np.argmax(c*([i]*26-lastd))
  lastd[a]=i
  #print(a,i,c,lastd)
  ans[i]=(i+a)%26+1

for i in range(d):
  print(ans[i])

Measured memory_bytes: 27632
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    println!("{}", if a == 0 { f(b) } else { f(a - 1) ^ f(b) });
}

fn f(n: i64) -> i64 {
    if n % 2 == 0 {
        (n / 2) % 2 ^ n
    } else {
        ((n + 1) / 2) % 2
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    long long H, W;
    vector<long long> c(26, 0);

    cin >> H >> W;
    for (long long i = 0; i < H; i++)
    {
        for (long long j = 0; j < W; j++)
        {
            char t;
            cin >> t;
            c[t - 'a']++;
        }
    }

    vector<long long> num(3, 0);
    num[0] = (H / 2) * (W / 2);
    num[1] = (H % 2) * (W / 2) + (H / 2) * (W % 2);
    num[2] = (H % 2) * (W % 2);

    for (long long i = 0; i < 2; i++)
    {
        long long t = pow(2, 2 - i);
        long long count = 0;
        bool f = false;
        for (long long j = 0; j < 26; j++)
        {
            count += c[j] / t;
            c[j] %= t;
            if (count >= num[i])
            {
                c[j] += (count - num[i]) * t;
                f = true;
                break;
            }
        }
        if (f == false)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  u64 n, prev, a;
  cin >> n >> prev;
  u64 ans = prev/2;
  prev = prev%2;
  for (int i = 1; i < n; ++i) {
    cin >> a;
    if (prev==1 && a>0) {ans++; a--;}
    ans+=a/2;
    prev = a%2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <ctime>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int MAX = 1000000;
bool a[MAX];

int main() {
	int n;
	cin >> n;
	vector<string> s(n);
	REP(i,n) cin >> s[i];
	FOR(l,1,5){
		REP(i,n){
			if (s[i].length() < l) continue;
			REP(j,s[i].length()-l+1){
				ll p = 0;
				REP(k,l){
					p = 27*p + s[i][j+k] - 'a' + 1;
				}
				if (p >= MAX) break;
				a[p] = true;
			}
		}
	}

	FOR(i,1,MAX-1){
		if (a[i]) continue;
		int x = i;
		string ans;
		bool f = true;
		while (x){
			if (x % 27 == 0) f = false;
			char c = (x % 27) - 1 + 'a';
			ans = c + ans;
			x /= 27;
		}
		if (f){
			cout << ans << endl;
			return 0;
		}
	}

    return 0;
}

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

bool isEasy(const string& s) {
  for (int i = 0; i < s.size(); ++i) {
    switch (s[i]) {
    case 'R': {
      if (i % 2 == 1) return false;
      break;
    }
    case 'L': {
      if (i % 2 == 0) return false;
      break;
    }
    }
  }
  return true;
}

int main() {
  string s;
  cin >> s;
  cout << (isEasy(s) ? "Yes\n" : "No\n");
  return 0;
}


Measured memory_bytes: 256
N = int(input())
dp = [0 for i in range(N + 1)]
divider = [1]

i = 6
while i <= N:
    divider.append(i)
    i *= 6

i = 9
while i <= N:
    divider.append(i)
    i *= 9


for x in divider:
    dp[x] = 1

for i in range(1, N + 1):
    if dp[i] == 0:
        poss = []
        for x in divider:
            if i - x >= 0:
                poss.append(dp[i - x] + 1)
        dp[i] = min(poss)

print(dp[N])


Measured memory_bytes: 9800
#include<iostream>

using namespace std;

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

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    map<int,int> freq;
    int n,tmp;
    long long ans=0;
    cin>>n;
    for(int i=0;i<n&&cin>>tmp;i++)
        ans+=freq[i-tmp],freq[i+tmp]++;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 20568
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
    }
    int[] rate = new int[9];
    for (int i = 0; i < N; i++) {
      if (3200 <= a[i]) {
        rate[8]++;
      } else {
        rate[a[i] / 400]++;
      }
    }
    int min = 0;
    int max = 0;
    for (int i = 0; i <= 7; i++) {
      if (0 < rate[i]) {
        min++;
        max++;
      }
    }
    max += rate[8];
    if (min == 0) {
      min = 1;
    }
    System.out.println(min + " " + max);
  }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() { cout << "Yes"; }

void no() { cout << "No"; }

int main() {
  kyun;
  in6 n;
  cin >> n;
  map<string,in6> data;
  in6 count = 0;
  rep(i,n) {
    string s;
    cin >> s;
    data[s]++;
    if(data[s] > count) count = data[s];
  }
  vs ans;
  for(auto a : data) if(a.second == count) ans.pb(a.first);
  sort(all(ans));
  rep(i,(int)ans.size()) cout << ans[i] << "\n";
}

Measured memory_bytes: 25584
import java.util.* ;
class Main {
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    String s = scan.next() ;
    char ch[] = s.toCharArray();
    int x = 0 ;
    for(int i = 0 ; i < s.length() ; i++){
      if(ch[i] == '+')
        x++;
      else if(ch[i]=='-')
        x--;
    }
    System.out.println(x) ;
  }
}


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

int i,j,flag=0,t;
int x[6],y[6],z[6];

void input(){
    for(i = 0;i < 6;i++) scanf("%d",&x[i]);
    for(i = 0;i < 6;i++) scanf("%d",&y[i]);
}

void N(int w[]){
    t = w[0];
    w[0] = w[1];
    w[1] = w[5];
    w[5] = w[4];
    w[4] = t;
}
 
void S(int w[]){
    t = w[0];
    w[0] = w[4];
    w[4] = w[5];
    w[5] = w[1];
    w[1] = t;
}
 
void W(int w[]){
    t = w[0];
    w[0] = w[2];
    w[2] = w[5];
    w[5] = w[3];
    w[3] = t;
}
 
void E(int w[]){
    t = w[0];
    w[0] = w[3];
    w[3] = w[5];
    w[5] = w[2];
    w[2] = t;
}

void turn(int w[]){
    t = w[1];
    w[1] = w[2];
    w[2] = w[4];
    w[4] = w[3];
    w[3] = t;
}

int main(void){
    input();
    memcpy(z,y,sizeof(int)*6);
    for(i=0;i<6;i++){
        if(x[0]==y[i]){
            
            switch(i){
                case 0:
                break;
                case 1:
                N(z);
                break;
                case 2:
                W(z);
                break;
                case 3:
                E(z);
                break;
                case 4:
                S(z);
                break;
                case 5:
                N(z);
                N(z);
                break;
            }
            for(j=0;j<4;j++){
                if(x[0]==z[0] && x[1]==z[1] && x[2]==z[2] && x[3]==z[3] && x[4]==z[4] && x[5]==z[5]){
                flag=1;
                break;
                }else turn(z);
            }
        }
        if(flag==1) break;
    }
    if(flag==1) printf("Yes\n");
    else printf("No\n");
    
}


Measured memory_bytes: 1804
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    long long N,X;cin >> N >> X;
    vector<long long> retu(N);
    vector<long long> hozon(N);
    
    for(int i = 0;i<N;i++){
        cin >> retu.at(i);
    }
    hozon = retu;
    for(int i = 0;i<N-1;i++){
        //後ろを減らした方が良い
        int sum = retu.at(i)+retu.at(i+1);
        if(sum > X){
            if(sum-X > retu.at(i+1)){
                retu.at(i) -= sum-X-retu.at(i+1);
                retu.at(i+1) = 0;
            }
            else{
                retu.at(i+1) -= min(retu.at(i+1),sum-X);
            }
        }
    }
    long long ans = 0;
    for(int i = 0;i<N;i++) ans += hozon.at(i)-retu.at(i);
    cout << ans << endl;
}


Measured memory_bytes: 4792
#include <cstdio>
#include <vector>
#include <algorithm>

typedef std::vector<int> VI;

int main()
{
	VI vi;
	int k, x;
	scanf("%d %d", &k, &x);
	vi.push_back(x);
	k--;
	int max = x + 1;
	int min = x - 1;
	int max_k = k;
	int min_k = k;

	for (; max_k > 0 && min_k > 0;)
	{
		if (max <= 1000000)
		{
			if (max_k > 0)
			{
				vi.push_back(max);
				max_k--;
				max++;
			}
		}
		else
		{
			if (min_k > 0)
			{
				vi.push_back(min);
				min_k--;
				min--;
			}
		}

		if (min >= -1000000)
		{
			if (min_k > 0)
			{
				vi.push_back(min);
				min_k--;
				min--;
			}
		}
		else
		{
			if (max_k > 0)
			{
				vi.push_back(max);
				max_k--;
				max++;
			}
		}
	}

	std::sort(vi.begin(), vi.end());
	printf("%d", vi[0]);
	for (int i = 1; i < vi.size(); i++) printf(" %d", vi[i]);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] temp = s.split("/");

		int year = Integer.parseInt(temp[0]);
		int month;
		if (temp[1].charAt(0) == '0') {
			month = Integer.parseInt(temp[1].substring(1));
		} else {
			month = Integer.parseInt(temp[1]);
		}
		int date;
		if (temp[2].charAt(0) == '0') {
			date = Integer.parseInt(temp[2].substring(1));
		} else {
			date = Integer.parseInt((temp[2]));
		}

		if (year < 2019) {
			System.out.println("Heisei");
		} else {
			if (month < 4) {
				System.out.println("Heisei");
			} else if (month == 4) {
				if (date <= 30) {
					System.out.println("Heisei");
				} else {
					System.out.println("TBD");
				}
			} else {
				System.out.println("TBD");
			}
		}
	}
}

Measured memory_bytes: 22996
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n):
        t = int((n * 2) ** 0.5) + 1
        for i in range(t,1,-1):
            if i % 2 == 1:
                if n % i == 0 and  n // i > i // 2:
                    return '{} {}'.format(n//i-i//2, i)
            else:
                if n%i != 0 and n*2 % i == 0 and n // i + 1 > i // 2:
                    return '{} {}'.format(n//i-i//2+1, i)
        return '{} {}'.format(n, 1)

    while 1:
        n = I()
        if n == 0:
            break
        rr.append(f(n))
        # print('nrr',n,rr[-1])

    return '\n'.join(map(str, rr))


print(main())



Measured memory_bytes: 9144
K, X = map(int, input().split())
if -100000 <= X-K+1 and X+K-1 <= 100000:
  for i in range(K*2-2):
    print(X-K+1+i, end="")
    print(" ", end="")
  print(X+K-1)
  
if X-K+1 < -100000:
  for i in range(-100000, X+K-1):
    print(i, end="")
    print(" ", end="")
  print(X+K-1)

if X+K-1 > 100000:
  for i in range(X-K+1, 100000):
    print(i, end="")
    print(" ", end="")
  print(100000)

Measured memory_bytes: 9088
#include<bits/stdc++.h>
#include<cmath>
#define ll long long
using namespace std;
signed main()
{
	
	
		ll x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1)
	{
		cout << "Brown\n";
	}
	else
	{
		cout << "Alice\n";
	}
	
	return 0;
}

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

int main(){
	//freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
	int q = 1;
	//cin >> q;
	while(q--){
		int n;
		cin >> n;
		int a[n+1], c = 0;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
			if(a[i] != i) c++;
		}
		if(c <= 2) cout << "YES\n";
		else cout << "NO\n";
	}
}

Measured memory_bytes: 256