akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int x = r.ri();		
		int max = 1;
		for(int b = 2; b<=x; b++) {
			int v = b*b;
			while(v<=x) {
				max = Math.max(max, v);
				v*=b;
			}
		}
		print(max);
	}
	
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


Measured memory_bytes: 22356
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,a[510][510];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

void solve(int l,int r,int id)
{
	if (l==r) return;
	int mid=(l+r)>>1;
	rep(i,l,mid) rep(j,mid+1,r) a[i][j]=id;
	solve(l,mid,id+1);solve(mid+1,r,id+1);
}

int main()
{
	n=read();
	solve(1,n,1);
	rep(i,1,n) 
	{
		rep(j,i+1,n) printf("%d ",a[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1536
/*input
3200
pink
*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define is_empty(v) v.empty()
#define vs			vector< string >
#define vvi			vector< vector< ll,ll > >
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define inf         1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define reprr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sum(v)      accumulate(v.begin(),v.end(),(ll)0)
//map <long long int,long long int> ma;
//set <long long int, greater <long long int> > s;


int solve()
{
	ll n;string s;cin>>n>>s;
	if(n<3200) cout<<"red\n";
	else cout<<s<<"\n";
}

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

	ll t=1;
	//cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b){
	long long int *A=(long long int *)a;
	long long int *B=(long long int *)b;
	if(*A>*B){
		return -1;
	}
	return 1;
}
int main(){
	long long int N;
	long long int a[300000];
	scanf("%lld",&N);
	int i;
	for(i=0;i<3*N;i++){
		scanf("%lld",&a[i]);
	}
	qsort(a,3*N,sizeof(long long int),comp);
	long long int ans;
	ans=0;
	for(i=1;i<2*N;i=i+2){
		ans=ans+a[i];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<bool> ok(1000001, true);
  unordered_set<int> st;
  for (int i = 0; i < n; i++) {
    if (ok[a[i]]) st.insert(a[i]);
    if (!ok[a[i]] && st.count(a[i])) st.erase(a[i]);
    if (!ok[a[i]]) continue;
    for (int j = a[i]; j <= 1000000; j += a[i]) {
      ok[j] = false;
    }
  }
  cout << st.size() << endl;
  return 0;
} 

Measured memory_bytes: 12272
n, a = map(int, input().split())
x = list(map(int, input().split()))
X = max(max(x), a)
dp = [[[0] * (n * X + 1) for i in range(n + 1)] for j in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
    for j in range(n + 1):
        for s in range(n * X + 1):
            if s < x[i - 1]:
                dp[i][j][s] = dp[i - 1][j][s]
            elif j >= 1 and x[i - 1] <= s:
                dp[i][j][s] = dp[i - 1][j][s] + dp[i - 1][j - 1][s - x[i - 1]]

num = 0
for i in range(1, n + 1):
    num += dp[n][i][i * a]

print(num)

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

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

   cin >> x;
   if(x < 1200) cout << "ABC\n";
   else{
       cout << "ARC\n";
   }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
  int key;
  Node *next;
  Node *prev;
};

Node *nil;

Node* listsearch(int key){
  Node *cur = nil->next;
  while(cur != nil && cur->key != key){
    cur = cur->next;
  }
  return cur;
}

void init(void){
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  Node *cur = nil->next;
  int isf = 0;
  while(1){
    if(cur == nil) break;
    if(isf++ > 0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listsearch(key));
}

void insert(int key){
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key,n,i;
  int size=0;
  int np=0,nd=0;
  char com[20];

  scanf("%d",&n);
  init();
  for(i=0 ; i<n ; i++){
    scanf("%s%d",com,&key);
    if(com[0] == 'i'){
      insert(key);
      np++;
      size++;
    }
    else if(com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      }
      else{
         deleteKey(key);
         nd++;
      }
      size--;
    }
  }
  printList();

  return 0;
}

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

int main(void)
{
    std::string S;

    std::cin >> S;

    std::vector<int> cnt(26);

    int ret = 0;

    if (S.length() == 4)
    {
        // アルファベットの登場回数をカウント
        for (int i = 0; i < S.length(); i++)
        {
            cnt[static_cast<int>(S[i] - 'A')]++;
        }

        // カウント値のリストを降順にソート
        std::sort(cnt.begin(), cnt.end(), std::greater<int>());
        if (cnt[0] == 2 && cnt[1] == 2)
            std::cout << "Yes" << std::endl;
        else
        {
            std::cout << "No" << std::endl;
        }
    }
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}

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

class segtree{
    public:
        int size;
        int node[(1<<18)-1];
        segtree(int n_){
            size=1;
            while (size<n_) size*=2;
            for (int i=0; i<2*size-1; i++) node[i]=INT_MAX;
        }

        void update(int k,int a){
            k+=size-1;
            node[k]=a;
            while (k>0){
                k=(k-1)/2;
                node[k]=min(node[2*k+1],node[2*k+2]);
            }
        }

        int get_min(int queryL,int queryR,int k=0,int nodeL=0,int nodeR=-1){
            if (nodeR==-1) nodeR=size;
            if (nodeR<=queryL or queryR<=nodeL) return INT_MAX;
            if (queryL<=nodeL and nodeR<=queryR) return node[k];
            else{
                int nodeM=(nodeL+nodeR)/2;
                int vl=get_min(queryL,queryR,k*2+1,nodeL,nodeM);
                int vr=get_min(queryL,queryR,k*2+2,nodeM,nodeR);
                return min(vl,vr);
            }
        }
};

int n,q,c,x,y;

int main(){
    cin >> n >> q;
    segtree seg(n);
    for(int i=0; i<q; i++){
        cin >> c >> x >> y;
        if (c==0) seg.update(x,y);
        else cout << seg.get_min(x,y+1) << endl;
    }
    return 0;
}

Measured memory_bytes: 4104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

ve<pair<ll,ll>> vec;
void primefactor(ll n)
{
    ll b=0;
    while (n % 2 == 0)  
    {  
        b++;
        n = n/2;  
    }  
    if(b>0)
        vec.pb({2,b});
    b=0;
    for (ll i = 3; i*i <= n; i = i + 2)  
    {   
        b=0;
        while (n % i == 0)  
        {  
            b++;
            n = n/i;  
        }  
        if(b>0)
            vec.pb({i,b});
    }  
    if (n > 2)  
        vec.pb({n,1});
}

int main() 
{
    FAST;
    ll arr[10000];
    arr[0]=0;
    for(int i=1;i<10000;i++)
        arr[i]=arr[i-1]+i;
    ll n,ans;
    cin>>n;
    ans=0;
    primefactor(n);
    for(int i=0;i<vec.size();i++)
    {
        ll x=vec[i].second,y=ub(arr,arr+10000,x)-arr;
        ans+=y-1;
    }
    cout<<ans;
    subt;
    return 0;
}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int l,r,k;
vi a;

int main(){
	cin>>l>>r>>k;
	for(int i=0;i<k&&l+i<=r;i++) a.push_back(l+i);
	for(int i=0;i<k&&r-i>=l;i++) a.push_back(r-i);
	sort(a.begin(),a.end());
	a.erase(unique(a.begin(),a.end()),a.end());
	for(auto i:a) cout<<i<<endl;
}

Measured memory_bytes: 256
# C - Maximal Value
N = int(input())
B = list(map(int,input().split()))
A = [10**6]*N

A[0] = B[0]
A[1] = B[0]
for i in range(1,N-1):
    if A[i] >= B[i]:
        A[i] = B[i]
        A[i+1] = B[i]
    else:
        A[i+1] = B[i]

print(sum(A))

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

// template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
// template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 998244353
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,K; cin>>N>>K;
    vector<ll> h(N); rep(i,N)cin>>h[i];
    vector<ll> dp(N,INF);
    dp[0] = 0;
    rep(i,N){
        rep1(j,K){
            if(i+j<N)dp[i+j] = min(dp[i+j],dp[i]+(ll)fabs(h[i+j]-h[i]));
        }
    }
    cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 4844
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	ll n,k;cin>>n>>k;
	vector<ll> A,B,big,small;
	rep(i,n){
		ll a;cin>>a;
		A.push_back(a);
		B.push_back(a);
		big.push_back(n);
		small.push_back(n);
	}
	sort(all(B));
	int bi = 0; int ei = 0;
	while(bi < n){
		int count = 0;
		while(ei < n && B[bi] == B[ei]) 
		{
			ei++;
		}
		int n_big = n-ei;
		int n_s = bi;
		while(bi < ei){
			big[bi] = n_big;
			small[bi] = n_s;
			bi++;
		}
	}
	rep(i, big.size()){
		cerr<<big[i]<<" ";
	}
	cerr<<endl;
	rep(i, small.size()){
		cerr<<small[i]<<" ";
	}
	cerr<<endl;
	ll ans = 0;
	rep(i, n){
		ans += k * (k-1) / 2 % MOD * big[i] % MOD;
		ans %= MOD;
		ans += k * (k-1) / 2 % MOD * small[i] % MOD;
		ans %= MOD;
	}
	ans *= mpow(2, MOD-2);
	ans %= MOD;
	cerr<<"chohuk:ans:"<<ans<<endl;

	rep(i,A.size()){
		rep(j,A.size()){
			if(i >= j) continue;
			if(A[i] > A[j]) ans += k;
			ans %= MOD;
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8
a = int(input())
b = list(map(int,input().split()))
s = 0
for i in range(a):
    s +=b[i]
tr = 0
for i in range(a):
    tr += b[i]**2
a2 = s**2-tr
a = a2//2
a %= 10**9+7
print(a)

Measured memory_bytes: 105376
#!/usr/bin/env python
# coding: utf-8


def main():
    k, a, b = list(map(int, input().split()))
    if b - a <= 2 or k - a < 1:
        print(k+1)
        return
    n = (k - a + 1) // 2
    print(1 + k - 2*n + (b - a) * (n))


if __name__ == '__main__':
    main()


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

vector<pair<long long, long long>> primeFact(long long n) {
  vector<pair<long long, long long>> result;
  long long s = floor(sqrt(n));
  for (long long i = 2; i <= s; i++) {
    if (n == 1) break;

    long long r = 0;
    while(n % i == 0) {
      r++;
      n /= i;
    }

    if (r == 0) continue;
    result.push_back({i, r});
  }

  if (n > s) {
    result.push_back({n, 1});
  }
  return result;
}

void solver() {
  long long n;
  cin >> n;

  vector<pair<long long, long long>> primes = primeFact(n);
  long long ans = 0;
  for (int i = 0; i < primes.size(); i++) {
    long long r = primes[i].second;
    long long rSum = 0;
    long long j = 1;
    while(rSum <= r) {
      rSum += j;
      j++;
    }
    ans += j - 2;
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << "NO\n"; return;}
#define yes {cout << "YES\n"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 2e6 + 7, MOD = 1e9 + 7;

int f[N] = { 1 }, rf[N] = { 1 };

int binpow(int x, int d) {
    int ans = 1;
    while (d) {
        if (d & 1)
            ans = ans * x % MOD;
        x = x * x % MOD;
        d >>= 1;
    }
    return ans;
}

int binom(int n, int k) {
    return f[n] * rf[k] % MOD * rf[n - k] % MOD;
}

void solve() {
    loop1(i, N - 1) {
        f[i] = f[i - 1] * i % MOD;
        rf[i] = binpow(f[i], MOD - 2);
    }
    int lef, rig, up, dwn, rev2 = binpow(2, MOD - 2);
    cin >> lef >> dwn >> rig >> up;
    int sum = binom(rig + up, rig), ans = sum;
    int dx = rig - lef + 1, dy = up - dwn + 1;
    loop1(i, dx + dy - 2) {
        if (dx > i)
            sum = (sum + binom(rig + up - i, rig - i)) % MOD;
        else
            sum = (sum - binom(rig + up - i, lef - 1) + MOD) % MOD;
        if (dy > i)
            sum = (sum + binom(rig + up - i, up - i)) % MOD;
        else
            sum = (sum - binom(rig + up - i, dwn - 1) + MOD) % MOD;
        sum = sum * rev2 % MOD;
        ans = (ans + sum) % MOD;
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 34788
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int p[3];
	int j[2];
	for (int k = 0; k < 3; k++){
		int b;
		cin >> b;
		p[k] = b;
	}
	for (int i = 0; i < 2; i++)
	{
		int a;
		cin >> a;
		j[i] = a;
	}

	sort(j, j + 2);
	sort(p, p + 3);
	cout << j[0] + p[0] - 50 << endl;
	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N;
    cin >> N;
    vector<int> X(N), cp;
    rep(i, N) cin >> X[i];
    cp = X;
    sort(cp.begin(), cp.end());
    int pop_before_center = cp[N / 2];
    int pop_after_center = cp[(N / 2) - 1];
    // cout << pop_before_center << " : " << pop_after_center << endl;
    double boader = (pop_before_center + pop_after_center) / 2.0;
    rep(i, N)
    {
        if (X[i] > boader)
        {
            cout << pop_after_center << endl;
        }
        else
        {
            cout << pop_before_center << endl;
        }
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, x); }
template<class T, class U> void init(vector<T> &v, U x, size_t n, size_t m...) { v=vector<T>(n); for(auto& a : v) init(a, x, m);}

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int x;
    cin >> x;
    x = -((x-400)/200) + 8;
    cout << x << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}



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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int a[100010];

int main() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
	}
	sort(a, a + N);
	int ret = 0;
	rep(i, N) {
		int u = (upper_bound(a, a + N, a[i] + 2) - a) - i;
		ret = max(ret, u);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef struct{
  int parent;
  int left,right;
}node;

node tree[30];
int d[30];
int h[30];
int c[30];
int n;

void get_depth(int now,int deep){
  d[now]=deep;

  if(tree[now].left!=-1)
    get_depth(tree[now].left,deep+1);
  if(tree[now].right!=-1)
    get_depth(tree[now].right,deep+1);

  return;
}

int get_height(int now){
  int a=0,b=0;

  if(tree[now].right!=-1)
    a=get_height(tree[now].right)+1;
  if(tree[now].left!=-1)
    b=get_height(tree[now].left)+1;

  return h[now]=max(a,b);
}

int sib(int i){
  if(tree[i].parent==-1)
    return -1;
  
  int p=tree[i].parent;
  if(tree[p].right!=i&&tree[p].right!=-1)
    return tree[p].right;
  if(tree[p].left!=i&&tree[p].left!=-1)
    return tree[p].left;

  return -1;
}

void print(int i){
  printf("node %d: parent = %d, ",i,tree[i].parent);
  printf("sibling = %d, degree = %d, ",sib(i),c[i]);
  printf("depth = %d, height = %d, ",d[i],h[i]);

  if(tree[i].parent==-1)
    printf("root\n");
  else if(tree[i].left!=-1||tree[i].right!=-1)
    printf("internal node\n");
  else
    printf("leaf\n");

  return;
}

  
main()
{

  for(int i=0;i<30;i++){
    tree[i].parent=-1;
  }
  
  int id;
  int left,right;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d %d",&id,&left,&right);

    c[id]=0;
    tree[id].left=left;
    tree[id].right=right;

    if(left!=-1){
      tree[left].parent=id;
      c[id]++;
    }
    if(right!=-1){
      tree[right].parent=id;
      c[id]++;
    }

  }

  int root;
  for(int i=0;i<n;i++){
    if(tree[i].parent==-1)
      root=i;
  }
  get_depth(root,0);
  get_height(root);

  for(int i=0;i<n;i++){
    print(i);
  }

  return (0);
}

Measured memory_bytes: 3208
#include <stdio.h>
#define ll long long

int M;
ll digits;
ll total_sum;

int main()
{
	scanf("%d", &M);
	for (int i = 0; i < M; ++i)
	{
		ll d, c;

		scanf("%lld %lld", &d, &c);
		digits += c;
		total_sum += d * c;
	}

	printf("%lld\n", digits - 1 + (total_sum - 1) / 9LL);

	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)
#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <typename T> bool chmin(T &a, T b) {
    if (a > b) {a = b;return true;}return false;
}

template <typename T> bool chmax(T &a, T b) {
    if (a < b) {a = b;return true;}return false;
}

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int w, h;
ll p[100001], q[100001];
vector < pair<ll, int> > v;

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
    show(MOD);
//    FILE *stream2;
//    stream2 = freopen("out.txt", "w", stdout);
//    if (stream2 == NULL) return 0;
#endif
    cin >> w >> h;
    for (int i = 0; i < w; i++) {
        cin >> p[i];
        v.emplace_back(p[i], 0);
    }
    for (int i = 0; i < h; i++) {
        cin >> q[i];
        v.emplace_back(q[i], 1);
    }
    sort(all(v));
    ll ans = 0L;
    ll width = w + 1L, height = h + 1L;
    for (int i = 0; i < (int)v.size(); i++) {
        if (v[i].se == 0) {
            if (height == 0) continue;
            ans += v[i].fi * height;
            width--;
        } else {
            if (width == 0) continue;
            ans += v[i].fi * width;
            height--;
        }
    }
    cout << ans << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

Measured memory_bytes: 7536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i=0; i < n; i++)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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 ll INF = 1LL << 60;
//cout << fixed << setprecision(10);
//M_PI

int main() {
    string s, t;
    cin >> s >> t;
    ll ans = 0;
    rep(i, s.size()){
        if(s[i] != t[i]) ans++;
    }
    cout << ans <<endl;
}


Measured memory_bytes: 3836
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (n, m) = (it.next().unwrap(), it.next().unwrap());
    if n==m {
	println!("Yes");
    }else {
	println!("No");
    }
}


Measured memory_bytes: 4352
# include <bits/stdc++.h>
using namespace std;
namespace fastio{
	template<typename tn> void read(tn &a){
	    tn x=0,f=1;char c=' ';
	    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
	    a=x*f;
	}
	template<typename tn> void print(tn a){
	    if(a<0) putchar('-'),a=-a;
	    if(a>9) print(a/10);
	    putchar(a%10+'0');
	}
};
using namespace fastio;
int main(){
	string s;
	cin>>s;
	if(s=="ABC") puts("ARC");
	else puts("ABC");
	return 0;
}

Measured memory_bytes: 3624
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map { it.toInt() }
    var cnt = 0
    for (i in 0 until n) {
        if (p[i] != i + 1) {
            cnt++
        }
    }
    if (cnt <= 2) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 37864
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;
bool prime[10000000];



int main() {
  ll s;
  cin >> s;

  const ll v = 1e9;

  ll x = (v - s % v);
  ll xx = x % v;
  ll y = (s + xx) / v;

  if(x < 0) cout << "iji"<<endl;

  cout << "0 0 1000000000 1 "<<xx<<" "<<y<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
//#include <queue>
using namespace std;
#define ll long long
#define ld long double


ll gcd(ll x,ll y)
{
    while(x%y!=0)
    {
        ll t=x%y;
      	if (t<0) t+=y;
        x=y;
        y=t;
    }
    return(y);
}

int main()
{
    //ifstream fi;
    //ofstream fo;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    ll c, d;
    cin >> a >> b >> c >> d;
    ll k=(c*d)/gcd(c,d);
    ll r1=b/c;
    if (a%c==0) r1++;
    r1-=a/c;

    ll r2=b/d;
    if (a%d==0) r2++;
    r2-=a/d;

    ll r3=b/k;
    if (a%k==0) r3++;
    r3-=a/k;

    cout << b-a+1 - (r1+r2-r3);
    return(0);
}


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

void bfs(){
	int cnt = 0;
	queue <string > q;
	for(int i = 1; i <= 9;i++){
		char c = i + '0';
		q.push(string(1,c));
	}
	while(!q.empty()){
		string x = q.front();
		q.pop();
		cnt++;
		if(cnt == n){
			cout << x << endl;
			return ;
		}
		char c = x[x.size() - 1];
		int a[] = {-1,0,1};
		for(int i = 0; i < 3; i++){
			char t = c + a[i];
			if(t >= '0' && t <= '9'){
				string y = x + t;
				q.push(y);
			}
		}
	}
}
int main(){
	scanf("%d",&n);
	bfs();
    return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> A1(N);
    vector<ll> A2(N);
    rep (i, N) {
        cin >> A1[i];
    }
    rep (i, N) {
        cin >> A2[i];
    }

    if (N == 1) {
        cout << A1[0]+A2[0] << endl;
        return 0;
    }

    ll sum = A1[0];
    rep (i, N) {
        sum += A2[i];
    }

    ll ans = 0;
    rep (i, N-1) {
        ans = max(ans, sum);
        sum += (A1[i+1]-A2[i]);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a, b, m = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
ansl = []
for i in range(m):
    x, y, c = map(int, input().split())
    ansl.append(al[x-1] + bl[y-1] - c)
ansl.append(min(al) + min(al))
print(min(ansl))

Measured memory_bytes: 18736
while True:
    H, W = map(int, input().split())
    if H ==0 and W == 0:
        break
    for i in range(H):
        a = ""
        for j in range(W):
            if i == 0 or i == (H-1):
                a += "#"
            elif j == 0 or j == (W-1):
                a += "#"
            else:
                a += "." 
        print(a)
    print("")

Measured memory_bytes: 7632
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
typedef long long ll;
const ll mod = 1e9 + 7;
const ll N = 3e5 + 7;



int main() {
	fastIO;
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> v;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		v.push_back({ x, y });
	}

	for (int i = 0; i < 1000; i++) {
		string s = to_string(i);
		bool valid = (int)s.size() == n;
		for (auto j : v) {
			if (s[j.first - 1] != j.second + '0')
				valid = false;
		}
		if (valid) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
}

Measured memory_bytes: 3684
let kKMax = 3000
let x, y, z, k = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let a_s = Array.init x @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let bs = Array.init y @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let cs = Array.init z @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ab_s = Array.make (x * y) 0
let ans = Array.make (kKMax * z) 0
let _ =
  for i = 0 to x - 1 do
    for j = 0 to y - 1 do
      ab_s.(i * y + j) <- a_s.(i) + bs.(j) done done;
  Array.sort (fun x y -> y - x) ab_s;
  for i = 0 to min (x * y - 1) @@ kKMax - 1 do
    for j = 0 to z - 1 do
      ans.(i * z + j) <- ab_s.(i) + cs.(j) done done;
  Array.sort (fun x y -> y - x) ans;
  for i = 0 to k - 1 do
    Printf.printf "%d\n" ans.(i) done

Measured memory_bytes: 38652
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


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

vi g[MX];
int d[MX];
int pr[MX];
void dfs(int v, int p) {
	if (v == p)
		d[v] = 0;
	else
		d[v] = d[p] + 1;
	fx(to, g[v]) {
		if (to != p) {
			if (v == p)
				pr[to] = to;
			else
				pr[to] = pr[v];
			dfs(to, v);
		}
	}		 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	
   	int n, k;
   	cin >> n >> k;
   	fi(0, n - 1) {
   		int a, b;
   		cin >> a >> b;
   		--a;
   		--b;
   		g[a].pb(b);
   		g[b].pb(a);
   	}  	
   	int ans = n;
   	fi(0, n) {
   		dfs(i, i);
   		int cur = 0;
   		map<int, int> cnt;
   		fj(0, n) {
   			if (k % 2) {
   				cur += d[j] * 2 - 1 > k;
   				if (d[j] * 2 - 1 == k) {
   					cnt[pr[j]]++;
   				}
   			} else {
   				cur += d[j] * 2 > k;
   			}
   		}
   		vi kek;
   		fx(x, cnt)
   			kek.pb(x.second);
   		sort(all(kek));
   		fi(0, siz(kek) - 1)
   			cur += kek[i];
   		mine(ans, cur);
   	}
   	cout << ans << '\n';
}

Measured memory_bytes: 8500
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>N) {
		double ans=M_PI*2*N;
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3264
fn main() {
    proconio::input! {
        n: usize,
        a_s: [i64; n],
    }
    let mut same_count = std::collections::BTreeMap::<i64, usize>::new();
    for &a in &a_s {
        *same_count.entry(a).or_default() += 1;
    }
    let mut v = (0..=1_000_000).collect::<Vec<_>>();
    let mut count = 0usize;
    for (key, value) in same_count {
        let tmp = v[key as usize];
        if tmp == 0 {
            continue;
        }
        for i in (key as usize..v.len()).step_by(tmp).skip(1) {
            v[i] = 0;
        }
        if value == 1 {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 18712
N, M = map(int, input().split())
xyz = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for bit in range(1 << 3):
    scores = [0] * N
    for i in range(N):
        for j in range(3):
            scores[i] += xyz[i][j] * (-1)**((bit >> j) & 1)
    scores.sort(reverse=True)
    ans = max(ans, sum(scores[:M]))
print(ans)


Measured memory_bytes: 42352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int H, W; cin >> H >> W;
    int N; cin >> N;
    int a[N];
    rep(i, N) cin >> a[i];
    int k = 0;
    vector<vector<string>> ans(H);
    for(int j = 0; j < H; ++j) {
        if(j % 2 == 0) {
            rep(i, W) {
                ans[j].pb(to_string(k + 1));
                --a[k];
                if(a[k] == 0)++k;
            }
        }else {
            rnr(i, W - 1, 0) {
                ans[j].pb(to_string(k + 1));
                --a[k];
                if(a[k] == 0)++k;
            }
            reverse(all(ans[j]));
        }
    }
    rep(i, H) {
        rep(j, W) {
            cout << ans[i][j] << ' ';
        }
        cout << endl;
    }
}


Measured memory_bytes: 896
using System;

	class Program
    {
        static void Main(string[] args)
        {
			string[] input = Console.ReadLine().Split();
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			bool calculatable = !(a < 1 || a > 9 || b < 1 || b > 9);
			Console.WriteLine(calculatable ? a * b : -1);
        }
    }


Measured memory_bytes: 11092
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
ll N, ans;

int check_753(ll a) {
	bool cnt3=false, cnt5=false, cnt7=false;
	ll b[100];ll  cnt = 0;
	
	while (a >= 0) {
		b[cnt] = a % 4;
		if (b[cnt] == 0)return 1;
		cnt++;
		a /= 4;
		if (a == 0)break;
	}cnt--;
	ll cur = 0;
	while (cnt >= 0) {
		int u = 0;
		if (b[cnt] == 1) { u = 3; cnt3=true; }
		else if (b[cnt] == 2) { u = 5; cnt5=true; }
		else if (b[cnt] == 3) {u = 7; cnt7=true;}
		
		cur = 10 * cur + u;
		cnt--;
	}
	if (cur > N)return 0;
	else if(cnt3==false||cnt5==false||cnt7==false)return 1;
	else return 2;
}
int main(void) {
	
	cin >> N;
	ll num = 10;
	while (1) {
		ll o = check_753(num);
		if (o == 0)break;
		if (o == 2)ans++;
		num++;
	}
	ct(ans);
	
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A_dict = {i: [] for i in range(1, N + 1)}

sunuke_have_not_okashi = 0

okashi = 0
for _ in range(K):
    okashi += 1
    d = input()
    A = map(int, input().split())
    for a in A:
        A_dict[a].append(okashi)


for i in sorted(A_dict.items(), key=lambda x: len(x[1])):
    if i[1]:
        break
    sunuke_have_not_okashi += 1

print(sunuke_have_not_okashi)


Measured memory_bytes: 9136
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int h, w;
        h = input.nextInt();
        w = input.nextInt();
        while (input.hasNextInt()) {                        
            for (int i = 0; i < h; ++i) {
                for (int k = 0; k < w; ++k) {
                    System.out.print("#");
                }
                System.out.println("");
            }
            h = input.nextInt();
            w = input.nextInt();
            System.out.println("");            
        }
    }   
}

Measured memory_bytes: 24016
N = int( input())
S = input()
Q = 10**9+7
A = [1]*26
ANS = [0]*26
for i in range(N):
    s = ord(S[i]) - ord("a")
    ans = 1
    for j in range(26):
        if j != s:
            ans *= A[j]
            ans %= Q
    ANS[j] = (ANS[j] + ans)%Q
    A[s] += 1
print( sum(ANS))


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

int main() {
   int n, x;
   cin >> n;
   x = (ceil)(n / 1.08);
   if (n == (floor)(1.08 * x)) cout << x << endl;
   else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{ int n,m;
 cin>>n>>m;
 for(int i=0;i<=1250;i++)
 {if(floor(i*0.08)==n && floor(i*0.1)==m)
 {
 cout<<i;
 goto end;
 }
 }
 cout<<-1;
 end:;
 return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

const int Maxn = 60;
const int INF = (int)1e9;
char f[Maxn][Maxn];
int d[Maxn][Maxn];

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
     */
    int h, w, black = 0;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> f[i][j];
            if (f[i][j] == '#') black++;
        }
    }
    for (int i = 0; i < h; ++i) {
        fill(d[i], d[i] + w, INF);
    }

    queue<P> que;
    d[0][0] = 0;
    que.push(P(0, 0));
    while(!que.empty()){
        P p = que.front();
        que.pop();
        for (int i = 0; i < 4; ++i) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (0 <= nx && nx < h && 0 <= ny && ny < w && d[nx][ny] == INF && f[nx][ny] != '#'){
                d[nx][ny] = d[p.first][p.second] + 1;
                que.push(P(nx, ny));
            }
        }
    }
    
    if (d[h - 1][w - 1] == INF) cout << -1 << endl;
    else cout << h * w - d[h - 1][w - 1] - 1 - black << endl;
}


Measured memory_bytes: 256