akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

void solve(){
    int n,m,k{};
    cin>>n>>m;
    vector<string> s(n);
    for(auto&c:s){
        cin>>c;
    }
    mcf_graph<ll,ll> g(2*n*m+2);
    int S=2*n*m,T=2*n*m+1;
    for(int i{};i<(n);++i){
        for(int j{};j<(m);++j){
            if(s[i][j]!='#') g.add_edge(n*m+i*m+j,T,1,0);
            if(s[i][j]=='o'){
                ++k;
                g.add_edge(S,i*m+j,1,0);
                auto vis=vector(n,vector(m,false));
                queue<pair<int,int>> q;
                q.emplace(i,j);
                while(!q.empty()){
                    auto[I,J]=q.front();q.pop();
                    if(s[I][J]=='#') continue;
                    g.add_edge(i*m+j,n*m+I*m+J,1,1000-(I-i)-(J-j));
                    if(I<n-1 and !vis[I+1][J]){
                        vis[I+1][J]=true;
                        q.emplace(I+1,J);
                    }
                    if(J<m-1 and !vis[I][J+1]){
                        vis[I][J+1]=true;
                        q.emplace(I,J+1);
                    }
                }
            }
        }
    }
    cout<<1000*k-g.flow(S,T).second<<'\n';
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
}

Measured memory_bytes: 8764
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>n;
		// n=s.length();
		// ll a[n];
		double q=n*6.28318530717958623200;
		setprecn(20);
		cout<<q;

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

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, c, k, t[100001];
  cin >> n >> c >> k;
  rep(i, 0, n) cin >> t[i];
  sort(t, t + n);
  int s = t[0];
  int ans = 0;
  int cu = 1;
  rep(i, 1, n) {
    cu++;
    if(t[i] - s > k || cu > c) ans++, s = t[i], cu = 1;

  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>

int main() {
	double a, b, c, d, e, f;
	double x, y;

	std::cout << std::fixed << std::setprecision(3);
	while (std::cin >> a >> b >> c >> d >> e >> f) {
		x = (c * e - b * f) / (a * e - b * d);
		y = (c * d - a * f) / (b * d - a * e);
		if (x == -0) x = 0;
		if (y == -0) y = 0;
		std::cout << x << " " << y << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1280
A, V = list(map(int, input().split()))
B, W = list(map(int, input().split()))
T = int(input())

diff = abs(A - B)
diff_v = V - W


def solve():
    if diff == 0:
        return "YES"
    if diff_v <= 0:
        return "NO"

    if diff/diff_v <= T:
        return "YES"
    else:
        return "NO"


print(solve())


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

using namespace std ; 

int main () { 
	
	vector <int> vect ; 
	for ( int i = 0 ; i < 3 ; i ++ ) {
		int a ; 
		cin >> a ; 
		vect.push_back(a) ; 
	}
	sort ( vect.begin() , vect.end() ) ; 
	
	if ( vect[0] == 5 && vect[1] == 5 && vect[2] == 7 )
		cout << "YES" << endl ;
	else
		cout << "NO" << endl ; 
	
}


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

string s;

int main() {
  cin >> s;
  int maxlen = 0;
  int indexa = -1;
  int indexz = -1;

  for (int i = 0; i < s.size(); ++i) {
    if (indexa == -1 && s[i] == 'A') indexa = i;
    if (s[i] == 'Z') indexz = i;
  }

  cout << indexz - indexa + 1 << endl;
}

Measured memory_bytes: 640
/*
 * B.cpp
 *
 *  Created on: 2020/08/16
 *      Author: 17k1028
 */



#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=n-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=a; i<=ll(b); i++)
#define FORD(i,a,b) for(ll i=a; i>=ll(b); i--)

bool can_triangle(ll n1, ll n2, ll n3){
	ll max_ll = max({n1,n2,n3});
	ll short_leng = 0;
	if(n1 != max_ll) short_leng += n1;
	if(n2 != max_ll) short_leng += n2;
	if(n3 != max_ll) short_leng += n3;
	if(max_ll < short_leng){
		return true;
	}else return false;
}

int main(){
	int N;
	cin >> N;
	ll L[100];
	REP(i,N) cin >> L[i];
	int count=0;
	FOR(i,0,N-3){
		FOR(j,i+1,N-2){
			FOR(k,j+1,N-1){
				if(L[i]!=L[j] and L[j]!= L[k] and L[i]!=L[k]){
					if(can_triangle(L[i], L[j], L[k])){
						count++;
					}
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}





Measured memory_bytes: 3612
#include <iostream>

int main() {
  int n;
  char s;
  
  std::cin >> n;
  
  for (int i = 0; i < n; i++) {
    std::cin >> s;
    if (s == 'Y') {
      std::cout << "Four\n";
      return 0;
    }
  }
  
  std::cout << "Three\n";
  
  return 0;
}


Measured memory_bytes: 256
n , k = map(int,input().split())
su = [1]*n
d = 0
A = []
for i in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    
    for j in range(d):
        a = A[j] -1
        su[a] = 0
    
print(sum(su))

Measured memory_bytes: 9200
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn

int main()
{
	IO;
	ll n{}, ans{},res{};
	cin>>n;
	vector<ll>v(n);
	For(i,0,n){cin>>v[i];res+=v[i];res%=mod;}
	For(i,0,n)
	{
		res-=v[i];
		if(res<0)res+=mod;
		ans+=v[i]*res;
		ans%=mod;
	}
	cout<<ans<<'\n';
//	system("pause");
	return 0;	
}

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

using namespace std;

int main(){
	int A, B, K; cin >> A >> B >> K;
  	if((B-A+1)/2 < K){
    	for(int i = A; i <= B; ++i){
        	cout << i << endl;
        }
    }else{
    	for(int i = A; i < A+K; ++i){
        	cout << i << endl;
        }
      	for(int i = B-K+1; i <= B; ++i){
        	cout << i << endl;
        }
    }
}

Measured memory_bytes: 256
a=input()
b=int(a[:2])
c=int(a[2:])
if 0<b<13:
  if 0<c<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0<c<13:
    print("YYMM")
  else:
    print("NA")

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

using namespace std;

int par[100010]={};
int rnk[100010]={};

void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		rnk[i]=0;
	}
}

int root(int x){
	return par[x]==x?x: par[x]=root(par[x]);
}

bool same(int x,int y){
	return root(x)==root(y);
}

void unite(int x,int y){
	x=root(x);
	y=root(y);
	if(x==y)return;
	if(rnk[x]<rnk[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(rnk[x]==rnk[y])rnk[x]++;
	}
}

int main(){
	int n,m;cin>>n>>m;
	vector<int> p(n);
	for(int i=0;i<n;i++)cin>>p[i];
	init(n);
	for(int i=0;i<m;i++){
		int a,b;cin>>a>>b;
		a--,b--;
		unite(p[a],p[b]);
	}
	int ret=0;
	for(int i=0;i<n;i++){
		if(same(i+1,p[i]))ret++;
	}
	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
vector<int> mul[200009];
int n,a[200009],smul[200009],ans;
int on[1000010];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		on[a[i]]++;
		for(int j=1;j*j<=a[i];j++){
			if(a[i]%j==0){
				smul[i]++;
				mul[i].push_back(j);
				if(j*j!=a[i]){
					smul[i]++;mul[i].push_back(a[i]/j);
				}
			}
		}
		sort(mul[i].begin(),mul[i].end());
	}
	bool fl=1;
	for(int i=0;i<n;i++){
		fl=1;
		for(int j=0;j<smul[i];j++){
			if(on[mul[i][j]] && mul[i][j]!=a[i] || mul[i][j]==a[i] && on[a[i]]>1){
				fl=0;break;
			}
		}
		ans+=(int)fl;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 62884
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
#define TRACE(x) cout<<#x<<" = "<<x<<'\n'
#define TRACE2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define TRACEA(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define PRINT(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define SZ(x) (int)(x).size()
using namespace std;
struct ii {
	int a, b;
	bool operator < (ii o) const { return tie(a, b) < tie(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return tie(a, b, c) < tie(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

long long fakt[MAXN];

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	fakt[0] = 1;
	for (int i = 1; i < MAXN; i++) fakt[i] = i*fakt[i-1]%MOD;
	
	scanf("%d%d", &N, &M);
	if (N < M) swap(N, M);
	if (N == M) printf("%lld\n", fakt[N]*fakt[N]*2%MOD);
	else if (N == M+1) printf("%lld\n", fakt[N]*fakt[M]%MOD);
	else puts("0");
	
	return 0;
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

signed main() {
	deque<int> d;
	int n = in();
	rep(i, n) {
		if (i & 1) d.push_back(in());
		else d.push_front(in());
	}
	if (n + 1 & 1) reverse(all(d));

	cout << d[0];
	for (int i = 1; i < n; ++i) {
		cout << " " << d[i];
	}
	puts("");
}


Measured memory_bytes: 2944
#include <iostream>
//#include <string>
#include <vector>

using namespace std;


int solution(const vector<int> V){
	int count = 0;
	int n = V.size() - 1;
	
	for(int i = 1; i < n; i++){
		
		if(V[i-1] < V[i] && V[i] <= V[i + 1]){
			count ++;
			
		}else if(V[i+1] < V[i] && V[i] <= V[i - 1]){
			count ++;
			
		}
	}
	
	return count;	
}


int main(){
  vector<int> V;
  int N;
  
  cin >> N;
  int a1;
  for(int i = 0; i < N; i++){
	  cin >> a1;
	  V.push_back(a1);	  
  }

  cout << solution(V) << endl; 
  
  return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N;
  cin>>N;
  set<int> st;

  rep(i,N){
    int a;
    cin>>a;
    if(st.find(a)!=st.end()){
      st.erase(a);
    }
    else{
      st.insert(a);
    }
  }

  cout<< st.size()<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 4992
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

constexpr long long mod = 1e9 + 7;

long long pow_mod(long long n, long long p) {
    long long ret = 1;
    while (p > 0) {
        if (p & 1) ret = (ret * n) % mod;
        n = (n * n) % mod;
        p >>= 1;
    }
    return ret;
}

void prepro(vector<long long> &fin, vector<long long> &inv) {
    fin[0] = fin[1] = 1;
    inv[0] = inv[1] = 1;
    for (long long i = 2; i <= 201000; i++) {
        fin[i] = (fin[i - 1] * i) % mod;
        inv[i] = pow_mod(fin[i], mod - 2);
    }
}

long long ncr_mod_prepro(vector<long long> &fin, vector<long long> &inv, long long n, long long r) {
    return fin[n] * inv[r] % mod * inv[n - r] % mod;
}

int main() {

    vector<long long> fin(202000), inv(202000);
    prepro(fin, inv);

    long long H, W, A, B;
    cin >> H >> W >> A >> B;

    long long ans = 0;
    for (long long w = B; w < W; w++) {
        long long left_w = w;
        long long right_w = W - w - 1;
        long long left_h = H - A - 1;
        long long right_h = A - 1;
        ans += (ncr_mod_prepro(fin, inv, left_w + left_h, left_w) * ncr_mod_prepro(fin, inv, right_h + right_w, right_w));
        ans %= mod;
    }

    cout << ans << endl;
}

































Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define maxn 100007
#define inf 1000000007
#define ll long long int
using namespace std;

int n;ll c;
ll ww=0;
ll d[maxn],t[maxn],v[maxn],g[maxn];
ll s[maxn],h[maxn],m1[maxn<<2]={0},m2[maxn<<2]={0},le[maxn<<2],ri[maxn<<2];

inline void create(int o,int l,int r)
{
	le[o]=l;ri[o]=r;
	if (l==r)
	{
		m1[o]=h[l]-t[l];
		return ;
	}
	int mid=l+r>>1;
	create(o<<1,l,mid);
	create(o<<1|1,mid+1,r);
	m1[o]=max(m1[o<<1],m1[o<<1|1]);
}

inline void build(int o,int l,int r)
{
	if (l==r)
	{
		m2[o]=h[l];
		return ;
	}
	int mid=l+r>>1;
	build(o<<1,l,mid);
	build(o<<1|1,mid+1,r);
	m2[o]=max(m2[o<<1],m2[o<<1|1]);
}

inline ll query1(int o,int x,int y)
{
	int l=le[o],r=ri[o];
	if (x==l&&y==r) return m1[o];
	int mid=l+r>>1;
	ll ans=0;
	if (y<=mid) ans=query1(o<<1,x,y);
	if (x>mid) ans=query1(o<<1|1,x,y);
	if (x<=mid&&y>mid) ans=max(query1(o<<1,x,mid),query1(o<<1|1,mid+1,y));
	return ans;
}

inline ll query2(int o,int x,int y)
{
	int l=le[o],r=ri[o];
	if (x==l&&y==r) return m2[o];
	int mid=l+r>>1;
	ll ans=0;
	if (y<=mid) ans=query2(o<<1,x,y);
	if (x>mid) ans=query2(o<<1|1,x,y);
	if (x<=mid&&y>mid) ans=max(query2(o<<1,x,mid),query2(o<<1|1,mid+1,y));
	return ans;
}

inline ll read()
{
	ll x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*f;
}

inline void writ(ll x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) writ(x/10);
	putchar(x%10+'0');
}
inline void write(ll x){writ(x);putchar('\n');}

int main()
{
	ll ans=0;
	n=read(),c=read();
	for (int i=1;i<=n;++i) d[i]=read(),t[i]=c-d[i],v[i]=read();
	for (int i=1;i<=n;++i) g[i]=t[n-i+1],ww+=v[i],s[i]=ww-d[i],ans=max(ans,s[i]);ww=0;
	for (int i=n;i>=1;--i) ww+=v[i],h[i]=ww-t[i],ans=max(ans,h[i]);
	create(1,1,n),build(1,1,n);
	for (int i=1;i<n;++i)
	{
		if (d[i]<=t[n]) ans=max(ans,s[i]-d[i]+query2(1,i+1,n));
		else if (d[i]>=t[i+1]) ans=max(ans,s[i]+query1(1,i+1,n));
		else
		{
			int x=n-(upper_bound(g+1,g+n-i+1,d[i])-g)+1;
			ans=max(ans,max(s[i]-d[i]+query2(1,i+1,x),s[i]+query1(1,x+1,n)));
		}
	}
	write(ans);
	return 0;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int r = ri();
	int t[n], e[n];
	for (int i = 0; i < n; i++) t[i] = ri(), e[i] = ri();
	std::vector<std::pair<int, int> > hen[n];
	for (int i = 0; i < r; i++) {
		int a = ri() - 1;
		int b = ri() - 1;
		int c = ri() - 1;
		hen[b].push_back({a, c});
	}
	typedef std::pair<int, int> T;
	std::priority_queue<T, std::vector<T>, std::greater<T> > que;
	for (int i = 0; i < n; i++) que.push({t[i], i});
	while (que.size()) {
		auto cur = que.top();
		que.pop();
		if (cur.first != t[cur.second]) continue;
		for (auto j : hen[cur.second]) {
			if (t[j.first] > t[cur.second] + j.second) {
				t[j.first] = t[cur.second] + j.second;
				que.push({t[j.first], j.first});
			}
		}
	}
	int64_t res = 0;
	for (int i = 0; i < n; i++) res += (int64_t) t[i] * e[i];
	std::cout << res << std::endl;
	return 0;
}



Measured memory_bytes: 10092
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <algorithm>
#include <complex>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace  std;
using ll = long long;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> pairs;
typedef complex<ll> G;
const int N=1e5+5;

const int INF = 1e9+5;


void done() {


    ll n;
    cin >> n;
    ll a[n];
    ll total = 0;
    vector<ll>frq(N, 0);
    for(int i=0;i < n;i++) {
        cin >> a[i];
        frq[a[i]]++;
        total += a[i];
    }
    ll q;
    cin >> q;
    for(int i=0; i< q;i++) {
        ll b, c;
        cin >> b >> c;

        ll p = total-(frq[b]*b) + (c*(frq[b]));

        frq[c] += frq[b];
        frq[b] = 0;

        total = p;

        /*for(int j=0; j< n;j++) {
            if(a[j]==b) {
                a[j] = c;
                frq[a[j]]--;
                frq[c]++;
            }
            total += a[j];
        }
        */
        cout << p << '\n';
    }

}
void solve() {
    int n;
    cin >> n;
    int a[n];
    int bad = false;
    bool vis[2*n+1];
    for(int i=0;i < n;i++) {
        cin >> a[i];
        if(i) {
            if(abs(a[i]-a[i+1]) < 2) {
                bad = true;
            }
        }
        vis[a[i]] = true;
    }
    if(bad) {
        cout << -1 << '\n';
        return;
    }
    vector<int>ans(2*n);
    for(int i=0;i < n;i+=2) {
        ans[i] = a[i/2];
    }
}

void another() {
    ll n;
    cin >> n;
    stack<int>q;
    while(n > 0) {
        n--;
        int a = n%26;
        q.push(a);
        n /= 26;
    }
    while(q.size() > 0) {
        cout << char('a' + q.top());
        q.pop();
    }

}
int main() {

    fast;
    another();

}


Measured memory_bytes: 3588
H, W = map(int, input().split())
N = int(input())
# color = [0]
data = list(map(int, input().split()))
# for i in range(N):
#    color.append(color[i] + data[i])

# def num(i):
#    for j in range(N):
#        if color[j] <= i < color[j + 1]:
#            return str(j + 1)

# grid = [[num(h * W + w) for w in range(W)] for h in range(H)]
col = 1
count = 1
grid = [["" for w in range(W)] for h in range(H)]
for h in range(H):
    for w in range(W):
        grid[h][w] = str(col)
        if count == data[col - 1]:
            count = 1
            col += 1
        else:
            count += 1

for h in range(H):
    if h % 2 == 0:
        print(" ".join(grid[h]))
    else:
        print(" ".join(grid[h][::-1]))


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vll = vector<pll>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define BIT(x,n) ((x>>n)&1)
const int inf = 1e9;

int main() {
    int N, ans = inf; cin >> N;
    vvl AB(N, vl(2));
    rep(i,N) cin >> AB[i][0];
    rep(i,N) cin >> AB[i][1];

    rep(bits,(1<<N)) {
        vll num(N); rep(i,N) num[i] = make_pair(AB[i][BIT(bits,i)], i);

        bool ok = true;
        int count = 0;
        rep(i,N-1) {
            int mx = 0, idx = -1;
            rep(j,N-i) {
                if (BIT(bits,num[j].second) != abs(N-1-i - num[j].second)%2) continue;
                int val = num[j].first;
                if (val > mx) {
                    mx = val; idx = j;
                } else if (val == mx) {
                    if (num[j].second > num[idx].second) idx = j;
                }
            }
            if (idx == -1) {
                ok = false;
                break;
            }
            rng(j,idx,N-i-1) {
                swap(num[j], num[j+1]);
                count++;
            }
        }
        rep(i,N-1) {
            if (num[i].first > num[i+1].first) ok = false;
        }
        rep(i,N) {
            if (BIT(bits,num[i].second) != abs(i - num[i].second)%2) ok = false;
        }
        if (ok) {
            ans = min(ans, count);
            cerr << count << ": ";
            rep(i,N) cerr << num[i].first << " \n"[i==N-1];
        }
    }
    if (ans == inf) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<LLONG> As(X), Bs(Y), Cs(Z);
    for (int i = 0; i < X; ++i) cin >> As[i];
    for (int i = 0; i < Y; ++i) cin >> Bs[i];
    for (int i = 0; i < Z; ++i) cin >> Cs[i];

    sort(As.rbegin(), As.rend());
    sort(Bs.rbegin(), Bs.rend());
    sort(Cs.rbegin(), Cs.rend());

    vector<LLONG> ABs;
    for (const LLONG A : As)
    {
        for (const LLONG B : Bs)
        {
            ABs.push_back(A + B);
        }
    }
    sort(ABs.rbegin(), ABs.rend());

    vector<LLONG> ABCs;
    for (int i = 0; i < min(K, X * Y); ++i)
    {
        for (const LLONG C : Cs)
        {
            ABCs.push_back(ABs[i] + C);
        }
    }
    sort(ABCs.rbegin(), ABCs.rend());
    for (int i = 0; i < K; ++i)
    {
        cout << ABCs[i] << endl;
    }
}


Measured memory_bytes: 43368
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int max = Math.max(X, Y);
		int min = Math.min(X, Y);
		int total = 0;
		int remain = 0;

		if (max == X) { //Aピザの残りを買う必要がある
			remain = A;
		} else {
			remain = B;
		}

		if (A >= 2 * C && B >= 2 * C) {//Its cheaper to buy AB pizza
			total = total + max * 2 * C;
		} else if (A >= 2 * C && A + B >= 2 * C && remain == A) {
			total = total + max * 2 * C;
		} else if (B >= 2 * C && A + B >= 2 * C && remain == B) {
			total = total + max * 2 * C;
		} else if (A + B >= 2 * C) {
			total = total + min * 2 * C + remain * (max - min);
		} else {
			total = A * X + B * Y;
		}
		System.out.println(total);
		scan.close();
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N;
ll A[100000];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N;
    ll o=0,e=0;
    rep(i,0,N){
        cin>>A[i];
        if(A[i]%2) o++;
        else e++;
    }
    if(e){
        if(o%2) cout <<"NO"<<"\n";
        else cout <<"YES"<<"\n";
    }
    else{
        if(o%2==0) cout <<"YES"<<"\n";
        else cout <<"NO"<<"\n";
    }
}

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

# from math import gcd
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
A = [int(_) for _ in input().split()]
A = sorted(A, reverse=True)

ret = A[0]
ct = 0
ni = []
for i in range(1, N-1):

    ret += A[(i+1) // 2]

print(ret)


Measured memory_bytes: 32920
#include<iostream>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if(a*b>c*d){cout<<a*b<<endl;}
else if(a*b<c*d){cout<<c*d<<endl;}
else{cout<<a*b<<endl;}
return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#include <bitset>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

ll solve(int n, ll c, vector <ll> x, vector <ll> v)
{
    vector <ll> suf(n + 1);
    ll cur = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        cur += v[i];
        suf[i] = max(suf[i + 1], cur - (c - x[i]));
    }
    ll ans = suf[0];
    cur = 0;
    for (int i = 0; i < n; i++)
    {
        cur += v[i];
        ans = max(ans, cur - x[i]);
        ans = max(ans, cur - 2 * x[i] + suf[i + 1]);
    }
    return ans;
}

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll c;
    cin >> c;
    vector <ll> x(n), v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> v[i];
    }
    ll ans = solve(n, c, x, v);
    for (int i = 0; i < n; i++)
    {
        x[i] = c - x[i];
    }
    reverse(x.begin(), x.end());
    reverse(v.begin(), v.end());
    ans = max(ans, solve(n, c, x, v));
    cout << ans << '\n';
}


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

class Edge{
public:
    int from, to, cost;
    Edge(int from, int to, int cost) : from(from), to(to), cost(cost){};
    
    bool operator < (const Edge& right)const{
        return cost < right.cost;
    }
};

class UnionFind {
    vector<int> par;
    int cnt;
public:
    UnionFind(int size_) : par(size_, -1), cnt(size_) { }
    void unite(int x, int y){
        if ((x = find(x)) != (y = find(y))) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y]; par[y] = x; cnt--;
        }
    }
    bool same(int x, int y){ return find(x) == find(y); }
    int find(int x){ return par[x] < 0 ? x : par[x] = find(par[x]); }
    int size(int x){ return -par[find(x)]; }
    int size(){ return cnt; }
};

int N, M;

void solve(){
    vector<pair<int, int>> islands;
    for(int i=0; i<N; i++){
        int h; cin >> h;
        islands.push_back(make_pair(-h, i));
    }
    sort(islands.begin(), islands.end());
    
    vector<Edge> edges;
    for(int i=0; i<M; i++){
        int a, b, c;
        cin >> a >> b >> c; a--; b--;
        edges.push_back({a, b, c});
    }
    sort(edges.begin(), edges.end());
    
    int ans = 0;
    UnionFind uf(N);
    set<int> exists;
    int p = 0;
    while(p < N){
        int cost = 0;
        int h = islands[p].first;
        while(p < N && islands[p].first == h){
            exists.insert(islands[p].second);
            p++;
        }
        for(auto edge: edges){
            if(exists.count(edge.from) && exists.count(edge.to) && !uf.same(edge.from, edge.to)){
                uf.unite(edge.from, edge.to);
                cost += edge.cost;
            }
        }
        if(uf.size() != N-exists.size()+1){
            ans = 0;
            uf = UnionFind(N);
        }else{
            ans += cost;
        }
    }
    cout << ans << endl;
}

int main(){
    while(cin >> N >> M, N|M){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3416
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <numeric>
#include <stack>

int main() {
  char buf[128];
  scanf("%s", buf);
  std::string s = buf;

  int res = 0;
  std::stack<char> st;
  // std::string tmp;
  for (auto c: s) {
    // fprintf(stderr, "c: %c, size: %zu\n", c, st.size());
    // fprintf(stderr, "s: %s\n", tmp.c_str());
    if (st.empty()) {
      if (c == '*') break;
      st.push(c);
      // tmp += c;
      continue;
    }
    if (c != ')') {
      st.push(c);
      // tmp += c;
      continue;
    }

    assert(c == ')');
    if (st.top() == '*') {
      // tmp.pop_back();
      st.pop();
      assert(st.top() == '(');
      st.pop();
      // tmp.pop_back();
      ++res;
      // fprintf(stderr, "++\n");
      if (st.empty()) break;
      st.push('*');
      // tmp += '*';
    } else {
      st.pop();
    }
  }

  printf("%d\n", res);
}



Measured memory_bytes: 2852
import bisect

N=int(input())
L = list(map(int, input().split()))

L.sort()
ans=0

for i in range(N-1):
	for g in range(i+1, N-1):
		bigger = bisect.bisect_left(L, L[i]+L[g])
		ans += bigger - g -1
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=3e5+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
 
int n;
bool ate[60];
int main()
{
   	
 	
 
    	scanf("%d",&n);
    	std::vector<int> a(n+1);
    	for(int i=0;i<n-1;i++){
    		scanf("%d",&a[i]);
    	}	

    	a[n-1]=a[n-2];
    	a[n]=1e9;
    	ll ans=0;
    	for(int i=n-1;i>=0;i--){
    		if(i)
    		ans+=min(a[i],a[i-1]);
    		else ans+=a[i];
    	}

    	printf("%lld\n",ans );


}

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

import sys
import os
import math
import itertools

A = [1, 0, 0]

for s in sys.stdin:
    s = s.strip()
    a, b = s.split(',')

    if a == 'A':
        i = 0
    elif a == 'B':
        i = 1
    elif a == 'C':
        i = 2

    if b == 'A':
        j = 0
    elif b == 'B':
        j = 1
    elif b == 'C':
        j = 2

    A[i], A[j] = A[j], A[i]

if A[0] == 1:
    print('A')
elif A[1] == 1:
    print('B')
else:
    print('C')

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

int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    cin >> s;

    int k;
    cin >> k;

    string t;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != '1') {
            t = s[i];
            break;
        } else {
            if (i + 1 == k) {
                t = '1';
                break;
            }
        }
    }

    cout << t << endl;
}

Measured memory_bytes: 256
import std;

void main() {
    int k; scan(k);
    string s; scan(s);
    if (s.length > k) writeln(s[0..k], "...");
    else writeln(s);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;


Measured memory_bytes: 3676
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#pragma endregion

// ABC088 A-Round Up the Mean

int main(void) {
	int a,b;
	
	scanf("%d %d", &a,&b);
	printf("%d\n", (a + b + 2 - 1) / 2);

	return 0;
}

Measured memory_bytes: 1684
#define DEBUG 0
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
#define pb push_back
#define all(v) v.begin(), v.end()
#define for1(i, n) for (ll i = 0; i < (n); i++)
#define for2(i, m, n) for (ll i = (m); i < (n); i++)
#define for3(i, m, n, d) for (ll i = (m); i < (n); i += (d))
#define INF (1LL << 60)
#if DEBUG
#define dump(v1) dump_1(#v1, v1)
#define dump2(v1, v2) dump_2(#v1, v1, #v2, v2)
#define dump3(v1, v2, v3) dump_3(#v1, v1, #v2, v2, #v3, v3)
#else
#define dump(v1)
#define dump2(v1, v2)
#define dump3(v1, v2, v3)
#endif
#if DEBUG
template <typename T> void dump_1(const string &n1, const T &v1) {
    cerr << n1 << ": " << v1 << endl;
}
template <typename T1, typename T2>
void dump_2(const string &n1, const T1 &v1, const string &n2, const T2 &v2) {
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << endl;
}
template <typename T1, typename T2, typename T3>
void dump_3(const string &n1, const T1 &v1, const string &n2, const T2 &v2,
            const string &n3, const T3 &v3) {
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << "  " << n3 << ": "
         << v3 << endl;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &v) {
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}
template <typename T1, typename T2, typename T3>
ostream &operator<<(ostream &os, const tuple<T1, T2, T3> &v) {
    os << "(" << get<0>(v) << ", " << get<1>(v) << ", " << get<2>(v) << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "]";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) {
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "}";
    return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &v) {
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << it->first << ":" << it->second;
    }
    os << "}";
    return os;
}
#endif // DEBUG
void Yes(void) { cout << "Yes" << endl; }
void No(void) { cout << "No" << endl; }
void YES(void) { cout << "YES" << endl; }
void NO(void) { cout << "NO" << endl; }
template <typename T> void print(const T &v) { cout << v << endl; }
//---------------------------------------------------------
void solve() {
    ll A, B, C;
    cin >> A >> B >> C;
    if (B + C <= A) {
        print(0);
    } else {
        print(C - (A - B));
    }
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll a,b,c;
    while(cin>>a>>b>>c){
        int rslt=0,start=a;
        while(start<=c){
            start+=a;
            rslt+=b;
        }
        cout<<rslt<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int maxn = 2e5 + 5;
int a[maxn], p[maxn];
int main()
{
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	while (k--)
	{
		bool flag = true;
		memset(p, 0, sizeof(p));
		for (int i = 1; i <= n; i++)
		{
			p[max(i - a[i], 1)]++;
			if (i + a[i] + 1 <= n)
				p[i + a[i] + 1]--;
		}
		a[1] = p[1];
		for (int i = 2; i <= n; i++)
		{
			a[i] = p[i] + a[i - 1];
			if (a[i] != n)
				flag = false;
		}
		if (flag)
			break;
	}
	for (int i = 1; i <= n; i++)
		cout << a[i] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 5220
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve( lst_a, lst_b,n):
    if n.count("-")!=1:
        answer= "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import collections
n = int(input())
arr = []
for i in range(n):
  arr.append(input())
m = int(input())
for i in range(m):
  s = input()
  if s in arr:
    arr.remove(s)
if len(arr) == 0:
  print(0)
else:
  arr = collections.Counter(arr)
  print(arr.most_common()[0][1])

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

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

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 100 * 1000 + 13;

int n, m, v, p;
int a[N];

bool read () {
	if (scanf("%d%d%d%d", &n, &m, &v, &p) != 4)
		return false;
	forn(i, n)
		scanf("%d", &a[i]);
	return true;
}

bool check(int pos){
	if (pos + p >= n)
		return true;
	if (v <= p)
		return a[n - p] <= a[pos] + m;
	li sum = 0;
	forn(i, n - (p - 1)) if (i != pos)
		sum += max(0, min(m, a[pos] + m - a[i]));
	int cnt = v - p;
	return sum >= cnt * li(m) && a[n - p] <= a[pos] + m;
}

void solve() {
	sort(a, a + n);
	int l = 0, r = n - 1;
	int ans = -1;
	while (l <= r){
		int m = (l + r) / 2;
		if (check(m)){
			ans = m;
			r = m - 1;
		}
		else{
			l = m + 1;
		}
	}
	printf("%d\n", n - ans);
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if(read()) {
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, k, c;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  vi32 lft(n), rgt(n);
  {
    int now = 0;
    for (int i = 0; i < n; ) {
      if (s[i] == 'x') {
        i += 1;
        continue;
      }
      lft[i] = ++now;
      i += c + 1;
    }
    if (now > k) {
      return;
    }
    for (int i = n - 1; i >= 0; ) {
      if (s[i] == 'x') {
        i -= 1;
        continue;
      }
      rgt[i] = now--;
      i -= c + 1;
    }
  }
  rep(i, n) {
    if (lft[i] != 0 && lft[i] == rgt[i]) {
      cout << i + 1 << endl;
    }
  }
}

Measured memory_bytes: 3348
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def main():
   R = get_input(int)
   print(2 * math.pi * R)




if __name__ == '__main__':
    main()


Measured memory_bytes: 27132
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# 全通り調べる問題
K, S = read_ints()
X = list(range(K + 1))  # Kは2500なのでK^2は間に合う
# X,Yについて全探索してZについて二分探索すればよい #連続なので範囲に入ってれば良い（二分探索もいらない！）
ans = 0
for x in X:
    for y in X:
        z = S - x - y
        if 0 <= z <= K:
            ans += 1
print(ans)


Measured memory_bytes: 40812
#include <string>
#include <iostream>
#include <vector>
#include <algorithm> 
using namespace std;
int main()
{
  int n,h,a,c=0;
  cin>>n>>h;
  for(int i=0;i<n;i++)
  {
    cin>>a;
    if(a>=h)
      c++;
  }
  
  cout<<c;
  
  return 0;
  
}

  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N,ansi,ans=-1;
inline int find(int x)
{
	int res=0;
	while(x%2==0)res++,x/=2;
	return res;
}
int main()
{
	scanf("%d",&N);
	for(register int i=1;i<=N;++i)
	{
		int temp=find(i);
		if(temp>ans)ans=temp,ansi=i;
	}
	printf("%d\n",ansi);
	return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

#endif

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

	rep(i, 0, size(s))
	{
		if ((i+1) % 2 == 0 && !(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'))
		{
			cout << "No";
			return 0;
		}
		else if ((i+1) % 2 == 1 && !(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'))
		{
			cout << "No";
			return 0;
		}
	}

	cout << "Yes";
	return 0;
}


Measured memory_bytes: 256