akhauriyash/Code-Regression huggingface dataset:
class Factorial:
    def __init__(self, max_fact, mod):
        #mod should be prime number
        #using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
        f = [1] * (max_fact + 1)
        for idx in range(2, max_fact + 1):
            f[idx] = f[idx - 1] * idx
            f[idx] %= mod
        fi = [pow(f[-1], mod - 2, mod)]
        for idx in range(max_fact, 0, -1):
            fi += [fi[-1] * idx % mod]
        fi = fi[::-1]
        self.mod = mod
        self.f = f
        self.fi = fi

    def factorial(self, n):
        return self.f[n]

    def factorial_inverse(self, n):
        return self.fi[n]

    def combination(self, n, r):
        f = self.f
        fi = self.fi
        return f[n] * fi[r] * fi[n - r] % self.mod

    def permutation(self, n, r):
        return self.f[n] * self.fi[n - r] % self.mod

    def homogeneous_product(self, n, r):
        f = self.f
        fi = self.fi
        return f[n + r - 1] * fi[r] * fi[n - 1] % self.mod


max_fact = 5 * 10**5
mod = 10**9 + 7
fact_instance = Factorial(max_fact, mod)
comb = fact_instance.combination
perm = fact_instance.permutation

N, M = [int(_) for _ in input().split()]
ans = 0
for p in range(N + 1):
    ans += (-1)**p * comb(N, p) * perm(M - p, N - p)
    ans %= mod
ans *= perm(M, N)
ans %= mod
print(ans)


Measured memory_bytes: 52352
package main

import "fmt"

func main() {
	var X int
	fmt.Scan(&X)
	ans := 1
	for b := 2; b*b <= X; b++ {
		v := b * b
		for v <= X {
			ans = Max(ans, v)
			v *= b
		}
	}
	fmt.Println(ans)
}

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


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

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

using namespace std;

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

    int N, A;
    cin >> N >> A;

    if (A >= N % 500) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

key = len(A) % 2
ans = [0]*N
mid = (len(A)) // 2
for i in range(N):
    ans[mid + ((-1)**(i+key))*((i+1)//2)] = A[i]
for i in range(N):
    print(ans[i], end = " ")
print("")


Measured memory_bytes: 26360
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
// };
} fio;

int N;
vector<string> y;

void dfs2(string s){
	
	if(s.size() == N){
		cout<<s<<endl;
		y.push_back(s);
		return ;
	}
	for(int i = 0; i <= s[(int)s.size()-1] - 'a' + 1; i++){
		char c = i + 'a';
		
		dfs2(s + c);
	}
}

void dfs(string s){
	
	if(s.size() == N){
		// cout<<s<<endl;
		y.push_back(s);
		return ;
	}
	// for(int i = 0; i <= s[(int)s.size()-1] - 'a' + 1; i++){
		// char c = i + 'a';
		
		// dfs(s + c);
	// }
	int con[26] = {};
	
	for(int i = 0; i < s.size(); i++){
		con[s[i] - 'a'] = true;
		con[s[i] - 'a' + 1] = true;
	}
	
	for(int i = 0; i < 26; i++){
		if(con[i] == false) break;
		char c = i + 'a';
		
		dfs(s+c);
	}
}
/*
$ ./a.exe

4
aaaa
aaab
aaba
aabb
aabc
abaa
abab
abba
abbb
abbc
abca
abcb
abcc
abcd





4
aaaa
aaab
aaba
aabb
aabc
abaa
abab
abac
abba
abbb
abbc
abca
abcb
abcc
abcd

*/
signed main(){
	cout<<fixed<<setprecision(10);
	string x;
	
	x = "a";
	
	cin>>N;
	
	dfs(x);
	// x[0] = 'b';
	// dfs(x);
	
	// cout<<y.size()<<endl;
	
	sort(y.begin(), y.end());
	for(int i = 0; i < y.size(); i++){
		cout<<y[i]<<endl;
	}
	return 0;
	for(int i = 0; i < y.size(); i++){
		for(int j = i+1; j < y.size(); j++){
			bool flag = true;
			for(int k = 0; k < N; k++){
				for(int l = 0; l < N; l++){
					if(y[i][k] == y[i][l] && y[j][k] == y[j][l]) {
						
					} else if(y[i][k] != y[i][l] && y[j][k] != y[j][l]){
					} else {
						flag = false;
					}
				}
			}
			
			if(flag) {
				cout<<"ZZZ "<<y[i]<<" "<<y[j]<<endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 9716
#include<stdio.h>
int main(){
int h,w,i,j;
while(1){
scanf("%d %d",&h,&w);
if((h==0)&&(w==0)) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if (j==0)printf("#");
else if (i==0)printf("#");
else if (j+1==w)printf("#");
else if (i+1==h)printf("#");
else printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 572
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const double EPS = 1e-11;

double width(vector<pair<int,int>> polygon, double x) {
  vector<double> w;
  for (int i = 0; i < polygon.size() ; i++) {
    pair<int,int> p = polygon[i], q = polygon[(i+1)%polygon.size()];
    if (abs(p.first - x) < EPS)
      w.push_back(1.0*p.second);
    else if ((p.first < x && x < q.first) || (p.first > x && x > q.first)) {
      int x0 = p.first, y0 = p.second;
      int x1 = q.first, y1 = q.second;
      w.push_back(y0 + 1.0*(y1-y0)*(x-x0)/(x1-x0));
    }
  }
  sort(w.begin(), w.end());
  return w[w.size()-1] - w[0];
}

double volume(vector<pair<int,int>> pxy, vector<pair<int,int>> pxz, vector<int> X) {
  double total = 0.0;
  int xmin = max((*min_element(pxy.begin(), pxy.end())).first,
                 (*min_element(pxz.begin(), pxz.end())).first);
  int xmax = min((*max_element(pxy.begin(), pxy.end())).first,
                 (*max_element(pxz.begin(), pxz.end())).first);
  sort(X.begin(), X.end());
  for (int i = 0; i < X.size()-1; i++) {
    int a = X[i], b = X[i+1];
    if (!(xmin <= a && a <= xmax && xmin <= b && b <= xmax))
      continue;
    double m = (a+b)/2.0;
    double va = width(pxy, a)*width(pxz, a);
    double vb = width(pxy, b)*width(pxz, b);
    double vm = width(pxy, m)*width(pxz, m);
    double area = ((b-a)/6.0)*(va + 4.0*vm + vb);
    total += area;
  }
  return total;
}

int main() {
  int M, N;
  while (cin >> M >> N && M > 0) {
    vector<pair<int,int>> PXY, PXZ;
    vector<int> X;
    int x, y, z;
    for (int i = 0; i < M; i++) {
      cin >> x >> y;
      PXY.push_back(make_pair(x,y));
      X.push_back(x);
    }
    for (int i = 0; i < N; i++) {
      cin >> x >> z;
      PXZ.push_back(make_pair(x,z));
      X.push_back(x);
    }
    cout << fixed << volume(PXY, PXZ, X) << endl;
  }
}



Measured memory_bytes: 3232
# lossがつらいので、全コンテストで26日以上の間があかないようにする。
# 26日サイクルで全部回すとして、残ってるコンテストの中で一番点数の高いものから順に選んでいく
import sys
import numpy as np
def main():
    DEBUG_MODE=False

    if DEBUG_MODE:
        f = open('tester/example/sample2.in')
        fo=open('tester/example/sample2.out','w')
    
    if DEBUG_MODE:
        D = int(f.readline())
    else:
        D = int(sys.stdin.readline())
    Dur = np.zeros(26)
    S = np.zeros((D, 26))
    if DEBUG_MODE:
        C = np.array(list(map(int, f.readline().split())))
    else:
        C = np.array(list(map(int, sys.stdin.readline().split())))
    
    for i in range(D):
        if DEBUG_MODE:
            S[i] = list(map(int, f.readline().split()))
        else:
            S[i] = list(map(int, sys.stdin.readline().split()))

    now=0
    already=set()
    for d in range(D):
        argSS=np.argsort(S[d])
        for c in argSS[::-1]:
            if c not in already:
                already.add(c)
                out=c+1
                break

        if DEBUG_MODE:
            fo.write(str(out)+'\n')
        else:
            print(out)

        now+=1
        if now==26:
            now=0
            already=set()

    if DEBUG_MODE:
        f.close()
        fo.close()
main()


Measured memory_bytes: 27268
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//vector<ll> cue: キューの宣言
//n重ループ：初期化の位置に注意
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

ll a(ll n, ll x) {
	ll r = pow(10, x);
	n = (n % r);
	n /= pow(10, x - 1);
	return n;
}

int main() {
	string a, b, c; cin >> a >> b >> c;

	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
// by The_One_Solver
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
long long  l,w,a,b,c,x,n,arr[1000001];
map<long long,int >mp;
set<long long>st;
set<long long>::iterator it;
int main()
{
    cin>>a>>b;

    c=__gcd(a,b);
    x=c;
    for(long long i=1;i<=sqrt(c);i++)
    {
        if(x%i==0)
        {   if(mp[i]!=1)
            {arr[l]=i;l++;}
             mp[i]=1;
            if(i*i!=x&&mp[x/i]!=1)
            {
               arr[l]=x/i;l++;
               mp[i]=1;
            }
        }
    }
    mp.clear();
    sort(arr,arr+l);
    for(long long i=1;i<l;i++)
    {   if(arr[i]!=-1)
        {for(long long j=i+1;j<l;j++)
         {
            if(arr[j]%arr[i]==0)arr[j]=-1;
         }
        }
    }
    for(long long i=0;i<l;i++)
    {
        if(arr[i]!=-1)w++;
    }
cout<<w<<endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
#define MOD 1e9+7
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  vint a(3);cin>>a[0]>>a[1]>>a[2];
  vsort(a);cout<<a[0]+a[1]<<endl;
  //caricurate
  //output
}

Measured memory_bytes: 256
from collections import defaultdict


def prime_factorize(num):
    prime_numbers = defaultdict(int)
    i = 2
    while i * i <= num:
        if num % i == 0:
            while num % i == 0:
                prime_numbers[i] += 1
                num //= i
        i += 1
    if num != 1:
        prime_numbers[num] += 1
    return prime_numbers


MOD = 10**9 + 7
N, M = [int(elem) for elem in input().split()]

prime_numbers = prime_factorize(M)

num_sequences = 1
for exponent in prime_numbers.values():
    denomimator = 1
    numerator = 1
    for i in range(1, exponent + 1):
        denomimator *= (N + exponent - i)
        numerator *= i
    num_sequences *= denomimator // numerator
    num_sequences %= MOD

print(num_sequences)


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

int main()
{
    int n;
    cin>>n;
    int val[n][3];
    for(int i=0;i<n;i++)
    {
        cin>>val[i][0]>>val[i][1]>>val[i][2];
    }

    long long cost[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
            cost[i][j] = -1;
    }

    cost[n-1][2] = val[n-1][2];
    cost[n-1][1] = val[n-1][1];
    cost[n-1][0] = val[n-1][0];
    for(int i = n-2;i>=0;i--)
    {
        for(int k=0;k<3;k++)
        {
            for(int j=0;j<3;j++)
                if(j!=k)
                cost[i][k] = max(cost[i][k],val[i][k]+cost[i+1][j]);
        }
    }
    long long ans = max(max(cost[0][0],cost[0][1]),cost[0][2]);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3800
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;

int main(){

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

    bool endflag = false;

    int cnt = 0;
    while(!endflag){
        if(cnt%2 == 1 && a == n-1 && b == n){
            cout << "Alice" << endl;
            endflag = true;
        }
        else if(cnt%2 == 0 && a == 1 && b == 2){
            cout << "Borys" << endl;
            endflag = true;
        }
        else if(cnt%2 == 0){
            if(b != a + 1){
                a++;
            }
            else{
                a--;
            }
        }
        else{
            if(b != a + 1){
                b--;
            }
            else{
                b++;
            }
        }
        cnt++;
    }

    return 0;
}

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

int main()
{
	int n;
	double a[50];
	double ans;
	cin >> n;
	for( int i = 0; i < n; i++ )
	{
		cin >> a[i];
	}

	sort(a,a+n);
	ans = (a[0] + a[1]) / 2;
	for( int i = 2; i < n; i++ )
	{
		ans = ( ans + a[i] ) / 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 100100
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,s,a[MAX];
bool calc(int p)
{
	int s=0,mn=1e9;
	for(int i=1;i<=n;++i)s+=a[i]&1,mn=min(mn,a[i]);
	if((n-s)&1)return p;
	if(s>1||mn==1)return p^1;
	for(int i=1;i<=n;++i)a[i]>>=1;
	int d=a[1];
	for(int i=1;i<=n;++i)d=__gcd(d,a[i]);
	for(int i=1;i<=n;++i)a[i]/=d;
	calc(p^1);
}
int main()
{
	n=read();for(int i=1;i<=n;++i)a[i]=read();
	puts(calc(1)?"First":"Second");
	return 0;
}


Measured memory_bytes: 640
n,m=map(int,input().split())
pp=[0]*6
xx=[0]*6
PY=[list(map(int,input().split())) for _ in range(m)]
g=[[] for _ in range(n+1)]
for i ,(p,y) in enumerate(PY):
    g[p].append((y,i))

ans=[0]*m
for i in range(n+1):
    for o,(j,k) in enumerate(sorted(g[i])):
        ans[k]=str(i).zfill(6)+str(o+1).zfill(6)
for i in ans:
    print(i)

Measured memory_bytes: 92504
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

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...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int vector_finder(std::vector<char> vec, char char_n) {
    auto itr = std::find(vec.begin(), vec.end(), char_n);
    size_t index = std::distance(vec.begin(), itr);
    if (index != vec.size()) {  // 発見できたとき
        return 1;
    } else {  // 発見できなかったとき
        return 0;
    }
}

int counter = 0;
int dfs(ll current, char num, int N) {
    string current_str = to_string(current);
    int len = to_string(current).length();
    vector<char> v(len);
    rep(i, len) { v[i] = current_str[i]; }
    v.push_back(num);

    string s;
    rep(i, v.size()) {
        if (v[i] != '\0') {  //空文字判定
            s += v[i];
        }
    }
    current = stol(s);
    if (current > N) {
        return 0;
    }

    if (vector_finder(v, '3') + vector_finder(v, '5') + vector_finder(v, '7') ==
        3) {
        counter++;
    }
    // debug(current, v, s, current, counter);
    dfs(current, '3', N);
    dfs(current, '5', N);
    dfs(current, '7', N);
    return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    dfs(3LL, '3', N);
    dfs(5LL, '3', N);
    dfs(7LL, '3', N);
    dfs(3LL, '5', N);
    dfs(5LL, '5', N);
    dfs(7LL, '5', N);
    dfs(3LL, '7', N);
    dfs(5LL, '7', N);
    dfs(7LL, '7', N);
    cout << counter << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
	int a,b,c;
  cin>>a>>b>>c;
  int m = a;
  m = max(max(a,b),c);
  cout<<a+b+c+m*9<<endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"reflect"
	"strconv"
	"strings"
)

var SENTINEL = 2000000000

type Card struct {
	suit  string
	value int
}

func merge(A []Card, n, left, mid, right int) {
	n1 := mid - left
	L := make([]Card, n1+1)
	n2 := right - mid
	R := make([]Card, n2+1)

	for i := 0; i < n1; i++ {
		L[i] = A[left+i]
	}
	for i := 0; i < n2; i++ {
		R[i] = A[mid+i]
	}
	L[n1].value, R[n2].value = SENTINEL, SENTINEL

	i, j := 0, 0
	for k := left; k < right; k++ {
		if L[i].value <= R[j].value {
			A[k] = L[i]
			i++
			continue
		}
		A[k] = R[j]
		j++
	}
}

func mergeSort(A []Card, n, left, right int) {
	mid := 0
	if left+1 < right {
		mid = (left + right) / 2
		mergeSort(A, n, left, mid)
		mergeSort(A, n, mid, right)
		merge(A, n, left, mid, right)
	}
}

func partition(A []Card, n, p, r int) int {
	x := A[r]
	i := p - 1
	for j := p; j < r; j++ {
		if A[j].value <= x.value {
			i++
			A[i], A[j] = A[j], A[i]
		}
	}
	A[i+1], A[r] = A[r], A[i+1]
	return i + 1
}

func quickSort(A []Card, n, p, r int) {
	q := 0
	if p < r {
		q = partition(A, n, p, r)
		quickSort(A, n, p, q-1)
		quickSort(A, n, q+1, r)
	}
}

func answer(r io.Reader) string {
	sc := bufio.NewScanner(r)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	A, B := make([]Card, n), make([]Card, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss := strings.Split(sc.Text(), " ")
		A[i].suit = ss[0]
		A[i].value, _ = strconv.Atoi(ss[1])
		B[i].suit, B[i].value = A[i].suit, A[i].value
	}

	mergeSort(A, n, 0, n)
	quickSort(B, n, 0, n-1)

	var buf bytes.Buffer
	if reflect.DeepEqual(A, B) {
		buf.WriteString("Stable\n")
	} else {
		buf.WriteString("Not stable\n")
	}

	for i := 0; i < n; i++ {
		buf.WriteString(B[i].suit)
		buf.WriteString(" ")
		buf.WriteString(strconv.Itoa(B[i].value))
		buf.WriteString("\n")
	}
	return strings.TrimRight(buf.String(), "\n")
}

func main() {
	fmt.Println(answer(os.Stdin))
}



Measured memory_bytes: 16748
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
#include <stdlib.h>
using namespace std;
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
typedef pair<int, int> p;
vector< int64_t > divisor(int64_t n) {
	vector< int64_t > ret;
	for (int64_t 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);
}
long long mod = 1e9 + 7;
string xo (string s, string t) {
	string ans = "";
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == t[i])ans += '0';
		else ans += '1';
	}
	return ans;
}
char xorr(char s, char t) {
	if (s == t)return '0';
	else return '1';
}
int num[30][500];
int main(int argc, char* argv[]) {
	srand(100);
	for (int i = 0; i < 30; i++) {
		set<int>s;
		while (s.size() < 500) {
			s.insert(rand() % 1000);
		}
		int j = 0;
		for (auto itr = s.begin(); itr != s.end(); itr++) {
			num[i][j++] = *itr;
		}
	}
	string s;
	cin >> s;
	if (s != "Charlie") {
		string ans = "";
		string tmp;
		for (int i = 0; i < 100; i++) {
			cin >> tmp;
			for (int j = 0; j < 30; j++) {
				char c = '0';
				for (int k = 0; k < 500; k++) {
					char x = tmp[num[j][k]];
					c = xorr(c, x);
				}
				ans += c;
			}
		}
		cout << ans;
	}
	else {
		map<string, p>ma;
		string a[100];
		string b[100];
		string x, y;
		cin >> x >> y;
		for (int i = 0; i < 100; i++) {
			a[i] = x.substr(i * 30, 30);
			b[i] = y.substr(i * 30, 30);
		}
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j < 100; j++) {
				string tmp = xo(a[i], b[j]);
				ma[tmp] = p(i + 1, j + 1);
			}
		}
		string cc;
		for (int i = 0; i < 100; i++) {
			cin >> cc;
			string str = "";
			for (int j = 0; j < 30; j++) {
				char c = '0';
				for (int k = 0; k < 500; k++) {
					char x = cc[num[j][k]];
					c = xorr(c, x);
				}
				str += c;
			}
			auto pr = ma.find(str)->second;
			cout << pr.first << " " << pr.second << "\n";
		}
	}
}



Measured memory_bytes: 4716
#include<bits/stdc++.h>
#define mkp make_pair
#define all(a) a.begin(),a.end() 
using namespace std;
typedef long long ll;
typedef map<ll,ll>::iterator itll;
typedef pair<ll,ll> P; 
int main()
{
	string s;
	cin>>s; 
	for(int pos = 0;pos<s.size();pos++)
	{
		for(int len = 0;len<=s.size();len++)
		{
			string k = s;
			k.erase(pos,len);
			if(k == "keyence")
			{
				cout<<"YES\n";
				return 0;
			}
		}
	}
	cout<<"NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {
  int big_b, regular_b, grape, cherry, star, total;
  while (true) {
    int medal = 100;
    cin >> big_b >> regular_b >> grape >> cherry >> star >> total;
    if (total == 0)
      break;
    medal += big_b * (15 + 15 * 5);
    medal += regular_b * (15 + 15 * 3);

    //grape -= big_b * 5 + regular_b * 3;                                                                                                         
    medal += grape * 7;

    medal += cherry * 2;

    total -= star;
    medal -= star * 0;
    total -= big_b * 5 + regular_b * 3;
    medal -= (big_b * 5 + regular_b * 3) * 2;

    medal -= total * 3;

    cout << medal << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
}

Measured memory_bytes: 27040
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	for (int i = 0; i < n - 1; ++i)
		ans += a[i + 1] - a[i];

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int, input().split())

A = []
for _ in range(N):
    A.append(int(input()))

ans = X

for i in range(1, D+1):
    for j in A:
        if j == 1:
            ans += 1
        elif i % j == 1:
            ans += 1

print(ans)

Measured memory_bytes: 3064
from functools import reduce
from operator import add

n,k=map(int, input().split())
hList=list(map(int, input().split()))

sortedHList = sorted(hList, reverse=True)
restHList = sortedHList[k:]
if len(restHList) == 0:
  print(0)
else:
  print(reduce(add, restHList))

Measured memory_bytes: 26524
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

int solve() {
    string s, ans;
    cin >> s;
    int n = sz(s);
    if(s[n - 1] == 's') {
        ans = s + "es";
    } else {
        ans = s + "s";
    }
    cout << ans << endl;
    return 0;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    while(t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n,i,j,k,a[100000];
    cin >> n;
    for (i=0;i<n;i++)
        cin >> a[i];
    sort(a,a+n);
    if (a[n/2-1]!=a[n/2]){
        k=a[n/2]-a[n/2-1];
        cout << k << endl;
    }
    else
        cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 640
n,k=map(int,input().split())
mod = 1000000007
ko = [0]*100005
ans = 0
for i in range(k,0,-1):
    baisu = k//i
    ko[i] = pow(baisu,n,mod)
    for j in range(2,baisu+1):
        ko[i] -= ko[i*j]
        ko[i] %= mod
    ans += ko[i] * i % mod
    ans %= mod
print(ans)


Measured memory_bytes: 74560
N, M = map(int, input().split())
g = [[] for i in range(N)]

for i in range(M):
  a, b = map(int, input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)

memo = {}
All_used = (1 << N) - 1


def dfs(v, used):
  if used == All_used:
    return 1
  key = (v, used)
  if key in memo:
    return memo[key]
  ans = 0
  for i in g[v]:
    if used & (1 << i):
      continue
    used ^= (1 << i)
    ans += dfs(i, used)
    used ^= (1 << i)
  memo[key] = ans
  return ans

print(dfs(0, 1))


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
    	try(Scanner sc = new Scanner(System.in)) {
    		
    		while(true) {
    			int r0 = sc.nextInt();
    			int w0 = sc.nextInt();
    			int c  = sc.nextInt();
    			int r  = sc.nextInt();
    			if(r0 + w0 + c + r == 0)	break;
    			int ans = 0;
    			for(int i = 0; i <= Integer.MAX_VALUE; i++) {
        			if((r0 + r*i)/ c >= w0) {
        				ans = i;
        				break;
        			}
        		}
    			System.out.println(ans);
    		}
    		
    	}
    }
   
}




Measured memory_bytes: 26648
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    int n, l;
    float x;
    cin >> n;
    
    x = ceil(n / (1.08));
    l = x;
    
    if((int)(l * 1.08) == n){
    	cout << l;
	}else{
		cout << ":(";
	}
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	for(int i  = 0; i < 3; i++) {
	    char c1 = s.charAt(i);
	    char c2 = s.charAt(i+1);
	    if(c1 == c2) {
		System.out.println("Bad");
		System.exit(0);
	    }
	}
	System.out.println("Good");
	//while (true) {
	//int a =sc.nextInt();
	//System.out.println();
    }
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, Y; scanf("%d %d", &N, &Y);
  Y /= 1000;
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j + i <= N; ++j) {
      int k = N - i - j;
      if (i * 10 + j * 5 + k == Y) {
        printf("%d %d %d\n", i, j, k);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<int,int> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int m;
Pi xy[11];
vector<Pi> PP[8];
Pi rotate(Pi p){
	Pi re;
	if(p.second!=0){
		re.first=p.second;
		re.second=0;
	}else{
		re.first=0;
		re.second=-1*p.first;
	}
	return re;
}

int main(){
	while(1){
		cin>>n;
		if(n==0)break;
		cin>>m;
		FOR(i,0,8)
			PP[i].clear();
		REP(i,m){
			int x,y;
			cin>>x>>y;
			xy[i]=Pi(x,y);
		}
		FOR(i,1,m)
			PP[0].push_back(Pi(xy[i].first-xy[i-1].first,xy[i].second-xy[i-1].second));
		
		for(int i=m-2;i>=0;i--){
			Pi t;
			t.first=PP[0][i].first*-1;
			t.second=PP[0][i].second*-1;
			PP[4].push_back(t);
		}
		
		FOR(i,1,4){
			FOR(j,0,PP[i-1].size()){
				PP[i].push_back(rotate(PP[i-1][j]));
			}
		}		
		FOR(i,5,8){
			FOR(j,0,PP[i-1].size()){
				PP[i].push_back(rotate(PP[i-1][j]));
			}
		}
		
		/*for(int i=0;i<8;i++){
			for(int j=0;j<PP[i].size();j++){
				printf("%d %d//",PP[i][j].first,PP[i][j].second);
			}
			printf("\n");
		}*/
		vector<Pi> rv;
		vector<Pi> vv;
		vector<int> ans;
		ans.clear();
		for(int i=1;i<=n;i++){
			rv.clear();
			vv.clear();
			int tm;
			cin>>tm;
			for(int j=0;j<tm;j++){
				int a,b;
				cin>>a>>b;
				rv.push_back(Pi(a,b));
			}
			for(int j=1;j<tm;j++)
				vv.push_back(Pi(rv[j].first-rv[j-1].first,rv[j].second-rv[j-1].second));
			int flag=0;
			if(tm!=m)continue;
			for(int j=0;j<8;j++){
				for(int k=0;k<tm-1;k++){
					if(PP[j][k]!=vv[k]){
						break;
					}
					if(k==tm-2)flag=1;
				}
			
			
			}
			if(flag){
				//printf("%d\n",i);
				ans.push_back(i);
			}
		}
		REP(i,ans.size()){
			cout<<ans[i]<<endl;
		}
		printf("+++++\n");
	}
	return 0;
}


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

#define ll long long
#define mod 1000000007
#define pii pair<ll,ll>

#define debug(a) { cout << #a << " = " << a << endl;}

const int maxn = 1e5+1;
ll arr[maxn], n, m, t, k;

ll __min(ll a, ll b) {
    return a < b ? a : b;
}

ll __max(ll a, ll b) {
    return a > b ? a : b;
}

vector<bool> vis;
vector<vector<ll>> ajd;

ll dfs(ll i) {
    vis[i] =true;
    ll cnt=1;
    for (int w:ajd[i])
        if (!vis[w])
            cnt+=dfs(w);
    return cnt;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    cin>>n>>m;
    ajd.resize(n);
    for (int i=0;i<m;i++) {
        cin>>t>>k;
        --t;--k;
        ajd[t].push_back(k);
        ajd[k].push_back(t);
    }
    ll ans=0;
    vis.resize(n,false);
    for (int i=0;i<n;i++)
        if (!vis[i])
            ans=__max(ans,dfs(i));
    cout << ans << "\n";
}



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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    vector<long long> B(N);
    for(int i = 0; i < N; i++)cin >> A[i];
    long long B0 = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 0)B0 += A[i];
        else B0 -= A[i];
    }
    B[0] = B0;
    for(int i = 1; i < N; i++){
        B[i] = 2 * A[i - 1] - B[i - 1];
    }
    
    for(int i = 0; i < N; i++){
        cout << B[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
    
 
int main (){
  	ll N, M;
    cin>>N>>M;
    ll Min=0;
    ll Max=100000;
    for(ll i=0; i<M; i++){
        ll L, R;
        cin>>L>>R;
        Min=max(Min, L);
        Max=min(Max, R);
    }
    if(Max-Min<0){
        cout<<0<<endl;
    }
    else{
        cout<<Max-Min+1<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>

#define LLMAX (1LL << 63) - 1

using namespace std;
using ll = long long;



int main() {
	ll argA, argB, argC, argX, argY;
	cin >> argA >> argB >> argC >> argX >> argY;

	ll ret = LLMAX;
	for (ll i = 0; i <= max(argX, argY) * 2; i += 2) {
		ll restA = argX - i / 2;
		ll restB = argY - i / 2;

		ll tempCost = max(restA, 0LL) * argA + max(restB, 0LL) * argB + i * argC;
		ret = min(ret, tempCost);
	}

	cout << ret << endl;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b;
    Scd2(a,b);

    if( a%2 == b%2 ) printf ("%d\n", (a+b)/2 );
    else printf ("IMPOSSIBLE\n");

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define ll  long long int
    #define N 100000
    #define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
    #define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
    #define po pop_back
    #define pb push_back
    #define lb lower_bound
    #define fi first
    #define se second
    #define debug(x) cout << #x << " = " << x << endl
    #define ub upper_bound
    #define ibs ios_base::sync_with_stdio(false)
    #define cti cin.tie(0)
    #define all(x) x.begin(),x.end()
    #define PI 3.14159265
    #define cot cout.tie(0)
    using namespace std;
      /**
        * @author :: Sawlani
        *
        */
        string s,t;
        ll dp[3001][3001];

        int main()
        {
            //freopen("input.txt","r",stdin);
            cin >> s >> t;

            ll n=s.length();
            ll m=t.length();

            s=" "+s;
            t=" "+t;
            memset(dp,0,sizeof(dp));
            f(i,1,n)
            {
                f(j,1,m)
                {
                    if(s[i]==t[j])
                    {
                        dp[i][j]=1+dp[i-1][j-1];
                    }
                    else
                    {
                        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                    }

                }
            }

//            f(i,1,n)
//            {
//                f(j,1,m)
//                cout << dp[i][j] << " ";
//                cout << endl;
//            }

         ll i=n,j=m;
         ll len=dp[n][m];
         string ans="";

         if(!dp[n][m])
         {
             cout << ans;
             return 0;
         }
         while(len!=0)
         {
           //  cout <<  i << " " << j << endl;
             if(s[i]==t[j])
                i--,j--,len--,ans+=s[i+1];

             else
             {
                 ll k=max(dp[i-1][j],dp[i][j-1]);
                 if(k==dp[i-1][j])
                    i--;
                 else
                    j--;
             }
          }


        reverse(all(ans));
        cout << ans ;
        }


Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
 
int main () {
	int A, B, C, D;
    cin >> A >> B >> C >> D;
  
    int a = A*B, b = C*D;
    cin >> a >> b;
  
    int ans = max(a,b);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()

{
    int a=0,b=0;
    
    scanf("%d %d\n",&a,&b);
    
    if(a<b)
    {
        printf("a < b\n");
    }else if(a>b)
    {
        printf("a > b\n");
    }else
    {
        printf("a == b\n");
    }
    
    return 0;
}


Measured memory_bytes: 1936
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
const int INF = 1e18;

signed main(){
    string s; cin >> s;
    cout << s.substr(0,3) << endl;
}

Measured memory_bytes: 3592
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  r=I()
  return (r*2)*math.pi

# main()
print(main())


Measured memory_bytes: 10736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ll n,ans=0;
  cin >> n;
  vector<ll> p(n);
  REP(i, n) { cin >> p[i]; }
  REP(i,n-2){
    if((p[i]<p[i+1]&&p[i+1]<p[i+2])||(p[i+2]<p[i+1]&&p[i+1]<p[i]))
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3576
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = Long.parseLong(sc.next());
		long M = Long.parseLong(sc.next());
		long K = Long.parseLong(sc.next());
		List<Long> countA = new ArrayList();
		List<Long> countB = new ArrayList();
		countA.add(0l);
		countB.add(0l);

		for(int i=1;i<=N;i++) {
			long a =Long.parseLong(sc.next());
			countA.add(countA.get(i-1)+a);
		}
		for(int i=1;i<=M;i++) {
			long b = Long.parseLong(sc.next());
			countB.add(countB.get(i-1)+b);
		}

		long countMax = 0;
		int bMax = countB.size()-1;
		for(int i=0;i<=N;i++){
			while(true){
				if(bMax<0)break;
				if(countA.get(i)+countB.get(bMax)<=K){
					countMax = Math.max(i+bMax, countMax);
					break;
				}
				bMax--;
			}
		}
		System.out.println(countMax);
	}
}


Measured memory_bytes: 61780
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 100005;

int main() {
	int n, m;
	cin >> n >> m;
	struct S
	{
		int p, y, idx;
	};
	auto comp = [&](S a, S b) -> bool {
		return a.y < b.y;
	};
	vector<S> v;
	for (int i = 0; i < m; i++) {
		int p, y;
		cin >> p >> y;
		v.push_back({p, y, i});
	}
	sort(v.begin(), v.end(), comp);
	vector<int> id(MAX, 0);
	vector<pair<int, int>> ans(m);
	for (S e : v) {
		id[e.p]++;
		int x = id[e.p];
		ans[e.idx].second = x;
		ans[e.idx].first = e.p;
	}
	for (auto e : ans) {
		printf("%06d%06d\n", e.first, e.second);
	}
	return 0;
}

Measured memory_bytes: 5140
#include <stdio.h>
int main(void){
	long a,b,i=2;
	scanf("%ld%ld",&a,&b);
	if(a%b==0)printf("-1");
	else{
		while((a*i)%b==0){
			i++;
		}
		printf("%ld",a*i);
	}
	return 0;
}

Measured memory_bytes: 128
h,w=gets.split.map(&:to_i)
a=[]
h.times do
  a << gets.chomp.split('')
end
def check(a,h)
  i=0
  h.times do
    if a[i].all?{|x| x=="."} == true
     a.delete_at(i)
    else
      i+=1
    end
  end
  return a
end
a=check(a,h)
a=a.transpose
h=a.count
a=check(a,h)
a=a.transpose
h=a.count
k=0
h.times do
  puts a[k].join
  k+=1
end

Measured memory_bytes: 3836
# -*- coding: utf-8 -*-
S = input()
ans = 'YES'
while len(S) > 0:
  if S[-7:] == 'dreamer':
    S = S[:-7]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  elif S[-5:] == 'dream':
    S = S[:-5]
  elif S[-5:] == 'erase':
    S = S[:-5]
  else:
    ans = 'NO'
    break
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <vector>
#include <map>

using namespace std;

typedef unsigned long long ull;
using boost::multiprecision::cpp_dec_float_50;

pair<ull, ull> update(pair<ull, ull> i, pair<ull, ull> j) {
    if (i.first < j.first) return j;
    else if (i.first > j.first) return i;
    i.second += j.second;
    return i;
}

int main() {
    ios::sync_with_stdio(false);
    ull n, a, b;
    cin >> n >> a >> b;
    vector<ull> v(n + 1);
    for (ull i = 1; i <= n; ++i) cin >> v.at(i);
    vector< vector< pair<ull, ull> > > dp(n + 1, vector< pair<ull, ull> >(n + 1));
    dp.at(0).at(0) = {0, 1};
    for (ull i = 1; i <= n; ++i) {
        for (ull j = 0; j <= n; ++j) {
            dp.at(i).at(j) = update(dp.at(i).at(j), dp.at(i - 1).at(j));
            if (j) dp.at(i).at(j) = update(dp.at(i).at(j), {dp.at(i - 1).at(j - 1).first + v.at(i), dp.at(i - 1).at(j - 1).second});
        }
    }
    cpp_dec_float_50 ma = 0;
    ull mb = 0;
    for (ull i = a; i <= b; ++i) {
        cpp_dec_float_50 ave = dp.at(n).at(i).first / cpp_dec_float_50(i);
        if (abs(ma - ave) < boost::multiprecision::pow(cpp_dec_float_50(10), -15)) mb += dp.at(n).at(i).second;
        else if (ma < ave) ma = ave, mb = dp.at(n).at(i).second;
    }
    cout << fixed << setprecision(15) << ma << '\n' << mb << '\n';
    return 0;
}


Measured memory_bytes: 384
/*
 * atcoder/abc089/b.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
void solve();
int main() { solve(); return 0; }

vector<string> Z { "No", "Yes" };

#include <set>
void solve() {
  string s, t;
  cin >> s >> t;
  int count = 0;
  int n=3;
  loop(i,0,n) count += s[i]==t[i];
  cout << count << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int n, chk[200010], cnt;
ll a[200010], b[200010];
ll amn = 2e9, amx = -1, bmn = 2e9, bmx = -1, ans;
pii x[400010];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%lld%lld", a + i, b + i);
		if(a[i] > b[i]) swap(a[i], b[i]);
		amn = min(amn, a[i]);
		bmn = min(bmn, b[i]);
		amx = max(amx, a[i]);
		bmx = max(bmx, b[i]);
	}
	ans = (amx - amn) * (bmx - bmn);
	for(int i = 1; i <= n; i++){
		x[2 * i - 1] = {a[i], i};
		x[2 * i] = {b[i], i};
	}
	sort(x + 1, x + 2 * n + 1);
    for(int i = 1, j = 1; i <= 2 * n; i++){
		for(; j <= 2 * n; j++){
			if(cnt == n) break;
			chk[x[j].second]++;
			if(chk[x[j].second] == 1) cnt++;
		}
		if(j > 2 * n && cnt < n) break;
		ans = min(ans, (bmx - amn) * (x[j - 1].first - x[i].first));
		chk[x[i].second]--;
		if(chk[x[i].second] == 0) cnt--;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000003;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret*x%mod;
        x = x*x%mod;
        y /= 2;
    }
    return ret;
}

int n;
ll kai[1000010];

void init() {
    kai[0] = 1;
    for (int i = 1; i < 1000010; i++) {
        kai[i] = kai[i-1] * i % mod;
    }
}

int main() {
    init();
    int q; cin >> q;
    rep(i,q) {
        ll x, d, n;
        cin >> x >> d >> n;
        if (d == 0) {
            cout << mod_pow(x, n) << endl;
            continue;
        }
        x = x * mod_pow(d, mod-2) % mod;
        if (x == 0 || x+n-1 >= mod) {
            cout << 0 << endl;
            continue;
        }
        ll ans = kai[x+n-1] * mod_pow(kai[x-1], mod-2) % mod;
        ans = ans * mod_pow(d, n) % mod;
        cout << ans << endl;
    }
}


Measured memory_bytes: 8704
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()


signed main() {
  int N,W;
  std::cin >> N >> W;
  std::vector<std::vector<int> > dp(N+1, std::vector<int>(W+1,-1));
  dp[0][0] = 0;
  rep(i,N) {
    int w,v;
    std::cin >> w >> v;
    rep(j,W) {
      if(dp[i][j]!=-1 && j+w<=W) {
        dp[i+1][j+w] = std::max(dp[i+1][j+w],dp[i][j]+v);
      }
      if(dp[i][j]!=-1) dp[i+1][j] = std::max(dp[i+1][j],dp[i][j]);
    }
  }
  int max = 0;
  rep(i,W+1) max = std::max(max,dp[N][i]);
  print(max);
  return 0;
}

Measured memory_bytes: 80256