akhauriyash/Code-Regression huggingface dataset:
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    string S;
    cin >> S;
    if(S[2]==S[3] && S[4]==S[5]){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#coding: utf-8
try:
    from math import gcd
except:
    from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
AL = [0] * N  # 左からGCD
AR = [0] * N  # 右からGCD
for i in range(1, N):
    AR[i] = gcd(AR[i-1], A[i-1])
for i in range(N-1)[::-1]:
    AL[i] = gcd(AL[i+1], A[i+1])
A_list = [gcd(AL[i], AR[i]) for i in range(N)]
print(max(A_list))

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

int main() {
	int n;
    cin >> n;
    int d[n];

    rep (i, n) cin >> d[i];

    int sum  = 0;
    rep (i, n) {
        rep (j, n) {
            if (i != j) sum += d[i] * d[j];
        }
    }

    cout << sum / 2 << endl;

	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxc = 410;
const int INF = INT_MAX/2;

int dp[45][410][410];
int A[45],B[45],C[45];
int aneed,bneed;
int n;

int main() {
	FAST
	cin >> n >> aneed >> bneed;
	for (int i =0;i<n;i++) {
		cin >> A[i] >> B[i] >> C[i];
	}
	
	for (int i =0;i<=n;i++) 
		for (int a = 0;a<maxc;a++)
			for (int b = 0;b<maxc;b++)
				dp[i][a][b] = INF;
		
	dp[0][0][0] = 0;
	
	for (int i =0;i<n;i++) {
		for (int a = 0; a < maxc; a++) {
			for (int b = 0; b<maxc; b++) {
				if (dp[i][a][b] == INF) continue;
				dp[i+1][a][b] = min(dp[i+1][a][b],dp[i][a][b]);
				dp[i+1][a+A[i]][b+B[i]] = min(dp[i+1][a+A[i]][b+B[i]], dp[i][a][b] + C[i]);		
				//cout << i << " " << a << " " << b << " " << dp[i][a][b] << "\n";
			}
		}
	}
	
	int ans = INF;
	//for (int a =1;a< maxc;a++) {
		//for (int b=1;b<=maxc;b++) {
			//if (a * needb == b * needa) ans = min(ans,dp[n][
		//}
	//}
	
	for (int x =1; x*aneed < maxc and x * bneed < maxc; x++) {
		ans = min(ans, dp[n][x*aneed][x*bneed]);
	}
	
	if (ans == INF) cout << -1;
	else cout << ans;
	
}	



Measured memory_bytes: 28928
(m,n=$_.split
l=*1..m.to_i
(1..n.to_i).map{|i|s=i%3<1?"Fizz":"";i%5<1&&s+="Buzz"
s[0]||s=i.to_s
c=l.shift
gets.chop!=s&&l[0]||l<<c}
puts l.sort*" ")while gets>?1

Measured memory_bytes: 6212
#include<stdio.h>
#include<string.h>
int main(void){
  char S[100];
  scanf("%s",S);
  if(strcmp(S,"Sunny")==0)printf("Cloudy");
  else if(strcmp(S,"Cloudy")==0)printf("Rainy");
  else if(strcmp(S,"Rainy")==0)printf("Sunny");
  return 0;
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;

    int res = 0;
    for (int i = 0; i < n; i++) {
        vector<int> z(n, 0);
        z[i] = n - i;

        for (int zi = 1, zj = 0; i + zi < n; ) {
            while (i + zi + zj < n && s[i + zj] == s[i + zi + zj]) {
                zj++;
            }

            z[i + zi] = zj;
            if (zj == 0) {
                zi++;
                continue;
            }

            int zk = 1;
            while (i + zi + zk < n && zk + z[i + zk] < zj) {
                z[i + zi + zk] = z[i + zk];
                zk++;
            }

            zi += zk;
            zj -= zk;
        }

        for (int j = i + 1; j < n; j++) {
            if (res < min(j - i, z[j])) {
                res = min(j - i, z[j]);
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Random;
import java.util.Scanner;

public class Main {
	private static final int K = 26;
	private static final int COUNT = 15000000;
	private static Random rand = new Random(System.currentTimeMillis());

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var d = sc.nextInt();
		var c = new int[K];
		var s = new int[d][K];
		for (var i = 0; i < K; i++) {
			c[i] = sc.nextInt();
		}
		for (var i = 0; i < d; i++) {
			for (var j = 0; j < K; j++) {
				s[i][j] = sc.nextInt();
			}
		}
		sc.close();

		var count = 0;
		var t = create(c, s, d);
		for (var i = 0; count < COUNT; i++) {
			for (var j = 1; j < K; j++) {
				count++;
				var mdi = i % d;
				var mti = (t[mdi] + j - 1) % K;
				var check = check(c, s, t, d, mdi, mti);
				if (check > 0) {
					t[mdi] = mti + 1;
					break;
				}
			}
		}

		for (var i = 0; i < d; i++) {
			System.out.println(t[i]);
		}
	}

	private static int check(int[] c, int[][] s, int[] t, int d, int mdi, int mti) {
		var sum = 0;
		var ti = t[mdi] - 1;
		sum += s[mdi][mti] - s[mdi][ti];

		var last1 = 0;
		var last2 = 0;
		for (var i = mdi - 1; i >= 0; i--) {
			if (t[i] == ti + 1) {
				last1 = i + 1;
				break;
			}
		}
		for (var i = mdi - 1; i >= 0; i--) {
			if (t[i] == mti + 1) {
				last2 = i + 1;
				break;
			}
		}

		var count1 = 1;
		var count2 = 1;
		for (var i = mdi + 1; i < d; i++) {
			if (t[i] == ti + 1) {
				break;
			}
			count1++;
		}
		for (var i = mdi + 1; i < d; i++) {
			if (t[i] == mti + 1) {
				break;
			}
			count2++;
		}
		sum += (mdi - last2 + 1) * c[mti] * count2 - (mdi - last1 + 1) * c[ti] * count1;
		return sum;
	}

	private static int score(int[] c, int[][] s, int[] t, int d) {
		var sum = 0;
		var last = new int[K];
		for (var i = 0; i < d; i++) {
			var ti = t[i] - 1;
			sum += s[i][ti];
			last[ti] = i + 1;
			for (var j = 0; j < K; j++) {
				sum -= ((i + 1) - last[j]) * c[j];
			}
		}

		return sum;
	}

	private static int[] create(int[] c, int[][] s, int d) {
		var t = new int[d];
		var last = new int[K];
		for (var i = 0; i < d; i++) {
			var v = new int[K];
			for (var j = 0; j < K; j++) {
				v[j] = s[i][j] + (((i + 1) - last[j]) * c[j]);
			}
			t[i] = rand(v) + 1;
			last[t[i] - 1] = i + 1;
		}
		return t;
	}

	private static int rand(int[] v) {
		var sum = 0;
		for (var i = 0; i < v.length; i++) {
			sum += v[i];
		}
		var value = rand.nextInt(sum);
		var index = 0;
		sum = 0;
		for (var i = 0; i < v.length; i++) {
			sum += v[i];
			if (value < sum) {
				break;
			}
			index++;
		}
		return index;
	}
}


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

int main(void){
    
    string p = "\"";
    string s1,s2;
    string a[300]={},b[300]={};
    int i=0,n,m,x=0,y=0;
    int count = 0;
    
    while(1){
        
        cin >> s1;
        if(s1 == ".") break;
        n = s1.size();
        
        cin >> s2;
        if(s2 == ".") break;
        m = s2.size();
        x=0;
        y=0;
        count = 0;
        
        for(i=0;i<300;i++){
            a[i] = "";
            b[i] = "";
        }
        
        for(i=0;i<n;i++){
            a[x].push_back(s1[i]);
            if(s1[i] == p[0]) x++;
            
        }
        
        for(i=0;i<m;i++){
            b[y].push_back(s2[i]);
            if(s2[i] == p[0]) y++;
        }
        
        if(x != y) {
            count = 2;;
        }
        

        for(i=0; i<x+1;i++){
    
            if( a[i] != b[i] ){
                if( i % 2 == 1) {
                    count += 1;
                }
                
                else count += 2;
                
            }
            
            if(count >1) break;
        }
        if ( count == 0 ) cout << "IDENTICAL" << endl;
        else if (count == 1) cout << "CLOSE" << endl;
        else cout << "DIFFERENT" << endl;
        
        
    }
    
    
   return 0;
}




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

const int mod = 1000000007;
// const int mod = 998244353;

struct mint
{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint &operator+=(const mint m)
    {
        if((x += m.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator-=(const mint m)
    {
        if((x += mod - m.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator*=(const mint m)
    {
        (x *= m.x) %= mod;
        return *this;
    }
    mint operator+(const mint m) const
    {
        return mint(*this) += m;
    }
    mint operator-(const mint m) const
    {
        return mint(*this) -= m;
    }
    mint operator*(const mint m) const
    {
        return mint(*this) *= m;
    }
    mint pow(ll n) const
    {
        if(!n) return 1;
        mint m = pow(n>>1);
        m *= m;
        if(n & 1) m *= *this;
        return m;
    }
    mint inv() const { return pow(mod-2);}
    mint &operator/=(const mint m) { return *this *= m.inv();}
    mint operator/(const mint m) const { return mint(*this) /= m;}
};
istream &operator>>(istream &is, mint &m) { return is >> m.x;}
ostream &operator<<(ostream &os, const mint &m) { return os << m.x;}

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n+1), ifact(n+1)
    {
        assert(n < mod);
        fact.at(0) = 1;
        for(int i=1; i<=n; i++)
        {
            fact.at(i) = fact.at(i-1) * i;
        }
        ifact.at(n) = fact.at(n).inv();
        for(int i=n; i>=1; i--)
        {
            ifact.at(i-1) = ifact.at(i) * i;
        }
    }
    mint operator()(int n, int k)
    {
        if(k < 0 || k > n) return 0;
        return fact.at(n) * ifact.at(k) * ifact.at(n-k);
    }
};

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

    int N, K;
    cin >> N >> K;

    combination comb(2*N);

    mint ans = comb(2*N - 1, N - 1);
    if(K < N - 1)
    {
        // i個の誰もいない部屋とN-i個の人のいる部屋
        for(int i=K+1; i<N; i++)
        {
            ans -= comb(N, i) * comb(N - 1, N - i - 1);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9512
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
typedef __int128 I128;
const int N = 250003;
const LL mod = 1000000000000000031ll, X = 1000000000000000003ll, inv = 821428571428571454ll;
int n, a[N];
LL ans, p[N], val[N];
char str[N];
map<LL, int> tong;
inline void upd(LL &a, LL b){a += b; if(a >= mod) a -= mod;}
inline LL add(LL a, LL b){return (a + b >= mod) ? (a + b - mod) : (a + b);}
int main(){
	scanf("%d%s", &n, str + 1);
	p[0] = 1;
	for(Rint i = 1;i <= n;i ++){
		p[i] = p[i - 1]; val[i] = val[i - 1];
		if(str[i] == '+') upd(val[i], p[i]);
		else if(str[i] == '-') upd(val[i], mod - p[i]);
		else if(str[i] == '<') p[i] = (I128) p[i] * inv % mod;
		else if(str[i] == '>') p[i] = (I128) p[i] * X % mod;
	}
	for(Rint i = n;i;i --){
		++ tong[val[i]];
		ans += tong[add((I128) p[i - 1] * val[n] % mod, val[i - 1])];
	}
	printf("%lld", ans);
}

Measured memory_bytes: 35584
#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, c;
	cin >> n >> c;
	vector<vector<int>> t(30, vector<int>(0));
	rep(i, n){
		int si, ti, ci;
		cin >> si >> ti >> ci;
		ci--;
		t.at(ci).push_back(si);
		t.at(ci).push_back(ti);
	}
	rep(i, 30) sort(t.at(i).begin(), t.at(i).end());
	vector<vector<int>> t0(30, vector<int>(0));
	rep(i, 30){
		int k = t.at(i).size();
		rep(j, k){
			if(j == 0){
				t0.at(i).push_back(t.at(i).at(0));
			}else if(j == k-1){
				t0.at(i).push_back(t.at(i).at(k-1));
			}else{
				if(k > 0 && t.at(i).at(j) != t.at(i).at(j+(j%2*2-1))) t0.at(i).push_back(t.at(i).at(j));
			}
		}
	}
	vector<vector<int>> t1(30, vector<int>(0));
	rep(i, 30){
		rep(j, t0.at(i).size()) t1.at(i).push_back(t0.at(i).at(j)*2-1*((j+1)%2));
	}
	vector<int> sum(200002);
	rep(i, 30){
		int sig = 0;
		int k = t1.at(i).size();
		rep(j, k){
			if(j%2 == 0){
				sum.at(t1.at(i).at(j))++;
			}else{
				sum.at(t1.at(i).at(j))--;
			}
		}
	}
	int sig = 0;
	int ma = 0;
	rep(i, 200002){
		sig += sum.at(i);
		if(sig > ma) ma = sig;
	}
	cout << ma << endl;
	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int WWW = 0;WWW < (n);WWW++)cerr << v[WWW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;


int main(){
	
	int n;cin >> n;
	vector<ll> v(n);
	vector<ll> rui(n);
	REP(i,n){
		cin >> v[i];
		v[i] -= i;
		rui[i] = v[i];
	}
	
	if(n == 1){
		cout << 0 << endl;
		return 0;
	}
	
	sort(ALL(v));
	sort(ALL(rui));
	
	REP(i,n-1)rui[i+1] += rui[i];
	
	ll ans = LLINF;
	
	for(int i = 1;i < n-1;i++){
		ll A = v[i] * i - rui[i-1];
		ll B = (rui[n-1] - rui[i]) - v[i] * (n - 1 - i);
		ans = min(ans,A+B);
	}
	
	cout << ans << endl;
			
	return 0;
}


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

int main() {
    int N; cin >> N;
    map<int, int> m;
    for (int i = 0; i < N; i++)
    {
        int a; cin >> a;
        m[a]++;
    }

    ll ans = 0;
    for(auto i : m){
        if(i.second>=i.first) ans += i.second - i.first;
        else ans += i.second;
    }    
    cout << ans << endl;
}

Measured memory_bytes: 4736
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,v,u;
long long int useda[100003]={},usedt[100003]={};
long long int a[100003],b[100003],aoki[100003]={},takahashi[100003]={};
vector<long long int> ed[100004];
queue<long long int>taska,taskt;

int main() {
	cout << fixed << setprecision(18);
    cin>>n>>u>>v;
    for(int i=0;i<n-1;i++){
        cin>>a[i]>>b[i];
        ed[a[i]].push_back(b[i]);
        ed[b[i]].push_back(a[i]);
    }
    taska.push(v);
    useda[v]=1;
    while(!taska.empty()){
        for(int i=0;i<ed[taska.front()].size();i++){
            if(useda[ed[taska.front()][i]]==0){
                useda[ed[taska.front()][i]]=1;
                aoki[ed[taska.front()][i]]=aoki[taska.front()]+1;
                taska.push(ed[taska.front()][i]);
            }
        }

        taska.pop();
    }
    taskt.push(u);
    usedt[u]=1;
    while(!taskt.empty()){
        for(int i=0;i<ed[taskt.front()].size();i++){
            if(usedt[ed[taskt.front()][i]]==0){
                usedt[ed[taskt.front()][i]]=1;
                takahashi[ed[taskt.front()][i]]=takahashi[taskt.front()]+1;
                taskt.push(ed[taskt.front()][i]);
            }
        }

        taskt.pop();
    }
    long long int res=0;
    for(int i=1;i<=n;i++){
        if(takahashi[i]<aoki[i]){
            res=max(res,aoki[i]-1);
        }
    }
    cout<<res;
} 

Measured memory_bytes: 11136
#include<vector>

template<typename T>
struct cumulative_sum {
    int n;
    T ZERO;
    std::vector<T> data;
    template<typename I> cumulative_sum(I begin, I end, T ZERO = T())
        : n(end - begin), ZERO(ZERO), data(n + 1) {
        std::copy(begin, end, data.begin() + 1);
        for (int i = 0; i < n; i++) { data[i + 1] += data[i]; }
    }
    T get_sum(int l, int r) const {
        if (l >= r || l > n || r < 0) { return ZERO; }
        if (l < 0) { l = 0; }
        if (r > n) { r = n; }
        return data[r] - data[l];
    }
};

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

int main() {
    int N, T;
    cin >> N >> T;
    vector<int> v(T + 1);
    for (int i = 0; i < N; i++) {
        int l, r;
        cin >> l >> r;
        v[l]++, v[r]--;
    }
    cumulative_sum<int> cs(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i <= T; i++) { ans = max(ans, cs.get_sum(0, i)); }
    cout << ans << endl;
}


Measured memory_bytes: 3608
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    d = defaultdict(int)
    sa = 0
    for i in a:
        sa += i
        d[sa] += 1
    ans = 0
    for iv in d.values():
        ans += iv*(iv-1)//2
    print(ans+d[0])
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 48068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const ll inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;
const ll Mod=1e9+7;


vector<ll> inv,fact,invfact;
void Mod_build(int n=101010){
	fact.resize(n+1);
	inv.resize(n+1);
	invfact.resize(n+1);
	fact[0]=inv[0]=invfact[0]=1;
	inv[1]=1;
	for(ll i=0;i<n;i++){
		fact[i+1]=fact[i]*(i+1)%Mod;
		if(i>0)inv[i+1]=Mod-inv[Mod%(i+1)]*(Mod/(i+1))%Mod;
		invfact[i+1]=invfact[i]*inv[i+1]%Mod;
	}
}
ll perm(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return fact[n]*invfact[n-k]%Mod;
}
ll comb(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return (fact[n]*invfact[n-k]%Mod)*invfact[k]%Mod;
}
ll powMod(ll n,ll k){
	k%=Mod-1;
	if(k<0)k+=Mod-1;
	ll ret=1;
	while(k){
		if(k&1)ret=ret*n%Mod;
		n=n*n%Mod;
		k>>=1;
	}
	return ret;
}


int main(){
  ll i,j;
  ll n;
  cin>>n;
  ll x[n];
  for(i=0;i<n;i++) cin>>x[i];
  ll y[n-1];
  for(i=0;i<n-1;i++){
    y[i]=x[i+1]-x[i];
  }
  Mod_build();
  VI g(101010);
  g[1]=1ll;
  for(i=2;i<101010;i++){
    g[i]=(g[i-1]+inv[i])%mod;
  }

  VI s(n-1);
  s[0]=y[0];
  for(i=1;i<n-1;i++){
    s[i]=(i+1)*s[i-1]%mod;
    ll p=fact[i+1]*g[i+1]%mod;
    p=p*y[i]%mod;
    s[i]=(s[i]+p)%mod;
  }
  cout<<s[n-2]<<endl;
  
  return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector< T > >;

int main() {
  string str;
  cin >> str;
  vi ground(str.length()+1);
  ground[0] = 0;
  rep(i, (int)str.length()) {
    if (str[i] == '_') {
      ground[i+1] = ground[i];
    } else if (str[i] == '/') {
      ground[i+1] = ground[i] + 1;
    } else {
      ground[i+1] = ground[i] - 1;
    }
  }

  int A = 0;
  vi L;
  vi vpd(str.length()+1, 0);
  vi vp(str.length()+1, 0);
  vi st; // x coordinate
  rep(i, (int)str.length()) {
    if ( str[i] == '\\' ) {
      st.pb(i);
    } else if ( str[i] == '/' && !st.empty() ) {
      vpd[st.back()] +=1;
      vpd[st.back()+1] += 1;
      vpd[i] += -1;
      vpd[i+1] += -1;

      st.pop_back();
    }
  }

  rep(i, (int)str.length()) {
    vp[i+1] = vp[i] + vpd[i];
  }

  int cond = 0; // 1: water
  FOR(i, 1, (int)str.length()+1) {
    if (cond == 0 && vp[i] == 1) {
      L.pb(0);
    }
    if (vp[i] == 1) {
      cond = 1 - cond;
    }
    if (vp[i] != 0) {
      L.back() += vp[i];
    }
  }

  rep(i, (int)L.size()) {
    L[i] /= 2;
    A += L[i];
  }

  printf("%d\n", A);
  printf("%lu", L.size());
  rep(i, (int)L.size()) {
    printf(" %d", L[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 3424
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, z, w;
    scan(N, z, w);
    auto a = readln.split.to!(int[]);

    if (N == 1) {
        writeln(abs(a.back - w));
        return;
    }

    auto ans = max(abs(a.back - w), abs(a.back - a[$ - 2]));
    writeln(ans);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 2428
// https://atcoder.jp/contests/abc143/tasks/abc143_e

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%lld%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 300;
const int M_MAX = N_MAX * (N_MAX - 1) / 2;
const int Q_MAX = N_MAX * (N_MAX - 1);
const int L_MAX = 1e9;
const int C_I_MAX = 1e9;
const ll INF = 1e12;

int N, M, L;
int A[M_MAX];
int B[M_MAX];
int C[M_MAX];
int Q;
int s[Q_MAX];
int t[Q_MAX];

ll d[N_MAX][N_MAX];

void warshall_floyd() {
  REP(k, N) REP(i, N) REP(j, N)
    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

void solve() {
  fill(d[0], d[N], INF);
  REP(i, M) d[A[i]][B[i]] = d[B[i]][A[i]] = C[i];
  warshall_floyd();
  REP(i, N) REP(j, N) {
    d[i][j] = (d[i][j] <= L) ? 1 : INF;
  }
  warshall_floyd();
  REP(i, Q) {
    ll ans = d[s[i]][t[i]];
    if (ans >= INF) puts("-1");
    else printf("%lld\n", ans - 1);
  }
}

void input() {
  scanf("%d%d%d", &N, &M, &L);
  REP(i, M) {
    scanf("%d%d%d", A + i, B + i, C + i);
    A[i]--; B[i]--;
  }
  scanf("%d", &Q);
  REP(i, Q) {
    scanf("%d%d", s + i, t + i);
    s[i]--; t[i]--;
  }
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 2304
num=int(input())
word=str(input())
w=[0]
e=[0]
if word[0]=='W':
	w=[1]
	e=[0]
else:
	w=[0]
	e=[1]
for i in range(1,num):
	if word[i]=='W':
		w.append(w[i-1]+1)
		e.append(e[i-1])
	else:
		w.append(w[i-1])
		e.append(e[i-1]+1)
n_th=e[num-1]
for i in range(1,num):
	n=w[i-1]+e[num-1]-e[i]
	if n_th>n:
		n_th=n

print (n_th)

Measured memory_bytes: 18036
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]
lst.sort()
lst = [[lst[i][0] - 1, lst[i][1] - 1, i] for i in range(m)]
dic = {}
for a, b, i in lst:
  if b in dic:
    dic[b].append(i)
  else:
    dic[b] = [i]

used = [False] * m
ans = 0
right = -1
for i in range(m):
  a, b, _ = lst[i]
  if used[i]:
    continue
  if right >= a:
    used[i] = True
    continue
  used[i] = True
  ans += 1
  for p in range(a, b):
    flag = False
    if p in dic:
      for j in dic[p]:
        if not used[j]:
          used[j] = True
          right = p - 1
          flag = True
    if flag:
      break
  else:
    right = p
print(ans)

Measured memory_bytes: 83964
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int count = 0;
    for (int i = 0; i < n; i++) {
      int pn = Integer.parseInt(sc.next());
      if (pn != i + 1) {
        count++;
      }
    }
    if (count <= 2) {
      pw.println("YES");
    } else {
      pw.println("NO");
    }
  }
}


Measured memory_bytes: 23124
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if X == 500*a + 100*b + 50*c:
                count +=1

print(count)


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

int main() {
  // ここにプログラムを追記
  
  int a,b,c;
  double heikin;
  
  cin >> a >> b;
  
  heikin = (a + b) / 2.0;
  c = heikin + 0.9;
  
  cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> h(n);
  for(Int i=0;i<n;i++) cin>>h[i];
  Int ans=0;
  for(Int i=0;i<n;i++){
    Int flg=1;
    for(Int j=0;j<i;j++) if(h[j]>h[i]) flg=0;
    ans+=flg;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
from collections import deque

N, X, Y = map(int, input().split())
X, Y = X - 1, Y - 1

ans = [0] * (N + 1)

def push(q, dist, index, dist_v):
    if dist[index] != -1:
        return
    q.appendleft(index)
    dist[index] = dist_v

for i in range(N):
    q = deque()
    dist = [-1] * N
    push(q, dist, i, 0)
    while len(q) > 0:
        v = q.pop()
        d = dist[v]
        if v - 1 >= 0: push(q, dist, v - 1, d + 1)
        if v + 1 < N: push(q, dist, v + 1, d + 1)
        if v == X: push(q, dist, Y, d + 1)
        if v == Y: push(q, dist, X, d + 1)
    for j in range(N):
        ans[dist[j]] += 1

for i in range(N):
    ans[i] //= 2

for i in range(1, N):
    print(ans[i])


Measured memory_bytes: 76208
// https://atcoder.jp/contests/abc128/tasks/abc128_c
#include <bits/stdc++.h>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,m;
	cin>>n>>m;
	vector<vector<int>> s(m,vector<int>());
	rep(i,m){
		int k;
		cin>>k;
		s[i].resize(k);
		rep(j,k)cin>>s[i][j];
	}
	vector<int> p(m);
	rep(i,m)cin>>p[i];

	int ans=0;
	rep(bit,(1<<n)){
		int light=0;
		rep(i,m){
			int cnt=0;
			rep(j,s[i].size()){
				if((bit>>s[i][j]-1)&1)cnt++;
			}
			if(cnt%2==p[i])light++;
		}
		if(light==m)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

t = sum(b)
j = m
ans = 0

for i in range(n+1):
    while(j > 0 and t > k):
        j -= 1
        t -= b[j]
    if(t > k): break
    ans = max(ans, i+j)
    if(i == n): break
    t += a[i]
print(ans)


Measured memory_bytes: 40596
#include "stdio.h"
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <queue>
#include <algorithm>

#define MAX 4000
#define WMAX 10000
#define NMAX 50
#define AMAX 1000
#define BMAX 100
#define inf 1000000

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    if(n % k == 0)cout << 0;
    else cout << 1;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = [int(x) for x in input().strip().split()]
dp = [None for i in range(n)]
dp[0] = 0
dp[1] = abs(arr[1]-arr[0])
for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]))
print(dp[n-1])

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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1,i,j;
    //cin>>t;
    while(t--)
    {
        int n,m,count=0,sum=0,maxi=0,mini=1e18;
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        while(1)
        {
            c-=b;
            if(c<=0) 
            {
                cout<<"Yes";
                break;
            }
            a-=d;
            if(a<=0)
            {
                cout<<"No";
                break;
            }
        }
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}


vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}

int main() {
    ll N, K, mod = 1e9 + 7;;
    cin >> N >> K;

    ll ans = 0;
    vector<ll> combs(K+1), used_nums(K+1);
    FORR(gcd, K, 1) {
        ll num = mod_pow(K/gcd, N, mod);

        // FOR(i, gcd+1, K) {
        //     if(i%gcd == 0) num -= combs[i];
        // }
        vector<ll> divs = divisor(gcd);
        if(used_nums[gcd] > 1e9) cerr << "error" << endl;
        num = (num + mod - used_nums[gcd]) % mod;

        for(ll x: divs) {
            used_nums[x] += num;
            used_nums[x] %= mod;
        }
        combs[gcd] = num;
        ans += num * gcd;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <vector>

#define rep(i, s, N) for(int i = s; i < N; i++)
#define YesNo(result) do {if (result) std::cout << "Yes" << '\n'; else std::cout << "No" << '\n';} while(0)
#define resetarr(arr, val) for(int i = 0; i < sizeof(arr) / 4; i++){ arr[i] = val; }


int main(int argc, char const *argv[]) {
  std::string s;
  std::cin >> s;
  int ans = 700;
  for(int i =0; i < s.length(); i++){
    if(s[i] == 'o') {
      ans += 100;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
A, B, C, X = readlines.map { |l| l.chomp.to_i }

ans = 0
(A+1).times do |a|
  (B+1).times do |b|
    (C+1).times do |c|
       ans += 1 if X == (500 * a + 100 * b + 50 * c)
    end
  end
end
p ans

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

int main() {
  
  int N=0;
  
  cin >> N;
  
  if(N == 1){
    
    int pass1 = 1*1*1;
    
    cout << pass1 << endl;
    
  } else if(N == 2){
    
    int pass2 = 2*2*2;
    
    cout << pass2 << endl;
    
  } else if(N == 3){
    
    int pass3 = 3*3*3;
    
    cout << pass3 << endl;
    
  } else if(N == 4){
    
    int pass4 = 4*4*4;
    
    cout << pass4 << endl;
    
  } else if(N == 5){
    
    int pass5 = 5*5*5;
    
    cout << pass5 << endl;
    
  } else if(N == 6){
    
    int pass6 = 6*6*6;
    
    cout << pass6 << endl;
    
  } else if(N == 7){
    
    int pass7 = 7*7*7;
    
    cout << pass7 << endl;
    
  } else if(N == 8){
    
    int pass8 = 8*8*8;
    
    cout << pass8 << endl;
    
  } else if(N == 9){
    
    int pass9 = 9*9*9;
    
    cout << pass9 << endl;
    
  }
  return 0;
}

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

int main(){
  int sx, sy, tx, ty;
  scanf("%d", &sx);
  scanf("%d", &sy);
  scanf("%d", &tx);
  scanf("%d", &ty);
  std::string ans;
  int x = tx-sx;
  int y = ty-sy;
  for (int i=0; i<y; i++){
    ans += 'U';
  }
  for (int i=0; i<x; i++){
    ans += 'R';
  }
  for (int i=0; i<y; i++){
    ans += 'D';
  }
  for (int i=0; i<x; i++){
    ans += 'L';
  }
  ans += 'L';
  for (int i=0; i<y+1; i++){
    ans += 'U';
  }
  for (int i=0; i<x+1; i++){
    ans += 'R';
  }
  ans += 'D';
  ans += 'R';
  for (int i=0; i<y+1; i++){
    ans += 'D';
  }
  for (int i=0; i<x+1; i++){
    ans += 'L';
  }
  ans += 'U';
  //printf("%d\n", ans.length());
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())

int main() {
	double L;
	cin >> L;
	printf("%.6lf\n", L * L * L / 27);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int n,i,j,k,flag,a[100];
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	flag=0;
	
	for(i=0;i<n;i++){
		for(j=n-1;j>0;j--){
			if(a[j]<a[j-1]){
				k=a[j];
				a[j]=a[j-1];
				a[j-1]=k;
				flag++;
			}
		}
	}
	
	for(i=0;i<n;i++){
		if(i>0){
			printf(" ");
		}
		printf("%d",a[i]);
		if(i==n-1){
			printf("\n%d\n",flag);
			
		}
	}
	
	return 0;
}


Measured memory_bytes: 2088
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    int N = input<int>(), A = input<int>(), B = input<int>();
    if ((abs(A - B) - 1) % 2 == 0)
    {
        cout << "Borys" << endl;
    }
    else
    {
        cout << "Alice" << endl;
    }
    return 0;
}

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

int main()
{
  int N , K ;
  cin >> N >> K ;
  vector<int>p(N);
  
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  
  sort(p.begin(),p.end());
  
  int ans=0;
  for(int i=0;i<K;i++){
    ans+=p.at(i);
  }
  
  cout << ans << endl; 

return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        
        static void Solve()
        {
            var input = Console.ReadLine().Split(' ');
            string ans = "A" + input[1][0] + "C";
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;


int32_t main()
{
    fast

   int test=1;
   //cin>>test;

  
  while(test--)
  {
    int r;
    cin>>r;
    double ans;

    ans=2*r*M_PI;
    
    cout<<fixed<<setprecision(20)<<ans;
  
  // while loop ending
   }
  

return 0;
}

Measured memory_bytes: 3804
//Counter-Clockwise
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

static const double ESP = 1e-10;

bool equals(double a, double b) { return fabs(a - b) < ESP; }

class Point {
public:
    double x, y;

    explicit Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (const Point &p) const { return Point(x + p.x, y + p.y); }
    Point operator - (const Point &p) const { return Point(x - p.x, y - p.y); }
    Point operator * (double a) { return Point(a * x, a * y); }
    Point operator / (double a) { return Point(a / x, a / y); }

    double norm() { return x * x + y * y; }
    double abs() { return sqrt(norm()); }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator == (const Point &p) const {
        return fabs(x - p.x) < ESP && fabs(y - p.y) < ESP;
    }
};

typedef Point Vector;

struct Segment {
    Point p1, p2;
    Segment(Point p1, Point p2): p1(p1), p2(p2) {}
};

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

bool isParallel(Vector v1, Vector v2) {
    return equals(cross(v1, v2), 0.0);
}

bool isOrthogonal(Vector v1, Vector v2) {
    return equals(dot(v1, v2), 0.0);
}

Point project(Segment s, Point p) {
    Vector base = s.p2 - s.p1;
    return s.p1 + (base * (dot(base, p - s.p1) / base.norm()));
}

Point reflect(Segment s, Point p) {
    return p + (project(s, p) - p) * 2;
}

enum {
    COUNTER_CLOCKWISE = 1,
    CLOCKWISE = -1,
    ONLINE_BACK = 2,
    ONLINE_FRONT = -2,
    ON_SEGMENT = 0
};

int ccw(Point p0, Point p1, Point p2) {
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > ESP) return COUNTER_CLOCKWISE;
    else if (cross(a, b) < -ESP) return CLOCKWISE;
    else if (dot(a, b) < -ESP) return ONLINE_BACK;
    else if (a.norm() < b.norm()) return ONLINE_FRONT;
    else return ON_SEGMENT;
}

bool intersect(Point p0, Point p1, Point p2, Point p3) {
    return (ccw(p0, p1, p2) * ccw(p0, p1, p3) <= 0 && ccw(p2, p3, p0) * ccw(p2, p3, p1) <= 0);
}

bool intersect(Segment s1, Segment s2) {
    return intersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

Point getCrossPoint(Segment s1, Segment s2) {
    Vector base = s1.p2 - s1.p1;
    double d1 = fabs(cross(base, s2.p1 - s1.p1));
    double d2 = fabs(cross(base, s2.p2 - s1.p1));
    return s2.p1 + (s2.p2 - s2.p1) * (d1 / (d1 + d2));
}

int main() {
    int q;
    double x0, y0, x1, y1, x2, y2, x3, y3;
    cin >> q;
    for(int i = 0; i < q; i++) {
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Segment s1 = Segment(Point(x0, y0), Point(x1, y1));
        Segment s2 = Segment(Point(x2, y2), Point(x3, y3));
        Point x = getCrossPoint(s1, s2);
        cout << setprecision(15) << x.x << " " << x.y << endl;
    }
}


Measured memory_bytes: 3288
//By Don4ick
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

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

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qwer1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

const int N = 606;
const int BASE = 1021;

using namespace std;

ull h1[N][N], h2[N][N], f[N];

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

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	//~solve
	int n;
	cin >> n;
	vector < string > s(n + n);
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		s[i] += s[i];
	}
	for (int i = 0; i < n; i++)
		s[i + n] = s[i];
	//~solve
	forn(i, n + n)
	{
		forn(j, n + n)
		{
			h1[i][j] = h1[i][j - 1] * BASE + s[i - 1][j - 1];
			h2[i][j] = h2[i - 1][j] * BASE + s[i - 1][j - 1];	
		}
	}
	int ans = 0;
	f[0] = 1;
	forn(i, n + n)
		f[i] = f[i - 1] * BASE;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			bool good = true;
			for (int k = 0; k < n; k++)
			{
				ull hh1 = h1[i + k + 1][j + n] - h1[i + k + 1][j] * f[n];
				ull hh2 = h2[i + n][j + k + 1] - h2[i][j + k + 1] * f[n];
				if (hh1 != hh2)
					good = false;
			}
			if (good)
				ans++;
		}		
	}
	cout << ans << endl;

	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int n;

void countingSort(vector<int> &A, vector<int> &B, int k){
    vector<int> C(k+1);
    rep(i,k+1) C[i] = 0;
    // Aの要素に出現する数値の回数をそれぞれカウントする
    rep(i,n) C[A[i]]++;
    // Cの累積和を計算する
    rep(i,k+1){
        if(i == 0) continue;
        C[i] += C[i-1];
    }
    for(int i=n-1; i>=0; i--){
        B[C[A[i]]-1] = A[i];
        C[A[i]]--;
    }
}

int main()
{
    cin >> n;
    vector<int> A(n), B(n);
    int k = 0;
    rep(i,n){
        scanf("%d", &A[i]);
        if(k < A[i]) k = A[i];
    }
    countingSort(A, B, k);
    rep(i,n){
        cout << B[i];
        if(i != n-1) cout << " ";
    }cout << endl;
}


Measured memory_bytes: 18332
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const{ return cost < b.cost; }
	bool operator>(const P &b) const{ return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const{ return cost < b.cost; }
	bool operator>(const E &b) const{ return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const{
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const{
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const{ return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const{ return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int a, b;
	cin >> a >> b;
	if (b%a == 0) cout << a + b << endl;
	else cout << b - a << endl;
}

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

using namespace std;
#define int long long
const int N = 6666;
int x,k,d;
signed main(){
	cin>>x>>k>>d;
	if(x<0) x*=-1;
	int tmp=x/d;
	int ans=0;
	if(tmp>=k) ans=x-k*d;
	else{
		ans=x-d*tmp;
		k-=tmp;
		if(k%2) ans=abs(ans-d);
		
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
    int x, y;
    scanf("%d %d", &x, &y);
    int i, j, cnt=0;
    for(i=0;i<=100;i++){
        for(j=0;j<=100;j++){
            if(x == i+j && y == 2*i+4*j){
                cnt++;
            }
        }
    }
    if(cnt != 0){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 1732