akhauriyash/Code-Regression huggingface dataset:
/*..........AAKASH GOYAL............*/
/*............DAIICT................*/
 
 
#include <bits/stdc++.h>
#include <boost/math/common_factor.hpp> 
using namespace std;
 
#define    int                      unsigned long long int
 
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1110111110111
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int tt; cin >> tt; while(tt--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    pll                      pair <long long int , long long int>
#define    ppl                      pair <long long int , pll>              //pair of ll and pair ll 
#define    sp(x)                    setprecision(x)
 
 
int32_t main()
{
    speed upp
    int n,m,x=1,z=1;
    cin>>n>>m;
    int a[n+1];
    f(i,1,n)
    {
        cin>>a[i];
        int o=__gcd(x,a[i]);  
        x=(x*a[i])/o;
        a[i]/=2;
        int p=__gcd(z,a[i]);  
        z=(z*a[i])/p;
    }
    if(z>m)
        cout<<"0";
    else
    {
        f(i,1,n)
        {
            if((z/a[i]) % 2==0)
            {
                cout<<"0";
                exit(0);
            }
        }
        int ans=(m-z)/x;
        cout<<ans+1;
    }
    
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n+1), b(n);
    rep(i,n+1) cin >> a.at(i);
    rep(i,n) cin >> b.at(i);

    ll ans = 0;
    rep(i,n) {
        int x = min(a.at(i), b.at(i));
        ans += x;
        b.at(i) -= x;
        int y = min(a.at(i+1), b.at(i));
        ans += y;
        a.at(i+1) -= y;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int x;
	cin >> x;
	if (x>=400 && x<=599){
		cout<<8<<endl;
	}else if(x>=600 && x<=799){
		cout<<7<<endl;
	}else if(x>=800 && x<=999){
		cout<<6<<endl;
	}else if(x>=1000 && x<=1199){
		cout<<5<<endl;
	}else if(x>=1200 && x<=1399){
		cout<<4<<endl;
	}else if(x>=1400 && x<=1599){
		cout<<3<<endl;
	}else if(x>=1600 && x<=1799){
		cout<<2<<endl;
	}else if(x>=1800 && x<=1999){
		cout<<1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3632
def haha():    
    A=[]
    for i in range(3):
        A.extend(list(map(int, input().split())))
    N = int(input())
    n=[]
    while N>0:
        inp = int(input())
        if inp in A:
            n.append(inp)
        N-=1

    A = [A[:3],A[3:6],A[6:9], [A[0], A[4], A[8]], [A[2], A[4], A[6]], [A[0], A[3], A[6]], [A[1], A[4], A[7]], [A[2], A[5], A[8]]]

    for ele in A:
        if ele[0] in n and ele[1]in n and ele[2]in n:
            return 'Yes'
    return 'No'

print(haha())

Measured memory_bytes: 3064
if __name__ == "__main__":
	n = int(input())
	num_array = input().split(" ")
	result = [0 for i in range(n)]
	for i in range(n)[::-1]:
		differ = n - (i + 1)
		if differ % 2 == 0:
			result[differ // 2] = num_array[i]
		else:
			result[- ((differ + 1) // 2)] = num_array[i]
	result_word = result[0]
	for w in result[1:]:
		result_word += " " + w
	print(result_word)

Measured memory_bytes: 27204
def main():
    N, A, B, C = list(map(int, input().split(' ')))
    S = [input() for _ in range(N)]
    D = {
        'AB': A + B,
        'BC': B + C,
        'AC': A + C
    }
    ans = list()
    for i, s in enumerate(S):
        if D[s] == 0:
            print('No')
            return
        if s == 'AB':
            if (D['BC'] < D['AC']) or \
                (i < N - 1 and S[i + 1] == 'BC' and D['BC'] == D['AC'] == 1):
                ans.append('B')
                D['BC'] += 1
                D['AC'] -= 1
            else:
                ans.append('A')
                D['BC'] -= 1
                D['AC'] += 1
        elif s == 'BC':
            if (D['AB'] < D['AC']) or \
                (i < N - 1 and S[i + 1] == 'AB' and D['AB'] == D['AC'] == 1):
                ans.append('B')
                D['AB'] += 1
                D['AC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['AC'] += 1
        else:  # s == 'AC'
            if (D['AB'] < D['BC']) or \
                (i < N - 1 and S[i + 1] == 'AB' and D['AB'] == D['BC'] == 1):
                ans.append('A')
                D['AB'] += 1
                D['BC'] -= 1
            else:
                ans.append('C')
                D['AB'] -= 1
                D['BC'] += 1
    print('Yes')
    for a in ans:
        print(a)

if __name__ == '__main__':
    main()

Measured memory_bytes: 16904
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int main(void){
	while(1){
		int a,b,c,d,e,f;
		if(cin >> a == 0) break;
		cin >> b >> c >> d >> e >> f;
		double x, y;
		x = (double)(e*c-b*f)/(a*e-b*d);
		y = (double)(a*f-c*d)/(a*e-b*d);

		if(0.0005 > x && x > -0.0005) x = 0.0;
		if(0.0005 > y && y > -0.0005) y = 0.0;

		cout << setprecision(3) << setiosflags(ios::fixed) << x << " " << y << endl;
	}

	return 0;
}

Measured memory_bytes: 1236
#include"bits/stdc++.h"
using namespace std;


//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pii pair<int,int>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i);
#define int long long int

int dp[100005],n,k;vector<int>arr(100005);

int call(int i)
{
	if (i >= n-1) return 0;
	if(dp[i]!=-1) return dp[i];

	int x1 = 1e10;
	for (int j = i + 1; j < min(n,i+k+1); j++)
	{
	    //trace(x1);
		x1 = min(x1,abs(arr[i]-arr[j]) + call(j));
	}
	return dp[i]=x1;

}


signed main()
{

//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif

	cin >> n >> k;

	for(int i=0;i<n;i++) cin>>arr[i];
	memset(dp,-1,sizeof dp);

	cout << call(0);

}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n;
  cin >> n;
  long i = 1;
  long sum = 0;
  while(sum<n){
    sum += i;
    i++;
  }
  for(long j = 1;j<i;j++){
    if(j != sum-n)cout << j << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
#include <vector>

using namespace std;

int N;
vector <int> A;

void Solve()
{
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  int N2 = A.size() - 1;
  if (N == N2) puts("YES"); else puts("NO");
}

void Init()
{
  cin >> N;
  A.resize(N + 10);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
}

void Clean(){}

int main(){ Init(); Solve(); Clean(); return 0; }


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
        var n = int.Parse(ReadLine());
        var x = new int[n];
        var y = new int[n];
        var l = new int[n];
        var maxX = 0;
        var minX = int.MaxValue;
        var maxY = 0;
        var minY = int.MaxValue;
        for(int i = 0; i < n; i++)
        {
            var a = ReadLine().Split().Select(int.Parse).ToArray();
            x[i] = a[0];
            y[i] = a[1];
            l[i] = a[0] - 1 + a[1] - 1;
            maxX = Max(maxX, a[0]);
            minX = Min(minX, a[0]);
            maxY = Max(maxY, a[1]);
            minY = Min(minY, a[1]);
        }
        var max = l.Max() - l.Min();
        for(int i = 0; i < n; i++)
        {
            l[i] = Abs(maxX - x[i]) + y[i];
        }
        max = Max(max, l.Max() - l.Min());
        var maxXi = x.Select((a, i) => new { a, i }).Aggregate((a, working) => (a.a > working.a) ? a : working).i;
        var minXi = x.Select((a, i) => new { a, i }).Aggregate((a, working) => (a.a < working.a) ? a : working).i;
        var maxYi = y.Select((a, i) => new { a, i }).Aggregate((a, working) => (a.a > working.a) ? a : working).i;
        var minYi = y.Select((a, i) => new { a, i }).Aggregate((a, working) => (a.a < working.a) ? a : working).i;
        max = Max(max, Abs(x[maxXi] - x[minXi]) + Abs(y[maxXi] - y[minXi]));
        max = Max(max, Abs(x[maxYi] - x[minXi]) + Abs(y[maxYi] - y[minXi]));
        max = Max(max, Abs(x[maxXi] - x[minYi]) + Abs(y[maxXi] - y[minYi]));
        max = Max(max, Abs(x[maxYi] - x[minYi]) + Abs(y[maxYi] - y[minYi]));
        max = Max(max, Abs(x[maxXi] - x[maxYi]) + Abs(y[maxXi] - y[maxYi]));
        max = Max(max, Abs(x[minXi] - x[minYi]) + Abs(y[minXi] - y[minYi]));
        WriteLine(max);
    }
}


Measured memory_bytes: 25068
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int a,b,c;

main(){
	cin>>a>>b;
	dump(max({a+b,2*a-1,2*b-1}));
}





Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int N;
long mod=998244353;
long v[1<<17];
vector<long>calc()
{
	int M;cin>>M;
	vector<vector<int> >G(N+1);
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;
		if(u>v)swap(u,v);
		G[u].push_back(v);
	}
	vector<long>ret(500,0L);
	vector<int>gru(N+1);
	for(int i=N;i;i--)
	{
		set<int>S;
		for(int v:G[i])S.insert(gru[v]);
		int id=0;
		while(S.find(id)!=S.end())id++;
		gru[i]=id;
		(ret[id]+=v[i])%=mod;
	}
	return ret;
}
main()
{
	cin>>N;
	v[0]=1;
	for(int i=1;i<=N;i++)v[i]=v[i-1]*716070898%mod;
	vector<long>A=calc();
	vector<long>B=calc();
	vector<long>C=calc();
	long ans=0;
	for(int i=0;i<500;i++)for(int j=0;j<500;j++)for(int k=0;k<500;k++)
	{
		if((i^j^k)==0)(ans+=A[i]*B[j]%mod*C[k]%mod)%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 5584
#include <queue>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <assert.h>
#include <algorithm>
using namespace std;
#define debug printf("%s %d\n", __FUNCTION__, __LINE__)

const int maxn = 300 + 10;
int mat[maxn][maxn];
int ptr[maxn];
int cnt[maxn];
bool used[maxn];
int main(int argc, char **argv) {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) 
        for (int j = 1; j <= m; j++) scanf("%d", &mat[i][j]);
    for (int i = 1; i <= n; i++) ptr[i] = 1;

    int ans = n;
    while (true) {
        //for (int i = 1; i <= n; i++) {
            //for (int j = 1; j < ptr[i]; j++) printf("* ");
            //for (int j = ptr[i]; j <= m; j++) printf("%d ", mat[i][j]);
            //puts("");
        //}

        int curmax = 1;
        for (int i = 1; i <= m; i++) cnt[i] = 0;
        for (int i = 1; i <= n; i++) {
            cnt[ mat[i][ ptr[i] ] ]++;
            if (cnt[ mat[i][ ptr[i] ] ] > cnt[curmax])
                curmax = mat[i][ ptr[i] ];
        }
        ans = min(ans, cnt[curmax]);
        
        used[curmax] = true;

        bool breakable = false;
        for (int i = 1; i <= n; i++) 
            if (mat[i][ ptr[i] ] == curmax) {
                while (ptr[i] <= m && used[ mat[i][ ptr[i] ] ]) ptr[i]++;
                if (ptr[i] == m + 1) breakable = true;
            }

        //cout << curmax << endl;
        if (breakable) break;

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

Measured memory_bytes: 640
#include<stdio.h>
#define MAX 100
void Graph(int **);
void Clear();
void Jugde(int);

int A[MAX][MAX],JDGE[MAX],DWN[MAX],FLT[MAX];
int *B[MAX];
int N;
int time = 0;
int i,j;

int main(){

  scanf("%d",&N);

  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      A[i][j] = 0;
    }
  }

  for(i = 0; i < N; i++){
    B[i] = A[i];
  }

  Graph(B);

  Clear();
  

  for(i = 0; i < N; i++){
    printf("%d %d %d\n",i+1,DWN[i],FLT[i]);
  }

  return 0;
}


void Graph(int **A){
  int u,k,v;

  for(i = 0; i < N; i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j = 0; j< k; j++){
      scanf("%d",&v);
      v--;
      A[u][v] = 1;
    }
  }
}

void Clear(){
  int a;
  for(a = 0; a < N; a++){
    JDGE[a] = 0;
  }

  for(a = 0; a < N; a++){
    if(JDGE[a] == 0) Judge(a);
  }

}

void Judge(int a){
  int b;
  JDGE[a] = 1;
  DWN[a] = ++time;
  for(b = 0; b < N; b++){
    if(A[a][b] == 0) continue;
    if(JDGE[b] == 0) Judge(b);
  }
  JDGE[a] = 2;
  FLT[a] = ++time;
}

Measured memory_bytes: 636
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=5e5+5;
struct eg{
	int u,v,w;
	inline bool operator <(const eg &b)const{return w<b.w;}
}E[N];
int fa[N],f[N],n,q,tot;ll res;
inline int find(R int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main(){
	scanf("%d%d",&n,&q);
	fp(i,0,n-1)f[i]=0x3f3f3f3f;
	for(R int i=1,u,v,w;i<=q;++i){
		scanf("%d%d%d",&u,&v,&w);
		E[++tot]={u,v,w},cmin(f[u],w+1),cmin(f[v],w+2);
	}
	fp(i,1,n-1)cmin(f[i],f[i-1]+2);
	cmin(f[0],f[n-1]+2);fp(i,1,n-1)cmin(f[i],f[i-1]+2);
	fp(i,0,n-2)E[++tot]={i,i+1,f[i]};E[++tot]={n-1,0,f[n-1]};
	fp(i,0,n-1)fa[i]=i;
	sort(E+1,E+1+tot);
	for(R int i=1,u,v;i<=tot;++i){
		u=find(E[i].u),v=find(E[i].v);
		if(u!=v)res+=E[i].w,fa[u]=v;
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int cnt = 0;

		for (int x = a; x <= b; x++) {
			if (c % x == 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

	}
}

Measured memory_bytes: 26380
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define inf 0x3f3f3f3f 
int main(){
	ll t , h[100001] , dp[100001] = {0};
    cin >> t;
	for(int i = 0 ; i < t ; ++i) scanf("%lld",h+i);
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2 ; i < t ; ++i)
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
        cout<<dp[t-1];
}

Measured memory_bytes: 5140
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int s;
    cin >> s;
    cout << fixed << setprecision(20);

    set<int> S;
    int cnt = 1;
    while (true) {
        if (S.count(s) > 0) break;

        S.insert(s);
        cnt++;
        if (s % 2) {
            s = 3 * s + 1;
        } else {
            s /= 2;
        }
    }

    cout << cnt << endl;
}


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

template <class T>
int bubbleSort(vector<T>& a) {
    int cnt = 0;
    bool rev = true;
    while (rev) {
        rev = false;
        for (int i = 0; i < a.size() - 1; ++i) {
            if (a[i] <= a[i+1]) continue;
            swap(a[i], a[i+1]);
            rev = true;
            cnt++;
        }
    }
    return cnt;
}

template <class T>
void printVector(vector<T>& a, string delimiter) {
    if (a.size() == 0) return;
    cout << a[0];
    for (int i = 1; i < a.size(); ++i) {
        cout << delimiter << a[i];
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<int> array(n);
    for (int i = 0; i < n; ++i) {
        cin >> array[i];
    }
    int k = bubbleSort(array);
    printVector(array, " ");
    cout << k << endl;
}



Measured memory_bytes: 3156
N=int(input())
a_list=[]
exists=False
for _ in range(N):
    a = int(input())
    a_list.append(a)
    if a == 2:
        exists = True
if not exists:
    print(-1)
    exit()

curr = 0
already = set()
ans=0
while True:
    nexthop = a_list[curr] - 1
    if nexthop in already:
        print(-1)
        exit()
    already.add(nexthop)
    curr = nexthop
    ans+=1
    if nexthop == 1:
        print(ans)
        exit()

Measured memory_bytes: 60632
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}

template <typename Func>
struct FixPoint : Func {
    inline constexpr FixPoint(Func &&f) noexcept : Func(forward<Func>(f)) {}

    template <typename... Args>
    inline decltype(auto) operator()(Args &&... args) const {
        return Func::operator()(*this, forward<Args>(args)...);
    }
};

template< typename Func >
inline decltype(auto) makeFixPoint(Func &&f) {
    return FixPoint< Func >{forward< Func >(f)};
}
// }}} End Header

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

    var(i64, N);

    if (N % 2 == 1) {
        print(0);
        return 0;
    }

    i64 ans = 0;
    for (i64 d = 5; d <= N; d *= 5) {
        ans += (N / d) / 2;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
char m[12][13];
void dfs(int x, int y)
{
	int i, j, nx, ny;
	m[y][x] = '0';
	for (i = 1; i >= -1; i--)
	{
		if (i == 1 || i == -1)
		{
			nx = x;
			ny = y + i;
			if (0 <= nx && nx < 12 && 0 <= ny && ny < 12 && m[ny][nx] == '1') dfs(nx, ny);
		}
		else
		{
			for (j = 1; j >= -1; j--)
			{
				nx = x + j;
				ny = y + i;
				if (0 <= nx && nx < 12 && 0 <= ny && ny < 12 && m[ny][nx] == '1') dfs(nx, ny);
			}
		}
	}
	return;
}
int main()
{
	int i, j, n;
	while (1)
	{
		for (i = 0; i < 12; i++)
		{
			cin >> m[i];
			if (cin.eof()) return 0;
		}
		n = 0;
		for (i = 0; i < 12; i++)
		{
			for (j = 0; j < 12; j++)
			{
				if (m[i][j] == '1')
				{
					n++;
					dfs(j, i);
				}
			}
		}
		cout << n << endl;
	}
}

Measured memory_bytes: 0
import sys
a=list(input())
i=0
if len(a)%2!=0:
    print('No')
    sys.exit()
for j in range(len(a)//2):
    if a[i]=='h' and a[i+1]=='i':
        print('Yes')
        sys.exit()
    i+=2
print('No')


Measured memory_bytes: 3060
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#define inf pow(10, 9)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  int N, M;
  ci(N, M);
  ve<int> H(N);
  rep(i, N){
    ci(H.at(i));
  }
  ve<ve<int>> A(N);
  rep(i, M){
    int a, b;
    ci(a, b);
    a--, b--;
    A.at(a).pb(b);
    A.at(b).pb(a);
  }
  int c = 0;
  rep(i, N){
    bool f = 1;
    each(j, A.at(i)){
      if(H.at(i) <= H.at(j)){
        f = 0;
      }
    }
    if(f){
      c ++;
    }
  }
  co(c);
}

Measured memory_bytes: 8804
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin>>n;
    vector<int> v(n,0);
    rep(i,n) cin>>v[i];
    bool ok=true;
    rep(i,n){
        if(v[i]%2==0){
            if(v[i]%3!=0 && v[i]%5!=0) ok =false; 
        }
    }
    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
const int N=5e5+5;
const ll Mod=998244353LL;
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
ll pow(ll x,ll k){
    if(k==0)return 1LL;
    if(k==1LL)return x;
    ll t=pow(x,k/2LL);t*=t;t%=Mod;
    if(k&1)t*=x,t%=Mod;
    return t;
}
int n,K;ll inv[N];ll ans;
ll C(int i,int j){
    if(i<j)return 0;
    if(i==j)return 1LL;
    ll ans=inv[i];
    ans*=pow(inv[j],Mod-2LL);ans%=Mod;
    ans*=pow(inv[i-j],Mod-2LL);ans%=Mod;
    return ans;
}
int main(){
    n=read();K=read();
    inv[1]=1LL;rep(i,2,K)(inv[i]=inv[i-1]*1LL*i)%=Mod;
    rpd(i,K,n){
        int R=i,B=K-i,T=R-(n-1);if(R<B)break;
        if(T>B){(ans+=C(K,R))%=Mod;continue;}
        if(R!=B){(ans+=((C(K,R)-C(K,R+T))%Mod+Mod)%Mod)%=Mod;continue;}
        (ans+=((C(K-1,R)-C(K-1,R+T))%Mod+Mod)%Mod)%=Mod;;
    }
    printf("%lld\n",ans);
    //system("pause");
    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,c[200010];
signed main(){
    cin>>n;
    rep(i,n)cin>>c[i];
    sort(c,c+n,greater<>());
    int ans=0;
    rep(i,n){
        ans+=c[i]*(i+2);
        ans%=MOD;
    }
    ans*=modpow(4,n-1);
    ans%=MOD;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm> 

using namespace std;

#define   M             100005
#define   ll            long long
#define   PI            atan(1.0)*4
#define   mst(x,v)      memset(x,v,sizeof(x))
#define   inf           (int)1e9

typedef   pair<int,int> P;

ll a[M];

int main() {

	ll n,t,d,c,ans,anger;
	scanf("%lld %lld %lld",&n,&t,&d);

	for(int i=0;i<n;i++) scanf("%lld",&a[i]);

	sort(a,a+n);
	
	anger=a[0]+d; 
	ans=1;c=1;
	 
	for(int i=1;i<n;i++) {
		
		if(c<t && a[i]<=anger) {
			c++;
		}
		else {
			anger=a[i]+d;
			c=1;
			ans++;
		}
	//	printf("anger:%2lld  now car:%2lld  now ple:%2lld\n",anger,ans,c);
	}
	printf("%lld\n",ans);
}




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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll a, b;
	cin >> a >> b;

	ll ret = (a <= 5) ? 0 : (a <= 12) ? b / 2 : b;

	cout << ret << endl;

	return 0;
}


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}


inline int addmod(int x ,int y){return (x%mod + y%mod)%mod;}
inline int submod(int x ,int y){return (x%mod - y%mod + mod)%mod;}
inline int mulmod(int x ,int y){return (x%mod *1LL* y%mod)%mod;}
inline int nextSubMask(int i , int mask) {return (i-1)&mask;} /// returns next smallest submask

void we_r_done(){cout<<"NO"; exit(0);}

void debug(bool ok , string mssg)
{
    if(ok)return;
    cout<<mssg;
    exit(0);
}

lli dp[66][55];

lli nCr(int n, int r)
{
 if(n==r) return dp[n][r] = 1;
 if(r==0) return dp[n][r] = 1;
 if(r==1) return dp[n][r] = n;
 if(dp[n][r]) return dp[n][r];
 return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    //FastIO;

    int n,A , B;


    cin>>n>>A>>B;
    int now = 1;
        lli ans = 0;
    for(int i=1; i<=n; i++){
        int x;
        cin>>x;
        if(i == 1) now = x;
        ans += min(A*1LL*(x-now) , 1LL*B ) ;
        now = x;
    }
    cout<<ans;

    return 0;

}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?


Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
nice = [True] * N
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, input().split())
    if H[a] <= H[b]:
        nice[a] = False
    if H[a] >= H[b]:
        nice[b] = False
ans = nice.count(True)
print(ans)

Measured memory_bytes: 20108
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    string o,e;
    cin >> o >> e;
    rp(i,o.length()){
        cout << o[i];
        if(i != e.length())
            cout << e[i];
    }
    cout << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;


void solve(long long a, std::string s){
    if(a >= 3200){
        cout<<s<<endl;
    }
    else{
        cout<<"red"<<endl;
    }
}

int main(){
    long long a;
    scanf("%lld",&a);
    std::string s;
    std::cin >> s;
    solve(a, s);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
signed main(){
    int n;cin >> n;
    int ans = 0;
    int num;
    for(int i = 1;i*i <= n;i++){
        if(n%i == 0){
            num = i-1;
            
            if(num != 0 && n%num == n/num){
                ans += num;
            }
            if(i*i != n){
                num = n/i - 1;
                
                if(num != 0&&n%num ==n/num )ans+= num;
            }

        }
        //trace(i,num,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
const M=10^9+7
function main()
	N=parse(Int,readline())
	fac=ones(Int,N)
	for i=2:N
		fac[i]=fac[i-1]*(i-1)%M
	end
	invfac=zeros(Int,N)
	invfac[N]=invmod(fac[N],M)
	for i=N-1:-1:1
		invfac[i]=invfac[i+1]*i%M
	end
	G=[Int[] for _=1:N]
	for s=readlines()
		a,b=map(x->parse(Int,x),split(s))
		push!(G[a],b)
		push!(G[b],a)
	end
	c=zeros(Int,N)
	dp1=zeros(Int,N)
	function dfs1(u,p)
		ret=1
		c[u]=1
		for v=G[u]
			if v!=p
				ret=ret*dfs1(v,u)%M
				ret=ret*invfac[c[v]+1]%M
				c[u]+=c[v]
			end
		end
		dp1[u]=ret
		ret*fac[c[u]]%M
	end
	ans=zeros(Int,N)
	function dfs2(u,p,pr)
		ans[u]=dp1[u]*pr%M*invfac[N-c[u]+1]%M
		for v=G[u]
			if v!=p
				dfs2(v,u,ans[u]*c[v]%M*invmod(dp1[v],M)%M*fac[N-c[v]]%M)
			end
		end
		ans[u]=ans[u]*fac[N]%M
	end
	dfs1(1,0)
	dfs2(1,0,1)
	println.(ans)
end
main()

Measured memory_bytes: 238888
using namespace std;
	#define M_PI 3.1415926535897932384626433832795
	#include<bits/stdc++.h>
	#define _USE_MATH_DEFINES
	#include<math.h>
	#include <iostream>


	int main(){
	int n,l;
	cin>>n>>l;
	string s[n];
	for (int i = 0; i < n; ++i) {
		cin>>s[i];
	}
	sort(s,s+n);
	for (int i = 0; i < n; ++i) {
			cout<<s[i];
		}
	cout<<endl;
	}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100000

int n, A[N];
binarySearch(int key){
    int left = 0;
    int right = n;
    while(left < right){
        int mid = (left + right) / 2;
        if (A[mid] == key) return mid;
        else if(key < A[mid]) right = mid;
        else left = mid + 1;
    }
    return 0;
}

int main(void){
    int q, key, i, c=0;
    scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &A[i]);
	
	scanf("%d", &q);
	for(i=0; i<q; i++){
		scanf("%d", &key);
		if(binarySearch(key)!=0) c++;
	}
    printf("%d\n", c);
	
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int main(void){
  int N;
  cin  >> N;
  int a[N];
  int b[N];
  int count=0;
  for(int i=0;i<N;i++){
cin >> a[i];
a[i]--;
b[i]=i;
  }

  for(int i=0;i<N;i++){
    if(a[i]+b[i]==b[a[i]]+a[a[i]]){
      count++;
    }
  }
cout << count/2 << endl;
return 0;
}


Measured memory_bytes: 1024
h, w = map(int, input().split())
a = []
ac = [0 for i in range(w)]
for i in range(h):
    temp = list(input())
    for j in range(w):
        if temp[j] == '#':
            ac[j] += 1
    if '#' in temp:
        a.append(temp)
    else:
        h -= 1
for j in range(h):
    ans = ''
    for i in range(w):
        if ac[i] != 0:
            ans += a[j][i]
    print(ans)


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

using namespace std;

const int inf = 1000000000;

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

	vector<int> c(n);
	vector<vector<int> > a(n, vector<int> (m));

	for(int i = 0; i < n; ++i) {
		cin >> c[i];
		for(int j = 0; j < m; ++j) {
			cin >> a[i][j];
		}
	}

	int ans = inf;

	for(int i = 0; i < 1 << n; ++i) {
		vector<int> sum(m);
		for(int j = 0; j < n; ++j) {
			if(i >> j & 1) {
				for(int k = 0; k < m; ++k) {
					sum[k] += a[j][k];
				}
			}
		}
		int tmp = 0;
		for(int j = 0; j < n; ++j) {
			if(i >> j & 1) {
				tmp += c[j];
			}
		}
		if(*min_element(sum.begin(), sum.end()) >= x) {
			ans = min(ans, tmp);
		}
	}

	if(ans == inf) {
		cout << -1 << '\n';
	} else {
		cout << ans << '\n';
	}

	return 0;
}

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

int main () {

    int N, K;

    scanf("%d %d", &N, &K);

    int A;

    for (int i = 0; i < N; i++) {
        scanf("%d", &A);
    }

    int ans = (N - 1 + (K - 2)) / (K - 1);

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

    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

result = []
for h in range(1, H):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, W):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))


Measured memory_bytes: 18968
a = int(input())
ar = []
b = 0
for i in range(a):
    l = int(input())
    b += l 
    if l % 10 != 0:
        ar.append(l)
if b % 10 != 0:
    print(b)
else:
    if len(ar) == 0:
        print(0)
    else:
        print(b - min(ar))

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

int main()
{
    /*ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);*/
    //freopen("output.txt","w+",stdout);
    //freopen("input.txt","r+",stdin);
    int ans=0;
    string s;
    cin>>s;
    for(int i=0;i<4;i++)
        ans+=(s[i]=='+'?1:-1);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3572
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 1000006
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    FASTIO;
    string s;
    cin>>s;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 3660
def resolve():
    '''
    code here
    '''
    X, N = [int(item) for item in input().split()]
    if N > 0:
        a_list = [int(item) for item in input().split()]
        

        a = X
        b = X
        is_not_fond = True
        res = X
        while is_not_fond:
            if a in a_list:
                a += 1
            else:
                res = a
                is_not_fond = False
            if b in a_list:
                b -= 1
            else:
                res = b
                is_not_fond = False

        print(res)
    else:
        print(X)

if __name__ == "__main__":
    resolve()


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

int n,k,s,l,r;
int a[500],b[500],c;

void check(int x){
	for(int i=0;i<n;i++){
		b[i]=a[i]%x;
	}
	sort(b,b+n);
	l=0,r=n-1;
	c=0;
	while(r>l){
		if(b[l]+b[r]==x){
			c+=b[l];
			l++,r--;
		}
		else if(b[l]+b[r]>x){
			c+=x-b[r];
			b[l]-=x-b[r];
			r--;
		}
		else{
			c+=b[l];
			b[r]+=b[l];
			l++;
		}
	}
	return;
}

int main(){
	cin>>n>>k;
	s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s+=a[i];
	}
	int res=0;
	for(int i=1;i*i<=s;i++){
		if(s%i==0){
			check(i);
			if(c<=k) res=max(res,i);
			check(s/i);
			if(c<=k) res=max(res,s/i);
		}
	}
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 256