akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	while(1) {
		int e;
		cin>>e;
		if(e == 0) break;
		ll res = INF;
		for(ll i = 0; i * i * i <= e; ++i) {
			for(ll j = 0; j * j <= e - i * i * i; ++j) {
				res = min(res, (e - i * i * i - j * j) + i + j);
			}
		}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 3052
#include <iostream>
#include<algorithm>
#include <string>
using namespace std;
int main() {
	long long int H, W;
	cin >> H >> W  ;
	if ((H==1)||(W==1)) {
		cout << 1;
	}
	else {
	if (H % 2 == 0) {
		cout << H * W / 2;
	}
	else {
		cout << H * W - H * W / 2;
	}
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
ll gcd(ll x, ll y) {
  if(x > y)
    return gcd(y, x);
  else if(x == 0)
    return y;
  else
    return gcd(y % x, x);
}
ll lcm(ll x, ll y) {
  ll g = gcd(x, y);
  return g * (x / g) * (y / g);
}
int main() {
  ll A, B;
  cin >> A >> B;
  cout << lcm(A, B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

int solve()
{
    int N;

    std::cin >> N;

    int sum = 0;

    vector<int> v = fetch_vec<int>(N);

    for (int i = 0; i < N; ++i) {
        sum += v[i];
    }

    int mid = sum / N;

    int stamina1 = 0;
    for (int i = 0; i < N; ++i) {
        stamina1 +=  (v[i] - mid) * (v[i] - mid);
    }

    ++mid;
    int stamina2 = 0;
    for (int i = 0; i < N; ++i) {
        stamina2 += (v[i] - mid) * (v[i] - mid);
    }

    return min(stamina1, stamina2);
}

int main()
{
    std::cout << solve() << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <bitset>  
using namespace std;

//======================================================
#define for1(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for2(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define forr1(i,n)  for (int i = n - 1 ;i <= 0; --i)
#define forr2(i,n)  for (int i = n  ;i < 0; --i)
#define all(v)	   ((v).begin()), ((v).end())
#define allr(v)	   ((v).rbegin()), ((v).rend())
#define clr(v,d)   memset(v, d, sizeof(v))
#define ull        unsigned long long
#define MP(a,b)	   make_pair(a,b)
#define S          second
#define F          first
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define bgn        begin
#define N          100000+5
#define	MOD        1e9+7
#define inf        1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;
}
//======================================================


int n;
int knapsackWeight;
int weights[100+5];
long long  benfits[100 + 5];
long long dp  [100000 + 5][100+5];
long long knapsack(int index , int reminderWeight)
{

	if (index == n)
		return 0;

	if (dp[reminderWeight][index] != -1)
		return dp[reminderWeight][index];

	long long r;
	r = knapsack(index + 1 , reminderWeight);
	if (reminderWeight >= weights[index])
	{
		r = max(knapsack(index + 1, reminderWeight - weights[index])+ benfits[index] , r);
	}
	dp[reminderWeight][index] = r;
	return r;
}


int main()
{
	cin >> n >> knapsackWeight;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		long long b;
		cin >> b;
		weights[i] = a;
		benfits[i] = b;
	}
	for (int i = 0; i < 100000 + 5; i++)
	{
		for (int x = 0; x < 100+5; x++)
		{
			dp[i][x] = -1;
		}
	}

	cout << knapsack(0 , knapsackWeight);
}



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

int main() {
    int N;
    string s;
    bool flag = false;
    cin >> N;

    for(int i = 0; i < N; i++) {
        cin >> s;
        if(s == "Y") {
            flag = true;
        }

    }
    if(flag) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }

}

Measured memory_bytes: 3628
n,K=(int(i) for i in input().strip().split(" "))
x=[int(i) for i in input().strip().split(" ")]
m=1000000000000000000000
for i in range(n-K+1):
    k=-x[i]+x[i+K-1]+min(abs(x[i]),abs(x[i+K-1]))
    if k<m:
        m=k
print(m)

Measured memory_bytes: 84768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 3003;

int p, a[MAXN], inv[MAXN];
int mpow (int bs, int ep) {
    ll ret = 1;
    while (ep) {
        if (ep&1) {
            ret = ret * bs % p;
        }
        bs = bs * bs % p;
        ep >>= 1;
    }
    return ret;
}

int cur[MAXN], tmp[MAXN];
void mul (int c) {
    memset(tmp, 0, sizeof(tmp));
    c = p - c;
    REP (i, p+1) {
        tmp[i] += cur[i] * c % p;
        tmp[i+1] += cur[i];
    }
    REP (i, p+1) {
        cur[i] = tmp[i] % p;
    }
}

int sum[MAXN], res[MAXN];
void divi (int c) {
    int lst = cur[p];
    for (int i=p-1; i>=0; i--) {
        sum[i] = lst;
        lst = (c * lst + cur[i]) % p;
    }
}
/*********************GoodLuck***********************/
int main () {
    IOS();
    cin >> p;
    REP1 (i, p-1) {
        inv[i] = mpow(i, p-2);
    }

    cur[0] = 1;
    REP (i, p) {
        cin >> a[i];
        mul(i);
    }
#ifdef tmd
    REP (i, p+1) {
        cout << cur[i] << " \n"[i==p];
    }
#endif

    REP (i, p) {
        if (a[i]) {
            int dv = 1;
            REP (j, p) {
                if (i != j) {
                    dv = dv * (i-j) % p;
                }
            }
            if (dv < 0) {
                dv += p;
            }
            dv = mpow(dv, p-2);

            divi(i);
            debug(i);
#ifdef tmd
    for (int i=0; i<p; i++) cout << sum[i] << " \n"[i==p-1];
#endif
            REP (j, p) {
                (res[j] += sum[j] * dv) %= p;
            }
        }
    }

    REP (i, p) {
        cout << res[i] << " \n"[i==p-1];
    }

    REP (i, p) {
        int aa = 0;
        REP (j, p) {
            aa = (aa + res[j]*mpow(i, j)) % p;
        }
        debug(aa, a[i], i);
        assert(aa == a[i]);
    }


}


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

int main() {
  string s,t;
  cin >> s >> t;
  int c = 0;
  for (int i = 0;i < 3;i++) {
    if(s.at(i) == t.at(i)){
      c++;
    }
  }
  cout << c <<endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n,m;
    int arr[100];
    cin>>n>>m;
  int sm =0;
    for(int i=0;i<n;i++){
     cin>>arr[i];
    
    sm += arr[i];
    }

    int cnt =0;
    for(int i =0;i<n;i++){
        if((arr[i]*4*m) >=sm )
         cnt++;
    }
    if(cnt>= m)
    cout<<"Yes";
    else 
    cout<<"No";
    
    
}

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

int main() {
    int n, m;
    cin >> n >> m;
    Graph G(n);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans=0;
    vector<int> v(n-1);
    rep(i,n-1) v[i]=i+1;
    do {
        int pr=0;
        for(int i=0; i<n-1; i++){
            bool ok=false;
            for(auto u : G[pr]){
                if(u==v[i]) ok=true;
            }
            if(ok && i==n-2){
                ++ans;
            }else if(ok && i!=n-2){
                pr=v[i];
            }else{
                break;
            }
        }
    } while(next_permutation(v.begin(),v.end()));
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
using ll=long long;
int main()
    {
        int t;
        cin>>t;
        if(t>=1200)
        {
            cout<<"ARC"<<endl;
        }
        else{
            cout<<"ABC"<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
import java.util.*;
class Main{
public void yatary() {
	Scanner sc = new Scanner(System.in);
	int i;
	int x = sc.nextInt();
	int [] num = new int [x];
	for(i=0; i<x; i++){
		num[i] = sc.nextInt();
	}
	for(i=x-1; i>=0; i--){
		if(i != 0){
		System.out.print(num[i] + " ");
		}else{
			System.out.println(num[i]);
		}
	}
}
public static void main(String[]args){
	new Main().yatary();
}
}

Measured memory_bytes: 18972
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef pair<ll , pair<ll, ll> > pi;
int pow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}   
struct Compare {
    constexpr bool operator()(pi const & a,
                              pi const & b) const noexcept
    { return a.first < b.first || (a.first == b.first && a.second.first > b.second.first); }
 
};
void prefix_function( string s,ll arr[] )
{
     long long border=0; arr[0]=0;
    for(long long i=1;i<s.size();i++)
    {
      while(border>0 && s[i]!=s[border])
        border=arr[border-1];
     
     if(s[i]==s[border])
         border++;
      else
       border=0;
      
      arr[i]=border;
    }
}//send mod-2 for a^-1 if mod is a prime number

ll mod=998244353;
ll add( ll a , ll b)
{
    return (((a%mod)+(b%mod))%mod);
}
ll mul(ll a,ll b)
{
  return (((a%mod)*(b%mod))%mod);
}
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}
ll subs(ll a,ll b)
{
    return (((a%mod)-(b%mod)+mod)%mod);
}
ll dv(ll a,ll b)
{
    ll inv=binpow(b,mod-2);
    return mul(a,inv);
}

ll dsu_arr[100000];
ll dsu_sz[100000];
void dsu(ll n)
{
    for(ll i=0;i<=n;i++)
    {
        dsu_arr[i]=i;
        dsu_sz[i]=1;
    }
}
ll find(ll x)
{
     ll root=x;
    while (root!=dsu_arr[root])
    {
        root=dsu_arr[root];
    }
    while(x!=dsu_arr[x])
    {
        dsu_arr[x]=root;
        x=dsu_arr[x];
    }
    return root;
}
ll merge(ll x,ll y)
{
    ll root1=find(x);
    ll root2=find(y);
    
    if(root1==root2)
    return 0ll;
 
    if(dsu_sz[x]>dsu_sz[y]){
    dsu_arr[root2]=root1;
    dsu_sz[root1]+=dsu_sz[root2];
    }
    else
    {
         dsu_sz[root2]+=dsu_sz[root1];
        dsu_arr[root1]=root2;
    }
    return 1ll;
}
/*
vector<ll>adj[100005];
bool vis[100005];
ll dist[100005];
void bfs(ll c)
{
  vis[c]=true;
  dist[c]=0;
  q.push(c);
while(!q.empty())
{
    ll x=q.front();
    q.pop();
   
    for(ll i=0;i<adj[x].size();i++)
    {
        ll y=adj[x][i];
        if(!vis[y])
        {
            vis[y]=true;
            dist[y]=dist[x]+1;
            
            q.push(y);
        }
    }
 
}
}
*/

int main()
{
    Fast
ll n;
cin>>n;
vector<ll>sura;
vector<ll>mura;
for(ll i=0;i<n;i++)
{
    ll u,v;
    cin>>u>>v;
    sura.push_back(u+v);
    mura.push_back(u-v);
}
sort(sura.begin(),sura.end());
sort(mura.begin(),mura.end());
cout<<max(sura[n-1]-sura[0],mura[n-1]-mura[0])<<endl;


}



   
      
    
        



Measured memory_bytes: 6688
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [0 for _ in range(s+1)]
dp[0] = 1

for i in range(n):
    plus = [dp[j-a[i]]  if j-a[i] >=0 else 0 for j in range(s+1)]
    for j in range(s+1):
        dp[j] = (dp[j]*2 +plus[j])%mod

print(dp[s])

Measured memory_bytes: 72020
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    input1, input2 = input().split()
    p.append(int(input1))
    s.append(input2)

correct = [0] * n
penalty = [0] * n
for i in range(m):
    tgt = p[i] - 1
    if correct[tgt] == 1:
        continue
    if s[i] == 'AC':
        correct[tgt] += 1
    elif s[i] == 'WA':
        penalty[tgt] += 1

for i in range(m):
    tgt = p[i] - 1
    if correct[tgt] == 0:
        penalty[tgt] = 0

print('{0} {1}'.format(sum(correct), sum(penalty)))


Measured memory_bytes: 15324
s=input()

ans='Yes'
for i in range(len(s)):
	if(i%2 == 0):
		#奇数
		if(s[i]=="L"):
			ans="No"
			break
	else:
		#偶数
		if(s[i]=="R"):
			ans="No"
			break
print(ans)


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

int main() {
    int x, y; cin >> x >> y;
    //           0   1  2  3  4  5  6  7  8  9  10 11 12
    int a[13] = {-1, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0};
    cout << (a[x] == a[y] ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int a,b,n,i;
	string s1,s2;
	cin>>s1>>s2;
	n=s2.size();
	int zh1(string q);
	int zh2(int c,int d,int p);
	a=zh1(s1);
	b=zh1(s2);
	if (sqrt(zh2(a,b,n))==int(sqrt(zh2(a,b,n))))
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}
int zh1(string q)
{
	int o=0;
	for (int i=0;i<q.size();i++)	o=o*10+(q[i]-'0');
	return o;	
}
int zh2(int c,int d,int p)
{
	int r;
	if (p==1)	  r=c*10+d;
	if (p==2)	 r=c*100+d;
	if (p==3)	r=c*1000+d;
	return r;
}

Measured memory_bytes: 256
//By Longqiang 2020-06-29
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
using namespace std;

#define MAX_N 100005
#define REP(i,a,b) for(int i=(a); i<(b); i++)

int N,Q;
int Head[MAX_N], Next[MAX_N*2], To[MAX_N*2], Color[MAX_N*2], Weight[MAX_N*2];
int tot, t;
int Fa[MAX_N][20], Dept[MAX_N], Dist[MAX_N];

void add_edge(int u,int v, int c, int w){
	To[++tot]=v;
	Next[tot] = Head[u];
	Color[tot] = c;
	Weight[tot] = w;
	Head[u] = tot;
}
//预处理  bfs法
void bfs(){
	queue<int> q;
	q.push(1);
	Dept[1] = 1;
	while(q.size()){
		int x=q.front();
		q.pop();
		for(int i=Head[x]; i; i=Next[i]){
			int y = To[i];
			if(Dept[y]) continue;
			Dept[y] = Dept[x]+1;
			Dist[y] = Weight[i] + Dist[x];
			Fa[y][0] = x;
			for(int j=1; j<=t; j++){
				Fa[y][j] = Fa[Fa[y][j-1]][j-1];
			}
			q.push(y);
		}
	}
}
//预处理  dfs法
void dfs(int cur, int fa, int d){
	for(int i=Head[cur]; i; i=Next[i]){
		int y = To[i];
		if(y == fa) continue;
		Dept[y] = Dept[cur]+1;
		Dist[y] = Dist[cur] + Weight[i];
		Fa[y][0] = cur;
		for(int i=t; i>=0; i--){
			Fa[y][i] = Fa[Fa[y][i-1]][i-1];
		}
		dfs(y,cur, d+1);
	}
}

struct Query{
	int color, w, coe, id;
};
vector<Query> Que[MAX_N];
int ans[MAX_N];
int Num[MAX_N*2], Value[MAX_N*2];

int lca(int x, int y){
	if(Dept[x]>Dept[y]) swap(x,y);
	for(int i=t; i>=0; i--){
		if(Dept[Fa[y][i]]>=Dept[x]) y= Fa[y][i];
	}
	if(x==y) return x;
	for(int i=t; i>=0; i--){
		if(Fa[x][i] != Fa[y][i]){
			x = Fa[x][i];
			y = Fa[y][i];
		}
	}
	return Fa[x][0];
}

void dfs2(int u, int fa){
	for(int i=0; i<Que[u].size(); i++){
		Query query = Que[u][i];
		ans[query.id] += (Dist[u] + Num[query.color]*query.w - Value[query.color])*query.coe;
		/*
		printf("ans[%d]=Dist[%d](%d)+___ = %d\n", query.id, u, Dist[u],ans[query.id]);
		printf("Num[%d]=%d\n", query.color, Num[query.color]);
		printf("Value[%d]=%d\n", query.color, Value[query.color]);
		printf("query.w = %d\n", query.w);
		printf("\n");
		*/
	}

	for(int i=Head[u]; i; i=Next[i]){
		int y = To[i];
		if(y==fa) continue;
		Num[Color[i]]++;
		Value[Color[i]] += Weight[i];
		dfs2(y,u);
		Num[Color[i]]--;
		Value[Color[i]] -= Weight[i];
	}
}

int main() {
	cin>>N>>Q;
	//t = (int)(log(N)/log(2))+1;
	t = 18;
	
	REP(i,0,N-1){
		int u,v,c,w;
		cin>>u>>v>>c>>w;
		add_edge(u,v,c,w);
		add_edge(v,u,c,w);
	}
	
	bfs();
	//Dept[1] = 1;
	//dfs(1,-1,1);
	
	REP(i, 1, Q+1){
		int x,y,u,v;
		cin>>x>>y>>u>>v;
		
		Que[u].push_back(Query{x,y,1,i});
		Que[v].push_back(Query{x,y,1,i});
		Que[lca(u,v)].push_back(Query{x,y,-2,i});
		//printf("%d\n", Dist[u]+Dist[v] - 2*Dist[lca(u,v)]);
	}
	
	dfs2(1,-1);
	
	REP(i, 1, Q+1){
		printf("%d\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 27488
#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+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    int a,b;
    cin >> a >> b;
    bool flag = true;
    REP1(i,2500){
        //cout << i;
        if(floor(i*0.08)==a and floor(i*0.1) == b){
            cout << i << endl;
            flag = false;
            break;
        }
    }
    if(flag) cout << -1 << endl;
    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
void stupid(){
    unsigned long long N;
    std::cin>>N;
    std::string ans="";
    // N=N-1;
    while(N>=1){
        N=N-1;
        ans=(char)(N%26+(int)('a'))+ans;
        N=N/26;
    }
    std::cout<<ans;
}

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

Measured memory_bytes: 3592
def mainFunc():
    alphabets = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    N = int(input())
    S = list(input())
    ans = ''

    for s in S:
        n = (alphabets.index(s) + N) % 26
        ans += alphabets[n]
    
    print(ans)

mainFunc()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

struct edge{
    int to;
    ll cost;
};
struct query{
    int from, to;
};

vector<vector<edge>> edges;
vector<ll> d;

void dfs(int vertex, ll cost, int parent=-1){
    d[vertex] = cost;
    for (auto e : edges[vertex]){
        if (e.to == parent) continue;
        dfs(e.to, cost + e.cost, vertex);        
    }
}

int main(){
    int N; cin >> N;
    d.assign(N,0);
    edges.resize(N);
    rep(i,N-1){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        a--;
        b--;
        edges[a].push_back(edge{b, c});
        edges[b].push_back(edge{a, c});
    }
    int Q, K; cin >> Q >> K;
    K--;
    vector<query> queries(Q);
    rep(i,Q){
        int from, to; cin >> from >> to;
        from--;
        to--;
        queries[i] = query{from, to};
    }
    
    dfs(K, 0);

    rep(i,Q){
        cout << d[queries[i].from] + d[queries[i].to] << endl;
    }
}

Measured memory_bytes: 15104
import copy

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

a = []
b = []
c = []
d = []

for i in range(q):
  _a, _b, _c, _d = map(int, input().split())
  a.append(_a)
  b.append(_b)
  c.append(_c)
  d.append(_d)

seq = [[] for i in range(n)]

for i in range(1, m + 1):
  seq[0].append([i])

for i in range(1, n):
  for j in range(len(seq[i - 1])):
    s = copy.copy(seq[i - 1][j])
    s.append(0)
    for k in range(s[-2], m + 1):
      s[-1] = k
      s2 = copy.copy(s)
      seq[i].append(s2)

score = [0 for i in range(len(seq[n - 1]))]
for i in range(len(seq[n - 1])):
  for j in range(q):
    if seq[n - 1][i][b[j] - 1] - seq[n - 1][i][a[j] - 1] == c[j]:
      score[i] += d[j]

print(max(score))

Measured memory_bytes: 39684
#include <cstdio>
#include <vector>
using namespace std;

#define min(a, b) b < a ? b : a
#define INF (10000000)

int money[51];

void set(void);

int main(void)
{
    int g;
    
    for (int i = 0; i < 51; i++){
        money[i] = INF;
    }
    
    set();
    while (1){
        scanf("%d", &g);
        if (g == 0) break;
        
        g /= 100;
        printf("%d\n", money[g]);
    }
}

void set(void)
{
    for (int i = 0; i < 26; i++){
        for (int j = 0; j < 18; j++){
            for (int k = 0; k < 11; k++){
                if((i * 2) + (j * 3) + (k * 5) < 51){
                    money[(i * 2) + (j * 3) + (k * 5)] = min(money[(i * 2) + (j * 3) + (k * 5)], (i / 5) * 1520 + (i % 5) * 380 + (j / 4) * 1870 + (j % 4) * 550 + (k / 3) * 2244 + (k % 3) * 850);
                }
            }
        }
    }
    
    
}

Measured memory_bytes: 0
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t; cin >> s >> t;
    vvl dp(s.size()+1, vl(t.size()+1, 0));
    
    REP(i, s.size()) REP(j, t.size()){
        if(s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
        dp[i+1][j+1] = max({dp[i+1][j+1], dp[i+1][j], dp[i][j+1]});
    }
    
    string res = "";
    ll i = s.size(), j = t.size();
    while(i > 0 && j > 0){
        if(dp[i][j] == dp[i-1][j]) i--;
        else if(dp[i][j] == dp[i][j-1]) j--;
        else{
            res = s[i-1] + res;
            i--; j--;
        }
    }
    cout << res << endstr;
    return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,C,sum;
  cin >> N >> M >> C;
  sum=0;
  
  vector<int>B(M);
  for(int i=0 ; i<M ; i++)
    cin >> B.at(i);
  
  for(int i=0; i<N ; i++){
    //Ai1~AiM　入れる
    vector<int>A(M);
    for(int j=0 ; j<M ; j++)
      cin >> A.at(j);
    //code　定義
    int code;
    code=C;
    //code 入れる
    for(int j=0 ; j<M ; j++)
      code+= B.at(j) * A.at(j);
    //code 判定
    if(code>0)
      sum++;
  }
  cout << sum <<endl;
}

Measured memory_bytes: 256
import numpy as np
import math
from collections import deque

N, M = map(int, input().split())

E = [[] for _ in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    E[A - 1].append(B - 1)
    E[B - 1].append(A - 1)

que = deque()
que.append(0)
ans = [None for i in range(N)]

while(len(que) > 0):
    p = que.popleft()
    #print(p, E[p])
    for to in E[p]:
        if ans[to] is None:
            #print(to, ans[to])
            que.append(to)
            ans[to] = p

if None not in ans:
    print("Yes")
    for a in ans[1:]:
        print(a + 1)
else:
    print("No")

Measured memory_bytes: 52452
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;
typedef pair<int,int> P;

P ne(int N,int x,int y){
    if(x==1 && y!=N) return {x,y+1};
    if(y==N && x!=N) return {x+1,y};
    if(x==N && y!=1) return {x,y-1};
    if(y==1) return {x-1,y};
}

int main(){
    int N;
    cin >> N;
    vector<vector<int>> ans(N+1,vector<int>(N+1,0));
    vector<vector<int>> edge(N*N+1),deg(5);
    vector<int> cnt(N*N+1,0),use(N*N+1,0);
    set<int> s[N*N+1];
    int a,b;
    for(int i=0;i<2*N*N-2*N;i++){
        cin >> a >> b;
        edge[a].push_back(b); edge[b].push_back(a);
        cnt[a]++; cnt[b]++;
        s[a].insert(b); s[b].insert(a);   
    }
    for(int i=1;i<=N*N;i++) deg[cnt[i]].push_back(i);
    int x = 1,y = 1,num = deg[2][0];
    ans[1][1] = num;
    use[num] = 1;
    while(true){
        for(auto a:edge[num]){
            if(!use[a] && cnt[a]!=4){
                P p = ne(N,x,y);
                x = p.first; y = p.second;
                ans[x][y] = a;
                use[a] = 1;
                num = a;
                break;
            }
        }
        if(x==2 && y==1) break;
    }
    for(int i=2;i<=N-1;i++) for(int j=2;j<=N-1;j++){
        for(auto a:s[ans[i-1][j]]){
            if(!use[a] && cnt[a]==4 && s[ans[i][j-1]].count(a)==1){
                ans[i][j] = a;
                use[a] = 1;
                break;
            }
        }
    }
    for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) cout << ans[i][j] << (j!=N? " ":"\n");
}


Measured memory_bytes: 6048
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<String> one = nextStrArray();
		double D = Double.parseDouble(one.get(0));
		double T = Double.parseDouble(one.get(1));
		double S = Double.parseDouble(one.get(2));
		if(D / S <= T){
			myout("Yes");
		}else{
			myout("No");
		}
	}
	//Method addition frame start




	//Method addition frame end
}


Measured memory_bytes: 33184
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    set<char> s;
    rep(i,3){
        char x;
        cin >> x;
        s.insert(x);
    }

    if(s.size() == 1){
        cout << "No\n";
    }else{
        cout << "Yes\n";
    }


    return 0;
}


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

int food[40] = {0};
int N, M;
int K, A;
int ans = 0;

int main() {
    cin >> N >> M;
    for (int i=0; i<N; ++i) {
        cin >> K;
        for (int k=0; k < K; ++k) {
            cin >> A;
            ++food[A];
        }
    }

    for (int i=1; i<=M; ++i) {
        if (food[i] == N) ++ans;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll K,A,B;
    ll C = 1;
    cin >> K >> A >> B;
    if((A+2) >= B||K <= A){
        cout << 1+K << "\n";
        return 0;
    }
    C = A;
    K -= (A-1);
    ll count = (ll)K/2;
    C += (count*(B-A));
    C += K%2;
    cout << C << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>

using namespace std;
typedef long long int ll;typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }

int main(void) {
	int a; cin >> a;
	cout << a * a / 1 << endl;



	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int mp[100010];
int parent[100010];

void init(int n) {
  for (int i = 0; i <= n; i++) parent[i] = i;
}

int find(int a) {
  int p = parent[a];
  if (parent[p] == p) {
    return p;
  } else {
    return parent[a] = find(p);
  }
}

void unite(int a, int b) {
  while (parent[b] != b) {
    b = parent[b];
  }
  if (find(a) == find(b)) return;
  parent[b] = find(a);
}

bool same(int a, int b) {
  return parent[a] == parent[b];
}

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> mp[i];
  }
  init(n);
  for (int i = 0; i < m ; i++) {
    int x, y;
    cin >> x >> y;
    unite(x, y);
  }
  for (int i = 1; i <= n; i++) find(i);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (same(mp[i], i)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import Data.Char (digitToInt)

generate :: Int -> [[Int]]
generate 0 = [[1]]
generate n = concatMap (\xs -> map (\x -> x:xs) [0,1]) $ generate (n-1)

func :: [Int] -> String -> Int -> Int -> Int
func [] _ _ total = total
func (n:ns) (x:xs) acc total = case n of
  0 -> func ns xs acc' total
  1 -> func ns xs 0 (acc' + total)
  where
    acc' = (+) (acc * 10) $ digitToInt x

main = do
  line <- getLine
  let
    n = length line
    ans = sum $ map (\x -> func x line 0 0) $ generate (n-1)
  putStrLn $ show ans


Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n = 0;
  cin >> n;
  vector <int> v(n+1,0);
  for(int i = 2; i <= n; i++){
    int t = 0;
    cin >> t;
    v[t] += 1;
  }
  for(int i = 1; i <= n; i++){
    cout << v[i] << endl;
  }
}

Measured memory_bytes: 4048
N,K=map(int,input().split())
S=input()
X=[]
Y=[0]
_s='2'
for i,s in enumerate(S):
  if _s!=s:
    _s=s
    X.append(i)
    Y.append((int(s)+1)%2)
import itertools
Y=list(itertools.accumulate(Y))
ans=[]
for i,x in enumerate(X):
  if Y[-1]-Y[i]<=K:
    ans.append(N-x)
    break
  else:
    if S[x]=='0':
      ans.append(X[i+2*K]-x)
    else:
      ans.append(X[i+2*K+1]-x)
print(max(ans))

Measured memory_bytes: 14336
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>

using namespace std;

using ll = unsigned long long int;
using pii = pair<int, int>;

ll arr[100010] = {};


int main() {

	int n;
	cin >> n;
	string str[2];

	for (int i = 0; i < 2; i++)
		cin >> str[i];

	ll res = 3;

	int f = 0;

	for (int i = 0; i < n; i++) {
		if (str[0][i] == str[1][i]) {
			if (f == 1) {
				res *= 2;
				res %= 1000000007LL;
			}
			f = 1;
		}
		else {
			if (f == 2) {
				res *= 3;
				res %= 1000000007LL;
			}
			else {
				res *= 2;
				res %= 1000000007LL;
			}
			i++;
			f = 2;
		}
	}

	cout << (res % 1000000007LL) << endl;

}



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

int dp[100001];

int solve(int a[], int n) {
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	// int minSum = dp[1];
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
		// minSum += dp[i];
	}
	return dp[n - 1];
}

int main() {

	int n;
	cin >> n;

	int a[n + 1] ;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	cout << solve(a, n) << endl;
	// for (int i = 0; i < n; i++)
	// 	cout << dp[i] << " ";
	return 0;
}

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

#define int long long

signed main()
{
    int i=0, j=0, k=0, ans=0;
    
    int l;
    cin>>l;

    long double a;
    a=(long double)l/3;
    cout<<setprecision(10)<<a*a*a<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a, b, c, d, e;
	scanf("%d", &a);
	b = a / 1000 ;
	c = (a - b * 1000) / 100 ;
	d = (a - b * 1000 - c * 100) / 10;
	e = a - b * 1000 - c * 100 - d * 10;

	if (b != c)
		if (c != d)
			if (d != e)
				printf("Good");
			else
				printf("Bad");
		else
			printf("Bad");
	else
		printf("Bad");
}

Measured memory_bytes: 128
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> g[100001];
int iri[100001],l[100001],visit[100001];

int dfs(int x){
    visit[x]=1;
    for(int i=0;i<g[x].size();i++){
        iri[g[x][i]]--;
        l[g[x][i]]=max(l[g[x][i]],l[x]+1);
        if(iri[g[x][i]]==0){
            dfs(g[x][i]);
        }
    }
    return 0;
}

int main(){
    int n,m,x,y,ans=0;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&x,&y);
        g[x].push_back(y);
        iri[y]++;
    }
    for(int i=1;i<=n;i++){
        if(iri[i]==0&&visit[i]==0){
            dfs(i);
        }
    }
    for(int i=1;i<=n;i++){
        ans=max(ans,l[i]);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 11520
S = input()
s = list(S)

count = 0
l = [0]

for i in range(len(s)):
    if s[i] == 'R':
        l.append(1)
        try:
            if s[i+1] == 'R':
                count += 1
                l.append(count+1)
            else:
                l.append(count)
                count = 0
        
        except IndexError:
            break

print(max(l))


Measured memory_bytes: 9044
N, K = map(int, input().split())
S = list(input())
current = S[0]
L0 = []
L1 = []
Lall = []
stack = 0
for i in range(N):
    if current == S[i]:
        stack += 1
    else:
        if current == '0':
            L0.append(stack)
        else:
            L1.append(stack)
        Lall.append(stack)
        stack = 1
        current = S[i]
if current == '0':
    L0.append(stack)
else:
    L1.append(stack)
Lall.append(stack)
len0 = len(L0)
len1 = len(L1)
if len0 == 0:
    print(L1[0])
elif len1 == 0:
    if K != 0:
        print(L0[0])
    else:
        print(0)
elif len0 <= K:
    print(len(S))
else:
    L = [0]
    for i in range(len(Lall)):
        L.append(L[-1] + Lall[i])
    if len0 < len1:
        ans = 0
        for k in range(len0-K+1):
            ans = max(ans, L[2*k + 2*K + 1]-L[2*k])
    elif len0 > len1:
        ans = max(L[2*K]-L[0], L[-1]-L[-1-2*K])
        for k in range(len0-K-1):
            ans = max(ans, L[2*k + 2*K + 2]-L[2*k + 1])
    elif S[0] == '0':
        ans = L[2*K]-L[0]
        for k in range(len0 - K):
            ans = max(ans, L[2*k + 2*K + 2]-L[2*k + 1])
    else:
        ans = L[-1]-L[-1-2*K]
        for k in range(len0 - K):
            ans = max(ans, L[2 * k + 2 * K + 1] - L[2 * k])
    print(ans)

Measured memory_bytes: 9432
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int p = 1, f = 0;
    string s, t, d;
    cin >> s >> t;
    string c = s;
    int l = s.length();
    for (int j = 0; j < l; j++) {
        for (int i = 0; i < l; i++) {
            d[(i + 1) % l] = s[i];
        }
        for (int k = 0; k < l; k++) {
            if (d[k] != t[k]) {
                f = 1;
                break;
            }
        }
        if (f == 1) {
            for (int a = 0; a < l; a++) {
                s[a] = d[a];
            }
            f = 0;
        }
        else {
            p = 0;
            break;
        }
    }
    if (p == 0 || c == t) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int l,same=0;
string rec="";
signed main(){
    cin>>s;
    l=s.size();
    rep(i,l){
        string t=s.substr(i,1);
        if(i==l-2&&s[l-2]==s[l-1]){
            same++;
            i++;
            continue;
        }
        if(rec!=t)rec=t;
        else{
            rec=s.substr(i,2);
            i++;
            same++;
        }
    }
    cout<<l-same<<endl;
    return 0;
}


Measured memory_bytes: 640
//By : BebekJK
#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 ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//Declare -> ordered_set NAMA;
//Nth smallest integer -> find_by_order(N-1)
//Number of elements less than N -> order_of_key(N)
//Delete N from the set -> erase(N)

#define endl '\n'
#define MOD 1000000007
#define PI 3.141592653
#define fi first
#define sc second
#define pb push_back
#define pbb pop_back

//#pragma GCC optimize("Ofast")
//#pragma GCC target ("string"...)
//#pragma GCC push_options
//#pragma GCC pop_options
//#pragma GCC reset_options
//#pragma GCC optimize ("O3")

typedef long long ll;
typedef long double ld;
typedef pair<int , int> pii;
typedef pair<long long , long long> pll;

void BOOST(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
}
void fcin(int &x){
	bool neg = false;
	register int c;
	x = 0;
	c = getchar();
	if(c=='-'){
		neg = true;
		c = getchar();
	}
	for(;(c>47 && c<58);c=getchar())x = (x<<1)+(x<<3)+c-48;
	if(neg)x*=-1;
}
ll pmod(ll a , ll b){
	if(b==0)return 1;
	ll temp = pmod(a , b/2);
	if(b%2==0)return(temp*temp)%MOD;
	return (((temp*temp)%MOD)*a)%MOD;
}
int main(){
//	BOOST();
	int n , arr[200005];
	map<int , int>cnt;
	cnt.clear();
	cin>>n;
	for(int i=1;i<=n;i++)cin>>arr[i] , cnt[arr[i]]++;
	int ans = 0;
	for(int i=1;i<=n;i++){
		bool ex = true;
		if(cnt[arr[i]]>=2)continue;
		if(arr[i]!=1 && cnt[1]!=0)continue;
		for(int j=2;j*j<=arr[i];j++){
			if(arr[i]%j==0){
				if(cnt[arr[i]/j] || cnt[j]){
					ex = false;
					break;
				}
			}
		}
		if(ex)ans++;
	}
	cout<<ans<<endl;
}







Measured memory_bytes: 33312
// C - All Green

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int p[11];
int c[11];

int main() {
	int D, G;
	cin >> D >> G;

	for (int i=1; i<=D; i++) {
		cin >> p[i] >> c[i];
	}

	int ans = INF;

	for (int bits=0; bits < (1<<D); bits++) {
		int n_solve = 0;
		int score = 0;
		for (int i=1; i<=D; i++) {
			if (bits & (1<<(i-1))) {
				// 100i problems are completed.
				n_solve += p[i];
				score += i * 100 * p[i] + c[i];
			}
		}

		for (int i=D; i>=1; i--) {
			if (bits & (1<<(i-1))) continue;

			for (int j=0; j<p[i]; j++) {
				if (score >= G) break;

				n_solve++;
				score += 100 * i;
			}
		}

		ans = min(ans, n_solve);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3640
const chunks = [];
process.stdin.on("data", (chunk) => {
  chunks.push(chunk);
});
process.stdin.on("end", () => {
  const data = Buffer.concat(chunks).toString("utf8").trim();
  const lines = data.split("\n");
  const [H, W, K] = lines[0].split(" ").map((item) => parseInt(item, 10));
  const C = lines.slice(1, H + 1).map((line) => line.split(""));
  console.log(solve(H, W, K, C));
});

function solve(H, W, K, C) {
  // const allBlack = countBlack(C);
  // if (K > allBlack) return 0;
  // if (K === allBlack) return 1;

  let count = 0;
  backtrackRow(0);
  return count;

  function backtrackRow(row) {
    if (row === H) {
      backtrackCol(0);
      return;
    }

    // Keep this row.
    backtrackRow(row + 1);

    // Remove this row.
    const original = C[row].slice(0);
    fillRedRow(row);
    backtrackRow(row + 1);
    C[row] = original;
  }
  function backtrackCol(col) {
    if (col === W) {
      if (countBlack(C) === K) {
        count++;
      }
      return;
    }

    backtrackCol(col + 1);

    const original = copyCol(col);
    fillRedCol(col);
    backtrackCol(col + 1);
    revertCol(col, original);
  }
  function fillRedRow(row) {
    for (let i = 0; i < W; i++) {
      C[row][i] = "r";
    }
  }

  function copyCol(col) {
    const result = [];
    for (let i = 0; i < H; i++) {
      result.push(C[i][col]);
    }
    return result;
  }
  function fillRedCol(col) {
    for (let i = 0; i < H; i++) {
      C[i][col] = "r";
    }
  }
  function revertCol(col, original) {
    for (let i = 0; i < H; i++) {
      C[i][col] = original[i];
    }
  }
}

function countBlack(C) {
  let count = 0;
  for (const line of C) {
    for (const cell of line) {
      if (cell === "#") count++;
    }
  }
  return count;
}


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

using namespace std;

int main()
{
    double n;
    int c=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i%2!=0)
        {
            c++;
        }
    }
    cout<<c/n;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const int MX= 1000005;

int main(){
  int n;cin>>n;
  cout<<fixed<<setprecision(5);
  cout<<6.28318530717958623200*n<<endl;
}

Measured memory_bytes: 3812