akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

struct diceOne{
    int number[6];
};

void rollN(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[1];
    x->number[1] = x->number[5];
    x->number[5] = x->number[4];
    x->number[4] = diceNumber;
}

void rollS(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[4];
    x->number[4] = x->number[5];
    x->number[5] = x->number[1];
    x->number[1] = diceNumber;
}

void rollE(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[3];
    x->number[3] = x->number[5];
    x->number[5] = x->number[2];
    x->number[2] = diceNumber;
}

void rollW(struct diceOne *x){
    int diceNumber;
    diceNumber = x->number[0];
    x->number[0] = x->number[2];
    x->number[2] = x->number[5];
    x->number[5] = x->number[3];
    x->number[3] = diceNumber;
}

int check(int j, int k, struct diceOne *x){
    int ans = 0;
        if(x[j].number[0] == x[k].number[0] && x[j].number[1] == x[k].number[1] && x[j].number[2] == x[k].number[2] &&
           x[j].number[3] == x[k].number[3] && x[j].number[4] == x[k].number[4] && x[j].number[5] == x[k].number[5]){
            ans = 1;
        }
    return ans;
}

int main(void){
    int n;
    int j;
    int ans = 0;
    char order[30];
    struct diceOne x[120];
    
    fgets(order, 10, stdin);
    sscanf(order, "%d", &n);
    for(j = 0; j < n; j++){
        fgets(order, 29, stdin);
        sscanf(order, "%d %d %d %d %d %d",
               &x[j].number[0], &x[j].number[1], &x[j].number[2], &x[j].number[3], &x[j].number[4], &x[j].number[5]);
    }
    for(int y = 0; y < n; y++){
        for(int i = 0; i < n; i++){
            if(y == i){
                continue;
            }
            for(int t = 0; t < 6; t++){
                for(int k = 0; k < 4; k++){
                    rollE(&x[i]);
                    if(check(y, i, x) == 1){
                        ans = 1;
                        break;
                    }
                }
                switch(t){
                    case 0:
                    case 1:
                    case 2: rollN(&x[i]);
                    case 3: rollN(&x[i]);
                            rollE(&x[i]);
                            rollN(&x[i]);
                            break;
                    case 4: rollN(&x[i]);
                            rollN(&x[i]);
                            break;
                    case 5: rollN(&x[i]);
                            break;
                }
            }
            if(ans == 1){
                break;
            }
        }
        if(ans == 1){
            break;
        }
    }
    if(ans == 1){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 2148
/*
 * Author : Sadi
 * Fri 24/07/2020
 * 17:44:08.69
 */
#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

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

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    vector<pair<int, int>> v(n);
    for(int i = 0; i < n; ++i) {
        int need, deadline;
        cin >> need >> deadline;
        v[i] = make_pair(need, deadline);
    }
    sort(v.begin(), v.end(), [] (pii p, pii q) {
        if(p.se < q.se) {
            return true;
        }
        else {
            return false;
        }
    });
    // cout << v << endl;
    long long time = 0;
    for(int i = 0; i < n; ++i) {
        if(time + v[i].fi <= v[i].se) {
            time += v[i].fi;
        }
        else {
            cout << "No" << '\n';
            return 0;
        }
    }
    cout << "Yes" << '\n';
    return 0;
}


Measured memory_bytes: 4724
class Drink(object):
    """docstring for."""

    def __init__(self,value,unit):
        self.value = value
        self.unit = unit
    def __repr__(self):
        return "%d,%d" %(self.value,self.unit)

n,m = (int(x) for x in input().split())
a = []
ans = 0;i = 0
for i in range(n):
    ai,bi = (int(x) for x in input().split())
    a.append(Drink(ai,bi))

a.sort(key=lambda x: x.value)

for i in range(n):
    mazai = a[i]
    if mazai.unit>=m:
        ans += mazai.value * m
        print(ans)
        break
    else:
        ans += mazai.unit * mazai.value
        m = m - mazai.unit


Measured memory_bytes: 28328
{-
  A,C,G,T にそれぞれ 0,1,2,3 を対応させ、4進表現で考える。

  状態を文字列の最後3文字の状態遷移を考える。（状態数 4^3 = 64）
  遷移先が pqr だとすると、入力は r で遷移元は 0pq, 1pq, 2pq, 3pq

  どの遷移元からも許されない遷移先は 021, 012, 102 （AGC, ACG, CAG に対応）
  遷移元 0pq からだけは許されない遷移先は 132, 112, 212, 312

  Arrayバージョン
-}

import Data.Array

ds1 = [d (0,2,1), d (0,1,2), d (1,0,2)]
ds2 = [d (1,3,2), d (1,1,2), d (2,1,2), d (3,1,2)]

d (a,b,c) = 16 * a + 4 * b + c

dp3 = array (0,63) [(i, if elem i ds1 then 0 else 1) | i <- [0..63]]

f xs = array (0,63) $ map (\i -> (i, g i)) [0..63] where
  g i
    | elem i ds1 = 0
    | elem i ds2 = h [16,32,48]   -- 1pq, 2pq, 3pq
    | otherwise  = h [0,16,32,48] -- 0pq, 1pq, 2pq, 3pq
    where
      pq = i `div` 4
      h os = sum [xs ! (pq + o) | o <- os] `mod` 1000000007

solve n =  (`mod` 1000000007) $ sum $ (!! (n - 3)) $ iterate f dp3

main = do
  n <- read <$> getLine
  print $ solve n

Measured memory_bytes: 1404
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int A, B, H, M;
  cin >> A >> B >> H >> M;

  double dy = A*std::sin(2*M_PI*(30*H+(M/2.0))/360) - B*std::sin(2*M_PI*(6.0*M)/360);
  double dx = A*std::cos(2*M_PI*(30*H+(M/2.0))/360) - B*std::cos(2*M_PI*6.0*M/360);
  double ans {sqrt(dx*dx + dy*dy)};
  printf("%0.10f\n", ans);
}


Measured memory_bytes: 4208
//PLUS ULTRA
//one who atops 

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define mp make_pair
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){
    int a , b , c ,d;

    cin >> a >> b >> c >> d;

    int xa = (a - 1)/d + 1 , xb = (c - 1)/b + 1;

    if(xa >= xb)cout << "Yes";
    else cout << "No";



}

int main(){
    SPEED;

   solve();



    

    return 0;
}
      
       


Measured memory_bytes: 3612
#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() {
    ll N; cin >> N;
    ll MAX = 3500;
    bool flag = false;
    rep2(h, 1, MAX + 1){
        rep2(n, h, MAX + 1){
            ll numerator = h * n * N; // 分子
            ll denominator = 4 * n * h - N * n - N * h; // 分母
            if (denominator != 0 && numerator % denominator == 0){
                ll w = numerator / denominator;
                if (w > 0){
                    cout << h << " " << n << " " << w; flag = true; break;
                }
            }
        }
        if (flag){break;}
    }
}

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


Measured memory_bytes: 3664
#include<stdio.h>
int main(void)
{
	int w,h,x,y,r;
	scanf("%d %d %d %d %d ",&w,&h,&x,&y,&r);
	if(x-r>=0 && w>=x+r && h>=y+r && y-r>=0){
		
		
		
		
		
		printf("Yes\n");
	}
	else
	{printf("No\n");
	}
	return 0;
}

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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int main() {
    fast_io;
     long long x,k,d;
     cin>>x>>k>>d;

     long long tmp;

     x=abs(x);

     tmp=min(k,(x/d));

     x-=(tmp*d);
     k-=tmp;

     if(k%2==0) {
         cout<<x<<endl;
     }
     else {
         cout<<abs(x-d)<<endl;
     }


}




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

int main() {
  int a,b,i=0;
  cin >> a >> b;
  if (a<b) swap(a,b);
  while (i<a) {
    if ((a-i)==(-1)*(b-i)) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
W, H, x, y, r=input().split()
W=int(W)
H=int(H)
x=int(x)
y=int(y)
r=int(r)
if H >= y+r and W >= x+r and 0 <= y-r and 0 <= x-r :
    print("Yes")
else :
    print("No")


Measured memory_bytes: 5596
#include <stdio.h>
int main (){
	int H,W,X;
	while(1){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0)break;
		X = W;
		while(H > 0){
			while(X > 0){
				printf("#");
				X--;
			}
			printf("\n");
			H--;
			X = W;
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2032
/*
wxy.

*/
#include<bits/stdc++.h>

using namespace std;
const int maxn=1e5+9;
int n,k;
int h[maxn];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;++i)cin>>h[i];
	sort(h+1,h+1+n);
	int l,r;
	l=1;r=l+k-1;
	int ans=h[r]-h[l];
	while(r<n){
		l++;r++;
		auto tomin= [](int &a,int b){b<a?a=b:0;};
		tomin(ans,h[r]-h[l]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main(){
    int n;cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(i%5&&i%3)
        ans+=i;
    }
    cout<<ans<<endl;
}

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

int main(void){
  int n, a, b;
  cin >> n >> a >> b;

  int cnt = 0, t;
  for(int i = 0; i < n; ++i){
    cin >> t;
    if(t < a || b <= t){ ++cnt; }
  }
  
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define int ll

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

#define fst first
#define pb push_back

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();
const int BIT = 10;

signed main() {
    int D, G;

    cin >> D >> G;

    vector<int> Ps(D);
    vector<int> Cs(D);
    REP(i, D) {
        cin >> Ps.at(i) >> Cs.at(i);
    }

    // どの問題をコンプリートしたかは、10ビットで表現できる。
    // そこから、それ以上コンプリートしないように注意しつつ、高い配点の問題から解いていく

    int ans = INF;

    REP(tmp, (1 << D)) {
        bitset<BIT> bs(tmp);

        int score = 0;
        int solved = 0;
        REP(i, D) {
            if (bs.test(i)) {
                solved += Ps[i];
                score += 100 * (i+1) * Ps[i] + Cs[i];
            }
        }

        // もし既に達成していたら、それでOK
        if (score >= G) {
            if (solved < ans) {
                ans = solved;

                debug(bs);
                debug(score);
                debug(solved);
                hyphen();
            }
            continue;
        }

        // 達成していない場合は、ポイントの高い問題から解いていく
        REPD(i, D) {
            if (bs.test(i)) {
                continue;
            }

            if (Ps[i] == 1) {
                continue;
            }

            int point = 100 * (i+1);
            int solve_but_one_score = score + (point * (Ps[i] - 1));
            if (solve_but_one_score < G) {
                // まだ足りない → 次へ
                score = solve_but_one_score;
                solved += (Ps[i] - 1);

                continue;
            } else {
                // 足りた → 解き過ぎないようにして〆
                // ceilはx.00001の時がこわい
                int solved_this;
                if ((G - score) % point == 0) {
                    solved_this = (G - score) / point;
                } else {
                    solved_this = (G - score) / point + 1;
                }
                score += point * solved_this;
                solved += solved_this;

                if (solved < ans) {
                    ans = solved;

                    debug(bs);
                    debug(score);
                    debug(solved);
                    hyphen();
                }

                break;
            }
        }

        // ここに辿り着いた時には、もう打つ手立てが無いので、
        // 更新処理を行わない

        // debug(bs);
        // debug(score);
        // debug(solved);
        // hyphen();
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
S=[]
while True:
  m,f,r=map(int,input().split())
  if m==-1 and f==-1 and r==-1:
    break
  if m==-1 or f==-1 or m+f<30:
    S.append('F')
  elif m+f>=80:
    S.append('A')
  elif 65<=m+f<80:
    S.append("B")
  elif 50<=m+f<65:
    S.append("C")
  else:
    if r>=50:
      S.append("C")
    else:
      S.append("D")
    
  k=int(0)  
for i in S:
  print(S[k])
  k=k+1  


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, n, a = 1000, b = 0;
  
  cin >> x >> n;
  
  if(n == 0){
    cout << x;
    return 0;
  }
  
  int p[n];
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  sort(p, p + n);

  for(int i = 0; i < n; i++){
    if(abs(p[i] - x) < abs(p[i] - a)){
      a = b = p[i];
    }
  }

  
  while(1){
    a--;
    bool bl = true;
    for(int i = 0; i <= n; i++){
        if(a == p[i]){
          bl = false;
          break;
        }
    }  
    if(bl){
      break;
    }
  }

  while(1){
    b++;
    bool bl = true;
    for(int i = 0; i <= n; i++){
        if(b == p[i]){
          bl = false;
          break;
        }
    }  
    if(bl){
      break;
    }
  }
  if(abs(x - a) <= abs(x - b)){
    cout << a;
  }else{
    cout << b;
  }
    
  

}

Measured memory_bytes: 3572
#include <stdio.h>

int main(void)
{
  int n, m, x;
  scanf("%d %d %d", &n, &m, &x);
  int i = 0;
  int a[m];
  while (i < m)
  {
    scanf("%d", &a[i]);
    i++;
  }
  
  i = 0;
  int cost = 0;
  int ans = 100;
  int k = 0;
  while (i < x)
  {
    if (i == a[k] && k < m)
    {
      k++;
      cost++;
    }
    i++;
  }
  if (ans > cost)
  {
    ans = cost;
  }
  i = x;
  cost = 0;
  while (i < n)
  {
    if (i == a[k] && k < m)
    {
      k++;
      cost++;
    }
    i++;
  }
  if (ans > cost)
  {
    ans = cost;
  }
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=300,MAX_A=300,MOD=998244353;
ll N,A[MAX_N],dp[MAX_N+1][MAX_A*MAX_N+1],dp2[MAX_N+1][MAX_A*MAX_N+1];
void add(ll &a,ll b){
	a+=b;
	if(a>=MOD){
		a-=MOD;
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	REP(i,N)cin>>A[i];
	dp[0][0]=1;
	REP(i,N){
		REP(j,N*MAX_A+1){
			if(j+A[i]<=MAX_A*N){
				add(dp[i+1][j+A[i]],dp[i][j]);
			}
			add(dp[i+1][j],2*dp[i][j]%MOD);
		}
	}
	dp2[0][0]=1;
	REP(i,N){
		REP(j,N*MAX_A+1){
			if(j+A[i]<=MAX_A*N){
				add(dp2[i+1][j+A[i]],dp2[i][j]);
			}
			add(dp2[i+1][j],dp2[i][j]%MOD);
		}
	}
	ll ans=1;
	REP(i,N){
		ans*=3;
		ans%=MOD;
	}
	ll sm=0;
	REP(i,N)sm+=A[i];
	FOR(j,(sm+1)/2,sm+1){
		ans-=dp[N][j]*3%MOD;
		ans+=MOD;
		ans%=MOD;
	}
	if(sm%2==0){
		add(ans,3*dp2[N][sm/2]%MOD);
	}
	cout<<ans<<endl;
/*	REP(i,N){
		REP(j,sm+1){
			printf("dp[%lld][%lld]=%lld\n",i+1,j,dp[i+1][j]);
		}
	}*/
}

Measured memory_bytes: 422912
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace D_PANA2020
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int a = s[0];

            var chara = new char[10] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };

            var anslst = new List<Dictionary<string, int>>();
            for (int i = 0; i < a; i++)
            {
                var myans = new Dictionary<string, int>();
                if (i == 0)
                {
                    myans.Add("a", 1);
                    anslst.Add(myans);
                }
                else
                {
                    var mydic = new Dictionary<string, int>();

                        foreach (var item in anslst[i-1])
                        {
                            var thiscnt = item.Value;
                            for (int k = 0; k <= thiscnt; k++)
                            {
                                if (k == thiscnt)
                                {
                                    mydic.Add(item.Key + chara[k], thiscnt + 1);
                                }
                                else
                                {
                                    mydic.Add(item.Key + chara[k], thiscnt);
                                }
                            }
                        }
                    
                    anslst.Add(mydic);

                }
            }

            foreach(var item in anslst[a-1]){
                WriteLine(item.Key);
            }

        }
    }
}


Measured memory_bytes: 31316
package main

import "fmt"

func sushi(cnt [3]int) float64 {
	var steps [301][301][301]float64

	a := cnt[0]
	b := cnt[1]
	c := cnt[2]
	n := float64(a + b + c)

	for z := 0; z < c+1; z++ {
		for y := 0; y < b+c-z+1; y++ {
			for x := 0; x < a+b+c-z-y+1; x++ {
				s := float64(x + y + z)
				if s == 0 {
					steps[x][y][z] = 0
				} else {
					res := n / s
					if x > 0 {
						res += float64(x) / s * steps[x-1][y][z]
					}
					if y > 0 {
						res += float64(y) / s * steps[x+1][y-1][z]
					}
					if z > 0 {
						res += float64(z) / s * steps[x][y+1][z-1]
					}
					steps[x][y][z] = res
				}
			}
		}
	}

	return steps[a][b][c]
}

func main() {
	var n, x int
	fmt.Scan(&n)
	var cnt [3]int
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		cnt[x-1]++
	}
	fmt.Println(sushi(cnt))
}


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

typedef long long ll;

int main(){
  ll n; cin >> n;
  
  ll num_two = 0;
  ll num_four = 0;
  for(ll i=0; i<n; i++){
    ll x; cin >> x;
    if (x % 4 == 0) ++num_four;
    else if (x % 2 == 0) ++num_two;
  }
  
  if ((num_two > 1) && num_four >= (n - num_two + 1) / 2 || num_four >= n/2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main(){
    int64_t N;
    cin >> N;
    vector<pair<int64_t,int64_t>> A(N);
    for ( int64_t i = 0; i < N; ++i){
        int64_t A_sub;
        cin >> A_sub;
        A[i] = make_pair(A_sub,i);
        //cin >> A.at(i).first;
        //A.at(i).second = i;
    }
    //sort(A.begin(),A.end(),greater<int64_t>());
    sort(A.begin(),A.end());
    
    /*for ( int i = 0; i < N; ++i){
        cout << A.at(i).first << A.at(i).second << endl;
    }*/
    
    vector<vector<int64_t>> DP(N+1,vector<int64_t>(N+1));
    // DP[x][y] 活発度の高い方から x+y 人を配置
    // x 人を右、y 人を左
    
    int64_t res = 0;
    for ( int64_t i = 0; i <= N; ++i){
        for ( int64_t j = 0; j <= N-i; ++j){
            if ( i == 0 and j == 0 ){
                DP.at(i).at(j) = 0;
                continue;
            }
            int64_t num = i + j;
            int64_t Act = A.at(N-num).first;
            int64_t pos = A.at(N-num).second;
            //int64_t right = abs(N - 1 - pos - i);
            //int64_t left = abs(pos - j);
            //cout << Act << pos << right << left << endl;
            
            if ( i == 0 ){
                //DP.at(i).at(j) = DP.at(i).at(j-1) + Act * right;
                //DP.at(i).at(j) = DP.at(i).at(j-1) + Act * abs( N - 1 - pos - (i-1) );
                DP.at(i).at(j) = DP.at(i).at(j-1) + Act * abs(pos - (j-1) );
            } else if ( j == 0 ){
                //DP.at(i).at(j) = DP.at(i-1).at(j) + Act * left;
                //DP.at(i).at(j) = DP.at(i-1).at(j) + Act * abs(pos - (j-1) );
                DP.at(i).at(j) = DP.at(i-1).at(j) + Act * abs( N - 1 - pos - (i-1) );
            } else {
                //DP.at(i).at(j) = max(DP.at(i).at(j-1) + Act * right, DP.at(i-1).at(j) + Act * left);
                DP.at(i).at(j) = max(DP.at(i-1).at(j) + Act *  abs(N - 1 - pos - (i-1)), \
                                     DP.at(i).at(j-1) + Act * abs(pos - (j-1)));
            }
            //cout << i << " " <<  j << " " << DP.at(i).at(j) << endl;;
            if ( num == N ){
                res = max( res, DP.at(i).at(j));
                break;
            }
        }
    }
    
    cout << res << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 34676
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(NULL); cout.tie(NULL)
using namespace std;                            
                                                
void yes() {cout << "Yes" << endl;}                                               
void no() {cout << "No" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const int INF = 1e9 + 9;
const long long LINF = 8e18 + 8;
const double EPS = 1e-9;
const long long MOD = 1e9 + 7; //998244353
const double PI = acos(-1);   

struct Circle {
    long long x, y, r;
};

double get(Circle c1, Circle c2) {
    return max(0.0, sqrt((c1.x - c2.x) * (c1.x - c2.x) + (c1.y - c2.y) * (c1.y - c2.y)) - c1.r - c2.r);
}

void solve() {
    long long xs, ys, xe, ye;
    cin >> xs >> ys >> xe >> ye;
    int n; cin >> n;
    vector<Circle> a(n + 2);
    for (int i = 1; i <= n; i++) {
        cin >> a[i].x >> a[i].y >> a[i].r;
    }
    a[0].x = xs, a[0].y = ys, a[0].r = 0;
    a[n + 1].x = xe, a[n + 1].y = ye, a[n + 1].r = 0; 
    double d[n + 2][n + 2];
    for (int i = 0; i < n + 2; i++) {
        for (int j = 0; j < n + 2; j++) {
            if (i != j) {
                d[i][j] = get(a[i], a[j]);
            }
        }
    }
    vector<double> di(n + 2, 1.0 * LINF);
    vector<bool> used(n + 2);
    double eps = 1e-10;
    di[0] = 0;
    for (int i = 0; i < n + 2; i++) {
        int v = -1;
        for (int j = 0; j < n + 2; j++) {
            if (!used[j] and (v == -1 or di[j] < di[v])) {
                v = j;
            }
        }
        if (fabs(di[v] - 1.0 * LINF) < eps) break;
        used[v] = true;
        for (int j = 0; j < n + 2; j++) {
            if (di[v] + d[v][j] < di[j]) {
                di[j] = di[v] + d[v][j];
            }
        }
    }
    cout << fixed << setprecision(10) << di[n + 1] << endl;
}

int main() {
    // freopen("bbreeds.in", "r", stdin);
    // freopen("bbreeds.out", "w", stdout);
    jonathan; 
    livingston;
    solve();
    return 0;
}

Measured memory_bytes: 11640
#２つのリストを使う場合
rL=list(input())#右のリストに入力
lL=[]
Q=int(input())
for i in range(Q):
  N=list(input().split())
  if N[0]=="1":#反転させる場合は右と左を入れ替える
    lL,rL=rL,lL
  elif N[1]=="1":#先頭の場合は左のリストに
    lL.append(N[2])
  else:#末尾の場合は右のリストに
    rL.append(N[2])
lL.reverse()#左のリストの向きを入れ替える
print("".join(lL)+"".join(rL))

Measured memory_bytes: 6292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

int n;
vector<double> x(60), y(60);
double eps;

bool check(double s, double t, double m) {
    bool res = true;
    rep(i, 0, n) {
        if (pow(x[i] - s, 2.0) + pow(y[i] - t, 2.0) > m * m + eps) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    eps = 1e-8;
    cin >> n;
    rep(i, 0, n) cin >> x[i] >> y[i];

    double r = 10000, l = 0;
    while (r - l > 1e-8) {
        double m = (r + l) / 2.0;
        bool ok = false;
        rep(i, 0, n) rep(j, i + 1, n) {
            if (pow(x[i] - x[j], 2.0) + pow(y[i] - y[j], 2.0) > 4.0 * m * m)
                continue;
            /*if (x[i] == x[j]) {
                double d = abs(y[i] - y[j]) / 2.0;
                ok |= check(x[i] + sqrt(max(0.0, m * m - d * d)),
                            (y[i] + y[j]) / 2.0, m);
                ok |= check(x[i] - sqrt(max(0.0, m * m - d * d)),
                            (y[i] + y[j]) / 2.0, m);
            }*/
            complex<double> a(x[i], y[i]), b(x[j], y[j]);
            complex<double> c = (a + b) / 2.0;
            double temp = m * m - norm(a - c);
            double p = sqrt(temp);
            complex<double> d = c - a;
            complex<double> e(-d.imag(), d.real());
            complex<double> f = e / abs(e);
            a = c + p * f;
            b = c - p * f;
            ok = ok or check(a.real(), a.imag(), m);
            ok = ok or check(b.real(), b.imag(), m);
        }
        if (ok)
            r = m;
        else
            l = m;
    }
    cout << fixed << setprecision(10) << (l + r) / 2.0 << endl;
    return 0;
}


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

using namespace std;

int main(){
    int n, cnt=1, min;
    cin >> n;
    vector<int> v;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        v.push_back(a);
    }
    min = v.at(0);
    for(int i=1; i<n; i++){
        if(min >= v[i]){
           cnt++;
           min = v[i];
        }
    }
    cout << cnt <<endl;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<string.h>
#define len 100005

typedef struct pp{
	char name[100];
	int t;
}P;

P Q[len];
int head,tail,n;

void enq(P x){
	Q[tail]=x;
	tail=(tail+1)%len;
}

P deq(){
	P x=Q[head];
	head=(head+1)%len;
	return x;
}

int min(int a,int b){return a<b?a:b;}

int main(void){
	int ela=0,c;
	int i,q;
	P u;
	scanf("%d %d",&n,&q);
	for(i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head=1;tail=n+1;
	
	while(head!=tail){
		u=deq();
		c=min(q,u.t);
		u.t-=c;
		ela+=c;
		if(u.t>0)enq(u);
		else{
			printf("%s %d\n",u.name,ela);
		}
	}
	return 0;
}


Measured memory_bytes: 11856
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;

int main(){
	cin >> n >> m;
	cout << (100*(n-m)+1900*m)*pow(2, m) << endl;
	return 0;
}

Measured memory_bytes: 256
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N = II()
    S = input()
    count = 0
    pre = -1
    for s in S:
        if s != pre:
            count += 1
            pre = s
    print(count)
if __name__ == '__main__':
    main()

Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    vector<vector<ll>> C(3, vector<ll>(3));
    rep(i, 3) {
        rep(j, 3) cin >> C[i][j];
    }

    rep(i, 3) {
        ll min = *min_element(C[i].begin(), C[i].end());
        rep(j, 3) {
            C[i][j] -= min;
        }
    }

    bool ans = true;;
    rep(i, 3) {
        if (C[0][i] != C[1][i] || C[1][i] != C[2][i]) ans = false;
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3628
package main

import "fmt"

func main() {
	var M1, D1, M2, D2 int
	fmt.Scan(&M1, &D1)
	fmt.Scan(&M2, &D2)

	if M2 == M1+1 && M1 <= 11 {
		fmt.Println("1")
	} else {
		fmt.Println("0")
	}
}


Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main() {
int a,b,c,x,y;
cin >> a >> b >> c;
y = 0;
for (int x = a; x <= b; x++)
if( c%x == 0) {
y  += 1;
}
cout << y << endl;
    return 0;
}


Measured memory_bytes: 3080
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int l;
  cin >> l;
  
  
  double ans = l*l*l;
  ans /= 27;
  
  
  cout << fixed << setprecision(12) << ans << endl;
    
}

Measured memory_bytes: 3656
Module Module1

    Sub Main()
        Dim ans As String = ""

        Dim input() As String = Console.ReadLine.Split(" "c)

        Dim value(input.Length - 1) As Long

        For i As Integer = 0 To input.Length - 1
            value(i) = CLng(input(i))
        Next

        Dim allkosuu As Long = value(0)
        Dim genzaikosuu As Long = 0
        Dim aodamakosuu As Long = 0

        Dim loopkosuu = value(1) + value(2)

        Dim kaisu As Long = CLng(System.Math.Floor(allkosuu / loopkosuu))

        aodamakosuu = value(1) * kaisu
        genzaikosuu = loopkosuu * kaisu



        Dim tuikakosuu As Long = allkosuu - genzaikosuu

        If tuikakosuu > value(1) Then
            aodamakosuu = aodamakosuu + value(1)
        Else
            aodamakosuu = aodamakosuu + tuikakosuu
        End If




        Console.WriteLine(aodamakosuu.ToString)
        Console.ReadKey()




    End Sub




End Module

Measured memory_bytes: 20444
#include<bits/stdc++.h>
using namespace std;
inline int Read()
{
    int x = 0, f = 1, c = getchar();
    for (; !isdigit(c); c = getchar())
        if (c == '-')
            f = -1;
    for (;  isdigit(c); c = getchar())
        x = x * 10 + c - '0';
    return x * f;
}

int main()

{

  int n = Read();
  cout<< 180*(n-2);

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    try {
      String s = scanner.next();
      int n = scanner.nextInt();
      int m = (s.length() + n - 1) / n;
      String ans = "";
      for (int i = 0; i < m; i++) {
        ans = ans + s.charAt(i*n);
      }
      System.out.println(ans);
    } finally {
      scanner.close();
    }
  }
}

Measured memory_bytes: 39756
#include<iostream>
#include<string>
using namespace std;
 
int main()
{
	char a, b, c;
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	a = s1[0] - 32;
	b = s2[0] - 32;
	c = s3[0] - 32;
	cout << a << b << c;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007
#define INF 1000000001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int a,b; cin >> a >> b ;
	out(max(0,a-2*b));
}




Measured memory_bytes: 256
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))
MOD = 10 ** 9 + 7


def to_cumsum(arr, pad=True):
    """
    1次元配列を累積和の1次元配列に変換する
    pad: 先頭に0の項を作る場合はTrue
    """
    cumsum = 0
    padding = 1 if pad else 0
    new = [0] * (len(arr) + padding)
    for i, e in enumerate(arr):
        cumsum += e
        new[i + padding] = cumsum
    return new


N = I()
A = LMI()
B = LMI()
C = LMI()

A.sort()
B.sort()
C.sort()


def bi(A, x):
    l = -1
    r = len(A)
    while l + 1 < r:
        p = (l + r) // 2
        if x < A[p]:
            r = p
        else:
            l = p
    return r


BC = [0] * N
for i, b in enumerate(B):
    BC[i] = N - bi(C, b)
BC = to_cumsum(BC)
ans = 0
for i, a in enumerate(A):
    ans += BC[N] - BC[bi(B, a)]
print(ans)


Measured memory_bytes: 105572
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    x = int(input())

    def bs(m):
        inp = 100
        for i in range(m):
            inp = int(inp * 1.01)
        return inp >= x
    
    l = 0
    r = 100000
    ans = 0
    while l <= r:
        mid = (r - l) // 2 + l
        if bs(mid):
            r = mid - 1
            ans = mid
        else:
            l = mid + 1
    print(ans)
    return

if __name__ == "__main__":
    main()

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}
int no = 1, n1;
int recu(int n, int k, int val) {


	if (n == n1) {
		return min(val * 2, val + k);
	}
	return min( recu(n + 1, k, 2 * val), recu(n + 1, k, val + k)              );


}
int digit(int n) {

	int temp = 0;
	while (n) {
		// temp += n % 10;
		n = n / 10;
		temp++;
	}



	return temp;
}

bool check(int a[], int n) {
	for (int i = 0; i < n; ++i)
	{
		/* code */
		if (a[i] % 2)
			return false;
	}
	return true;
}
bool ispalin(int n) {


	string  str = to_string(n);
	// cout<<str<<endl;


	for (int i = 0; i < str.size() / 2; ++i)
	{
		/* code */
		// watch2(str[i],str[str.size()-i-1]);
		if (str[i] != str[str.size() - i - 1]) {
			return false;
		}
	}


	return true;


}

int main() {
	int i,  n, m,c=0, k, sum = 0;
	c_p_c();

	cin>>n>>m;
	int a[n];
	fo(i,n) cin>>a[i];

	for (int i = 0; i <n; ++i)
	{
		/* code */
		if(a[i]>=m)
			c++;
	}
	cout<<c<<endl;
}


Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main()
{
    ll n,a,b;
    cin >> n >> a >> b;
    if((b - a) % 2 == 0)pf(min({(b - a) / 2,n - a,b - 1}))
        else pf((b - a - 1) / 2 + min(n - b + 1,a))
    return 0;
}


Measured memory_bytes: 256
import sys
from networkx.utils import UnionFind
def input(): return sys.stdin.readline().rstrip()


def main():
    n,m=map(int, input().split())
    lang=[[] for i in range(m+1)]
    for i in range(1,n+1):
        for talk in list(map(int, input().split()))[1:]:
            lang[talk].append(i)
    uf = UnionFind()
    for langs in lang:
        if len(langs) >=1:
            uf.union(*langs)
    print('YES' if len(list(uf.to_sets()))==1 else 'NO')
    




if __name__ == '__main__':
    main()


Measured memory_bytes: 80900
// Date: 2020-04-19

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

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

const double PI = acos(-1.0);

int main() {
    double x;
    cin >> x;
    cout << fixed << setprecision(20) << 2*PI*x;

    return 0;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
int n,m;
int dp[100010];
vector<int> adj[100010];
int rec(int x){
	if(dp[x]>=0)
	   return dp[x];
	if(adj[x].empty())
	   return dp[x]=0;
	dp[x]=dp[adj[x][0]]+1;
	for(int i=0;i<adj[x].size();i++){
		dp[x]=max(rec(adj[x][i])+1,dp[x]);
	}
	return  dp[x];
}
int a,b;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>a>>b;
		adj[a].push_back(b);
	}
	memset(dp,-1,sizeof(dp));
	int ans=0;
	for(int i=1;i<=n;i++)
	   ans=max(ans,rec(i));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8192
def PrimeNumber(N):
    if N==2:
        ans=[2]
        return ans
    ans = list(range(2, N + 1))
    i = 0
    while ans[i] < N ** 0.5 + 1:
        j = 2
        temp = ans[i]
        while temp * j <= ans[-1]:
            if temp * j in ans:
                ans.remove(temp * j)
            j += 1
        i += 1
    return ans

N=int(input())

if N==1:
    print(1)
    exit()

mod=10**9+7
PN=PrimeNumber(N)
P=[0]*(N+1)

for i in range(2,N+1):
    temp=i
    for j in PN:
        if temp<j:
            break
        cnt=0
        while temp%j==0:
            cnt+=1
            temp=temp//j
        P[j]+=cnt

ans=1

for i in range(1,N+1):
    if P[i]!=0:
        ans=(ans*(P[i]+1))%mod
print(ans)



Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner push = new Scanner(System.in);
		int A = push.nextInt();
		int B = push.nextInt();
		int C = push.nextInt();

		int work = A*10+B+C;
		int work2 = B*10+A+C;
		int work3 = C*10+A+B;

		if(work >= work2) {
			if(work >= work3) {
				System.out.println(work);
			}else if(work2 >= work3) {
				System.out.println(work2);
			}else {
				System.out.println(work3);
			}
		}else if(work2 >= work3) {
			System.out.println(work2);
		}else if(work3 >= work) {
			System.out.println(work3);
		}else {
			System.out.println(work);
		}
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;


	public class Main {
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int x = sc.nextInt();
			
			long a;
			long b;
			
			for(long i=-1000;i<=1000;i++) {
				for(long j=-1000;j<=1000;j++) {
					long cal = ((i*i*i*i*i)-(j*j*j*j*j));
					if(cal==x) {
						System.out.println(i+" "+j);
						return;
					}
				}
			}
			
			
		}
		
		
	}


Measured memory_bytes: 39008
n = int(input())
h = list(map(int,input().split()))

dp = [float("inf")] * n
dp[0] = 0

for i in range(1,n):
    if i == 1:
        dp[i] = dp[i] + abs(h[i-1] - h[i])
    dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]),dp[i-2] + abs(h[i-2] - h[i]))


print(dp[n-1])

Measured memory_bytes: 13980
// Believe in yourself
#include<bits/stdc++.h>

using namespace std;

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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Pair vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define mo 1000000007
#define decimal(i,n) fixed << setprecision(i) << n
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define show_nl(a) for(auto xyz:a)cout<<xyz<<endl;


void eea(ll a,ll b,ll &x,ll &y)
{
    if (a == 1)
    {
        x = 1; y = 0;
        return;
    }
    ll x1, y1;
    eea(b%a,a,x1,y1);
    x=y1-(b/a)*x1;
    y=x1;
}
ll mi(ll a,ll m)
{
    ll x,y;
    eea(a,m,x,y);
    x= (x%m+m)%m;
    return x;
}

/*
Enter the test case


Some helpful points
1.) Calm yourself
2.) check for semicolon or data type mismatch
*/


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);    
    ll t=1;
    // cin>>t;
    while(t--)
    {
        string s1,s2;
        cin>>s1>>s2;
        int a,b;
        cin>>a>>b;
        string s;
        cin>>s;
        if(s==s1)
        cout<<a-1<<" "<<b<<"\n";
        else
        cout<<a<<" "<<b-1<<"\n";
    }
}



Measured memory_bytes: 3628
n = gets.to_i
num = gets.strip.split.map(&:to_i)
ary = []
for i in 0..n-1
  if i%2==0
    ary.push(num[i])
  else
    ary.unshift(num[i])
  end
end
if n%2==0
  puts ary.join(" ")
else
  puts ary.reverse.join(" ")
end

Measured memory_bytes: 40800
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
int N, Q;
string S;

struct SegmentTree {
    vector<int> tree;
    int N;

    SegmentTree(int _N) {
        N = _N;
        tree.resize(2*N);
    }

    void Update(int pos, int delta) {
        tree[N+pos] += delta;
        for (auto p = (N + pos) / 2; p; p >>=1) {
            tree[p] = tree[2*p] + tree[2*p+1];
        }
    }

    int Query(int n, int nl, int nr, int l, int r) {
        if (l <= nl && nr <= r)
            return tree[n];
        int m = (nl + nr) >> 1;
        int res = 0;
        if (l <= m)
            res += Query(2*n, nl, m, l, r);
        if (r >= m + 1)
            res += Query(2*n+1, m+1, nr, l, r);
        return res;
    }
};

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

    cin >> N >> S;
    cin >> Q;

    vector<SegmentTree> seg_trees(26, (1<<19));

    for (int i = 0; i < N; i++)
        seg_trees[S[i] - 'a'].Update(i, 1);

    for (int i = 0; i < Q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            int p;
            char v;
            cin >> p >> v;
            p--;
            seg_trees[S[p] - 'a'].Update(p, -1);
            seg_trees[v - 'a'].Update(p, 1);
            S[p] = v;
        } else {
            int l, r;
            cin >> l >> r;
            l--, r--;
            
            int res = 0;
            for (int v = 0; v < 26; v++)
                res += seg_trees[v].Query(1, 0, (1<<19)-1, l, r) > 0;
            cout << res << "\n";

        }
    }

    return 0;
}


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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n=II()
	A=[0]+LI()
	B=[0]*(n+1)

	for i in range(n,0,-1):
		a=A[i]
		if n//i>=2:
			for j in range(2,n//i+1):
				#print(i,j)
				a^=B[i*j]
		B[i]=a

	ans=[]
	for i,v in enumerate(B):
		if v:
			ans.append(i)

	print(len(ans))
	print(*ans)













if __name__ == "__main__":
	main()


Measured memory_bytes: 92976
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
lli mod = 1e9 +7;

int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	vector<int> t(n);
	for(int i=0; i<n; i++){
		cin >> s[i] >> t[i];
	}
	string x;
	cin >> x;
	int ans = 0;
	bool sleep = false;
	for(int i=0; i<n; i++){
		if(sleep) ans += t[i];
		if(x == s[i]) sleep = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384