akhauriyash/Code-Regression huggingface dataset:
/*input
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5,mod=1e9+7; 
int dp[N][2];
vector<int> g[N];
int fun(int u,int p,int col)
{
	if(dp[u][col]!=-1) return dp[u][col];
	long long int ans = 1;
	for(int i=0;i<(int)g[u].size();i++)
	{
		int ch = g[u][i];
		if(ch==p) continue;
		long long int temp = 0;
		if(col==1) 
		{
			temp+=fun(ch,u,col);
			temp+=fun(ch,u,col^1);
			temp%=mod;
		}
		else
		{
			temp+=fun(ch,u,1);
			temp%=mod;
		}
		ans*=temp;
		ans%=mod;
	}

	return dp[u][col]=(int)ans;
}


int main()
{
	memset(dp,-1,sizeof dp);
	int n;cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int x,y;cin>>x>>y;
		x--,y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}


	cout<<(fun(0,-1,0)+fun(0,-1,1))%mod<<"\n";



	return 0;
}


Measured memory_bytes: 18052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using vi = vector<int>;

ll f(ll x){
    return x*(x+1)/2;
}

int main(){
    int n,m;
    scanf(" %d %d", &n, &m);

    vector<vi> add(n+1,vi(3));
    rep(i,m){
        int q;
        ll k;
        scanf(" %d %lld", &q, &k);
        if(q==0){
            ll l=0, r=100000;
            while(r-l>1){
                ll mid = (l+r)/2;
                if(f(mid)<k) l=mid;
                else r=mid;
            }
            if(r<=n) ++add[r][q];
        }
        else{
            if(k<=n) ++add[k][q];
        }
    }

    ll ans = 0;
    ll a[3]={};
    for(ll i=1; i<=n; ++i){
        a[0] = add[i][0];
        for(int j=1; j<3; ++j) a[j] += add[i][j];

        ans += i*i*i;
        ans -= i*i*(a[0]+a[1]+a[2]);
        ans += i*(a[0]*a[1]+a[1]*a[2]+a[2]*a[0]);
        ans -= a[0]*a[1]*a[2];
    }
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 5532
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<int> res(n);
	rep(i, n - 1)
	{
		int a; cin >> a;
		--a;
		++res[a];
	}
	rep(i, n)cout << res[i] << endl;
}

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

#define endl '\n'

using namespace std;

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

  int n, ans = 0;
  cin >> n;
  vector<int> num(n);
  for (int i = 0; i < n; i++) cin >> num[i];
  for (int i = 1; i < n - 1; i++) {
    if (max(max(num[i], num[i - 1]), num[i + 1]) != num[i] && min(min(num[i], num[i - 1]), num[i + 1]) != num[i])
      ans++;
  }
  cout << ans << endl;

  return 0;
}


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

int main(){

  string S;
  cin>>S;
  
  int N=S.length();
  rep(i,N){

    if(i%2==0 && S[i]=='L'){cout<<"No"; return 0;}
    else if(i%2==1 && S[i]=='R'){cout<<"No"; return 0;}
    
  }
  cout<<"Yes";
  
}


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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  sort(x.begin(),x.end());
  int max_x = x[n-1];
  long long ans=10101010;
  for(int i=1;i<=max_x;i++){
    long long sum=0;
    for(int j=0;j<n;j++){
      sum += (i-x[j])*(i-x[j]);
    }
    if(sum<ans) ans = sum;
  }
  cout << ans << endl;
}

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

typedef long long ll;

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

    int n,a,b,uku=0; cin >> n;
    vector<int> p(n),q(n),v(n);
    for(int i=0;i<n;i++) cin >> p[i];
    for(int i=0;i<n;i++) cin >> q[i];
    for(int i=0;i<n;i++) v[i] = i + 1;
    do{
        uku++;
        int i,cntp,cntq;
        cntp = cntq = 0;
        for(int i=0;i<n;i++){
            if(p[i]==v[i]) cntp++;
            if(q[i]==v[i]) cntq++;
        }
        if(cntp==n) a = uku;
        if(cntq==n) b = uku;
    }while(next_permutation(v.begin(),v.end()));
    cout << abs(a-b) << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

const MAX = 1001

func main() {
	var n int
	fmt.Scanln(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	w := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&w[i])
	}
	l := MAX
	r := MAX
	for i := 0; i < n; i++ {
		if a[i] == 0 {
			if w[i] < r {
				r = w[i]
			}
		} else {
			if w[i] < l {
				l = w[i]
			}
		}
	}
	ans := 0
	if l < MAX && r < MAX {
		ans = l + r
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1136
x , y = input().split()
a1 = [1 , 3 , 5 , 7 , 8 , 10 , 12]
b1 = [4 , 6 , 9 , 11]
c1 = [2]
x = int(x)
y = int(y)
b = False
if x in a1:
    if y in a1:
        b = True
if x in b1:
    if y in b1:
        b = True
if x in c1:
    if y in c1:
        b = True

if b:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
a=[int(i)-1 for i in input().split()]
b=[int(i)-1 for i in input().split()]

for _ in range(4):
    b[0],b[4],b[5],b[1]=b[1],b[0],b[4],b[5]
    for _ in range(4):
        b[1],b[2],b[4],b[3]=b[3],b[1],b[2],b[4]
        for _ in range(4):
            b[0],b[4],b[5],b[1]=b[1],b[0],b[4],b[5]
            if a==b:
                print('Yes')
                exit()
print('No')


Measured memory_bytes: 5604
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    multiset<int> values;
    for (int i = 0; i < N; ++i)
    {
        int value;
        cin >> value;
        values.insert(value);
    }
    cout << accumulate(values.begin(), values.end(), 0)
        - *max_element(values.begin(), values.end()) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
/*!* [warshall_floyd] *!*/
/*+* ワーシャルフロイド法,全ての二点間距離をO(V^3)で求める *+*/
template <typename T>
void WarshallFloyd(vector<vector<T>> &link) {
    int N = link.size();
    for (int k = 0; k < N; k++)
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                link[i][j] = min(link[i][j], link[i][k] + link[k][j]);
}
int D[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
int main() {
    int H, W;
    cin >> H >> W;
    vector2d<bool> S(H, vector<bool>(W));
    for(int i = 0; i < H; i++) {
        string s;
        cin >> s;
        for(int j = 0; j < W; j++) {
            S[i][j] = s[j] == '.' ? 1 : 0;
        }
    }
    const int INF = 1e8;
    vector2d<int> v(H * W, vector<int>(H * W, INF));
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            for(int d = 0; d < 4; d++) {
                int ni = i + D[d][0], nj = j + D[d][1];
                if(0 <= ni && ni < H && 0 <= nj && nj <= W && S[i][j] && S[ni][nj]) {
                    v[ni * W + nj][i * W + j] = 1;
                    v[i * W + j][ni * W + nj] = 1;
                }
            }
            v[i * W + j][i * W + j] = 0;
        }
    }
    int ans = 0;
    WarshallFloyd(v);
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            for(int ni = 0; ni < H; ni++) {
                for(int nj = 0; nj < W; nj++) {
                    if(S[ni][nj] && S[i][j]) {
                        ans = max(ans, v[ni * W + nj][i * W + j]);
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
long long N,M;

int main(){
  cin >> N >> M;
  if(N%2 == 1){
    for(long long i = 1; i <= M; i++){
      cout << i << " " << 2*M+1-i << endl;
    }
  }else{
    for(long long i = 1; i <= M; i++){
      if(i <= N/4){
        cout << i << " " << N+1-i << endl;
      }
      else{
        cout << i << " " << N-i << endl;
      }
    }
  }
}

Measured memory_bytes: 3608
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int n,m;
vector<int> adj[MAXN];

bool solve() {
	//printf("adj:"); REP(i,n) printf(" %d",SZ(adj[i])); puts("");
	REP(i,n) if(SZ(adj[i])%2==1) return false;
	REP(i,n) if(SZ(adj[i])>=6) return true;
	vector<int> fours; REP(i,n) if(SZ(adj[i])==4) fours.PB(i);
	if(SZ(fours)<=1) return false;
	if(SZ(fours)>=3) return true;
	int a=fours[0],b=fours[1];
	REPSZ(i,adj[a]) {
		int at=adj[a][i],prv=a;
		while(at!=a&&at!=b) {
			int to=-1; REPSZ(j,adj[at]) { int cur=adj[at][j]; if(cur==prv) continue; assert(to==-1); to=cur; } assert(to!=-1);
			prv=at,at=to;
		}
		if(at==a) return true;
	}
	return false;
}

void run() {
	scanf("%d%d",&n,&m);
	REP(i,m) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(b); adj[b].PB(a); }
	printf("%s\n",solve()?"Yes":"No");
}

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


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

#define Int register int
#define mod 998244353
#define MAXN 1000005

template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}
template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}
template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}

int n,m,fac[MAXN],ifac[MAXN];

int mul (int a,int b){return 1ll * a * b % mod;}
int dec (int a,int b){return a >= b ? a - b : a + mod - b;}
int add (int a,int b){return a + b >= mod ? a + b - mod : a + b;}
int qkpow (int a,int b){int res = 1;for (;b;b >>= 1,a = mul (a,a)) if (b & 1) res = mul (res,a);return res;}
int binom (int a,int b){return mul (fac[a],mul (ifac[b],ifac[a - b]));}
int inv (int x){return qkpow (x,mod - 2);}

signed main(){
	read (n,m);
	fac[0] = 1;for (Int i = 1;i <= n + m;++ i) fac[i] = mul (fac[i - 1],i);
	ifac[n + m] = inv (fac[n + m]);for (Int i = n + m;i;-- i) ifac[i - 1] = mul (ifac[i],i);
	int res = 0;for (Int i = 1;i <= n && i <= m;++ i) res = add (res,mul (binom (2 * i,i),binom (n + m - 2 * i,n - i)));
	res = mul (res,mul (ifac[2],inv (binom (n + m,n))));
	write (add (res,max (n,m))),putchar ('\n');
	return 0;
}

Measured memory_bytes: 11448
n = STDIN.gets.chomp.to_i
ary = STDIN.gets.chomp.split(' ').map(&:to_i)
(0..n-1).each do |i|
  v = ary[i]
  j = i - 1
  while j >= 0 && ary[j] > v do
    ary[j+1] = ary[j]
    j -= 1
  end
  ary[j+1] = v
  puts ary.join(' ')
end

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

int main(void){
	int X;
	cin >> X;
	int i;
	int temp=0;
	int ans = 0;
	for(i=1;i<=X;i++){
		temp += i;
		if(temp>=X){
			ans = i;
			break;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define INF (1<<30)
#define LINF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl
#define SP << " " << 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
#define parity(i,j) (i&(1LL<<j))
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int a,b,n;
  cin >> a >> b >> n;

  n = min(n,b-1);

  cout << (a*n)/b - a*(n/b) << endl;

  return 0;
}

Measured memory_bytes: 3616
import sys
input = sys.stdin.buffer.readline

def main():
    N,M,P = map(int,input().split())
    
    def BellmanFord(edges,v,source):
        INF = float("inf")
        dist = [INF for _ in range(v)]
        dist[source] = 0
        for i in range(2*v+1):
            for now,fol,cost in edges:
                if (dist[now] != INF and dist[fol]>dist[now]+cost):
                    dist[fol] = dist[now]+cost
                    if i >= v:
                        dist[fol] = -INF
        if dist[v-1] == -INF:
            return -1
        else:
            return max(0,-1*dist[v-1])
    
    edges = []
    for _ in range(M):
        a,b,c = map(int,input().split())
        edges.append((a-1,b-1,P-c))
    
    print(BellmanFord(edges,N,0))

if __name__ == "__main__":
    main()


Measured memory_bytes: 43112
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define INF 1000000000000000003
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define pb push_back 
#define pob pop_back
#define mp make_pair

void solve(){
	int x,y;
	cin>>x>>y;
	if(y%2==0){
		if((4*x)>=y && (y>=2*x))   cout<<"Yes";
		else  cout<<"No";
	}
	else cout<<"No";
}

int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1; 
    // cin>>t;
    while(t--){
      solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

const double PI=3.14159265358979323846;
int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    double ans = n * 2 * PI;


    co(ans);

    return 0;
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 998244353;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
lint ncr(lint n, lint r, lint mod, vector<lint> &fact) {
  if(n < 0 || r < 0 || n-r < 0) return 0;
  return fact[n]*power(fact[r], mod-2, mod)%mod*power(fact[n-r], mod-2, mod)%mod;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N, A, B, K;
  cin >> N >> A >> B >> K;
  vector<lint> fact(N+1);
  fact[0] = 1;
  FOR(i, 1, N+1) fact[i] = fact[i-1] * i % MOD;
  lint ans = 0;
  REP(i, N+1) {
    lint p = i;
    if(K-p*A < 0 || (K-p*A)%B != 0) continue;
    lint q = (K-p*A) / B;
    if(q < 0 || q > N) continue;
    ans = (ans + ncr(N, p, MOD, fact) * ncr(N, q, MOD, fact) % MOD) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 2688
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


/////////////////////////////////////////////////////////////////



int main(){
    int n;cin>>n;
    ll a[n+1];
    rep(i,1,n){
        int k;cin>>k;
        a[k]=i;
    }
    set<ll>s;
    ll ans=0;
    s.insert(0);s.insert(n+1);
    rep(i,1,n){
        auto z=s.upper_bound(a[i]);
        z--;
        ll l=*z;
        ll r=*(s.upper_bound(a[i]));
        s.insert(a[i]);
        ans+=(r-a[i])*(a[i]-l)*i;//cout<<l<<" "<<a[i]<<" "<<r<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
    set<int> s; 
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
      int a;
      cin>>a;
      s.insert(a);
    }
    if (s.size()==n) { 
        cout << "YES"; 
    } 
    else { 
        cout << "NO"; 
    } 
  
    return 0; 
} 


Measured memory_bytes: 9600
S = input()
answer = 'Yes'
N = len(S)
S2 = S[0:(N-1)//2]
N2 = len(S2)
S3 = S[(N+3)//2-1:]
N3 = len(S3)
for i in range(N//2):
  if ( S[i] == S[-(i+1)]):
    answer = 'Yes'
  else:
    answer = 'No'
    break
if answer == 'Yes':
  for i in range(N2//2):
    if( S2[i] == S2[-(i+1)] and S3[i] == S3[-(i+1)]):
      answer = 'Yes'
    else:
      answer = 'No'
      break
print(answer)

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Add Sub Mul
            var line = ReadLine();
            int a = line[0];
            int b = line[1];
            var calc = new int[3];

            calc[0] = a + b;
            calc[1] = a - b;
            calc[2] = a * b;

            Console.WriteLine(calc.Max());
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13396
def f(a,b):
    print("#"*b)
    for i in range(a-2):
        print("#"+"."*(b-2)+"#")
    print("#"*b)

    print()
L = []
while True:
        a,b = map(int,input().split())
        k = [a,b]
        L.append(k)
        if a == 0 and b == 0 :
            break

for i in range(len(L)-1):
    f(L[i][0],L[i][1])



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

char s[MAXN];

void solve(){
	int n, a, b, c, d;
	scanf("%d%d%d%d%d%s", &n, &a, &b, &c, &d, &s[1]);
	REP(i, a, c) {
		if (s[i] == '#' && s[i + 1] == '#') {
			printf("No\n");
			return;
		}
	}
	REP(i, b, d) {
		if (s[i] == '#' && s[i + 1] == '#') {
			printf("No\n");
			return;
		}
	}
	if (c < d) {
		printf("Yes\n");
		return;
	}
	int fl = 0;
	REPN(i, b, d) {
		if (i > 0 && s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
			fl = 1;
		}
	}
	if (fl == 0) {
		printf("No\n");
		return;
	}
	printf("Yes\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
using namespace std;
#define int long long
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
char F[2001][2001];
int A[4][2000][2000];
signed main() {
  int H, W; cin >> H >> W;
  REP(i,H) cin >> F[i];
  REP(i, H) REP(j, W) {
    // left
    if (j == 0) A[0][i][j] = 0;
    else if(F[i][j] != '#' && F[i][j - 1] != '#') A[0][i][j] = A[0][i][j - 1] + 1;

    // up
    if (i == 0) A[1][i][j] = 0;
    else if(F[i][j] != '#' && F[i - 1][j] != '#') A[1][i][j] = A[1][i - 1][j] + 1;
  }
  for(int i = H - 1; i >= 0; i--) {
    for(int j = W - 1; j >= 0; j--) {
      // right
      if (j == W - 1) A[2][i][j] = 0;
      else if(F[i][j] != '#' && F[i][j + 1] != '#') A[2][i][j] = A[2][i][j + 1] + 1;

      // down
      if (i == H - 1) A[3][i][j] = 0;
      else if(F[i][j] != '#' && F[i + 1][j] != '#') A[3][i][j] = A[3][i + 1][j] + 1;
    }
  }
  int ans = 0;
  REP(i, H) REP(j, W) {
    if (F[i][j] != '#') {
      int t = 1 + A[0][i][j] + A[1][i][j] + A[2][i][j] + A[3][i][j];
      ans = max(ans, t);
    }
  }
  cout << ans << endl;
}


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

int main(){
  int n;
  cin >> n;
  ll ans = 1;
  rep (i, n){
    ans *= i;
    ans = ans % (1000000007);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  int N, M;
  cin >> N >> M;

  if (N % 2 != 0) {
    for(int i = 1; i <= M; i++) {
      cout << i << " " << N - i << endl;
    }
  } else {
    int mid = N / 2;
    for(int i = 1; i <= (M+1)/2; i++) {
      cout << i << " " << mid - i + 1 << endl;
    }

    for(int i = 1; i <= M/2; i++) {
      cout << i+mid << " " << N - i << endl;
    }
  }

  return 0;
}


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

typedef long long ll;
int main()
{
  ll n; cin>>n;
  if(n<=6){
    cout<<1<<"\n"; return 0;
  }
  if(n<=11){
    cout<<2<<"\n"; return 0;
  }
  ll amari = n%11;
  ll ans= (n-amari)/11;
  if(amari==0) cout<<ans*2<<"\n";
  else if(amari<=6) cout<<ans*2+1<<"\n";
  else cout<<ans*2+2<<"\n";

}


Measured memory_bytes: 256
n = int(input())
s = set()
for _ in range(n):
    a, b = map(int,input().split())
    if a == 0:
        s.add(b)
        print(len(s))
    elif a == 1:
        if b in s:
            print(1)
        else:
            print(0)
    else:
        if b in s:
            s.remove(b)


Measured memory_bytes: 23356
#include<stdio.h>
#include<iostream>
using namespace std;

long long int res[10];
bool g[5][5];

#define MOD 6000011
char h[MOD],T;
long long int v[MOD];
void ins(long long int x){
	int hx = (int)(x % MOD);
	while(h[hx]==T && v[hx]!=x){
		hx++;
		if(hx==MOD)hx=0;
	}
	h[hx]=T;
	v[hx]=x;
}
bool fd(long long int x){
	int hx = (int)(x % MOD);
	while(h[hx]==T && v[hx]!=x){
		hx++;
		if(hx==MOD)hx=0;
	}
	if(h[hx]!=T)return false;
	return true;
}

int H,W,N,X,Y;

int main(){
	++T;
	scanf("%d%d%d",&H,&W,&N);
	res[0] = (H-2LL)*(W-2LL);
	for(int i=0; i<N; i++){
		scanf("%d%d",&X,&Y);--X;--Y;
		for(int u=max(X-2,0); u <= min(X+2,H-1); u++)
			for(int v=max(Y-2,0); v <= min(Y+2,W-1); v++)
				g[u-(X-2)][v-(Y-2)] = fd(u * (long long int)W + v);
		ins(X*(long long int)W + Y);
		
		for(int u=max(X-2,0); u+2 <= min(X+2,H-1); u++)
			for(int v=max(Y-2,0); v+2 <= min(Y+2,W-1); v++){
				int cnt=0;
				for(int t=0; t<3; t++)
					for(int t2=0; t2<3; t2++){
						if(g[u+t-(X-2)][v+t2-(Y-2)])
							cnt++;
					}
				--res[cnt];
				++res[cnt+1];
			}
	}
	for(int i=0; i<10; i++)
		cout<<res[i]<<endl;
	return 0;
}

Measured memory_bytes: 52992
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int A[N], B[N], X[N], Y[N], C[N], ac[N], bc[N];
int a, b, m;
int main(){
    cin >> a >> b >> m;
    for(int i = 1; i <= a; i ++){
        cin >> A[i];
    }
    for(int i = 1; i <= b; i ++){
        cin >> B[i];
    }
    for(int i = 1; i <= m; i ++){
        cin >> X[i] >> Y[i] >> C[i];
    }
    memcpy(ac, A, sizeof A);
    memcpy(bc, B, sizeof B);
    sort(A, A+a+1);
    sort(B, B+b+1);
    int curr = A[1] + B[1];
    for(int i = 1; i <= m; i ++){
        //cout << curr << endl;
        if(curr > ac[X[i]] + bc[Y[i]] - C[i]){
            curr = ac[X[i]] + bc[Y[i]] - C[i];
        }
    }
    cout << curr << endl;
    return 0;
}


Measured memory_bytes: 2944
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#define For(i,x) for (int i=h[x],k; i; i=nxt[i])
typedef long long ll;
using namespace std;

const int N=400010;
int n,u,v,cnt,ans,f[N],h[N],to[N<<1],nxt[N<<1];

void add(int u,int v){ to[++cnt]=v; nxt[cnt]=h[u]; h[u]=cnt; }

void dfs(int x,int fa){
	int mx=0,mx2=0;
	For(i,x) if ((k=to[i])!=fa){
		dfs(k,x);
		if (f[k]+1>=mx) mx2=mx,mx=f[k]+1;
			else if (f[k]+1>mx2) mx2=f[k]+1;
	}
	ans=max(ans,mx+mx2); f[x]=mx;
}

int main(){
	scanf("%d",&n);
	rep(i,2,n) scanf("%d%d",&u,&v),add(u,v),add(v,u);
	dfs(1,0);
	if ((ans+1)%3==2) puts("Second"); else puts("First");
	return 0;
}

Measured memory_bytes: 23296
s = input()

is_all_swappd = False
n_swap = 0
n_white = s.count('W')
for i in range(n_white):
    w_idx = None
    if i == 0:
        w_idx = s.find('W')
    else:
        w_idx = s[last_w_idx + 1:].find('W') + last_w_idx + 1
    n_swap += w_idx - i
    last_w_idx = w_idx

print(n_swap)

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

#define EPS 1e-9
#define INF 1e9
#define EQ(x, y) (abs((x)-(y))<EPS)

typedef long long int LLI;
typedef pair<double, double> Pair;

int N;
LLI tot;
double as[114514];
double bs[114514];
double cs[114514];
int BIT[114514];

void add(int k, int x) {
  k++;
  while (k <= N+1) {
    BIT[k] += x;
    k += k&-k;
  }
}

int getsum(int k) {
  k++;
  int ret = 0;
  while (k > 0) {
    ret += BIT[k];
    k -= k&-k;
  }
  return ret;
}

double determine(double *A, double *B, double *C) {
  double low = -INF;
  double high = INF;
  for (int i=0; i<80; i++) {
    LLI cnt = 0;
    double k = (low+high)/2;
    vector<double> ys;
    vector<Pair> ps;

    fill(BIT, BIT+N+10, 0);
    for (int j=0; j<N; j++) {
      double X = A[j]/B[j];
      double Y = k*(A[j]/B[j]) - (C[j]/B[j]);
      ys.emplace_back(Y);
      ps.emplace_back(Pair(X, Y));
    }
    
    sort(ys.begin(), ys.end());
    ys.erase(unique(ys.begin(), ys.end()), ys.end());
    sort(ps.begin(), ps.end());
    for (Pair p : ps) {
      double X = p.first;
      double Y = p.second;
      int idx = lower_bound(ys.begin(), ys.end(), Y) - ys.begin();
      cnt += getsum(idx);
      add(idx, 1);
    }

    //printf("%.20f: %lld %lld\n", k, cnt, (tot/2+tot%2));
    if (cnt < (tot/2+tot%2)) low = k;
    else high = k;
  }
  return low;
}

int main() {
  scanf("%d", &N);
  for (int i=0; i<N; i++) {
    scanf("%lf%lf%lf", &as[i], &bs[i], &cs[i]);
  }
  tot = LLI(N)*(N-1)/2;
  printf("%.20f %.20f\n", determine(as, bs, cs), determine(bs, as, cs));
}


Measured memory_bytes: 3880
#include<bits/stdc++.h>
using namespace std;
#define ll int

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll c=0;
    ll n;
    cin>>n;
    
   
    
    
        ll x=7;
        c=1;
        for(ll i=0;i<1e7;i++)
        {
        
           x=x%n;
           if(x==0)
           {
               cout<<c;return 0;
           }
           c++;
           x=x*10+7;
        }
   cout<<-1;
    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    rep(i, N) cin >> H[i];

    vector<int> dp(N, MOD);
    dp[0] = 0;
    rep(i, N) {
        rep2(j, 1, K + 1) {
            if (i + j < N) {
                dp[i + j] = min(dp[i + j], dp[i] + abs(H[i] - H[i + j]));
            }
        }
    }
    cout << dp[N - 1] << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
import numpy as np
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

l = []
tmp = 0
for i in range(N):
  tmp += a[i]
  l.append(tmp)

ans1 = 0
cnt = 0
tmp = 0
for i in range(N):
  if i%2 == 0:
    if l[i]+tmp > 0:
      continue
    else:
      cnt = -(l[i]+tmp) +1
      tmp += cnt
      ans1 += abs(cnt)
  else:
    if l[i]+tmp < 0:
      continue
    else:
      cnt = -(l[i]+tmp) -1
      tmp += cnt
      ans1 += abs(cnt)

ans2 = 0
cnt = 0
tmp = 0
for i in range(N):
  if i%2 == 0:
    if l[i]+tmp < 0:
      continue
    else:
      cnt = -(l[i]+tmp) -1
      tmp += cnt
      ans2 += abs(cnt)
  else:
    if l[i]+tmp > 0:
      continue
    else:
      cnt = -(l[i]+tmp) +1
      tmp += cnt
      ans2 += abs(cnt)


print(min(ans1,ans2))

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

int main() {
  string S; cin >> S;

  string next = "";
  if (S == "Sunny") { next = "Cloudy"; }
  else if (S == "Cloudy") { next = "Rainy"; }
  else { next = "Sunny"; }
  cout << next << endl;
}

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

int main() {
    int n, a[100005], x, count=0;
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> x;
        count++;
        a[x]=count;
    }
    for(int i=0; i<n; i++) cout << a[i+1] << endl;
}

Measured memory_bytes: 1152
N,M=map(int,input().split())
if N == 1:begin,end=0,10
elif N==2:begin,end=10,100
else: begin,end=100,1000
ans = -1
SC=[]
for i in range(M):
  s,c = map(int,input().split())
  SC.append((s,c))
for n in range(begin,end):
  count = 0
  n = str(n)
  for i in range(M):
    if int(n[SC[i][0]-1])==SC[i][1]:count+=1
  if count==M:
    ans=n
    break
print(ans)

Measured memory_bytes: 9160
import math
a, b, x = list(map(int, input().split()))
if a * a * b / 2 <= x:
    print(math.degrees(math.atan(2 * (b * (a ** 2) - x) / (a ** 3))))
else:
    print(math.degrees(math.atan((a * b ** 2) / (2 * x))))

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

using namespace std;

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

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				printf("yaha aya\n")
#define debug(x,y)		printf("%d %d\n",x,y)
#define fast_io			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define grt				greater<int>()

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

int main(void)
{
	int N,W;cin>>N>>W;
	int w[N],v[N];
	rep(i,0,N-1) cin>>w[i]>>v[i];
	ll dp[N+1][W+1];
	fill(dp,0);
	rep(i,0,N)
		rep(j,0,W)
		if(i == 0 or j == 0)
			dp[i][j] = 0;
		else if(w[i-1] > j)
			dp[i][j] = dp[i-1][j];
		else
			dp[i][j] = max(dp[i-1][j], dp[i-1][j - w[i-1]] + v[i-1]);

	cout<<dp[N][W]<<"\n";
}

Measured memory_bytes: 79104
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const ll mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n; cin >> n;
    vector<int> a(n); rep(i,n) cin >> a[i];
    vector<int> b(n); rep(i,n) cin >> b[i];
    vector<int> c(n,0);
    vector<int> d(n,0);
    vector<pii> e(n,{0,0}); rep(i,n) e[i].second = i;
    vector<int> bi(29,0);
    rep(bit,29){
        rep(i,n){
            if(b[e[i].second]>>bit & 1){
                e[i].first += 1<<bit;
                d[i] += 1<<bit;
            }
        }
        sort(all(d));
        sort(all(e));
        rep(i,n){
            int cnt = 0;
            if(a[i]>>bit & 1){
                c[i] += 1<<bit;
                cnt += lower_bound(all(d), (1<<(bit+2)) - c[i]) - lower_bound(all(d), 3*(1<<bit)-c[i]);
                cnt += lower_bound(all(d), (1<<(bit+1)) - c[i]) - d.begin();
            }else{
                cnt += lower_bound(all(d), (1<<(bit+1)) - c[i]) - lower_bound(all(d), (1<<bit) - c[i]);
            }
            bi[bit] = (bi[bit] + cnt) % 2;
        }
    }
    int ans = 0;
    rep(bit,29){
        if(bi[bit] & 1) ans += 1<<bit;
    }
    cout << ans << "\n";
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int T;
double XA,YA,RA;
double XB,YB,RB;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>T;
	while(T--) {
		cin>>XA>>YA>>RA;
		cin>>XB>>YB>>RB;
		double D=hypot(XA-XB,YA-YB);
		
		double X=0.5/RA;
		double r1=X-1/(RA+D-RB);
		double r2=X-1/(RA+D+RB);
		
		double x = sqrt(r1*r2);
		double r3 = 0.5/x;
		double a = 0.5/(x-r1);
		double b = 0.5/(x-r2);
		double r4 = abs(a-b);
		
		double dif=(r4-r3)/2;
		double at = asin(dif/(r3+dif));
		_P("%d\n",(int)(atan(1)*4/at));
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		String S = sc.next();
		int passed = 0;
		int passedFore = 1;
		for(int i = 0 ; i < n ; i++) {
			if(S.charAt(i) == 'a') {
				if(passed < A + B) {
					passed++;
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			} else if(S.charAt(i) == 'b') {
				if(passed < A + B && passedFore <= B) {
					passedFore++;
					passed++;
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			} else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 34976
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FModularness solver = new FModularness();
        solver.solve(1, in, out);
        out.close();
    }

    static class FModularness {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();
            int q = in.nextInt();
            long d[] = new long[k];
            for (int i = 0; i < k; i++) d[i] = in.nextInt();
            while (q-- > 0) {
                long c = 0;
                long n = in.nextLong();
                long x = in.nextLong();
                long m = in.nextLong();
                long an = x;
                for (int i = 0; i < k; i++) {
                    long temp = (n - 2 + k - i) / k;
                    an += temp * (d[i] % m);
                    if (d[i] % m == 0) c += temp;
                }
                c += ((an / m) - (x / m));
                out.println(n - c - 1);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 27472
#pragma GCC optimize(3)
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<bitset>
#include<deque>
using namespace std;
#define ll long long
// #define inf 0x3f3f3f3f
#define ri register int
#define il inline
#define fi first
#define se second
#define mp make_pair
#define pi pair<int,int>
#define mem0(x) memset((x),0,sizeof (x))
#define mem1(x) memset((x),0x3f,sizeof (x))
il char gc()
{
	static const int BS = 1 << 22;
	static unsigned char buf[BS], *st, *ed;
	if (st == ed) ed = buf + fread(st = buf, 1, BS, stdin);
	return st == ed ? EOF : *st++;
}
#define gc getchar
template<class T>void in(T &x)
{
	x = 0;
	bool f = 0;
	char c = gc();
	while (c < '0' || c > '9')
	{
		if (c == '-') f = 1;
		c = gc();
	}
	while ('0' <= c && c <= '9')
	{
		x = (x << 3) + (x << 1) + (c ^ 48);
		c = gc();
	}
	if (f) x = -x;
}
#undef gc
#define pb push_back
ll n;
int s[500], hd = 250, tl = 249;
int dfs(ll x)
{
	if (x == 0) return 0;
	if (x == 1)
	{
		s[++tl] = 1;
		return 1;
	}
	if (x & 1)
	{
		int t = dfs(x >> 1);
		s[++tl] = t + 1;
		return t + 1;
	}
	else
	{
		int t = dfs(x - 1);
		s[--hd] = t + 1;
		return t + 1;
	}
}
signed main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
#endif
	in(n);
	dfs(n);
	printf("%d\n", 100 + tl - hd + 1);
	for (ri i = 1; i <= 100; ++i) printf("%d ", i);
	for (ri i = hd; i <= tl; ++i) printf("%d ", s[i]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(pos,mp) for(ll pos=mp.begin();pos!=mp.end();pos -++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);
    rep(i, n)cin >> v[i];

    ll ans = 0;
    rep(left, min(n, k) + 1)rep(right, min(n, k) + 1 - left){
        vector<ll> res = v;
        res.erase(res.begin()+left, res.end()-right);

        sort(ALL(res));

       rep(i, k-left-right){
            if(res.empty() || res.front() >= 0)break;
            res.erase(res.begin());
        }

        ans = max(ans, accumulate(ALL(res), 0LL));
    }

    cout << ans << endl;
}

Measured memory_bytes: 3608
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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 main() {
	
	int n, m;
	cin >> n >> m;
	double cnt = 0;
	double sum = 0;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a.begin(), a.end());
	
	for (int i = n - 1; 0 < m; i--) {
		if (cnt == m) break;
		//cout << sum * (1.0 / (4 * m)) << endl;
		if (a[i] < sum * (1.0 / (4 * m))) {
			cout << "No" << endl;
			return 0;
		}
		cnt++;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256