akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

ll op, a, b, c, d, n;
map <ll, ll> mp;
ll dp(ll x){
	if (x == 0) return 0;
	if (mp.find(x) != mp.end()) return mp[x];
	mp[x] = infll;
	ll ans;
	if (infll / d <= x) ans = infll; else ans = d * x;
	ans = min(dp((x - x % 2) / 2) + x % 2 * d + a, ans);
	ans = min(dp((x - x % 3) / 3) + x % 3 * d + b, ans);
	ans = min(dp((x - x % 5) / 5) + x % 5 * d + c, ans);
	if (x % 2 != 0) ans = min(dp((x + (2 - x % 2)) / 2) + (2 - x % 2) * d + a, ans);
	if (x % 3 != 0) ans = min(dp((x + (3 - x % 3)) / 3) + (3 - x % 3) * d + b, ans);
	if (x % 5 != 0) ans = min(dp((x + (5 - x % 5)) / 5) + (5 - x % 5) * d + c, ans);
	mp[x] = ans;
	return ans;
}
int main(){
	read(op);
	while (op--){
		mp.clear();
		read(n); read(a); read(b); read(c); read(d);
		printf("%lld\n", dp(n));
	}
	return 0;
}



Measured memory_bytes: 4448
N = input()
a = N[0]
b = N[1]
c = N[2]
d = N[3]
if a == b and b == c and c == d:
    print("Yes")
elif a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")

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

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

int main() {

    int r;
    cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}

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

const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int N,bool visited[nmax]){
  
  bool all_visited=true;
  
  for(int i=0;i<N;i++){
    if(visited[i]==false)
      all_visited=false;
  }
  if(all_visited){
    return 1;
  }
  
  int ret=0;
  
  for(int i=0;i<N;i++){
    if(graph[v][i]==false)continue;
    if(visited[i])continue;
    
    visited[i]=true;
    ret+=dfs(i,N,visited);
    visited[i]=false;
  }
  return ret;
  
}

int main(){
  int N,M; cin>>N>>M;
  for(int i=0;i<M;i++){
    int A,B;
    cin>>A>>B;
    graph[A-1][B-1]=graph[B-1][A-1]=true;
  }
  bool visited[nmax];
  for(int i=0;i<N;i++){
    visited[i]=false;
  }
  visited[0]=true;
  cout<<dfs(0,N,visited)<<endl;
  return 0;
}

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

int main() {
    int H, W; cin >> H >> W;
    int c[10][10];
    int C[10][10];
    rep(i, 10){
        rep(j, 10){
            cin >> c[i][j];
            C[i][j] = c[i][j];
        }
    }

    for (int k = 0; k < 10; k++){
        for (int i = 0; i < 10; i++){
            for (int j = 0; j < 10; j++){
                C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
            }
        }
    }

    int ans = 0;
    rep(i, H){
        rep(j, W){
            int a; cin >> a;
            if(a == -1)continue;
            ans += C[a][1];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  
 
  cin >> N;
 
  if (N % 1111 == 0) {
    cout << "Yes" << endl;
  }
  else if ((N - (N / 1000) * 1000) % 111 == 0) {
    cout << "Yes" << endl;
  }
  else if (((N / 10) * 10) % 1110 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
      


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,sum=0;
	cin>>a>>b;
	if(a*2>b){
		sum=floor(b/2.0);
	}
	else{
		sum=a+floor((b-a*2)/4.0);
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256
import math
n = int(input())
max_target = int(math.sqrt(n) // 1)
ans = 10 ** 9
for a in range(1, max_target + 1):
  if n % a == 0:
    b = n // a
    f = max(len(str(a)), len(str(b)))
    ans = min(ans, f)
print(ans)

Measured memory_bytes: 64996
using System;

class test{
public static void Main(){
  
  int result = 0;
  
  string[] input = Console.ReadLine().Split(' ');
  int n1 = int.Parse(input[0]);
  int n2 = int.Parse(input[1]);
  
  if (n1 % 2 != 0 && n2 % 2 != 0){
    result =1;
  }
  
  answer(result);
}
    static void answer(int result){
    string answer  = (result == 0) ? "Even" : "Odd";
    Console.WriteLine(answer);
  }

}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 100010;
double ans[1000];
int main()
{
    int n;
    cin>>n;
    for(int i = 1;i<=n;++i)
    {
        cin>>ans[i];
    }
    sort(ans+1,ans+n+1);
    long double sum = ans[1]+ ans[2];
    long double k = 2;
    for(int i = 3;i<=n;++i)
    {
        sum += k*ans[i];
        k *= 2;
    }
    cout<<(long double)sum/k;
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF 1000000000 //
#define LINF (ll)4000000000000000000 //
#define MOD (ll)1000000007
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898
#define NP(v) next_permutation(v.begin(),v.end())

//------------------------------------------------------

int main() {
    double a, b, c;
    ll two;
    cin >> a >> b >> c >> two;

    ll one = (ll) min({a * 4, b * 2, c});

    ll n;
    cin >> n;

    ll ans;

    if (two < 2 * one) {
        ans = two * (n / 2) + one * (n % 2);
    } else {
        ans = one*n;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/*
Author: Babin Dutta
*/

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define endl "\n"

void solve(){
	int n,k; cin>>n>>k;
	int a[n];
	f(i,n) cin>>a[i];
	int b[n];
	b[0]=0;
	ff(i,1,n-1){
		b[i] = b[i-1]+abs(a[i]-a[i-1]);
		for(int j=2;j<=k && i>=j;j++) b[i] = min(b[i], b[i-j]+abs(a[i]-a[i-j]));
	}
	cout<<b[n-1]<<endl;
}

int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 1024
S = input()
N = len(S)
 
cond1 = True if S[0] == 'A' else False
cond2 = True if S[2:-1].count('C') == 1 else False
cond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False
 
print('AC') if cond1 and cond2 and cond3 else print('WA')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

int main(){
	int n;
	cin >> n;
	vector<int> go,hi;
	for(int i(0);i<n;++i){
		int x;
		cin>> x;
		go.push_back(x);
		hi.push_back(x);
	}
	sort(hi.begin(),hi.end());
	int a=hi[n-1];
	int b=hi[n-2];
	for(int i(0);i<n;++i){
		if(go[i]!=a){
			cout << a<<"\n";
		}
		else{
			cout << b << '\n';
		}


	}
}

Measured memory_bytes: 3436
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<vector>
#include<list>
#include<set>
#include<bitset>
#include<stack>
#include<cctype>
#define sc(x) scanf("%d",&x);
#define pr(x) cout<<#x<<": "<<x<<" ";
#define prln(x) cout<<#x<<": "<<x<<endl;
#define bug() cout<<"bug: "<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const double eps = 1e-4;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5+7;
const int maxm = 1e6+7;
const double pi = acos(-1.0);


int main(){
	int n,a,b; cin>>n>>a>>b;
	a=abs(a-n); b=abs(b-n);
	if(a>b)
		puts("B");
	else
		puts("A");
	return 0;
} 

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

int main(){
  string s;
  int    a, ua, da;
  istringstream ss;
  cin >> s;
  ss = istringstream(s);
  ss >> a;
  
  ua = a / 100;
  da = a % 100;
  
  
  if(
    (ua >= 0 && ua < 100 && da >  0 && da < 13 ) &&
    (ua > 0  && ua < 13  && da >= 0 && da < 100)
  ){
    cout << "AMBIGUOUS" << endl;
  }else if(
    (ua >= 0 && ua < 100 && da >  0 && da < 13 ) 
  ){
    cout << "YYMM" << endl;
  }else if(
    (ua > 0  && ua < 13  && da >= 0 && da < 100)
  ){
    cout << "MMYY" << endl;
  }else{
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, H, W;
    cin >> H >> W >> h >> w;
    int a = H - h;
    int b = W - w;
    cout << a * b << '\n';
    
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String line = br.readLine();
    String[] ar = line.split("");
    int res = 700;
    if (ar[0].equals("o")) res = res + 100;
    if (ar[1].equals("o")) res = res + 100;
    if (ar[2].equals("o")) res = res + 100;
    System.out.println(res);
  }
}

Measured memory_bytes: 23252
import sys,collections as cl
import fractions
from functools import reduce
import copy
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())

a = l()

m = gcd_list(a[1:])
m = max(m,gcd_list(a[:n-1]))
aa = [a[0]]
aaa = [a[-1]]
for i in range(n-1):
	aa.append(gcd(aa[-1],a[i+1]))
	aaa.append(gcd(aaa[-1],a[-(i+1)]))

for i in range(n-1):
	m = max(m,gcd(aa[i],aaa[-(i+2)]))
print(m)

Measured memory_bytes: 100064
#include<stdio.h>
#define NUM 15000
int main(void){
  int a[NUM],i=0;
  for(i=0;i<NUM;i++){
    scanf("%d",&a[i]);
    if(a[i]==0){
      break;
    }
  }
     for(i=0;i<NUM;i++){
    if(a[i]==0){
      break;
    }
    printf("Case %d: %d\n",i+1,a[i]);
  }
  return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n, m, a[1001], t, p, q, r;
	bool f;
	
	while(cin>>n>>m&&n&&m){
		vector<int> vec;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
		}
		a[0] = 0;
		
		for(int i = 0; i <= n; i++){
			for(int j = 0; j <= n; j++){
				r = a[i]+a[j];
				f = true;
				for(int k = 0; k < vec.size(); k++){
					if(r == vec[i]){
						f = false;
						break;
					}
				}
				if(f){
					vec.push_back(r);
				}
			}
		}
		sort(vec.begin(), vec.end());
		
		t = 0;
		for(int i = 0; i < vec.size(); i++){
			p = 0;
			q = vec.size();
			while(q-p > 1){
				r = (p+q)/2;
				if(vec[i]+vec[r] >= m){
					q = r;
				} else {
					p = r;
				}
			}
			r = vec[i]+vec[p];
			if(t < r && r <= m){
				t = r;
			}
		}
		
		cout << t << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4952
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        Set <Integer> st = new HashSet <Integer> ();
        for(int i = 1; i <= k; ++i){ 
            int d = sc.nextInt();
            for(int j = 1; j <= d; ++j){
                int x = sc.nextInt();
                st.add(x);
            }
        }
        System.out.println(n - st.size());
    }    
}

Measured memory_bytes: 37564
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int n,k,x;
    scanf("%d%d",&n,&k);
    int g = 0,maxn = 0;
    for(int i = 1;i <= n;i++)
        scanf("%d",&x),g = __gcd(g,x),maxn = max(maxn,x);
    if(k <= maxn && k % g == 0)
        printf("POSSIBLE\n");
    else
        printf("IMPOSSIBLE\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int l;
	int m,n;
	int a[12];

	while(true){
		int num = 0;
		cin >> l;

		if(l==0)
			break;

		for(int i=0 ;i<12 ;i++){
			cin >> m >> n;

			num = num+(m - n);
			a[i] = num;
		}
		for(int i=0 ;i<12 ;i++){
			
			if(a[i] >= l){
				cout << i+1 << endl;
				break;
			}
			else if(i==11){
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	string S;
	cin >> S;

	string s = S.substr(0, 4) + S.substr(5, 2) + S.substr(8, 2);
	int ymd = atoi(s.c_str());

	cout << (ymd > 20190430 ? "TBD" : "Heisei") << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
rs = [list(map(int, input().split())) for _ in range(n)]
lr = [[x-l, x+l] for x, l in rs]
lr.sort(key=lambda x: x[1])

cnt = 0
reach = None
for l, r in lr:
    if reach is not None and l < reach:
        continue
    reach = r
    cnt += 1
print(cnt)

Measured memory_bytes: 42792
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;

	vector<int> h;
	for (int i = 0; i < N; i++) {
		int H;
		cin >> H;
		if (H >= K) {
			h.push_back(H);
		}
	}

	cout << h.size() << endl;
}


Measured memory_bytes: 892
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>

using namespace std;

int N, M;

int main() {
	cin >> N >> M;
	
	int Mul = (int)pow(2.0, M);

	int Ans = ((N - M) * 100 + M * 1900) * Mul;
	
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int i,j; 
	
	 for(i=1; i<= 9 ;i++)
	 {
		for(j=1 ; j<= 9 ;j++)
		{
	printf("%dx%d=%d\n",i,j,i*j);
		
		}
	}
    return 0;
}

Measured memory_bytes: 524
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,k;
int x[30][25];
string S;
int cur = 0;
vector<int>expr();
vector<int>term(){
	if(S[cur] == '('){
		cur++; vector<int>V = expr(); cur++; return V;
	}
	if(0<=S[cur]-'A' && S[cur]-'A'<=25){
		int r = S[cur]-'A'; cur++;
		vector<int>V; for(int i=0;i<n;i++) V.pb(x[r][i]);
		return V;
	}
	int val = 0;
	while(0<=S[cur]-'0' && S[cur]-'0'<=9){
		val = val*10+(S[cur]-'0');
		cur++;
	}
	vector<int>rep = term(); 
	vector<int>now,nw(n); for(int i=0;i<n;i++) now.pb(i);
	while(val){
		if(val%2){
			for(int i=0;i<n;i++){
				nw[i] = now[rep[i]];
			}
			now = nw;
		}
		for(int i=0;i<n;i++){
			nw[i] = rep[rep[i]];
		} 
		rep = nw; val/=2;
	}
//for(int i=0;i<n;i++) cout << now[i] << endl;
	return now;
}
vector<int> expr(){
	vector<int>vi; for(int i=0;i<n;i++) vi.pb(i);
	do{
		if(S[cur] == '+') cur++;
		vector<int>ch = term();
		vector<int>nw(n); for(int i=0;i<n;i++) nw[i] = vi[ch[i]]; vi = nw;
	}while(cur<S.size() && S[cur] == '+');
	return vi;
}
int main(){
	cin >> n >> k;
	for(int i=0;i<k;i++){
		string s; cin >> s;
		int r; cin >> r;
		vector<int>V; for(int i=0;i<n;i++) V.pb(i);
		for(int iy=0;iy<r-1;iy++){
			for(int j=0;j<n-1;j++){
				int y; cin >> y; if(y) swap(V[j],V[j+1]);
			}
		}
		for(int j=0;j<n;j++) x[s[0]-'A'][j] = V[j];
	}
	int x; cin >> x;
	for(int i=0;i<x;i++){
		cin >> S;
		cur = 0; vector<int>vi = expr();
		for(int i=0;i<vi.size();i++) cout << vi[i]+1 << (i == n-1?'\n':' ');
	}
}

Measured memory_bytes: 3196
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	ll A=in<ll>(),B=in<ll>();

	ll C = (A+B);
	cout << (C%2 ? "IMPOSSIBLE" : to_string(C/2)) << endl;
	return 0;
}


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

int main() {
    long double N, ans=0, X;
    cin >> X;
    N=100;
    if(N>=X){
	cout << 0 << endl;
	return 0;
    }

    while(true){
	N *= 1.01;
	N = floor(N);
	ans++;
	if(N>=X)
	    break;
    }

    

    cout << ans << endl;
} 




Measured memory_bytes: 3788
n=int(input())
ln=0
mx=0

for _ in range(n):
	l,r=map(int,input().split())
	if l == r:
		ln += 1
	else:
		ln = 0
	mx = max(mx, ln)

if mx >= 3:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 62300
import sys
import itertools

def resolve(in_):
    N, M = map(int, in_.readline().split())
    sc = tuple(tuple(map(int, line.split())) for line in itertools.islice(in_, M))

    if N == 1:
        values = range(10)
    else:
        values = range(10 ** (N - 1), 10 ** N)

    for value in values:
        if all(value // (10 ** (N - s)) % 10 == c for s, c in sc):
            return value

    return -1


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


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

using namespace std;

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

//    vector<pair<long long, long long>> pairs;

    vector<long long> divisior;
    //vector<vector<long long>> squares(sqrt(n), vector<long long>(sqrt(n)));
    for(long long i = 1 ; i <= sqrt(n); ++i)
    {
        if(n%i == 0)
        {
            if(n/i == i)
                divisior.push_back(i);
            else
            {
                divisior.push_back(i);
                divisior.push_back(n/i);
            }
        }
    }

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

    long long sum = 1000000000009;

    for(int i = 0 ; i <= divisior.size(); ++i)
    {
        for(int j = 0 ; j < divisior.size(); ++j)
        {
            if(divisior[i]*divisior[j] == n)
            {
                sum = min(sum, (divisior[i]-1) + (divisior[j]-1));
            }
        }
    }

//    for(auto pr : pairs)
//    {
//        if(pr.second == n)
//        {
//            sum = min(sum, pr.first);
//        }
//    }
//
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 384
///
// File:  b.cpp
// Author: ymiyamoto
//
// Created on Sat Nov  4 21:38:06 2017
//

#include <cmath>
#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()
{
  uint32_t N;
  cin >> N;

  double s = sqrt(N);
  int S = s;

  cout << S * S << endl;

  return 0;
}


Measured memory_bytes: 256
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()

	ans := map[int]int{}

	nmax := 10000
	for x := 1; x*x <= nmax; x++ {
		for y := 1; (x*x + y*y + x*y) <= nmax; y++ {
			for z := 1; x*x+y*y+z*z+x*y+y*z+x*z <= nmax; z++ {
				v := x*x + y*y + z*z + x*y + y*z + x*z
				if v <= nmax {
					ans[v]++
				}
			}
		}
	}

	for i := 1; i <= N; i++ {
		fmt.Println(ans[i])
	}

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 2628
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

ll A[200010];
ll cnt[200010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		cnt[A[i]]++;
	}
	ll ans = 0;
	for (int i = 0; i <= N; i++) {
		ans += (cnt[i] - 1) * cnt[i] / 2;
	}
	for (int i = 0; i < N; i++) {
		cnt[A[i]]--;
		cout << ans - cnt[A[i]] << endl;
		cnt[A[i]]++;
	}
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = int(2e5) + 7;
typedef pair<int, int> pii;
const int mod = int(1e9) + 7;

int Pow(int x, int y) {
    int res = 1;
    while(y) {
        if(y & 1) res = 1ll * res * x % mod;
        x = 1ll * x * x % mod; y >>= 1;
    }
    return res;
}

int fac[N], rev[N], n, m, k;

int nCk(int n, int k) {return 1ll * fac[n] * rev[k] % mod * (ll)rev[n - k] % mod;}
void add(int& x, int y) {
    x += y;
    if(x >= mod) x -= mod;
    if(x < 0) x += mod;
}
int sum(int x, int y) {add(x, y); return x;}
int mul(int x, int y) {
    int res = 1ll * x * y % mod;
    if(res < 0) res += mod;
    return res;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> m >> k;
    fac[0] = rev[0] = 1;
    for(int i = 1; i <= n * m; ++i) {
        fac[i] = (ll)fac[i - 1] * i % mod;
        rev[i] = Pow(fac[i], mod - 2);
    }
    int res = 0;
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= m; ++j) {
            add(res, mul(mul(i, (i - 1) * m + j - 1), nCk(n * m - 2, k - 2)));
            add(res, mul(mul(-i, (n - i) * m + m - j), nCk(n * m - 2, k - 2)));
        }
    }
    for(int i = 1; i <= m; ++i) {
        for(int j = 1; j <= n; ++j) {
            add(res, mul(mul(i, (i - 1) * n + j - 1), nCk(n * m - 2, k - 2)));
            add(res, mul(mul(-i, (m - i) * n + n - j), nCk(n * m - 2, k - 2)));
        }
    }
    cout << res;
}


Measured memory_bytes: 1792
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
//#include<ext/rope>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
const double PI=acos(-1.0);
const double eps=1e-6;
inline 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;
}
template<typename T> void debug(T x)
{
    cout<<"value="<<x<<endl;
    return;
}
signed main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int n=read();
	int cnt=0;
	for(int i=1;i<=n;i++){
        int x=read();
        if(i%2==1 && x%2==1) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 3584
N,Q=gets.chomp.split.map(&:to_i)
edge=Array.new(N+1).map{Array.new}
(N-1).times do
  a,b=gets.chomp.split.map(&:to_i)
  edge[a] << b
  edge[b] << a
end

v=Array.new(N+1,0)
Q.times do
  p,x=gets.chomp.split.map(&:to_i)
  v[p]+=x
end
stack = [[1,0]]
w=Array.new(N+1,-1)
w[0]=0

while(!stack.empty?)
  pos,parent = stack.pop
  w[pos] = v[pos] + w[parent]
  edge[pos].each do |t|
    next if w[t] != -1 
    stack.push([t,pos])
  end
end
puts w[1..N].join(" ")

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


using namespace std;


long long lcm(long long a,long long b){
    return a / __gcd(a, b) * b;
}

int main(){
    long long N,A,B,C,D;
    long long ans=0;


    cin>>A>>B>>C>>D;
    long cwari=(B/C-(A-1)/C);
    long dwari=(B/D-(A-1)/D);
    long lll=(B/lcm(C,D)-(A-1)/lcm(C,D));
    
    ans=B-A+1+lll-cwari-dwari;



    cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

int a, b, c;

int main() {

  cin >> a >> b >> c;

  if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b)) {
    puts("Yes");
  } else {
    puts("No");
  }

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    Vec l(n);
    rep(i,n){
        cin>>l[i];
    }
    sort(ALL(l));
  //  dbg(l);
    ll ans=0;
    rep(i,n){
        if(i<2){
            continue;
        }
        REP(j,1,i){
            if(l[j]<l[i]/2){
                continue;
            }
            auto itr = upper_bound(l.begin(),l.begin()+j-1,l[i]-l[j]);
//            dbg(i);
//            dbg(j);
//            dbg(itr-l.begin());
            if(l[itr-l.begin()]>l[i]-l[j]){
                ll tmp = j - (itr-l.begin());
                ans += tmp;
            }

        }
     //   dbg(ans);
    }
    cout<<ans<<endl;
    return  0;
}


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

int main() {
    int n; cin >> n;
    vector<int> A(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
    }

    vector<bool> V(n + 1);
    int m = 0;
    for (int i = n; i > 0; i--) {
        int cnt = A[i];
        for (int j = i * 2; j <= n; j += i) {
            if (V[j]) cnt++;
        }
        if (cnt % 2 == 1) {
            V[i] = true;
            m++;
        }
    }
    cout << m << endl;
    if (m == 0) return 0;

    for (int i = 1; i <= n; i++) {
        if (V[i]) cout << i << ' ';
    }
    cout << endl;

    return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int n;

int main(){
    cin >> n;
    vec<int> p(n, 0), q(n, 0);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    vec<int> v(n), e(n);
    rep(i, n) v[i] = i+1, e[i] = n-i;
    int c = 0;
    int a, b;
    while(true) {
        bool is_p, is_q;
        is_p = true, is_q = true;
        rep(i, n) if (p[i] != v[i]) is_p = false;
        rep(i, n) if (q[i] != v[i]) is_q = false;
        if (is_p) a = c;
        if (is_q) b = c;
        c++;
        bool fin = true;
        rep(i, n) if (v[i]!=e[i]) fin = false;
        if (fin) break;
        next_permutation(v.begin(),v.end());
    }
    cout << abs(a-b) << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=110000;
int a[MAXN][3], f[MAXN][3];
int main()
{
//	freopen("C.in", "r", stdin);
//	freoepn("C.out", "w", stdout);
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++)
		for (int j=0; j<3; j++)
			scanf("%d", &a[i][j]);
	f[0][0]=f[0][1]=f[0][2]=0;
	for (int i=1; i<=n; i++)
	{
		f[i][0]=max(f[i-1][1], f[i-1][2])+a[i][0];
		f[i][1]=max(f[i-1][0], f[i-1][2])+a[i][1];
		f[i][2]=max(f[i-1][0], f[i-1][1])+a[i][2];
	}
	printf("%d\n", *max_element(f[n], f[n]+3));
	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>

#define MOD 1e9+7;
#define INF 1e17+9;
#define PI acos(-1);

using namespace std;

int main() {
	long long k,a,b;
	cin >> k >> a >> b;
	long long first_cost=a+2-1;
	long long bisk=1;
	
	if(first_cost>k || a+2>b){
		bisk+=k;
		cout << bisk << endl;
		return 0;
	}else{
		bisk=0;
		bisk+=b;
		k-=first_cost;
		if(k<0)k=0;
	}
	
	bisk+=(k/2)*(b-a);
	bisk+=k%2;
	cout << bisk << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;

int main()
{
  int a[3],five=0,seven=0;
  rep(i,3) cin >> a[i];
  rep(i,3){
    if(a[i]==5) five++;
    if(a[i]==7) seven++;
  }
  if(five==2 && seven==1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}

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

int main(){

  int h,w;
  char c;
  int maze[100][100];
  int d[100][100];

  cin >> h >> w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> c;
      maze[i][j] = c - '0';
    }
  }

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

  for(int i=1;i<h;i++) d[i][0] += maze[i][0] + d[i-1][0];
  for(int i=1;i<w;i++) d[0][i] += maze[0][i] + d[0][i-1];

  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++){
      d[i][j] = min(d[i-1][j],d[i][j-1]) + maze[i][j];
    }
  }

  cout << d[h-1][w-1] << endl;

}

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

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

int main() {
	int n;
	double xa, ya, xb, yb, ra, rb;
	vector<int> Decision;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		if ((ra+rb)*(ra + rb) < ((xb - xa)*(xb - xa) + (yb - ya)*(yb - ya)))Decision.push_back(0);
		else if ((ra - rb)*(ra - rb) > ((xa - xb)*(xa - xb) + (ya - yb)*(ya - yb))) {
			if (ra > rb)Decision.push_back(2);
			else Decision.push_back(-2);
		}
		else if (((xb - xa)*(xb - xa) + (yb - ya)*(yb - ya)) <= (ra + rb)*(ra + rb))Decision.push_back(1);
	}
	for (int i = 0; i < Decision.size(); i++)cout << Decision[i] << endl;
	return 0;
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    double r;
    cin>>r;
    double PIE=acos(-1);
    printf("%.10lf",PIE*2*r);
    return 0;
}




Measured memory_bytes: 3788
# -*- coding: utf-8-*-
#strs = []
#n,k = map(int,input().split())
#hates = list(input().split())

n,m = map(int,input().split())
print((n-1) * (m-1))
#length = len(inputstr) - 2
#print('{}{}{}'.format(inputstr[0],length,inputstr[-1]))


Measured memory_bytes: 2940
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <list>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(d) string(1,d)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007
 
int main() {
  ll n;
  cin>>n;
  ll ans = 0;
  vector<ll> v;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a);
  }
  rep(i,0,v.sz-1){
    ans += v[i]/2;
    v[i] = v[i]%2;
    if(v[i]==1&&v[i+1]>0){
      v[i]--;
      v[i+1]--;
      ans++;
    }
  }
  ans += v[v.sz-1]/2;
  cout << ans << endl;
  return 0;
}
 
 


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>

using namespace std;
const int MAXN = 3001;
long long a[MAXN];
long long dp[MAXN][MAXN];

int main()
{
    int N;
    cin >> N;
    for(int i = 0; i < MAXN; i++) for(int j = 0; j < MAXN; j ++) dp[i][j] = 0;
    for(int i = 1; i <= N; i++)
    {
        cin >> a[i];
        dp[i][i] = a[i];
    }
    for(int j = 1; j <= N; j++) for(int i = j-1; i >= 1; i--) dp[i][j] = max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
    cout << dp[1][N];
}

Measured memory_bytes: 70656
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    int p[4][3][10] = {0};
    int b, f, r, v;
    for(int i = 0; i < n; ++i) {
        cin >> b >> f >> r >> v;
        p[b-1][f-1][r-1] += v;
    }
    for(int i = 0; i < 4; ++i) {
        for(int j = 0; j < 3; ++j) {
            for(int k = 0; k < 10; ++k) {
                cout << " " << p[i][j][k];
            }
            cout << endl;
        }
        if(i != 3) {
            cout << "####################" << endl;
        }        
    }
    return 0;

}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n, L;
    while(scanf("%d%d", &n, &L) && n){
        int pos[n], dir[n];
        rep(i, n){
            char c;
            scanf(" %c%d", &c, &pos[i]);
            pos[i] *= 2;
            dir[i] = (c == 'R' ? 1 : -1);
        }
        auto in = [&](int x){return x > 0 && x < 2*L;};

        int ans = 0, last;
        bool flag = true;
        for(int t=1; flag; ++t){
            flag = false;
            int last_l = -1, last_r = -1;
            rep(i, n)if(in(pos[i])){
                pos[i] += dir[i];
                if(in(pos[i])) flag = true;
                else{
                    chmax(ans, t);
                    (pos[i] == 0 ? last_l : last_r) = i;
                }
            }

            rep(i, n)if(in(pos[i]))For(j, i+1, n)if(pos[i] == pos[j]){
                if(pos[i] % 2 == 0){
                    dir[i] *= -1;
                    dir[j] *= -1;
                }
            }

            if(last_l >= 0) last = last_l;
            else if(last_r >= 0) last = last_r;
        }
        printf("%d %d\n", ans/2, last+1);
    }
}


Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int n; cin >> n;
  vector<pair<int, int>> p(n);

  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    p[i] = make_pair(a, i+1);
  }
  sort(p.begin(), p.end());
  for (int i = 0; i < n; i++) {
    cout << p[i].second;
    cout << (i == n-1 ? "\n" : " ");
  }
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int a, b, k;
	cin >> a >> b >> k;

	cout << max((ll)0, a - k) << " ";

	if(a > k) cout << b << endl;
	else cout << max((ll)0, b - (k - a)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int A,B;
int sum=0,cnt=0;
 
scanf("%d %d",&A,&B);
if(A>=B){
  sum+=A;
   A=A-1;
   cnt++;}
if(B>=A){
   sum+=B;
   B=B-1;
   cnt++;}
if(A>=B&&cnt!=2){
    sum+=A;
    A=A-1;
    cnt++;}
if(B>=A&&cnt!=2&&cnt!=3){
   sum+=B;
   B=B-1;
   cnt++;}

 printf("%d\n",sum);
 
  return(0);
}

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int n, ans = 0;
	cin >> n;
	vector<int>p(n);
	for (int i = 0; i < n; i++)cin >> p[i];
	for (int i = 1; i < n-1; i++)
	{
		if ((p[i - 1] > p[i] && p[i + 1] < p[i]) || (p[i + 1] > p[i] && p[i - 1] < p[i]))ans++;
	}
	cout << ans;
}


Measured memory_bytes: 256
N,D=map(int,input().split())
x=[0]*N
y=[0]*N
for i in range(N):
    x[i],y[i] = map(int,input().split())
cnt = 0
for i in range(N):
    r=((x[i]**2)+(y[i]**2))**0.5
    if r <= D:
        cnt += 1
    #print(r)
print(cnt)


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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	int c4 = 0;
	int c2 = 0;
	int c1 = 0;
	for (int i = 0; i < N; i++) {
		int v; cin >> v;
		if (v % 4 == 0) c4++;
		else if (v % 2 == 0) c2++;
		else c1++;
	}
	if (c2) c1++;
	cout << (c1 <= c4 + 1 ? "Yes" : "No") << '\n';

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll dat[1<<18];
ll sum[1<<18];
ll dp[1<<18];
ll n;
int main(){
	cin>>n;
	for(ll i=0;i<n;i++) {
		cin>>dat[i];
		if(i>=2 and i%2==0) sum[i]=dat[i]+sum[i-2];
		else if(i==0) sum[i]=dat[i];
	}
	for(ll i=0;i<n;i++){
		if(i&1){
			dp[i]=max(dp[i-2]+dat[i] , sum[i-1]);
		}
		else{
			dp[i]=max(dp[i-2]+dat[i] , dp[i-1]);
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 8280
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
// scanf
#pragma warning(disable: 4996)
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// 丸め
#define _round(v) round(v)
// 2乗 / 3乗  default_value:初期値
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)

int main()
{
	int32_t a, b;
	cin >> a >> b;

	cout << _round((float)(a + b)/2);

	return 0;
	//	std::cout << "Hello World!\n"; 
}

Measured memory_bytes: 256