akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  char c;
  cin>>c;
  if(c=='A') cout<<'T'<<endl;
  if(c=='T') cout<<'A'<<endl;
  if(c=='G') cout<<'C'<<endl;
  if(c=='C') cout<<'G'<<endl;
  return 0;
}

Measured memory_bytes: 256
def solve(string):
    *nkrsp, t = string.split()
    n, k, *rsp = map(int, nkrsp)
    table = {k: v for k, v in zip("spr", rsp)}
    ans = 0
    for s in range(k):
        u = t[s::k]
        i = 0
        while i < len(u):
            c = 1
            while i < len(u) - 1 and u[i] == u[i + 1]:
                i += 1
                c += 1
            ans += (c + 1) // 2 * table[u[i]]
            i += 1
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 3316
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}


 main()

{
    fast
    int h;
    cin>>h;
    int last=1;
    int x=h;
    int cnt=0;
    if(x==1)
    {
        cout<<"1"<<endl;
        return 0;
    }
    while(1)
    {
        x=x/2;
        cnt+=last;
        last=last*2;
        if(x==1)break;
    }
    cnt+=last;
    cout<<cnt<<endl;

















    return 0;

}













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

using namespace std;
using ll=long long;

ll n,k;

ll search(vector<ll> a,vector<ll> f){
     ll l=-1,r=1e17+1;
     while(abs(l-r)>1){
         ll mid=(l+r)/2;
         ll cnt=0;
         for(int i=0;i<n;i++){
             cnt+=max(0ll,a[i]-mid/f[i]);
         }
         if(cnt>k)l=mid;
         else r=mid;
     }
     return r;
}

int main(){
    cin>>n>>k;
    vector<ll> a(n),f(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>f[i];
    sort(a.begin(),a.end());
    sort(f.begin(),f.end(),greater<>());
    cout<<search(a,f)<<endl;
}


Measured memory_bytes: 6528
import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]
INF = 10**18
arr = [INF]*(N+1)
arr[0] = -1
for a in A:
    l, r = 0, N
    while (r-l) > 1:
        mid = (r+l)//2
        if arr[mid] < a:
            l = mid
        else:
            r = mid
    arr[r] = a
for i in range(N, 0, -1):
    if arr[i] != INF:
        print(i)
        break


Measured memory_bytes: 10448
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#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 <memory>
#include <regex>
using namespace std;

const long long INF = LLONG_MAX / 2;

void solve(const vector<long long>& a, vector<long long>& ans)
{
    int n = a.size();
    vector<long long> diff(n, 0);
    diff[0] = INF;
    for(int i=1; i<n; ++i){
        long long x = abs(a[i-1]);
        long long y = abs(a[i]);
        if(x > y)
            swap(x, y);

        if(a[i-1] <= a[i]){
            while(x < y){
                x *= 4;
                -- diff[i];
            }
        }
        else{
            while(x * 4 <= y){
                x *= 4;
                ++ diff[i];
            }
        }
    }
    
    ans.assign(n+1, 0);
    stack<int> stk;
    for(int i=0; i<n; ++i){
        ans[i+1] = ans[i];
        if(diff[i] > 0){
            stk.push(i);
            continue;
        }

        while(diff[i] < 0){
            int j = stk.top();
            ans[i+1] += i - j;
            ++ diff[i];
            -- diff[j];
            if(diff[j] == 0)
                stk.pop();
        }
    }
}


int main()
{
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    vector<long long> v1;
    solve(a, v1);

    vector<long long> v2;
    reverse(a.begin(), a.end());
    solve(a, v2);

    long long ans = INF;
    for(int i=0; i<=n; ++i){
        long long cost = (i + v1[i] * 2) + (v2[n-i] * 2);
        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6500
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=5000+10;
const int mod=1e9+7;

struct edge { int v,nxt; } e[N<<1];
int head[N];

inline void addEdge(int u,int v) {
    static int e_cnt=0;
    e[++e_cnt]=(edge){v,head[u]},head[u]=e_cnt;
}

int n,sz[N];
int f[N][N],g[N],tmp[N];

inline void dfs(int u,int fa) {
    sz[u]=f[u][1]=1;
    for (re int i=head[u];i;i=e[i].nxt) {
        int v=e[i].v; if (v==fa) continue;
        dfs(v,u);
        for (re int j=1;j<=sz[u]+sz[v];++j) tmp[j]=0;
        for (re int j=1;j<=sz[u];++j)
            for (re int k=0;k<=sz[v];++k)
                tmp[j+k]=(tmp[j+k]+1ll*f[u][j]*f[v][k])%mod;
        sz[u]+=sz[v];
        for (re int j=1;j<=sz[u];++j) f[u][j]=tmp[j];
    }
    for (re int i=2;i<=sz[u];i+=2)
        f[u][0]=(f[u][0]-1ll*f[u][i]*g[i]%mod+mod)%mod;
}

int main() {
    n=read();
    for (re int i=1;i<n;++i) {
        int u=read(),v=read();
        addEdge(u,v),addEdge(v,u);
    }
    g[0]=1;
    for (re int i=2;i<=n;i+=2) g[i]=1ll*g[i-2]*(i-1)%mod;
    dfs(1,0); printf("%d\n",mod-f[1][0]);
    return 0;
}


Measured memory_bytes: 97024
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int a;
	string s;
	cin >> a >> s;
	cout << (a < 3200 ? "red" : s);
}

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

vector<int> L, R;
int n, x, k;

void input(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> x;
        if(x == 0){
            --k;
            continue;
        }
        (x < 0 ? L : R).push_back(abs(x));
    }
    reverse(L.begin(),L.end());
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    input();
    int r = R.size(), l = L.size();
    int ans = INT_MAX;
    if(!k){
        cout << 0 <<'\n';
        return 0;
    }
    if(l >= k) ans = min(ans, L[k-1]);
    if(r >= k) ans = min(ans, R[k-1]);
    for(int i = 0; i < r; i++){
        int p = k-i-2;
        if(0 <= p && p < l) ans = min(ans, R[i] + L[p] + min(R[i],L[p]));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1020
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100000
using namespace std;
typedef long long LL;
struct node
{
	int to,w;
	node *nxt;
}edges[MAXN*4+5];
node *ncnt,*Adj[MAXN+5];
int N,M;
int col[MAXN+5],cnt[3],edcnt=0;
bool legal=true;
void Init()
{
	ncnt=&edges[0];
	memset(col,-1,sizeof(col));
}
void AddEdge(int u,int v,int w)
{
	node *p=++ncnt;
	p->to=v;
	p->w=w;
	p->nxt=Adj[u];
	Adj[u]=p;
}
void DFS(int u)
{
	cnt[col[u]]++;
	for(node *p=Adj[u];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		int w=p->w;
		if(w==1)
			edcnt++;
		if(col[v]==-1)
		{
			col[v]=(col[u]+w)%3;
			DFS(v);
		}
		else if(col[v]!=(col[u]+w)%3)
			legal=false;
	}
}
int main()
{
//	freopen("flower.in","r",stdin);
//	freopen("flower.out","w",stdout);
	Init();
	scanf("%d %d",&N,&M);
	int u,v;
	for(int i=1;i<=M;i++)
	{
		scanf("%d %d",&u,&v);
		AddEdge(u,v,1);
		AddEdge(v,u,2);
	}
	LL ans=0;
	for(int i=1;i<=N;i++)
		if(col[i]==-1)
		{
			edcnt=0;
			legal=true;
			memset(cnt,0,sizeof(cnt));
			col[i]=0;
			DFS(i);
			if(legal==false)
				ans+=(1LL*cnt[0]+1LL*cnt[1]+1LL*cnt[2])*(1LL*cnt[0]+1LL*cnt[1]+1LL*cnt[2]);
			else if(cnt[0]==0||cnt[1]==0||cnt[2]==0)
				ans+=1LL*edcnt;
			else if(legal==true)
				ans+=1LL*cnt[0]*cnt[1]+1LL*cnt[1]*cnt[2]+1LL*cnt[0]*cnt[2];
		}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9472
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if (A < 10 && B < 10) {
			System.out.println(A * B);
		}else {
			System.out.println(-1);
		}
	}

}

Measured memory_bytes: 35832
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	
	if(n < 3) {
		printf("No\n");
		return 0;
	}
	int tmp = (n + 1) % 4;
	
	if(tmp == 1) {
		if((n & (n - 1)) == 0) {
			printf("No\n");
			return 0;
		}
		
		std::vector<std::pair<int, int>> edges;
		edges.push_back({1, 2});
		edges.push_back({2, 3});
		edges.push_back({3, 1 + n});
		edges.push_back({1 + n, 2 + n});
		edges.push_back({2 + n, 3 + n});
		for(int i = 4; i + 5 <= n; i += 4) {
			edges.push_back({edges.back().second, i});
			for(int k = 0; k < 3; k++) edges.push_back({i + k, i + k + 1});
			edges.push_back({i + 3, i + n});
			for(int k = 0; k < 3; k++) edges.push_back({i + k + n, i + k + 1 + n});
		}
		
		int A = n, B = n - 1, C = n - 2, D = n - 3, E = n - 4;
		int X = A ^ B;
		
		edges.push_back({A, X});
		edges.push_back({X, B});
		edges.push_back({B, A + n});
		edges.push_back({B, C});
		edges.push_back({C, D});
		edges.push_back({D, E});
		edges.push_back({E, B + n});
		edges.push_back({B + n, C + n});
		edges.push_back({C + n, D + n});
		edges.push_back({D + n, E + n});
		
//	assert(edges.size() == 2 * n - 1);
		printf("Yes\n");
		for(auto v: edges) printf("%d %d\n", v.first, v.second);
		return 0;
	}
	
	std::vector<std::pair<int, int>> edges;
	edges.push_back({1, 2});
	edges.push_back({2, 3});
	edges.push_back({3, 1 + n});
	edges.push_back({1 + n, 2 + n});
	edges.push_back({2 + n, 3 + n});
	for(int i = 4; i + 3 <= n; i += 4) {
		edges.push_back({edges.back().second, i});
		for(int k = 0; k < 3; k++) edges.push_back({i + k, i + k + 1});
		edges.push_back({i + 3, i + n});
		for(int k = 0; k < 3; k++) edges.push_back({i + k + n, i + k + 1 + n});
	}
	
	if(tmp == 2) {
		int A = n - 1, B = n;

		edges.push_back({A, B});
		edges.push_back({B, 1});
		edges.push_back({1, A + n});
		edges.push_back({A + n, B + n});
	} else if(tmp == 3) {
		int A = n - 2, B = n - 1, C = n;
		
		edges.push_back({A, B});
		edges.push_back({C, B});
		edges.push_back({B, 1});
		edges.push_back({2, C + n});
		edges.push_back({1, A + n});
		edges.push_back({A + n, B + n});
	}
	
	printf("Yes\n");
	for(auto v: edges) printf("%d %d\n", v.first, v.second);
	return 0;
}


Measured memory_bytes: 4464
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string S,ans="No";
    cin >> N >> S;
    if(N%2==0){
        int n = N/2;
        string T = S.substr(0,n);
        if(S==T+T) ans = "Yes";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3560
#
import sys
import math
import numpy as np
import itertools

n = int(input())

# n行の複数列ある数値をそれぞれの配列へ
a, b = [0]*n, [0]*n
for i in range(n): a[i], b[i] = map(int, input().split())

#print(a,b)

a.sort()
b.sort()

if n % 2 == 0:
    t = a[n//2-1] + a[n//2]
    s = b[n//2-1] + b[n//2]
    print(s-t+1)
else:
    t = a[n//2]
    s = b[n//2]
    print(s-t+1)




Measured memory_bytes: 43356
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
int main() { 
  int n;
  cin >> n;
  vector<int> p(n); 
  rep(i, n) cin >> p[i];
  int k = 0;
  rep(i, n) if(p[i] != i + 1) k++;
  if(k <= 2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100100;
int par[N];
vector<int> g[N];
int dp[N];
int ans;
int n, k;

void dfs(int v)
{
	dp[v] = 0;
	for (int u : g[v])
	{
		dfs(u);
		dp[v] = max(dp[v], dp[u] + 1);
	}
	if (v == 0 || par[v] == 0) return;
	if (dp[v] == k - 1)
	{
//		printf("%d\n", v);
		ans++;
		dp[v] = -1;
	}
	return;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++)
	{
		int v;
		scanf("%d", &v);
		v--;
		if (i == 0)
		{
			if (v != 0)
				ans++;
			continue;
		}
		par[i] = v;
		g[v].push_back(i);
	}
	dfs(0);
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int n,c,cnt,Max;
int main() {
	scanf("%d%d",&n,&c);
	Max=(n-1)*(n-2)/2,cnt=n-1;
	if(c>Max)return !puts("-1");
	cnt+=Max-c;
	printf("%d\n",cnt);
	for(int i=2; i<=n; i++)printf("1 %d\n",i);
	for(int i=2; i<=n; i++) {
		if(c==Max)break;
		for(int j=i+1; j<=n; j++) {
			if(c==Max)break;
			c++;
			printf("%d %d\n",i,j);
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

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

vector<bool> flag(1000010,false);

int main(){
    int n;
    cin >> n;
    vl a(n);
    rep(i,n) cin >> a[i];
    bool pc_f = true;

    rep(i,n){
        ll N = a[i];
        if(N == 1) continue;

        for (ll a = 2; a * a <= N; ++a) {
            if (N % a != 0) continue;
            ll ex = 0;
            while (N % a == 0) {
                ++ex;
                N /= a;
            }

            if(!flag[a])flag[a] = true;
            else pc_f = false;

        }
        if(N != 1){
            if(!flag[N]){ 
                flag[N] = true; 
            }else{
                pc_f = false;
            }
        }

        if(!pc_f) break;
    }

    if(pc_f){
        cout << "pairwise coprime" << endl;
        return 0;
    }


    ll tmp = a[0];
    rep(i,n-1){
        tmp = gcd(tmp,a[i+1]);
    }
    if(tmp != 1){
            cout << "not coprime" << endl;
            return 0;
    }
    cout << "setwise coprime" << endl;
    return 0;
}

Measured memory_bytes: 11180
#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>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  rep(i, n+1) cin >> a[i];

  vector<ll> cum(n+1);
  cum[n] = a[n];
  for (int i = n-1; i >= 0; i--) {
    cum[i] = a[i] + cum[i+1];
  }

  ll nd = 1;
  ll ans = 0;
  rep(i, n+1) {
    if (nd < a[i]) {
      ans = -1;
      break;
    }
    ans += nd;
    nd -= a[i];
    if (i < n) nd = min(2*nd, cum[i+1]);
    // printf("ans = %lld, nd = %lld\n", ans, nd);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4516
#include "bits/stdc++.h"
using namespace std;

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

	cin>>x;
	if(x==7 || x==5 || x==3)
		cout<<"YES";
	else
		cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
int main()
{
	while (true)
	{
		int passed = 0;
		int days[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
		int m, d;
		std::cin >> m >> d;
		if (m == 0)
		{
			break;
		}
		for (int i = 0; i < m - 1; i++)
		{
			passed += days[i];
		}
		passed += d - 1;
		switch (passed % 7)
		{
		case 0:
			std::cout << "Thursday" << std::endl;
			break;
		case 1:
			std::cout << "Friday" << std::endl;
			break;
		case 2:
			std::cout << "Saturday" << std::endl;
			break;
		case 3:
			std::cout << "Sunday" << std::endl;
			break;
		case 4:
			std::cout << "Monday" << std::endl;
			break;
		case 5:
			std::cout << "Tuesday" << std::endl;
			break;
		case 6:
			std::cout << "Wednesday" << std::endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 2988
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    if(abs(x) / d >= k)
    {
        cout << abs(x) - k * d << endl;
    }
    else
    {
        int num = x / d;
        if((k - num) % 2 == 0) cout << abs(x % d) << endl;
        else cout << d - abs(x % d) << endl;
    }
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl
#define PII pair<int,int>
typedef long long ll;
const int maxn=2e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=1e9;
const double ep=1e-7;
using namespace std;
int main()
{
	int x,y,z;
	scanf("%d%d%d",&x,&y,&z);
	printf("%d %d %d\n",z,x,y);
}

Measured memory_bytes: 256
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**6
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

X,Y = list(map(int,input().split()))
if (X+Y)%3 != 0:
    print(0)
    exit()
N = (X+Y)//3
K = min(2*N-X,X-N)
print(cmb(N,K,mod))

Measured memory_bytes: 128200
N = int(input())
A = []
for i in range(N):
    A.append(int(input()) )

B=sorted(A)
#print(B[N-1]-B[0] + B[N-1]-B[0])
hN=int(N/2)
cnt=0
C=[]
if N ==2:
    print(B[1]-B[0])
    exit()

if N %2 == 0:
    C.append(B[hN])
    for i in range(hN-1):
        C.append(B[N-1-i])
        C.append(B[i])
    C.append(B[hN-1])
else:
    C.append(B[hN])
    for i in range(hN):
        C.append(B[N-1-i])
        C.append(B[i])

#print(C)

for i in range(1,N):
    cnt+=abs(C[i]-C[i-1])

C=[]
cnt2=0
if N %2 == 0:
    C.append(B[hN])
    for i in range(hN-1):
        C.append(B[i])
        C.append(B[N-1-i])
    C.append(B[hN-1])
else:
    C.append(B[hN])
    for i in range(hN):
        C.append(B[i])
        C.append(B[N-1-i])

#print(C)
for i in range(1,N):
    cnt2+=abs(C[i]-C[i-1])

print(max(cnt,cnt2))

Measured memory_bytes: 8940
import java.util.*;
import java.util.HashSet;
import java.util.Set;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=A+B;
        if(D>=C){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
       
        
    }}

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

int main(){
    int n, ans = 0;
    bool exist_odd = false;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    while(!exist_odd){
        rep(i, n){
            if(a.at(i)%2 != 0){
                exist_odd = true;  // 奇数があるときにフラグを立てる
                break;
            }
        }
        if(!exist_odd) {  // 奇数がない(全部２で割り切れる)とき
            rep(i, n) a.at(i) /= 2;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int max(int a,int b){
  if(a > b) return a;
  else return b;
}

int main(){
  int n;
  int a[100000];
  int b[100000];
  int c[100000];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d %d",&a[i],&b[i],&c[i]);
  }
  int dp[100000][3];
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  int i;
  for(i=1;i<n;i++){
    dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
    dp[i][2] = c[i] + max(dp[i-1][1], dp[i-1][0]);
  }
  int answer;
  answer = max(dp[n-1][0],dp[n-1][1]);
  answer = max(dp[n-1][2],answer);
  printf("%d",answer);
  return 0;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
	
	long long int N,ans=1,a=1;
	cin>>N;
	for(int i=1;i<=N;i++){
		ans=(ans*i)%1000000007;
	}
	cout<<ans<<endl;
	/*int x,a=1,b,c,d,e;
	cin>>x;
	for(int j=0;;j++){
		for(int i=0;i<4;i++){
			b=x/a;
			c=b/a;
			d=c/a;
			e=d/a;
			if(a==e){
				cout<<a<<endl;
				break;
			}
			a++;
		}
		if(a==e)break;
	}*/
	return 0;
}

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

using namespace std;

const int MAXN = 1e3 + 10;

int n, T, k, m;

int a[MAXN][MAXN], dp[MAXN][MAXN];

string s, t;

const int MOD = 1e9 + 7;

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> s;
        for (int j = 0; j < m; j++)
            a[i][j] = s[j];
    }

    dp[n - 1][m - 1] = 1;
    for (int i = n - 1; i >= 0; i--)
        for (int j = m - 1; j >= 0; j--) {
            if (a[i][j] == '.') {
                if (j < m - 1 && a[i][j + 1] == '.')
                    dp[i][j] = (dp[i][j] + dp[i][j + 1]) % MOD;

                if (i < n - 1 && a[i + 1][j] == '.')
                    dp[i][j] = (dp[i][j] + dp[i + 1][j]) % MOD;            
            }
        }
    
    cout << dp[0][0];
}


Measured memory_bytes: 11416
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template <class _T> static _T tp_modpow(_T a, _T n, _T mod = (_T)1) {
	_T ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans = ans * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}

template <class _T> static _T tp_modfact(_T n, _T k, _T mod = (_T)1) {
	_T count = 0;
	_T ans = 1;

	while (count < k) {
		ans = ans * (n - count) % mod;
		count++;
	}
	return ans;
}
template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void D_task();
#if 1
int main()
{
	D_task();
	fflush(stdout);
	return 0;
}
#endif


static void D_task()
{
	LLONG N, A, B;
	getint<LLONG>(N, A, B);
	
	LLONG total = tp_modpow<LLONG>(2, N, MOD_NUM) % MOD_NUM - 1;
	LLONG aCnt =
		tp_modfact<LLONG>(N, A, MOD_NUM)
		* tp_modpow<LLONG>(
			tp_modfact<LLONG>(A, A, MOD_NUM),
			MOD_NUM - 2,
			MOD_NUM
			)
		% MOD_NUM;
	LLONG bCnt = tp_modfact<LLONG>(N, B, MOD_NUM)
		* tp_modpow<LLONG>(
			tp_modfact<LLONG>(B, B, MOD_NUM),
			MOD_NUM - 2,
			MOD_NUM
			)
		% MOD_NUM;
	LLONG ans = (total - aCnt - bCnt) % MOD_NUM;
	printf("%lld\n", (ans < 0) ? ans + MOD_NUM : ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222



ll a[3333], b[3333], dp[3333][3333];


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


  cin >> n >> m;
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  rep(i, m+1) dp[0][i] = 1;
  rep(i, n+1) dp[i][0] = 1;
  rep(i, n) {
    rep(j, m) {
      (dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]) %= mod;
      if (a[i] != b[j]) (dp[i + 1][j + 1] += mod - dp[i][j]) %= mod;
    }
  }
  
  cout << dp[n][m] << endl;
  

  return 0;
}

Measured memory_bytes: 52992
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
typedef long long int ll;

#define min(x,y)(x<y?x:y)

 
using namespace std;
 
int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else{
		return a * power(a, N - 1);
	}
}

int main() {
	FAST;

	int N, i, j;

	cin >> N;

	int *dp = (int *)malloc(sizeof(int) * (N + 1));
	dp[0] = 0;
	for(i = 1; i <= N; i++){
		dp[i] = dp[i - 1] + 1;
		for(j = 1; power(6, j) <= i; j++){
			dp[i] = min(dp[i], dp[i - power(6, j)] + 1);
		}
		for(j = 1; power(9, j) <= i; j++){
			dp[i] = min(dp[i], dp[i - power(9, j)] + 1);
		}
	}

	cout << dp[N];

	return 0;
}

Measured memory_bytes: 640
import bisect,collections,copy,heapq,itertools,math,numpy,string,scipy
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N,K = LI()
    P = LI()
    Pe = [(v+1)/2 for v in P]
    P_ms = numpy.cumsum(Pe)
    if K==N:print("{:.12f}".format(sum(Pe)));exit(0)
    ans = 0
    for i in range(K,N):
        ans = max(ans,P_ms[i]-P_ms[i-K])
    print("{:.12f}".format(ans))
main()



Measured memory_bytes: 54872
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int32_t main()
{
	reus;
	int n;
	cin>>n;
	int ans=0;
	for(int i=2;i<1000010;i++)
	{
		int c=0;
		while(n%i==0)
		{
			c++;
			n/=i;
		}
		for(int j=1;j<10000;j++)
		{
			if(c<j)
			break;
			ans++;
			c-=j;
		}
	}
	if(n>1)
	ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;
long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}
ll modinv(ll a){ ll b=mod,u=1,v=0,t; while(b){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return (u+mod)%mod; }
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
ll modncr(ll n,ll r){ ll i,plus=1; rep(i,r){ plus=(plus*(n-i))%mod; plus=moddevide(plus,i+1); } return plus; }
ll gcd(ll a, ll b) { if(a<b) return gcd(b, a); ll r; while ((r=a%b)){a=b;b=r;} return b; }
ll countdigits(ll n){ ll ans=0; while(n){n/=10;ans++;} return ans; }
ll sumdigits(ll n){ ll ans=0; while(n){ans+=n%10;n/=10;} return ans; }
void printmap(vector<ll>& a,ll H,ll W){ ll i,j; For(i,0,H+2){ For(j,0,W+2){cout<<a[i*(W+2)+j];} cout<<endl; } } void inputmap(vector<ll>& a,ll H,ll W){ ll i,j; string ss; For(i,1,H+1){ cin>>ss; For(j,1,W+1){ if(ss[j-1]=='#'){ a[i*(W+2)+j]=1; }else{ a[i*(W+2)+j]=0; } } } }
int main(){
  ll i,j,N,K,a;
  string ss;
  cin>>N;
  vec v(N);
  cin>>a;
  rep1(i,N){
    cin>>K;
    a=a/gcd(a,K)*K;
  }
  cout<<a<<endl;
  return 0;
}


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

typedef pair<long long,long long> ii;
typedef pair<long long,ii> iii;

long long me[50][60*50],c[50],d[50];
long long res[50];

vector < vector <iii> > mv;

int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	long long n,m,s,u,v,a,b;
	cin>>n>>m>>s;
	mv.resize(n);
	for(int i=0;i<m;i++){
		cin>>u>>v>>a>>b;
		u--;v--;
		mv[u].push_back(iii(v,ii(a,b)));
		mv[v].push_back(iii(u,ii(a,b)));
	}
	for(int i=0;i<n;i++){
		cin>>c[i]>>d[i];
		for(int j=0;j<=n*50;j++)me[i][j] = 1000000000000000;
		res[i] = 1000000000000000;
	}
	if(s>n*50)s=n*50;
	me[0][s] = 0;
	res[0] = 0;
	priority_queue <iii> mq;
	mq.push(iii(0,ii(0,s)));
	long long t,ac,ns,ts;
	while(!mq.empty()){
		iii top = mq.top();
		mq.pop();
		t = -top.first;
		ac=top.second.first;
		s = top.second.second;
		//if(ac==0)cout<<ac<<' '<<s<<' '<<t<<' '<<me[ac][s]<<endl;
		if(me[ac][s]==t){
			if(t<res[ac])res[ac] = t;
			if(s<n*50){
				ns = s +c[ac];
				if(ns>n*50)ns = n*50;
				ts = t +d[ac];
				if(ts<me[ac][ns]){
					me[ac][ns] = ts;
					mq.push(iii(-ts,ii(ac,ns)));
				}
			}
			for(int i=0;i<mv[ac].size();i++){
				v = mv[ac][i].first;
				a = mv[ac][i].second.first;
				b = mv[ac][i].second.second;
				ts = t + b;
				if(a<=s&&me[v][s-a]>ts){
					me[v][s-a]=ts;
					mq.push(iii(-ts,ii(v,s-a)));
				}
			}
		}
	}
	for(int i=1;i<n;i++)cout<<res[i]<<endl;
	
	return 0;
}

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


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

ll solve(int N, vector<int>& S) {
    sort(ALL(S));
    auto used = vector<int>{S.back()};
    multiset<int> unused;
    REP(i, (1<<N) - 1) unused.insert(S[i]);

    int num_of_gen = 1;

    while (SIZE(used) < (1<<N)) {
        vector<int> next_used;
        REP(i, num_of_gen) {
            auto loc = unused.lower_bound(used[i]);
            if (loc == unused.begin()) return false;
            next_used.pb(used[i]);
            auto loc_prev = loc;
            --loc_prev;
            next_used.pb(*loc_prev);
            unused.erase(unused.find(*loc_prev));
        }
        used = next_used;
        num_of_gen *= 2;
    }
    return true;
}

int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> S((1<<N));
    REP(n, (1<<N)) cin >> S[n];

    if (solve(N, S)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <cmath>

#ifdef LOCAL
  #define debug_echo(expr) cout << expr << "\n";
#else
  #define debug_echo(expr)
#endif

using namespace std;

#define at ,<=,
#define to ,<,
#define in ,
#define forrange(...)  forrange1(forrange2, (__VA_ARGS__))
#define forrange1(X, A) X A
#define forrange2(i, s, op, e) for (int i = (s); i op (e); i++)

void dfs(vector<int>& scores, int& result, int now, int n) {
  if (n >= scores.size()) {
    if (now % 10 != 0) {
      result = max(result, now);
    }
    return;
  }
  dfs(scores, result, now + scores[n], n+1);
  int acc = now;
  forrange (i in n+1 to scores.size()) {
    acc += scores[i];
  }
  if (acc % 10 == 0) {
    return;
  }
  if (acc > result) {
    dfs(scores, result, now, n+1);
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> scores(N);
  forrange (i in 0 to N) {
    cin >> scores[i];
  }

  int result = 0;
  dfs(scores, result, 0, 0);
  cout << result << "\n";
}


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

using namespace std;

int saikou(int x,int y);
int makeans(int n,vector<int> a,int M);


int main(){
    int n,ans;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i ++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());

    if(a.at(0) == 1){
        cout << 1 << endl;
        return 0;
    }

    int M = saikou(a.at(0),a.at(1));

    ans = makeans(n,a,M);

    cout << ans << endl;
}


int saikou(int x,int y){
    while(x != y){
        if(x < y){
            y -= x;
        }else{
            x -= y;
        }
    }
    return x;
}

int makeans(int n,vector<int> a,int M){
    for(int i = M;i > 0;i --){
        int j;
        for(j = 0;j < n;j ++){
            if(a.at(j) % i != 0){
                break;
            }
        }
        if(j == n){
            return i;
        }
    }

}

Measured memory_bytes: 1280
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    int n,k,a[200005];
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i>k){
            if(a[i]>a[i-k]){
                cout<<"Yes"<<endl;
            }else{
                cout<<"No"<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3912
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
// #define mod             1000000007  //998244353// 1e9 + 7
int mod = 1e9;
int modd = 1e9;
#define inf             1000000007 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define MAXN 			10000004
#define mt 				make_tuple
#define eps             1e-6
#define endl			'\n'
#define test            int t; cin>>t; while(t--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define tree            tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
// int fact[1000007]={0};
// int spf[(int)(1e7) + 20];
// bool prime[(int)((1e7) + 20)];
// int gcd(int a,int b){if(b==0)return a; return gcd(b,a%b);}
// void sp(int n){spf[1]=1;for(int i=2;i<n;i++)spf[i]=i;for(int i=4;i<n;i+=2)spf[i]=2;for(int i=3;i*i<n;i++){if(spf[i]==i){for(int j=i*i;j<n;j+=i)if(spf[j]==j)spf[j]=i;}}}
// void sieve(int n){memset(prime,true,sizeof(prime) );for(int p=2;p*p<=n;p++){if(prime[p]==true)for(int i=p*p;i<=n;i+=p)prime[i]=false;}prime[0]=false;prime[1]=false;}
// int xyp(int x,int y){int res=1;while(y>0){if(y%2==1) res=(res*x)%mod;x=(x*x)%mod;y/=2;}return res%mod;}
// int inv(int x){return xyp(x,mod - 2);}
// int inv_euclid(int a, int m = mod){int m0 = m;int y = 0, x = 1;if (m == 1)return 0;while (a > 1){int q = a / m;int t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
// void init() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
// int ncr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[r],mod-2)))%mod; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res;}
// int npr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res; }
// bool isp(int a){if(a == 2)return true;if(a == 1)return false;for(int x= 2; x <= sqrt(a) + 1; x++)if(a % x == 0)return false;return true;}
// int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
// int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
// int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
// #define p_set tree< pair<int,int> ,  null_type ,  less<pair<int,int>> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// #define i_set tree< int ,  null_type ,  less< int > ,  rb_tree_tag ,  tree_order_statistics_node_update>
// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
// int dx[] = {1, -1, 0};
// int dy[] = {1, -1, 0};
signed main()
{
	fast_io
	ld r;
	cin >> r; 
	r *= 2.000*acos(-1);
	cout << fixed << setprecision(4) << r << endl;
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  int n,x,ans=0;
  int a[100009];
  cin>>n>>x;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n-1;i++){
    if(a[i]+a[i+1]>x){
      int temp=a[i]+a[i+1]-x;
      ans+=temp;
      a[i+1]-=temp;
      if(a[i+1]<0)a[i+1]=0;
    }
  }
  cout<<ans<<endl;
  return(0);
}
  

Measured memory_bytes: 1024
n = int(input())
l = list(map(int, input().split()))
s = 0
if n <= 2:
  s = 0
else:
  for i in range(n):
    for j in range(i+1, n):
      for k in range(j+1, n):
        a = l[i]
        b = l[j]
        c = l[k]
        if a+b>c and b+c>a and c+a>b and a != b and b != c and c != a:
          s += 1
print(s)

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

int main(){
  int n;
  cin >> n;
  int count=0;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    while(a%2==0){
      count++;
      a/=2;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val result = solve(Scanner(System.`in`))
    if (result.isNotEmpty()) println(result)
}

const val MOD = 1000000007L

fun modMul(a: Long, b: Long): Long = (a * b) % MOD

fun modDiv(a: Long, b: Long): Long = (a * modPow(b, MOD - 2)) % MOD

fun modPow(a: Long, p: Long): Long = when {
    p == 0L -> 1
    p % 2 == 1L -> (a * modPow(a, p - 1)) % MOD
    else -> {
        val half = modPow(a, p / 2)
        (half * half) % MOD
    }
}

fun solve(sc: Scanner): String {
    val X = sc.nextInt()
    val Y = sc.nextInt()

    if ((X + Y) % 3 != 0) {
        return "0"
    }
    val a = ((2 * Y) - X) / 3
    val b = ((2 * X) - Y) / 3
    if (b < 0 || a < 0) {
        return "0"
    }

    var result = 1L
    for (i in (b + 1)..(a + b)) {
        result = modMul(result, i.toLong())
    }
    for (i in (1..a)) {
        result = modDiv(result, i.toLong())
    }

    return result.toString()
}


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

int a[5][5];
int n,t;
int main()
{
	for(int i = 1;i<=3;i++)
		for(int j = 1;j<=3;j++)
			cin>>a[i][j];
	cin>>n;
	while(n--){
		cin>>t;
		for(int i = 1;i<=3;i++)
			for(int j = 1;j<=3;j++)
				a[i][j] = a[i][j] == t? -1 : a[i][j]; 
	}
	for(int i = 1;i<=3;i++){
		int flag = 0;
		for(int j = 1;j<=3;j++){
			flag += a[i][j];
		}
		if(flag == -3){
			cout<<"Yes"<<endl;
			return 0;
		}
		flag = 0;
		for(int j = 1;j<=3;j++){
			flag += a[j][i];
		}
		if(flag == -3){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	if(a[1][1]+a[2][2]+a[3][3]==-3||a[1][3]+a[2][2]+a[3][1]==-3)
		cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=55,mo=1e9+7;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int c[N][N],f[N][N];
void cal(int &x,int y){
    x+=y;
    if (x>=mo) x-=mo;
    return;
}
int main(){
    int n; cin>>n;
    for (int i=0; i<=n; ++i){
	c[i][0]=1;
	for (int j=1; j<=i; ++j)
	    c[i][j]=(c[i-1][j-1]+c[i-1][j])%mo;
    }
    f[1][0]=f[1][1]=1;
    for (int i=1; i<=n; ++i)
	for (int j=0; j<=i; ++j){
	    if (!f[i][j]) continue;
	    for (int x=0; x<=n-i; ++x)
		for (int y=0; y<=n-i-x; ++y)
		    if (x+y>0&&x+y>=j&&((x+y-j)&1)==0)
			cal(f[i+x+y][abs(j+(x+y-j)/2-x)],1ll*c[i+x+y][x+y]*c[x+y][x]%mo*f[i][j]%mo);
	}
    cout<<f[n][0]<<endl;
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
s=input() ;a=len(s)
t=input() ;b=len(t)
def gcd(a,b):
    if b==0: return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)
L=lcm(len(s),len(t))

d={}
now=0
for i in range(0,L,L//a):
    d[i]=s[now]
    now+=1
now=0
for j in range(0,L,L//b):
    if d.get(j, t[now])!=t[now]:
        print(-1);exit()
    now+=1
print(L)

Measured memory_bytes: 19340
#include <iostream>
#include <stack>

using namespace std;

int main() {
    stack<int> rail;
    int n;
    
    while (cin >> n) {
        if (n == 0) {
            cout << rail.top() << endl;
            rail.pop();
        }
        else {
            rail.push(n);
        }
    }

    return 0;
}

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

int main(void){
        int H,W;
        while(1) {
                cin>>H>>W;
                if (H==0 and W==0) {
                        return 0;
                }
                for(int i=0; i<H; i++) {
                        for(int j=0; j<W; j++) {
                                if((i+j)%2==0) {
                                        printf("#");
                                }
                                else{
                                        printf(".");
                                }
                        }
                        printf("\n");
                }
                printf("\n");
        }
}



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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;





int main(){
  ll p, q, r;
  cin >> p >> q >> r;

  cout << min(p+q, min(q+r, r+p)) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
    long long n;
    cin >> n;
    long long mx;
    cin>>mx;
    long long answer = 0;
    for (int i = 1; i < n; i++)
    {
        long long a;
        cin >> a;
        mx = max(mx, a);
        answer += mx - a;
    }
    cout << answer << endl;
}

Measured memory_bytes: 3624
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b, c] <- sort <$> map strToInt . words <$> getLine
    -- 出力
    putStrLn $ if a == 5 && b == a && c == 7 then "YES" else "NO"


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

using namespace std;
typedef  long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)

int f(string a, string  b) {
    int ans = 0;
    int t[26] = {};
    for (int i = 0; i < a.size(); i++)
        for (int j = 0; j < b.size(); j++)
            if (a[i] == b[j])
                t[a[i]-'a']++;

    for (int i = 0; i < 26; i++)
        if (t[i] > 0)
            ans++;

    return ans;
}

int main () {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = max(ans, f(s.substr(0, i), s.substr(i, n)));
    }
    cout << ans << endl;

    return 0;
 }


Measured memory_bytes: 256
N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
    if S[i]=="o" and span >= C:
        maru += 1
        last = i
        F.append([maru,last])
        span = 0
    else:
        span += 1
        F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 10**9
span = C
E = []
for i in range(N):
    if s[i] == "o" and span >= C:
        maru += 1
        last = N-1-i
        E.append([maru,last])
        span = 0
    else:
        E.append([maru,last])
        span += 1
E = E[::-1]
#print(E)
F = [[0,-10**9]] + F + [[0,10**9]]
E = [[0,-10**9]] + E + [[0,10**9]]
#print(F)
#print(E)
ans = []
for i in range(1,N+1):
    cnt = F[i-1][0] + E[i+1][0]
    
    if S[i-1] == "o":
        if E[i+1][1] - F[i-1][1] < C:
            cnt -= 1
        if cnt == K-1:
            ans.append(i)
    #print(F[i-1],E[i+1],cnt)
for i in range(len(ans)):
    print(ans[i])

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


void fst() {ios::sync_with_stdio(0);cin.tie(0);
    #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    #endif
    }    
int nxt(){int x;cin>>x;return x;}
int nex_l(){long long x;cin>>x;return x;}
  
typedef long long ll; typedef vector<int> vi;typedef vector<bool> vb;typedef vector<vi> vvi; 
typedef vector<vb> vvb;typedef vector<ll> vl;typedef vector<vl> vvl;typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
  
#define fr first 
#define sc second 
#define mp make_pair 
#define pb push_back 
#define all(v) v.begin(), v.end()
#define binary(n) cout<<bitset<31>(n)<<"\n";
#define FOR(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define input_arr(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define print_arr(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";

main(){
    //fst();
 
    int tc;tc=1;
    while(tc--){
        ll n=nxt(),W=nxt();
        vl w(n),v(n);
        rep(i,0,n){cin>>w[i]>>v[i];}
        //cout<<w[0];
        vvl DP(n+1,vl (W+1,0));

        rep(i,1,n+1){
            rep(j,1,W+1){
                // i can either chose the ith weight or not choose it 
                if(j>=w[i-1]){
                DP[i][j]=max(DP[i-1][j],DP[i-1][j-w[i-1]]+v[i-1]);
                    //cout<<i<<" "<<j<<" "<<DP[i][j]<<"\n";
                }
                else{
                    DP[i][j]=DP[i-1][j];
                }
                // total weight is j and I have reached that through ith weight

            }
        }

        cout<<DP[n][W];


    }

}

    


Measured memory_bytes: 80256