akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"YES"<<endl
#define prN         cout<<"NO"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
sc(n);
f1(i,n){
	sc(A[i]);
	if(A[i]!=i)ans++;	
}
	
	if(ans==0 or  ans ==2)prY;
	else prN;
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int ans = 1; char now = s[0];
	for (int i = 1; i < s.size(); i++) {
		if (s[i] == now) {
			i++; now = '*';
			if (i >= s.size())break;
		}
		else now = s[i];
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>

using namespace std;

long a[200005], n, k;
long long sum, maxs;
long double ans;

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

    for(int i = 0; i < k; i++)
    {
        sum += a[i];
    }
    //cout << sum << endl;
    maxs = 0;
    if(sum > maxs)
    {
        maxs = sum;
    }
    for(int i = k; i < n; i++)
    {
        sum += a[i];
        sum -= a[i - k];
        //cout << sum << ' ' << i << ' ' << i - k  << endl;
        if(sum > maxs)
        {
            maxs = sum;
        }
    }
    ans = (maxs + k) / (double)2;
    cout.precision(6);
    cout << fixed << ans << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int h[n];
  rep(i, n) { cin >> h[i]; }
  int tmp;

  tmp = h[0];
  for (int i = 1; i < n; i++) {
    if (h[i] < tmp) {
      cout << "No" << endl;
      return 0;
    } else {
      if (h[i] > tmp) {
        tmp = h[i] - 1;
      } else {
        tmp = h[i];
      }
    }
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 640
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll f(vll& ls, vll& ps, ll n, ll x) {
  if (x <= 0) return 0;
  if (n == 0) {
    return 1;
  }

  if (x < ls[n - 1] + 1)
    return f(ls, ps, n - 1, x - 1);
  else if (x == ls[n - 1] + 1)
    return ps[n - 1];
  else
    return ps[n - 1] + 1 + f(ls, ps, n - 1, x - 2 - ls[n - 1]);
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, x;
  cin >> n >> x;

  vll ls(n), ps(n);
  ls[0] = 1;
  rep(i, n - 1) ls[i + 1] = 2 * ls[i] + 3;
  ps[0] = 1;
  rep(i, n - 1) ps[i + 1] = 2 * ps[i] + 1;

  ll ans = f(ls, ps, n, x);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
vector<int> ki[110000];
void dfs(int now,vector<int> &dist,int last = -1){
    for(int next:ki[now]){
        if(next == last)continue;
        dist[next] = dist[now] +1;
        dfs(next,dist,now);
    }
}
signed main(){
    int n,u,v;cin >> n >> u >> v;
    u--;v--;
    rep(i,n-1){
        int a,b;cin >> a >> b;
        a--;b--;
        ki[a].push_back(b);
        ki[b].push_back(a);
    }
    vector<int> takahashi(n,0),aoki(n,0);
    dfs(u,takahashi);
    dfs(v,aoki);
    int ans = 0;
    rep(i,n){
        
        if(takahashi[i] < aoki[i])ans = max(ans,aoki[i]);
    }
    cout << ans-1 << endl;


    return 0;
}

Measured memory_bytes: 12800
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,k;
ll s;
int main(){
    scanf("%d%d",&n,&k);
    int o;
    if(k&1)o=k;
    else o=k/2;
    for(int i=o;i<=n;i+=o){
        int p;
        if(i%k==0)p=n/k;
        else p=(n+o)/k;
        s+=p*1ll*p;
    }
    printf("%lld\n",s);
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int pow;
        int ans=1;
        for(int i=2;i<=Math.sqrt(x);i++){
            pow=1;
            while(Math.pow(i, ++pow)<=x){
                ans=Math.max(ans,(int)Math.pow(i, pow));
            }
        }
        System.out.println(ans);
        

    }
}

Measured memory_bytes: 25684
#include <stdio.h>
#include <string.h>
int F() {
	register int a, b, c;
	while(c=getchar(), c<'-');
	b=(c=='-');
	for(a=b?0:c-'0'; c=getchar(),c>'-'; a=a*10+c-'0');
	return b?-a:a;
}
const int N=3e5+10, M=1e6+10, oo=1<<30;
int m, e, S, T, head[N], cur[N], to[M], next[M], cap[M], dis[N], q[N];
void add(register int u, register int v, register int w) {
	to[e]=v, next[e]=head[u], cap[e]=w, head[u]=e++;
	to[e]=u, next[e]=head[v], cap[e]=0, head[v]=e++;
}
bool bfs() {
	register int l=-1, r=-1, i;
	memset(dis, -1, m*sizeof(int));
	dis[q[++r]=T]=0;
	while(l<r) {
		for(i=head[q[++l]]; i; i=next[i]) {
			if(cap[i^1] && dis[to[i]]==-1) {
				dis[q[++r]=to[i]]=dis[q[l]]+1;
			}
		}
	}
	return ~dis[S];
}
int dfs(register int x, register int lim) {
	register int ans=0, now;
	if(x==T) return lim;
	for(register int &i=cur[x]; i; i=next[i]) if(dis[x]==dis[to[i]]+1 && cap[i]) {
		now=dfs(to[i], lim<cap[i]?lim:cap[i]);
		lim-=now;
		ans+=now;
		cap[i]-=now;
		cap[i^1]+=now;
		if(!lim) break;
	}
	return ans;
}
int fa[N];
int find(register int x) {return fa[x]==x?x:fa[x]=find(fa[x]);}
int deg[N];
bool mark[N], appear[N];
bool work() {
	register int n=F(), h=F(), i, a, b, c, d, cnt=0, ans=0;
	m=n+h+h+2, e=2, S=0, T=n+h+h+1;
	memset(head, 0, m*sizeof(int));
	for(i=1; i<=2*h; ++i) fa[i]=i, deg[i]=0, appear[i]=mark[i]=0;
	for(i=1; i<=n; ++i) {
		a=F(), b=F(), c=F(), d=F();
		if(!c) c=a+h, add(i+h+h, c, 1);
		if(!d) d=b  , add(i+h+h, d, 1); else d+=h;
		++deg[c], --deg[d], fa[find(c)]=find(d);
		appear[c]=appear[d]=1;
		add(S, i+h+h, 2);
	}
	for(i=1; i<=2*h; ++i) if(appear[i]) {
		if(deg[i]>0) if(i> h) add(i, T, deg[i]), cnt+=deg[i]; else return 0;
		if(deg[i]<0) if(i<=h) add(i, T,-deg[i]), cnt-=deg[i]; else return 0;
		mark[i] = deg[i]!=0;
	}
	for(i=1; i<=2*h; ++i) mark[find(i)]|=mark[i];
	for(i=1; i<=2*h; ++i) if(appear[i] && find(i)==i && !mark[i]) return 0;
	while(bfs()) {
		memcpy(cur, head, m*sizeof(int));
		ans+=dfs(S, oo);
	}
	return ans==cnt;
}
int main() {
	puts(work()?"YES":"NO");
	return 0;
}

Measured memory_bytes: 16640
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Random;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();
		System.out.println(Math.min(A, B)+Math.min(C, D));
		pw.close();
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    cout << (1000 - n%1000)%1000 << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
int n = 100005;
vector<vector<P>> tree(n,vector<P>());

P dfs(int i,int before=-1){
    int res = i;
    int mx = 0;

    for(P c:tree[i]){
        if(c.second==before) continue;
        P now = dfs(c.second,i);
        if(now.first+c.first > mx){
            res = now.second;
            mx = now.first+c.first;
        }
    }

    return P(mx,res);
}

int main(){
    cin >> n;
    rep(i,n-1){
        int s,t,w;
        cin >> s >> t >> w;
        tree[s].push_back(P(w,t));
        tree[t].push_back(P(w,s));
    }

    int k = dfs(0).second;
    int ans = dfs(k).first;

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


Measured memory_bytes: 15956
#include <iostream>

using namespace std;

long gcm(long foo, long bar) {
  if (foo > bar) return gcm(bar, foo);
  if (bar % foo == 0) return foo;
  return gcm(bar % foo, foo);
}

long lcm(long foo, long bar) {
  return foo / gcm(foo, bar) * bar;
}

int main(void) {
  long N;
  cin >> N;
  long ans = 1;
  for (long i = 0; i < N; i++) {
    long tmp;
    cin >> tmp;
    ans = lcm(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

void test(int M, int K, vector<int> z) {
    vector<int> visited(z.size() / 2);
    rep(i, z.size()) {
        if(visited[z[i]]) continue;
        int s = 0;
        bool found = false;
        repeat(j, i + 1, z.size()) {
            if(z[i] == z[j]) {
                found = true;
                break;
            }
            s ^= z[j];
        }
        if(found and s != K) {
            // debug(z);
            // cerr << i << " " << s << endl;
            assert(0);
        }
    }
}

class Solver {
  public:
    bool solve() {
        int M, K; cin >> M >> K;

        int a = pow(2, M);
        if(K == 0) {
            rep(i, a) cout << i << " " << i << (i == a - 1 ? "\n" : " ");
            return false;
        }
        vector<pii> p;
        set<int> used;
        rep(i, a) {
            int j = K ^ i;
            if(used.count(j)) continue;
            used.insert(i);
            used.insert(j);
            if(j >= a) {
                cout << -1 << endl;
                return false;
            }
            p.emplace_back(i, j);
        }
        if(p.size() % 2 != 0) {
            cout << -1 << endl;
            return false;
        }
        //debug(p);
        int cnt = 0;
        vector<int> res;
        rep(i, p.size() / 2) {
            pii x = p[i * 2];
            pii y = p[i * 2 + 1];
            vector<int> z = {
                x.first, y.first, y.second, x.first, x.second, y.second, y.first, x.second
            };
            rep(i, z.size()) {
                res.push_back(z[i]);
            }
        }
        // test(M, K, res);
        rep(i, res.size()) {
            cout << res[i] << (i == res.size() - 1 ? "\n" : " ");
        }
        return 0;
    }
};

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


Measured memory_bytes: 9588
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
int main() {
	int K, S;
	cin >> K >> S;
	int cnt = 0;
	for (int i = 0; i <= K; i++) {
		for (int j = 0; j <= K; j++) {
			int k = S - i - j;
			if (0 <= k&&k <= K) cnt++;
		}
	}
	cout << cnt << endl;
}

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int main() {
    int N;
    cin >> N;
    int now = 1000;
    while(1){
        if(now >= N){
            cout << now-N << endl;
            exit(0);
        } else {
            now += 1000;
        }
    }
}

Measured memory_bytes: 3636
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
//#define i_5 i_7-2

ll i_7=1E6+3;
ll i_5=i_7-2;

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
///////////////////////////

void no(){
    cout<<"No"<<endl;
}

int main(){fastio
    string s;cin>>s;
    ll n=s.size();
    if(n%2==1){
        no();return 0;
    }
    rep(i,0,n-1){
        if(i%2==0){
            if(s[i]!='h'){
                no();return 0;
            }
        }else{
            if(s[i]!='i'){
                no();return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    
    return 0;
}



Measured memory_bytes: 764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX + 1];


void maxHeap(int i) {
	int l, r, large;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H&&A[l] > A[i]) {
		large = l;
	}
	else {
		large = i;
	}
	if (r <= H&&A[r] > A[large]) {
		large = r;
	}
	if (large != i) {
		swap(A[large], A[i]);
		maxHeap(large);
	}
}

int extract() {
	int maxv;
	if (H < 1) return -INFTY;
	maxv = A[1];
	A[1] = A[H--];
	maxHeap(1);
	return maxv;
}
void increasekey(int i, int key) {
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		swap(A[i], A[i / 2]);
		i = i / 2;
	}
}

int insert(int key) {
	H++;
	A[H] = -INFTY;
	increasekey(H, key);
}

int main()
{
	int key;
	string com;
	while (1) {
		cin >> com;
		if (com=="end") break;
		if (com=="insert") {
			cin >> key;
			insert(key);
		}
		else {
			cout << extract()<<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 6916
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    long ans = long.max;
    // foreach (i; 1 .. (n + 1))
    // {
    //     foreach (j; 1 .. (n + 1))
    //     {
    //         if (i * j == n)
    //         {
    //             ans = min(ans, ((i - 1) + (j - 1)));
    //         }
    //     }
    // }
    // writeln(ans);
    foreach (i; 1 .. n)
    {
        if (n % i == 0)
        {
            ans = min(ans, ((i - 1) + (n / i) - 1));
            // writeln(ans);
        }
        if (i > (n / i))
        {
            // writeln(i, n / i);
            break;

        }

    }

    writeln(ans);

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <iomanip>
#include <queue>
#include <deque>
#include <sstream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <map>
#include <utility>
using namespace std;

#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define ss(n) scanf("%s",&n)
#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795

int color(int x) {
	if(x >= 1 && x<= 399) {
		return 0;
	}
	if(x >= 400 && x<= 799) {
		return 1;
	}
	if(x >= 800 && x<= 1199) {
		return 2;
	}
	if(x >= 1200 && x<= 1599) {
		return 3;
	}
	if(x >= 1600 && x<= 1999) {
		return 4;
	}
	if(x >= 2000 && x<= 2399) {
		return 5;
	}
	if(x >= 2400 && x<= 2799) {
		return 6;
	}
	if(x >= 2800 && x<= 3199) {
		return 7;
	}
	return 8;
}

int main() {
	int n;
	cin >> n;
	vector<bool> was (8,false);
	int count3200 = 0;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		int col = color(x);
		if(col == 8) {
			count3200++;
		} else {
			was[col] = true;
		}
	}
	int count = 0;
	for(int i = 0; i < 8; i++) {
		if(was[i]) {
			count++;
		}
	}
	cout << max(1,count) << " " << (count+count3200);
	return 0;
}



Measured memory_bytes: 256
n = int(input())
ans = []
for i in range(1,n+1):
    if i % 3 == 0 or i % 10 == 3:
        ans.append(i)
    else:
        tmp =  i // 10
        while True:
            if tmp == 0:
                break
            if tmp % 10 == 3:
                ans.append(i)
                break
            tmp //= 10


print(' ',end='')
print(*ans) 


Measured memory_bytes: 6128
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i

}

type node struct {
	item int
	prev *node
	rank int
}

func (n *node) root() *node {
	var parent *node
	for parent = n; parent.prev != nil; parent = parent.prev {
		continue
	}
	if parent != n {
		n.prev = parent
	}
	return parent
}

func issame(nodeX, nodeY *node) bool {
	return nodeX.root() == nodeY.root()

}

func merge(nodeX, nodeY *node) {
	nodeX = nodeX.root()
	nodeY = nodeY.root()
	if nodeX.item == nodeY.item {
		return
	}

	if nodeX.rank < nodeY.rank {
		nodeX, nodeY = nodeY, nodeX
	}

	if nodeX.rank == nodeY.rank {
		nodeX.rank += 1
	}

	if nodeX.prev != nil || nodeY.prev != nil {
		panic(fmt.Sprintf("%v, %v", nodeX, nodeY))
	}

	nodeY.prev = nodeX

}

func main() {
	sc.Split(bufio.ScanWords)
	var n, q int
	fmt.Scanf("%d %d", &n, &q)

	groups := make([]*node, n)
	for i := 0; i < n; i++ {
		groups[i] = &node{item: i, prev: nil, rank: 0}
	}

	for i := 0; i < q; i++ {
		com, x, y := next(), next(), next()
		if com == 0 {
			merge(groups[x], groups[y])

		} else {
			if issame(groups[x], groups[y]) {
				fmt.Println("1")
			} else {
				fmt.Println("0")
			}
		}
	}

}



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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i, n)ans += (n-1)/(i+1);
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  ll a, b, n; cin >> a >> b >> n;
  ll x = min(b-1, n);
  ll ans = floor(a*x/b);
  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
 
signed main(){
    int a,p;
    cin>>a>>p;
    p+=a*3;

    cout<<p/2<<endl;
}

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

int main(){

    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n){
        cin >> p[i];
    }
    int ans=0;
    for(int i=1;i<n-1;i++){
        vector<int> t(3);
        rep(j,3){
            t[j]=p[i+j-1];
        }
        sort(t.begin(),t.end());
        if(t[1]==p[i]){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll n,a,b; cin >> n >> a >> b;
	cout << (n)/(a+b)*a+max(0LL,min(a,n%(a+b))) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 110
int main(){
    int a[N],n,m,i,cnt=0,num=0;
    double min;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        num+=a[i];
    }
    min=num/(4.0*m);
    for(i=0;i<n;i++){
        if(a[i]>=min) cnt+=1;
    }
    if(cnt>=m) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
use std::io::{stdin, BufRead};
fn main() {
    let mut n = String::new();
    let stdin = stdin();
    let mut stdinlock = stdin.lock();
    stdinlock.read_line(&mut n).expect("read line");
    let mut more_than_twice: u32 = 0;
    let mut once: u32 = 0;
    let mut never: u32 = 0;
    for a in stdinlock
        .lines()
        .next()
        .expect("next line")
        .expect("line")
        .trim()
        .split_whitespace()
        .map(|a| a.parse::<u32>().expect("a"))
    {
        if a % 2 != 0 {
            never += 1;
        } else if (a / 2) % 2 == 0 {
            more_than_twice += 1;
        } else {
            once += 1;
        }
    }
    println!(
        "{}",
        if never + (if once > 0 { 1 } else { 0 }) <= more_than_twice + 1 {
            "Yes"
        } else {
            "No"
        }
    );
}


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

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

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

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

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


Measured memory_bytes: 256
L = list(input())
if L.count("C") == 0 :
    ans = "No"
else :
    for i in range(len(L)) :
        if L[i] == "C" :
            if "F" in L[i:] :
                ans = "Yes"
            else :
                ans = "No"
            break
print(ans)


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

int main() {
  int N, count;
  cin >> N;
  count = 0;
  for (int i = 1; i < 10; ++i) {
    for (int j = 1; j < 10; ++j) {
      int ans = i * j;
      if (ans != N) {
        ++count;
      }
    }
  }
  if (count == 81) {
    printf("No");
  } else {
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 1e9
#define MOD 1000000007;//1e9+7

int c(int s, int g) { return (s - g)*(s - g); }

int main() {
    int N;
    cin >> N;
    vector<int>X(N);
    rep(i, N)cin >> X[i];

    int ans = INF;
    rep(i, 101) {
        int sum = 0;
        rep(j, N)sum += c(i, X[j]);
        ans = min(ans, sum);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
 
using namespace std;

int main (){
    int N,W,h,w,ans=0;

	cin >> N >> W >> h >> w;

    ans = N*W-h*w-h*(W-w)-w*(N-h);

    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    s = sum(a)
    s1 = 0
    for i in range(1,n,2):
        s1 += a[i]
    x1 = s-2*(s1)
    ans = [x1]
    for i in range(n-1):
        ans.append(2*a[i]-ans[-1])
    print(*ans)
    
main()

Measured memory_bytes: 20580
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <numeric> //accumulate
#include <unordered_map> //ハッシュ関数

using namespace std;

//デバッグ時はTESTを定義する。本番時はこの行をコメントアウトする
//#define TEST //*******************************************************************************************************************************************

//そうすることで、以下に定義する、デバッグ時にのみ標準出力する、doutコマンドが実現できる。本番時はダミーストリームに出力
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //デバッグ時のdoutコマンドのダミー出力先
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummyを毎回リセットしておかないとメモリ溢れちゃう。
    //どうせ表示しないからgoodbitしなくていいけど、表示する場合はこれしておかないとバグるらしいので、勉強のために。詳しくは http://d.hatena.ne.jp/linden/20060427/p1
#endif


#define disp(A) dout << #A << " = " << (A) << endl
#define disP(A) dout << (A) << " "
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)

#define dispAll(A,n) dout << #A << " = "; rep(j, 0, (n)) {disP(A[j]);} dout << endl

const int INF = 1e9;


int main(void) {
    int N;
    cin >> N;
    
    int a[N];
    rep(i,0,N) cin >> a[i];
    
    dispAll(a,N);
    
    sort(a,a+N);
    
    dispAll(a,N);
    
    int number;
    int cnt;
    int i = 0;
    int ans = 0;
    
    while(i<N) {
        
        
        number = a[i];
        cnt = 1;

        dout << "====\n";
        disp(i);
        disp(number);
        disp(cnt);
        
        i++;
        
        while( number == a[i] ) {
            dout << "---\n";
            disp(i);
            disp(a[i]);
            
            cnt++;
            i++;
            
            
            disp(cnt);
        }
        
        //奇数個のもののみカウント
        if( cnt%2 ) ans++;
        
    }
    

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


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

int main(){
  int n,t;
  cin>>n>>t;
  vector<int> arr(n);
  for(int i=0;i<n;++i){
    cin>>arr[i];
  }
  
  int result = 0;
  for(int K=0;K<=t;++K){
    for(int r=0;2*r<=K;++r){
      int take = K-r;
      
      if(take>n){
        continue;
      }
      
      for(int l=0;l<=take;++l){
        vector<int> curr;
        for(int k=0;k<l;++k){
          curr.push_back(arr[k]);
        }
        for(int k=0;k+l<take;++k){
          curr.push_back(arr[n-1-k]);
        }
        sort(curr.begin(),curr.end());
        int currResult = 0;
        for(int k=0;k<K-2*r;++k){
          currResult += curr[take-1-k];
        }
        result = max(result,currResult);
      }
    }    
  }
  cout<<result<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
string s, t;
 
int main()
{
	cin >> s >> t;
	bool ok = s == t;
	for (int i = 1; i < s.length() && !ok; i++)
		ok = s.substr(i) + s.substr(0, i) == t;
	printf("%s\n", ok? "Yes": "No");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN 100001

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

    ll n,a,b;
    cin>>n>>a>>b;
    print(min(n*a, b));
        
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;





int main() {
//    cout << setprecision(100);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    cout << a[n / 2] - a[n / 2 - 1];




}




Measured memory_bytes: 640
n, m, q = gets.split.map(&:to_i)
nums = []
q.times { nums << gets.split.map(&:to_i) }
options = (1..m).to_a
ans = []
options.repeated_combination(n).each do |combi|
  array = combi.to_a
  tmp = 0
  nums.each do |a, b, c, d|
    if array[b - 1] - array[a - 1] == c
      tmp += d
    end
  end
  ans << tmp
end
puts ans.max


Measured memory_bytes: 15544
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define per(i, a, b) for(int i = (a); i >= (b); --i)
#define debug(x) cerr << #x << ' ' << x << endl;
using namespace std;

typedef long long ll;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;
const double EPS=1e-8;
inline int sign(double a){return a<-EPS?-1:a>EPS;}
inline int cmp(double a,double b){return sign(a-b);}
//点
struct P{
    double x,y;
    P(){}
    P(double _x,double _y):x(_x),y(_y){}
    P operator + (P p){return P(x+p.x,y+p.y);}
    P operator - (P p){return P(x-p.x,y-p.y);}
    P operator * (double k){return P(x*k,y*k);}
    P operator / (double k){return P(x/k,y/k);}
    double dot(P p){return x*p.x+y*p.y;}
    double det(P p){return x*p.y-y*p.x;}
    double distTo(P p){return (*this-p).abs();}
    double alpha(){return atan2(y,x);}
    void read(){scanf("%lf%lf", &x, &y);}
    void write(){printf("%.0lf %.0lf\n", x, y);}
    double abs(){return sqrt(abs2());}
    double abs2(){return x*x+y*y;}
    P rot90(){return P(-y,x);}
    P unit(){return *this/abs();}
    int quad(){return sign(y)==1||(sign(y)==0&&sign(x)>=0);}
    P rot(double an){return P(x*cos(an)-y*sin(an),x*sin(an)+y*cos(an));}
    bool operator < (P p)const{int c=cmp(x,p.x);if(c)return c==-1;return cmp(y,p.y)==-1;}
    bool operator == (P o)const{return cmp(x,o.x)==0&&cmp(y,o.y)==0;}
}s[MAXN];

int main(int argc, char const *argv[])
{
    int n;
    scanf("%d", &n);
    rep(i, 0, n-1)    s[i].read();
    int j = 2;
    double ans = 0;
    rep(i, 0, n-1) {
        while((s[i]-s[j]).det(s[i+1]-s[j]) <= (s[i]-s[(j+1)%n]).det(s[i+1]-s[(j+1)%n]))  j = (j+1)%n;
        ans = max(ans, max((s[i]-s[j]).abs(), (s[i+1]-s[j]).abs()));
    }
    printf("%.16lf\n", ans);
    return 0;
}


Measured memory_bytes: 4444
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 101
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
int n,X,D,sz[N],p[N],top[N]; ll m[N],f[2][N*N*N],g[N*N*N];
struct node{int v,c,id;}a[N]; int q[N*N*N];
bool operator<(node x,node y){return 1ll*x.c*y.v<1ll*x.v*y.c;}
int main()
{
	n=read(),X=read(),D=read(),m[1]=read(); sz[1]=1; top[1]=X;
	for(int i=2;i<=n;i++)	m[i]=read(),p[i]=read(),sz[i]=1;
	for(int i=n;i>1;i--)	sz[p[i]]+=sz[i],m[p[i]]+=m[i],m[i]=min(m[i],X+1ll),top[i]=D;
	m[1]=min(X+1ll,m[1]); for(int i=1;i<=n;i++)	a[i]=(node){sz[i],m[i],i};
	int cur=1,lst=0,s=0; memset(f[cur],63,sizeof(f[cur])); f[cur][0]=0;
	for(int i=1;i<=n;i++)
	{
		cur^=1,lst^=1; memset(f[cur],63,sizeof(f[cur]));
		int ctop=min(top[i],n); top[i]-=ctop;
		s+=ctop*sz[i];
		for(int j=0;j<sz[i];j++)
		{
			int hd=1,tl=0;
			for(int k=0;k*sz[i]+j<=s;k++)
			{
				int p=k*sz[i]+j;
				while(hd<=tl&&k-q[hd]>ctop)	hd++;
				while(hd<=tl&&g[tl]+1ll*(k-q[tl])*m[i]>=f[lst][p])	tl--;
				q[++tl]=k; g[tl]=f[lst][p];
				f[cur][p]=min(f[cur][p],g[hd]+1ll*(k-q[hd])*m[i]);
			}
		}
	}
	sort(a+1,a+n+1); ll ans=0;
	for(int i=0;i<=s;i++)	if(f[cur][i]<=X)
	{
		ll s1=0,s2=0;
		for(int j=1;j<=n;j++)
		{
			int x=a[j].id;
			ll nw=min(1ll*top[x],(X-f[cur][i]-s2)/a[j].c)*a[j].v;
			ans=max(ans,s1+i+nw);
			s1+=nw; s2+=1ll*top[x]*a[j].c;
			if(s2+f[cur][i]>X)	break;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 22400
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    bool f = false;
    if(s[0] == 'A'){
        int count = 0;
        for(int i = 2;i < s.length()-1;i++){
            if(s[i] == 'C')count++;
        }
        if(count == 1){
            int upcnt = 0;
            for(int i = 0;i < s.length();i++){
                if(isupper(s[i]))upcnt++;
            }
            if(upcnt == 2){
                f = true;
            }
        }
    }
    if(f){
        P("AC");
    }else{
        P("WA");
    }
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;

	int cnt = 0 ;
	int len = s.length()-1;
	
	for(int i  = 0 ; i <= (int)ceil((double)len/2)-1; i++)
	{
		if(s[i] == s[len-i])
			continue;
		else 
			cnt++;
	}
	cout<<cnt<<"\n";
return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,a[100],b[100],i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(j=0;j<n;j++){
		b[j]=a[i-1];
		printf("%d",b[j]);
		if(j!=n-1){
			printf(" ");
		}
		i--;
	}
	printf("\n");
	return 0;
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector <int> d(n);
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    int res=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            res+=d[i]*d[j];
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int H, W; cin >> H >> W;
    vector<vector<char>> canvas;
    rep (i, 0, H) {
        vector<char> tmp;
        rep (j, 0, W) {
            char c; cin >> c;
            tmp.push_back(c);
        }
        canvas.push_back(tmp);
    }

    rep (i, 0, H) {
        rep (j, 0, W) {
            if (canvas[i][j] == '#') {
                if ((i-1) >= 0 && canvas[i-1][j] == '#') continue;  // upper
                if ((j-1) >= 0 && canvas[i][j-1] == '#') continue;  // left
                if ((H-1) >= (i+1) && canvas[i+1][j] == '#') continue;  // lower
                if ((W-1) >= (j+1) && canvas[i][j+1] == '#') continue;  // right

                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){

	final int N = 100;
	Scanner scan = new Scanner(System.in);
	int[][] m = new int[N+1][N+1];
	int[] p = new int[N];

	int n = scan.nextInt();
	
	for(int i = 1; i <= n; i++){
	    p[i-1] = scan.nextInt();
	    p[i] = scan.nextInt();
	}
	
	for(int i = 1; i <= n; i++){
	    m[i][i] = 0;
	}
	for(int i = 2; i <= n; i++) {
	    for(int j = 1; j <= n - i + 1; j++){
		int k = j + i - 1;
		m[j][k] = (1 << 21);
      
		for(int l = j; l <= k - 1; l++){
		    m[j][k] = Math.min(m[j][k],m[j][l] + m[l+1][k] + p[j-1] * p[l] * p[k]);
		}
	    }
	}
	System.out.println(m[1][n]);

    }
}




Measured memory_bytes: 26372
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int n,m,r;
int l[8]  = {0};
int a,b,c;

int dfs(int k, int x1, int x2, int y1, int y2, int z1, int z2){
    if(k == n){
      if(x1 == 0 || y1 == 0 || z1 == 0) return 100000;
      int ans = (x1+y1+z1-3)*10 + abs(a-x2) + abs(b-y2) + abs(c-z2);
      return ans;
    }
    return min({ dfs(k+1, x1+1, x2+l[k],y1,y2,z1,z2), dfs(k+1, x1,x2,y1+1,y2+l[k],z1, z2), dfs(k+1,x1,x2,y1,y2,z1+1,z2+l[k]),dfs(k+1,x1,x2,y1,y2,z1,z2)});
}

int main(){
  cin >> n >> a >> b >> c;
  for(int i = 0 ; i < n; i++){
    cin >> l[i];
  }
  int ans = dfs(0,0,0,0,0,0,0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>

using namespace std;

int main(){
    string inp;
    cin >> inp;
    for( int i=0 ;i < inp.size() ; i++ ){
        if( i% 2== 0 ){
            if( inp[i] == 'R' || inp[i] == 'U' ||inp[i] == 'D' ){
                continue;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }else{
            if( inp[i] == 'L' || inp[i] == 'U' ||inp[i] == 'D' ){
                continue;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256