akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n, k;
	long long ans;
	cin >> n >> k;
	ans = 1LL * (n / k) * (n / k) * (n / k);
	if (k % 2 == 0) ans += 1LL * ((n + k / 2) / k) * ((n + k / 2) / k) * ((n + k / 2) / k);
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Array.Sort(line);
            Array.Reverse(line);
            int A = line[0];
            int B = line[1];
            int C = line[2];
            Console.WriteLine(10 * A + B + C);
        }
    }
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main(){

	int N;
	cin >> N;
	vec(A);
	set<int> all;
	map<int, int> K;
	fx(N) {
		vecp(A);
		all.insert(A[x]);
		K[A[x]]++;
	}

	if (N==3) {
		if ((A[0]^A[2])==A[1]&&( A[1] ^ A[2]) == A[0]&& (A[1] ^ A[0])== A[2]) {
			cey;
		}
		else {
			cen;
		}
	}
	else {
		if (N%3==0) {
			if (all.size()>3) {
				cen;
			}
			else if (all.size()==3) {
				vec(B);
				for (int b : all) {
					pb(B, b);
				}
				int b[3] = {K[B[0]],K[B[1]] ,K[B[2]] };
				if (b[0]==b[1]&&b[1]==b[2]) {
					if ((B[0]^B[1])==B[2]&& (B[0] ^ B[2]) == B[1]&& (B[2] ^ B[1] )== B[0]) {
						cey;
					}
					else {
						cen;
					}
				}
				else {
					cen;
				}
			}
			else if (all.size()==2) {
				vec(B);
				for (int b : all) {
					pb(B, b);
				}
				int b[2] = { K[B[0]],K[B[1]]  };
				if (b[0] == b[1]*2 || b[1] == b[0]*2) {
					if (B[0] ==0||B[1]==0) {
						cey;
					}
					else {
						cen;
					}
				}
				else {
					cen;
				}
			}
			else {
				if (A[0]==0) {
					cey;
				}
				else {
					cen;
				}
			}


		}
		else {
			if (all.size() == 1 && A[0] == 0) {
				cey;
			}
			else {
				cen;
			}
		}
	}


    return 0;
}



Measured memory_bytes: 7800
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

struct UF{
  vector<int> parent, size_;
  UF(int n){
    rep(i, n){
      parent.push_back(i);
      size_.push_back(1);
    }
  }
  int root(int x){
    if(parent[x] == x) return x;
    return parent[x] = root(parent[x]);
  }
  void unite(int x, int y){
    if(root(x) == root(y)) return;
    else if(root(x) > root(y)){
      size_[root(y)] += size_[root(x)];
      parent[root(x)] = root(y);
      return;
    }
    else{
      size_[root(x)] += size_[root(y)];      
      parent[root(y)] = root(x);
      return;
    }
  }
  bool same(int x, int y){
    return root(x) == root(y);
  }
  int size(int x){
    return size_[root(x)];
  }
};

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  UF uf(n);
  rep(i, m){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    uf.unite(a-1, b-1);
  }
  unordered_set<int> s;
  rep(i, n) s.insert(uf.root(i));
  printf("%d\n", s.size());
  return 0;
}

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

int main() {
	long n,i;
	cin >> n;
	
	string s;
	vector<int> ans(4,0);
	for(i=0; i<n; i++){
		cin >> s;
		if(s=="AC"){
			ans[0]++;
		}else if(s=="WA"){
			ans[1]++;
		}else if(s=="TLE"){
			ans[2]++;
		}else{
			ans[3]++;
		}
	}
	cout << "AC x " << ans[0] << endl;
	cout << "WA x " << ans[1] << endl;
	cout << "TLE x " << ans[2] << endl;
	cout << "RE x " << ans[3] << endl;
	return 0;
}

Measured memory_bytes: 3600
MOD=10**9+7
N,K=gets.split.map(&:to_i)
A=gets.split.map(&:to_i)
AA=A+A

cnt1, cnt2 = 0, 0
(0..N-2).each do |i|
    (i+1..N-1).each do |j|
        cnt1 = (cnt1 + 1) % MOD if A[i] > A[j]
    end
end

(0..2*N-2).each do |i|
    (i+1..2*N-1).each do |j|
        cnt2 = (cnt2 + 1) % MOD if AA[i] > AA[j]
    end
end
cnt2 -= cnt1 * 2

x = (K*cnt1) % MOD
y = (cnt2*((K-1)*K)/2) % MOD
puts (x + y) % MOD


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 998244353LL
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef pair<int, int> pi ;
typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define maxn 100005

/*
     *os.find_by_order(k) -> returns the k'th smallest element (indexing starts from 0)
      os.order_of_key(v)  -> returns how many elements are strictly smaller than v
*/

int d[maxn] , a[maxn] ;

int main()
{
    int n ;

    scanf("%d",&n) ;

    for(int i=1 ; i<=n ; i++)
    {
        scanf("%d",&a[i]) ;
        d[ a[i] ]++ ;
    }

    if( a[1]!=0 || d[ 0 ]!=1 )
    {
        printf("0\n") ;
        return 0 ;
    }

    int ans = 1 ;

    for(int i=1 ; i<n ; i++)
    {
        for(int j=1 ; j<=d[i] ; j++) ans = (1LL*ans*d[i-1])%mod ;
    }

    printf("%d\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 1024
// 154 C

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long long int n;
    cin >> n;
    vector<long long int> v;
    int tmp;
    for(int i=0; i<n; i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    for(int i=0; i<n-1; i++){
        if(v.at(i) == v.at(i+1)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
/*第三个方法是自己写一个比较函数来实现升序或降序排列，并让这个比较函数做sort()函数的第三个参数；其实比较函数不仅能实现升序降序排列，还能实现其他的功能。

    这就是sort()函数功能强大的地方，它可以扩展，而扩展的关键就是第三个参数，所以我把这种方法放在最后讲。

    先说一下比较函数吧，当你想实现特定比较方式的时候，就要自己定义一个返回bool值的比较函数了；这时sort()函数的第三个参数就是一个函数，如果它返回假值就交换

    操作对象的位置，返回真值的话操作对象位置不变。下面就用比较函数来实现升序降序的排列，看代码*/
class Pair
{
public:
	Pair(int xx,int yy):x(xx),y(yy){}
	Pair(){}
	bool operator < (const Pair a)
	{
		if (this->x < a.x)return true;
		else if (this->x > a.x)return false;
		else
		{
			if (this->y < a.y)return true;
			else if (this->y > a.y)return false;
			else return false;
		}
	}
	void myprint()
	{
		cout << this->x << " " << this->y << endl;
	}
private:
	int x;
	int y;

};
int main()
{
	int n;
	cin >> n;
	vector<Pair>p;
	for(int i=0;i<n;i++)
	{
		int x, y;
		cin >> x >> y;
		Pair temp(x, y);
		p.push_back(temp);
	}
	sort(p.begin(), p.end());
	vector<Pair>::iterator pp = p.begin();
	while (pp != p.end())
		(*pp++).myprint();



}


Measured memory_bytes: 3872
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()

	var anslist []int = []int{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0}
	if n <= 20 {
		for i := 1; i <= n; i++ {
			fmt.Println(anslist[i-1])
		}
		return
	}

	ans := 0
	for i := 1; i <= n; i++ {
		if i <= 20 {
			fmt.Println(anslist[i-1])
			continue
		}

		// xとyでloop回す
		ans = 0
		for x := 1; x <= 100; x++ {
			for y := 1; y <= 100; y++ {
				hy := x*x + y*y
				if hy > i {
					break
				}
				// 2次方程式 zz+bz+c=0
				b := x + y
				c := hy + x*y - i

				h := b*b - 4*c
				if h < 0 {
					continue // 解がない
				}

				bs := math.Sqrt(float64(h))
				if !isInteger(bs) {
					continue // 整数解がない
				}

				kai := (bs - float64(b)) / 2.0
				if kai >= 1.0 && isInteger(kai) {
					ans++
				}
			}

		}

		fmt.Println(ans)
	}

}
func isInteger(x float64) bool {
	return math.Floor(x) == x
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1860
#include <iostream>
using namespace std;
int main()
{
    int k,s,x,y,z;
    cin>>k>>s;
    int c=0;
    for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
    	z=s-x-y; 
    	if(s==(x+y+z))
    if(z>=0&&z<=k)
    c+=1;
    }}
    cout<<c;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] S = new string[N];
        int[] P = new int[N]; 
for (int i = 0; i < N; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            S[i] = input[0];
            P[i] = int.Parse(input[1]);

        }

        List<Tuple<string, int, int>> list = new List<Tuple<string, int, int>>();
        for (int j = 0; j < N; j++)
        {
            list.Add(new Tuple<string, int, int>(S[j], P[j], j));
        }

        list.Sort((a, b) => (a.Item1 != b.Item1) ? (a.Item1.CompareTo(b.Item1)) : (b.Item2 - a.Item2)
        );

        foreach (var x in list)
        {
            Console.WriteLine(x.Item3+1);
        }

    }
}



Measured memory_bytes: 11484
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), w = sc.nextInt();
        long[] ws = new long[n];
        int[] vs = new int[n];

        for (int i = 0; i < n; i++) {
            ws[i] = sc.nextInt();
            vs[i] = sc.nextInt();
        }
        System.out.println(maxKnapsack2(ws, vs, w));
    }


    private static long maxKnapsack2(long[] ws, int[] vs, int w) {
        int totVal = 0;
        for(int v : vs) totVal += v;
        long[] dp = new long[totVal + 1];

        Arrays.fill(dp, w+1);
        dp[0] = 0;
        for (int i = 0; i < ws.length; i++) {
            for (int s = totVal; s >= 0; s--) {
                if(s >= vs[i])
                    dp[s] = Math.min(dp[s - vs[i]] + ws[i], dp[s]);
            }
        }

        long res = 0;
        for(int i= 0;i <= totVal;i ++){
            if(dp[i] <= w){
                res = Math.max(res, i);
            }
        }
        return res;
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main() {
  int n;
  cin>>n;
  deque<int>q;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(i%2==0){
      q.push_back(a);
    }else{
      q.push_front(a);
    }
  }
  if(n%2==1)reverse(q.begin(),q.end());
  for(int i=0;i<n;i++){
    if(i==n-1)cout<<q[i]<<endl;
    else cout<<q[i]<<" ";
  }
  return 0;
}


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

int main() {
int n;
cin>>n;
int sum=0;
int a[n-1];
for(auto i=0;i<n-1;i++){
  cin>>a[i];
}
sum+=a[0];
 for (int i=1;i<n-1;i++){
    if(a[i]>a[i-1])
    {int temp=min(a[i],a[i-1]);
      sum+=temp;
    }
    else{
        sum+=a[i];
    }
 }
 sum+=a[n-2];
 cout<<sum<<"\n";


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

string s[100];
int dy[4]={-1,0,0,1};
int dx[4]={0,-1,1,0};

signed main()
{
    int H,W; cin>>H>>W;
    REP(i,H) cin>>s[i];

    REP(i,H) REP(j,W){
        if(s[i][j]=='.') continue;
        bool ok=false;
        REP(k,4){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0 or H<=y or x<0 or W<=x) continue;
            if(s[y][x]=='#') ok=true;
        }
        if(!ok){
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout<<"Yes"<<endl;

}


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

ll gcd(ll a, ll b){
	ll c;
	while(a%b!=0){
		c = b;
		b = a%b;
		a = c;
	}
	return b;
}

int main(void){
	ll N,M;
	cin >> N >> M;
	ll s = M/N;
	ll ans = 1;
	for(ll i=1;i*i<=M;i++){
		if(M%i==0){
			ll o = M/i;
			if( M>=N*i)ans = max(ans,i);
			if( M>=N*o)ans = max(ans,o);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

s = list(input())

n = len(s)
finalList = [0] * n
i = 1
odd = 1
even = 0
flag = 'R'
oddFlag = True
border = 0
while i < n:
    if flag == 'R':
        if s[i] == 'R':
            tmp = odd
            odd = even + 1
            even = tmp
        else:
            border = i
            flag = 'L'
            finalList[i-1] += odd
            finalList[i] += even
            odd = 1
            even = 0
            oddFlag = False
    else:
        if s[i] =='L':
            if oddFlag == True:
                odd += 1
                oddFlag = False
            else:
                even += 1
                oddFlag = True
        else:
            finalList[border -1] += even
            finalList[border] += odd
            flag = 'R'
            odd = 1
            even = 0
    i += 1

finalList[border -1] += even
finalList[border] += odd

print(' '.join(map(str, finalList)))


Measured memory_bytes: 54924
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <tuple>

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

void solve(){
  double n,k;
  cin >> n >> k;
  double sum = 0.0;
  for(double i=1.0; i<=n; i++){
    if(i<k){
      double j=0.0;
      while((k/i) > pow(2,j)){
         j += 1;
      }
      sum += 1/n * 1/pow(2,j);
      //cout << sum << " yeah" << endl;
    }
    else sum += 1/n;
  }
  printf("%.12f\n",sum);
}

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


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(ll (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

/*
 * 同じ深さにある2頂点に同時に玉を置くとそれらはどこかで出会う
 * 頂点を根からの深さごとに分類し、各深さdについてtree dp
 * dp[i][j]: 頂点iを根とする部分木に着目したとき、頂点iにj(0or1)個の玉が置かれるような頂点0からの距離がdの頂点への玉の配置の数
 * を求めると答えは Σ dp[0][1]*2^(n-s[d]) (1<=d<=n) (s[d]:深さdにある頂点の数) O(n^2)で部分点
 * このdpには無駄な遷移が含まれる 例えばある頂点に玉が複数個来るためには子が2つ以上ある必要があるが⇡は1つの場合でも毎回計算している
 * 深さdについてdequeを使って管理し、サイズが小さい方を大きい方にマージするやり方でO(n)
 */

typedef deque<pair<pll,ll>> dq;
ll n, p, ans;
vi e[200200];

void rec(int v, dq &d) {
	dq m;
	each(i,e[v]) rec(i,m);
	if (e[v].size()>=2) {
		each(i,m) {
			(i.fi.fi += i.se) %= mod;
			i.se = 0;
		}
	}
	m.push_front({{1,1},0});
	if (d.size()<m.size()) d.swap(m);
	auto j = d.begin();
	each(i,m) {
		j->se = (j->se + j->fi.fi + j->fi.se) * (i.se + i.fi.fi + i.fi.se) %mod;
		j->fi.se = ((j->fi.se * i.fi.fi) + (j->fi.fi * i.fi.se)) %mod;
		j->fi.fi = (j->fi.fi * i.fi.fi) %mod;
		j->se = (j->se + mod - j->fi.fi + mod - j->fi.se) %mod;
		j++;
	}
}

signed main() {
	cin >> n;
	repst(i,1,n) {
		cin >> p;
		e[p].pb(i);
	}
	dq nw;
	rec(0,nw);
	ll t = 1;
	each(i,nw) {
		ans = (ans * (i.fi.fi + i.fi.se) + t * i.fi.se) %mod;
		t = t * (i.fi.fi + i.fi.se) %mod;
	}
	cout << ans << ln;
}

Measured memory_bytes: 164352
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] max = new int[N];
		
		for(int i = 0; i < N; i++) {
			int A = sc.nextInt();
			int count = 0;
			while(A % 2 == 0) {
				count++;
				A /= 2;
			}
			max[i] = count;
		}
		Arrays.sort(max);
		System.out.println(max[0]);
	}
}


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

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

int main() {
    int a, b;
    cin >> a >> b;
    int ans = max(0, a - 2 * b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
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(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...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    ll n;
    cin>>n;
    vi a(n);
    map<ll,ll>mp;
    ll sum = 0;
    rep(i,0,n)
    {
        cin>>a[i];
        mp[a[i]]++;
        sum += a[i];
    }
    ll q;
    cin>>q;
    rep(i,0,q)
    {
        ll b,c;
        cin>>b>>c;
        sum -= mp[b]*b;
        mp[c] += mp[b];
        sum += mp[b]*c;
        mp[b] = 0;
        cout<<sum<<endl;
    }
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(2 * M);
  vector<int> count(N);
  for (int i = 0; i < 2 * M; i++){
    cin >> vec.at(i);
    for(int j = N * i + 1; j < N * (i + 1) + 1; j++){
      if (vec.at(i) == j - N * i){
        count.at(j - N * i - 1)++;
      }
    }
  }
  for (int k = 0; k < N; k++){
    cout << count.at(k) << endl;
  }
}

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

using namespace std;

int main(){
    long i;
    long n;
    int s = 0;
    int e = 0;
    cin >> n;
    i = n;
    s = s + i %10;
    do{
        i = i - i % 10;
        i = i / 10;
        s = s + i %10;
    }while(i/10 >=1);
    while(n/10 >=1){
        e = e + 1;
        n = n - n % 10;
        n = n / 10;
    }
    if(9*e+n-1 > s) s = 9*e+n-1;
    cout << s;
    return 0;
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()
a= []
for i in range(len(x)):
    a.append(int(x[i]))

if (a[0]*100+a[1]*10+a[2])%4:print("NO")
else:print("YES")

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

double n, m, a, total = 0;
double nums[100];
double minM;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        nums[i] = a;
        total += a;
    }

    minM = total / (4 * m);
    total = 0;

    for (int i = 0; i < n; i++)
    {
        if (nums[i] >= minM)
        {
            total++;
        }
    }

    cout << (total >= m ? "Yes" : "No");
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, X):

    ans = sys.maxsize
    for i in range(N-K+1):
        c = 0
        if X[i] <= 0 and X[i+K-1] <= 0:
            c += -X[i]
        elif X[i] <= 0 and X[i+K-1] > 0:
            c += -2*X[i] + X[i+K-1]
        else:
            c += X[i+K-1]

        # print(c)
        ans = min(ans, c)

    X = [-x for x in reversed(X)]
    for i in range(N-K+1):
        c = 0
        if X[i] <= 0 and X[i+K-1] <= 0:
            c += -X[i]
        elif X[i] <= 0 and X[i+K-1] > 0:
            c += -2*X[i] + X[i+K-1]
        else:
            c += X[i+K-1]

        # print(c)
        ans = min(ans, c)
    return ans


def main():
    N, K = read_int_n()
    X = read_int_n()
    print(slv(N, K, X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16676
#include <algorithm>
#include <cstdio>

#define int long long
#define macrocat_impl(a, b) a##b
#define macrocat(a, b) macrocat_impl(a, b)
#define dotimes_impl(i, n, x) for (int i = 0, x = n; i < x; i++)
#define dotimes(i, n) dotimes_impl(i, (n), macrocat(dotimes_n_, __COUNTER__))

using namespace std;

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

signed main() {
  // existence: exists <=> Floyd-Warshall makes no update
  // edge elimination: can eliminate if there are detours
  int N = rint();
  int A[N][N];
  int r = 0;
  dotimes(i, N)
    dotimes(j, N) {
      r += A[i][j] = rint();
    }
  dotimes(i, N)
    dotimes(j, N)
      dotimes(k, N)
        if (i != k && j != k) {
          int d = A[i][k] + A[k][j];
          if (d < A[i][j]) {
            wint(-1);
            return 0;
          }
          if (d == A[i][j]) {
            r -= A[i][j];
            break;
          }
        }
  wint(r / 2);
  return 0;
}


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

int n;

int ans;

int main(void){
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    ans += a;
  }

  printf("%d\n", ans - n);

  return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int need[10] = {100000,2,5,5,4,5,6,3,7,6};

int main(){
    int n,m,ans=0;
    cin>>n>>m;
    vector<int> a(m), amarils(m);
    for(int i = 0; i < m; i++)
    {
        cin>>a[i];

    }
    sort(all(a));

    string dp[10010];
    for(int i = 0; i < 10010; i++)
    {
        dp[i]="~";
    }
    dp[0]="";
    for(int used = 0; used < n; used++)
    {
        if(dp[used]=="~") continue;
        for(int num = 0; num < m; num++)
        {
            string nextstr = to_string(a[num]) + dp[used];
            int nextuse = need[a[num]];
            if(dp[used+nextuse]=="~" || 
            dp[used+nextuse].length() < nextstr.length() ||
            dp[used+nextuse] < nextstr)
            {
                dp[used+nextuse] = nextstr;
            }
        }
        
    }
    

    cout<<dp[n]<<endl;
    return 0;
}

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

int recurse(const int N, int *E, vector<int> o, int nn) {
    if (o.size() == N) return 1;

    int ret = 0;
    REP(i, N) {
        if (E[nn * N + i] == 1) {
            if (find(o.begin(), o.end(), i) != o.end()) continue;
            auto no = o; no.push_back(i);
            ret += recurse(N, E, no, i);
        }
    }

    return ret;


}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;
    int E[N * N];
    REP(i, N * N) E[i] = 0;

    int a, b;
    REP(i, M) {
        cin >> a >> b;
        --a; --b;
        E[a * N + b] = 1;
        E[b * N + a] = 1;
    }

    cout << recurse(N, E, {0}, 0) << endl;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define lli long long int
int main() {
	lli n,d,ans=0,x,y;
	cin>>n>>d;
	while(n--){
		cin>>x>>y;
		ans += (x*x + y*y <= d*d ? 1 : 0);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3148
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define DEBUG 1
#define LEN 3001
#define NINF -1
#define PINF 1E9+1

char s[LEN],t[LEN];
short *dp; // x:s y:t

int pos(int i,int j)
{
	return (strlen(s)+1)*j+i;
}

void chMax(short *a,short b)
{
	if (*a<b) *a = b;
	return;
}

int main(void)
{
	int i,j;
	int x,y;
	char ans[LEN],sub[LEN];
	scanf("%s",s);
	scanf("%s",t);
	x = strlen(s);
	y = strlen(t);

	dp = (short *)malloc(sizeof(short) * (x+1) * (y+1));
	if (dp==NULL) {
		perror("malloc");
		exit(1);
	}
	for (i=0;i<=x;i++) dp[pos(i,0)] = 0;
	for (j=0;j<=y;j++) dp[pos(0,j)] = 0;

	for (i=1;i<=x;i++) {
		for (j=1;j<=y;j++) {
			if (s[i-1] == t[j-1]) chMax(&dp[pos(i,j)] , dp[pos(i-1,j-1)]+1);
			chMax(&dp[pos(i,j)] , dp[pos(i-1,j)]);
			chMax(&dp[pos(i,j)] , dp[pos(i,j-1)]);
			
		}
	}

	ans[0] = '\0';
	i=x; j=y;
	while (1) {
		if (i-1>=0 && dp[pos(i,j)] == dp[pos(i-1,j)]) {
			i--;
		} else if (j-1>=0 && dp[pos(i,j)] == dp[pos(i,j-1)]) {
			j--;
		} else if (i-1>=0 && j-1>=0 && dp[pos(i,j)] == (dp[pos(i-1,j-1)]+1)) {
			i--; j--;
			snprintf(sub, LEN, "%c%s", s[i], ans);
			snprintf(ans, LEN, "%s", sub);
		} else {
			break;
		}
	}

	printf("%s\n",ans);
	free(dp);
	return 0;
}


Measured memory_bytes: 17792
#include<iostream>
using namespace std;
int main(){
    int n, x;
    while(true){
        cin >> n >> x;
        int count = 0;
        if (n != 0 || x != 0){
            for(int i = 1; i <= n - 2; i++){
                for(int j = i + 1; j <= n -1; j++){
                    for(int k = j + 1; k <= n; k++){
                        if(i + j + k == x){
                            count++;
                        }
                    }
                }
            }
            cout << count << endl;
        } else {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3076
import heapq
from operator import itemgetter

def main():
    N, M = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    AB.sort(key = itemgetter(0))
    heap = []
    ans = 0
    cnt = 0
    for i in range(1,M + 1):
        while cnt < N and AB[cnt][0] <= i:
            heapq.heappush(heap,-1*AB[cnt][1])
            cnt += 1
        if len(heap) > 0:
            ans += heapq.heappop(heap)*-1
    print(ans)
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 31988
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int MOD=1e9+7;

int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

int L[222222];
int R[222222];
int pref[222222];
int suf[222222];
int dp[222222];
int S[222222];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vector<ii> vec;
	for(int i=0;i<n;i++)
	{
		int x,v; cin>>x>>v; vec.pb(mp(x,v));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<n;i++)
	{
		pref[i]=vec[i].se;
		if(i>0) pref[i]=max(pref[i],pref[i-1]);
	}
	suf[n]=int(2e9);
	for(int i=n-1;i>=0;i--)
	{
		suf[i]=min(vec[i].se,suf[i+1]);
	}
	for(int i=0;i<n;i++)
	{
		L[i]=R[i]=i;
		int lo=0; int hi=i; int ans=-1;
		while(lo<=hi)
		{
			int mid=(lo+hi)>>1;
			if(pref[mid]>=vec[i].se)
			{
				ans=mid;hi=mid-1;
			}
			else lo=mid+1;
		}
		L[i]=ans;
		lo=i;hi=n-1;ans=-1;
		while(lo<=hi)
		{
			int mid=(lo+hi)>>1;
			if(suf[mid]<=vec[i].se)
			{
				ans=mid;lo=mid+1;
			}
			else hi=mid-1;
		}
		R[i]=ans;
		//cerr<<L[i]<<' '<<R[i]<<'\n';
	}
	vector<ii> intervals;
	for(int i=0;i<n;i++) intervals.pb(mp(R[i],L[i]));
	sort(intervals.begin(),intervals.end());
	for(int i=0;i<n;i++) swap(intervals[i].fi,intervals[i].se);
	int ptr=0; int mx=-1;
	for(int i=0;i<=n;i++)
	{
		while(ptr<n&&intervals[ptr].se<i){mx=max(mx,intervals[ptr].fi); ptr++;}
		if(mx<0) dp[i]=1;
		if(i>0) dp[i]=add(dp[i],add(S[i-1],(mx>=1?MOD-S[mx-1]:0)));
		S[i]=dp[i];
		if(i>0) S[i]=add(S[i-1],S[i]);
	}
	cout<<dp[n]<<'\n';
}


Measured memory_bytes: 8432
#include<set>
#include<deque>
#include<queue>
#include<map>

#include<string>
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long int llint;
#define pub push_back
#define mp make_pair
#define fir first
#define sec second
#define res resize
const int big=((llint)1<<30);


int main(void){
	llint q,n,i,gen=0;
	llint ans=0;vector<llint> let;vector<llint> doc;set<llint> used;
	scanf("%lld",&n);let.resize(n);doc.resize(n+1);
	for(i=0;i<n;i++){ scanf("%lld",&q);doc[q]=i; }
	used.insert(-1);used.insert(n);
	for(i=1;i<=n;i++){
		ans+=(doc[i]-*(--used.lower_bound(doc[i])))*(*(used.lower_bound(doc[i]))-doc[i])*i;
		used.insert(doc[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N;
    ll ans = 0;
    rep(i,N){
        cin>>A;
        while((A&1) == 0){
            ++ans;
            A >>= 1;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	input := make([][3]int64, n)
	for i := 0; i < n; i++ {
		var x, y, h int64
		fmt.Scan(&x, &y, &h)
		input[i] = [3]int64{x, y, h}
	}

	for x := 0; x <= 100; x++ {
		for y := 0; y <= 100; y++ {
			point := [3]int64{0, 0, 0}
			for i := 0; i < n; i++ {
				xyh := input[i]
				if xyh[2] != 0 {
					point = xyh
					break
				}
			}

			h := abs(int64(x)-point[0]) + abs(int64(y)-point[1]) + point[2]
			allOk := true
			for i := 0; i < n; i++ {
				xyh := input[i]
				height := max(h-abs(int64(x)-xyh[0])-abs(int64(y)-xyh[1]), 0)
				if xyh[2] != height {
					allOk = false
					break
				}
			}

			if allOk {
				fmt.Printf("%d %d %d\n", x, y, h)
				break
			}
		}
	}
}

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 512
#include <stdio.h>

int main(){
  long int a,b,c,d,max;
  scanf("%ld%ld%ld%ld", &a,&b,&c,&d);
  max = a*c;
  if(a*d > max)max = a*d;
  if(b*c > max)max = b*c;
  if(b*d > max)max = b*d;
  
  printf("%ld\n", max);
  return 0;
}

Measured memory_bytes: 1632
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
int a[12][1005],b[12];
char s[12][1005];
int main()
{
	int h,w,k;
	sc(h);sc(w);sc(k);
	rep(i,1,h){getchar();scs(s[i]+1);}
	rep(i,1,h)rep(j,1,w){
		if(s[i][j]=='1')a[i][j]=1;
		a[i][j]+=(a[i-1][j]+a[i][j-1]-a[i-1][j-1]);
	}int minn=(h-1)+(w-1);
	rep(i,0,(1<<h)-1){
		int end=1,u=i,coul=0,cour=0,r=1,lef=0,biaoji=0;
		while(u){b[end]=u%2;coul+=u%2;u/=2;end++;}
		while(r<=w){
			int up=0,j;
			for(j=1;j<=(h-1);j++){
				if(b[j]==1){
					if(a[j][r]-a[up][r]-a[j][lef]+a[up][lef]>k)break;
					up=j;
				}
			}if(j<=(h-1)||(a[j][r]-a[up][r]-a[j][lef]+a[up][lef])>k){
				if(lef==r-1){
					biaoji=1;break;
				}lef=r-1;cour++;
			}r++;
		}
		for(int j=1;j<=h;j++)b[j]=0;
		if(biaoji==0)minn=min(minn,coul+cour);
	}pf("%d\n",minn);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int h,w;
    while(1){
        scanf("%d%d",&h,&w);
        if(h==0&&w==0)break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(i==0||i==h-1||j==0||j==w-1)printf("#");
                else printf(".");
            }printf("\n");
        }printf("\n");
    }return 0;
}


Measured memory_bytes: 2032
n, k = map(int, input().split())
x = list(map(int, input().split()))

ans = 10**18
for i in range(n-k+1):
    ans = min(ans, min(abs(x[i]-x[i+k-1])+abs(x[i+k-1]), abs(x[i])+abs(x[i]-x[i+k-1])))
print(ans)


Measured memory_bytes: 14384
import itertools
k = int(input())

d = [[] for _ in range(k)]

for i in range(1, k+1):
    n = 1
    while i*n <= k:
        d[i*n-1].append(i)
        n += 1

seq = [i for i in range(1, k+1)]
ans = 0
A = list(itertools.combinations_with_replacement(seq, 3))
for a in A:
    a1 = a[0]
    a2 = a[1]
    a3 = a[2]
    if a1 == a2 == a3:
        m = 1
    elif a1 == a2 or a1 == a3 or a2 == a3:
        m = 3
    else:
        m = 6
    ans += max(set(d[a1-1]) & set(d[a2-1]) & set(d[a3-1])) * m

print(ans)

Measured memory_bytes: 105528
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	input := scanIntNum()
	fmt.Println(float64(input) * 2 * math.Pi)

}

func scanIntNum() (num int) {
	sc.Scan()

	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return num
}


Measured memory_bytes: 1760
N = int(input())
syougen = [[] for _ in range(N)]
for _ in range(N):
    kosuu = int(input())
    for i in range(kosuu):
        syougen[_].append([int(x) for x in input().split(" ")])
num = 0
for i in range(2 ** N):
    bit = i
    hypothesis = []
    for _ in range(N):
        hypothesis.append(bit % 2)
        bit //= 2
    bit = i
    k = 0
    flag = True
    while bit > 0:
        if bit % 2 == 1:
            for s in syougen[k]:
                if hypothesis[s[0] - 1] != s[1]:
                    flag = False
        bit >>= 1
        k += 1
    if flag:
        if sum(hypothesis) > num:
            num = sum(hypothesis)
print(num)

Measured memory_bytes: 3064
#!/usr/bin/perl

$line == 0;
while(<>) {
    chomp;
    if ($line == 0) {
        $n = $_;
    } elsif ($line == 1) {
        $k = $_;
    } else {
        @x = split /\s+/, $_;
    }
    $line++;
}

foreach (@x) {
    $d1 = $_;
    $d2 = abs($k - $_);
    if ($d1 < $d2) {
        $total += $d1 * 2;
    } else {
        $total += $d2 * 2;
    }
}

print "$total\n";


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int x, y, x1 = 0, x2, y1 = 0, y2, n, a;
    cin >> x2 >> y2 >> n;
    while (n--) {
        cin >> x >> y >> a;
        if (a == 1 && x1 < x) {
            x1 = min(x, x2);
        } else if (a == 2 && x < x2) {
            x2 = max(x, x1);
        } else if (a == 3 && y1 < y) {
            y1 = min(y, y2);
        } else if (a == 4 && y < y2) {
            y2 = max(y, y1);
        }
    }
    cout << (x2-x1)*(y2-y1) << endl;
}


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

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> a(n), b(n);
  vector<P> p(n);
  rep(i, n) {
    cin >> a[i] >> b[i];
    p[i] = {a[i], b[i]};
  }

  sort(p.begin(), p.end());

  int ans = 0;
  ll cnt = 0;
  rep(i, n) {
    if (cnt >= k) break;
    ans = p[i].first;
    cnt += p[i].second;
  }
  cout << ans << endl;
}


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

int t,n,k;
int X[100010],A[100010];
int ans=0;

int main(){
  cin >> t;
  for(int i=0;i<t;i++){
    cin >> n >> k;
    for(int j=0;j<n;j++){
      cin >> X[j];
    }
    for(int j=0;j<n-1;j++){
      A[j]=X[j+1]-X[j];
    }
    sort(A,A+n-1);
    if(n<=k)ans=0;
    else{
      for(int l=0;l<n-k;l++){
        ans+=A[l];}
      }
      cout << ans << endl;
      ans=0;
      for(int j=0;j<100010;j++){
        X[j]=0;
        A[j]=0;
      }
    }
  }



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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long


signed main()
{
    int n, m, t;
    cin >> n >> m >> t;
    vector<bool> used(t+1, 0);
    for(int i=0; i<n; ++i) {
        int a;
        cin >> a;
        for(int j=a; j>=max(a-m, (long long)0); --j) used[j] = 1;
        for(int j=a; j<min(a+m, t); j++) used[j] = 1;
    }
    cout << count(used.begin(), used.end()-1, 0) << endl;
    return 0;
}

Measured memory_bytes: 3096
n = gets.chomp.to_i
a = gets.chomp.split(' ').map { |s| s.to_i}
b = gets.chomp.split(' ').map { |s| s.to_i}
c = gets.chomp.split(' ').map { |s| s.to_i}

before = 0
result = 0
a.each do |i|
  result += b[i-1]
  if 0 < before && i == before + 1
    result += c[before-1]
  end
  before = i
end
puts result

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>

using namespace std;


int main(){
  
  vector<string> v(3);

  for(int i = 0; i < 3; i++) cin >> v[i];
  int cur = 0;
  while(true){
    
    if(v[cur].length() == 0){
      if(cur == 0){
        cout << 'A' << endl;
      }else if(cur == 1){
        cout << 'B' << endl;
      }else{
        cout << 'C' << endl;
      }
      return 0;
    }
    int c = v[cur][0] - 'a';
    v[cur] = v[cur].substr(1);
    cur = c;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>


int main() {
	int n, k;
	cin >> n >> k;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int l = 0;
	int r = 1e9;
	while (r - l > 1) {//二分探索！
		int x = (l + r) / 2;
		auto f = [&](int x) {
			ll now = 0;
			rep(i, n) {
				now += (a[i] - 1) / x;	
			}
			return now <= k;
		};
		if (f(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}
	cout << r << endl;
	return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int A,B,C,D;
  cin >> A >> B >> C >> D;


  double x = 30 * (double)(C) + 30 * ((double)(D)/60 );
  double y = 6 * (double)D;

  double theta = abs(x - y);
  theta = min(theta, 360 - theta);

  // cerr << theta << endl;

  double pi = acos(-1);

  double cos_theta = cos(theta*pi / 180);
  // cerr << cos_theta << endl;

  double ans = A*A + B*B - 2 * A * B * cos_theta;
  cout << sqrt(ans) << endl;

}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pair2;
typedef pair<int, pair<int, int> > pair3;
typedef pair<int, pair<int, pair<int, int > > > pair4;
#define MAXN 200013
#define INF 1000000000000000000LL
#define MOD 1000000007LL
#define IINF 1000000000
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

int n, k, values[MAXN];

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

	cin >> n >> k;

	int answer = 0;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;

		if (h >= k) {
			answer++;
		}
	}
	cout << answer << endl;
}

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

int main(){
    int k, a, b,c=0;
    cin >> k >> a >> b;

    for (int i = a; i < b + 1;i++){
        if(i%k==0){
            c++;
        }
    }
    if(c!=0){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3632
N = int(input())
cnt = 0
ans = 1
for i in range(1,N+1):
    t = i
    c = 0
    while True:
        if t % 2 != 0:
            break
        t /= 2
        c += 1
    if c > cnt:
        ans = i
        cnt = c
print(ans)


Measured memory_bytes: 38256
#include <iostream>
using namespace std;
int main(void){
    int m,f,r;
    
    
    while(1){
      cin >> m >> f >> r;
        
        if(-1 == m && -1 == f && -1 == r){
            return 0;
        } else if(-1 == m || -1 ==f){
            cout << "F" << endl;
        } else if(m+f >= 80){
            cout << "A" << endl;
        } else if(m+f >= 65){
            cout << "B" << endl;
        } else if(m+f >= 50 || r >= 50){
            cout << "C" << endl;
        } else if(m+f >= 30 ){
            cout << "D" << endl;
        } else cout << "F" << endl;
        
    }
}



Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;

int main(){

  int n;
  int d[100];
  string s;

  while(cin >> n, n){
    cin >> s;

    memset(d,0,sizeof(d));

    for(int i=0;i<s.size();i++){
      if(s[i] == 'M') d[i%n]++;
      if(s[i] == 'S') d[n] += d[i%n]+1, d[i%n] = 0;
      if(s[i] == 'L') d[i%n] += d[n]+1, d[n] = 0;
    }

    sort(d,d+n);
    for(int i=0;i<n;i++) cout << d[i] << " ";
    cout << d[n] << endl;

  }
}

Measured memory_bytes: 1228