akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
bool f[777][777];
int n,m,x,y,ans,d[600010],A[666666],B[66666],fa[600010];
bool u[777][777];
int getf(int x){
	if (x==fa[x]) return x;
	int t=fa[x];
	fa[x]=getf(t);
	d[x]^=d[t];
	return fa[x];
}
int main(){
	cin>>n>>m;
	FOR(i,1,m){
		getint(x),getint(y);
		if (x>y) swap(x,y);
		u[x][y]=1;
	}
	FOR(i,1,n) fa[i]=i,d[i]=0;
	FOR(i,1,n)
		FOR(j,i+1,n)
			if (!u[i][j]){
				int X=getf(i),Y=getf(j);
				if (X==Y){
					if (d[i]==d[j]) return puts("-1"),0;
				}
				else{
					fa[X]=Y;
					d[X]=d[i]^d[j]^1;
				}
			}
	FOR(i,1,n){
		int X=getf(i);
		if (d[i]==0) A[X]++;
		else B[X]++;
	}
	f[0][0]=1;
	FOR(i,1,n){
		FOR(j,0,n){
			if (f[i-1][j]) f[i][j+A[i]]=1,f[i][j+B[i]]=1;
		}
	}
	ans=n*n*n;
	FOR(i,0,n)
		if (f[n][i]){
			ans=min(ans,i*(i-1)/2+(n-i)*(n-i-1)/2);
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	
	int sum=0;
	cin>>n;
	int a[105];
	int b[105];
	for(int i=0;i<n-1;i++){
		cin>>b[i];
	}
	a[0]=b[0];
	a[n-1]=b[n-2];
	for(int i=1;i<n-1;i++){
		a[i]=min(b[i-1],b[i]);
	}
	for(int i=0;i<n;i++){
		sum+=a[i];
	}
	cout<<sum;
}

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

int main()
{
	int N, P;
	cin >> N >> P;
	int odd = 0;
	int even = 0;
	for( int i = 0; i < N; i++ ) {
		int A;
		cin >> A;
		if( A % 2 ) odd++;
		else even++;
	}

	long long ans = 0;
	if( odd ) {
		ans = 1;
		for( int i = 0; i < N - 1; i++ ) {
			ans *= 2;
		}
	}
	else if( P % 2 == 0 ) {
		ans = 1;
		for( int i = 0; i < N; i++ ) {
			ans *= 2;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3608
import math
N, K = [int(_) for _ in input().split()]
A = sorted([int(_) for _ in input().split()])

#x回切ると1/(x+1)倍になる


def check(x):
    if x == 0:
        print(1)
        exit()
    cnt = sum(0 - (-a) // x for a in A) - N
    return cnt <= K


lb = -1
rb = 10**9 + 1
# Max x for check(x) == True
while rb - lb > 1:
    mid = (rb + lb) // 2
    if check(mid):
        rb = mid
    else:
        lb = mid
ans = lb
d = 0
for a in A:
    if a % ans:
        d = 1
        break
ans += d
print(ans)


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


int main(){
    ll N, M ,X;
    cin >> N >> M >> X;
    vector<ll> d(N + 1,0);
    for(int i = 0; i < M; i++){
        ll tmp;
        cin >> tmp;
        d[tmp] ++;
    }

    ll ans_1 = 0, ans_2 = 0;

    for(int i = X; i >= 0; i--){
        ans_1 += d[i];
    }

    for(int i = X; i <= N; i++){
        ans_2 += d[i];
    }

    cout << min(ans_1, ans_2) << endl;

}

Measured memory_bytes: 256
//dont try to understand my code i really dont understand it 
#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<vector>
#include <queue>
#include <stack>
#include<algorithm>
#include<memory.h>
using namespace std;
typedef long long ll;
#define f( i , x , n ) for(int i = x; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define mt make_tuple
typedef pair<int, int> ii;
const double PI = acos(-1.0);
//const ll oo = 1000000000000030200;
//const ll F = LLONG_MIN;	
const int A = 1234567;
typedef long long ll;
// write what you need here : ... 


int main() {
	
	ll count = 0 , count2 = 0 ; 

	ll n;
	cin >> n; 
	for (int i = 0;i < n;i++)
	{
		ll temp; 
		cin >> temp; 
		if (temp % 4 == 0)
		{
			count++;
		}
		else
			if (temp % 2 == 0)
				count2++;
	}
	
	if (count2 == n) {
		cout << "Yes" << endl;
		return 0;
	}
	if (count2 != 0) {
		n -= count2;
		n++;
	}

	if (count + 1>= (n - count))
		cout << "Yes";
	else
		cout << "No";


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
namespace IO
{
    const int __S=(1<<20)+5;char __buf[__S],*__H,*__T;
    inline char getc()
    {
        if(__H==__T) __T=(__H=__buf)+fread(__buf,1,__S,stdin);
        if(__H==__T) return -1;return *__H++;
    }
    template <class __I>inline void read(__I &__x)
    {
        __x=0;int __fg=1;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1,__c=getc();
        while(isdigit(__c)) __x=__x*10+__c-'0',__c=getc();
        __x*=__fg;
    }
    inline void readd(double &__x)
    {
        __x=0;double __fg=1.0;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1.0,__c=getc();
        while(isdigit(__c)) __x=__x*10.0+__c-'0',__c=getc();
        if(__c!='.'){__x=__x*__fg;return;}else __c=getc();
        double __t=1e-1;while(isdigit(__c)) __x=__x+1.0*(__c-'0')*__t,__t=__t*0.1,__c=getc();
        __x=__x*__fg;
    }
    inline void reads(char *__s,int __x)
    {
        char __c=getc();int __tot=__x-1;
        while(__c<'a'||__c>'z') __c=getc();
        while(__c>='a'&&__c<='z') __s[++__tot]=__c,__c=getc();
        __s[++__tot]='\0';
    }
    char __obuf[__S],*__oS=__obuf,*__oT=__oS+__S-1,__c,__qu[55];int __qr;
    inline void flush(){fwrite(__obuf,1,__oS-__obuf,stdout);__oS=__obuf;}
    inline void putc(char __x){*__oS++ =__x;if(__oS==__oT) flush();}
    template <class __I>inline void print(__I __x)
    {
        if(!__x) putc('0');
        if(__x<0) putc('-'),__x=-__x;
        while(__x) __qu[++__qr]=__x%10+'0',__x/=10;
        while(__qr) putc(__qu[__qr--]);
    }
    inline void prints(const char *__s,const int __x)
    {
        int __len=strlen(__s+__x);
        for(int __i=__x;__i<__len+__x;__i++) putc(__s[__i]);
    }
    inline void printd(long double __x,int __d)
    {
        long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t;
        while(__d--)
        {
            long double __y=__x*10.0;__x*=10.0;
            int __c=(int)floor(__y+1e-9);if(__c==10) __c--;
            putc(__c+'0');__x-=floor(__y);
        }
    }
    inline void el(){putc('\n');}inline void sp(){putc(' ');}
}using namespace IO;
char c[100005];int n;
vector<pair<int,int> >e;
int main()
{
	scanf("%s",c+1);n=strlen(c+1);int gg=1,cur=1;
	for(int i=1;i<=(n-1)/2;i++) if(c[i]!=c[n-i]) return puts("-1"),0;
	if(c[n]=='1') return puts("-1"),0;if(c[1]=='0') return puts("-1"),0;
	for(int i=1;i<n;i++)
	{
		if(c[i]=='0') e.push_back(make_pair(cur,++gg));
		else e.push_back(make_pair(cur,++gg)),cur=gg;
	}
	for(int i=0;i<e.size();i++) cout<<e[i].first<<' '<<e[i].second<<endl;
}

Measured memory_bytes: 2420
import java.io.IOException;
import java.util.BitSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			boolean[][] map = new boolean[n][31];
			for (int i = 0; i < n; i++) {
				int f = scanner.nextInt();
				while (f-- > 0)
					map[i][scanner.nextInt()] = true;
			}
			int ans = -1;
			BitSet[] bit = new BitSet[n];
			for (int i = 0; i < n; i++) {
				bit[i] = new BitSet();
				bit[i].set(i);
			}
			for (int t = 1; t <= 30; t++) {
				BitSet tmp = new BitSet();
				for (int i = 0; i < n; i++)
					if (map[i][t])
						tmp.or(bit[i]);
				for (int i = 0; i < n; i++)
					if (map[i][t])
						bit[i] = tmp;

				if (tmp.cardinality() == n) {
					ans = t;
					break;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 97712
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

long select(const vector<vector<long>>& values, long W, long w)
{
  vector<vector<long>> sums(4);
  for (int i = 0; i < 4; ++i) {
    const auto& value = values[i];
    auto& sum = sums[i];
    sum.push_back(0);
    for (int j = 0; j < value.size(); ++j) {
      sum.push_back(sum[j] + value[j]);
    }
  }
  long max_w = 0;
  for (int c3 = values[3].size(); c3 >= 0; --c3) {
    auto w3 = c3 * (w + 3);
    if (w3 > W) continue;
    for (int c2 = values[2].size(); c2 >= 0; --c2) {
      auto w2 = w3 + c2 * (w + 2);
      if (w2 > W) continue;
      for (int c1 = values[1].size(); c1 >= 0; --c1) {
        auto w1 = w2 + c1 * (w + 1);
        if (w1 > W) continue;
        for (int c0 = values[0].size(); c0 >= 0; --c0) {
          auto w0 = w1 + c0 * w;
          if (w0 > W) continue;
          long w = sums[0][c0] + sums[1][c1] + sums[2][c2] + sums[3][c3];
          if (max_w < w) max_w = w;
        }
      }
    }
  }
  return max_w;
}


int main()
{
  int N;
  long W;
  cin >> N >> W;
  vector<vector<long>> values(4);
  long w0 = -1;
  for (int i = 0; i < N; ++i) {
    long w, v;
    cin >> w >> v;
    if (w0 < 0) w0 = w;
    values[w - w0].push_back(v);
  }
  for (int i = 0; i < 4; ++i) {
    sort(values[i].begin(), values[i].end(), [](long a, long b) { return b < a; });
  }
  cout << select(values, W, w0) << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			// input
			char[] firstInput = br.readLine().toCharArray(); // ex : 123
			int[] num = new int[firstInput.length];// base
			char seconInput = 0;
			for (int i = 0; i < firstInput.length; i++) {
				seconInput = firstInput[i];// split
				num[i] = Character.getNumericValue(seconInput);// input info
			}
			// constraints
			if (num[0] == 0 && seconInput == '0' )break;

			// plus works & output
			int sum = 0;
			for (int i = 0; i < num.length; i++) {

				sum += num[i];
			}
			System.out.println(sum);
		} while (true);
	}
}

Measured memory_bytes: 24412
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const int INF = 1<<30;

ll dp[100100];

int main(){
    int N; cin >> N;
    vector<int> h(N);
    rep(i,N)cin >> h[i];
    rep(i,N+1)dp[i]=INF;
    dp[0]=0;
    rep(i,N){
        dp[i+1]=min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
        dp[i+2]=min(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

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

using namespace std;

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

int main() {
    int x;
    cin >> x;
    int n = x / 100;
    int m = x % 100;
    if(m <= n * 5){
        cout << 1;
    }else{
        cout << 0;
    }
}



Measured memory_bytes: 256
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		//var x = ss.Next<int>();
		//var y = ss.Next<int>();
		for (int i = 1; i <= 3000; i++)
		{
			int x = ss.Next<int>();
			int y = ss.Next<int>();
			if (x == 0 && y == 0)
			{
				break;
			}
			else if (x <= y)
			{
				Console.WriteLine(x+" "+y);
			}
			else if(x>y)
			{
				Console.WriteLine(y+" "+x);
			}


		}




		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}



public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9952
#include<iostream>
using namespace std;
int main(){
	int w,h,x,y,r;
	cin>>w>>h>>x>>y>>r;
	if(x-r>=0&&x+r<=w&&y-r>=0&&y+r<=h){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int x = (a + d - 1) / d;
    int y = (c + b - 1) / b;
    cout << (x >= y ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int n;
int a[20];
int main() {
    scanf("%d",&n);
    for (int i=0; i<n ;i++) scanf("%d",&a[i]);
    int ans=0;
    for (int i=1; i<n-1; i++) {
        int b[3] = {a[i-1],a[i],a[i+1]};
        sort(b,b+3);
        if (b[1]==a[i]) ans++;
    }
    printf("%d",ans);
}


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

int main() {
    string s;
    cin >> s;
    int n = s.length();
    int ans = 0, x = 0;
    REP(i,n){
        if (s[i] == 'S'){
            x++;
        }else{
            if (x > 0){
                x--;
            }else{
                ans++;
            }
        }
    }
    ans += x;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

const int P=998244353;
const int N=205;

int x[N],y[N];
int C[N][N];
int n,ans,pw;

int main()
{
	//freopen("cvxscr.in","r",stdin),freopen("cvxscr.out","w",stdout);
	scanf("%d",&n),pw=1;
	for (int i=1;i<=n;++i) scanf("%d%d",&x[i],&y[i]),(pw<<=1)%=P;
	C[0][0]=1;
	for (int i=1;i<=n;++i)
	{
		C[i][0]=1;
		for (int j=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%P;
	}
	ans=n+1;
	for (int i=1;i<n;++i)
		for (int j=i+1;j<=n;++j)
		{
			int cnt=2,vx=x[i]-x[j],vy=y[i]-y[j];
			for (int k=1,vx_,vy_;~cnt&&k<i;++k)
			{
				vx_=x[i]-x[k],vy_=y[i]-y[k];
				if (!(vx*vy_-vy*vx_)) cnt=-1;
			}
			for (int k=i+1,vx_,vy_;~cnt&&k<j;++k)
			{
				vx_=x[i]-x[k],vy_=y[i]-y[k];
				if (!(vx*vy_-vy*vx_)) cnt=-1;
			}
			if (!~cnt) continue;
			for (int k=j+1,vx_,vy_;k<=n;++k) vx_=x[i]-x[k],vy_=y[i]-y[k],cnt+=!(vx*vy_-vy*vx_);
			for (int k=2;k<=cnt;++k) (ans+=C[cnt][k])%=P;
		}
	ans=(P-ans+pw)%P,printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

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

int main(){
  double n,m,d;
  cin>>n>>m>>d;
  double ans=(n-d)*2*(m-1)/n/n;
  if(d==0) ans/=2;
  printf("%.10f\n",ans);
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define f(i,n) for(ll i=0;i<n;i++)
#define fe(i,a,b) for(ll i=a;i<=b;i++)
#define ll long long
#define endl "\n"
#define pb push_back
#define mp make_pair
using namespace std;
ll dp[100005];
ll mincost(vector<int>&a, ll n)
{
	if(dp[n]!=-1)
		return dp[n];
	if(n==1)
		return dp[n]=0;
	if(n<1)
		return INT_MAX;
	dp[n]=min(abs(a[n-2]-a[n-1])+mincost(a,n-1),abs(a[n-3]-a[n-1])+mincost(a,n-2));
	return dp[n];
}
void solve()
{
	memset(dp,-1,sizeof(dp));
	ll n;
	cin>>n;
	vector<int>a(n);
	f(i,n)
		cin>>a[i];
	cout<<mincost(a,n)<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll t=1;
	// cin>>t;
	while(t--)
		solve();
    return 0;
}

Measured memory_bytes: 6764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ll A,B,C,K; cin >> A >> B >> C >> K;
    ll a = min(A,K);
    ll b = min(B,K - a);
    ll c = max(K - (a+b), (ll)0);
    cout << a-c << endl;
    return 0;
}

Measured memory_bytes: 3644
// C++ program for coin change problem.
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int k;
    int a,b;
    cin >>k;
    cin >>a>> b;
    bool ck = false;

    for(int i=min(a,b); i<=max(a,b); i++){
        if(i%k==0) ck = true;
    }

    if(ck==true) cout <<"OK";
    else cout <<"NG";


	return 0;
}




Measured memory_bytes: 3620
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

char str[120];

int main()
{
  int i;
  int sum=0;

  while(scanf("%s",str)!=EOF){
    if(strlen(str)==1){
      sum++;
      continue;
    }
    rep(i,(strlen(str)+1)/2)
      if(str[i]!=str[strlen(str)-i-1]){
	break;
      }
    if(i>=(strlen(str)+1)/2)
      sum++;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 1156
program kadai
   implicit none
    integer  ::  M,D
    integer  ::  dd(2)
integer  ::  num,i,j,k


read(*,*) M,D

if(D<22) then
    write(*,*) 0
    stop
end if

!write(*,*) M,D,dd(1),dd(2)

num=0
do i=1,M
    do j=22,D
        dd(1)=j-(j/10)*10
        dd(2)=j/10
        !write(*,*) dd(2),dd(1)
        if (dd(1)>1 .and. dd(1)*dd(2)==i) then
            num=num+1
        end if
    end do
end do

write(*,*) num


stop
contains


end program kadai


Measured memory_bytes: 768
import std.stdio;
import std.math;
import std.algorithm;
import std.conv;

long bisect(T)(T[] arr, T p) {
	long u, t = arr.length-1;
	long i = (u + t) / 2;
	while(i != 0 && i != arr.length - 1 && (arr[i] > p || arr[i+1] <= p)) {
		if (arr[i] > p) {
			t = i;
		}
		else {
			if (u == i)
				u = i + 1;
			else
				u = i;
		}
		i = (t + u) / 2;
	}
	return i;
}
unittest {
	assert(bisect!int([1, 2, 3, 4], 1) == 0);
	assert(bisect!int([1, 2, 3, 4], 2) == 1);
	assert(bisect!int([1, 2, 3, 4], 3) == 2);
	assert(bisect!int([1, 2, 3, 4], 4) == 3);
}

void main() {
	long a, b, q;
	long[] s, t, x;
	scanf("%ld %ld %ld", &a, &b, &q);
	foreach (i;0..a+b+q) {
		long y;
		scanf("%ld", &y);
		if (i < a) {
			s ~= y;
		}
		else if (i < a + b) {
			t ~= y;
		}
		else {
			x ~= y;
		}
	}
	s.sort!"a<b";
	t.sort!"a<b";
	s = -100000000000 ~ s ~ 100000000000;
	t = -100000000000 ~ t ~ 100000000000;
	foreach(x_;x) {
		auto sc = s.bisect!long(x_);
		auto tc = t.bisect!long(x_);
		auto tsl = s[sc+1] - x_;
		auto tsr = x_ - s[sc];
		auto ttl = t[tc+1] - x_;
		auto ttr = x_ - t[tc];
		writeln([
			max(tsr, ttr),
			max(tsl, ttl),
			tsr*2+ttl,
			tsr+ttl*2,
			tsl*2+ttr,
			tsl+ttr*2
		].reduce!((a, b) => min(a,b)));
	}
}


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

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    if(K - A <= 0){
        cout << K << endl;
    }
    else if(K - A - B <= 0){
        cout << A << endl;
    }
    else{
        cout << A - (K - A - B) << endl;
    }
}

Measured memory_bytes: 3656
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



from collections import Counter
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i * i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += i % 2 + (3 if i % 3 == 1 else 1)
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
 
    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret

def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return ret
  
n=int(readline())
a=list(map(int,readline().split()))  
A=set(a)
ans=0
c=Counter(a)
for i in a:
  if c[i]>=2:
    continue
  chk=set(divisors(i))
  if chk&A=={i}:
    ans+=1
print(ans)





Measured memory_bytes: 152844
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 ans = (b-1)/(a-1);
    if((b-1)%(a-1)==0) {
    	System.out.println(ans);
    }else {
    	System.out.println(ans+1);
    }
    }
}

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


template<class T>
struct Dinic {
	using value_type = T;
private :
	const value_type INF = numeric_limits<value_type>::max();
	struct Edge {
	public : 
		int to, rev; value_type cap;
		Edge (int to, value_type cap, int rev) :
			to(to), cap(cap), rev(rev) { }
    };
    vector<int> level, idx;
    vector<vector<Edge>> g;
public : 
	Dinic (int n) : g(n), level(n), idx(n) { }

	Dinic (int l, int r, vector<pair<int, int>> &e) : g(l + r + 2), level(l + r + 2), idx(l + r + 2) {
		for (int i = 1; i <= l; i++) add_edge(0, i, 1);
		for (int i = 1; i <= r; i++) add_edge(l + i, l + r + 1, 1);
		for (const auto p : e) add_edge(p.first + 1, p.second + l + 1, 1);
	}

	void add_edge (int from, int to, value_type cost) {
		g[from].emplace_back(to, cost, g[to].size());
		g[to].emplace_back(from, 0, g[from].size() - 1);
	}

	void init (int s) {
		fill(level.begin(), level.end(), -1); level[s] = 0;
		queue<int> que; que.emplace(s);
		while (not que.empty()) {
			const int v = que.front(); que.pop();
			for (const Edge &e : g[v]) {
				if (e.cap > 0 and level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.emplace(e.to);
				}
			}
		}
	}

	value_type find_flow (int v, int t, value_type f) {
		if (v == t) return f;
		for (int &i = idx[v]; i < g[v].size(); i++) {
			Edge &e = g[v][i];
			if (e.cap > 0 and level[v] < level[e.to]) {
				value_type flow = find_flow(e.to, t, min(f, e.cap));
				if (flow > 0) {
					e.cap -= flow;
					g[e.to][e.rev].cap += flow;
					return flow;
				}
			}
		}
		return 0;
	}

	value_type max_flow (int s, int t) {
		value_type ret = 0;
		while (true) {
			init(s);
			if (level[t] < 0) break;
			fill(idx.begin(), idx.end(), 0);
			while (true) {
				value_type flow = find_flow(s, t, INF);
				if (flow <= 0) break;
				ret += flow;
			}
		}
		return ret;
	}

	vector<pair<int, int>> bipartite_matching (int l, int r) {
		max_flow(0, l + r + 1);
		vector<pair<int, int>> ret;
		for (int v = 1; v <= l; v++) {
			for (const auto &e : g[v]) {
				if (e.to == 0 or e.cap > 0) continue;
				ret.emplace_back(v - 1, e.to - l - 1);
				break;
			}
		}
		return ret;
	}

};

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n), d(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i] >> d[i];
	}

	vector<pair<int, int>> match;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i] < c[j] and b[i] < d[j]) {
				match.emplace_back(i, j);
			}
		}
	}
	
	Dinic<int> g(n, n, match);
	
	cout << g.bipartite_matching(n, n).size() << '\n';
	
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#define N 200

static int a = 0;
static int b  = 1;
static int c = 2;

int n,line[N][N],node[N],d[N],f[N],t;

void linenode(int );

void lenior();

int main()
{
  int u,k,v;
  int i,j;

  scanf("%d",&n);

  for(i = 0;i < n;i++)
    {
      for(j = 0;j < n;j++)
	{
	  line[i][j] = 0;
	}
    }

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

  return 0;
}
void linenode(int u)
{
  int y;
  node[u] = b;
  d[u] = ++t;
  for(y = 0;y < n;y++)
    {
      if( line[u][y] == 0)continue;
      if( node[y] == a)
	{
	  linenode(y);
	}
    }
  node[u] = c;
  t++;
  f[u] = t;
}
void lenior(){
  int i,u;
  for(i = 0;i < n;i++)
    node[i] = a;
  t = 0;
  for(u = 0;u < n;u++)
    {
      if(node[u] == a)
	    linenode(u);
    }
  for(i = 0;i < n;i++)
    {
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
}



Measured memory_bytes: 2028
#include <bits/stdc++.h>
#define ll long long
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using pii = pair<int, int>;
int n, c;
int channel[32][202020];
int32_t main()
{
	usecppio
    cin >> n >> c;
    for (int i = 0; i<n; i++)
    {
        int s, t, ch;
        cin >> s >> t >> ch;
        channel[ch][s*2-1]++;
        for (int j = s; j<=t; j++)
        {
            channel[ch][j*2]++;
            channel[ch][j*2+1]++;
        }
        channel[ch][t*2+1]--;
    }
    int ans = 0;
    for (int i = 0; i<202020; i++)
    {
        int ct = 0;
        for (int j = 0; j<32; j++)
            ct += (channel[j][i]>0);
        ans = max(ans, ct);
    }
    cout << ans << '\n';
}

Measured memory_bytes: 24064
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}

long long get_kth_a(long long a, long long k)
{
	if (k < a)
		return k;
	else
		return k + 1;
}

long long check(long long a, long long b, long long n)
{
	long long worst = 0;

	for (long long tmp = max(1LL, n / 2 - 100); tmp <= min(n, n / 2 + 100); tmp++) 
	{
		long long realb = tmp;
		if (tmp >= b)
			realb++;
		worst = max(worst, realb * get_kth_a(a, n -tmp+1));
	}
	return worst;
}


int main() {

#if defined(_DEBUG) 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int q;
	cin >> q;

	auto xxx = check(10, 5, 13);

	for (int i = 0; i < q; i++)
	{
		long long a, b;
		cin >> a >> b;

		long long best = 0;
		long long left = 0, right = 3000000001LL; // a * b + 1LL;
		while (left <= right)
		{
			long long m = left + (right - left) / 2LL;
			if (check(a, b, m) < (a*b))
			{
				left = m + 1;
				best = max(best, m);
			}
			else
			{
				right = m - 1;
			}
		}

		cout << best << "\n";
	}


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)cout<<'x';
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int m,n;
bool vi[100];
vector<int> g[60][60];
void dfs(int i,int u){
	for(auto v: g[u][i]){
		if(!vi[v]){
			vi[v] = true;
			dfs(i,v);
		}
	}
}
int main(){
	cin >> n >> m;
	for(int i=0;i<m;++i){
		int a,b;
		cin >> a >> b;
		for(int j=0;j<m;++j){
			if(j!=i){
				g[a][j].push_back(b);
				g[b][j].push_back(a);
			}
		}
	}
	int ans =0 ;
	for(int i=0;i<m;++i){
		memset(vi,false,sizeof(vi));
		vi[1]=true;
		dfs(i,1);
		for(int j=1;j<=n;++j)
			if(!vi[j]){
				ans++;
				break;
			}
	}
	cout << ans << endl;
}

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

int main()
{
	while (true) {
		int n;

		cin >> n;

		if (n == 0) {
			break;
		}

		int minx = 1000;
		int maxx = 0;
		int temp;
		int sum = 0;
		int avr;

		for (int i = 0; i < n; i++) {
			cin >> temp;

			sum += temp;

			minx = min(minx, temp);
			maxx = max(maxx, temp);
		}

		if (minx == maxx) {
			sum -= minx;
			avr = sum / (n - 1);
		}
		else {
			sum -= minx;
			sum -= maxx;
			avr = sum / (n - 2);
		}

		cout << avr << endl;
	}

	return 0;
}

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

signed main() {
  int n; cin >> n;
  int f[50];
  f[0] = f[1] = 1;

  // メモ化再帰
  for(int i = 2; i <= n; i++) {
    f[i] = f[i-1]+f[i-2];
  }
  cout << f[n] << endl;
  return 0;
}



Measured memory_bytes: 3096
N = int(input())
def numalpha(num):
  if num <= 26:
    return chr(64+num)
  elif num % 26 == 0:
    return numalpha(num//26-1)+chr(90)
  else:
    return numalpha(num//26)+chr(64+num%26)
print(numalpha(N).lower())

Measured memory_bytes: 61228
n,m = map(int,input().split())
t = [0]*m
s = []

for i in range(n):
    a = list(map(int,input().split()))
    for j in range(1,a[0]+1):
        t[a[j]-1] += 1

count = 0

for i in range(len(t)):
    if t[i] == n:
        count += 1

print(count)





Measured memory_bytes: 3060
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	long long int N, K, S;
	cin >> N >> K >> S;
	vector<long long int> v;
	for(int i = 0; i < K; i++){
		v.push_back(S);
	}
	if(S >= 200000){
		for(int i = K; i < N; i++){
			v.push_back(1);
		}
	}else{
		for(int i = K; i < N; i++){
			v.push_back(100000000);
		}
	}
	for(int i = 0; i < v.size() - 1; i++){
		cout << v[i] << " ";
	}
	cout << v[v.size() - 1] << endl;
	return 0;
}

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

int main(void)
{
  int a, b, c;
  cin >> a >> b >> c;

  string ans = "NO";
  for (int i = a; i < a * b; i += a)
  {
    if (i % b == c)
    {
      ans = "YES";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int N, K;
	string S;
	cin >> N >> K;
	cin >> S;

	vector<int> Nums;
	char now = '1';	// 今見ている数
	int cnt = 0;	// nowがいくつ並んでいるか

	for (int i = 0; i < N; i++) {
		if (S.at(i) == now) {
			cnt++;
		}
		else {
			Nums.push_back(cnt);
			now = S.at(i);
			cnt = 1;
		}
	}
	if (cnt != 0) Nums.push_back(cnt);
	if (Nums.size() % 2 == 0) Nums.push_back(0);

	// 累積和
	vector<int> sum(Nums.size() + 1, 0);
	for (int i = 0; i < Nums.size(); i++) {
		sum.at(i + 1) = sum.at(i) + Nums.at(i);
	}

	int Add = 2 * K + 1;
	int ans = 0;
	for (int i = 0; i < Nums.size(); i += 2) {
		int right;
		right = min(i + Add, (int)Nums.size());
		int tmp = sum.at(right) - sum.at(i);
		ans = max(tmp, ans);
	}

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


Measured memory_bytes: 1272
N = int(input())
A = [int(input()) for _ in range(N)]

A_sort = sorted(A)

A_max = A_sort[-1]
A_second_max = A_sort[-2]

for i in range(N):
  if A[i] != A_max:
    print(A_max)
  else:
    print(A_second_max)



Measured memory_bytes: 14172
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
inline void modAdd(int& _a, int _b, int _m) { _a = (_a + _b) % _m; }
inline void modAdd(lint& _a, lint _b, lint _m) { _a = (_a + _b) % _m; }
inline void minUpdate(int& _a, int _b) { _a = min(_a, _b); }
inline void minUpdate(lint& _a, lint _b) { _a = min(_a, _b); }
inline void maxUpdate(int& _a, int _b) { _a = max(_a, _b); }
inline void maxUpdate(lint& _a, lint _b) { _a = max(_a, _b); }

struct State {
	int x, c;
	State(int _x, int _c) : x(_x), c(_c) {}
};

bool operator > (const State& a, const State& b) { return a.c > b.c; }

int N, P[100010];

int cost[100010];

void solve() {
	fill(cost, cost + N, iINF);
	priority_queue< State, vector< State >, greater< State > > q;
	q.push(State(0, 0));
	cost[0] = 0;
	
	int ans = iINF;
	
	while (!q.empty()) {
		State s = q.top(); q.pop();
		
		if (cost[s.x] < s.c) continue;
		
		if (s.x == N - 1) {
			ans = s.c;
			break;
		}
		
		if (P[s.x] != 0) {
			if (cost[s.x + P[s.x]] > s.c) {
				cost[s.x + P[s.x]] = s.c;
				q.push(State(s.x + P[s.x], s.c));
			}
			continue;
		}
		
		for_(i,1,7) {
			if (s.x + i >= N) continue;
			if (cost[s.x + i] > s.c + 1) {
				cost[s.x + i] = s.c + 1;
				q.push(State(s.x + i, s.c + 1));
			}
		}
	}
	
	cout << ans << endl;
}

int main() {
	cin >> N;
	for_(i,0,N) cin >> P[i];
	solve();
	return 0;
}

Measured memory_bytes: 1996
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);++(i))
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);--(i))
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    string s, t;
    cin >> n >> s >> t;

    int index = -1;
    REP(i,0,n){
        bool match = true;
        REP(j,0,n-i){
            if (s[i + j] != t[j]){
                match = false;
                break;
            }
        }
        if (match){
            index = i;
            break;
        }
    }

    if (index == -1) cout << 2 * n << endl;
    else cout << n + index << endl;
    
    return 0;
}

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


def main():
    n = int(input())
    a = sorted(list(map(int, input().split())))
    mod_a = a
    mod = min(a)
    index = 0

    while True:
        for idx, ai in enumerate(a):
            if idx != index:
                mod_a[idx] %= mod

                if 0 < mod_a[idx] < mod:
                    mod = mod_a[idx]
                    index = idx

        if mod_a.count(0) >= n - 1:
            break

    print(max(min(a), max(mod_a)))


if __name__ == '__main__':
    main()


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

std::string S, T;
int L1, L2;
int dp[3100][3100];
P pr[3100][3100];

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

    std::cin >> S >> T;

    L1 = S.size();
    L2 = T.size();

    std::fill(&pr[0][0], &pr[0][0] + 3100 * 3100, std::make_tuple(-1, -1));

    for(int i=0;i<=L1;++i){
        for(int j=0;j<=L2;++j){
            if(i + 1 <= L1){
                if(dp[i+1][j] < dp[i][j]){
                    dp[i+1][j] = dp[i][j];
                    pr[i+1][j] = pr[i][j];
                }
            }

            if(j + 1 <= L2){
                if(dp[i][j+1] < dp[i][j]){
                    dp[i][j+1] = dp[i][j];
                    pr[i][j+1] = pr[i][j];
                }
            }

            if(i + 1 <= L1 && j + 1 <= L2 && S[i] == T[j]){
                if(dp[i+1][j+1] < dp[i][j] + 1){
                    dp[i+1][j+1] = dp[i][j] + 1;
                    pr[i+1][j+1] = std::make_tuple(i, j);
                }
            }
        }
    }

    int i, j;
    std::tie(i, j) = pr[L1][L2];

    std::stack<int> st;

    while(i >= 0){
        st.emplace(i);
        std::tie(i, j) = pr[i][j];
    }

    while(!st.empty()){
        std::cout << S[st.top()];
        st.pop();
    }

    std::cout << std::endl;
}


Measured memory_bytes: 111744
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <vector>
#include <cmath>
#include <map>
#include <stack>
#include <algorithm>
typedef long long int ll;
using namespace std;
const int INF = 1e-8;

int main(){
    //freopen("/Users/mac/Desktop/C++?¨????/test/test.txt", "r", stdin);
    int n;
    int _p=-2000000000;
    int _min;
    int now;
    scanf("%d",&n);
    scanf("%d",&now);
    _min=now;
    for (int i=1; i<n; i++) {
        scanf("%d",&now);
        _p=max(_p,now-_min);
        if (now<_min) {
            _min=now;
        }
    }
    printf("%d\n",_p);
    return 0;
}

Measured memory_bytes: 3204
// I love Charlize Theron
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = (ll)1e9 + 7;
#define all(z) begin(z), end(z)
template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {
  }
};

int main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  Vec<2, ll> dp(10, 10, 0);
  int h, w;
  cin >> h >> w;
  for(auto& i: dp) for(auto& j: i) cin >> j;
  for(int k = 0; k < 10; ++k) {
    for(int i = 0; i < 10; ++i) {
      for(int j = 0; j < 10; ++j) {
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }
  ll ans = 0;
  for(int i = 0; i < h * w; ++i) {
    int x;
    cin >> x;
    if(x == -1) continue;
    ans += dp[x][1];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <cassert>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

int n, k, q, a[100001];

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("memory.in", "r", stdin);
	//freopen("memory.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k >> q;
	for (int i = 0; i < q; i++)
	{
		int x;
		cin >> x;
		a[x]++;
	}
	for (int i = 1; i <= n; i++)
		if (k - (q - a[i]) <= 0)
			cout << "No\n";
		else
			cout << "Yes\n";
	return 0;
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool ok = true;
    rep (i, s.size()) {
        if (i % 2 == 0 && s[i] == 'L') ok = false;
        if (i % 2 == 1 && s[i] == 'R') ok = false;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s[0]==s[1]){
    cout<<"Bad"<<endl;
  }else if(s[1]==s[2]){
    cout<<"Bad"<<endl;
  }else if(s[2]==s[3]){
    cout<<"Bad"<<endl;
  }else{
    cout<<"Good"<<endl;
  }
}

Measured memory_bytes: 256
//Triple Dots
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    int K;
    string S;
    cin >> K >> S;

    int m = K < S.length() ? K : S.length();
    S.substr(m);

    if (K < S.length()) {
        cout << S.substr(0, K) << "..." << endl;
    }
    else {
        cout << S << endl;
    }

    return 0;
}

Measured memory_bytes: 3016
#include<bits/stdc++.h>
#define ll long long
const int maxn=1e5+10;
using namespace std;

ll quickqow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1) ans*=a;
		a*=a;b>>=1;
	}
	return ans;
}
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
int main()
{ 
	int n,m;
	cin>>n>>m;
	if(m>=n) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] a = new int[h][w];
		sc.nextLine();
		for(int i=0; i<h; i++){
			String s = sc.nextLine();
			for(int j=0; j<w; j++){
				a[i][j] = s.charAt(j) - 97;
			}
		}
		sc.close();
		int x1=0, x2=0, x4=0;
		
		int[] num = new int[26];
		Arrays.fill(num, 0);
		
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				num[a[i][j]]++;
			}
		}
		
		for(int i=0; i<26; i++){
			if(num[i] % 4 == 0){
				x4++;
			}else if(num[i] % 2 == 0){
				x2++;
			}else{
				x1++;
			}
		}
		
		if(h%2 == 0 && w%2 == 0){
			if(x1>0 || x2 > 0){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
		}else if(h%2 != 0 && w%2 != 0){
			if(x1 != 1 || x2 > (w-1+h-1)/2 || (x2 - (w-1+h-1)/2)%2 != 0){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
		}else if(h%2 != 0 && w%2 == 0){
			if(x1>0 || x2 > w/2 || (x2-w/2)%2 != 0 ){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
		}else{
			if(x1>0 || x2 > h/2 || (x2-h/2)%2 != 0 ){
				System.out.println("No");
			}else{
				System.out.println("Yes");
			}
		}
		
		
	}
}


Measured memory_bytes: 22608
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
/*
struct Edge
{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
*/
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

const int mod = 1000000007;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    mint p(int n, int k)
    {
        return fact[n] * ifact[n - k];
    }
} c(1000005);

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> C(N);
    for (auto &it : C)
    {
        cin >> it;
        it--;
    }

    vector<int> left(200001, -1);
    vector<mint> dp(200001, 0);
    dp[0] = 1;
    for (int i = 0; i < N; i++)
    {
        dp[i + 1] += dp[i];
        int c = C[i];
        if (left[c] >= 0 && left[c] < i - 1)
            dp[i + 1] += dp[left[c] + 1];
        left[c] = i;
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 21912