akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  bool isYellow = false;
  REP(i, n) {
    char c;
    scanf("%c", &c);
    if (c == 'Y')
      isYellow = true;
  }
  if (isYellow)
    std::cout << "Four" << std::endl;
  else
    std::cout << "Three" << std::endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 100001;

VI a;
int n;
int k;
VVI g;
VI lvl;
VI ord;

int comp(int x, int y)
{
	return lvl[x] < lvl[y];
}

void dfs(int v)
{
	stack<int> s;
	s.push(v);
	while (!s.empty())
	{
		int t = s.top();
		s.pop();
		for (auto i : g[t])
			lvl[i] = lvl[t] + 1, s.push(i);
	}
}

int DP[MAXN][18];
int p2[18];

int getAncestor(int v, int x)
{
	if (x == 0)
		return v;

	if (x == 1)
		return a[v];

	RFOR(i, 18, 0)
		if (p2[i] <= x)
			return getAncestor(DP[v][i], x - p2[i]);
}

VCH ok;

void zanuly(int v)
{
	stack<int> s;
	s.push(v);
	ok[v] = 1;
	while (!s.empty())
	{
		int t = s.top();
		s.pop();
		for (auto i : g[t])
			if (ok[i] == 0)
				ok[i] = 1, s.push(i);
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	
	p2[0] = 1;
	FOR(i, 1, 18)
		p2[i] = 2 * p2[i - 1];

	cin >> n >> k;
	a.assign(n + 1, 0);
	FOR(i, 0, n)
		cin >> a[i + 1];

	k = min(k, n);
	int ans = 0;
	if (k == 1)
	{
		FOR(i, 1, n + 1)
			if (a[i] != 1)
				++ans;
		cout << ans;
		return 0;
	}

	if (a[1] != 1)
		++ans, a[1] = 1;

	g.assign(n + 1, VI());
	FOR(i, 2, n + 1)
		g[a[i]].push_back(i);

	lvl.assign(n + 1, 0);
	dfs(1);

	FOR(i, 2, n + 1)
		DP[i][0] = a[i];

	FOR(i, 2, n + 1)
		ord.push_back(i);

	sort(ALL(ord), comp);
	FOR(i, 0, SZ(ord))
	{
		FOR(j, 1, 18)
			DP[ord[i]][j] = DP[DP[ord[i]][j - 1]][j - 1];
	}

	reverse(ALL(ord));
	ok.assign(n + 1, 0);
	FOR(j, 0, SZ(ord))
	{
		int i = ord[j];
		if (lvl[i] > k && ok[i] == 0)
		{
			int anc = getAncestor(i, k - 1);
			if (ok[anc] == 0)
			{
				a[anc] = 1;
				++ans;
				zanuly(anc);
			}
		}
	}

	cout << ans;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 14204
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const ll INF=1e18;
//N^P(modM)

using ll = long long int;

ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}

int main() {
  ll k;cin>>k;
  if(k%7==0)k/=7;
  ll now=1;
  k*=9;
  ll ans=-1;
  rep(i,10000000){
    now*=10;
    now%=k;
    if(now==1){
      ans=i+1;break;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
  ll x;
  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;
  }
   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;}
};
typedef vector<mint> vm;
typedef vector<vm> vvm;

class Combi {
private:
  v(ll) fac, inv, finv;
  void init(int N) {
    fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
  }
public:
  Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
  ll Cmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  ll Pmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n - k] % MOD;
  }
};
  
int main() {
  int n;
  cin >> n;
  vi a(n+1);
  rep(i,n+1) {
    cin >> a[i];
    a[i]--;
  }
  int l,r;
  vi pos(n+1,-1);
  rep(i,n+1) {
    if(pos[a[i]]>=0) {
      l=pos[a[i]];
      r=i;
      break;
    }
    pos[a[i]]=i;
  }
  Combi comb(n+1);
  srep(k,1,n+2) {
    mint all = comb.Cmod(n+1,k);
    mint sub = comb.Cmod(l+n-r,k-1);
    cout << (all-sub).x << endl;
  }
  return 0;
}

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

int main() {
  int w, n, a, b;
  char d;
  cin >> w >> n;
  vector<int> v(w + 1);
  for (int i = 0; i <= w; i++) {
    v[i] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> a >> d >> b;
    int t = v[a];
    v[a] = v[b];
    v[b] = t;
  }
  for (int i = 1; i <= w; i++) {
    cout << v[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3008
#include<bits/stdc++.h>
#define ll long long
#define oo 0x7fffffff
#define lowbit(x) x&(-x)
using namespace std;
typedef pair<int,int> pii;
inline int read()
{
	int out=0,fh=1;
	char cc=getchar();
	while ((cc>'9'||cc<'0')&&cc!='-')
		cc=getchar();
	if (cc=='-')
		{
			fh=-1;
			cc=getchar();
		}
	while (cc>='0'&&cc<='9')
		{
			out=out*10+cc-'0';
			cc=getchar();
		}
	return out*fh;
}
const int MAXN=1e5+10,mod=1e9+7;
int n,m;
ll c[MAXN],dp[MAXN];
int a[MAXN],b[MAXN];
pii p[MAXN];
void add(int i,int x)
{
	for(;i<=n;i+=lowbit(i))
		c[i]+=x;
}
int sum(int i)
{
	ll ans=0;
	for(;i;i-=lowbit(i))
		ans+=c[i];
	return ans % mod; 
}
int cmp(pii a,pii b)
{
	return a.first!=b.first?a.first<b.first:a.second>b.second;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),m=read();
	for(register int i=1;i<=n;++i)
		a[i]=read();
	for(register int i=1;i<=m;++i)
		b[i]=read();
	int n0=n;
	n=0;
	for(register int i=1;i<=n0;++i)
		{
			if(a[i]<b[1] || a[i]>b[m])
				continue;
			int j=lower_bound(b+1,b+1+m,a[i])-b;//a[i]的位置恰好在第j-1个出口与第j个出口之间 
			p[++n]=pii(a[i]-b[j-1],b[j]-a[i]);
		}
	for(register int i=1;i<=n;++i)
		b[i]=p[i].second;//进行第一次移动
	sort(b+1,b+1+n);
	int u=unique(b+1,b+1+n)-b-1;
	for(register int i=1;i<=n;++i)
		p[i].second=lower_bound(b+1,b+u+1,p[i].second)-b;
	sort(p+1,p+n+1,cmp);
	for(register int i=1;i<=n;++i)
		{
			if(p[i].first==p[i-1].first && p[i].second==p[i-1].second)
				dp[i]=0;
			else
				dp[i]=sum(p[i].second-1)+1;
			add(p[i].second,dp[i]); 
		}
	ll ans=1;
	for(register int i=1;i<=n;++i)
		ans+=dp[i];
	printf("%d",ans%mod);
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


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

int main(){
  int N,total = 0;
  cin >> N;
  vector<int> a(N);
  
  for(int i = 0;i < N;i++){
    cin >> a.at(i);
  }

  sort(a.begin(), a.end(), greater<int>());
  
  for(int i = 0;i < N;i++){
    if(i % 2 == 0){
      total += a.at(i);
    }else{
      total -= a.at(i);
    }
  }
  
  cout << total << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (w, a, b) = listOfInt()

    if (a < b && a + w < b) {
        println(b - (a + w))
    } else if (b < a && b + w < a) {
        println(a - (b + w))
    } else {
        println(0)
    }
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 36080
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto& v : a)
	{
		cin >> v;
		v--;
	}

	int ans = 0;
	int cur = 0;
	while (cur > -1)
	{
		int next = a[cur];
		a[cur] = -1;
		cur = next;
		ans++;
		if (cur == 1)
			break;
	}

	if (cur == 1)
		print(ans);
	else
		print(-1);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli n,m;
    cin2(n,m);
    lli x[m];
    ncin1(m,x);
    if (m == 1 || n >= m) {
        cout << 0 << endl;
        return 0;
    }
    sort(x, x+m);
    priority_queue<lli> que;
    lli ans = x[m-1] - x[0];
    REP(i,0,m-1) {
        //cout1(x[i]);
        que.push(x[i+1]-x[i]);
    }
    REP(i,0,n-1) {
        ans -= que.top();
        que.pop();
    }
    cout << ans << endl;
}


Measured memory_bytes: 2168
#include <stdio.h>

int main(void) {
	int n, i, j, k, x;
	char moji1[52];
	char moji2[4]={'S', 'H', 'C', 'D'};
	int rank1[52];
	int rank2[13]={1,2,3,4,5,6,7,8,9,10,11,12,13};
	scanf("%d\n", &n);
	for (i=1; i<=n; i++)
	{
		scanf("%c%d\n", &moji1[i-1], &rank1[i-1]);
	}
	for (i=1; i<=4; i++)
	{
		for (j=1; j<=13; j++)
		{
			x=0;
			for (k=1; k<=n; k++)
			{
				if (moji2[i-1]==moji1[k-1] && rank2[j-1]==rank1[k-1])
				{
					x=1;
				}
			}
			if (x==0)
			{
				printf("%c %d\n",moji2[i-1], rank2[j-1]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<map>
using namespace std;
map<int,int>p;
int main()
{
	int n,m,i,leap=0;
	while(~scanf("%d",&n))
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&m);
			if(p[m])
				leap=1;
			else
				p[m]=m;
		}
		if(!leap)
			printf("YES\n");
		else
			printf("NO\n");
		leap=0;
		p.clear();
	}
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int H, N, A;
    cin >> H >> N;
    
    for(int i = 0; i < N; i++){
        cin >> A;
        H -= A;
        if(H <= 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001001001

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

const int mod = 1000000007;

#define MAX_V 100005

struct edge {
    int to;
    int cost;
    int snuuk;
};

// <最短距離, 頂点の番号>
using P = pair<ll, int>;

int V;
vector<edge> G[MAX_V];
ll d[MAX_V];
ll d2[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

void dijkstra2(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d2, d2+V, INF);
    d2[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d2[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d2[e.to] > d2[v] + e.snuuk) {
                d2[e.to] = d2[v] + e.snuuk;
                que.push(P(d2[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    int s, t;
    cin >> s >> t;
    --s; --t;
    for (int i=0; i<E; ++i) {
        int a, b, c, dd;
        cin >> a >> b >> c >> dd;
        --a; --b;
        edge e = {b, c, dd};
        edge e2 = {a, c, dd};
        G[a].push_back(e);
        G[b].push_back(e2);
    }
    dijkstra(s);
    dijkstra2(t);
    vector<ll> ans(V);
    ans[V-1]=d[V-1]+d2[V-1];
    repo(i, V-1){
      ans[V-1-i]=min(ans[V-i], d[V-1-i]+d2[V-1-i]);
    }
    rep(i, V){
      cout << 1000000000000000-ans[i] << endl;
    }
}


Measured memory_bytes: 10692
N = int(input())
primeCounter = [0 for _ in range(N + 1)]
for i in range(2, N + 1):
    for div in range(2, i + 1):
        while i % div == 0:
            primeCounter[div] += 1
            i /= div
ans = 0
ans += len([i for i in primeCounter if i >= 74])
ans += len([i for i in primeCounter if i >= 24]) * (len([i for i in primeCounter if i >= 2]) - 1)
ans += len([i for i in primeCounter if i >= 14]) * (len([i for i in primeCounter if i >= 4]) - 1)
ans += len([i for i in primeCounter if i >= 4]) * (len([i for i in primeCounter if i >= 4]) - 1) * (len([i for i in primeCounter if i >= 2]) - 2) // 2
print(ans)


Measured memory_bytes: 3064
use std::cmp;
use std::io;
use std::io::prelude::*;

fn solve(dp: &mut Vec<Vec<usize>>, x: &str, y: &str) -> usize {
    for (i, xi) in x.chars().enumerate() {
        for (j, yj) in y.chars().enumerate() {
            dp[i + 1][j + 1] = if xi == yj {
                dp[i][j] + 1
            } else {
                cmp::max(dp[i + 1][j], dp[i][j + 1])
            };
        }
    }
    dp[x.len()][y.len()]
}

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n = lines.next().unwrap().unwrap().parse().unwrap();

    for _ in 0..n {
        let x = lines.next().unwrap().unwrap();
        let y = lines.next().unwrap().unwrap();
        let nx = x.len();
        let ny = y.len();
        let mut dp = vec![vec![0; ny + 1]; nx + 1];

        println!("{}", solve(&mut dp, &x, &y));
    }
}



Measured memory_bytes: 13172
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-2,D-2):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-2,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(A,D):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

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

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
        
  # divisors.sort()
  return divisors
count=0
for i in range(1, N+1, 2):
  lis = make_divisors(i)
  if len(lis) == 8:
    count += 1
print(count)

Measured memory_bytes: 3064
//*
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

ll memo[10000] = { 0 };

ll Luca(ll x) {
	if (x == 0) {
		return 2;
	}
	else if (x == 1) {
		return 1;
	}
	else if (memo[x] != 0) {
		return memo[x];
	}

	return memo[x] = Luca(x - 1) + Luca(x - 2);
}

int main() {
	ll n;

	cin >> n;

	cout << Luca(n) << endl;
}
//*/

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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	os << "{";
	rep(i, (int)v.size()) {
		if (i)
			os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
	for (auto val : array)
		std::cout << val << ", ";
	std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

	vi cnt(11);
	rep(i, 3) {
		int v; std::cin >> v;
		cnt[v]++;
	}
	if (cnt[5] == 2 && cnt[7] == 1)
		std::cout << "YES" << "\n";
	else
		std::cout << "NO" << "\n";
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
char a[3];
scanf("%s",a);
if(a[0]=='A')
{if(a[1]=='B')
  {if(a[2]=='C')
{printf("ARC\n");}}}
if(a[0]=='A')
{if(a[1]=='R')
  {if(a[2]=='C')
{printf("ABC\n");}}}
return 0;   
}

Measured memory_bytes: 1608
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
int main(void) {
    ll n, i, j, tmp;
    cin >> n;
    ll x[n], c[n];
    for(i=0; i<n; i++) {
        scanf("%lld", &x[i]);
        c[i] = x[i];
    }
    sort(c, c+n);
    
    for(i=0; i<n; i++) {
        if(x[i]>=c[n/2])
            cout << c[n/2-1] << endl;
        else
            cout << c[n/2] << endl;
    }
}


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

#define pb push_back


//copied
 
int solve() {
    
    int n;
    cin>>n;
    std::vector<int > v;
    for(int i = 0;i<n;i++){
        int x;
        cin>>x;
        v.pb(x);
    }
    int sum=1,a=v[0];
    for(int i=1;i<n;i++)
    {
        if(a>=v[i]){
            a = v[i];
            sum++;
        }
    }
    cout<<sum<<endl;

}
 
 
int main()
{
    int test = 1, tc = 0;
    //scanf("%d", &test);
   // (void)getchar();
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
    return 0;
}

Measured memory_bytes: 1400
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;

const int mod=1000000007;

int n,a,b;

int main() {
    scanf("%d%d%d",&n,&a,&b);

    if(a==b) {
        puts("1"); return 0;
    }

    if(a>b||n<2) {
        puts("0"); return 0;
    }
    a=b-a;
    n-=2;
    if(n==0) {
        puts("1"); return 0;
    }

    printf("%lld\n",1ll*a*n+1);
}



Measured memory_bytes: 256
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),a.end()
using namespace std;

int main()
{
	char t;
	int sum=0;
	rep(i, 3) {
		cin >> t;
		sum += t;
	}
	if (sum == 'a' + 'b' + 'c')cout << "Yes" << endl;
	else cout << "No" << endl;
}



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

int main () {
  int H, A;
  cin >> H >> A;

  if (H % A == 0) {
    cout << H / A << endl;
  }
  else {
    cout << (H / A) + 1 << endl;
  }
}

  /*
  if (H % A == 0) {
    cout << H << endl;
  }
  else if (H <= A) {
    cout << "1" << endl;
  }
  else {
    cout << (H / A) + 1 << endl;
  }
  */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long mod = 1000000007;

struct node {
	int depth;
	set<int> children;
};

void maketree(node* nodes, int num) {
	for (auto it = nodes[num].children.begin(); it != nodes[num].children.end(); ++it) {
		nodes[*it].children.erase(num);
		nodes[*it].depth = nodes[num].depth + 1;
		maketree(nodes, *it);
	}
}

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

	int n, u, v;
	cin >> n >> u >> v;

	node* nodes, *nodeu;
	nodes = new node[n];
	nodeu = new node[n];

	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		nodes[a - 1].children.insert(b - 1);
		nodes[b - 1].children.insert(a - 1);
		nodeu[a - 1].children.insert(b - 1);
		nodeu[b - 1].children.insert(a - 1);
	}

	nodes[v - 1].depth = 0;
	maketree(nodes, v - 1);
	nodeu[u - 1].depth = 0;
	maketree(nodeu, u - 1);

	int ans = 0;
	rep(i, n) {
		if (nodes[i].depth > nodeu[i].depth) {
			ans = max(ans, nodes[i].depth);
		}
	}

	cout << ans - 1 << "\n";

	return 0;
}


Measured memory_bytes: 38912
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int maxn=2160;
bool flag[maxn];
int pri[maxn],t;
void pre()
{
    memset(flag,0,sizeof(flag));
    t=0;
    for(int i=2;i<maxn;i++)
    {
        if(!flag[i]){
            pri[t++]=i;
        }
        for(int j=0;j<t&&i*pri[j]<maxn;j++)
        {
            flag[i*pri[j]]=1;
            if(i%pri[j]==0) break;
        }
    }
}
long long shit[100005];
bool vis[100005];
map<long long,int> mp;
long long q[100005];
long long now[100005];
bool deal(long long num,int id)
{
    now[id]=1;
    q[id]=1;
    for(int i=0;i<t;i++)
    {
        if(num%pri[i]==0){
            int cnt=0;
            while(num%pri[i]==0){
                num=num/pri[i];
                cnt++;
            }
            cnt=cnt%3;
            if(cnt){
                for(int j=1;j<=cnt;j++)
                    now[id]=now[id]*pri[i];
                for(int j=1;j<=3-cnt;j++)
                    q[id]=q[id]*pri[i];
            }
        }
        if(num==1) break;
    }
    if(num==1) {
        mp[now[id]]++;return 0;
    }
    long long t=(long long)sqrtl(1.0*num);
    if(t*t==num){
        q[id]=q[id]*t;
        now[id]=now[id]*t*t;
        mp[now[id]]++;return 0;
    }
    else if((t-1)*(t-1)==num){
        q[id]=q[id]*(t-1);
        now[id]=now[id]*(t-1)*(t-1);
        mp[now[id]]++;return 0;
    }
    else if((t+1)*(t+1)==num){
        q[id]=q[id]*(t+1);
        now[id]=now[id]*(t+1)*(t+1);
        mp[now[id]]++;return 0;
    }
    else if(num<1000000){
        now[id]=now[id]*num;
        q[id]=q[id]*num*num;
        mp[now[id]]++;return 0;
    }
    else{
        return 1;
    }
}
int main()
{
    pre();
    int n;
    scanf("%d",&n);
    int ans=0;
    memset(vis,0,sizeof(vis));
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",shit+i);
        vis[i]=deal(shit[i],i);
        ans=ans+vis[i];
//        printf("%d %d-----\n",shit[i],vis[i]);
//        printf("%lld %lld\n",now[i],q[i]);
    }
    bool ss=0;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]) continue;
        int num=mp[now[i]];
        //printf("%d %dkk %d %d\n",i,ans,num,q[i]);
        if(num==0) continue;
        mp[now[i]]=0;
        if(now[i]==1){
            ans++;
        }
        else{
            map<long long, int>::iterator iter = mp.find(q[i]);
            if (iter == mp.end())
            {
                ans += num;
                continue;
            }
            num=max(num,iter->second);
            ans+=num;
            iter->second=0;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c >= 22) cout<<"bust"<<endl;
  else cout<<"win"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
int main(){
    ll n,m,i;
    cin>>n>>m;
    map<ll,ll>ma;
    ll t[n];
    for(i=0;i<n;i++){
        ll b;
        cin>>t[i]>>b;
        ma[t[i]]+=b;
    }
    sort(t,t+n);
    ll ans=0,c=0;
    while(1){
        for(i=0;i<ma[t[c]];i++){
            ans+=t[c];
            m--;
            if(m==0){
                cout <<ans<< endl;
                return 0;
            }
        }
        c++;
        while(t[c] == t[c-1])c++;
    }
}

Measured memory_bytes: 7296
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

int ans[1000000];

bool solve(int m, int k) {
  int n = 1 << m;
  if(k == 0) {
    REP(i, n+n) {
      ans[i] = i/2;
    }
    return true;
  }
  if(k >= n || (m == 1 && k == 1)) {
    return false;
  }
  ans[0] = 0;
  ans[1] = k;
  ans[2] = 0;
  REP(i, n-2) {
    ans[i+3] = i+1;
    if(ans[i+3] >= k) {
      ans[i+3]++;
    }
  }
  ans[n+1] = k;
  REP(i, n-2) {
    ans[2*n-1-i] = i+1;
    if(ans[2*n-1-i] >= k) {
      ans[2*n-1-i]++;
    }
  }
  return true;
}

int main(void) {
  int m, k;
  scanf("%d%d", &m, &k);

  bool res = solve(m, k);
  if(res) {
    int n = 1<<(m+1);
    REP(i, n) {
      printf("%d%c", ans[i], i == n-1 ? '\n' : ' ');
    }
  } else {
    puts("-1");
  }
  return 0;
}


Measured memory_bytes: 2816
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

string kthLunlun(vector<string>& nums, int k) {
  int len = nums.size() ? nums[0].size() : 0;
  if (len == 0) {
    int cnt = 0;
    int num = 0;
    while (num < 10) {
      if (num != 0) cnt++;
      if (cnt == k) {
        return to_string(num);
      }
      nums.push_back(to_string(num));
      num++;
    }
    return kthLunlun(nums, k - cnt);
  }
  else {
    int cnt = 0;
    int num = 0;
    vector<string> new_nums;
    while (num < 10) {
      // TODO : 範囲の最適化
      for (int i = 0; i < nums.size(); ++i) {
        int last_digit = nums[i].back() - '0';
        if (abs(last_digit - num) > 1) {
          continue;
        }
        if (num != 0) cnt++;
        string str = nums[i] + to_string(num);
        if (cnt == k) {
          return str;
        }
        new_nums.push_back(str);
      }
      num++;
    }
    return kthLunlun(new_nums, k - cnt);
  }
}

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

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

  int k;
  cin >> k;

  vector<string> nums;
  string s = kthLunlun(nums, k);
  reverse(s.begin(), s.end());
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 6264
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int h[100001];
    for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    int dp[n+1];
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=1;j<=min(k,i-1);j++)
        {
            dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]));
        }
    }
    cout<<dp[n]<<"\n";
}

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

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

string s, t;

int main(){
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);
  cin.sync_with_stdio(0); cin.tie();
  cin.exceptions(cin.failbit);

  cin >> s >> t;
  vector<vi> dp(s.size()+1, vi(t.size()+1, 0));
  rep(i, 1, s.size()){
  	rep(j, 1, t.size()){
  		if(s[i-1]==t[j-1]){
  			dp[i][j]=1+dp[i-1][j-1];
  			// cout << s[i]<<endl;
  		}
  		else{
  			dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
  		}
  	}
  }
  int x=s.size(), y=t.size();
  int cnt=dp[x][y];
  string ans;
  while(cnt){
  	if(dp[x][y]>dp[x-1][y] && dp[x][y]>dp[x][y-1]){
  		ans+=s[x-1];
  		// cout << s[x] << endl; 
  		x--; y--; cnt--; 
  		
  	}
  	else if(dp[x][y]==dp[x-1][y]) x--;
  	else if(dp[x][y]==dp[x][y-1]) y--;
  }
  reverse(all(ans));
  cout << ans;
}

Measured memory_bytes: 38556
def resolve():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    good = [True for _ in range(n)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        a = a - 1
        b = b - 1

        if h[a] <= h[b]:
            good[a] = False
        if h[a] >= h[b]:
            good[b] = False

    print(good.count(True))


# x = list(map(int, input().split()))

if __name__ == "__main__":
    resolve()


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

using namespace std;
#define int long long
#define all(a) (a).begin(), (a).end()
#define ms(a,v) memset(a, v, sizeof(a))
#define sz(v) ((int)(v).size())
#define mp make_pair
#define pb push_back
#define prev biiiiirl_sai_de_casa_comi_pra_caralho
#define next trapezio_descendente
#define index eh_ele_que_nos_vai_buscar
#define left aqui_eh_37_anos_porra
#define R32 ({int32_t x; scanf("%d", &x); x;})
#define RL ({long long x; scanf("%lld", &x); x;})
#define RC ({char x; scanf(" %c", &x); x;})
#define RI RL
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;

const int N = 1e6;
vector<int> adj[N];
int vis[N];
deque<int> ans;

void go(int a, int b){
    vis[a] = 1;
    vis[b] = 1;

    for(int v : adj[a]){
        if(!vis[v]){
            ans.push_front(v);
            go(v, b);
            return;
        }
    }
    
    for(int v : adj[b]){
        if(!vis[v]){
            ans.push_back(v);
            go(a, v);
            return;
        }
    }
}

int32_t main(){
    int n = RI;
    int m = RI;

    ii root;
    for(int i = 0; i < m; i++){
        int a = RI;
        int b = RI;
        adj[a].pb(b);
        adj[b].pb(a);
        root = ii(a, b);
    }

    vis[root.ff] = vis[root.ss] = 1;
    ans.push_front(root.ff);
    ans.push_back(root.ss);

    go(root.ff, root.ss);

    cout << ans.size() << endl;
    while(!ans.empty()){
        cout << ans.front() << " ";
        ans.pop_front();
    }
    cout << endl;
}


Measured memory_bytes: 35328
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n := nextInt()

	xl := make([]int, n, n)
	yl := make([]int, n, n)
	hl := make([]int, n, n)
	for i := 0; i < n; i++ {
		xl[i] = nextInt()
		yl[i] = nextInt()
		hl[i] = nextInt()
	}

	max := 100
	for x := 0; x <= max; x++ {
		for y := 0; y <= max; y++ {
			needH := -1

			for i := 0; i < n; i++ {
				if hl[i] > 0 {
					dist := hl[i] + abs(x-xl[i]) + abs(y-yl[i])
					if needH == -1 {
						needH = dist
					} else {
						if dist != needH {
							needH = -2
							break
						}
					}
				}
			}

			if needH == -2 {
				continue
			}

			for i := 0; i < n; i++ {
				if hl[i] == 0 {
					dist := abs(x-xl[i]) + abs(y-yl[i])
					if needH > dist {
						needH = -2
						break
					}
				}
			}

			if needH == -2 {
				continue
			}

			fmt.Printf("%v %v %v\n", x, y, needH)
			return
		}
	}
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a;
        boolean b = true;
        for (int i=0;i<n;i++){
            a = scanner.nextInt();
            if (a%2==0){
                if (a%3!=0&&a%5!=0){
                    b = false;
                }
            }

        }
        if (b){
            System.out.println("APPROVED");
        }else {
            System.out.println("DENIED");
        }
    }
}

Measured memory_bytes: 23892
A,B = map(int,input().split())
S = list(input())
c = 0

if len(S) != A+B+1:
    print("No")
else:
    for i in range(A):
        if S[i] == "-":
            print("No")
            break
        else:
            c += 1

if c == A:
    if S[A] != "-":
        print("No")
        c += 1
    else:
        for j in range(A+1,A+B+1):
            if S[j] == "-":
                print("No")
                c += 1
                break

if c == A:
    print("Yes")


Measured memory_bytes: 3188
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
ans=0
for i in range(n):
    a=list(map(int,input().split()))
    d=0
    for j in range(m):
       d+=a[j]*b[j]
    d+=c
    if(d<=0):
        continue
    else:
     ans+=1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll      long long
#define ld      long double
#define pb      push_back
#define mp      make_pair
#define all(x)  x.begin(),x.end()
#define ff      first
#define ss      second
#define pi      acos(-1.0)
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	ll n,m;
	cin >> n >> m;
	char a[n][m];
	vector <bool> vi(n);
	vector <bool> vj(m);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < n; i++){
		ll k1 = 0;
		ll k2 = 0;
		for (int j = 0; j < m; j++){
			if (a[i][j]=='#'){
				k1++;
			}
			else{
				k2++;
			}
		}
		if (k1 == 0){
			vi[i] = 1;
		}
	}
	for (int j = 0; j < m; j++){
		ll k1 = 0;
		ll k2 = 0;
		for (int i = 0; i < n; i++){
			if (a[i][j]=='#'){
				k1++;
			}
			else{
				k2++;
			}
		}
		if (k1 == 0){
			vj[j]=1;
		}
	}
	for (int i = 0; i < n; i++){
		if (!vi[i]){
			for (int j = 0; j < m; j++){
				if (!vj[j]){
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
	return 0;

}

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

int main(){
    string S;
    cin >> S;
    int flag=0;

    for (int i=0; i<3; i++){
        if (S[i] == S[i+1]){
            flag = 1;
        }
    }
    
    if (flag){
        cout << "Bad" << endl;
    }
    else{
        cout << "Good" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, int> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int W, H;
    cin >> W >> H;
    vector<P> a(W + H);
    ll ans = 0;
    for (int i = 0; i < W; i++) {
        ll p;
        cin >> p;
        a[i] = P(p, 0);
        ans += p * (H + 1);
    }
    for (int i = W; i < W + H; i++) {
        ll q;
        cin >> q;
        a[i] = P(q, 1);
        ans += q * (W + 1);
    }
    int cnt[2] = {};
    sort(a.begin(), a.end());
    for (int i = 0; i < W + H; i++) {
        P x = a[i];
        if (x.second == 0) {
            cnt[0]++;
            ans -= x.first * cnt[1];
        } else {
            cnt[1]++;
            ans -= x.first * cnt[0];            
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int a,b;
	cin >> a >> b;
	cout << a*b << endl;
}

Measured memory_bytes: 3636
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main(){
int H,W;
cin>>H>>W;
char grid[H][W];
rep(i,H){
    rep(j,W){
        cin>>grid[i][j];
    }
}
int dp[H][W];
if(grid[0][0]=='.'){
dp[0][0]=0;
}
else{
    dp[0][0]=1;
}
rep(i,H){
    rep(j,W){
        if((i==0)&&(j==0))continue;
        else if(i==0){
            if(grid[i][j-1]!=grid[i][j]){
            dp[i][j]=dp[i][j-1]+1;
            }
            else{
                dp[i][j]=dp[i][j-1];
            }
        }
        else if(j==0){
            if(grid[i-1][j]!=grid[i][j]){
                dp[i][j]=dp[i-1][j]+1;

            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
        else{
            dp[i][j]=min(dp[i-1][j]+(grid[i-1][j]!=grid[i][j]),dp[i][j-1]+(grid[i][j-1]!=grid[i][j]));

        }
    }
}
cout<<(dp[H-1][W-1]+(grid[H-1][W-1]=='#'))/2<<endl;

return 0;
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

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

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

int main() {
  ll N;
  scanf("%lld", &N);

  vector<ll> list;
  for (ll i = 0; i < N; i++) {
    ll v;
    scanf("%lld", &v);
    list.emplace_back(v);
  }

  vll l(N);
  vll r(N);

  ll c;

  c = list[0];
  for (ll i = 0; i < N; i++) {
    c = gcd(c, list[i]);
    l[i] = c;
  }

  c = list[N - 1];
  for (ll i = N - 1; i >= 0; i--) {
    c = gcd(c, list[i]);
    r[i] = c;
  }

  ll ans = 0;

  ans = max(ans, r[1]);
  ans = max(ans, l[N - 2]);

  for (ll i = 1; i < N - 1; i++) {
    ll tmp = gcd(l[i - 1], r[i + 1]);
    ans = max(ans, tmp);
  }

  cout << ans << endl;
}


Measured memory_bytes: 5628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
struct P {
  double x, y;
};

int n;
vector<P> p;

double dist(P a, P b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}

// 最大半径
double f(double x, double y) {
  double res = 0;
  rep(i, n) {
    res = max(res, dist((P){x, y}, p[i]));
  }
  return res;
}

// x座標を決めた時のy方向の探索
double g(double x) {
  double l = 0, r = 1000;
  rep(i, 70) {
    double c1 = (l * 2 + r) / 3;
    double c2 = (l + r * 2) / 3;
    if (f(x, c1) > f(x, c2)) {
      l = c1;
    } else {
      r = c2;
    }
  }
  return f(x, l);
}

int main() {
  cin >> n;
  p = vector<P>(n);
  rep(i, n) cin >> p[i].x >> p[i].y;
  double l = 0, r = 1000;
  rep(i, 70) {
    double c1 = (l * 2 + r) / 3;
    double c2 = (l + r * 2) / 3;
    if (g(c1) > g(c2)) {
      l = c1;
    } else {
      r = c2;
    }
  }

  double ans = g(l);
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 384