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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	string s; cin >> s;
	int cnt = 0;
	for (int i = 0; i < s.size() / 2; ++i) {
		if (s[i] != s[s.size() - i - 1]) cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  if (N == 1)
    cout << 0 << endl;
  else
    cout << ((N - 1) * N) / 2 << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second

bool isP(ll x)
{
    for(int i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)return 0;
    }
    return 1;
}

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    //freopen("op.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll C;
        cin>>C;
        string ab="zabcdefghijklmnopqrstuvwxy";
        ll bbb=1,y=1,p=1,x=0,z=0;
        string bb="";
        while (bbb != 0)
        {
            bbb=C/26;
            y=C%26;

            if (bbb==0 && y==1 && z==1) break;
            if(y-z==-1)bb+=ab[25];
            else bb+=ab[y-z];

            if (y==0 || y==z)
                {
                    if (C==26) break ;
                    z=1;
                }
            else
                {
                    z=0;
                }
            C=bbb;
        }
        reverse(bb.begin(),bb.end());
        cout<<bb;
    }
    return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b, c;
	cin >> a >> b >> c;

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

	cout << "NO" << endl;


	return 0;
}


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

signed main(void)
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((abs(a - b) <= d && abs(b - c) <= d) || (abs(a - c) <= d))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		int t=0,h=0;
		String st,sh;
		for(int i=s.nextInt();i>0;i--) {
			st=s.next();
			sh=s.next();
			if(st.compareTo(sh)>0)
				t+=3;
			else if(st.compareTo(sh)<0)
				h+=3;
			else {
				t++;
				h++;
			}
		}
		System.out.printf("%d %d\n",t,h);
	}
}

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

int main(){
	string S;
  	cin >> S;
  	bool res = true;
  	sort(begin(S),end(S));
    for(int i = 0;i < S.size();i++){
    	if(S[i] == S[i+1]){
        	res = false;
          	break;
        }
    }
  	if(res) cout << "yes" << endl;
  	else cout << "no" << endl;
}

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

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Node[] nodes = new Node[n];
        for (int i = 0; i < n; i++) {
            nodes[i] = new Node(i);
        }
        for (int i = 0; i < n - 1; i++) {
            int a = Integer.parseInt(sc.next()) - 1;
            int b = Integer.parseInt(sc.next()) - 1;
            Edge ab = new Edge(i, -1, a, b);
            Edge ba = new Edge(i, -1, b, a);
            nodes[a].add(ab);
            nodes[b].add(ba);
        }
        int color = 0;
        for (int ee : nodes[0].adj.keySet()) {
            Edge e = nodes[0].adj.get(ee);
            e.color = color;
            nodes[e.dst].paint(color, 0, nodes);
            color++;
        }
        int[] ans = new int[n - 1];
        color = 0;
        for (Node node : nodes) {
            for (Edge e : node.adj.values()) {
                ans[e.idx] = e.color + 1;
                color = Math.max(color, e.color + 1);
            }
        }
        System.out.println(color);
        Arrays.stream(ans).forEach(System.out::println);
    }

    private static class Edge {
        int idx;
        int color;
        int src;
        int dst;

        public Edge(int i, int c, int s, int d) {
            idx = i;
            color = c;
            src = s;
            dst = d;
        }
    }

    private static class Node {
        int id;
        HashMap<Integer, Edge> adj;

        public Node(int i) {
            id = i;
            adj = new HashMap<Integer, Edge>();
        }

        void add(Edge e) {
            adj.put(e.dst, e);
        }

        void paint(int rootColor, int root, Node[] ns) {
            Edge er = adj.get(root);
            er.color = rootColor;
            int color = 0;
            for (int e0 : adj.keySet()) {
                Edge e = adj.get(e0);
                if (e.dst == root) {
                    continue;
                }
                if (color == rootColor) {
                    color++;
                }
                e.color = color;
                ns[e.dst].paint(color, e.src, ns);
                color++;
            }
        }
    }
}

Measured memory_bytes: 96168
n,c,k = map(int,input().split())
lis = []
for i in range(n):lis.append(int(input()))
lis.sort()
ans = 0
time = 0
cou = 0
for m in range(n):
    if time == 0:
        time = lis[m]
        cou += 1
    elif lis[m] <= time + k and cou < c:
        cou += 1
    else:
        ans += 1
        cou = 1
        time = lis[m]
ans += 1
print(ans)

Measured memory_bytes: 7388
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()

{
  long n,x,y,z,m;
  cin>>n;

  if(n%15==0)
    cout<<(n*800)-200*(n/15)<<endl;
  else{
    x=n/15;
    z=x*15;
    y=n-z;
    m=((z*800)-(200*x))+y*800;
    cout<<m<<endl;


  }
 return 0;
}








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

int main() {
  string s;
  cin >> s;
  int counter = 0;

  if(s.at(0) == '1') counter++;
  if(s.at(1) == '1') counter++;
  if(s.at(2) == '1') counter++;

  cout << counter << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int min = a + b;
    if (b + c < min) min = b + c;
    if (c + a < min) min = c + a;
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
    if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
    template <class C>
    static char test(typename C::const_iterator*);
    template <class C>
    static int test(...);
    static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
    static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream& o,
                                                             const C& c) {
    o << '[';
    for (auto it = c.begin(); it != c.end();)
        o << *it << (++it != c.end() ? ", " : "");
    return o << ']';
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
    return o << '(' << p.fi << ", " << p.se << ')';
}

vi dp;
vvi adj;

void dfs(int v) {
    dp[v] = 0;
    for (int u : adj[v]) {
        if (dp[u] == -1) dfs(u);
        ckmax(dp[v], dp[u] + 1);
    }
}

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

    int n, m;
    cin >> n >> m;
    dp.assign(n, -1);
    adj.assign(n, vi());
    F0R (i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        adj[a].pb(b);
    }
    F0R (i, n)
        if (dp[i] == -1) dfs(i);
    cout << *max_element(ALL(dp)) << endl;
    return 0;
}


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

int main() {
  int a, b, c, d;
  int x,y;
  cin >> a >> b >> c >> d;
  x = a;
  y = c;
  while (1)
  {
    y -= b;
    if (y <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    x -= d;
    if (x <=0) {
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3636
//29
#include<iostream>
#include<queue>
#include<vector>
#include<cstdlib>
#include<algorithm>

using namespace std;

/*
double t[1<<15][15];
int p[1<<15][15];
int n;
int k[15],d[15],s[15];

void dfs(int f,int ds){
  if(t[f][ds]!=1<<30)return;
  for(int i=0;i<n;i++){
    if(f&1<<i){
      int nf=f&~(1<<i);
      dfs(nf,i);
      double nt=t[nf][i];
      int w=0;
      for(int j=0;j<n;j++){
	if(nf&1<<j){
	  w+=s[j]*20;
	}
      }
      nt+=abs(d[ds]-d[i])/(2000./(70+w));
      if(nt<t[f][ds]){
	t[f][ds]=nt;
	p[f][ds]=i;
      }
    }
  }
}
	
    

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i]>>d[i]>>s[i];
  }
  fill(t[0],t[1<<15],1<<30);
  fill(p[0],p[1<<15],-1);
  for(int i=0;i<n;i++){
    t[0][i]=0;
  }
  int mn=1<<30;
  int x;
  for(int i=0;i<n;i++){
    dfs((1<<n)-1,i);
    if(mn>t[(1<<n)-1][i]){
      mn=t[(1<<n)-1][i];
      x=i;
    }
  }
  vector<int> v;
  int f=(1<<n)-1;
  while(x!=-1){
    v.push_back(x);
    int nf=f&~(1<<x);
    x=p[f][x];
    f=nf;
  }
  for(int i=0;i<n;i++){
    cout<<k[v[n-1-i]]<<((i!=n-1)?' ':'\n');
  }
  return 0;
}
*/


struct S{
  int w,f,i,p;
  double t;
  bool operator<(S a)const{
    return t>a.t;
  }
};

int main(){
  int n;
  cin>>n;
  int k[15],d[15],s[15];
  for(int i=0;i<n;i++){
    cin>>k[i]>>d[i]>>s[i];
  }
  priority_queue<S> que;
  for(int i=0;i<n;i++){
    S is;
    is.t=0;
    is.f=1<<i;
    is.i=i;
    is.w=s[i];
    is.p=-1;
    que.push(is);
  }
  bool p[1<<15][15]={{}};
  static int pr[1<<15][15];
  for(;;){
    S c=que.top();
    if(c.f==(1<<n)-1)break;
    que.pop();
    if(p[c.f][c.i]++)continue;
    pr[c.f][c.i]=c.p;
    for(int i=0;i<n;i++){
      S n=c;
      n.t+=abs(d[c.i]-d[i])/(2000./(70+c.w*20));
      n.f|=1<<i;
      n.i=i;
      n.w+=s[i];
      n.p=c.i;
      if(!p[n.f][n.i]){
	que.push(n);
      }
    }
  }
  int x=que.top().i;
  int f=(1<<n)-1;
  int a[15];
  for(int i=0;i<n;i++){
    int nf=f&~(1<<x);
    a[i]=k[x];
    x=(i==0)?que.top().p:pr[f][x];
    f=nf;
  }
  for(int i=0;i<n;i++){
    cout<<a[n-1-i]<<((i==n-1)?'\n':' ');
  }
  return 0;
}

Measured memory_bytes: 28544
#include <iostream>
//#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb(x) push_back(x)
#define F first
#define S second
using namespace std;
using ll = long long;
const int MOD=1e9+7;
const int MAXN=1e6+5;

ll modpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
ll f[MAXN];
ll invf[MAXN];

ll ncr(ll n,ll r){
	if(r==0 || n==r) return 1;
	return (((f[n]*invf[n-r])%MOD)*invf[r])%MOD;
}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	f[0]=1;
	for(int i=1;i<MAXN;i++){
		f[i]=(f[i-1]*i)%MOD;
		invf[i]=modpow(f[i],MOD-2);
	}
//	
//	ll res=0;
//	for(int i=b;i<w;i++){
//		int y1=h-a-1,x1=i;
//		int y2=a-1, x2=w-i-1;
//		ll p=(ncr(x1+y1,x1)*ncr(x2+y2,x2))%MOD;
//		res=(res+p)%MOD;
//	}
	ll ans=0;
	for(int i=b;i<w;i++){
		ll ways=(ncr(h-a-1+i,i)*ncr(w-i-1+a-1,w-i-1))%MOD;
		ans=(ans+ways)%MOD;
	}
	cout<<ans<<'\n';
	return 0;
}



Measured memory_bytes: 15872
#ifndef COMPETITIVE_HEADER
    #pragma GCC optimize ("Ofast")
    #ifdef ONLINE_JUDGE
        #pragma GCC target ("avx512f")
    #else
        #pragma GCC target ("avx")
    #endif
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;
#endif

int n,ai;
vi a;
int xsm;

signed main(){
    I(n);
    REP(i,n){
        I(ai);
        a.pb(ai);
        xsm ^= ai;
    }
    REP(i,n){
        auto p = a[i];
        printf("%lld", xsm ^ p);
        printf((i == n-1) ? "\n" : " ");
    }
}


Measured memory_bytes: 5352
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let s: Vec<Vec<char>> = (0..n)
        .map(|_| sc.read::<String>().chars().collect())
        .collect();
    let mut ans = 0;
    for a in 0..n {
        let mut ok = true;
        for i in 0..n {
            for j in 0..n {
                if s[i][(j + a) % n] != s[j][(i + a) % n] {
                    ok = false;
                }
            }
        }
        if ok {
            ans += n;
        }
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
import sys

def main():
    line = sys.stdin.readline()
    n = int(line)
    line = sys.stdin.readline()
    lst = line.split()
    a_lst = [int(a) for a in lst]
    length = len(a_lst)

    sunuke_sum = a_lst[0]
    arai_sum = sum(a_lst[1:])
    min_score = abs(sunuke_sum - arai_sum)

    for k in range(1,length-1):
        sunuke_sum += a_lst[k]
        arai_sum -= a_lst[k]
        score = abs(sunuke_sum - arai_sum)
        if score < min_score:
            min_score = score

    print(min_score)
    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 26608
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005

ll N;
ll num_nodes[SIZE],c[SIZE];
ll ans[SIZE],work[SIZE],remsize[SIZE];
stack<int> S[SIZE];
vector<int> G[SIZE];


ll calc(ll num){

	return (num*(num+1))/2;
}

ll dfs(int node_id,int pre){

	num_nodes[node_id] = 1;
	for(int child: G[node_id]){
		if(child == pre)continue;

		num_nodes[node_id] += dfs(child,node_id);
	}
	return num_nodes[node_id];
}


void dfs2(int node_id,int pre){

	S[c[node_id]].push(node_id);

	for(int child: G[node_id]){
		if(child == pre)continue;

		work[node_id] = num_nodes[child]; //子へのパスごとに処理
		dfs2(child,node_id);
		ans[c[node_id]] -= calc(work[node_id]);
	}
	S[c[node_id]].pop();

	if(!S[c[node_id]].empty()){

		work[S[c[node_id]].top()] -= num_nodes[node_id]; //直近の同色ノードから、自分の部分木サイズを引く

	}else{

		remsize[c[node_id]] -= num_nodes[node_id]; //rootを頂点とする木
	}
}


int main(){

	scanf("%lld",&N);

	for(ll i = 0; i < N; i++){

		scanf("%lld",&c[i]);
		c[i]--;
	}

	int from,to;

	for(ll i = 0; i < N-1; i++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		G[from].push_back(to);
		G[to].push_back(from);
	}

	dfs(0,-1);
	for(ll i = 0; i < N; i++){

		ans[i] = calc(N); //余事象で考える
		remsize[i] = N;
	}
	dfs2(0,-1);

	for(ll i = 0; i < N; i++){

		ans[i] -= calc(remsize[i]);
		printf("%lld\n",ans[i]);
	}

	return 0;
}


Measured memory_bytes: 173216
n = int(input())
s = list(input())
'''
alp = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for i in range(len(s)):
    s[i] = alp[(int(alp.index(s[i])) + n) % len(alp)]

print(''.join(s))
'''

for i in range(len(s)):
    s[i] = chr((ord(s[i]) + n - 65)%26 +65)

print(''.join(s))

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

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

long long MOD = 10000000000 + 7;
// modint
const ll mod = 1e9+7;
template< int mod >
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
      return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inv();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
    
  ModInt inv() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
  
  static int get_mod() { return mod; }
};
 
using mint = ModInt<mod>;

int main(){
  cout << setprecision(10);
  int N,M; cin >> N >> M;
  vector<int> S(N), T(M);
  for(int i = 0; i < N; i++){
    cin >> S[i];
  }
  for(int j = 0; j < M; j++){
    cin >> T[j];
  }

  mint dp[N+1][M+1];
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= M; j++){
      dp[i][j] = 0;
    }
  }
  for(int i = 0; i <= N; i++){
    dp[i][0] = 1;
  }
  for(int j = 0; j <= M; j++){
    dp[0][j] = 1;
  }

  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= M; j++){
      dp[i][j] += dp[i-1][j];
      dp[i][j] += dp[i][j-1];
      dp[i][j] -= dp[i-1][j-1]; 
      if(S[i-1] == T[j-1]){
        dp[i][j] += dp[i-1][j-1]; 
      }
      // cerr << "i,j: " << i << ", " << j << " dp[i][j]: " << dp[i][j] << endl;
    }
  }

  cout << dp[N][M] << endl;
}


Measured memory_bytes: 19252
#include<stdio.h>
int main(void)
{
  int a,b,d,r;
  double f;

  scanf("%d %d",&a,&b);

  d=a/b;
  r=a%b;
  f=(double)a/(double)b;

  printf("%d %d %lf\n",d,r,f);
  
  return 0;
}

Measured memory_bytes: 636
#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>;
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int res = 0;
  rep(i, n) {
    if(s[i] != t[i]) res++;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3796
import itertools
N = int(input())
L = [int(x) for x in input().split()]

ans = 0
for i in range(N):
  for j in range(i,N):
    for k in range(j,N):
      ml = max([L[i],L[j],L[k]])
      if(L[i]!=L[k])and(L[i]!=L[j])and(L[j]!=L[k])and((L[i]+L[j]+L[k]-ml)>ml):
        ans +=1
print(ans)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		if (x % 2 && i % 2) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3624
N, Y = [int(i) for i in input().split()]
temp = Y - (N * 1000)
passed = False
for i in range(N + 1):
    t = temp-9000*i
    if t < 0:
        break
    a = t % 4000
    if a == 0:
        y = t/4000
        if i + y <= N:
            print(i, int(y), int(N-i-y))
            passed = True
            break
if not passed:
    print(-1, -1, -1)


Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var (
		n, a, b, c, d int
		s             string
	)
	fmt.Scan(&n, &a, &b, &c, &d, &s)

	for i := b - 1; i <= d-1; i++ {
		if s[i] == '#' && i+1 <= d-1 && s[i+1] == '#' {
			fmt.Println("No")
			return
		}
	}
	for i := a - 1; i <= c-1; i++ {
		if s[i] == '#' && i+1 <= c-1 && s[i+1] == '#' {
			fmt.Println("No")
			return
		}
	}

	if c < d {
		fmt.Println("Yes")
	} else {
		for i := b - 1; i <= d-1; i++ {
			if s[i-1:i+2] == "..." {
				fmt.Println("Yes")
				return
			}
		}
		fmt.Println("No")
	}
}


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

int dep[200010], dp[200010];
vector<int> adj[200010];
int d;

void dfs(int cur, int prev = -1) {
    for (int to : adj[cur]){
        if (to != prev) {
            dep[to] = dep[cur] + 1;
            dfs(to, cur);
            d = max(d, dp[cur] + 1 + dp[to]);
            dp[cur] = max(dp[cur], 1 + dp[to]);
        } 
    }
}

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

    for (int i = 1, a, b; i < n; i++) {
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs(1);
    puts(d % 3 != 1 ? "First" : "Second");
}

Measured memory_bytes: 24704
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 1000000000000000
#define mod 1000000007
#define ld long double
#define pll pair<ll,ll>
using namespace std;

int main()
{ 
	

fast;

char ch;
cin>>ch;

if(islower(ch))
	cout<<'a';
else cout<<'A';
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define INF (1<<30)-1
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  map<ll,ll> mp;
  ll sum = 0;
  mp[0] = 1;
  rep(i,n){
    sum += a[i];
    mp[sum]++;
  }
  ll ans = 0;
  for(auto x : mp) ans += x.second*(x.second-1)/2;
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 16372
#include <stdio.h>

#define MAX 100
#define INFTY 2000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,G[MAX][MAX];
int prim();

int main()
{
  
  int i,j;
  int e;


  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      
      scanf("%d",&G[i][j]);

    }
  }
  prim();

  return 0;
}

int prim(){
  //すべての頂点 uについてcolor[u]WHITEとし、d[u]をMAX(∞)へ初期化

  int u =0;
  int d[MAX],pi[MAX],color[MAX];
  int i;
  int mincost;
  int sum =0;

  for(i=0;i<n;i++){
    
    
    d[i] = INFTY;
    pi[i] = -1; //NIL
    color[i] = WHITE;

  }

  d[u] = 0;
    

  while(1) {
    mincost = INFTY;
    u=-1;

    for(i=0;i<n;i++) {
      if(color[i] != BLACK && mincost > d[i]){
	
	mincost = d[i];
	u = i;
      }
    }

    if( mincost == INFTY){
      break;
    }

    color[u] = BLACK;

    for(i=0;i<n;i++){
      if(G[i][u] != -1) {
	
	if(color[i] != BLACK && G[i][u] < d[i] ){
	  if(d[i] > G[u][i]){
	  d[i] = G[u][i];
	  pi[i] = u;
	  color[i] = GRAY;
	  }
	}
      }
    }
  }

  for(i=0;i<n;i++){
    if(pi[i] != -1){
      sum += G[i][pi[i]];
    }
  }
  printf("%d\n",sum);
  
}
    
      

Measured memory_bytes: 636
/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
int binomialCoeff(int n,int k)
{
    int dp[k+1];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=min(i,k);j>0;j--)
        dp[j]=(dp[j]+dp[j-1])%mod;
    }
    return dp[k]%mod;
    
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    string s;
    cin>>s;
    int red=0;
    for(int i=0;i<n;i++)
        if(s[i]=='R')
        red++;
    int ans=red;
    for(int i=0;i<red;i++)
    {
        if(s[i]=='R')
        ans--;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3732
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		for(int i =0;i<N;i++) {
			list.add(scan.nextInt());
		}
		insertionSort(list);
	}

	public static void insertionSort(List<Integer> list) {
		showList(list);
		for (int i = 1; i < list.size(); i++) {
			int j = i - 1;
			int tmp = list.get(i);
			while (j >= 0 && tmp < list.get(j)) {
				list.set(j + 1, list.get(j));
				j--;
			}
			list.set(j+1, tmp);
			showList(list);
		}
	}

	public static void showList(List<Integer> list) {
		for (int i = 0; i < list.size() - 1; i++) {
			System.out.print(list.get(i));
			System.out.print(" ");
		}
		System.out.println(list.get(list.size() - 1));
	}
}



Measured memory_bytes: 34132
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trii(x) cerr<<#x<<": ("<<x.F<<","<<x.S<<")\n";
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define mod 1000000007ll
#define inf 9999999999999999ll
#define nl endl
#define sz(x) (ll)(x).size()
#define all(x) x.begin(), x.end()
#define modulo 998244353ll

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T=1;
    for(ll w1=1;w1<=T;w1++)
    {
        string s;
        cin>>s;
        bool p=false;
        for(ll i=0;i<3;i++)
        {
            if(s[i]=='7')
                p=true;
        }
        if(p)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
}


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

using namespace std;

#define endl '\n'

vector<int> strategy_function(const vector<vector<int>> &g)
{
	vector<int> label(g.size());
	function<int(int)> dfs = [&](int u)
	{
		label[u] = -1;
		int used = 0, more = 0;
		for (int v : g[u])
			if (!label[v])
			{
				int mask = dfs(v);
				more |= mask & used;
				used |= mask;
			}
		for (int k : {1, 2, 4, 8, 16})
			more |= more >> k;
		++more;
		int possible = ~used & -more;
		label[u] = possible & -possible;
		used |= label[u];
		used &= -label[u];
		return used;
	};
	dfs(0);
	return label;
}

int main()
{
#ifdef jcg
	assert(freopen("input.in", "r", stdin));
	// assert(freopen("output.out", "w", stdout));
#else
#endif

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

	int n;
	cin >> n;

	vector<vector<int>> g(n);
	for (int i = 1; i < n; ++i)
	{
		int u, v;
		cin >> u >> v;
		--u, --v;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}

	vector<int> label = strategy_function(g);
	cout << __lg(*max_element(label.begin(), label.end())) << endl;

	return 0;
}

Measured memory_bytes: 11776
#include <iostream>

int main(){
    int n;
    int f=0,s=0;
    for(int i = 0; i<3 ; i++){
        std::cin >> n;
        if (n==5){
            f++;
        }else if(n==7){
            s++;
        }
    }
    if(f==2&&s==1){
        std::cout << "YES";
    }else{
        std::cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    long N;
    cin >> N;
    int A[N], B[N], C[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> B[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }
    sort(A, A + N, greater<int>());
    sort(B, B + N, greater<int>());
    sort(C, C + N, greater<int>());
    long B_can_use_C[N];
    long can_use = 0;
    for(int i = 0; i < N; i++){
        while(B[i] < C[can_use] && can_use != N){
            can_use++;
        }
        B_can_use_C[i] = can_use;
    }
    long ans = 0;
    can_use = 0;
    long can_use_pattern = 0;
    for(int i = 0; i < N; i++){
        while(A[i] < B[can_use] && can_use != N){
            can_use_pattern += B_can_use_C[can_use];
            can_use++;
        }
        ans += can_use_pattern;
    }
    cout << ans << endl;
}

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

#define MAX 1000000 

bool prime_table[MAX];
int head;

int main(){
	int n, i, j;
	int result;
	// make table
	for (i = 0; i < MAX; i++) {
		if(i==0||i==1){
			prime_table[i] = false;
		}else{
			prime_table[i] = true;
		}
	}
	// find prime
	for (i = 2; i < MAX; i++) {
		if(prime_table[i]){
			for (j = i+i; j < MAX; j+=i) {
				prime_table[j] = false;
			}
		}
	}
	
	while(cin >> n){
		result = 0;
		for (i = 0; i <= n; i++) {
			if(prime_table[i])
				result++;
		}
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;

namespace ABC120_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ans = ABC[0] * ABC[2] <= ABC[1] ? ABC[2] : ABC[1] / ABC[0];

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11348
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if all([abs(a-b)<=k,abs(a-c)<=k,abs(a-d)<=k,abs(a-e)<=k,abs(b-c)<=k,abs(b-d)<=k,abs(b-e)<=k,abs(c-d)<=k,abs(c-e)<=k,abs(d-e)<=k]):
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3064
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#include <numeric>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long int;
using ULL = unsigned long long;

ULL gcd(ULL m, ULL n) {
    if (n > m) return gcd(n, m);
    if (n == 0) return m;
    return gcd(n, m % n);
}
ULL lcm(ULL m, ULL n) {
    return m / gcd(m, n) * n;
}
int main() {
    int n; cin >> n;
    vector<ULL> t(n);
    rep(i, n) {
        cin >> t[i];
    }
    ULL ans = accumulate(t.begin(), t.end(), t[0], lcm);
    cout << ans << endl;
}


Measured memory_bytes: 384
import math
a,b,v = map(float,input().split())

if a*b/2*a < v:
	tanres = (2*b-2*v/(a*a))/a
else:
	tanres = a*b*b/(2*v)
arc = math.atan(tanres)
deg = arc*180/math.pi
print('%.20f'%deg)


Measured memory_bytes: 2940
/* 
 * Project: AtCoder Beginners Contest 159 A - The Number of Even Pairs
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/13
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int n, m;

void solve() {
   
   printf("%d\n", n*(n-1)/2+m*(m-1)/2);

}

int main() {

    scanf("%d", &n);
    scanf("%d", &m);

    solve();

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n , bob = 0 , alice = 0;
    cin >> n;
    int arr[n];
    for (int i = 0 ; i < n ; i++)
        cin >> arr[i];
    sort(arr,arr+n);
    for (int i = n-1 ; i >= 0 ; i--){
        alice += arr[i];
        i--;
        if (i >= 0)
            bob += arr[i];
    }
    cout << alice-bob;
    return 0;
}

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

int main() {
    string n;
    cin>>n;
    int i = n.size();
    if(n[i-1]=='2'||n[i-1]=='4'||n[i-1]=='5'||n[i-1]=='7'||n[i-1]=='9'){
        cout<<"hon"<<endl;
    }else if(n[i-1]=='3'){
        cout<<"bon"<<endl;
    }else{
        cout<<"pon"<<endl;
    }
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final List<List<Integer>> factors = new ArrayList<>();
    private static final int MAX = 1000000;
    public static void main(String args[]) throws Exception {
        int n = Integer.parseInt(br.readLine());
        String[] tokens = br.readLine().split(" ");
        int[] freq = new int[MAX+1];
        int[] nums = new int[n];
        for(int i=0;i<n;i++){
            nums[i] = Integer.parseInt(tokens[i]);
            freq[nums[i]]++;
        }
        if(freq[1]>0){
            if(freq[1]==1)
                System.out.println(1);
            else
                System.out.println(0);
        }else{
            int count=0;
            Set<Integer> forbidden = new HashSet<>();
            for(int i=0;i<nums.length;i++){
                forbidden.addAll(multiples(nums[i]));
                if(freq[nums[i]]>1)
                    forbidden.add(nums[i]);
            }
            for(int i=0;i<nums.length;i++){
                if(!forbidden.contains(nums[i])){
                    count++;
                }
            }
            System.out.println(count);
        }

    }

    private static Set<Integer> multiples(int num){
        Set<Integer> set = new HashSet<>();
        for(int i=2*num;i<=MAX;i+=num){
            set.add(i);
        }
        return set;
    }
}

Measured memory_bytes: 143992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
 
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}
 
int main(){
	ll x,k,d; cin >> x >> k >> d;
	x = abs(x);
	if(x / k >= d){
		cout << x - k * d << endl;
	}else{
		ll t = x / d;
		k -= t;
		x -= t * d;
		if(k % 2){
			cout <<  d - x << endl;
		}else{
			cout << x << endl;
		}
	}
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        int n, k; scanf("%d%d", &n, &k);
        vector<int> vis(n + 1, 0);
        int ans = n;
        for(int i = 0; i < k; i++) {
            int d; scanf("%d", &d);
            for(int j = 0; j < d; j++) {
                int x; scanf("%d", &x);
                ans -= (!vis[x]);
                vis[x] = 1;
            }
        }
        printf("%d\n", ans);
    }  
    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>


using namespace std;

int main(){
    long N; 
    int r, i;
    cin >> N;
    r = (int) sqrt(N);
    i = r;
    while(N%i != 0){
        i -= 1;
    }
    cout << (i-1) + (N/i -1) << endl;
}

Measured memory_bytes: 256