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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , k;
double a[N];

void solve(int testCase){

    scanf("%d %d" , &n , &k);


    for(int i = 1 ; i <= n ; i ++){
            ll x; scanf("%lld" , &x);
            ll sum = x * (x + 1ll) / 2ll;
            a[i] = 1.0 * sum / x;
    }

    for(int i = 1 ; i <= n ; i ++){
            a[i] += a[i-1];
    }

    double ans = 0.0;
    for(int i = 1 ; i <= n - k + 1; i ++){
            ans = max(ans , a[i + k - 1] - a[i-1]);
    }
    printf("%.6f\n" , ans);
}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
	string S,T="KIHBR";
	cin >> S;
	if(S.size()>=10){
		cout << "NO";
		return 0;
	}
	for (size_t i = 0; i < S.size(); i++)
	{
		if (S.at(i) == 'A') {
			if (i != S.size() - 1 &&S.at(i+1)!='K'&& S.at(i + 1) != 'B'&& S.at(i + 1) != 'R') {
				cout << "NO";
				return 0;
			}
			S.erase(i, 1);
		}
	}
	if (S == T)cout << "YES";
	else cout << "NO";
	
}

Measured memory_bytes: 256
#include <string.h>
#include <stdio.h>
int main(void){
    char a[201];
    char b[201];
    int shuffle,h,i;
     
    while(1){
        scanf("%s",a);
        if(strcmp(a,"-")==0) break;
         
        strcpy(b,a);
         
        scanf("%d",&shuffle);
         
        for(i=0; i<shuffle; i++){
            scanf("%d",&h);
            strcpy(a,&b[h]);
            strncpy(&a[strlen(a)],b,h);
            strcpy(b,a);
        }
         
        printf("%s\n",a);
    }
    return 0;
}


Measured memory_bytes: 2104
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;

int main(int argc, char *args[]) {
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	double ans = (double)w*h / 2;
	int num = 0;
	if (w == x * 2 && h == y * 2) num = 1;
	printf("%.10f %d\n", ans, num);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# いっこ入力
n =int(input())
# n行の複数列ある数値を二次元配列へ。x[n][?]
x = [[i for i in input().split()] for i in range(n)]

answer =0

for i in range(n):
    if x[i][1] == 'BTC':
        answer +=   float(x[i][0]) * 380000.0
    else:
        answer += int(x[i][0])

print(answer)



Measured memory_bytes: 21928
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;
ll n, m, x;
vector<vector<ll>> a;
vector<ll> cost;
ll ans = INF;

int main() {

  cin >> n >> m >> x;
  a.assign(n, vector<ll>(m));
  cost.resize(n);

  rep(i, n) {
    cin >> cost[i];
    rep(j, m) cin >> a[i][j];
  }

  rep(i, 1<<n) {
    vector<ll> score(m, 0);
    ll money = 0;

    rep(j, n) {
      if (i>>j&1) {
        rep(k, m) score[k] += a[j][k];
        money += cost[j];
      }
    }

    bool flg = true;
    rep(i, m) {
      if (score[i] < x) flg = false;
    }
    if (flg) chmin(ans, money);
  }

  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

#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 REP(i,n) rep(i,0,n)
#define RREP(i,n) rrep(i,n,0)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

ll n,m,H;
vector<pair<ll,ll>> G[100010];
ll h[100010];
ll d[100010];

int main(){
  cin >> n >> m >> H;
  REP(i,n) {
    cin >> h[i];
    d[i] = INF;
  }
  REP(i,m) {
    int a,b,c;
    cin >> a >>b >> c;
    a--;b--;
    G[a].pb({b,c});
    G[b].pb({a,c});
  }

  priority_queue<pair<pair<ll,ll>,ll>,vector<pair<pair<ll,ll>,ll>>,greater<pair<pair<ll,ll>,ll>>> pq;
  //タイム，高さ，番号
  d[0] = 0;
  pq.push({{0,H},0});
  while (!pq.empty()) {
    ll tt = pq.top().fi.fi;
    ll hh = pq.top().fi.se;
    ll nn = pq.top().se;
    //cout << nn << " " << tt << " " << hh << endl;
    pq.pop();
    if (tt > d[nn]) continue;
    if (nn == n - 1) {
      cout << h[nn] - hh + tt << endl;
      return 0;
    }
    for (int i = 0; i < G[nn].size(); i++) {
      ll to = G[nn][i].fi;
      ll cost = G[nn][i].se;
      ll mx = h[to] + cost;
      ll mi = cost;

      ll my_h = hh;
      ll my_cost = cost;

      if (h[nn] < mi) continue;
      if (my_h < mi) {
        my_cost += mi - my_h;
        my_h = mi;
      } else if (my_h > mx) {
        my_cost += my_h - mx;
        my_h = mx;
      }
      if (d[to] > my_cost + tt) {
        d[to] = my_cost + tt;
        pq.push({{d[to], my_h - cost}, to});
      }
    }
  }

//REP(i,n) cout << d[i] << " ";
//cout << endl;
  if (d[n-1] == INF) cout << -1 << endl;
  else cout << d[n-1] << endl;
  return 0;
}



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

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++)

long long INF = 1LL<<60;

typedef struct node{
   int p;
}Node;
Node n[100000];
int parent(int x){
    while(n[x].p!=-1){
        x=n[x].p;
    }
    return x;
}
bool same(int x,int y){
    if(parent(x)==parent(y)){
        return true;
    }
    else return false;
}

int main( ){
    int N,Q;
    cin>>N>>Q;
    rep(i,0,N)n[i].p=-1;
    rep(i,0,Q){
        int cmd; cin>>cmd;
        int x,y; cin>>x>>y;
        if(cmd==0){
            if(same(x,y))continue;
            else {
                int yp=parent(y);
                n[yp].p=parent(x);
            }
        }
        else if(cmd==1){
            if(same(x,y))cout<<1<<endl;
            else cout<<0<<endl;
        }
    }
    return 0;
}





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

using namespace std;

typedef long long ll;

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

int main()
{
  int N; scanf("%d", &N);
  vector<int> A(N + 5);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  vector<int> even, odd;
  for (int i = 1; i <= N; ++i) {
    if (i & 1) { odd.push_back(A[i]); }
    else { even.push_back(A[i]); }
  }
  vector<int> ans;
  if (N & 1) {
    reverse(odd.begin(), odd.end());
    ans = vector<int>(odd.begin(), odd.end());
    copy(even.begin(), even.end(), back_inserter(ans));
  }
  else {
    reverse(even.begin(), even.end());
    ans = vector<int>(even.begin(), even.end());
    copy(odd.begin(), odd.end(), back_inserter(ans));
  }
  printf("%d", ans[0]);
  for (int i = 1; i < N; ++i) {
    printf(" %d", ans[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 4716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()

int main() {
    int N;
    cin >> N;
    int td_p, tm_p;
    cin >> td_p;
    int64_t money = 1000;
    int64_t stock = 0;
    
    rep(i, N-1) {
        cin >> tm_p;
        //とりあえず株を全部売却
        money += stock * td_p;
        stock = 0;
        //翌日の株価が値上げしていたら買えるだけ株を買う
        if (td_p < tm_p) {
            stock = int64_t(money / td_p);
            money %= td_p;
        }
        td_p = tm_p;
    }
    money += stock * td_p;
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 3520
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll x;cin >> x;
    ll a[201];
    for(int i=0;i<=200;i++)a[i]=i*i*i*i*i;
    for(int i=0;i<=200;i++)
    {
        for(int j=0;j<=200;j++)
        {
            if(a[i]+a[j]==x)
            {
                cout << i << " " << -j;return 0;
            }
        }
    }
    for(int i=0;i<=200;i++)
    {
        for(int j=0;j<=200;j++)
        {
            if(a[i]-a[j]==x)
            {
                cout << i << " " << j ;return 0;
            }
        }
    }
    }

Measured memory_bytes: 3660
x1, y1, x2, y2 = gets.split.map(&:to_f)
vx = x2 - x1
vy = y2 - y1
rv = Math.sqrt(vx*vx+vy*vy)
#normarize
vx /= rv
vy /= rv
q = gets.to_i
q.times{
  x, y = gets.split.map(&:to_f)
  rp1x = (x-x1)*vx+(y-y1)*vy
  puts "%.12f %.12f" % [rp1x*vx + x1, rp1x*vy + y1]
}

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

int gcd(int a, int b){
    int r = a%b;
    if(r == 0) return b;
    else return gcd(b, r);
}
int main()
{
    int a, b, k;
    int r, j;
    int *arr;
    
    scanf("%d%d%d", &a, &b, &k);
    r = gcd(a,b);
    arr = malloc(sizeof(int) * r);
    for(int i=0;i<r;i++) arr[i] = 0;
    for(int i=1;i<=r;i++){
        if(r%i == 0) arr[i-1] = i;
    }
    j = r-1;
    while(k != 0){
        if(arr[j] != 0) k--;
        j--;
    }
    printf("%d\n", arr[++j]);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
s = input()

ans = 0
sn = len(s)

r = []
if s[0] == "R":
    r.append(1)
else:
    r.append(0)
g = []
if s[0] == "G":
    g.append(1)
else:
    g.append(0)
b = []
if s[0] == "B":
    b.append(1)
else:
    b.append(0)

for i in range(1, sn):
    if s[i] == "R":
        r.append(r[-1] + 1)
        g.append(g[- 1])
        b.append(b[- 1])
    elif s[i] == "G":
        r.append(r[-1])
        g.append(g[-1] + 1)
        b.append(b[- 1])
    elif s[i] == "B":
        r.append(r[-1])
        g.append(g[-1])
        b.append(b[-1] + 1)
    else:
        r.append(r[-1])
        g.append(g[- 1])
        b.append(b[- 1])

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if s[i] != s[j]:
            tmp = dict()
            tmp[s[i]] = 0
            tmp[s[j]] = 0
            target_idx = j + (j - i)

            if tmp.get("B", 1) == 1:
                ans += b[-1] - b[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "B":
                    ans -= 1
            elif tmp.get("G", 1) == 1:
                ans += g[-1] - g[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "G":
                    ans -= 1
            else:
                ans += r[-1] - r[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "R":
                    ans -= 1

print(ans)


Measured memory_bytes: 68888
package main
 
import (
  "fmt"
)

func main() {
  var s string
  fmt.Scan(&s)
  
  ans := "Yes"
  for pos, i := range s {
    if (pos+1) % 2 == 1 && string([]rune{i}) == "L" {
      ans = "No"
      break
    }
    if (pos+1) % 2 == 0 && string([]rune{i}) == "R" {
      ans = "No"
      break
    }
  }
  fmt.Println(ans)
}


Measured memory_bytes: 512
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		Integer[] a = new Integer[n];
		Integer[] b = new Integer[n];
		Integer[] c = new Integer[n];
		for(int i = 0; i < n; i++){
		    a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
		    b[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
		    c[i] = sc.nextInt();
		}
		Arrays.sort(a);
		Arrays.sort(b);
		Arrays.sort(c);
		
		// 計算
		long result = 0;
		for(int i = 0; i < n; i++){
		    int indexA = lowerBound(a, b[i])-1;
		    int indexC = upperBound(c, b[i]);
		    result += (long)(indexA+1)*(n-indexC);
		}
		
		// 出力
		System.out.println(result);
	}
	
	static int upperBound(Integer[] array, int n){
		int index = ~Arrays.binarySearch(array, n, (x,y) -> x.compareTo(y) > 0 ? 1 : -1);
		return index;
	}
	static int lowerBound(Integer[] array, int n){
		int index = ~Arrays.binarySearch(array, n, (x,y) -> x.compareTo(y) >= 0 ? 1 : -1);
		return index;
	}
}



Measured memory_bytes: 102532
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 1000005;
array<ll, MAX_SIZE> fac, inv, finv;
void fac_init() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[0] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    repe(i, 1, MAX_SIZE) finv[i] = finv[i - 1] * (MAX_SIZE - i) % MOD;
    reverse(all(finv));

    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    fac_init();
    ll N, M;
    cin >> N >> M;
    vl A(N), B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    sort(all(A),greater<ll>()), sort(all(B),greater<ll>());
    rep(i,N-1){
        if(A[i]==A[i+1]){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,M-1){
        if(B[i]==B[i+1]){
            cout << 0 << endl;
            return 0;
        }
    }

    ll ai = 0, bi = 0, now = N * M;
    ll ans = 1, ncnt = 0, mcnt = 0;
    while(now){
        ll isa = false, isb = false;
        if (ai < N && now == A[ai]) isa = true, ai++;
        if (bi < M && now == B[bi]) isb = true, bi++;

        if(isa&&isb){
            ncnt++, mcnt++;
        }else if(isa){
            ans *= mcnt;
            ans %= MOD;
            ncnt++;
        }else if(isb){
            ans *= ncnt;
            ans %= MOD;
            mcnt++;
        }else{
            ans *= ncnt * mcnt - (N * M - now);
            ans %= MOD;
        }

        now--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'

ll pow(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){

     
// }

 int k;
 string s;
 cin >> k >> s;
 int n = s.length();
 if(k >= n)cout << s << endl;
 else{
 	string res;
 	fo(i,0,k)res += s[i];
 	res += "...";
 	cout << res << endl;
 }
 

return 0;
}



Measured memory_bytes: 3588
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)]


dic = {}

sum_ = 0
for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1

    sum_ += a


for b, c in BC:
    if b in dic:
        x = dic[b]
    else:
        print(sum_)
        continue

    sum_ += x * (c - b)
    print(sum_)

    if c in dic:
        dic[c] += x
    else:
        dic[c] = x

    dic[b] -= x


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

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        int f;
        int res = 0;
        int c = 0;
        int k = 0;
        for (var i = 1; n >= i; i++)
        {
            c = 0;
            f = i;
            while (f % 2 == 0 && f != 0)
            {
                f /= 2;
                c++;
            }
            if (res <= c)
            {
                res = c;
                k = i;
            }
        }
        Console.WriteLine(k);
    }
}


Measured memory_bytes: 11092
n, m = map(int, input().split())
ans= 0
rs = []
hs = list(map(int, input().split()))
ds = {}
ok = True
for i in range(m):
    a,b = map(int, input().split())
    if(a in ds):
        ds[a].append(b)
    if(b in ds):
        ds[b].append(a)
    if(a not in ds):
        ds[a] = [b]
    if(b not in ds):
        ds[b] = [a]
for i in range(1, n+1):
    if(i not in ds):
        ans +=1
    else:
        for l in ds[i]:
            if(hs[i-1] <= hs[l-1]):
                ok = False
        if(ok):
            ans +=1
        ok = True
print(ans)

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

using namespace std;

int main()
{
  int N; cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) {
    cin >> p[i];
  }

  sort(p.begin(), p.end(), greater<int>());

  int sum = p[0] / 2;
  for (int i = 1; i < N; ++i) {
    sum += p[i];
  }

  cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int N;

int dfs(ll now,int used) {
    if(now > N) return 0;
    int ret = 0;
    if(used == 0b111) ret++;
    ret += dfs(now*10+7,used|(1<<2));
    ret += dfs(now*10+5,used|(1<<1));
    ret += dfs(now*10+3,used|(1<<0));
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    int ans = 0;
    ans += dfs(3,0b001);
    ans += dfs(5,0b010);
    ans += dfs(7,0b100);
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int k=sc.nextInt();
    if(a+k-1>=b-k+1){
      for(int i=a;i<=b;i++){
        System.out.println(i);
      }
    }else{
      for(int i=a;i<a+k;i++){
        System.out.println(i);
      }
      for(int i=b-k+1;i<=b;i++){
        System.out.println(i);
      }
    }
  }
}

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

using namespace std;

#define il inline
#define Rep(i, s, e) for (int i = s; i <= e; ++i)
#define Dep(i, s, e) for (int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)

il int read() {
    int x = 0; bool f = true; char c = getchar();
    while (!isdigit(c)) {if (c == '-') f = false; c = getchar();}
    while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}

int main() {
    printf("%s", read() >= 30 ? "Yes" : "No");
    return 0;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> height(N);
    for(int i=0;i<N;i++){
        cin >> height[i];
    }

    int max_num = 0, num=0;
    for(int i=0;i<N-1;i++){
        if(height[i] >= height[i+1]){
            num++;
        }
        else{
            max_num = max_num < num ? num : max_num;
            num = 0;
        }
    }
    max_num = max_num < num ? num : max_num;

    cout << max_num << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
  for(;;) {
    int n, p;
    cin >> n >> p;
    if(n == 0) break;
    int st[n];
    for(int i = 0; i < n; i++) {
      st[i] = 0;
    }
    int c = 0;
    for(;;) {
      if(p>0) {
        st[c++]++;
        p--;
      } else {
        int nz = 0;
        for(int i = 0; i < n; i++) {
          if(st[i] != 0) nz++;
        }
        if(nz == 1) {
          cout << ((c + n - 1) % n) << endl;
          break;
        }
        p = st[c];
        st[c++] = 0;
      }
      c %= n;
    }
  }
  return 0;
}

Measured memory_bytes: 3068
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
// const long long MOD = (ll)1e6+3;
const long long MAX = (ll)1e5+10;

map<ll,ll> Num;
ll GetN(ll helth) {
    if (Num.count(helth)) return Num[helth];
    else if (helth == 1) {
        Num[1] = 1;
        return Num[1];
    } else {
        ll ne = (ll)(helth/2);
        Num[helth] = GetN(ne) * 2 + 1;
        return Num[helth];
    }
}

int main(void) {
    ll H;
    cin>>H;
    cout<<GetN(H)<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int main(){
  long long int i,n,k,a[20],ans=1000000000000,sum=0,min=0;
  scanf("%lld %lld\n",&n,&k);
  for(i=0;i<n;i++){
    scanf("%lld\n",&a[i]);
  }
  for(int tmp=0;tmp<(1<<n);tmp++){
    int size=0;
    bitset<15> s(tmp);
    for(i=0;i<n;i++){
      if(s[i]==1){
        size++;
      }
    }
    if(size<k){
      continue;
    }
    for(i=0;i<n;i++){
      if(s[i]==1){
        if(a[i]>min){
          min=a[i];
        }
        else{
          sum=sum+(min-a[i]);
        }
        min++;
      }
      else{
        if(a[i]>min){
          min=a[i]+1;
        }
      }
    }
    if(sum<ans){
      ans=sum;
    }
    sum=0,min=0;
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 384
from collections import namedtuple
Node = namedtuple('Node', ['parent', 'children'])
  
class my_binary_tree:
    def __init__(self, N=[]):
        self.T = {}
        for ni in N: self.addNode(ni)
  
    def addNode(self, n):
        p = self.T.get(n[0],Node(-1,[-1,-1])).parent
        self.T[n[0]] = Node(p,n[1:])
        for c in n[1:]:
            if c > -1:  
                cc = self.T.get(c,Node(-1,[-1,-1])).children
                self.T[c] = Node(n[0],cc)
  
    def getParent(self, i): return self.T[i].parent
  
    def getChildren(self, i): return self.T[i].children
  
    def getRoot(self, i=0):
        p = self.T[i].parent
        if p == -1: return i 
        return self.getRoot(p)
  
    def getDepth(self, i):
        if self.T[i].parent == -1: return 0
        return self.getDepth(self.T[i].parent) + 1
  
    def getHeight(self, i):
        c0 = self.T[i].children[0]
        c1 = self.T[i].children[1]
        if c0 + c1 == -2: return 0
        return max( ( 0 if c0 == -1 else self.getHeight(c0) ), \
                    ( 0 if c1 == -1 else self.getHeight(c1) ) )\
               + 1
  
    def getDegree(self, i):
        return int(self.T[i].children[0] != -1) + \
               int(self.T[i].children[1] != -1)
  
    def getNodeType(self, i):
        if self.T[i].parent == -1        : return 'root'
        if sum(self.T[i].children) == -2 : return 'leaf'
        return 'internal node'
  
    def getSibling(self, i):
        p = self.T[i].parent
        if p == -1: return -1
        return sum(self.T[p].children) - i
  
    def getIdList(self): return sorted(self.T.keys())
  
    def getPreorderList(self, i, L=[]):
        c0 = self.T[i].children[0]
        c1 = self.T[i].children[1]
        L.append(i)
        if c0 != -1: self.getPreorderList(c0, L)
        if c1 != -1: self.getPreorderList(c1, L)
        return L
  
    def getInorderList(self, i, L=[]):
        c0 = self.T[i].children[0]
        c1 = self.T[i].children[1]
        if c0 != -1: self.getInorderList(c0, L)
        L.append(i)
        if c1 != -1: self.getInorderList(c1, L)
        return L
  
    def getPostorderList(self, i, L=[]):
        c0 = self.T[i].children[0]
        c1 = self.T[i].children[1]
        if c0 != -1: self.getPostorderList(c0, L)
        if c1 != -1: self.getPostorderList(c1, L)
        L.append(i)
        return L
  
   
if __name__=='__main__':
    n = int(input())
    N = [None]*n
    for i in range(n): N[i] = list(map(int,input().split()))
    tree = my_binary_tree(N)
       
    r = tree.getRoot()
    print("Preorder")
    print("",*tree.getPreorderList(r))
    print("Inorder")
    print("",*tree.getInorderList(r))
    print("Postorder")
    print("",*tree.getPostorderList(r))

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

int i,j,k,n,way[31];

int combi(int n,int m){
	long long int z,s,ans=1;
	s=m;
	if(s>n/2)s=n-s;
	for(z=0;z<s;z++)ans=ans*(n-z);
	for(;s>1;s--)ans=ans/s;
	return (int)ans;
}

int main(){
	for(i=0;i<=30;i++){
		for(j=0;j*2+i<=30;j++){
			for(k=0;k*3+j*2+i<=30;k++){
				way[k*3+j*2+i]+=combi(i+j+k,i)*combi(j+k,j);
			}
		}
	}
	while(scanf("%d",&n)*n)printf("%lld\n",way[n]/3650+(way[n]%3650!=0));
	return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

int getDigitNumber(int n){
  return n > 0 ? 1 + getDigitNumber(n / 10) : 0;
}

int main(int argc, char const *argv[]) {
  while(true){
    int a,b;
    cin >> a >> b;
    if ( cin.eof() ) { break; }
    cout << getDigitNumber(a+b) << endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include <cstdio>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

const int p=1000000007;
int n,m,f[3010][3010][2],g[3010][6010][2],ans;

int main()
{
    scanf("%d%d",&n,&m);
    repu(i,0,n)
        g[0][i][!i]=1;
    repu(i,1,m)
        repu(j,0,n)
            repu(k,0,1)
            {
                if (g[i-1][j][k])
                {
                    if (j)
                        (f[i][j][k || j==1]+=g[i-1][j][k])%=p;
                    if (j<n)
                        (f[i][j+1][k]+=g[i-1][j][k])%=p;
                }
                if (f[i][j][k])
                {
                    if (j)
                        (g[i][j-1][k || j==1]+=f[i][j][k])%=p;
                    (g[i][j][k]+=f[i][j][k])%=p;
                }
            }
    repu(i,0,n)
        (ans+=g[m][i][1])%=p;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 211200
N = int(input())
count_number=0
for i in range((N-105)//2+1):
  count_yakusu=0
  for j in range((2*i+105)//2+1):
    if((2*i+105) % (2*j+1)==0):
      count_yakusu+=1
    else:continue
  if(count_yakusu==8):
    count_number+=1
  else:continue
print(count_number)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    vector <int> graph[100005];
int path( int *dp , int n){
    bool bache=false;
     if(dp[n]!=-1)return dp[n];
     int ans=0;
      for(auto neighbour : graph[n]){
          bache=true;
          ans=max(ans, path(dp,neighbour));
      }
    if(!bache) return dp[n]=0;
    else return dp[n]=ans+1;
}

    
    signed main(){
        int n,m;cin>>n>>m;
     vector<int>demo;
        forr(i,0,m){
            int a,b;cin>>a>>b;
            graph[a].pb(b);
            demo.pb(a);
        }
        int dp[n+1];
        memset(dp,-1,sizeof dp);
         int maxx=0;
         for(auto t : demo){
             if(dp[t]!=-1){
                 maxx=max(maxx,dp[t]);
             }
             else maxx=max(maxx,path(dp, t));
         }
         cout<<maxx;
    }

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

int main() {
    int N;
    cin >> N;
    vector<double> x(N), y(N);
    rep(i, N) cin >> x[i] >> y[i];

    vector<int> v;
    rep(i, N) v.push_back(i);
    double ans = 0;
    do {
        rep(i, N - 1) {
            double dx = x[v[i]] - x[v[i + 1]];
            double dy = y[v[i]] - y[v[i + 1]];
            ans += sqrt(dx * dx + dy * dy);
        }
    } while (next_permutation(v.begin(), v.end()));

    int S = 1;
    rep(i, N) S *= (i + 1);
    ans /= S;
    cout << fixed << setprecision(8) << ans << endl;
}

Measured memory_bytes: 3784
#include<stdio.h>
#include<stdlib.h>
int gcd(int a,int b){return b == 0 ? a : gcd(b, a % b);}
int cmp(const void *a,const void *b){return *(int*)a-*(int*)b;}
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i = 0; i < n; i++)
        scanf("%d",&a[i]);
    qsort(a, n, sizeof(int),cmp);
    int p = a[n - 1];
    int prime[p + 1];
    //printf("%d\n",p);
    for(int i = 1; i <= p; i++)
        prime[i] = 0;
    
    int b = 0;
    //prime[p] = 1;
    //pairwise coprime
    for(int i = 0; i < n; i++){
        int q = a[i];
        // printf("q = %d\n",q);
        if(a[i] == 1)
            continue;
        int j = 2;
        if(prime[q] != 0){
            b = 1;
            break;
        }
        prime[q] = 1;
        while(j * j <= q){
            if(q % j == 0 && (prime[j] != 0 || prime[q / j] != 0)){
                b = 1;
                break;
            }
            if(q % j == 0){
                prime[j] = 1;
                prime[q / j] = 1;
                // printf("%d\n",j);
            }
            j++;
        }
        prime[q] = 1;
        // for(int i = 1; i <= p; i++)
        //     printf("%d ",prime[i]);
        // printf("\n");
    }
    
    if(b == 0){
        puts("pairwise coprime");
        return 0;
    }
    //setwise coprime
    //setwise: ;
    int g = a[0];
    for(int i = 1; i < n; i++)
        g = gcd(g, a[i]);
    if(g == 1){
        puts("setwise coprime");
        return 0;
    }
    puts("not coprime");
    return 0;
}

Measured memory_bytes: 9396
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int height[1005];
	int maxim = 0;
	int sum = 1;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> height[i];
	}

	maxim = height[0];
	for (int i = 1; i < n; i++) {
		if (height[i] >= maxim) {
			sum++;
			maxim = height[i];
		}
	}

	cout << sum << 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;
using ll = long long;
using P = pair<int,int>;

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double theta;
  if (x >= 0.5 * a * a * b) {
    theta = atan(2 * (b / a - x / a / a / a));
  } else {
    theta = atan(a * b * b / 2 / x);
  }
  theta *= 180 / M_PI;
  printf("%.7f\n", theta);
  return 0;
}

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

signed main(){
  double W,H,x,y;cin>>W>>H>>x>>y;
  cout<<W*H/2<<" ";
  if(x==W/2&&y==H/2)cout<<1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
main = do
  s <- getContents
  let v = map (map read . words) . lines $ s
  let w = map solve v
  let x = map (\x-> if x then "YES" else "NO") $ w
  mapM_ putStrLn x

solve::[Double] -> Bool
solve [xa,ya,xb,yb,xc,yc,xd,yd] =
  abs(dot u v)/len(u)/len(v) < eps
  where u = (xb-xa, yb-ya)
        v = (xd-xc, yd-yc)
        dot (a,b) (c,d) = a*c + b*d
        len (a,b) = sqrt(a^2+b^2)
        eps=1e-11

Measured memory_bytes: 4336
N = int(input())
Ss = [int(input()) for _ in range(N)]
n = sum(Ss)
dp = [[False] * (n+1) for i in range(2)]
dp[0][0] = True
for i in range(N):
    x = Ss[i]
    dp[(i+1)%2][:] = dp[i%2][:]
    for j in range(n+1):
        if j+x > n : continue 
        # print(dp[0][j+x],dp[1][j+x])
        dp[(i+1)%2][j+x] = dp[i%2][j] or dp[i%2][j+x]
    # print(dp)

ans = 0
for i in range(n+1):
    if dp[N%2][i] and i%10 != 0:
        ans = i
print(ans)

Measured memory_bytes: 3436
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
  int a[3];
  for(int i=0; i<3; i++) cin >> a[i];
  swap(a[0], a[1]);
  swap(a[0], a[2]);
  cout << a[0] << " " << a[1] << " " << a[2];
}

Measured memory_bytes: 256
import math

i = list(map(int, input().split()))

h = 30*i[2]+(30*i[3]/60)
m = 6 * i[3]

g = abs(h-m)


s = i[0]**2+i[1]**2-2*i[0]*i[1]*math.cos(g*math.pi/180)
a = math.sqrt(s)
print(a)

Measured memory_bytes: 9496
let n, k = Scanf.scanf "%d %d\n" (fun a b -> a, b)
let ds =
  Array.init k (fun _ -> Scanf.scanf "%c " (fun x -> x))
  |> Array.to_list

let rec solve p =
  let s = string_of_int p in
  if List.exists (fun c -> String.contains s c) ds then solve (p + 1)
  else p

let () = solve n |> Printf.printf "%d\n"

Measured memory_bytes: 2560
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();
        for(int i=0; i<H; i++){
            String tmp = sc.next();
            for(int j=0; j<2; j++){
                System.out.println(tmp);
            }
        }
    }
}


Measured memory_bytes: 11088
#include <stdio.h>

int main(){
  long n, a, b;  scanf("%ld %ld %ld", &n, &a, &b);
  long ans = 0;
  if(n <= 2 || a > b){
    if((n==1&&a==b) || (n==2&&a<=b))  ans = 1;
    printf("%ld\n", ans);
    return 0;
  }

  ans = (b - a) * (n - 2) + 1;

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

  return 0;
}


Measured memory_bytes: 1708
from sys import stdin
S = (stdin.readline().rstrip())
a_cnt = S.count("a")
b_cnt = S.count("b")
c_cnt = S.count("c")

d = sorted([a_cnt,b_cnt,c_cnt])
if d[2] - d[0]  <= 1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();

            var yyyy = int.Parse(s.Substring(0, 4));
            var MM = int.Parse(s.Substring(5, 2));
            var dd = int.Parse(s.Substring(8, 2));

            if(yyyy <= 2019 && MM <= 4 && dd <= 30)
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                Console.WriteLine("TBD");
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
fn main() {
    let ab = read_vec::<usize>();
    let ret = if ab[0] == ab[1] {
        ab[0] + ab[1]
    } else if ab[0] > ab[1] {
        ab[0] + (ab[0] - 1)
    } else {
        ab[1] + (ab[1] - 1)
    };
    println!("{}", ret);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

ll gcd(ll x,ll y){
    ll b=max(x,y),s=min(x,y);
    if(s<=0)return b;
    return gcd(s,b%s);
}


int main(){    
    double R;
    cin>>R;
    cout<<setprecision(15)<<R*2.0*3.1415926535<<endl;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e6 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=998244353;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n<0)return 0;if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(),x.end()
#define Return(x) {cout << x << endl; return 0;}

int popcount(int x) {
    if(x == 0) return 0;
    return x % 2 + popcount(x/2);
}

int__ main() {
    fast;
    int n; cin >> n;

    vvi a(n, vi (n, 0));

    for(int i=0;i<n;i++) {
        for(int j=0;j<n;j++) {
            cin >> a[i][j];
        }
    }

    vi dp(1 << n , 0);

    dp[0] = 1;

    const int mod_ = 1e9 + 7;

    for(int i = 0; i < (1 << n) ; i++) {
        int man = popcount(i);

        // try to pair with woman

        for(int j=0;j<n;j++) {
            if((i >> j) & 1) continue;
            if(a[man][j] == 0) continue;
            int mask = (i) ^ (1 << j);
            dp[mask] += dp[i];
            dp[mask] %= mod_;
        }
    }

    cout << dp[(1<<n)-1] << endl;
}

Measured memory_bytes: 16640
a,b,m = map(int,input().split())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = min(a_li) + min(b_li)
for i in range(m):
  x,y,c = map(int,input().split())
  price = a_li[x-1] + b_li[y-1] - c
  if price < cost:
    cost = price
print(cost)


Measured memory_bytes: 24784
#include<bits/stdc++.h>
        using namespace std;
        typedef long long ll;
        ll INF =1e9+7;
        typedef pair<ll,ll> ii;
        #define f(i,a,b) for(long long i = a;i < b;i++)
        #define rf(i,a,b) for(long long i=a;i>=b;i--)
        #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
        #define w(t) while(t--)
        #define c(n); cin>>n;
        #define p(n) cout<<n;
        #define pl(n) cout<<n<<endl;
        #define ps(n); cout<<n<<" ";
        int main(void){
            fastio;
            ll t1,t2,a1,a2,b1,b2;
            c(t1);
            c(t2);
            c(a1);
            c(a2);
            c(b1);
            c(b2);
            ll ans=0;
            if(t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2){
                pl("infinity");
                return 0;
            }
            if(max(a1,b1) == a1 && max(a2,b2) == a2){
                pl(0);
                return 0;
            }
            if(max(a1,b1) == b1 && max(a2,b2) == b2){
                pl(0);
                return 0;
            }
          	if(max(a1,b1) == a1 && t1 * a1 + t2 * a2 > t1 * b1 + t2 * b2){
              pl(0);
              return 0;
            }
          	if(max(a1,b1) == b1 && t1 * a1 + t2 * a2 < t1 * b1 + t2 * b2){
              pl(0);
              return 0;
            }
            ll t = 1;
            ll d = abs((t1 * a1 + t2 * a2) - (t1 * b1 + t2 * b2));
            ans = (t1 * abs(a1-b1))/d;
            if( (t1 * abs(a1-b1)) % d == 0){
                t = 0;
            }
            pl(2*ans+t)
        }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b=0;
  cin>>a;
  for(int i=1;i<=a;i++){
    for(int j=1;j<=a;j++){
      if(i%2==1){
	if(j%2==0) b++;
      }
    }
  }
  cout<<b<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int n, k, arr[200005], m = 0;

int main() {
	fastio; cin >> k >> n;
	FOR(i, 1, n) cin >> arr[i];
	FOR(i, 1, n-1) m = max(m, arr[i+1] - arr[i]);
	m = max(m, arr[1] + k - arr[n]);
	cout << k - m;
}



Measured memory_bytes: 1024
n = int(input())
tarou_point = 0
hanako_point = 0
for _ in range(n):
    tarou_card, hanako_card = input().split()
    for i in range(len(tarou_card)):
        if ord(tarou_card[i]) > ord(hanako_card[i]):
            tarou_point += 3
            break
        elif ord(tarou_card[i]) < ord(hanako_card[i]):
            hanako_point += 3
            break
        else:
            if i == len(tarou_card) - 1 or i == len(hanako_card) - 1:
                if len(tarou_card) > len(hanako_card):
                    tarou_point += 3
                    break
                elif len(tarou_card) < len(hanako_card):
                    hanako_point += 3
                    break
                tarou_point += 1
                hanako_point += 1
print(tarou_point, hanako_point)



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

const static ll MOD = (1e+9)+7;

ll modpow(ll a,ll n){
    if(n==0)return 1;
    if(n%2==1)return a*modpow(a,n-1)%MOD;
    ll t = modpow(a,n/2) % MOD;
    return t*t % MOD;
}



int main(){
    ll n,m,q;cin>>n>>m>>q;
    ll ans = 0;
    vector<vector<ll>> lst(q);
    rep(i,q){
        ll a,b,c,d;cin>>a>>b>>c>>d;
        a--;b--;
        lst[i].push_back(a);
        lst[i].push_back(b);
        lst[i].push_back(c);
        lst[i].push_back(d);
    }
    vector<int> A(10);
    function<void(ll)>go=[&](ll i){
        if(i == n){
            ll tmp=0;
            rep(j,q){
                if(A[lst[j][1]]-A[lst[j][0]] == lst[j][2])tmp+=lst[j][3];
            }
            ans = max(ans,tmp);
            return;
        }
        if(i == 0){
            rep1(j,m){
                A[i]=j;
                go(i+1);
            }
        }else{
            for(int j = A[i-1];j<=m;j++){
                A[i] = j;
                go(i+1);
            }
        }
    };
    go(0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632