akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;
	string s;
	cin>>n>>s>>k;
	rep(i,s.size()){
		cout<<((s[k-1]==s[i])?s[k-1]:'*');
	}
	cout<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 100


int n , c , d;
	d=0;
int pre[1000] , in[1000],post[1000];

int find(int x)
{
	int i;
	for(i = 0; i < n; i++)
	{
		if(x == in[i]) 
		{
			return i;
		}
	}
	return 0;
}

void rec(int l,int r)
{
	int a,b;
	if(l >= r) return;
	a = pre[d++];
	b = find(a);
	rec(l,b);
	rec(b+1,r);
	post[c++] = a;
}



int main(void)
{
	int j;
	scanf("%d",&n);
	
	for(j = 0; j < n; j++)
	{
		scanf("%d",&pre[j]);
	}
	
	for(j = 0; j < n; j++)
	{
		scanf("%d",&in[j]);
	}
	
	rec(0,n);
	
	for(j = 0; j < n; j++)
	{
		if(j != n-1)
		{
			printf("%d ",post[j]);
		}
		else 
		{
			printf("%d\n",post[j]);
		}
	}
	
	return 0;
}



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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int y, m, d;
  char a, b;
  cin >> y >> a >> m >> b >> d;
  string ans;
  if(m>4) ans = "TBD";
  else ans = "Heisei";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3568
import * as fs from 'fs';

namespace AtCoder.abc163 {

    export class Program {

        constructor(private readonly args: string[]) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const r :number = parseInt(this.args[0],10);
            console.log((r*2)*Math.PI);
        }
    }
}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const prg: AtCoder.abc163.Program = new AtCoder.abc163.Program(args);
prg.main();


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

int main() {
    long long a, b;

    cin >> a >> b;
    
    if (a <= 0 && b >= 0) {
        cout << "Zero" << endl;
    } else if (a > 0) {
        cout << "Positive" << endl;
    } else {
        if ((b-a+1) % 2 == 0) {
            cout << "Positive" << endl;
        } else {
            cout << "Negative" << endl;
        }
    }
}


Measured memory_bytes: 256
#include <stdio.h>
 
#define M 1000000007
 
 
unsigned long long power(int m, int n) {
    unsigned long long x;
    if (n == 0) return 1;
    if (n % 2) {
        x = power(m, n-1);
        return (x * m) % M;
    }
    else {
        x = power(m, n/2);
        return (x * x) % M;
    }
}
 
int main() {
    int m, n, i;
    unsigned long long x;
 
    scanf("%d %d", &m, &n);
 
    printf("%llu\n", power(m, n));
 
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 55;
int N, P, a[MAX];
LL dp[MAX][2];

int main(void) {
    scanf("%d%d", &N, &P);
    REP(i, N) {
        scanf("%d", a + i);
    }
    dp[0][0] = 1;
    REP(i, N) {
        REP(j, i + 1) {
            REP(k, 2) dp[i + 1][(k + a[j]) % 2] += dp[j][k];
        }
    }
    cout << dp[N][P] * 2 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner stdInt = new Scanner(System.in);

  int[][] ans = new int[300][2]; //int[][] の方にh,w代入
  int i = 0;
    while(true) {
      int h, w;
      h = stdInt.nextInt();
      w = stdInt.nextInt();
      if (h == 0 && w == 0) break;
      ans[i][0] = h;
      ans[i++][1] = w;
    }

    for (int j = 0; j < i; j++) {
      for (int k = 0; k < ans[j][0]; k++) {
        for (int l = 0; l < ans[j][1]; l++) {
          System.out.print("#");
        }
        System.out.println();
      }
      System.out.println();
    }
  }
}


Measured memory_bytes: 35144
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}

int N,A,B,C;
vi L;
int ans;
void dfs(int n, int a, int b, int c, int cost) {
    if (n >= N) {
        if (a>0 and b>0 and c>0) {
            ans = min(ans, cost+ abs(A-a) + abs(B-b) + abs(C-c));
        }
        return;
    }

    REP(i,4) {
        if (i == 1) {
            if (a == 0)
                dfs(n+1, a+L[n], b, c, cost);
            else
                dfs(n+1, a+L[n], b, c, cost+10);
        } else if (i == 2) {
            if (b == 0)
                dfs(n+1, a, b+L[n], c, cost);
            else
                dfs(n+1, a, b+L[n], c, cost+10);
        } else if (i == 3) {
            if (c == 0)
                dfs(n+1, a, b, c+L[n], cost);
            else
                dfs(n+1, a, b, c+L[n], cost+10);
        } else {
            dfs(n+1, a, b, c, cost);
        }
    }
}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    cin>>N>>A>>B>>C;
    L = vi(N); REP(i,N) cin>>L[i];

    ans = INF;
    dfs(0, 0, 0, 0, 0);

    cout << ans << endl;


    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end

struct RMQ{
    int n; vector<ll> dat,laz;
    RMQ(){}
    RMQ(int n_){init(n_);}
    void init(int n_){
        n=1; while(n<n_) n*=2;
        dat.clear(); dat.resize(2*n-1,INF);
        laz.clear(); laz.resize(2*n-1,-INF);
    }
    inline void eval(int len,int k){
        if(laz[k]==-INF) return;
        if(k*2+1<n*2-1)laz[k*2+1]=laz[k],laz[k*2+2]=laz[k];
        dat[k]=laz[k];laz[k]=-INF;
    }
    ll update(int a,int b,ll x,int k,int l,int r){
        eval(r-l,k);
        if(r<=a||b<=l) return dat[k];
        if(a<=l&&r<=b) return laz[k]=x;
        eval(r-l,k);
        dat[k]=min(update(a,b,x,k*2+1,l,(l+r)/2),
        update(a,b,x,k*2+2,(l+r)/2,r));
        return dat[k];
    }
    void update(int a,int b,ll x){update(a,b,x,0,0,n);}
    ll query(int a,int b,int k,int l,int r){
        eval(r-l,k);
        if(r<=a||b<=l) return INF;
        if(a<=l&&r<=b) return dat[k];
        return min(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
    }
    ll query(int a,int b){return query(a,b,0,0,n);}
};

int main(){
    int n,k; scanf("%d%d",&n,&k);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    RMQ seg1(n),seg2(n);
    rep(i,0,n){
        seg1.update(i,i+1,a[i]);
        seg2.update(i,i+1,-a[i]);
    }
    int sum[200010]={};
    rep(i,0,n-1)sum[i+1]=(a[i]>a[i+1]);
    rep(i,0,n)sum[i+1]+=sum[i];
    int ans=0; bool f=0;
    rep(i,0,n-k+1){
        if(sum[i]==sum[i+k-1]){
            f=1; continue;
        }
        if(i&&seg1.query(i-1,i+k-1)==a[i-1]&&seg2.query(i,i+k)==-a[i+k-1])continue;
        ans++;
    }
    printf("%d",ans+f);
    return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===

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

	set<char> charset;
	for (const auto& c : s) charset.insert(c);

	int s_size = static_cast<int>(s.size());
	int ans = 1001001001;
	for (auto itr = charset.begin(); itr != charset.end(); ++itr) {
		int last = -1;
		int cnt_tmp = 0;
		int cnt = 0;
		for (int i = 0; i < s_size; ++i) {
			if (s[i] == *itr) {
				cnt = max(cnt, cnt_tmp);
				cnt_tmp = 0;
				last = i;
			}
			else {
				++cnt_tmp;
			}
		}
		cnt = max(cnt, s_size - last - 1);
		ans = min(ans, cnt);
	}

	cout << ans << endl;
}

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

int main()
{   
    int N,T;
    int c[1010],t[1010];
    int c_min = 100000;
    scanf("%d%d",&N,&T);
    for(int i=0;i<N;i++){
        scanf("%d%d",&c[i],&t[i]);
        if( t[i] <= T ){
            if( c[i] < c_min ){
                c_min = c[i];
            }
        }
    }
    
    if( c_min == 100000 ){
        printf("TLE\n");
        return 0;
    }

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

Measured memory_bytes: 128
S = input()
MAE = int(S[0:2])
ATO = int(S[2:4])
if MAE >= 1 and MAE <= 12 and ATO >= 1 and ATO <= 12:
    print('AMBIGUOUS')
elif MAE >= 1 and MAE <= 12:
    print('MMYY')
elif ATO >= 1 and ATO <= 12:
    print('YYMM')
else:
    print('NA')

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

int main() {
  int n, next = 0, ans = 0;
  cin >> n;
  vector<int> b(n), c(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> b.at(i);
  }
  for (; ans < n; ans++) {
    c.at(next)++;
    if (c.at(next) == 2) {
      ans = -1;
      break;
    }
    next = b.at(next) - 1;
    if (next == 1) {
      ans += 1;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    string s, t;
    cin >> s >> t;
    bool ans = false;
    for(int i=0; i<s.length(); i++)
    {
        bool lans = true;
        for(int j=0; j<s.length(); j++)
        {
            if(s.at(j) != t.at(j)) lans = false;
        }
        if(lans)
        {
            ans = true;
            break;
        }
        char c = s.back();
        s.pop_back();
        s.insert(s.begin(), c);
    }
    cout << (ans?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	char a[10],b[10],c[10];
	int len,lon,lan;
	scanf("%s %s %s",a,b,c);
	len=strlen(a);
	lon=strlen(b);
	lan=strlen(c);
	if(a[len-1]==b[0] && b[lon-1]==c[0]){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
program main
    implicit none
    integer n,i,ans
    real(8) x,y,d
    read(*,*)n,d
    ans=0
    do i=1,n
        read(*,*)x,y
        if(sqrt(x**2+y**2)<=d)then
            ans=ans+1
        endif
    enddo
    write(*,*)ans
end program main


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for(int a = 0; a <= A; ++a) {
    for(int b = 0; b <= B; ++b) {
      for(int c = 0; c <= C; ++c) {
        if(X == a * 500 + b * 100 + c * 50) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int H,R,ans,z;
	scanf("%d %d",&H,&R);
	z=abs(H);
	if(H<0&&z==R){
		printf("0\n");
	}
	else if(H<-1*R){
		printf("-1\n");
	}
	else {
		printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 1824
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    ll N, W; cin >> N >> W;
    vl w(N+1,0);
    vl v(N+1,0);
    FOR(i,1,N+1) cin >> w[i] >> v[i];

    ll WMIN = LINF;
    FOR(i,1,N+1) WMIN = min(WMIN, w[i]);    

    vi r(N+1,0);
    FOR(i, 1, N + 1) r[i] = w[i] - WMIN;

    const ll RMAX = 400;
    vector<vvl> dp(N+MGN, vvl(N+MGN, vl(RMAX+MGN, 0)));
    dp[0][0][0] = 0;

    FOR(i,1,N+1) {
        FOR(j,1,i+2) {
            for (ll k = 0; k <= RMAX; k++) {  
                ll next = (k >= r[i]) 
                    ? dp[i - 1][j - 1][k - r[i]] + v[i] : 0;
                dp[i][j][k] = max(next, dp[i - 1][j][k]);
            }
        }
    }

    ll ans = 0;
    for (ll j = 1; j <= N; j++) {
        if (WMIN * j <= W) {
            ans = max(ans, dp[N][j][min(RMAX, W - WMIN*j)]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 38272
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
int N;
int A[100100];
int main(){
	cin >> N;
	int cnt = 0;
	for(int i=0;i<N;i++){
		cin >> A[i];
		if(A[i]%2==1)cnt++;
	}
	if(cnt%2==0)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int n,m;
const int inf=1e18;
#define x first
#define y second
bool ok(int i,int j)
{
	return (i>=0 and i<n and j>=0 and j<m);
}
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};
char a[1001][1001];
int d[1001][1001];
int32_t main()
{
	n=in();m=in();
	queue<pair<int,int>> q;
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	{
		cin>>a[i][j];
		if(a[i][j]=='#'){d[i][j]=0;q.push({i,j});}
		else d[i][j]=inf;
	}
	while(!q.empty())
	{
		auto p=q.front();
		q.pop();
		for(int k=0;k<4;k++)
		{
			int u=p.x+dx[k],v=p.y+dy[k];
			if(!ok(u,v))continue;
			if(d[u][v]!=inf)continue;
			d[u][v]=d[p.x][p.y]+1;
			q.push({u,v});
		}
	}
	
	int ans=0;
	for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)ans=max(ans,d[i][j]);
	assert(ans!=inf);cout<<ans;	
}


Measured memory_bytes: 28476
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

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

// ABC102-B - Maximum Difference
int main()
{
    int N;
    cin >> N;

    vector<int> A;
    RPT(N) {int tmp; cin >> tmp; A.push_back(tmp);}

    int max_sa = 0;
    for (int i = 0; i < N - 1; i++) 
    {
        for (int j = i + 1; j < N; j++) 
        {
            max_sa = (abs(A[i] - A[j]) > max_sa) ? abs(A[i] - A[j]) : max_sa;
        }
    }

    cout << max_sa << endl;

    return 0;
}


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

int check(char *grid){
  char g1[] = "#...";
  char g2[] = ".###";
  char g3[] = "...#";
  char g4[] = "###.";
  
  if(!strncmp(grid, "#...", 4) || !strncmp(grid, ".###", 4)) return 1;
  if(!strncmp(grid, "...#", 4) || !strncmp(grid, "###.", 4)) return -1;
  return 0;
}

int main(){
  int H, W;
  while(cin >> H >> W){
    H += 2; W += 2;
    vector<vector<char> >G(H, vector<char>(W, '.'));
    for(int i=1;i<H-1;i++){
      for(int j=1;j<W-1;j++){
	cin >> G[i][j];
      }
    }
    // for(int i=0;i<H;i++){
    //   for(int j=0;j<W;j++){
    // 	cout << G[i][j];
    //   }
    //   cout << endl;
    // }
    vector<pair<double, int> >E;
    for(int i=0;i<H-1;i++){
      for(int j=0;j<W-1;j++){
	char g[4];
	g[0] = G[i][j];
	g[1] = G[i][j+1];
	g[2] = G[i+1][j];
	g[3] = G[i+1][j+1];
	int c = check(g);
	// cout << g << " " << c << endl;
	if(c){
	  E.push_back(make_pair(atan2(H-2-i, j), c));
	}
      }
    }

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

    int result = 2;
    int cnt = 1;
    // cout << E.size() << endl;
    for(const auto &e: E){
      cnt += e.second;
      result = max(result, cnt);
    }

    cout << result << endl;
  }
  return 0;
}



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

int main(){
  int n, d, x;
  cin >> n >> d >> x;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    x += (d + a - 1)/a;
  }
  cout << x << endl;
}

Measured memory_bytes: 3584
def f(n):
    if n == 1:
        return 1
    else:
        return n * f(n - 1)

n = int(input())
X = []
Y = []
for i in range(n):
    x, y = map(int,input().split())
    X.append(x)
    Y.append(y)

total = 0
for i in range(n):
    for j in range(n):
        total += ((X[i] - X[j])**2 + (Y[i] - Y[j])**2)**0.5

print(total/n)



Measured memory_bytes: 9312
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] mass = new char[H+2][W+2];
		for( int i=0; i<=H+1; i++ ){
			for( int j=0; j<=W+1; j++ ){
				mass[i][j] = '?';
			}
		}
		for( int i=1; i<=H; i++ ){
			String ss = sc.next();
			for( int j=1; j<=W; j++ ){
				mass[i][j] = ss.charAt(j-1);
			}
		}
		loop:for( int i=1; i<=H; i++ ){
			for( int j=1; j<=W; j++ ){
				if( mass[i][j]=='#' ){
					if( mass[i-1][j]!='#' && mass[i+1][j]!='#' && mass[i][j-1]!='#' && mass[i][j+1]!='#' ){
						System.out.println("No");
						break loop;
					}
				}
			}
			if( i==H ){
				System.out.println("Yes");
				break loop;
			}
		}
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<21

using namespace std;

int change(char c)
{
	if('a' <= c && c <= 'f') return int(c-'a') + 10;
	else return int(c-'0');
}

int main()
{
	string N[8] = {"black","blue","lime","aqua","red","fuchsia","yellow","white"};

	int c[8][3] = {{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0,},{255,255,255}};

	string s;
	while(cin >> s)
	{
		if(s == "0") break;
		
		int r = 0,g = 0,b = 0;

		r += change(s[1])*16 + change(s[2]);
		g += change(s[3])*16 + change(s[4]);
		b += change(s[5])*16 + change(s[6]);
		
		double ans = INF;
		rep(i,8)
		{
			double temp = sqrt(	(c[i][0]-r)*(c[i][0]-r) + (c[i][1]-g)*(c[i][1]-g) + (c[i][2]-b)*(c[i][2]-b));
			ans = min(ans,temp);
		}

		rep(i,8)
		{
			double temp = sqrt(	(c[i][0]-r)*(c[i][0]-r) + (c[i][1]-g)*(c[i][1]-g) + (c[i][2]-b)*(c[i][2]-b));
			if(temp == ans)
			{
				cout << N[i] << endl;
			}
		}
	}
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}

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

int N, M, Q;
vector<int> a, b, c, d;
ll ans = 0;
void dfs(vector<int> &A, int tmp) {
  if(A.size() == N) {
    ll tmp = 0;
    REP(i, Q) {
      if(A[b[i] - 1] - A[a[i] - 1] == c[i]) {
        tmp += d[i];
      }
    }
    if(ans < tmp) ans = tmp;
    return;
  }

  for(int i = tmp; i <= M; ++i) {
    A.push_back(i);
    dfs(A, i);
    A.pop_back();
  }
}

int main() {
  cin >> N >> M >> Q;
  a.resize(Q); b.resize(Q); c.resize(Q); d.resize(Q);
  REP(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];
  vector<int> A;
  dfs(A, 1);
  cout << ans << endl;
}

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

int main() {
  int w,h,n,ans=0;
  cin >> w >> h >> n;
  vector<vector<int>> vec(h,vector<int>(w));
  for(int i=0; i<n; i++) {
    int x,y,a;
    cin >> x >> y >> a;
    if(a == 1) {
      for(int j=0; j<h; j++) {
        for(int k=0; k<x; k++) vec[j][k] = 1;
      }
    }
    else if(a == 2) {
      for(int j=0; j<h; j++) {
        for(int k=x; k<w; k++) vec[j][k] = 1;
      }
    }
    else if(a == 3) {
      for(int j=0; j<y; j++) {
        for(int k=0; k<w; k++) vec[j][k] = 1;
      }
    }
    else if(a == 4) {
      for(int j=y; j<h; j++) {
        for(int k=0; k<w; k++) vec[j][k] = 1;
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(vec[i][j] == 0) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val inputs = Array(N) {
        val A = nextInt()
        Array(A) {
            val (x, y) = nextIntList()
            intArrayOf(x, y)
        }
    }
    val ans = f(0, inputs, IntArray(N + 1) { -1 }, 0)
    println(ans)
}

fun f(n: Int, data: Array<Array<IntArray>>, results: IntArray, cnt: Int): Int {
    if (n >= data.size) return cnt
    val type = results[n + 1]
    return when (type) {
        0 -> {
            f(n + 1, data, results, cnt)
        }
        1 -> {
            val updated_results = update(data[n], results)
            if (updated_results == null) {
                0
            } else {
                f(n + 1, data, updated_results, cnt + 1)
            }
        }
        else -> {
            val skip_results = results.clone()
            skip_results[n + 1] = 0
            val updated_results = update(data[n], results)
            if (updated_results == null) {
                f(n + 1, data, skip_results, cnt)
            } else {
                updated_results[n + 1] = 1
                Math.max(f(n + 1, data, updated_results, cnt + 1), f(n + 1, data, skip_results, cnt))
            }
        }
    }
}

fun update(data: Array<IntArray>, results: IntArray): IntArray? {
    val new_results = results.clone()
    for (d in data) {
        val (x, y) = d
        if (new_results[x] != -1 && new_results[x] != y) return null
        new_results[x] = y
    }
    return new_results
}

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

int main()
{
    int n ,di = 0;
    scanf("%d",&n);
    vector <int> cnt(n);
    for(int a,i=0; i<n; i++)
        scanf("%d",&a) ,cnt[a]++ ,di = max(di ,a);

    cnt[(di+1)/2] -=(di&1 ? 2 : 1);
    bool poss = !cnt[(di+1)/2];
    for(int i=(di+1)/2+1; i<=di; i++)
        poss &= (cnt[i] >= 2);
    for(int i=1; i<=(di+1)/2; i++)
        poss &= !cnt[i];

    printf(poss? "Possible\n" : "Impossible\n");
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

priority_queue<int> l, r;

int q, s, a, b;
ll off = 0;

int main() {
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &s);
		switch (s)
		{
		case 1:
			scanf("%d %d", &a, &b);
			if (!l.empty() && a < l.top()) {
				int c = l.top(); l.pop();
				off += c - a;
				l.emplace(a);
				l.emplace(a);
				r.emplace(-c);
			}
			else if (!r.empty() && -r.top() < a) {
				int c = -r.top(); r.pop();
				off += a - c;
				l.emplace(c);
				r.emplace(-a);
				r.emplace(-a);
			}
			else {
				l.emplace(a);
				r.emplace(-a);
			}
			off += b;
			break;
		case 2:
			printf("%d %lld\n", l.top(), off);
			break;
		default:
			break;
		}
	}
}

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

const int mod = 1e9 + 7;
const int N = 1000010;
int dp[N][2][2];

signed main() {
  int n;
  cin >> n;

  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        for (int l = 0; l <= 9; l++) {
          dp[i][j || (l == 0)][k || (l == 9)] += dp[i-1][j][k];
          dp[i][j || (l == 0)][k || (l == 9)] %= mod;
        }
      }
    }
  }

  cout << dp[n][1][1] << '\n';
}


Measured memory_bytes: 34844
S = int(input())


def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1


memo = [0, S]
result = -1

for m in range(2, 1000000):

    a = f(memo[m - 1])
    memo.append(a)

    # print(memo)

    if a in memo[1:m - 1]:
        result = m
        break

print(result)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define reg(i,a,b) for(int i=a;i<=b;i++)
#define reh(i,a,b) for(int i=a;i>b;i--)
#define in(x) scanf("%d",&x)
#define fro freopen("D:\\testdata.in", "r", stdin)
#define il inline
#define lson(q) q<<1
#define rson(q) q<<1|1
using namespace std;
typedef long long ll;
const int mx=2e5+10;
int a[mx];
int b[mx];
int main() {
	int n;
	scanf("%d",&n);
	reg(i,1,n) {
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(a+1,a+n+1);
	reg(i,1,n) {
		printf("%d\n",b[i]!=a[n]?a[n]:a[n-1]);
	}

	return 0;
}




Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll x,y; cin>>x>>y;
    ll ans=INF;
    //o o
    if(-x<=-y) chmin(ans,2+x-y);
    //o x
    if(-x<=y) chmin(ans,1+y+x);
    //x o
    if(x<=-y) chmin(ans,1-y-x);
    //x x
    if(x<=y) chmin(ans,y-x);
    
    cout<<ans<<endl;
}



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

int l[101][101] = {}, u[101][101] = {};

int main(){
    int n, m, d, ans = 0;
    char x;

    cin >> n >> m >> d;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cin >> x;
            if(x == '.'){
                u[i][j] = u[i-1][j]+1;
                l[i][j] = l[i][j-1]+1;
                ans += (l[i][j] >= d) + (u[i][j] >= d);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3164
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace Contest
{
    

    class Program
    {

        static void Main(string[] args)
        {

            var input = Console.ReadLine().Split();
            var x = int.Parse(input[0]);
            var y = int.Parse(input[1]);

            for (int i = 0; i <= x; i++)
            {

                if (i * 2 + (x - i) * 4 == y)
                {
                    Console.WriteLine("Yes");
                    return;
                }

            }

            Console.WriteLine("No");

        }
    }
}




Measured memory_bytes: 27532
#include <stdio.h>
int main(void){
    long long int a, b, v, w, t;
    scanf("%lld %lld", &a, &v);
    scanf("%lld %lld", &b, &w);
    scanf("%lld", &t);
    
    if( a < b ){
        if( (v-w) * t >= b-a ){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    } else {
        if( (v-w) * t >= a-b ){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    
    return 0;
}

Measured memory_bytes: 1616
#include <iostream>
#include <string>
using namespace std;
string s[101];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int h, w;
	cin >> h >> w;
	int w2 = w + 2;
	for (int i = 0; i < h; i++)cin >> s[i];
	for (int i = 0; i < w2; i++)cout << '#';
	cout << '\n';
	for (int i = 0; i < h; i++) {
		cout << '#';
		cout << s[i];
		cout << '#';
		cout << '\n';
	}
	for (int i = 0; i < w2; i++)cout << '#';

}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<set>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;


void max_u(ll&m, ll v)
{
	if(m<v) m=v;
}

using ki_t=pair<ll,ll>;
struct k_t
{
	vector<ki_t> m_ki;
	void add(const ki_t&ki)
	{
		m_ki.push_back(ki);
	}
	ll calc(void)
	{
		if(m_ki.size()==0) return 0;

		vector<ki_t> t;
		t.swap(m_ki);
		sort(t.begin(), t.end());
		m_ki.push_back(t[0]);
		for(int i=1;i<t.size();i++)
		{
			if(m_ki.back().second+1>=t[i].first)
			{
				max_u(m_ki.back().second, t[i].second);
			}
			else
			{
				m_ki.push_back(t[i]);
			}
		}
		ll ret=0;
		for(auto&mm:m_ki)
		{
			ret+=(mm.second-mm.first+1);
		}
		return ret;
	}
};


ll xdiv(ll a, ll b)
{
	if(b<=0) return -9999999999;
	if(a>=0) return a/b;
	a=-a;
	return -((a+b-1)/b);
}


int main(void)
{
	int n, x, d;
	while(scanf("%d%d%d", &n, &x, &d)==3)
	{
		if(d<0) x=-x, d=-d;
		if(d==0)
		{
			printf("%d\n", x==0?1:n+1);
			continue;
		}

		map<int,k_t> m;

		for(ll i=0;i<=n;i++)
		{
			ll y=(ll)x*i;
			ll s=i*(i-1)/2;
			ll t=(n-1)*i-s;
			ll b=xdiv(y, d);
			m[y%d].add(make_pair(b+s, b+t));
		}

		ll ans=0;
		for(auto&mm:m)
		{
			ans+=mm.second.calc();
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 22144
def get_distance(s1, s2):
    dis = 0
    for c1, c2 in zip(s1, s2):
        if c1 != c2:
            dis = dis + 1
    return dis

S = str(input())

S0 = []
for i in range(len(S)):
    if i % 2 == 0:
        S0.append('0')
    else:
        S0.append('1')
S0 = ''.join(S0)

S1 = []
for i in range(len(S)):
    if i % 2 == 0:
        S1.append('1')
    else:
        S1.append('0')
S1 = ''.join(S1)

ans = min(get_distance(S, S0), get_distance(S, S1))
print(ans)


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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()
#define ADD(a, b) a = (a + b) % MOD

int main() {
  int N, M;
  cin >> N >> M;
  vector<bool> ng(N + 10, false);
  REP(i, M) {
    int a;
    cin >> a;
    ng[a] = true;
  }
  ll dp[N + 10];
  REP(i, N + 10) dp[i] = 0;
  dp[0] = 1;
  REP(i, N) {
    if (ng[i]) dp[i] = 0;
    ADD(dp[i + 1], dp[i]);
    ADD(dp[i + 2], dp[i]);
  }
  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
  int N, C;
  int s[100000], t[100000], c[100000];
  int tmp[100000], tt[100000] = {0};

  cin >> N >> C;

  for(int i = 0; i < N; i++)
    cin >> s[i] >> t[i] >> c[i];

  for(int i = 1; i <= C; i++)
  {
    for(int j = 0; j < 100000; j++)
      tmp[j] = 0;
    for(int j = 0; j < N; j++)
      if(c[j] == i)
        for(int k = s[j]; k <= t[j]; k++)
          tmp[k]++;
    for(int j = 0; j < 100000; j++)
      if(tmp[j] > 0)
        tt[j]++;
  }

  int max = 0;
  for(int i = 0; i < 100000; i++)
  {
    if(max < tt[i])
      max = tt[i];
  }

  cout << max << endl;
  return 0;
}


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

int h,w,n,a,ans[111][111],cnt;

int main(){
    cin >> h >> w >> n;
    for(int i = 0;i < n;++i){
        scanf("%d",&a);
        while(a--){
            if((cnt / w) % 2 == 0) ans[cnt/w][cnt%w] = i+1;
            else ans[cnt/w][w-cnt%w-1] = i+1;
            cnt++;
        }
    }
    for(int i = 0;i < h;++i)
        for(int j = 0;j < w;++j)
            printf("%d%c",ans[i][j],j == w - 1 ? '\n' : ' ');

    return 0;
}

Measured memory_bytes: 384
from sys import stdin
import sys
import math

# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A,B = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
# A, B = [str(x) for x in stdin.readline().rstrip().split()]
i=int(input())
print(i*2*math.pi)
# print("YES")
# print("NO")


Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, i;
  int x = 0;
  cin >> N;
  
  for (i = 0; i < N; i++){
  string S;
    cin >> S;
   if (S == "Y"){
      x++;}
  }
  if (x > 0){
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
}
}

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

template <uint32_t mod>
class modint{
    uint64_t value;
public:
    constexpr modint(const int64_t x=0) noexcept: value(x % mod + (x < 0 ? mod : 0)){ }
    constexpr explicit operator uint64_t() const noexcept{ return value; }
    constexpr modint inverse() const noexcept{ return pow(*this, mod-2); }
    constexpr bool operator==(const modint &rhs) const noexcept{ return value == rhs.value; }
    constexpr bool operator!=(const modint &rhs) const noexcept{ return value != rhs.value; }
    constexpr modint operator+() const noexcept{ return modint(*this); }
    constexpr modint operator-() const noexcept{ return modint(mod - value); }
    constexpr modint operator+(const modint &rhs) const noexcept{ return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept{ return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept{ return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept{ return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) noexcept{
        if((value += rhs.value) >= mod) value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) noexcept{ return *this += mod - rhs.value; }
    constexpr modint &operator*=(const modint &rhs) noexcept{
        if((value *= rhs.value) >= mod) value %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) noexcept{ return *this *= rhs.inverse(); }
    constexpr modint operator++(int) noexcept{
        modint ret(*this);
        if((++value) >= mod) value -= mod;
        return ret;
    }
    constexpr modint operator--(int) noexcept{
        modint ret(*this);
        if((value += mod - 1) >= mod) value -= mod;
        return ret;
    }
    constexpr modint &operator++() noexcept{ return *this += 1; }
    constexpr modint &operator--() noexcept{ return *this -= 1; }
    friend std::ostream &operator<<(std::ostream &os, const modint<mod> &x){ return os << x.value; }
    friend std::istream &operator>>(std::istream &is, modint<mod> &x){
        int64_t i;
        is >> i;
        x = modint<mod>(i);
        return is;
    }
    friend constexpr modint<mod> pow(const modint<mod> &x, uint64_t y){
        modint<mod> ret{1}, m{x};
        while(y > 0){
            if(y & 1) ret *= m;
            m *= m;
            y >>= 1;
        }
        return ret;
    }
};
constexpr int64_t mod = 998244353;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, s;
    cin >> n >> s;
    static int a[3001];
    for(int i=1;i<=n;++i) cin >> a[i];
    static modint<mod> dp[3001][3002];
    dp[0][0] = pow(modint<mod>{2}, n);
    for(int i=1;i<=n;++i){
        for(int j=0;j<=s;++j){
            dp[i][j] += dp[i-1][j];
            if(j + a[i] <= s) dp[i][j+a[i]] += dp[i-1][j] / 2;
        }
    }
    cout << dp[n][s] << endl;

    return 0;
}

Measured memory_bytes: 74016
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<int> h;
    rep(i, n){
        int x;
        cin >> x;
        h.push_back(x);
    }
    h.push_back(0);
    int now, top, ans=0;
    vector<int> res;
    res.push_back(0);
    rep(i, n+1){
      now = res.back();
      while (now > h[i]) {
        res.pop_back();
        top = res.back();
        ans += now - max(top, h[i]);
        now = top;
      }
      if (now < h[i]) {
        res.push_back(h[i]);
      }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if (a>=b) {
    cout<<"delicious"<<endl;
  }
  else if (a<b && x>=b-a) {
    cout<<"safe"<<endl;
  }
  else{
    cout<<"dangerous"<<endl;
  }
}

Measured memory_bytes: 256
// C++(Clang 10.0.0)

//GCC用 ナゾです
//#pragma GCC target("avx")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart(x>=0) -> x<0の時異常終了
#include <numeric>
#include <iterator>
#include <list>
#include <tuple>
#include <queue>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(ll i=(min);i<(max);i++)
#define FOReq(i,min,max) for(ll i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(ll i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(ll i=(max);i>=(min);i--)

#define all(vec) (vec).begin(),(vec).end()

const int MOD=1e9+7;
const int MOD2=998244353;
const int not0=1;
const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2 || not0){;}
    return 0;
}

#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
//#define br printf("\n");
#define br cout<<"\n";
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
#define isdiff5(a,b,c,d,e) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c) and (e)!=(a) and (e)!=(b) and (e)!=(c) and (e)!=(d))
#define Func3(f,a,b,c) (f)((f)((a),(b)),(c))
#define Func4(f,a,b,c,d) (f)((f)((f)((a),(b)),(c)),(d))

inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll samepair(ll x){return x*(x-1)/2;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}
//ans = accumulate(A, A+N, 0, [](int a, int b) {return gcd(a,b);});
//auto count = std::count_if(v.begin(), v.end(), [](int x) { return x == 1 || x == 3; } );

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

//累積和　しゃくとり法　木構造　DP キュー　乱択アルゴリズム　嘘解法　ハッシュ　next_permulation

//課題：DP 木構造　Xor

ll dist(ll i, ll k, ll X, ll Y){
    return min(k-i,abs(X-i)+1+abs(Y-k));
}

ll probNow(){
    ll ans;ans=0;
    ll N,X,Y;
    cin>>N>>X>>Y;
    
    ll ansv[N];
    FOR(i, 0, N){
        ansv[i]=0;
    }
    
    FOReq(i, 1, N-1){
        FOReq(k, 2, N){
            ansv[dist(i,k,X,Y)]++;
        }
    }
    
    FOReq(i, 1, N-1){
        cout<<ansv[i];
        br;
    }
    
    //OutputAndReturn0(0);
    return 0;
}

signed main(){
    cin.tie(0);    //cinとcoutの結び付き解除（cout時にcinの内容を吐き出さなくなる）
    ios::sync_with_stdio(false);  //coutとprintfの結び付き解除（coutとprintfを同時に使うな！）
    probNow();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
n=0
if S.find("W")==-1 or S.find("R")==-1:
  print(0)
else:
  while S.find("W")<S.rfind("R") and S.find("W")>=0:
    S = S[S.find("W")+1:S.rfind("R")]
    n+=1
  print(n)

Measured memory_bytes: 9356
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](long a, long b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<long>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  string s,t;
  cin >> s>>t;
  if(s==t.substr(0,s.size())){cout << "Yes"<<endl;return 0;}
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3596