akhauriyash/Code-Regression huggingface dataset:
/*
 * Package: StandardCodeLibrary.Core
 * */
//蠑戊ソ帛クク逕ィ逧?、エ譁?サカ蟷カ菴ソ逕ィstd蜷榊ュ礼ゥコ髣エ
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <utility>
#include <vector>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <climits>
using namespace std;

////蟶ク逕ィ謨ー謐ョ邀サ蝙?//typedef long long int lli;
//typedef vector<int> vi;
//typedef vector<vi> vvi;
//typedef pair<lli,lli> pll;
//typedef queue<int> qi;
typedef long T;

int MOD=1000000007;

//蟶ク逕ィ蜃ス謨ー:譛?、ァ譛?ー丞?譖エ譁ー;謨ー蟄ヲ逶ク蜈ウ蜃ス謨ー;霎灘?蜥瑚セ灘?;譬醍憾謨ー扈?蟷カ譟・髮?蜿ッ蜷亥ケカ蝣?
template<typename type>inline bool cmax(type& a,const type& b){return a<b?a=b,true:false;}
template<typename type>inline bool cmin(type& a,const type& b){return b<a?a=b,true:false;}

const int MAXV=1000;
const int MAXE=1000000;
typedef struct struct_edge* edge;
struct struct_edge{int v;edge n;}pool[MAXE];
edge top;
int V;
edge adj[MAXV];
void build_graph(int v)
{
	top=pool,memset(adj,0,sizeof adj);
	V=v;//轤ケ謨ー
	//add_edge(u,v);
}
void add_edge(int u,int v)
{
	top->v=v,top->n=adj[u],adj[u]=top++;
}
int ord;
int dfn[MAXV];
int low[MAXV];
int stks;
int stk[MAXV];
bool ins[MAXV];
int cnt;
int bl[MAXV];
void dfs(int u)
{
	dfn[u]=low[u]=++ord;
	ins[stk[stks++]=u]=true;
	for (edge i=adj[u];i;i=i->n)
		if (!dfn[i->v]) dfs(i->v),cmin(low[u],low[i->v]);
		else if (ins[i->v]) cmin(low[u],dfn[i->v]);
	if (dfn[u]==low[u])
	{
		int v;
		do ins[v=stk[--stks]]=false,bl[v]=cnt;
		while(v!=u);
		cnt++;
	}
}
void tarjan()
{
	ord=0,memset(dfn,0,sizeof dfn),cnt=0;
	for(int i=0;i<V;i++) if (!dfn[i]) dfs(i);
}

int main()
{
	int n,m;
	cin>>n>>m;
	build_graph(n);
	for(int i=0;i<m;i++)
	{
		int s,d;
		cin>>s>>d,--s,--d;
		add_edge(s,d);
	}
	tarjan();
	vector<vector<int> > adj(cnt);
	vector<vector<int> > radj(cnt);
	for(int i=0;i<V;i++) for (edge e=::adj[i];e;e=e->n) if (bl[i]!=bl[e->v]) adj[bl[i]].push_back(bl[e->v]);
	for(int i=0;i<cnt;i++) sort(adj[i].begin(),adj[i].end()),unique(adj[i].begin(),adj[i].end());
	vector<int> id(cnt);
	for(int i=0;i<cnt;i++) for (int j=0;j<adj[i].size();j++) id[adj[i][j]]++;
	queue<int> q;
	vector<pair<long long int,long long int> > f(n);
	for(int i=0;i<cnt;i++) if (id[i]==0) q.push(i),f[i]=make_pair(1,1);
	long long int ans=1;
	while(q.size())
	{
		int u=q.front();
		q.pop();
		if (!adj[u].size()) ans=(ans*(f[u].first+f[u].second))%MOD;
		for(int i=0;i<adj[u].size();i++)
		{
			int v=adj[u][i];
			radj[v].push_back(u);
			if ((--id[v])==0)
			{
				q.push(v);
				f[v]=make_pair(1,1);
				for (int j=0;j<radj[v].size();j++)
				{
					int w=radj[v][j];
					f[v].first*=f[w].first+f[w].second;
					f[v].second*=f[w].second;
					f[v].first%=MOD;
					f[v].second%=MOD;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1368
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;
const ll INF = INT_MAX;

struct SegmentTree{
    private:
        int n;
        vector<int> node;

    public:
        SegmentTree(vector<int> v){
            int sz = v.size();
            n = 1;while(n < sz)n *= 2;
            node.resize(2*n-1,0);

            rep(i,sz)node[i+n-1] = v[i];
            for(int i = n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
        }

        void add(int x,int val){
            x += (n - 1);

            node[x] += val;
            while(x > 0){
                x = (x - 1) / 2;
                node[x] = node[x*2+1] + node[x*2+2];
            }
        }

        int getsum(int a, int b, int k = 0, int l = 0, int r = -1){
            if(r < 0) r = n;

            if(r <= a || b <= l) return 0;

            if(a <= l && r <= b) return node[k];

            int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
            int vr = getsum(a, b, k*2+2, (l+r)/2, r);
            return vl+vr;
        }
};

int main(){
    int n,q;cin >> n >> q;
    vector<int> xy[q];
    rep(i,q){
        int com,x,y;cin >> com >> x >> y;
        // xy[i] = {com,x,y};
        xy[i].pb(com);xy[i].pb(x);xy[i].pb(y);
    }

    vector<int> a(n,0);
    SegmentTree seg(a);

    rep(i,q){
        int com,x,y;
        com = xy[i][0];x = xy[i][1];y = xy[i][2];
        if(com) cout << seg.getsum(x-1,y) << endl;
        else seg.add(x-1,y);
    }

    return 0;
}


Measured memory_bytes: 10220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  int a = 0;
  if( s.at(0) == 'o' ){
    a++;
  }
  if( s.at(1) == 'o' ){
    a++;
  }
  if( s.at(2) == 'o' ){
    a++;
  }
  
  cout << 700+100*a << endl;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long monsterHP = scan.nextLong();
		long servalATK = scan.nextLong();
		scan.close();

		long mod = monsterHP % servalATK;
		long ans  = monsterHP / servalATK;
		if (mod > 0) {
			ans ++;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 0
//{
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
 
//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}
int a,b,c;
main(){
	cin>>a;
  	for(b;b*111<a;b++);
  dump(b*111);
}

Measured memory_bytes: 256
def main():
    s = str(input())
    n = len(s)
    
    # is_kai = partA == partB
    if not is_kai(s):
        print('No')
        return

    partA = s[:int(((n-1)/2))]
    if not is_kai(partA):
        print('No')
        return
    
    partB = s[:int((n+1)/2)-1:-1]
    if not is_kai(partB):
        print('No')
        return
    
    print('Yes')
    return

def is_kai(word):
    n = len(word)
    if not n % 2 == 0:
        pa = word[:int((n-1)/2)]
        pb = word[:int((n+1)/2)-1:-1]
        return pa == pb
    else:
        pa = word[:int(n/2)]
        pb = word[:int(n/2)-1:-1]
        return pa == pb
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define mod 998244353
#define N 200010
using namespace std;
ll n;
int check(ll x)
{
    ll t=n;
    while(t%x==0)
    {
        t=t/x;
    }
    t=t%x;
    if(t==1)
    {
        return 1;
    }
    else
        return 0;
}

int main()
{
    cin>>n;
    if(n==2)
    {
        cout<<1<<endl;
    }
    else
    {
        ll res=2,t=n-1;
        for(ll i=2; i*i<=t; i++)
        {
            if(t%i==0)
            {
                res++;
                if(i*i!=t)
                {
                    res++;
                }
            }
        }
        for(ll i=2; i*i<=n; i++)
        {
            if(n%i==0)
            {
                res=res+check(i);
                if(i*i!=n)
                {
                    res=res+check(n/i);
                }
            }
        }
        cout<<res<<endl;
    }
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll i,n,a,g;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    rep(i,0,n){
        cin>>a;
        g = __gcd(g,a);
    }
    cout<<g;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

template < typename T >
struct WeightedUnionFind {
    vector<int> p, size, height;
    vector<T> diff_weight;

    WeightedUnionFind(){}
    WeightedUnionFind(int n) {
        size.resize(n, 1);
        height.resize(n, 1);
        diff_weight.resize(n, 0);
        p.resize(n);
        for (int i=0; i<n; i++) p[i] = i;
    }

    int root(int i) {
        // iの親を求めるついでに差分の累積もとる
        if (p[i] == i) return i;
        else {
            int r = root(p[i]);
            diff_weight[i] += diff_weight[p[i]];
            return p[i] = r;
        }
    }

    T weight(int i) {
        // iの重みを取得する
        root(i);  // 経路圧縮
        return diff_weight[i];
    }

    T diff(int i, int j) {
        if (root(i) != root(j)) return HIGHINF;
        // iとjの重みの差分をとる
        return weight(j) - weight(i);
    }

    bool same(int i, int j) {
        // iとjが同じグループかどうかを判別する
        return root(i) == root(j);
    }

    void unite(int i, int j, T w) {
        // iとjを併合する, wは重みの差weight[j]-weight[i]
        // rootとの間に辺をつなぐので単純にwで増減じゃダメ
        w += weight(i); w -= weight(j);
        int pi=root(i), pj=root(j);
        if (pi == pj) return;
        if (height[pi] < height[pj]) {
            w = -w;
            p[pi] = pj;
            size[pj] += size[pi];
            diff_weight[pi] = w;
        } else {
            p[pj] = pi;
            size[pi] += size[pj];
            diff_weight[pj] = w;
            if (height[pi] == height[pj]) height[pi]++;
        }
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    WeightedUnionFind<ll> uni(n);
    int com, x, y;
    ll z;
    for (int i=0; i<q; i++) {
        cin >> com;
        if (com == 0) {
            cin >> x >> y >> z;
            uni.unite(y, x, z);
        } else {
            cin >> x >> y;
            if (!uni.same(x, y)) cout << "?\n";
            else cout << uni.diff(y, x) << '\n';
        }
    }
    return 0;
}



Measured memory_bytes: 4948
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7, K = 625 + 325 + 1, Z = 325;
int n, k, dp[2][51][51][K];
// [-325, 625]

void add(int & x, int y) {
	x += y;
	if (x >= MOD) {
		x -= MOD;
	}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> k;
	if (k & 1) {
		cout << 0;
		return 0;
	}
	k /= 2;
	k += Z;
	dp[0][0][0][Z] = 1;
	for (int i = 1; i <= n; i++) {
		int p = i & 1;
		for (int j = 0; j <= i; j++) {
			for (int k = 0; k <= j; k++) {
				for (int s = 0; s < K; s++) {
					int & res = dp[p][j][k][s];
					res = 0;
					if (j > 0 && s + i < K) {
						add(res, dp[p ^ 1][j - 1][k][s + i]);
					}
					if (k > 0 && s - i >= 0) {
						int x = (j - (k - 1));
						int y = (ll)x * x % MOD;
						add(res, (ll)dp[p ^ 1][j][k - 1][s - i] * y % MOD);
					}
					if (j > 0 && k > 0) {
						int x = ((j - 1) - (k - 1));
						add(res, (ll)dp[p ^ 1][j - 1][k - 1][s] * x % MOD);
					}
					int none = i - (j + k);
					int J = j + none;
					int K = k + none;
					
					if (J - (K - 1) > 0) {
						add(res, (ll)dp[p ^ 1][j][k][s] * (J - (K - 1)) % MOD);
					}
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		add(ans, dp[n & 1][i][i][k]);
	}
	cout << ans;
}


Measured memory_bytes: 17664
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>        P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// メイン
int main()
{
	string a, b;
	cin >> a >> b;

	sort(ALL(a));
	sort(ALL(b));
	reverse(ALL(b));

	string ans = "No";
	if (a < b) {
		ans = "Yes";
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code
vector<int> p;
map<int, int> mp;
bool pp[N];
void primes(int n)
{
  pp[1] = 1;
  repn(i, 1, n)
  {
    if(pp[i] == 0){
      p.pb(i);
      for(int j = i*i; j<=n; j += i)
      {
        pp[j] = 1;
      }
    }
  }
}

void factors(int n)
{
  for(int x: p)
  {
    int cnt = 0;
    while(n%x == 0){
      cnt++;
      n = n / x;
    }
    mp[x]+= cnt;
  }
}

int main()
{
  int n;
  cin>>n;
  primes(n);
  repn(i, 1, n)
  {
    factors(i);
  }
  ll ans = 1;
  for(int x: p)
  {
    //cout<<x<<" "<<mp[x]<<endl;
    ans = (ans * (mp[x]+1))%M;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12672
import java.util.Scanner;

public class Main{
    public static void main (String []args){
       Scanner sc = new Scanner(System.in);
       double r =sc.nextDouble();
       double pi=Math.PI;

       double area=r*r*pi;
       double length=2*r*pi;
       System.out.printf("%f %f",area,length);
       sc.close();
    }
}



Measured memory_bytes: 28332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<ll>
#define f(i,a,b) for(ll i=a;i<b;i++)
#define r(i,b,a) for(ll i=b-1;i>=a;i--)
#define pq_min priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define pq_max priority_queue<pair<ll,ll>>
#define forx(i,a,b) for(ll i=a;i<b;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
typedef pair<pp,pp> ppll;
const ll mod=998244353;
const ld pi = 3.14159265359;
const ll N=100005;

ll power(ll a,ll b)
{
    ll res=1;
    a%=mod;
    while(b>0)
    {
        if(b%2==1)
        {
            res = (res * a)%mod;
        }
        b/=2;
        a = (a*a)%mod;
    }
    return res;
}


int main()
{
  fast;
  ll n;
  cin>>n;
  vector<ll> p;
  for(ll i=2;i*i<=n;i++)
  {
     ll c=0;
     while(n%i==0)
     {
       c++;
       n/=i;
     }
     if(c!=0) p.pb(c);
  }
  if(n!=1) p.pb(1);
  ll ans=0;
  for(ll i=0;i<p.size();i++)
  {
     ll g=1;
     while(p[i]>=g)
     {
        p[i] -= g;
        g++;
        ans++;
     }
  }
  cout<<ans;
}

Measured memory_bytes: 3644
n = int(input())
l = [int(i) for i in input().split()]

cnt = 0
while l.count(0) < n:
    for i in range(n):
        if (i > 0 and l[i-1] == 0 and l[i] == 0) or (i == 0 and l[i] == 0):
            continue
        if l[i] == 0 or i == n-1:
            cnt += 1
    l = [k-1 if k > 0 else k for k in l]

print(cnt)


Measured memory_bytes: 3060
n,m=map(int,input().split())
inf=100000000
wf=[[inf]*n for i in range(n)]
wf_sub=[[inf]*n for i in range(n)]
for i in range(n):
    wf[i][i]=0
    wf_sub[i][i]=0
for i in range(m):
    a,b,c=map(int,input().split())
    wf[a-1][b-1]=c
    wf_sub[a-1][b-1]=c
    wf[b-1][a-1]=c
    wf_sub[b-1][a-1]=c
'''
for i in range(n):
    print(wf[i])
for i in range(n):
    print(wf_sub[i])
'''

for k in range(n):
    for i in range(n):
        for j in range(n):
            wf[i][j]=min(wf[i][j],wf[i][k]+wf[k][j])
cnt=0
for i in range(n):
    for j in range(n):
        if wf_sub[i][j]!=0 and wf_sub[i][j]!=inf:
            if wf[i][j]!=wf_sub[i][j]:
                cnt+=1

'''
for i in range(n):
    print(wf[i])
for i in range(n):
    print(wf_sub[i])
'''

print(cnt//2)


Measured memory_bytes: 3444
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

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

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

int main() {
	int n;
	cin >> n;
	int ans = n % 1000;
	if (ans == 0) {
		cout << 0 << endl;
	} else {
		cout << 1000 - ans << endl;
	}
	return 0;
}

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

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

    int ans = 0;
    for(int i=0; i<n; i++){
        int l, r;
        cin >> l >> r;
        ans += (r - l + 1);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n, a[100], cnt = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n - 1; i > 0; i--) {  
    for (int j = n - 1; j > 0; j--) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        cnt++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    i == n - 1 ? printf("%d\n", a[i]) : printf("%d ", a[i]);
  }
  printf("%d\n", cnt);
  return 0;
}



Measured memory_bytes: 3228
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

ll N, W;
vector<ll> weight(110), value(110);
vector<vector<ll>> memo(110, vector<ll>(100010, -1));

ll solve(ll n, ll w)
{
    if (memo.at(n).at(w) != -1)
    {
        return memo.at(n).at(w);
    }
    if (n == N)
    {
        return memo.at(n).at(w) = 0;
    }
    if (w - weight.at(n) < 0)
    {
        return memo.at(n).at(w) = solve(n + 1, w);
    }
    else
    {
        ll res1 = solve(n + 1, w);
        ll res2 = solve(n + 1, w - weight.at(n)) + value.at(n);
        return memo.at(n).at(w) = max(res1, res2);
    }
}

int main()
{
    cin >> N >> W;
    rep(0, i, N)
    {
        cin >> weight.at(i) >> value.at(i);
    }

    memo.at(0).at(0) = 0;

    cout << solve(0, W) << endl;
}

Measured memory_bytes: 90172
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

cnt = 0

for i in T:
    left = 0
    right = n - 1
    while left < right:
        mid = (left + right) // 2
        if i == S[mid]:
            cnt += 1
            break
        elif i < S[mid]:
            right = mid
        else:
            left = mid + 1
            if left == right:
                if i == S[left]:
                    cnt += 1
                    break

print(cnt)


Measured memory_bytes: 16708
n,m=map(int,input().split())
s=input()
l=[0]
x,y=0,0
for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":x+=1
    l.append(x)
l.append(x)
for i in range(m):
    a,b=map(int,input().split())
    print(l[b-1]-l[a-1])

Measured memory_bytes: 6100
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    string S; cin >> S;

    vector<int> R(N+1),G(N+1),B(N+1);
    rep(i,N) {
        if (S[i]=='R') R[i] = 1;
        else if (S[i]=='G') G[i] = 1;
        else B[i] = 1;
    }
    for (int i = N-1; i >= 0; i--) {
        R[i] += R[i+1];
        G[i] += G[i+1];
        B[i] += B[i+1];
    }

    ll ans = 0;
    rep(i,N) {
        for (int j = i+1; j < N; j++) {
            if (S[i]=='R' and S[j]=='G') {
                ans += B[j+1];
                int p = j-i;
                if (j+p < N and S[j+p] == 'B') ans--;
            }
            if (S[i]=='G' and S[j]=='B') {
                ans += R[j+1];
                int p = j-i;
                if (j+p < N and S[j+p]=='R') ans--;
            }
            if (S[i]=='B' and S[j]=='R') {
                ans += G[j+1];
                int p = j-i;
                if (j+p < N and S[j+p]=='G') ans--;
            }
            if (S[i]=='G' and S[j]=='R') {
                ans += B[j+1];
                int p = j-i;
                if (j+p < N and S[j+p] == 'B') ans--;
            }
            if (S[i]=='B' and S[j]=='G') {
                ans += R[j+1];
                int p = j-i;
                if (j+p < N and S[j+p]=='R') ans--;
            }
            if (S[i]=='R' and S[j]=='B') {
                ans += G[j+1];
                int p = j-i;
                if (j+p < N and S[j+p]=='G') ans--;
            }
        }
    }

    cout << ans << ln;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    ll cnt = 0;
    vector<int> A(N);
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    vector<ll> accum(N);
    accum[0] = A[0];
    for(int i = 1;i < N;i++){
        accum[i] = A[i] + accum[i-1];
    }
    map<ll,ll> mp;
    for(int i = 0;i < N;i++){
        mp[accum[i]]++;
    }
    for(auto p:mp){
        if(p.first){
            cnt += p.second * (p.second-1) / 2;
        }else{
            cnt += p.second * (p.second-1) / 2 + p.second;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 15104
#include<stdio.h>
int main(){
  int a, b, c, i, ans;
  scanf ("%d %d %d", &a, &b, &c);

  for (i = a; i <= b; i++) {
    if (c % i == 0) {
      ans++;
    }
  }
  printf ("%d\n", ans);

  return 0;
}


Measured memory_bytes: 2100
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  vector<int> height_of_mountains(10);
  for (int i = 0; i < 10; i++) {
    cin >> height_of_mountains[i];
  }

  sort(height_of_mountains.begin(), height_of_mountains.end());

  for (int i = 0; i < 3; i++) {
    cout << height_of_mountains[10 - 1 - i] << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, i;
    ll d;
    cin >> n >> d;
    d = d*d;
    int ans = 0;
    for(i=0;i<n;i++){
        ll x,y;
        cin >> x >> y;
        ll tmp = x*x + y*y;
        if(tmp <= d) ans++;
    }
    cout << ans << "\n";
    return 0;
}


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

class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        long res = 1;
        long[] a = new long[26];
        foreach (var i in s)
        {
            a[i - 'a']++;
        }
        for (int i = 1; i < 26; i++)
        {
            for (int j = 0; j < i; j++)
            {
                res += a[j] * a[i];
            }
        }
        Console.WriteLine(res);
    }
}

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

#define mo 1000000007
long long int dp[3005][3005];

long long int solve(long long int arr[],int start,int end)
{
	if(start > end )
		return 0;

	if(dp[start][end] != 0)
	{
		return dp[start][end];
	}

	dp[start][end] =  max(arr[start] + min(solve(arr,start+2,end),solve(arr,start+1,end-1)),arr[end] + min(solve(arr,start+1,end-1),solve(arr,start,end-2)));
	return dp[start][end];
}
int main()
{
	int n;
	cin>>n;
	long long int arr[n];
	long long int sum = 0;
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
		sum = sum + arr[i];
	}
	memset(dp,0,sizeof(dp));
	long long int a = solve(arr,1,n);
	long long int b = sum - a;
	long long int c = a-b;
	cout<<c<<endl;
}

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

using namespace std;
int main(){
	int h, n, sum = 0;
	cin >> h >> n;
	int a[n];
	for(int i = 0; i < n; i++)
	    cin >> a[i];

    for(int j = 0; j < n; j++)
		sum += a[j];
	if(sum >= h)
	    cout << "Yes\n";
	else
	    cout << "No\n";
	return 0;
}        	


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

int main() {
  string S;
  cin >> S;
  
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == S.at(i + 1)) {
      cout << "Bad" << endl;
      break;
    }
    else if (i == 2) {
      cout << "Good" << endl;
    }
  }
}

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

import static java.lang.Integer.parseInt;

/**
 * Look for the Winner!
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			line = br.readLine();

			Candidate[] idx = new Candidate['Z' - 'A' + 1];
			List<Candidate> list = new ArrayList<>();
			list.add(new Candidate('\0'));

			//solve
			Candidate c = null;
			int d = -1;

			for (int i = 0, j = 1; i < line.length(); i += 2, j++) {
				int _c = line.charAt(i) - 'A';
				if (idx[_c] == null) {
					idx[_c] = new Candidate((char) (_c + 'A'));
					list.add(idx[_c]);
				}
				idx[_c].vote++;

				Collections.sort(list);

				if (list.get(0).vote > list.get(1).vote + n - j) {
					c = list.get(0);
					d = j;
					break;
				}
			}

			if (c != null) {
				System.out.printf("%c %d%n", c.name, d);
			} else {
				System.out.println("TIE");
			}
		} //end while

	} //end main
}

class Candidate implements Comparable<Candidate> {
	char name;
	int vote = 0;

	Candidate(char name) {
		this.name = name;
	}

	@Override
	public int compareTo(Candidate o) {
		return Integer.compare(o.vote, this.vote);
	}
}

Measured memory_bytes: 35100
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define vpii vector< pair<int,int> >
#define mii map<int,int>
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int x,y;
cin>>x>>y;
if((y-2*x)>=0 && (y-2*x)%2==0 && (y-2*x)/2<=x)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;

return 0;
}
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)



Measured memory_bytes: 3648
a, b, c, k = map(int, input().split())
ans = 0
now = 0
if a > k:
    print(k)
    exit()
else:
    ans += a
    k -= a

if b > k:
    print(ans)
    exit()
else:
    k -= b

if c > k:
    ans += -1*k
    print(ans)
    exit()
else:
    ans += -1*c

print(ans)


Measured memory_bytes: 9132
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int r, g, b; cin >> r >> g >> b;
    if ((r*100+g*10+b)%4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] h = {'L', 'R'};

        for(int i = 0; i < s.length; i++) {
        	if(s[i] == h[i%2]) {
        		System.out.println("No");
        		return;
        	}
        }

        System.out.println("Yes");

        return;
    }

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll N, K;
    cin >> N >> K;
    if (N % K == 0) cout << 0;
    else if (K % N == 0) cout << N;
    else if (K > N){
        if (K / N == 1) cout << abs(N - K);
        else if (K / N > 1) cout << N;
    }
    else if (N > K){
        ll mod = N % K;
        if (mod > K / 2) cout << K - mod;
        else cout << mod;
    }
    return 0;
}


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

typedef struct {
  double x;
  double y;
} point;

int main() {
  point a, b, c, d;
  int n;
  cin >> n;
  while (n--) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    point p, q;
    p.x = b.x - a.x;
    p.y = b.y - a.y;
    q.x = d.x - c.x;
    q.y = d.y - c.y;

    if (-1e-10  < p.x * q.y - p.y * q.x && p.x * q.y - p.y * q.x < 1e-10)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
////////////////////////////////////////

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    int n,m;cin>>n>>m;
    string s;cin>>s;
    int c[n][2];memset(c,0,sizeof(c));
    vector<int>e[n];
    rep(i,0,m-1){
        int a,b;cin>>a>>b;a--;b--;
        e[a].pb(b);
        e[b].pb(a);
        if(s[a]=='A'){
            c[b][0]++;
        }else{
            c[b][1]++;
        }
        if(s[b]=='A'){
            c[a][0]++;
        }else{
            c[a][1]++;
        }
    }
    bool use[n];memset(use,true,sizeof(use));
    vector<int>que;
    rep(i,0,n-1){
        if(c[i][0]==0||c[i][1]==0){
            que.pb(i);
            use[i]=false;
        }
    }
    for(int b=0;b<que.size();b++){
        int k=0;if(s[que[b]]=='B')k=1;
        for(int x:e[que[b]]){
            c[x][k]--;
            if(c[x][k]==0&&use[x]){
                use[x]=false;
                que.pb(x);
            }
        }
    }
    rep(i,0,n-1){
        if(c[i][0]>0&&c[i][1]>0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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


int main(){
  string str; cin >> str; ll n,s,w,e;  n=0; s=0; w=0; e=0;
  
  for(ll i=0; i < str.size(); i++){
    if(str[i] == 'N') n++;
    else if(str[i] == 'S') s++;
    else if(str[i] == 'W') w++;
    else e++;
  }
  
  if((n!=0&&s!=0)||(n==0&&s==0)){
    if((w!=0&&e!=0)||(w==0&&e==0)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else cout << "No" << endl;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int m[100010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    int ans = 0;
    REP(i,n-1){
        ans += a[i+1] - a[i];
    }
    cout<<ans<<endl;
    return 0;
}

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


int main(){
   char c;
   cin >> c;
   if(c=='A') cout << 'T' <<endl;
   if(c=='T') cout << 'A' <<endl;
   if(c=='G') cout << 'C' <<endl;
   if(c=='C') cout << 'G' <<endl;
   return 0;
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ll LCM(int a, int b){
    return a*b/gcd(a,b);
}

int main(void)
{
    int n;
    cin>>n;
    map<ll,int,greater<int>> a;
    rep(i,0,n){
        int in;
        cin>>in;
        a[in]++;
    }

    vector<ll> num;
    ll ans=0;
    for(auto i:a){
        if(i.second>=4){
            ans=max(ans,i.first*i.first);
        }
        if(i.second>=2){
            num.push_back(i.first); 
        }
        if(num.size()==2){
            ans=max(ans,num[0]*num[1]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> gr(n);
    for(int i = 0; i < n; i++)
    cin >> gr[i];
    vector<vector<char>> grid(n);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            grid[i].emplace_back(gr[i][j]);
        }
    }
    set<int> k,l;
    for(int i = 0; i < n; i++){
        bool white = 1;
        for(int j = 0; j < m; j++){
            if(grid[i][j] == '#')
            white = 0;
        }
        if(white)
        k.insert(i);
    }
    for(int i = 0; i < m; i++){
        bool white = 1;
        for(int j = 0; j < n; j++){
            if(grid[j][i] == '#')
            white = 0;
        }
        if(white)
        l.insert(i);
    }
    for(int i = 0; i < n; i++){
        int cnt =0;
        for(int j = 0; j < m; j++){
            if(!l.count(j) && !k.count(i)){
            cout << grid[i][j];
            cnt++;
            }
        }
        if(cnt)
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    int l[30];
    int max = -1;
    int total = 0;
    for(int i = 0; i < n; i++){
        cin >> l[i];
        if(l[i] > max) max = l[i];
        total += l[i];
    }
    //cout << max << total << endl;

    if(max < (total - max)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

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

	if (n < 2) cout << 0 << endl;
	else if (n % 2 == 0) {
		ll ans = 0;
		ll m = 10;
		while (n >= m) {
			ans += (n / m);
			m *= 5;
		}
		cout << ans << endl;
	}
	else if (n % 2 == 1) {
		cout << 0 << endl;
	}

	return 0;
}

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


vector<pair<int, int>> combinartions(int s, int e) {
    vector<pair<int, int>> ans;
    for (int i = s; i < e; i++) {
        for (int j = i + 1; j <= e; j++) {
            ans.push_back(make_pair(i, j));
        }
    }
    return ans;
}


int main(){
    int N, K; cin >> N >> K;
    if (((N - 1) * (N - 2) / 2) < K) {
        cout << "-1" << endl;
        return 0;
    }

    vector<pair<int, int>> edges;
    for (int i = 2; i <= N; i ++) {
        edges.push_back(make_pair(1, i));
    }

    int diff = (N - 1) * (N - 2) / 2 - K;
    vector<pair<int, int>> comb = combinartions(2, N);
    for (int i = 0; i < diff; i++) {
        edges.push_back(comb[i]);
    }

    cout << edges.size() << endl;
    for (auto u_v : edges) {
        cout << u_v.first << " " << u_v.second << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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 factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
    // abピザの方が安いパターン
    if ((a+b)>c*2) {
        ll cost = 0;
        ll ab1 = min(x, y), ab2 = max(x, y);
        cost += c * ab1 * 2;
        x -= ab1; y -= ab1;
        if (x > 0) cost += x * a;
        if (y > 0) cost += y * b;
        chmin(cost, c*ab2*2);
        cout << cost << endl;
    } else {
        cout << a * x + b * y << endl;
    }
    return 0;
}

Measured memory_bytes: 256