akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define FORN(i, x, y) for (int i = x; i <= y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define scan1(X) scanf("%d", &X)
#define scan2(X, Y) scanf("%d%d", &X, &Y)
#define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z)
#define scan4(X, Y, Z, W) scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define scanl1(X) scanf("%lld", &X);
#define scanl2(X, Y) scanf("%lld%lld", &X, &Y)
#define scanl3(X, Y, Z) scanf("%lld%lld%lld", &X, &Y, &Z)
#define scanl4(X, Y, Z, W) scanf("%lld%lld%lld%lld", &X, &Y, &Z, &W)
#define print1(X) printf("%d\n", X);
#define print2(X, Y) printf("%d %d\n", X, Y);
#define print3(X, Y, Z) printf("%d %d %d\n", X, Y, Z);
#define print4(X, Y, Z, W) printf("%d %d %d %d\n", X, Y, Z, W);
#define printl1(X) printf("%lld\n", X);
#define printl2(X, Y) printf("%lld %lld\n", X, Y);
#define printl3(X, Y, Z) printf("%lld %lld %lld\n", X, Y, Z);
#define printl4(X, Y, Z, W) printf("%lld %lld %lld %lld\n", X, Y, Z, W);
#define max3(X, Y, Z) max(X, max(Y, Z))
#define max4(X, Y, Z, W) max(max(X, Y), max(Z, W))
#define min3(X, Y, Z) min(X, min(Y, Z))
#define min4(X, Y, Z, W) min(min(X, Y), min(Z, W))
#define popcount(X) __builtin_popcount(X)
#define all(x) x.begin(), x.end()
#define size(X) (int)X.size()
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define lc(x) 2 * x
#define rc(x) 2 * x + 1
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pldld;
const long long l_inf = numeric_limits<long long>::max();
const long long l_ninf = numeric_limits<long long>::min();
const int inf = numeric_limits<int>::max();
const int ninf = numeric_limits<int>::min();
const double pi = 1.00 * acos(-1.00);
const double eps = 1e-8;
void cio(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
int sq( int x ) {return x * x;}
////////////////////////////////////////////////////////////////////Header
const int maxn = 1e5 + 5;
int n, m;
ll dp[105][maxn];
int w[maxn], v[maxn];

int main () {
    scan2(n, m);
    FORN(i, 1, n) scan2(w[i], v[i]);
    FORN(i, 1, n) {
        FORN(j, 0, m) {
            if ( j >= w[i] ) dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    printl1(dp[n][m]);
}

Measured memory_bytes: 81788
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
// #define PI 3.14159265

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    float x = m/(float)60;
    // out1(x);
    // out1(cos(60));
    long double ans = sqrt(a*a + b*b - 2*a*b*cos(((- 6*m + 30*(h+x))*M_PI)/(double)180));

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

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 4220
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-c)<=d||abs(a-b)<=d&&abs(b-c)<=d)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}










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

typedef vector<int> vi;  
typedef pair<int,int> ii;  
typedef vector<ii> vii;  
typedef list<int> li;  
typedef unordered_map<int,int> mii;

#define ll long long
#define rep(i,n) for (int i = 0; i < (n); i++)  
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rap(i,a,n) for (int i = a; i < (n); i++) 
#define rrap(i,n,a) for (int i = (n)-1; i >= a; i--) 


int main() {
    ios_base::sync_with_stdio(false);
    int n;
    bool flag=false;
    cin >> n;
    rap(i,1,10) {
        rap(j,1,10) {
            if (i*j == n) {
                flag=true;
                break;
            }
        }
        if (flag) break;
    }
    if (flag) cout << "Yes\n";
    else cout << "No\n";
    return 0;

    //compile: g++ -std=c++14 -O2 -Wall -g NAME.cpp -o NAME
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};

signed main() {
	int n, k;
	bool sp = 0;
	while (scnaf("%d %d", &n, &k)) {
		if (n == 0)
			break;
		vector<int> num(k);
		REP(i, k) {
			scanf("%d", &num[i]);
			if (!num[i])
				sp = 1;
		}
		sort(ALL(num));
		if (sp)
			num.erase(num.begin());
		int cou = 1;
		vector<pii> ren;
		REP(i, num.size() - 1) {
			if (num[i + 1] - num[i] == 1) {
				cou++;
			}
			else {
				ren.push_back({ cou, num[i] });
				cou = 1;
			}
		}
		ren.push_back({ cou, num[num.size() - 1] });
		int ans = 0;
		REP(i, ren.size()) {
			ans = max(ans, ren[i].first + sp);
		}
		if (sp && ren[0].first == n)
			ans--;
		if (sp) {
			REP(i, ren.size() - 1) {
				if (ren[i + 1].second- ren[i+1].first+1 - ren[i].second == 2) {
					ans = max(ans, ren[i + 1].first + 1 + ren[i].first);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3464
//#pragma comment(linker, "/STACK:102400000,102400000") 
#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 2e5 + 5;
const ll mod = 1000;
const double PI = acos(-1.0);
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }

int main()
{

	string s = "CODEFESTIVAL2016";
	string res;
	int ans = 0;
	cin >> res;
	rep(i, 0, res.length())
	{
		if (res[i] != s[i])
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll n, k;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;

  ll ans;
  ans = min((n % k), (abs(k - (n % k))));

  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

int main() {
    int n,a;
    ll x[55][2555];
    cin>>n>>a;
    vector<int> v(n+1);
    for(int i=1;i<=n;i++){
		cin>>v[i];
	}
	x[0][0]=1;
	int val=0;
	for(int i=1;i<=n;i++){
		for(int i2=i-1;i2>=0;i2--){
			for(int j=val;j>=0;j--){
				x[i2+1][j+v[i]]+=x[i2][j];
			}
		}
		val+=v[i];
	}
	ll sum=0;
	for(int i=1;i<=n;i++){
		sum+=x[i][i*a];
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 1280
from collections import defaultdict

def main():
    N = int(input())
    D = list(map(int, input().split()))
    MOD = 998244353
    for i, d in enumerate(D):
        if (i == 0 and d != 0) or (i > 0 and d == 0):
            print(0)
            exit()
    set_D = list(set(D))
    set_D.sort()
    cnt = 0
    for i in set_D:
        if cnt == i:
            cnt += 1
        else:
            print(0)
            exit()

    A = defaultdict(int)
    for d in D:
        A[d] += 1

    cnt = 1
    pre = 0
    for key, value in A.items():
        if key == 0 or key == 1:
            pre = value
        else:
            cnt *= pre ** value 
            cnt %= MOD
            pre = value
    print(cnt)

    

    


if __name__ == "__main__":
    main()

Measured memory_bytes: 63208
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	string s;
	int n,m,count;
	while(scanf("%d",&n)){
		if(n==0)
		break;
		string s1="IOI";
		scanf("%d",&m);
		cin >> s;
		for(int i=1;i<n;i++){
			s1.push_back('O');
			s1.push_back('I');
		}
		count = 0;
		for(int i=0;i<m;i++){
			if(s.substr(i,s1.size())==s1)
			count++;
		}
		printf("%d\n",count);
	}
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}
vector<Int> dp;
bool VIS[MAXN];

void dfs(int u){
    VIS[u]=true;
        for(auto &v:adj[u]){
            if(!VIS[v])
                dfs(v);
            dp[u]=max(dp[u],1+dp[v]);
        }
}

int main()
{
     cin>>N>>M;
     for(int i=0;i<M;++i){
         int u,v;
         cin>>u>>v;
         u--;v--;
         adj[u].pb(v);
     }
     memset(VIS,0,sizeof(VIS));
     dp.resize(N);
     fill(dp.begin(),dp.end(),0);
     for(int i=0;i<N;++i){
         if(VIS[i]) continue;
         dfs(i);
     }
     Int ans=0;
     for(int i=0;i<N;++i){
         ans=max(ans,dp[i]);
     }
     cout<<ans<<'\n';
}


Measured memory_bytes: 32876
#include <iostream>


const int MAXNUM = 500000;
const int SENTINEL = 2000000000;
int A[MAXNUM];
int L[MAXNUM / 2 + 2];
int R[MAXNUM / 2 + 2];
int cnt = 0;

void merge(int *A, int left, int mid, int right) {
    int nl = mid - left;
    int nr = right - mid;
    for (int i = 0; i < nl; i++) {
        L[i] = A[left + i];
    }
    for (int i = 0; i < nr; i++) {
        R[i] = A[mid + i];
    }
    L[nl] = SENTINEL;
    R[nr] = SENTINEL;
    int li = 0, ri = 0;
    for (int i = left; i < right; i++) {
        cnt ++;
        if (L[li] <= R[ri]) {
            A[i] = L[li++];
        } else {
            A[i] = R[ri++];
        }
    }

}

void mergeSort(int *A, int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}


int main (int argc, char **argv) {
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> A[i];
    }
    mergeSort(A, 0, n);
    for (int i = 0; i < n; i++) {
        if (i) std::cout << " ";
        std::cout << A[i];
    }
    std::cout << std::endl;
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 6980
sx, sy, tx, ty = map(int, input().split())

'''
route1 : R * (tx - sx) -> U * (ty - sy)
route2 : L * (tx - sx) -> D * (ty - sy)
route3 : D * 1 -> R * (tx - sx + 1) -> U * (ty - sy + 1) + L * 1
route4 : U * 1 -> L * (ty - sy + 1) -> D * (tx - sx + 1) + R * 1
'''

ans = []
sax = tx - sx
say = ty - sy

for i in range(sax):
    ans.append('R')

for i in range(say):
    ans.append('U')

for i in range(sax):
    ans.append('L')
    
for i in range(say):
    ans.append('D')

ans.append('D')

for i in range(sax + 1):
    ans.append('R')

for i in range(say + 1):
    ans.append('U')

ans.append('L')

ans.append('U')

for i in range(sax + 1):
    ans.append('L')

for i in range(say + 1):
    ans.append('D')

ans.append('R')

print(''.join(ans))


Measured memory_bytes: 3188
#include <iostream>

int main(){
    int n = 0, d = 0;
    std::cin >> n >> d;

    int i = 1;
    int count = 0;
    while(i<=n){
        ++count;
        i += 2*d+1;
    }
    std::cout << count << std::endl;

    return 0;
}


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

void fnInput(int& rnMaxNum)
{
  cin >> rnMaxNum;
}

int64_t fnIntGet(const vector<char>& cnrvcNum)
{
  const vector<int> cnvnDgt = {0, 3, 5, 7};
  int64_t nRtn = 0;
  int nNumPos = 0;

  for (int i = cnrvcNum.size() - 1; i >= 0; i--)
  {
    if (cnrvcNum[i] == '0') break;
    nRtn += cnvnDgt[ cnrvcNum[i] - '0' ] * pow(10.0, nNumPos++);
  }

  return nRtn;
}

bool fnDgt753_Check(const vector<char>& cnrvcNum)
{
  int nDgt3Cnt = 0;
  int nDgt5Cnt = 0;
  int nDgt7Cnt = 0;

  for (int i = cnrvcNum.size() - 1; i >= 0; i--)
    if      (cnrvcNum[i] == '1') nDgt3Cnt++;
    else if (cnrvcNum[i] == '2') nDgt5Cnt++;
    else if (cnrvcNum[i] == '3') nDgt7Cnt++;

  if (nDgt3Cnt && nDgt5Cnt && nDgt7Cnt)
    return true;
  else 
    return false;
}

int fnDgt753_Count(int nMaxNum)
{
  int nDgt753Cnt = 0;
  int nDgtSiz = to_string(nMaxNum).size();
  vector<char> vcNum(nDgtSiz + 1, '0');

  while (true)
  {
    vcNum[vcNum.size() - 1]++;
    for (int i = vcNum.size() - 1; i > 0; i--)
      if (vcNum[i] > '3')
      {
        vcNum[i - 1]++;
        vcNum[i] = '1';
      }

    if (fnIntGet(vcNum) > nMaxNum) break;
    if (fnDgt753_Check(vcNum)) nDgt753Cnt++;
  }

  return nDgt753Cnt;
}

int main()
{
  int nMaxNum;

  fnInput(nMaxNum);
  cout << fnDgt753_Count(nMaxNum) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

        int l;
        cin >> l;
        int i,j,k;
        double a,b,c;
         j=l/3;
        a=j;
        b=a;
        c=a;
        i=l%3;
        if(i==1){
            double r=1.00/(3.00);
            a=a+r;
            b=b+r;
            c=c+r;
        }
        else if(i==2){
            double r=2.000/3.000;
            //trace(r);
            a=a+r;
            b=b+r;
            c=c+r;
        }
        double ans=a*b*c;
        cout << setprecision(12) << fixed << ans ;
        

}

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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N, K;
int A[110000], dp[60][2];

signed main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++)cin >> A[i];
    for (int i = 0; i < 59; i++) {
        int z = 0, o = 0;
        for (int j = 0; j < N; j++) {
            if ((A[j] & (1LL << i)) == 0)z++;
            else o++;
        }
        if ((K & (1LL << i)) == 0)dp[i][0] = dp[i - 1][0] + (o << i);
        else dp[i][0] = max(dp[i - 1][0] + (z << i), dp[i - 1][1] + (o << i));
        dp[i][1] = dp[i - 1][1] + (max(z, o) << i);
    }
    cout << dp[58][0] << endl;

}

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

string f[8];
int dx[12] = {0,0,0,-1,-2,-3,0,0,0,1,2,3};
int dy[12] = {-1,-2,-3,0,0,0,1,2,3,0,0,0};

void bomb(int x, int y){
	for(int i=0 ; i < 12 ; i++ ){
		int mx = x + dx[i];
		int my = y + dy[i];
		if( mx < 0 || my < 0 || mx >= 8 || my >= 8 ) continue;
		if( f[my][mx] == '1' ){
			f[my][mx] = '0';
			bomb( mx , my );
		}
	}
}

int main(){
	int n;
	cin >> n;
	for(int t=1 ; t <= n ; t++ ){
		int x,y;

		for(int i=0 ; i < 8 ; i++ ){
			cin >> f[i];
		}
		cin >> x >> y;
		x--;
		y--;
		f[y][x] = '0';
		bomb( x , y );
		cout << "Data " << t << ":" << endl;
		for(int i=0 ; i < 8 ; i++ ){
			cout << f[i] << endl;
		}
	}
}

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

int n, k, p[200001];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

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

    int ans = 0;
    for(int i = k; i <= n; i++) {
        ans = max(ans, p[i]-p[i-k]);
    }

    cout << fixed << setprecision(9) << (double)(ans+k)/2.0;
    return 0;
}



Measured memory_bytes: 1024
### constant

FEES = [
  [   0,  300,  500,  600,  700, 1350, 1650],
  [ 300,    0,  350,  450,  600, 1150, 1500],
  [ 500,  350,    0,  250,  400, 1000, 1350],
  [ 600,  450,  250,    0,  250,  850, 1300],
  [ 700,  600,  400,  250,    0,  600, 1150],
  [1350, 1150, 1000,  850,  600,    0,  500],
  [1650, 1500, 1350, 1300, 1150,  500,    0]
]

DISTS = [0, 6, 13, 18, 23, 43, 58]

### global variables

### subroutines

def discount?(h, m)
  (h == 17 && m >= 30 || h == 18 || h == 19 && m <= 30)
end

### main

while true
  ic0 = gets.strip.to_i
  break if ic0 == 0

  h0, m0 = gets.strip.split(' ').map{|s| s.to_i}
  ic1 = gets.strip.to_i
  h1, m1 = gets.strip.split(' ').map{|s| s.to_i}

  ic0 -= 1
  ic1 -= 1

  fee = FEES[ic0][ic1]

  if (discount?(h0, m0) || discount?(h1, m1)) &&
      (DISTS[ic1] - DISTS[ic0]).abs <= 40
    fee = (fee / 100) * 50 + (fee % 100 != 0 ? 50 : 0)
  end

  puts fee
end

Measured memory_bytes: 6120
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 4e5 + 10;

int a[N];
ll sum[N];

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-') ch = getchar();
	if(ch == '-') flag = -1,ch = getchar();
	while(isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

int main() {

	int L = read(),n = read();
	For(i,1,n) a[i] = read(),sum[i] = sum[i - 1] + a[i];
	a[n + 1] = L,sum[n + 1] = sum[n] + L;
	For(i,n + 2,n + n + 1) a[i] = a[i - n - 1] + L,sum[i] = sum[i - 1] + a[i];
	ll ans = 0;
	For(i,0,n) {
		ll cur = 0,cnt = min(i,n - i); //zuo -> i + 1,you -> i + n + 1
		cur = abs(max(a[i + n + 1 - cnt] - L,L - a[i + cnt + 1]));
		int pos = (cur == a[i + n + 1 - cnt] - L) ? i + n + 1 - cnt : i + cnt + 1;
		cur += 2 * ((sum[i + n + 1] - sum[i + n + 1 - cnt]) - (sum[i + cnt] - sum[i]));
		cur -= min(a[pos] - a[i + 1],a[i + n + 1] - a[pos]);
//		cur = 2 * (sum[n + i + 1] - sum[n + i + 1 - cnt] - (sum[i + cnt] - sum[i]));
//		cout << cur << " " << i << " " << n - i << endl;
//		debug(cnt);
		chkmax(ans,cur);
	}

	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
   return b == 0 ? a : gcd(b, a % b);
}

int main(int argc, char **argv)
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);

#ifdef LOCAL_DEFINE
   freopen("in.txt", "r", stdin);
#endif

   ll a, b, c, d, cd;
   cin >> a >> b >> c >> d;
   cd = c * d / gcd(c, d);

   ll ans = 0;
   ans += b / c - (a - 1) / c;
   ans += b / d - (a - 1) / d;
   ans -= b / cd - (a - 1) / cd;

   cout << b - a + 1 - ans << '\n';

   return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

vector<vpll> to;
vll dist;

void dfs(ll cur,ll pre,ll d){
	dist[cur]=d;
	for(auto&& next:to[cur]){
		if(next.first==pre) continue;
		dfs(next.first,cur,d+next.second);
	}
}

int main()
{
	ll n;
	cin >> n;
	to.resize(n);
	dist.resize(n);
	rep(i,n-1){
		ll a,b,c;
		cin >> a >> b >> c;
		a--;
		b--;
		to[a].emplace_back(b,c);
		to[b].emplace_back(a,c);
	}
	ll q,k;
	cin >> q >> k;
	k--;
	dfs(k,-1,0);
	vll ans(q);
	rep(i,q){
		ll x,y;
		cin >> x >> y;
		x--;
		y--;
		ans[i]=dist[x]+dist[y];
	}
	for(auto&& e:ans) cout << e << endl;
	return 0;
}


Measured memory_bytes: 15104
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
#include<iomanip>
#include<algorithm>
#include<map>
#include<math.h>
#include<string.h>
#define ll long long
#define eb emplace_back
#define pb push_back
#define ins insert 
#define mp make_pair
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define inf 1000000000000000000
using namespace std;
const ll M =1e9+7;
ll maxVal=1e5+1;
vector<vector<ll> > v(maxVal);
pair<ll,ll> dfs(ll a, ll b){//first is number of ways current can be is black
    ll allWhites=1;//current can be black
    ll someBlacks=0;
    for (int i : v[a])
    {
        if(i!=b){
            pair<ll,ll> p =dfs(i,a);
            someBlacks=((p.first%M * allWhites%M)%M+(someBlacks*(p.first+p.second)%M)%M)%M;
            allWhites=(allWhites%M*p.second%M)%M;
        }
    }
    return(mp(allWhites,(someBlacks+allWhites)%M));
}
void solve(){
    ll n,x,y;
    cin>>n;
    v.resize(n+1);
    for (int i = 1; i < n; ++i)
    {
        cin>>x>>y;
        v[x].eb(y);
        v[y].eb(x);
    }
    pair<ll,ll> p =dfs(1,0);
    cout<<(p.second+p.first)%M<<endl;

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1,t1=1;
    //cin>>t;
    while(t--){
        //cout<<"Case #"<<t1++<<": ";        
        solve();
    }
    return 0 ;
}

Measured memory_bytes: 12672
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;cin>>N;
    int m = -1;
    for(int i=1;i<=N;i++){
        if(i*(i+1)/2==N) m=i;
    }
    if(m==-1){
        cout<<"No"<<endl;
        return 0;
    }
    //cout<<m<<endl;
    vector<vector<int>> ans(m+1);
    int idx1=0,idx2=1,j=1;
    for(int i=m;i>=1;i--){
        for(int k=0;k<i;k++,j++){
            ans[idx1].push_back(j);
            ans[idx2].push_back(j);
            idx2++;
        }
        idx1++;
        idx2=idx1+1;
    }
    cout<<"Yes"<<endl;
    cout<<m+1<<endl;
    REP(i,m+1){
        cout<<ans[i].size();
        for(auto j:ans[i]) cout<<" "<<j;
        cout<<endl;
    }
}


Measured memory_bytes: 2304
#include<stdio.h>

int main()
{
	int h1, m1, h2, m2, k;
	int difference = 0;
	scanf("%d%d%d%d%d", &h1, &m1, &h2, &m2, &k);
	difference = ((h2 * 60 + m2) - (h1 * 60 + m1)) - k;
	printf("%d", difference);
	return 0;
}

Measured memory_bytes: 2148
#include <stdio.h>

int main() {
  int x, y;
  while (1) {
    scanf("%d%d", &x, &y);
    if (x == 0 && y == 0) break;
    if (x < y) printf("%d %d\n", x, y);
    else printf("%d %d\n", y, x);
  }
}


Measured memory_bytes: 2660
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.stream.IntStream;

public class Main {

    // Multiple of 9
    public static String multipleOfNine(String Number){
        int sumOfDigits = 0;
        String[] digits2 = Number.split("(?<=.)");
        for (int i = 0; i <digits2.length ; i++) {
            sumOfDigits += Integer.parseInt(digits2[i]);
        }
        return sumOfDigits%9 == 0 ? "Yes": "No";
    }

    public static void main(String[] args) {
        InputStreamReader in = new InputStreamReader(System.in);
        BufferedReader bufferedReader = new BufferedReader(in);
        try {
            String input = bufferedReader.readLine();
            String[] inputsArrays = input.split(" ");
            String N = inputsArrays[0];
            System.out.println(multipleOfNine(N));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 42844
(N,),r,*L=$<.map{|l|l.split.map &:to_i};l=(n=*0..N).map{[1e9]*N*2};L.map{|a,b,c|l[a][b]=l[b][a]=c};n.map{|k|n.map{|i|n.map{|j|(l[i][j]>t=l[i][k]+l[k][j])&&l[i][j]=t}}};p r.permutation.map{|a|s=0;a.each_cons(2){|b,c|s+=l[b][c]};s}.min

Measured memory_bytes: 71364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<double> a(n);
    double s = 0;
    for(int i = 0;i < n;i ++){
        cin >> a[i];
        s += 1/a[i];
    }
    cout << std::setprecision(10) << 1/s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		// a < b < c
		for (int i = 0; i < k; i++) {
			if (a >= b) {
				b *= 2;
			} else {
				c *= 2;
			}
		}
		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 35656
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, m = na()
div = []
for i in range(1, int(m**0.5)+1):
    if m % i == 0:
        j = m // i
        #i * j = n
        if i >= n:
            div.append(j)
        if j >= n:
            div.append(i)

print(max(div))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int l;
  cin >> l;
  double ans = pow(l / 3.0, 3);
  printf("%.8f\n", ans);
  return 0;
}

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

using namespace std;

const int N = 55;

int n;
double a[N];

int main() {

	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}
	double ans = 0;
	sort(a + 1, a + n + 1);
	for (int i = 1; i < n; i ++) {
		ans = 1.0 * (a[i] + a[i + 1]) / 2;
		a[i + 1] = ans;
	}
	cout << setprecision(9) << fixed << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
x = input()
n = x.count("N")
w = x.count("W")
s = x.count("S")
e = x.count("E")
if (n == 0 and s != 0) or (n != 0 and s == 0) or (w == 0 and e != 0) or (w != 0 and e == 0):
    print("No")
else:
    print("Yes")



Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
	
	public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			int n = sc.nextInt();
			String s= sc.next();
			int index;
			int rednum=0;
			int bluenum=0;
			// 文字列の入力
			for(index=0;index<n;index++) {
				if(s.substring(index,index+1).equals("R")) {
					rednum++;
					}
				else {
					bluenum++;
				}
			}
			if(rednum>bluenum) {
		    	System.out.println("Yes");
		    }
			else {
		    	System.out.println("No");
		    }
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int N;
int c[212345];
vector<int> g[212345];
int last_p[212345]; // 色 i の最も近い祖先
ll ans[212345];
int child[212345]; // 自身を含んだ子孫の数
int cnt[212345];
int c_cnt[212345]; // 色 i でカウントした個数

void dfs(int u, int p) {
	int pr_lp = last_p[c[u]];
	last_p[c[u]] = u;
	child[u] = 1;
	
	++c_cnt[c[u]];
	
	for (int v : g[u]) {
		if (v == p) continue;
		cnt[u] = 0; // v の部分木のうち色 i でカウントされた頂点数
		dfs(v, u);
		child[u] += child[v];
		
		// child[v] - cnt[u] が 連結成分の個数
		int tarc = child[v] - cnt[u];
		c_cnt[c[u]] += tarc;
		
		ans[c[u]] += (ll)tarc * (tarc - 1) / 2;
	}
	
	last_p[c[u]] = pr_lp;
	if (pr_lp != -1) cnt[pr_lp] += child[u];
}

int main() {
	cin >> N;
	REP(i, N) scanf("%d", c + i), --c[i];
	REP(i, N - 1) {
		int a, b;
		scanf("%d %d", &a, &b);
		--a; --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	
	memset(last_p, -1, sizeof(last_p));
	dfs(0, -1);
	
	REP(i, N) {
		c_cnt[i] = N - c_cnt[i];
		ans[i] += (ll)c_cnt[i] * (c_cnt[i] - 1) / 2;
	}
	ll s = (ll)N * (N - 1) / 2;
	REP(i, N) ans[i] = s - ans[i];
	REP(i, N) ++ans[c[i]];
	
	REP(i, N) printf("%lld\n", ans[i]);
	
	return 0;
}


Measured memory_bytes: 39228
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>  // https://boostjp.github.io/tips/math.html
#include <boost/dynamic_bitset.hpp>  // https://boostjp.github.io/tips/dynamic_bitset.html

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t N, M;
    std::cin >> N >> M;

    struct P {
        int64_t a;
        int64_t b;
    };

    int64_t ans = 0;

    std::vector<P> p;
    for (decltype(M) i = 0; i < M; ++i) {
        int64_t a, b;
        std::cin >> a >> b;
        a--;
        b--;
        p.push_back({a, b});
    }

    for (int64_t i = 0; i < M; ++i) {
        // i: skipするインデックス

        boost::multi_array<bool, 2> mat(boost::extents[N][N]);
        std::fill(mat.data(), mat.data() + mat.num_elements(), false);
        for (int64_t j = 0; j < M; ++j) {
            if (i == j) {
                continue;
            }
            mat[p[j].a][p[j].b] = true;
            mat[p[j].b][p[j].a] = true;
        }

        boost::dynamic_bitset<> visited(N);

        auto dfs = [&mat, &visited, N](auto DFS, int64_t n) -> void
            {
                if (visited[n]) {
                    return ;
                }
                visited[n] = true;
                for (int64_t i = 0; i < N; ++i) {
                    if (mat[n][i]) {
                        DFS(DFS, i);
                    }
                }
            };

        dfs(dfs, 0);

        if (visited.size() != visited.count()) {
            ans++;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <bits/stdc++.h>
#define N 1000010
#define ls x << 1
#define rs x << 1 | 1
#define inf 1000000000000000000
#define inc(i) (++ (i))
#define dec(i) (-- (i))
// #define mid ((l + r) >> 1)
#define int long long
#define XRZ 998244353
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
int dx[10] = {1, -1, 0, 0};
int dy[10] = {0, 0, 1, -1};
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar();
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
string s;
signed main() {
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
def GCD(a, b):
    while b:
        a, b = b, a % b
    return a

a, b = map(int, input().split())
n = GCD(a,b)
i = 2
table = []
while i * i <= n:
    while n % i == 0:
        n = n // i
        table.append(i)
    i += 1
if n > 1:
    table.append(n)
print(len(set(table))+1)

Measured memory_bytes: 3064
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(char &c){
  int i;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
template<class T, class S> int arrCountVal(int N, T A[], S val){
  int i;
  int res = 0;
  for(i=(0);i<(N);i++){
    if(A[i]==val){
      res++;
    }
  }
  return res;
}
int main(){
  char S[5];
  rd(S);
  if(arrCountVal(3,S,'7')){
    wt_L("Yes");
    wt_L('\n');
  }
  else{
    wt_L("No");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200418-1

// --- original code ---
// {
//   char S[5];
//   rd(S);
//   wt(if[arrCountVal(3,S,'7'), "Yes", "No"]);
// }


Measured memory_bytes: 3592
/*
* welcome to my code!
* ------------------------------------------
* author : lynmisakura(twitter : @andoreiji11)
*/

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

using ll = long long;

#define REP(i,n) for(int i = 0;i < n;i++)
#define all(x) x.begin(),x.end()
#define dup(x,y) (x + y - 1)/y
#define sz(v) (int)v.size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

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

ll ans[10100];

int f(int x,int y,int z){
  return x * x + y * y + z * z + x * y + y * z + z * x;
}
void func(int n){
  for(int x = 1;x * x <= n;x++){
    for(int y = 1;y * y + x * x + x * y<= n;y++){

      int lb = 1,ub = 300;
      while(lb + 1 != ub){
        int mid = (lb + ub)/2;
        if(f(x,y,mid) <= n) lb = mid;
        else ub = mid;
      }

      if(f(x,y,lb) == n)ans[n]++;
    } 
  } 
}

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

    for(int i = 1;i <= 10000;i++) func(i);

    int n;cin >> n;
    for(int i = 1;i <= n;i++)cout << ans[i] << '\n';

}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>

const int m=998244353;
using namespace std;

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}





int32_t main(){
	
	//FIO();
	
		int n;cin>>n;
		int array[n],dp[n];
		for(int i=0; i<n; i++){
			cin>>array[i];
		}
		for(int i=0; i<n; i++)
			dp[i]=1e9;
		dp[0]=0;
		for(int i=0; i<n; i++){
			dp[i+1]=min(dp[i+1],dp[i]+abs(array[i]-array[i+1]));
			dp[i+2]=min(dp[i+2],dp[i]+abs(array[i]-array[i+2]));
		}
		cout<<dp[n-1]<<"\n";
	

	

	return 0;
		
	
		
		
}


Measured memory_bytes: 1792
object Main {
    def main(args:Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        while(sc.hasNextInt) {
            val n = sc.nextInt
            println(primes(n).mkString(" "))
        }
   }
    def primes (n: Int): List[Int] =  {
        var i = n - 1
        while(!is_prime(i)) i -= 1
        var j = n + 1
        while(!is_prime(j)) j += 1
        List(i, j)
    }
    def is_prime (n: Int): Boolean = (2 to math.sqrt(n).toInt).toList.forall(x => n % x != 0)
}

Measured memory_bytes: 45356
class UnionFindTree:
    """Union-Find Tree

    Attributes:
        n (int):    頂点数
        par (list): 要素の格納先
    """
    def __init__(self, n):
        """初期化 O(1)

        Args:
            n (int): 頂点数
        """
        self.par = [-1] * n

    def find(self, x):
        """要素の検索 O(α(N))

        Args:
            x (int): 対象要素

        Returns:
            int: xの根
        """
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]


    def union(self, x, y):
        """要素の併合 O(1)

        Args:
            x (int): 併合対象の集合に属する要素
            y (int): 併合対象の集合に属する要素
        """
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return

        if self.par[x] > self.par[y]:
            x, y = y, x

        self.par[x] += self.par[y]
        self.par[y] = x

    def same(self, x, y):
        """要素の判定 O(1)

        Args:
            x (int): 判定対象の要素
            y (int): 判定対象の要素

        Returns:
            bool: xとyが同じ集合に属するか否か
        """
        return self.find(x) == self.find(y)
    
    def size(self, x):
        """要素数の計算 O(1)

        Args:
            x (int): 対象要素

        Returns:
            int: xが属する集合の要素数
        """
        return -self.par[self.find(x)]


n, m = map(int, input().split())

uf = UnionFindTree(n)

for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)

s = set()
for i in range(n):
    x = uf.find(i)
    if x not in s:
        s.add(x)

print(len(s) - 1)

Measured memory_bytes: 80564
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#define REP(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int, int> P;

class team{
public:
	int id,uni,ac,pe;
	team(int _id,int _uni, int _ac, int _pe){
		id=_id; uni=_uni; ac=_ac; pe=_pe;
	}
	
	bool operator<(const team& t) const{
		if(ac>t.ac) return true;
		else if(ac==t.ac && pe<t.pe) return true;
		else if(ac==t.ac && pe==t.pe && id<t.id) return true;
		else return false;
	}
};

int main(void) {
	int n;
	while(cin>>n,n){
		vector<team> vt;
		for(int i=0;i<n;i++){
			int id,uni,ac,pe;
			cin>>id>>uni>>ac>>pe;
			vt.push_back(team(id,uni,ac,pe));
		}
		sort(vt.begin(),vt.end());
		//for(int i=0;i<n;i++) cout<<vt[i].id<<" ";
		//cout<<endl;
		
		
		int sum=0;
		vector<int> adv(1001,0);
		for(int i=0;i<n;i++){
			if(sum<10 && adv[vt[i].uni]<3){sum++; adv[vt[i].uni]++; cout<<vt[i].id<<endl;}
			else if(sum<20 && adv[vt[i].uni]<2){sum++; adv[vt[i].uni]++; cout<<vt[i].id<<endl;}
			else if(sum<26 && adv[vt[i].uni]<1){sum++; adv[vt[i].uni]++; cout<<vt[i].id<<endl;}
		}
	}
	
	return 0;
	

	
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string board[60];
  for (int i = 0; i < H; i++) cin >> board[i];

  int dx[4] = {-1, 0, 1, 0};
  int dy[4] = {0, 1, 0, -1};
  
  bool ans = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (board[i][j] == '.') continue;
      bool ok = false;
      for (int k = 0; k < 4; k++) {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x < 0 || x >= H || y < 0 || y >= W) continue;
        if (board[x][y] == '#') ok = true;
      }
      if (!ok) {
        ans = false;
        break;
      }
    }
    if (!ans) break;
  }

  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
s = STDIN.gets
s.chomp!
n = s.split(' ')
n[0] = n[0].to_i(16)
n[1] = n[1].to_i(16)
if n[0] < n[1]
	puts "<"
elsif n[0] > n[1]
	puts ">"
else
	puts "="
end


Measured memory_bytes: 1788