akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); ++i)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100005
#define MS(m,v) memset(m,v,sizeof(m))
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long  ll;
typedef pair<int, int> P;

bool solve(int x)
{
	int i = 3;
	if (x%2==0)return false;
	while (i*i<=x)
	{
		if (x%i==0)
		{
			return false;
		}
		i += 2;
	}
	return true;
}

int main()
{
	int n;
	int ans=0;
	int x;
	cin >> n;
	REP(i, n)
	{
		cin >> x;
		if (x == 2)ans++;
		else if (solve(x))ans++;
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int a, b;
int main() {
	cin >> a >> b;
	for (int i = b * 10; i < b * 10 + 10; i++) {
		if ((int)(i * 0.08) == a) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */

int main() {
	int a, b, r = 0;
	scanf("%d%d", &a, &b);
	REP(i, 2) {
		r += max(a, b);
		if (a > b)a--;
		else b--;
	}
	printf("%d", r);
	return 0;
}


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

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s.at(i) == t.at(i))
        {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; double w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

void dijkstra(int n, vector< vector<edge> >& G, int s, vector<double>& d) {
	fill(d.begin(), d.end(), DBL_MAX); d[s] = 0;
	priority_queue<d_i, vector<d_i>, greater<d_i> > q;
	q.push(d_i(0, s));
	while (!q.empty()) {
		d_i p = q.top(); q.pop();
		int u = p.second;
		if (p.first > d[u]) continue;
		for (int i = 0; i < G[u].size(); i++) {
			edge e = G[u][i];
			if (d[e.v] > d[u] + e.w) {
				d[e.v] = d[u] + e.w;
				q.push(d_i(d[e.v], e.v));
			}
		}
	}
}

int main() {
	for (;;) {
		int n, m, p, a, b;
		cin >> n >> m >> p >> a >> b;
		a--; b--;
		if (n == 0) break;
		vector<int> t(n);
		for (int i = 0; i < n; i++)
			cin >> t[i];
		vector< vector<edge> > G(m * (1 << n));
		while (p--) {
			int x, y, z;
			cin >> x >> y >> z;
			x--; y--;
			for (int S = 0; S < (1 << n); S++) {
				int u = x * (1 << n) + S;
				for (int i = 0; i < n; i++) {
					if (S & (1 << i)) continue;
					int v = y * (1 << n) + S + (1 << i);
					edge e = {u, v, (double)z / t[i]};
					G[u].push_back(e);
				}
			}
			for (int S = 0; S < (1 << n); S++) {
				int u = y * (1 << n) + S;
				for (int i = 0; i < n; i++) {
					if (S & (1 << i)) continue;
					int v = x * (1 << n) + S + (1 << i);
					edge e = {u, v, (double)z / t[i]};
					G[u].push_back(e);
				}
			}
		}
		vector<double> d(m * (1 << n));
		dijkstra(m * (1 << n), G, a * (1 << n), d);
		double mini = DBL_MAX;
		for (int S = 0; S < (1 << n); S++)
			mini = min(mini, d[b * (1 << n) + S]);
		if (mini < DBL_MAX) printf("%.10f\n", mini);
		else cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 23304
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define szxb 100010
using namespace std;
int n,a[szxb];
signed main(){scanf("%d",&n);long long maxn(2),minn(2);for(register int i(0);i^n;i++){scanf("%d",&a[i]);}for(register int i(n-1);i>=0&&maxn>=minn;i--){if(minn%a[i]){minn=minn/a[i]*a[i]+a[i];}maxn=(maxn/a[i]+1)*a[i]-1;}return (maxn>=minn)?(printf("%lld %lld\n",minn,maxn)):(puts("-1")),0;}

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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;
typedef vector<unordered_map<lli,lli>> graph;

lli n;
graph g;
lli s,t;
vll visit;
lli ans = 0;


lli bfs(){
  queue<vll> q;
  q.push(vll({s,-1,LONG_MAX}));
  visit = vll(n+2,-1);
  while(!q.empty()){
    vll x = q.front();
    q.pop();
    if(visit[x[0]] >= 0) continue;
    visit[x[0]] = x[1];
    if(x[0] == t) return x[2];
    for(auto itr = g[x[0]].begin();itr != g[x[0]].end();itr++)
      if(visit[itr->first] < 0 && itr->second > 0)
        q.push(vll({itr->first,x[0],min(itr->second,x[2])}));
  }
  return -1;
}

int main(){
  cin >> n;
  g = graph(n+2);
  s = 0,t = n+1;
  for(lli i = 1;i <= n;i++){
    lli a;
    cin >> a;
    if(a <= 0) g[s][i] = -a,g[i][s] = 0;
    else ans += a,g[i][t] = a,g[t][i] = 0;
  }
  for(lli i = 1;i <= n;i++){
    for(lli j = i;j <= n;j+=i){
      g[i][j] = LONG_MAX;
      g[j][i] = 0;
    }
  }
  while(true){
    lli f = bfs();
    if(f < 0) break;
    ans -= f;
    lli x = t;
    while(x != s){
      lli y = visit[x];
      g[y][x] -= f;
      g[x][y] += f;
      x = y;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
using namespace std;

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll A[n]; ll B[m]; ll preA[n+1]; ll preB[m+1];
    preA[0] = 0; preB[0] = 0;
    for (ll i = 0; i < n; ++i) {
        cin >> A[i];
        preA[i+1] = preA[i] + A[i];
    }
    for (ll i = 0; i < m; ++i) {
        cin >> B[i];
        preB[i+1] = preB[i] + B[i];
    }
    ll max = 0;
    ll index = m;
    for (ll i = 0; i <= n; ++i) {
        ll totalLeft = k - preA[i];
        if (totalLeft < 0){
            break;
        }
        while (preB[index] > totalLeft){
            index--;
        }
        if (index + i > max) {
            max = index+i;
        }
    }
    cout << max;
}

Measured memory_bytes: 9864
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1


n=input1()
X=input_array()

min_p=min(X)
max_p=max(X)
b_p=10000
p=[]
for i in range(min_p,max_p):
	s=0
	for j in X:
		s+=(j-i)**2
	p.append(s)
	# if s>b_p:
	# 	break
	# else:
	# 	b_p=s

if p==[]:
	print(0)
else:
	print(min(p))





Measured memory_bytes: 13560
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){

    string s;
    cin >> s;

    int ans = 0;
    int pre = s[0];
    REP(i,s.size()-1){
        if(pre != s[i+1]) ans++;
        pre = s[i+1];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
h,w,k = [int(i) for i in input().split()]

mod = 10**9 + 7
   

dp = [[0 for _ in range(w)] for _ in range(h + 1)]
dp[0][0] = 1

for i in range(h):
    for bit in range(1<<(w-1)):
        if '11' in bin(bit) : continue
        for j in range(w):
            if j > 0 and bit & (1 << (j-1)):
                dp[i+1][j-1] += dp[i][j] % mod 
            elif bit & (1 << j):
                dp[i+1][j+1] += dp[i][j] % mod
            else:
                dp[i+1][j] += dp[i][j] % mod
                
print(dp[h][k-1]%mod)

Measured memory_bytes: 3064
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
constexpr int MOD = 1e9 + 7;
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define printx(x) printf("%lld\n",x);
#define printxy(x,y) cout << x << y <<endl;
#define printxyz(x,y,z) cout << x << y << z <<endl;
#define deba(a) cout << #a << a << endl;
#define debab(a,b) cout << #a << a << #b << b << endl;
vi fac(10000000, 1);
ll power(ll a, ll n)
{
	ll res = 1;
	while (n > 0)
	{
		if (n % 2 == 0)
			a = ((a % MOD) * (a % MOD)) % MOD, n /= 2;
		else
			res = ((res % MOD) * (a % MOD)) % MOD , n--;
	}
	return res % MOD;
}
ll C(ll n , ll k)
{
	if (k > n) return 0;
	ll res = fac[n];
	res = (res * power(fac[k], MOD - 2)) % MOD; //inverse of K = power(F[k],MOD-2)
	res = (res * power(fac[n - k], MOD - 2)) % MOD; //inverse of N-K = power(F[N-K],MOD-2)
	return res % MOD;
}
int main()
{
	fast;
	ll n, m, a, b;
	cin >> n >> m >> a >> b;


	rep(i, 1, n + m + 1)
	fac[i] = ((i * fac[i - 1]) % MOD) % MOD;

	ll ans = 0;
	for (int i = b; i < m; i++)
	{
		ll x = n - a - 1;
		ll y = i;
		ll x2 = a - 1;
		ll y2 = m - i - 1;
		ll p = (C(x + y, x) % MOD * C(x2 + y2, x2) % MOD) % MOD;
		ans = (ans + p) % MOD;
	}
	cout << ans % MOD << endl;
	return 0;
}

Measured memory_bytes: 81220
import sys

N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))

visited = [False] * (N+1)
s = 1

while not visited[s]:
    visited[s] = True
    s = A[s]

a = 1

while a != s:
    K -= 1
    a = A[a]
    if K == 0: 
        print(a)
        sys.exit()

visited = [False] * (N+1)
length = 0
while not visited[s]:
    visited[s] = True
    s = A[s]
    length += 1
    
k = K % length
while k:
    s = A[s]
    k -= 1
    
print(s)

Measured memory_bytes: 32372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <list>
#define pie 3.141592653589793
#define si(a) scanf("%d",&a)
#define ss(a) scanf("%s",a)
#define sl(a) scanf("%lld",&a)
#define pi(a) printf("%d",a)
#define pl(a) printf("%lld",a)
#define ps(a) printf("%s",a)
#define ll long long
using namespace std;

bool check(string str,char a,char b,char c)
{
  int k1 = str[0]-'0';
  int k2 = str[1]-'0';
  int k3 = str[2]-'0';
  int k4 = str[3]-'0';
  if(a=='+')
    k1=k1+k2;
  else
    k1=k1-k2;
  if(b=='+')
    k1=k1+k3;
  else
    k1=k1-k3;
  if(c=='+')
    k1=k1+k4;
  else
    k1=k1-k4;
  // cout << k1 << endl;
  if(k1==7)
    return true;
  else
    return false;
}

int main()
{
  string str;
  cin >> str;
  char c1='+';
  char c2='-';
  bool f1 = check(str,c1,c1,c1);
  if(f1){
    cout << str[0] << c1 << str[1] << c1 << str[2] << c1 << str[3] << "=7" << endl;
    return 0;
  }
  bool f2 = check(str,c1,c1,c2);
  if(f2){
    cout << str[0] << c1 << str[1] << c1 << str[2] << c2 << str[3] << "=7" << endl;
    return 0;
  }
  bool f3 = check(str,c1,c2,c1);
  if(f3){
    cout << str[0] << c1 << str[1] << c2 << str[2] << c1 << str[3] << "=7" << endl;
    return 0;
  }
  bool f4 = check(str,c2,c1,c1);
  if(f4){
    cout << str[0] << c2 << str[1] << c1 << str[2] << c1 << str[3] << "=7" << endl;
    return 0;
  }
  bool f5 = check(str,c1,c2,c2);
  if(f5){
    cout << str[0] << c1 << str[1] << c2 << str[2] << c2 << str[3] << "=7" << endl;
    return 0;
  }
  bool f6 = check(str,c2,c2,c1);
  if(f6){
    cout << str[0] << c2 << str[1] << c2 << str[2] << c1 << str[3] << "=7" << endl;
    return 0;
  }
  bool f7 = check(str,c2,c1,c2);
  if(f7){
    cout << str[0] << c2 << str[1] << c1 << str[2] << c2 << str[3] << "=7" << endl;
    return 0;
  }
  bool f8 = check(str,c2,c2,c2);
  if(f8){
    cout << str[0] << c2 << str[1] << c2 << str[2] << c2 << str[3] << "=7" << endl;
    return 0;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b && b==c) cout << 1 << endl;
	else if(a==b || b==c || c==a) cout << 2 << endl;
	else cout << 3 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int n, a, s=0, b;

	scanf("%lld", &n);
	b = n;
	while(n>0)
	{
		a = n % 10;
		n/=10;
		s+=a;
	}

	if(b%s == 0)
		printf("Yes\n");
	else
		printf("No\n");
}


Measured memory_bytes: 128
a = sorted(list(map(int, input().split())))
ans = (a[2]-a[0])//2
a[0] += (a[2]-a[0])//2 * 2
ans += (a[2]-a[1])//2
a[1] += (a[2]-a[1])//2 * 2
a.sort()
if a[0]==a[1]==a[2]:
    print(ans)
elif a[0]==a[1]:
    print(ans+1)
else:
    print(ans+2)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<char,int>;

int main(){
   int n,m,x;
   cin >> n >> m >> x;
   auto a = vector<int>(m,0);

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

   auto s = upper_bound(a.begin(),a.end(),x)-a.begin();
   if(s <= m/2){
   		cout << s;
   }else{
   		cout << m -s;
   }
}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int N;
    long long x, result = 0;
    cin >> N >> x;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < N - 1; ++i) {
        long long sum = a[i] + a[i + 1];
        if (sum > x) {
            result += sum - x;
            a[i + 1] -= sum - x;
            if (a[i + 1] < 0) {
                a[i + 1] = 0;
            }
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int a[10005];
int b[105][105];
int main()
{
	int h,w,n;
	scanf("%d%d%d",&h,&w,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int x=1;
	int y=1;
	for(int i=1;i<=n;i++)
	{
		while(a[i])
		{
			a[i]--;
			b[y][x]=i;
			if(y%2==0)
			{
				x--;
			}
			else
			{
				x++;
			}
			if(x>w)
			{
				x--;
				y++;
			}
			if(x<1)
			{
				x++;
				y++;
			}
		}
	}
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<w;j++)
		{
			printf("%d ",b[i][j]);
		}
		printf("%d\n",b[i][w]);
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<iterator>
#include<vector>
using namespace std;
typedef vector<int> vii;
#define ll long long
#define tt ll t;cin>>t;while(t--)
#define nl endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define cinv(v) for(auto &it:v)cin >> it;
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll i,j,sum=0;
int main()
{
          so;

          ll a[4],x,ans=-1e18;
          for(int i=0;i<4;i++)cin>>a[i];
          for(i=0;i<2;i++){
                    for(int j=2;j<4;j++){
                              x=a[i]*a[j];
                              if(x>ans)ans=x;
                    }
          }
          cout<<ans;



          return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

const int MAX_STATE = 1e6 + 5;
int E[MAX_STATE][26];
bool accept[MAX_STATE];

int main()
{
    int N;
    std::cin >> N;

    std::vector<std::string> S(N);
    for (auto &s : S) {
        std::cin >> s;
    }

    std::vector<std::vector<int>> paths(N);
    int state = 1;
    for (int i = 0; i < N; i++) {
        auto& s = S[i];
        std::reverse(s.begin(), s.end());

        int node = 0;
        for (const auto c : s) {
            paths[i].push_back(node);
            if (E[node][c - 'a'] == 0) {
                E[node][c - 'a'] = state;
                state++;
            }
            node = E[node][c - 'a'];
        }
        accept[node] = true;
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        const auto& s = S[i];

        std::set<char> suffix;
        for (int j = s.length() - 1; j >= 0; j--) {
            suffix.insert(s[j]);

            const int node = paths[i][j];
            for (const auto c: suffix) {
                ans += accept[E[node][c - 'a']];
            }
        }
    }

    std::cout << ans - N << '\n';
}

Measured memory_bytes: 112912
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int par[N], siz[N];

void make_set(int x) {
  par[x] = x;
  siz[x] = 1;
}

int find_set(int x) {
  if (x == par[x]) {
    return x;
  }
  return par[x] = find_set(par[x]);
}

void union_sets(int x, int y) {
  x = find_set(x);
  y = find_set(y);
  if (x == y) {
    return;
  }
  if (siz[x] > siz[y]) {
    swap(x, y);
  }
  siz[y] += siz[x];
  par[x] = y;
}

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);    
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    make_set(i);
  }
  while (m--) {
    int x, y;
    cin >> x >> y;
    union_sets(x, y);
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans = max(ans, siz[i]);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 6248
#include <stdio.h>

#define MAX 2000001
#define NMAX 10000

int n;
int A[MAX], B[MAX], C[NMAX+1];

void countingSort() {
  int i, j;

  for (i = 0; i <= NMAX; i++) {
    C[i] = 0;
  }

  for (j = 1; j <= n; j++) {
    C[A[j]]++;
  }

  for (i = 1; i <= NMAX; i++) {
    C[i] = C[i] + C[i-1];
  }

  for (j = 1; j <= n; j++) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

}

int main() {
  int i;

  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
  }

  countingSort();

  for (i = 1; i <= n; i++) {
    if (i == n) {
      printf("%d\n", B[i]);
      break;
    }
    printf("%d ", B[i]);
  }

  return 0;
}

Measured memory_bytes: 16264
a = raw_input().split()

def change(a):
 for i in range(0,3):
  for j in range(0,3):
   if a[i] < a[j]:
    temp = a[i]
    a[i] = a[j]
    a[j] = temp
 print str(a[0])+" "+str(a[1])+" "+str(a[2])

change(a)

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

int main()
{
    int x;
    cin >> x;

    if (x >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000001

pair<long long,int> Slice(string s){
	string a = "",b = "";
	while(s.size()!=0&&s[0]!='.'){
		a += s[0];
		s.erase(s.begin());
	}
	if(s.size()!=0)s.erase(s.begin());
	b = s;
	
	return make_pair(stoll(a+b),b.size());
}

int main(){
	
	int N;
	cin>>N;
	vector<long long> x(N);
	vector<int> cnt(N);
	for(int i=0;i<N;i++){
		string s;
		cin>>s;
		pair<long long,int> p = Slice(s);
		x[i]=p.first;
		cnt[i]=p.second;
	}

	int off2 = 40,off5 = 20;
	
	vector<long long> mul5(21,1LL);
	for(int i=1;i<=20;i++)mul5[i] = mul5[i-1]*5;
	
	vector<vector<long long>> C(81,vector<long long>(41,0LL));
	
	for(int i=0;i<N;i++){
		long long t = 1;
		for(int j=0;j<cnt[i];j++)t *= 10;
		
		int c2 = -100,c5 = -100;
		for(int j=0;j<=40;j++){
			for(int k=0;k<=20;k++){
				//long long y = x[i] * (1LL<<j) * mul5[k];
				long long y = x[i]%t;
				y *= (1LL<<j)%t;
				y%=t;
				y *= mul5[k]%t;
				y%=t;
				if(y%t==0){
					c2=-j;
					c5=-k;
					goto L;
				}
			}
		}
		L:
		//cout<<i<<endl;
		if(c2<-99)continue;
		if(x[i]%2==0)c2 = -cnt[i];
		if(x[i]%5==0)c5 = -cnt[i];
		while(x[i]%2==0){
			c2++;
			x[i]/=2;
		}

		while(x[i]%5==0){
			c5++;
			x[i]/=5;
		}
		
		if(c2<-40)continue;
		if(c5<-20)continue;
		c2 = min(c2,40);
		c5 = min(c5,20);
		//cout<<i<<','<<c2<<','<<c5<<endl;
		C[c2+off2][c5+off5]++;
	}

	long long ans = 0LL;
	long long D = 0LL;
	for(int i=0;i<C.size();i++){
		for(int j=0;j<C[i].size();j++){
			
			for(int k=0;k<C.size();k++){
				for(int l=0;l<C[k].size();l++){
					
					int a = i-off2,b = j-off5,c = k-off2,d = l-off5;
					if(a+c<0||b+d<0)continue;
					if(i==k&&j==l){
						ans += C[i][j] * (C[i][j]-1) /2;
						continue;
					}
				/*
					if(C[i][j]*C[k][l]!=0){
						cout<<i<<','<<j<<','<<k<<','<<l<<endl;
					}
					*/
					D+= C[i][j]*C[k][l];
				}
			}
		}
	}
	
	cout<<ans + D/2<<endl;
	
	return 0;
}


Measured memory_bytes: 5572
P,L="+<"
p=print
r=range
p(6484,P,0,1,3,L,2,3,3)
for x in 0,1:p(P,x,3,x);[p(P,v:=x+4,v,v,P,v,3,6,*[P,6,6,6]*(38-t),L,6,x,T:=x*60+t,P,v,T,v)for t in r(9,39)]
for t in r(60):p(P,2,2,2);[p(P,8+t-s,69+s,5,L,3,5,6,P,2,6,2)for s in r(t)]

Measured memory_bytes: 9248
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  string a, b, c; readV(a, b, c);
  writeln(a[$-1] == b[0] && b[$-1] == c[0] ? "YES" : "NO");
}


Measured memory_bytes: 256
N = int(input())

if N == 1:
    print('Yes')
    print(2)
    print(1, 1)
    print(1, 1)
else:
    r = int((N*2)**0.5)
    if N*2 == r*(r+1):
        print('Yes')
        print(r+1)
        ans = []

        if r % 2 == 0:
            for i in range(r//2):
                ans.append([j+1+i*(r+1) for j in range(r+1)])
            for i in range(r//2):
                c = [j+1+i*(r+1) for j in range(r+1)]
                ans.append(c[i+1:]+c[:i+1])

        else:
            for i in range(r//2):
                ans.append([j+1+i*(r+1) for j in range(r+1)])

            m = N % (r+1)

            for i in range(r//2):
                c = [j+1+m+i*(r+1) for j in range(r+1)]
                ans.append(c[i+1:]+c[:i+1])

            l = [i+1 for i in range(N)]
            ans.append(l[-m:]+l[:m])

            # print(ans)

        for i in zip(*ans):
            print(r, *i)

    else:
        print('No')


Measured memory_bytes: 14820
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

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

	int i = 0, j = n - 1, ans = 0;
	while (i < j) {
		while (i < n && c[i] != 'W') {
			i++;
		}
		while (j > 0 && c[j] != 'R') {
			j--;
		}

		if (i < j) {
			c[i] = 'R';
			c[j] = 'W';
			ans++;
		}
	}

	col(ans);
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
using namespace std;
 
int main()
{
	int N;
	cin >> N;
	double x[10];
	string u[10];
 
	double sum = 0;
	for(int i = 0; i < N; i++)
	{
	cin >> x[i] >> u[i];
 
	if(u[i] == "JPY")
	{
		sum += x[i];
    }
	else
	{
    	sum += x[i] * 380000;
    }
  }
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int A,B;
    cin>>A>>B;

    if(A+B==15){
        cout<<'+'<<endl;
    }
    else if(A*B==15){
        cout<<'*'<<endl;
    }
    else{
        cout<<'x'<<endl;
    }
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
typedef long long ll;

int count_digits(ll n) {
  int res = 0;
  while (n) {
    n /= 10;
    res++;
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  
  int ans = 10000;
  
  for (ll A=1; A*A<=N; A++) {
    if (N%A == 0) {
      ll B = N/A;
      int count = max(count_digits(A), count_digits(B));
      ans = min(ans, count);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
    char S[(int)(2e5 + 1)];
    long long b = 0, ans = 0;
    char *s = S;

    gets(S);

    do {
        if (*s == 'B') b++;
        else ans += b;
    } while (*(++s));

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

    return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int value = n*(n-1)/2 + m*(m-1)/2;
    cout << value <<endl;
    return 0;
}

Measured memory_bytes: 256
//
// Created by PIIMUU on 8/22/2020.
//
#include <bits/stdc++.h>
using namespace  std;

int main() {
    string s;
    cin >> s;
    int sum = 0;
    for (int i = 0; i < s.size(); i++) {
        sum += s[i] - '0';
    }
    if (sum % 9 == 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}



Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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(){
 string s;
 cin >> s;

 if(s.at(0)==s.at(1)&&s.at(1)==s.at(2)&&s.at(2)==s.at(0))
{cout << "No"<<endl;}
else
{
    cout << "Yes" <<endl;
}


    return 0;
}

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

char t_map[30];
char s_map[30];

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

	for(int i=0; i<30; i++){
		t_map[i] = s_map[i] = 0;
	}


	bool f = true;
	for(int i=0; i<s.size(); i++){
		if(t_map[t[i]] == 0){
			t_map[t[i]] = s[i];
		}else{
			if(t_map[t[i]] != s[i]){
				f = false;
				break;
			}
		}
		if(s_map[s[i]] == 0){
			s_map[s[i]] = t[i];
		}else{
			if(s_map[s[i]] != t[i]){
				f = false;
				break;
			}
		}
	}

	if(f) puts("Yes");
	else puts("No");
	
	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define int long long
#define double long double
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

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

    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            cnt++;
        }
    }
    cout << cnt << '\n';

    fflush(stdout);
    return 0;
}


Measured memory_bytes: 3888
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
typedef long long ll;
using namespace std;

int main() {
	char X,Y; cin >> X >> Y;
	if (X < Y) cout << "<" << endl;
		else if (X > Y) cout << ">" << endl;
			else cout << "=" << endl;
}


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

int main() {
	int n;
	while (cin >> n) {
		int  i, j, p;
		p = 0;
		bool isprime[1000000];
		for (i = 0; i <= n; i++) {
			isprime[i] = true;
		}
		isprime[0] = false;
		isprime[1] = false;
		for (j = 2; j <= n; j++) {
			if (isprime[j]) {
				for (i = 2; i*j <= n; i++) {
					isprime[i*j] = false;
				}
				p++;
			}
		}
		cout << p << endl;
	}
	return 0;
}

Measured memory_bytes: 4052
b=[chr(i) for i in range(97,97+26)]
c=[chr(i) for i in range(65,65+26)]
d=[0 for i in range(26)]
flg=True
while flg==True:
    try:
        a=raw_input()
        for i in a:
            for j in range(len(b)):
                if i==b[j]:
                    d[j]+=1
            for k in range(len(c)):
                if i==c[k]:
                    d[k]+=1
    except:
            flg=False
for i in range(26):
    print (b[i]+" : "+str(d[i]))


Measured memory_bytes: 4668
#include <iostream>
#include <string>

using namespace std;

int main() {
	char cube[6][8] = {{'.', '.', 'r', 'r', '.', '.', '.', '.'},
					   {'.', '.', 'r', 'r', '.', '.', '.', '.'},
					   {'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w'},
					   {'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w'},
					   {'.', '.', 'o', 'o', '.', '.', '.', '.'},
					   {'.', '.', 'o', 'o', '.', '.', '.', '.'}};
	string a;
	cin >> a;
	char kari, kari2;
	for (int i = 0; i < a.size(); i++) {
		if (a[i] == 'U') {
			kari = cube[2][0];
			kari2 = cube[2][1];
			for (int j = 0; j < 6; j++) {
				cube[2][j] = cube[2][j+2];
			}
			cube[2][6] = kari;
			cube[2][7] = kari2;
			kari = cube[0][3];
			cube[0][3] = cube[0][2];
			cube[0][2] = cube[1][2];
			cube[1][2] = cube[1][3];
			cube[1][3] = kari;
		} else if (a[i] == 'D') {
			kari = cube[3][6];
			kari2 = cube[3][7];
			for (int j = 7; j > 1; j--) {
				cube[3][j] = cube[3][j-2];
			}
			cube[3][1] = kari2;
			cube[3][0] = kari;
			kari = cube[4][2];
			cube[4][2] = cube[5][2];
			cube[5][2] = cube[5][3];
			cube[5][3] = cube[4][3];
			cube[4][3] = kari;
		} else if(a[i] == 'L') {
			kari = cube[4][2];
			kari2 = cube[5][2];
			for (int j = 5; j > 1; j--) {
				cube[j][2] = cube[j-2][2];
			}
			cube[1][2] = cube[2][7];
			cube[0][2] = cube[3][7];
			cube[2][7] = kari2;
			cube[3][7] = kari;
			kari = cube[2][0];
			cube[2][0] = cube[3][0];
			cube[3][0] = cube[3][1];
			cube[3][1] = cube[2][1];
			cube[2][1] = kari;
		} else if (a[i] == 'R') {
			kari = cube[0][3];
			kari2 = cube[1][3];
			for (int j = 0; j < 4; j++) {
				cube[j][3] = cube[j+2][3];
			}
			cube[4][3] = cube[3][6];
			cube[5][3] = cube[2][6];
			cube[2][6] = kari2;
			cube[3][6] = kari;
			kari = cube[2][4];
			cube[2][4] = cube[3][4];
			cube[3][4] = cube[3][5];
			cube[3][5] = cube[2][5];
			cube[2][5] = kari;
		} else if (a[i] == 'F') {
			kari = cube[2][2];
			cube[2][2] = cube[3][2];
			cube[3][2] = cube[3][3];
			cube[3][3] = cube[2][3];
			cube[2][3] = kari;
			kari = cube[2][1];
			kari2 = cube[3][1];
			cube[2][1] = cube[4][2];
			cube[3][1] = cube[4][3];
			cube[4][2] = cube[3][4];
			cube[4][3] = cube[2][4];
			cube[2][4] = cube[1][2];
			cube[3][4] = cube[1][3];
			cube[1][2] = kari2;
			cube[1][3] = kari;
		} else if(a[i] == 'B'){
			kari = cube[2][6];
			cube[2][6] = cube[3][6];
			cube[3][6] = cube[3][7];
			cube[3][7] = cube[2][7];
			cube[2][7] = kari;
			kari = cube[2][5];
			kari2 = cube[3][5];
			cube[2][5] = cube[5][3];
			cube[3][5] = cube[5][2];
			cube[5][2] = cube[2][0];
			cube[5][3] = cube[3][0];
			cube[2][0] = cube[0][3];
			cube[3][0] = cube[0][2];
			cube[0][2] = kari;
			cube[0][3] = kari2;
		}
	}
	for (int i = 0; i < 6; i++) {
		for (int j = 0; j < 8; j++) {
			cout << cube[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,q,x;
    cin>>a>>b>>q;
    ll s[a+2],t[b+2];
    s[a+1]=1e18;
    t[b+1]=1e18;
    s[0]=-1e18;
    t[0]=-1e18;
    for(int i=1;i<=a;i++){
        cin>>s[i];
    }
    for(int i=1;i<=b;i++){
        cin>>t[i];
    }
    for(int i=0;i<q;i++){
        ll ans=1e18;
        cin>>x;
        int c=lower_bound(s,s+a+2,x)-s;
        int d=lower_bound(t,t+b+2,x)-t;
        for(int j=c-1;j<=c;j++){
            for(int k=d-1;k<=d;k++){
                ans=min(ans,abs(x-s[j])+abs(s[j]-t[k]));
                ans=min(ans,abs(x-t[k])+abs(t[k]-s[j]));
            }
        }
        cout <<ans<<endl;
    }
    return 0;
}




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

int keta(long n) {
  int cnt = 0;
  while (n > 0) {
    n /= 10;
    cnt++;
  }
  return cnt;
}

int f(long a, long b) { return max(keta(a), keta(b)); }

int main() {
  long long n, a, b;
  int fmax, min = INT_MAX;
  cin >> n;
  a = 1;
  while (a <= sqrt(n)) {
    if (n % a == 0) {
      b = n / a;
      fmax = f(a, b);
      if (min > fmax) min = fmax;
    }
    a++;
  }
  cout << min << endl;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int h,w;//rode,line
char s[2000+10][2000+10];
struct Point{int heng,shu;};
Point point[2000+10][2000+10];
vector<int> sum;
bool comp(int a,int b)
{
    return a>b;
}
int main()
{
    cin>>h>>w;
    for(int i=1;i<=h;i++)//rode,line
    {
        for(int j=1;j<=w;j++)
        {
            cin>>s[i][j];
        }
    }
    for(int i=0;i<=h+1;i++)
    {
        s[i][0]='#';
    }
    for(int j=0;j<=w+1;j++)
    {
        s[0][j]='#';
    }
    for(int i=0;i<=h+1;i++)
    {
        s[i][w+1]='#';
    }
    for(int j=0;j<=w+1;j++)
    {
        s[h+1][j]='#';
    }
    for(int i=1;i<=h+1;i++)//rode,line
    {
        int passed=0;
        for(int j=1;j<=w+1;j++)
        {
            if(s[i][j]=='#')
            {
                for(int x=passed+1;x<j;x++)
                {
                    point[i][x].heng=j-passed-1;
                }
                passed=j;
            }
        }
    }
    for(int j=1;j<=w+1;j++)//line,rode
    {
        int passed=0;
        for(int i=1;i<=h+1;i++)
        {
            if(s[i][j]=='#')
            {
                for(int x=passed+1;x<i;x++)
                {
                    point[x][j].shu=i-passed-1;
                }
                passed=i;
            }
        }
    }
    for(int i=1;i<=h;i++)//rode,line
    {
        for(int j=1;j<=w;j++)
        {
            if(point[i][j].heng!=0||point[i][j].shu!=0)
            {
                sum.push_back(point[i][j].heng+point[i][j].shu-1);
            }
        }
    }
    sort(sum.begin(),sum.end(),comp);
    cout<<sum[0];
    return 0;
}

Measured memory_bytes: 54248
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	// your code goes here
	ll a,b;
	cin>>a>>b;
	ll xorb,xora;
	if(b%4==0)
	{
	    xorb=b;
	}
	else if(b%4==1)
	{
	    xorb=1;
	}
	else if(b%4==2)
	{
	    xorb=b+1;
	}
	else if(b%4==3)
	{
	    xorb=0;
	}
	a-=1;
	if(a%4==0)
	{
	    xora=a;
	}
	else if(a%4==1)
	{
	    xora=1;
	}
	else if(a%4==2)
	{
	    xora=a+1;
	}
	else if(a%4==3)
	{
	    xora=0;
	}
    cout<<(xorb^xora)<<endl;
	return 0;
}


Measured memory_bytes: 256
#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() {
  string s;
  cin >> s;
  if(s == "ABC")cout << "ARC" << endl;
  if(s == "ARC")cout << "ABC" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<int> nums;
    int now = 1; // 今見ている数
    int cnt = 0; // いくつ並んでいるか
    rep(i, n) {
        if (s[i] == (char)('0' + now)) cnt ++;
        else {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0) nums.push_back(cnt);
    if (nums.size()%2==0) nums.push_back(0);

    int add = 2 * k + 1;
    int ans = 0;
    int left = 0;
    int right = 0;
    int tmp = 0;
    for (int i=0; i<nums.size(); i+=2) {
        int nl = i;
        int nr = min(i+add, (int)nums.size());
        while (nl > left) {
            tmp -= nums[left];
            left++;
        }
        while (nr > right) {
            tmp += nums[right];
            right++;
        }
        ans = max(tmp, ans);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int D, G;
  cin >> D >> G;
  int p[D], c[D], foo, bar, tmp, ans = INT_MAX;
  for (int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  for (int i = 0; i < pow(2, D); i++) {
    foo = bar = 0;
    for (int j = 0; j < D; j++) {
      if (((i >> j) & 1) > 0) {
        foo += p[j] * 100 * (j + 1) + c[j];
        bar += p[j];
      }
    }
    if (foo < G) {
      for (int j = D - 1; j >= 0 && foo < G; j--) {
        if (((i >> j) & 1) == 0) {
          tmp = min((G - foo - 1) / (100 * (j + 1)) + 1, p[j] - 1);
          foo += tmp * 100 * (j + 1);
          bar += tmp;
        }
      }
    }
    if (bar < ans && foo >= G) {
      ans = bar;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){

  double r,S,C;

  cin >>r;

  C=M_PI*(2*r);
  S=r*r*M_PI;

  printf("%f %f\n",S ,C);

  return 0;
}

Measured memory_bytes: 1232
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in(),m=in();
    priority_queue<int>pq;
    for(ll i=0;i<n;++i)pq.push(in());
    for(ll i=0;i<m;++i){
        ll mx=pq.top();pq.pop();
        pq.push(mx>>1);
    }
    ll ans=0;
    while(!pq.empty()){
        ans+=pq.top();
        pq.pop();
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 892
#0120
a, b, k = (int(_) for _ in input().split())
num = []
if a > b:
    for i in range(1, a + 1):
        if a % i == 0 and b % i == 0:
            num.append(i)
else:
    for i in range(1, b + 1):
        if a % i == 0 and b % i == 0:
            num.append(i)
if a == 1 and b == 1:
    num.append(1)
print(num[-k])

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            int N = intArray[0];
            int K = intArray[1];
            // Boolean[] ans = new Boolean[N];
            HashSet<int> munber = new HashSet<int>();
            for(int i = 0; i < K; i++)
            {
                int d = int.Parse(Console.ReadLine());
                int[] A = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
                for(int j = 0; j < d; j++)
                {
                    //ans[ A[j] - 1] = true;
                    munber.Add(A[j]);
                }
            }
            //int cnt = 0;
            //for (int i = 0; i < N; i++)
            //{
            //    if (!ans[i])
            //    {
            //        cnt++;
            //    }
            //}
            //Console.WriteLine(cnt);
            Console.WriteLine(N - munber.Count());
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28424
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,m,a,b,i,j,jc[200005],ny[200005],ans;
long long ksm(long long u,long long v){
	long long o=1;
	while(v){
		if(v&1)
			o=o*u%mo;
		u=u*u%mo;
		v>>=1;
	}
	return o;
}
long long C(long long u,long long v){
	return jc[u]*ny[v]%mo*ny[u-v]%mo;
}
long long Q(long long u,long long v){
	return C(u+v,v);
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    n=read();m=read();a=read();b=read();
    jc[0]=1;
    for(i=1;i<=n+m;i++)
   		jc[i]=jc[i-1]*i%mo;
   	ny[n+m]=ksm(jc[n+m],mo-2);
   	for(i=n+m-1;i>=0;i--)
   		ny[i]=ny[i+1]*(i+1)%mo;
   	ans=Q(n-1,m-1);
   	for(i=1;i<=b;i++)
   		ans=(ans-Q(n-a-1,i-1)*Q(a-1,m-i)%mo+mo)%mo;
   	pus(ans,2);
    return 0;
}

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

int main(void){
    int K;
    string S;
    cin >> K;
    cin >> S;
    string temp;
    string temp2 = "...";
    if(S.length() <= K){
        cout << S << endl;
    }
    else{
        temp = S.substr(0,K);
        cout << temp + temp2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define MAXN 55560

bool prime[MAXN];
void isprime(){
	memset(prime,true,sizeof(prime));
	for(int i=2;i*i<MAXN;i++){
		if(prime[i]){
			for(int j=i*i;j<MAXN;j+=i) prime[j]=false;
		}
	} 
}

int main(){
	int n;
	cin>>n;
	int j=0;
	isprime();
	for(int i=0;i<n;i++){
		while(1){
			if(j%10==3 && prime[j]){
				cout<<j<<" ";
				break;
			}
			else j++;
		}
		j++;
		
	}
	return 0;
}

Measured memory_bytes: 256