akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

void Yes()
{
    puts("Yes");
    exit(0);
}
void No()
{
    puts("No");
    exit(0);
}

struct SizeAwareUnionFind
{
    vector<int> par, cou;
    SizeAwareUnionFind(int N) : par(N), cou(N) { REP(i, N) par[i] = i, cou[i] = 1; }
    int find(int x) { return (par[x] == x) ? x : (par[x] = find(par[x])); }
    void unite(int x, int y) {
        x = find(x), y = find(y); if (x == y) return;
        if (cou[x] < cou[y]) swap(x, y); 
        par[y] = x, cou[x] += cou[y];
    }
    int count(int x) { return cou[find(x)]; }
    bool same(int x, int y) { return find(x) == find(y); }
};

int main()
{
    lint N, M, Q;
    cin >> N >> M >> Q;
    SizeAwareUnionFind uf(N);
    vector<pint> E;
    while (Q--)
    {
        int a, b, c;
        cin >> a >> b >> c;
        if (c == 0)
        {
            uf.unite(a, b);
        }
        else
        {
            E.emplace_back(a, b);
        }
    }
    if (M == N - 1) {
        if (E.size()) No();
        else Yes();
    }

    for (auto p : E) if (uf.same(p.first, p.second)) No();

    map<int, int> g2s;
    REP(i, N) g2s[uf.find(i)] = uf.count(i);

    lint tree_edge = 0;

    for (auto p : g2s) tree_edge += p.second - 1;

    lint hi = 0;
    lint nb_grp = 0;
    for (auto p : g2s)
    {
        nb_grp++;
        hi += p.second - 1;
    }
    hi += nb_grp * (nb_grp - 1) / 2;

    if (M > hi) No();
    else Yes();
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int b = 0, c = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
        if (a.at(i) % 4 == 0)
        {
            b++;
        }
        else if(a.at(i) % 2 == 0)
        {
            c++;
        }
    }
    if (c == 0)
    {
        if(n<=b*2+1){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    if (c != 0)
    {
        if(n-c<=b*2){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
   // cout<<c;
}

Measured memory_bytes: 640
// https://atcoder.jp/contests/abc160/tasks/abc160_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> va(A), vb(B), vc(C);
    for (auto &x : va)
        cin >> x;
    for (auto &x : vb)
        cin >> x;
    for (auto &x : vc)
        cin >> x;

    // 降順ソート
    sort(ALLR(va));
    sort(ALLR(vb));
    sort(ALLR(vc));

    vector<int> ans;
    REP(i, X) { ans.emplace_back(va[i]); }
    REP(i, Y) { ans.emplace_back(vb[i]); }

    // 昇順ソート
    sort(ALL(ans));

    // 無色の添字
    int idx = 0;
    for (auto &x : ans) {
        // 暫定解より無色の価値が大きければ、入れ替える
        if (x < vc[idx]) {
            x = vc[idx++];
        }
    }

    cout << accumulate(ALL(ans), 0LL) << endl;
    return 0;
}


Measured memory_bytes: 4852
#include <stdio.h>

int main()
{
    long long n;
    long long a,b;

    scanf("%lld %lld %lld",&n,&a,&b);

    long long ans = 0;
    ans += n / (a + b) * a;

    n -= n / (a + b) * (a + b);

    if(n >= a)ans += a;
    else ans += n;

    printf("%lld",ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;



int main(){
	int n, m;
	cin >> n >> m;
	vector<string> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	string ans = "";
	rep(i, n) {
		ans += a[i];
	}
	cout << ans;
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S,T; cin >> S >> T;
  int N = S.size();
  int M = T.size();
  int ans = T.size();
  
  for(int i=0; i<=N-M; i++) {
    int count =0;
    for(int j=0; j<M; j++) {
      if(T.at(j) != S.at(j+i)) count++;
    }
    ans = min(ans,count);
  }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;

int f(vector<int> h,int n){
    if(n==0)return 0;
    else if(n==1)return abs(h[0]-h[1]);
    return min(abs(h[n]-h[n-1])+f(h,n-1),abs(h[n]-h[n-2])+f(h,n-2));
}

int main(){
    FASTER;
    int n;cin>>n;
    vector<int> h(n),F(n,INT_MAX);for(int &i:h)cin>>i;
    F[0]=0;
    F[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)F[i]=min(abs(h[i]-h[i-1])+F[i-1],abs(h[i]-h[i-2])+F[i-2]);
    cout<<F[n-1];
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    double l;cin >> l;
    double x,y,z;
    x = l / (double)3;
    y = l / (double)3;
    z = l-x-y;
    cout << setprecision(11) <<  x * y * z << endl;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

struct point {
	int x, y;
	explicit point(double x_ = 0.0, double y_ = 0.0):x(x_), y(y_) {}
	point(const point &p):x(p.x), y(p.y) {}

	point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}
};

inline double angle(const point &p) {
	return atan2(p.y, p.x);
}

inline int cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

struct edge {
	int to;
	double theta;
	bool used;
	edge(int to_, double theta_):to(to_), theta(theta_), used(false) {}

	inline bool operator<(const edge &e) const {
		return theta < e.theta;
	}
};

inline istream &operator>>(istream &is, point &p){
	return is >> p.x >> p.y;
}

inline bool outside(const vector<int> &P, const vector<point> &points) {
	double res = 0.0;
	point prev = points[P.back()];

	for(const auto &e : P) {
		const point &curr = points[e];
		res += cross(prev, curr);
		prev = curr;
	}
	return res >= 0;
}

inline bool neighbor(const vector<int> &a, const vector<int> &b) {
	int pa = a.back();
	for(const auto &ca : a) {

		int pb = b.back();
		for(const auto &cb : b) {
			if((pa == pb && ca == cb) || (pa == cb && ca == pb)) return true;
			pb = cb;
		}

		pa = ca;
	}
	return false;
}

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

	for(int n, m; cin >> n >> m && n;) {
		vector<point> points(n);
		for(auto &e : points) cin >> e;

		vector<vector<edge>> G(n);
		for(int i = 0; i < m; ++i) {
			int s, t;
			cin >> s >> t;
			--s; --t;
			G[s].emplace_back(t, angle(points[t] - points[s]));
			G[t].emplace_back(s, angle(points[s] - points[t]));
		}

		for(auto &edges : G) sort(begin(edges), end(edges));

		int s = -1;

		const int V = 2 + m - n;
		vector<vector<int>> faces;
		faces.reserve(V);

		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < static_cast<int>(G[i].size()); ++j) {
				int v = i;
				int e_idx = j;

				vector<int> P;
				while(true) {
					edge &e = G[v][e_idx];
					if(e.used) break;
					e.used = true;

					P.emplace_back(v);

					for(int k = 0; k < static_cast<int>(G[e.to].size()); ++k) {
						if(G[e.to][k].to == v) {
							v = e.to;
							e_idx = k + 1;
							if(e_idx >= static_cast<int>(G[e.to].size())) e_idx = 0;
							break;
						}
					}
				}

				if(P.size() >= 3) {
					if(s == -1 && outside(P, points)) s = faces.size();
					faces.emplace_back(P);
				}
			}
		}

		assert(s != -1);

		vector<vector<int>> Gf(V);

		for(int i = 0; i < V; ++i) {
			for(int j = i + 1; j < V; ++j) {
				if(neighbor(faces[i], faces[j])) {
					Gf[i].emplace_back(j);
					Gf[j].emplace_back(i);
				}
			}
		}

		vector<int> dist(V, INT_MAX);
		queue<int> que;

		dist[s] = 0;
		que.push(s);

		while(!que.empty()) {
			const int v = que.front();
			que.pop();

			for(const auto &to : Gf[v]) {
				if(dist[to] == INT_MAX) {
					dist[to] = dist[v] + 1;
					que.push(to);
				}
			}
		}

		cout << *max_element(begin(dist), end(dist)) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1308
N=gets.to_i
ps=gets.split.map(&:to_i)
ps.unshift(0)
flag=false
cnt=0
1.upto(N) do |i|
  if flag
    flag=false
    next
  end
  if i==N
    cnt+=1 if i==ps[i]
  else
    if i==ps[i]
      flag=true if i+1==ps[i+1]
      cnt+=1
    end
  end
end
puts cnt

Measured memory_bytes: 8452
#include <bits/stdc++.h>
using namespace std;
int n, k, h[100005];
long long dp[100005];
int main(){
	scanf("%d", &n);
	for (int i=1;i<=n;i++){
		scanf("%d", &h[i]);
	}
	
	k = 2;
	h[0] = 0;
	dp[0] = 0;	dp[1] = 0;
	for (int i=2;i<=n;i++){
		dp[i] = -1;
		
		for (int j=1;j<=k && j<i;j++){
			if (dp[i-j] + abs(h[i]-h[i-j]) < dp[i] || dp[i] == -1){
				dp[i] = dp[i-j] + abs(h[i]-h[i-j]);
			}
		}
	}
	
	printf("%lld\n", dp[n]);
}

Measured memory_bytes: 1408
n = int(input())
l = [0]
for i in input().split():
    l.append(int(i))
l.append(0)
s = 0
for i in range(n+1):
    s += abs(l[i+1] - l[i])
for i in range(1, n+1):
    ans = s - abs(l[i] - l[i-1]) - abs(l[i+1] - l[i]) + abs(l[i+1] - l[i-1])
    print(ans)


Measured memory_bytes: 14048
#include <stdio.h>
#include <math.h>

int main( void ) {

	int s, t, dir = 90;
	double x = 0.0, y = 0.0, pi;

	pi = 4 * atan( 1.0 );

	while ( scanf( "%d,%d", &s, &t ) && ( s != 0 || t != 0 ) ) {

		x += s * cos( ( double ) dir / 180 * pi );
		y += s * sin( ( double ) dir / 180 * pi );
		dir -= t;

	}
	
    //printf( "%d\n", ( int ) x );
    //printf( "%d\n", ( int ) y );
	printf( "%d\n%d\n", ( int ) x ,( int ) y );

	return 0;

}

Measured memory_bytes: 604
import sys
import decimal

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

A, B = ns().split()
A = int(A)
B = decimal.Decimal(B)


def solve():
    return int(A * B)


print(solve())


Measured memory_bytes: 10004
while !((m, f, r = gets.split.map(&:to_i)).all? { |v| v == -1 })
  case m + f
    when 80..100 then grade = "A"
    when 65...80 then grade = "B"
    when 50...65 then grade = "C"
    when 30...50 then r >= 50 ? grade = "C" : grade = "D"
    when 0...30 then grade = "F"
  end
  grade = "F" if m == -1 || f == -1
  puts grade
end


Measured memory_bytes: 6864
#include<iostream>
#include<algorithm>
#define INF 210000
using namespace std;
int c[INF];
int main(){
	int n,a,b;
	for(int i=0;i<INF;i++)c[i]=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		c[a+b]++;
	}
	for(int i=0;i<INF-1;i++){
		c[i+1]+=c[i]/2;
		if(c[i]%2)cout<<i<<" 0"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3836
#include <cstdio>
#include <iostream>
using namespace std;
int W, H, x, y, flag;
double result;

int main()
{
    scanf("%d %d %d %d", &W, &H, &x, &y);
    result = (double)H * W / 2;
    if(W % 2 == 0 && H % 2 == 0 && W / 2 == x && H / 2 == y)
        flag = 1;
    printf("%0.6lf %d", result, flag);
}

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

int ans = 0;
int n = 8;
vector<vector<int>> e(n+1, vector<int>(n+1));
vector<int> tmp(n+1);

int next(int a, vector<int> d)
{
    int count = 0;
    for(int i = 1; i < n + 1; i++)
    {
        if(d[i]) count++;
    }
    if(count == n)
    {
        ans++;
        return 0;
    }

    for(int i = 1; i < n + 1; i++)
    {
        if(e[a][i] == 1 && d[i] == 0)
        {
            d[i] = 1;
            
            next(i, d);
            d[i] = 0;
        }
    }
}

int main()
{
    int m;
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        e[a][b] = 1;
        e[b][a] = 1;
    }

    tmp[1] = 1;
    next(1, tmp);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common
typedef long long i64,ll;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(l);i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

class Main{
public:
	
	void run(){
		int N,Q;cin >> N>>Q;
		vector<pair<ll,int>> ss(N);
		REP(i,N){
			cin >> ss[i].first;
			ss[i].second=i;
		}
		sort(ALL(ss));
		vector<int> sv(N);REP(i,N)sv[i]=ss[i].first;
		vector<int> itossi(N);REP(i,N)itossi[ss[i].second]=i;

		map<int,int> lmap;
		REP(q,Q){
			string Comm;cin >> Comm;
			if(Comm=="ADD"){
				int a;cin >> a;a--;
				lmap[itossi[a]]=1;
			}else if(Comm=="REMOVE"){
				int a;cin >> a;a--;
				lmap.erase(itossi[a]);
			}else{
				int x;cin >> x;
				vector<int> ls;EACH(it,lmap)ls.push_back(it->first);
				sort(ALL(ls));
				//count
				ll INF=1LL<<38;
				ll l=-1,r=INF;
				while(r-l>1){
					ll m=(l+r)/2;int pd=0;
					int team=0;
					REP(i,ls.size()){
						int ui=upper_bound(ALL(sv),sv[ls[i]])-sv.begin()-1;
						int d=max((int)(lower_bound(ALL(sv),sv[ui]-m)-sv.begin()),pd);
						team+=ui-d+1;
						pd=ui+1;
					}
					int los=N-team;
					if(los<=x)r=m;
					else l=m;
				}
				if(r!=INF)cout << r <<endl;
				else cout <<"NA" <<endl;
			}
		}


	}
};

 int main(){
	//ios::sync_with_stdio(false);
 	Main().run();
 	return 0;
 }

Measured memory_bytes: 24676
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<set>
#include<bitset>
#include<vector>
#include<functional>
#include<deque>
#include<cctype>
#include<climits>
#include<complex>
#include<bits/stdc++.h>
#include<ctime>

using namespace std;

typedef long long LL;
typedef double DB;
typedef pair<int,int> PII;
typedef pair<DB,DB> PDD;
typedef complex<DB> CP;
typedef vector<int> VI;

#define mmst(a,v) memset(a,v,sizeof(a))
#define mmcy(a,b) memcpy(a,b,sizeof(a))
#define fill(a,l,r,v) fill(a+l,a+r+1,v)
#define re(i,a,b)  for(i=(a);i<=(b);i++)
#define red(i,a,b) for(i=(a);i>=(b);i--)
#define rep(i,a,b) for(i=(a);i<(b);i++)
#define fi x
#define se y
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define two(k) (1<<(k))
#define SZ(x) (int(x.size()))
#define all(x) (x).begin(),(x).end()
#define ire(i,v,x) for(i=0,v=i<SZ(x)?x[i]:0;i<SZ(x);v=x[++i])
#define ls (rt<<1)
#define rs (rt<<1|1)
#define MID ((l+r)>>1)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template<class T>inline T sqr(T x){return x*x;}
template<class T>inline void upmin(T &t,T tmp){if(t>tmp)t=tmp;}
template<class T>inline void upmax(T &t,T tmp){if(t<tmp)t=tmp;}

inline int sgn(DB x){if(fabs(x)<1e-9)return 0;return(x>0)?1:-1;}
const DB Pi=acos(-1.0);

int gint()
  {
		int res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=(res<<3)+(res<<1)+z-'0',z=getchar());
		return (neg)?-res:res;
	}
LL gll()
  {
  	LL res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=res*10+z-'0',z=getchar());
		return (neg)?-res:res;
	}

const int maxn=110;

int n;
struct Tp{int x,y,label;}p[maxn];

LL det(Tp p0,Tp p1,Tp p2){return 1LL*(p1.x-p0.x)*(p2.y-p0.y)-1LL*(p2.x-p0.x)*(p1.y-p0.y);}

bool cmp(Tp p1,Tp p2){return p1.x==p2.x?p1.y<p2.y:p1.x<p2.x;}

Tp sta[maxn];
int top;
void solve()
	{
		int i;
		sort(p+1,p+n+1,cmp);
		re(i,1,n)
			{
				while(top>1 && det(sta[top-1],sta[top],p[i])<=0)top--;
				sta[++top]=p[i];
			}
		int m=top;
		red(i,n,1)
			{
				while(top>m && det(sta[top-1],sta[top],p[i])<=0)top--;
				sta[++top]=p[i];
			}
		top--;
	}

double dist(Tp p1,Tp p2){return sqrt(sqr(LL(p1.x-p2.x))+sqr(LL(p1.y-p2.y)));}

double deg(Tp A,Tp B,Tp C)
	{
		double b=dist(A,C),a=dist(B,C),c=dist(A,B);
		double cosB=(sqr(a)+sqr(c)-sqr(b))/(2.*a*c);
		return acos(cosB);
	}

double ans[maxn];

int main(){
 // freopen("input.txt","r",stdin);
  int i;
  n=gint();
  re(i,1,n)p[i].x=gint(),p[i].y=gint(),p[i].label=i;
  solve();
  sta[0]=sta[top];
  re(i,1,top)ans[sta[i].label]=(Pi-deg(sta[i-1],sta[i],sta[i+1]))/(2*Pi);
  re(i,1,n)printf("%lf\n",ans[i]);
  return 0;
}

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

struct UnionFind {
	vector<int> par;
	
	UnionFind(int n) : par(n) {
		for (int i = 0; i < n; i++) par[i] = i;
	}
	
	int root(int x) {
		return (par[x] == x) ? x : par[x] = root(par[x]);
	}
	
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	
	void unite(int x, int y) {
		x = root(x);
		y = root(y);
		if (x == y) return;
		par[x] = y;
	}
};

struct Edge {
	int from, to, cost;
	
	bool operator <(Edge const &e) {
		return cost < e.cost;
	}
};

int main() {
	int n;
	cin >> n;
	vector<pii> x(n), y(n);
	rep(i, n) {
		int tx, ty;
		cin >> tx >> ty;
		x[i] = pii{tx, i};
		y[i] = pii{ty, i};
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	vector<Edge> e;
	rep(i, n - 1) {
		pii t = x[i];
		pii u = x[i + 1];
		e.push_back(Edge{t.second, u.second, abs(t.first - u.first)});
		t = y[i];
		u = y[i + 1];
		e.push_back(Edge{t.second, u.second, abs(t.first - u.first)});
	}
	sort(e.begin(), e.end());
	UnionFind uf(n);
	ll ans = 0;
	for (auto a : e) {
		if (!uf.same(a.from, a.to)) {
			uf.unite(a.from, a.to);
			ans += a.cost;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7992
#include<stdio.h>

int main(){
    int S,h,m,s;
    scanf("%d", &S);

    h = S / 3600;
    m = (S - h * 3600) / 60;
    s = S % 60;

    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2136
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val aList = readLine()?.split(" ")?.map { it.toInt() } ?: return

    val result = mutableSetOf<Int>()
    var overRed = 0

    for (a in aList) {
        when (a) {
            in 1..399 -> {
                result += 0
            }
            in 400..799 -> {
                result += 1
            }
            in 800..1199 -> {
                result += 2
            }
            in 1200..1599 -> {
                result += 3
            }
            in 1600..1999 -> {
                result += 4
            }
            in 2000..2399 -> {
                result += 5
            }
            in 2400..2799 -> {
                result += 6
            }
            in 2800..3199 -> {
                result += 7
            }
            else -> {
                overRed++
            }
        }
    }
    val min = if (result.isEmpty()) 1 else result.size
    val max = result.size + overRed

    println("$min $max")
}

Measured memory_bytes: 37496
import numpy as np

#initialization
nmatch = np.array([0,2,5,5,4,5,6,3,7,6])
N,M = map(int,input().split())
dp = [-1]*(N+1) # contains the number of digits it can make
dp[0] = 0
ff = np.array(list(map(int,input().split()))).reshape(-1,1)
fg = nmatch[ff].reshape(-1,1)
Atemp = np.concatenate([ff,fg],axis=1)
index0 = np.argsort(Atemp[:,0])
index1 = np.argsort(Atemp[:,1])
A = Atemp[index1] #sorted by the number of matches: ascending
B = Atemp[index0]
B = B[::-1] #sorted by the number: descending
for i in range(1,N+1):
    for k in range(M):
        j = A[k,1]
        i_old = i - j #available matches
        if (i-j) < 0:
            break
        if (i-j) == 0 and dp[i] == -1:
            dp[i] = 1
        if dp[i_old] != -1 and dp[i_old]+1 > dp[i]:
            dp[i] = dp[i_old] + 1
#print(dp)
ndigits = dp[N]
j = N
final_number = ''
for l in range(ndigits,0,-1):
    index = 0
    while True:
        temp_j = j - B[index,1]
        if temp_j < 0:
            index += 1
            continue
        if dp[temp_j] + 1 == dp[j]:
            final_number += str(B[index,0])
            j = temp_j
            break
        else:
            index += 1
        if index > M:
            break
print(int(final_number))


Measured memory_bytes: 22016
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define rrep(i,n,l) for(int i=n-1;i>=l;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	string s;
	cin>>s;
	int pos=0;
	rep(i,0,s.size()){
		if(s[i]=='?'){
			pos=i;
		}
	}
	vi ans;
	rep(x,0,10){
		string t;
		t=s;
		t[pos]='0'+x;
		//o(t);
		int check=0;
		rep(i,0,11){
			int now=11-i;
			if(now<=6){
				check+=(now+1)*(t[i]-'0');
			}else{
				check+=(now-5)*(t[i]-'0');
			}
		}
		if(check%11<=1) check=0;
		else check=11-check%11;
		//o(check<<" "<<x);
		if(check==(int)(t[11]-'0')){
			int tmp=x;
			ans.push_back(tmp);
			//o("ok"<<tmp);
		}
	}
	//o("  ok");
	if(ans.size()>1) o("MULTIPLE");
	else o(ans[0]);
}

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

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

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

int H, W, N, sx, sy, gx, gy, dp[109][109][12][12][4]; char c[109][109];
queue<tuple<int, int, int, int, int>>Q; bool used[109][109];

int main() {
	cin >> H >> W >> N;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> c[i][j];
			if (c[i][j] == 'S') { c[i][j] = '.'; sx = i; sy = j; }
			if (c[i][j] == 'G') { c[i][j] = '.'; gx = i; gy = j; }
		}
	}
	if (c[sx + 1][sy] != '.') {
		cout << "-1" << endl;
		return 0;
	}

	used[sx + 1][sy] = true; queue<pair<int, int>>que; que.push(make_pair(sx + 1, sy));

	while (!que.empty()) {
		int cx = que.front().first, cy = que.front().second; que.pop();
		int dx[4] = { -1, 0, 1, 0 }, dy[4] = { 0, 1, 0, -1 };
		for (int i = 0; i < 4; i++) {
			int ex = cx + dx[i], ey = cy + dy[i];
			if (c[ex][ey] != '.' || (ex == sx && ey == sy && i == 0)) continue;
			if (used[ex][ey] == false) { used[ex][ey] = true; que.push(make_pair(ex, ey)); }
		}
	}
	if (used[gx][gy] == false) {
		cout << "-1" << endl;
		return 0;
	}

	for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { for (int k = 0; k < 144; k++) { for (int l = 0; l < 4; l++) { dp[i][j][k / 12][k % 12][l] = 0; } } } }
	
	dp[sx][sy][0][0][2] = 1; Q.push(make_tuple(sx, sy, 0, 0, 2));

	while (!Q.empty()) {
		int px = get<0>(Q.front()), py = get<1>(Q.front()), a = get<2>(Q.front()), b = get<3>(Q.front()), dir = get<4>(Q.front()); Q.pop();
		int dx[4] = { -1, 0, 1, 0 }, dy[4] = { 0, 1, 0, -1 };

		for (int i = 0; i < 4; i++) {
			int tx = px + dx[i], ty = py + dy[i];
			if (tx <= 0 || ty <= 0 || tx > H || ty > W || c[tx][ty] == '#') continue;

			bool flag = false;
			int pa = a, pb = b; if (i != dir) { if (i + dir == 3) pb++; else pa++; }
			if (i != dir && (i + dir) % 2 == 0) flag = true;
			if (i != dir && px == sx && py == sy) flag = true;
			if (tx == sx && ty == sy && i == 0) flag = true;

			if (flag == false && pa <= N && pb <= N && dp[tx][ty][pa][pb][i] == 0) {
				dp[tx][ty][pa][pb][i] = 1;
				Q.push(make_tuple(tx, ty, pa, pb, i));
			}
		}
	}

	int maxn = (1 << 30);
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			for (int k = 0; k < 4; k++) {
				if (dp[gx][gy][i][j][k] == 1) maxn = min(maxn, i + j);
			}
		}
	}
	if (maxn == (1 << 30)) maxn = -1;
	cout << maxn << endl;
	return 0;
}


Measured memory_bytes: 18808
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
signed main() {
  string s;
  cin >> s;
  set<char> st = {'A', 'C', 'G', 'T'};
  int ans = 0;
  rep(i, s.size()) {
    int cnt = 0, pos = i;
    while (1) {
      if (st.count(s[pos]))
        cnt++, pos++;
      else
        break;
    }
    cmax(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		char a=s.next().charAt(0);
		char b=s.next().charAt(0);
		System.out.println(a<b?'<':a>b?'>':'=');
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '?') cout << 'D';
        else cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3732
'use strict'

function main(input){
  const lines = input.split('\n');
  const HW = lines.shift().split(' ').map(x => parseInt(x));
  const H = HW[0];
  const W = HW[1];
  const A = [];
  for(var i =0;i<H;i++){
    A.push(lines.shift().split(''));
  }
  const divider = 10e8+7;

  const dp=[];
  for(var i =0;i<H;i++){
    dp.push(Array(W).fill(0))
  }

  dp[0][0]=1;
  for(var i =0;i<H;i++){
    for(var j =0;j<W;j++){
      if( i>0 && A[i-1][j]!='#' ){ dp[i][j] += dp[i-1][j]; }
      if( j>0 && A[i][j-1]!='#' ){ dp[i][j] += dp[i][j-1]; }
      dp[i][j] %= divider
    }
  }


//console.log(dp);

  let result = dp[H-1][W-1];
  console.log(result%divider);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 53280
// 基本テンプレート
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int temp[210], A[210], B[210], C[210];
int dp[210][210];
signed main() {
    int D, N; cin >> D >> N;
    for(int i=0; i<D; i++) {
        cin >> temp[i];
    }
    for(int i=0; i<N; i++) {
        cin >> A[i+1] >> B[i+1] >> C[i+1];
    }

    memset(dp, -1, sizeof(dp));
    dp[0][0] = 0;
    for(int i=0; i<D; i++) {
        for(int j=0; j<=N; j++) {
            if(dp[i][j] < 0) continue;
            for(int k=1; k<=N; k++) {
                if(A[k] <= temp[i] and temp[i] <= B[k]) {
                    if(i == 0) chmax(dp[i+1][k], dp[i][j]);
                    else chmax(dp[i+1][k], dp[i][j] + abs(C[j] - C[k]));
                }
            }
        }
    }

    int ans = 0;
    for(int i=0; i<=N; i++) ans = max(ans, dp[D][i]);
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3412
def dfs(v):
    visited[v]=1#訪問済みとする
    for i in range(n):#全ての遷移先を調べる
        if connect[v][i]==0:#接続していない
            continue
        if visited[i]==1:#既に訪問済み
            continue
        dfs(i)
n,m=map(int,input().split())
edge=[[int(i)for i in input().split()]for i in range(m)]
connect=[[0 for i in range(n)]for i in range(n)]#接続状況を管理する配列
for i in range(m):
    connect[edge[i][0]-1][edge[i][1]-1]=1#接続状況を格納
    connect[edge[i][1]-1][edge[i][0]-1]=1
visited=[0]*n#既にその頂点を訪問したか管理する配列
ans=0
for i in range(m):
    connect[edge[i][0]-1][edge[i][1]-1]=0#接続を取り除く
    connect[edge[i][1]-1][edge[i][0]-1]=0
    for j in range(n):
        visited[j]=0
    dfs(0)
    brdge=False
    for j in range(n):
        if visited[j]==0:
            brdge=True
    if brdge:
        ans+=1
    connect[edge[i][0]-1][edge[i][1]-1]=1
    connect[edge[i][1]-1][edge[i][0]-1]=1
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);
  int d[N];

  int ans = 0;
  for(int i = 0; i < N; i++) {
    scanf("%d", &d[i]);
  }
  for(int j = 0; j < N; j++) {
    for (int k = j+1; k < N; k++) {
      ans += d[j] * d[k];
    }
  }
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	s := sc.Text()

	sc.Scan()
	p := sc.Text()

	check(s, p)

}
func check(s, p string) {
	ret := "No"
	for i := 0; i < len(s); i++ {
		newStr := part(s, i, len(s)) + part(s, 0, i)
		if has(newStr, p) {
			ret = "Yes"
			break
		}
	}
	fmt.Println(ret)
}

func part(s string, b, e int) string {
	var p string
	for i := b; i < e; i++ {
		p += string(s[i])
	}
	return p
}

func has(s, p string) bool {
	for i := 0; i < len(p); i++ {
		if p[i] != s[i] {
			return false
		}
	}
	return true
}



Measured memory_bytes: 1548
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

#define endl "\n"

void solve() {
    cini(n);
    for(int i=0; i<n; i++) 
        cout<<"ACL";
    cout<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const double conv = 380000.0;

int32_t main() {

    int n; cin >> n;

    double ans = 0.0;

    for(int i = 0; i < n; ++i) {
        double x; cin >> x;
        string u; cin >> u;
        if(u == "JPY") {
            ans += x;
        } else {
            ans += conv*x;
        }
    }

    cout << setprecision(20) << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(){
	double r;
	double S,l;
	scanf("%lf",&r);
	S=pow(r,2)*M_PI;
	l=2*r*M_PI;
 	printf("%lf %lf\n",S,l);
    return 0;
}

Measured memory_bytes: 2632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int l = sc.nextInt();
		int ans = 0;
		int abs = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			ans += i + l;
			if (Math.abs(abs) >= Math.abs(i + l)) {
				abs = i + l;
			}
		}
		System.out.println(ans - abs);
	}
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int ans = 0;

bool hantei(ll x)
{
	int count7, count5, count3;
	count7 = count5 = count3 = 0;
	while(x > 0){
		if(x % 10 == 7){
			count7++;
		}else if(x % 10 == 5){
			count5++;
		}else{
			count3++;
		}
		x /= 10;
	}
	if(count7 > 0 && count5 > 0 && count3 > 0)
		return true;
	return false;
}

void rekkyo(ll x, ll n)
{
	if(hantei(x) && x <= n)ans++;
	if(x <= n){
		rekkyo(x * 10 + 7, n);
		rekkyo(x * 10 + 5, n);
		rekkyo(x * 10 + 3, n);
	}
}

int main()
{
	ll n;
	cin >> n;
	rekkyo(0,n);
	ANS(ans);
	return 0;
}


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

int d, g;
vector<int> ps;
vector<int> cs;
vector<int> ss;

int solve(int, int, int, int, vector<bool> &);

int main() {
    cin >> d >> g;

    for (int i = 0; i < d; i++) {
        int p, c;
        cin >> p >> c;
        ps.push_back(p);
        cs.push_back(c);
        ss.push_back(c + 100 * (i + 1) * p);
    }

    vector<bool> solved(d);
    cout << solve(0, 0, 0, accumulate(ps.begin(), ps.end(), 0), solved) << endl;
}

int solve(int i, int score, int n, int ans, vector<bool> &solved) {
    if (i > d) return ans;
    if (score >= g) {
        ans = n;
    }

    if (i == d) {
        for (int j = d - 1; j >= 0; j--) {
            if (!solved.at(j)) {
                for (int k = 0; k < ps.at(j); k++) {
                    n++;
                    score += 100 * (j + 1);
                    if (score >= g) break;
                }
            }
            if (score >= g) {
                if (ans > n) ans = n;
                break;
            }
        }
    } else {
        solved.at(i) = false;
        int ans1 = solve(i + 1, score, n, ans, solved);

        solved.at(i) = true;
        int ans2 = solve(i + 1, score + ss.at(i), n + ps.at(i), ans, solved);

        return min(ans1, ans2);
    }
    return ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int x = N * B < C ? N * B : C;
		System.out.println(x);
	}
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
 
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#define fi first
#define se second
#define pb push_back
#define last(s) (s)[(s).length()-1]
#define all(a) (a).begin(),(a).end()
#define elif else if
#define left asdasd
#define next zaza
#define prev azaz
#define cclear cout<<flush;
#define x0 kerker
#define y0 lolik
#define kchay ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
using namespace std;
 
using llong = long long;
using ld = long double;
using ii = pair<int,int>;
using ull = unsigned long long;
using pll = pair<llong, llong>;
 
const llong over999 = 1e18;
const llong md = 1e9+7;
const ld eps = 1e-16;
const ld Pi = acos(-1);
 
/*
*/
string s;
int32_t main()
{
    kchay;
    
    cin >> s;
    
    if(s.length() < 4)return cout << "No", 0;
    
    if(s[0] != 'Y' || s[1] != 'A' || s[2] != 'K' || s[3] != 'I')return cout << "No", 0;
    cout <<"Yes";
    
    return 0;
}

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

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	if (a + b <  c + d) {
		cout << "Right" << endl;
	}
	else if (a + b > c + d) {
		cout << "Left" << endl;
	}
	else {
		cout << "Balanced" << endl;
	}
	
	return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


using ld = long double;

int n;

ld dfs(vector<vector<vector<ld>>> &dp, int i, int j, int k) {
	if (abs(dp[i][j][k] + 1) > EPS)return dp[i][j][k];
	ld ret = 0;
	if (k > 0) {
		ret += (1 + dfs(dp, i, j + 1, k - 1))* ld(k) / n;
	}
	if (j > 0) {
		ret += (1 + dfs(dp, i + 1, j - 1, k)) * ld(j) / n;
	}
	if (i > 0) {
		ret += (1 + dfs(dp, i - 1, j, k)) * ld(i) / n;
	}
	ret += ld(n - i - j - k) / n;
	ret *= ld(n) / (i + j + k);
	return dp[i][j][k] = ret;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	vi v(n);
	REP(i, n)cin >> v[i];
	vi cnt(3);
	REP(i, n)cnt[v[i] - 1]++;
	vector<vector<vector<ld>>> dp(n + 1, vector<vector<ld>>(cnt[1] + cnt[2] + 1, vector<ld>(cnt[2] + 1, -1)));
	dp[0][0][0] = 0;
	dfs(dp, cnt[0], cnt[1], cnt[2]);
	cout << fixed << setprecision(12) << dp[cnt[0]][cnt[1]][cnt[2]] << endl;
}

Measured memory_bytes: 431488
defmodule Main do
  def main do
      x =
      IO.gets("")
      |> String.trim
      |> String.to_integer
	  a =
      IO.gets("")
      |> String.trim
      |> String.to_integer
      b =
      IO.gets("")
      |> String.trim
      |> String.to_integer
      IO.puts(rem((x - a), b))
  end
end


Measured memory_bytes: 30664
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
   int n;
   cin>>n;
   if(n==1){
       cout<<1<<endl;
       cout<<0<<endl;
   }
   else if(n==2){
       cout<<2<<endl;
       cout<<0<<endl;
       cout<<11<<endl;
   }
   else{
       cout<<n-1<<endl;
       vector<string>s(n-1);
       for (int i = 0; i < n-1; i++)
       {
           s[i].push_back('1');
           for (int j = 0; j < i; j++)
           {
               s[i].push_back('0');
           }
           s[i].push_back('1');
           cout<<s[i]<<endl;
       }
       
   }
    
    return 0;
}


Measured memory_bytes: 3268
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)

hash = {}
# 10 ** 6 と定数でおいても構わない
max = 10 ** 6
# aごとに個数の数え上げ
a_arr.each do |a|
  hash[a] ||= 0
  hash[a] += 1
  max = a if a > max
end

hash.each do |a, count|
  # 重複がある場合は自身(a)も削除対象
  from_i = count > 1 ? 1 : 2
  to_i = max / a
  # aが1のときにループの回数が一番多い(max回)
  # aがmaxのときにループの回数は一番少ない(1回)
  # max/1 + max/2 + ... + max/max (調和級数:O(log(max)))
  from_i.upto(to_i) do |i|
    # ループ対象を途中で削除しても, 外側のループには影響がない
    hash.delete(a * i)
  end
end

puts hash.size


Measured memory_bytes: 38268
#include<iostream>
#include<cmath>
using namespace std;
int p = 1000000007;
int log2_p_MAX = 32;
// 1/a (mod p) = a^(p-2) (mod p)
long felmer(long a)
{
  // a^(2^i) mod p
  long rem[log2_p_MAX];
  rem[0] = a%p;
  for(int i=1;i<log2_p_MAX;i++)
    rem[i] = (rem[i-1]*rem[i-1])%p;
  long res = 1;
  long expo = p-2;
  for(int i=0;i<log2_p_MAX;i++){
	if(expo%2==1){
      res *= rem[i];
      res = res%p;
    }
  	expo /= 2;
  }
  return res;
}
int p_MAX = 100000;
int prime[100000];
int num_prime;
// エラトステネスの篩
int calc_prime()
{
  bool notPrime[p_MAX];
  int n = sqrt(p_MAX)+1;
  notPrime[0]=1;
  notPrime[1]=1;
  for(int i=0;i<=n;i++){
    if(notPrime[i])
      continue;
    int m = p_MAX/i;
    for(int j=2;j<=m;j++)
      notPrime[j*i]=1;
  }
  num_prime = 0;
  for(int i=0;i<p_MAX;i++)
    if(!notPrime[i]){
      prime[num_prime] = i;
      num_prime++;
    }
  return 0;
}
int main()
{
  int n,m;
  cin >> n >> m;
  calc_prime();
  double sqm = sqrt(m)+1;
  int num_p=0, count=0;
  long res=1, res_n=1;
  int n_pow[log2_p_MAX];
  for(int i=0;i<num_prime;i++){
    if(prime[i]>sqm)
      break;
    if(m%prime[i]==0){
      m/=prime[i];
      count=1;
      while(m%prime[i]==0){
        m/=prime[i];
      	count++;
      }
      n_pow[num_p]=count;
      num_p++;
    }
  }
  if(m!=1){
    n_pow[num_p]=1;
    num_p++;
  }
  for(int i=2;i<n;i++){
    res_n *= felmer(i);
    res_n %= p;
  }
  for(int i=0;i<num_p;i++){
    for(int j=1;j<n;j++){
      res *= n_pow[i]+j;
      res %= p;
    }
    res *= res_n;
    res %= p;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lint N;
    cin >> N;
    vector<lint> A(N);
    REP(i, N) cin >> A[i];
    sort(ALL(A));
    lint ans = 0;
    REP(i, N-1) {
        ans += A[N-1-((i+1)/2)];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4780
#include <stdio.h>

int main(){
    
    int a, b;
    char op;
    int res;
    
    while(1){
        
        
        scanf("%d %c %d", &a, &op, &b);
        
        if(op == '?') break;
        
        if(op == '+'){
            res = a + b;
        }
        else if(op == '-'){
            res = a - b;
        }
        else if(op == '*'){
            res = a * b;
        }
         else if(op == '/'){
            res = a / b;
        }
        
        printf("%d\n", res);
        
    }
    
    return 0;
}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = NM[0], M = NM[1];
        var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Array.Sort(A);
        var BC = new int[M][];
        for (int i = 0; i < M; i++)
        {
            BC[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
        }
        Array.Sort(BC, (x, y) => -x[1].CompareTo(y[1]));

        int indexA = 0;
        int indexBC = 0;
        while (indexA < N && indexBC < M)
        {
            for(int i = 0; i < BC[indexBC][0]; i++)
            {
                if (A[indexA] < BC[indexBC][1])
                {
                    A[indexA] = BC[indexBC][1];
                }
                indexA++;

                if (indexA == N) break;
            }
            indexBC++;
        }
        Console.WriteLine(A.Sum());
    }
}

Measured memory_bytes: 55388
# https://atcoder.jp/contests/abc068/tasks/arc079_a
from collections import deque
n, m = map(int, input().split())

graph = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


def bfs(graph, start, n):
    visited = [False] * n
    visited[start] = True
    que = deque([start])
    cost = [float('inf')] * n
    cost[start] = 0
    while que:
        node = que.popleft()
        for n in graph[node]:
            if not visited[n]:
                visited[n] = True
                cost[n] = cost[node] + 1
                que.append(n)
    return cost

cost = bfs(graph, 0, n)
if cost[-1] == 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 96588