akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdint>
#include <cctype>
#include <cassert>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <stdexcept>

const std::string TERMINAL = "01+-*()=";
const std::vector<std::string> OPS = {"+-", "*"};

int parse(const std::string& s, size_t& i, size_t preced=0) {
  if (preced == OPS.size()) {
    if (s[i] == '(') {
      int res = parse(s, ++i, 0);
      if (s[i] != ')') throw std::logic_error("expected: closing parenthesis");
      ++i;
      return res;
    }
    if (s[i] == '-') {
      return -parse(s, ++i, preced);
    }
    if (s[i] == '0') {
      ++i;
      if (isdigit(s[i]))
        throw std::logic_error("expected: leading-zero-free number");

      return 0;
    }
    if (isdigit(s[i])) {
      int res = s[i]-'0';
      while (++i < s.length() && isdigit(s[i]))
        res = res*2 + s[i]-'0';
      return res;
    }
    throw std::logic_error("unexpected token");
  }

  int lhs = parse(s, i, preced+1);
  while (i < s.length()) {
    char op = s[i];
    if (!std::count(OPS[preced].begin(), OPS[preced].end(), op)) break;
    int rhs = parse(s, ++i, preced+1);
    if (op == '+') lhs += rhs;
    if (op == '-') lhs -= rhs;
    if (op == '*') lhs *= rhs;
  }
  return lhs;
}

void validate(const std::string& s) {
  size_t i = 0;
  int lhs = parse(s, i);
  if (s[i] != '=') throw std::logic_error("excepted: equal sign");
  ++i;
  int rhs = parse(s, i);
  if (i != s.length()) throw std::logic_error("expected: EOL");
  if (lhs != rhs) throw std::logic_error("not equal");

  // validated
}

int main() {
  char buf[32];
  scanf("%s", buf);
  std::string s = buf;

  std::set<char> alpha;
  for (char ch: s)
    if (isalpha(ch)) alpha.insert(ch);

  if (alpha.size() > TERMINAL.size())
    return puts("0"), 0;

  std::vector<char> t;
  for (char ch: TERMINAL) t.push_back(ch);
  std::sort(t.begin(), t.end());
  std::set<std::string> eq;
  do {
    std::map<char, char> enc;
    {
      size_t i = 0;
      for (auto it=alpha.begin(); it!=alpha.end(); ++it)
        enc[*it] = t[i++];
    }

    std::string s1 = s;
    for (char &c: s1)
      if (isalpha(c)) c = enc[c];

    try {
      validate(s1);
      eq.insert(s1);
    } catch (std::logic_error&) {
      void(0);
    }
  } while (std::next_permutation(t.begin() ,t.end()));

  printf("%zu\n", eq.size());
}



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


void input(); template<typename First,typename... Rest> void input(First&,Rest&...);
void inputVector(); template<typename First,typename... Rest>  void inputVector(std::vector<First>&,Rest&...);
#define loop(n) for(int i = 0;i < (int)(n);++i)
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define all(vec) (vec).begin(),(vec).end()
#define sort(vec) std::sort(all(vec))
#define rev(vec) std::reverse(all(vec))

void calculate(){

}

int main(int,char**){
    std::string t;
    input(t);
    for(int i = 0;i < (int)t.size();i += 2){
        std::cout << t[i];
    }
    std::cout << '\n';
}


void input(){return;}
template<typename First,typename... Rest>
void input(First &first,Rest&... rest){
    std::cin >> first;
    input(rest...);
}

void inputVector(){return;}
template<typename First,typename... Rest> 
void inputVector(std::vector<First> &first,Rest&... rest){
    int N = first.size();
    for(int i = 0;i < N;i++){
        std::cin >> first[i];
    }
    inputVector(rest...);
}

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

int main() {
  long N,M;
  cin>>N;
  for(int i=0;i<=N;i++){
    if(i*(i+1)/2>=N){
      M=i;
      break;
    }
  }
  for(int i=1;i<=M;i++){
    if(i==M*(M+1)/2-N){
      continue;
    }
    cout<<i<<endl;
  }
  
  
}

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

int main(){
    int n, m; cin >> n >> m;
    priority_queue<int> pq;
    rep(i,n){
        int v; cin >> v;
        pq.push(v);
    }
    
    rep(i,m){
        int b = pq.top() / 2; pq.pop();
        pq.push(b);
    }

    ll ans = 0; 
    while( !pq.empty() ) {
        ans += pq.top(); pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
S = input()

if S =="SUN":
  print(7)
elif S =="MON":
  print(6)
elif S =="TUE":
  print(5)
elif S =="WED":
  print(4)
elif S =="THU":
  print(3)
elif S =="FRI":
  print(2)
elif S =="SAT":
  print(1)

Measured memory_bytes: 2940
#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    num = 1
    count = 0

    for i in a:
        if i != num:
            count += 1
        else:
            num += 1
    
    if count == N:
        count = -1
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26356
#include <stdio.h>
#include <math.h>

int main(void)
{
	int D, N, a;

	scanf("%d %d", &D, &N);

	if(N != 100)
	{
		a = N*pow(100, D);
		printf("%d", a);
	}
	else if(N == 100)
	{
		a = (N+1)*pow(100, D);
		printf("%d", a);
	}	
}

Measured memory_bytes: 128
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
MOD = 10 ** 9 + 7

ans = 0

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

N2 = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N2 + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

#print(cmb(n, r, p))
for i in range(len(A)):
  if N - 1 - i >= K - 1:
    ans += (A[- i - 1] - A[i]) * cmb(N - 1 - i, K - 1, MOD)
    ans = ans % MOD
    
    
print(ans % MOD)


Measured memory_bytes: 127420
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,d;
    cin >> n>>d;
    int count=0;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin >> x>>y;
        if(sqrt(x*x+y*y)<=d)
        {
            count++;
        }
    }
    
    cout << count;
} 


Measured memory_bytes: 3672
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,m;
    cin >> a >> b >> m;
    ll ans = LLINF;
    ll mina = LLINF;
    ll minb = LLINF;
    vll ai(a);
    vll bi(b);
    REP(i,a){
        cin >> ai[i];
        mina = min(mina,ai[i]);
    }
    REP(i,b){
        cin >> bi[i];
        minb = min(minb,bi[i]);
    }
    ans = mina+minb;
    REP(i,m){
        ll x,y,c;
        cin >> x >> y >> c;
        x--;
        y--;
        ans = min(ai[x]+bi[y]-c,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <time.h>
#include <chrono>
#include <random>
//#include <math.h>
#include <cmath>
#include <fstream>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <stdlib.h>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <bitset>

#pragma comment(linker, "/STACK:36777216")
using namespace std;

#define flu fflush(stdout)
#define gg return 0
#define mp make_pair

typedef long double ptype;

long long mod = /*27449*//*998244353*/ /*1e9 + 7*/998244353 /*1e9 + 9*/;
int inf = 1e9;
double eps = 1e-7;
long double pi = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ifstream in("input.txt");
ofstream out("output.txt");

int used[100010];

void solve()
{
	long long n;
	cin >> n;
	long long x, m;
	cin >> x >> m;
	long long cur = x;
	int id = 1;
	vector<int> vals;
	vals.push_back(0);
	int cyclelen = 0;
	int start = 1;
	while (1)
	{
		if (used[cur] != 0)
		{
			start = used[cur];
			cyclelen = id - used[cur];
			break;
		}
		used[cur] = id;
		vals.push_back(cur);
		cur = cur * cur % m;
		id++;
	}
	long long ans = 0;
	for (int i = 1; n > 0 && i < start; i++, n--)
	{
		ans += vals[i];
	}
	long long cyclesum = 0;
	for (int i = start; i < vals.size(); i++)
	{
		cyclesum += vals[i];
	}
	ans += n / cyclelen * cyclesum;
	n %= cyclelen;
	for (int i = 0; i < n; i++)
	{
		ans += vals[start + i];
	}
	cout << ans;
}

int main()
{
	cout << setprecision(20) << fixed;
	cin.tie();
	cout.tie();
	clock_t t1 = clock();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int t;
	//cin >> t;
	t = 1;
	while (t--) {
		solve();
		//test();
	}
	//cout << (clock() - t1) * 1.0 / CLOCKS_PER_SEC;
	gg;
}

Measured memory_bytes: 4160
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define mod 1000000007LL
#define eps 0.0001
#define pi acos(-1)
#define INF 10000000000000000

#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // ---------------------
    // コーディング開始
    // ---------------------
    int n , m;
    cin >> n >> m ;
    int i,j;
    string a;
    string line[n];


    rep (i,n){
        line[i]="#";
        cin >> a;
        line[i]+=a;
        line[i]+="#";
    }
    string hoge = "";
    rep(i,m+2){
        hoge+="#";
    }

    pri(hoge);
    rep (i,n){
        pri(line[i]);
    }

    pri(hoge);


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define mod 1e9
int a[200005],b[200005];
int32_t main() {
	int n;
	cin>>n;
	int i;
	for(i=0;i<n;i++)
	{	cin>>a[i];
		b[i]=a[i];
	}
	sort(a,a+n);
	for(i=0;i<n;i++)
	{
		if(a[n-1]==b[i])
			cout<<a[n-2]<<"\n";
		else cout<<a[n-1]<<"\n";
	}
}
						

Measured memory_bytes: 4736
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode('c${rg(Qbk;6n!V*A8ul{!K_BJEm?@{7xn?pm|6-nE3KA-?(cVNnbc{Y$~}j3&po#jU_Z9jDg#MX)zOM?CGWY+U*c$T!T8A<x@EfA3(2?CRBb-{ENN@ws5H76c=J6qR7x&^iDs{jg}p&hK9Ho?v3Y9?p)YvFEvu;^NEFJJal{H<g4C*7zb)`AH&6^k#PK(kq@Z*qWEMw&=K}2rFvwxy%f}jh!g3(FvqNy`mZW1@l!&b0^*w`~;q-e%oEn2?ST10SoEdUFXt?c+0yg;SwJ3lVMdDltayE0iHtF36SmmGsOT}7jV4A}zu;ac3Ji<%_SwP!0UjEMTp74Kk0UxjkdbLj2H4J;r#$Lf-Z4kI}A-K>99L6h7X$f=$`ZziYTVI(fwLw*(hTSJB&3rr<<C1uZ^gi{F29E7tzp>QamipTguGD73gG!zrWbvh*$T`A3#WlK1mj-+;Tkb7(-eQm7FR^{mdj')))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 12944
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int N = (int) 1e5 + 100;
long long answer[N];

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    int n, q;
    scanf("%d%d", &n, &q);

    vector <long long> v;
    v.push_back(1);
    v.push_back(n);

    bool has1 = false;
    for (int i = 0; i < q; i++)
    {
        long long x;
        scanf("%lld", &x);
        if (x == 1)
            has1 = true;
        while (!v.empty() && x <= v.back())
            v.pop_back();
        v.push_back(x);
    }

    if (has1)
    {
        printf("%lld\n", v.back());
        for (int i = 2; i <= n; i++)
            printf("0\n");
        return 0;
    }

    vector <long long> dp;
    dp.resize(v.size(), 0);
    dp.back() = 1;

    for (int i = (int) v.size() - 1; i > 0; i--)
    {
        long long x = v[i];
        //eprintf("i = %d, x = %lld\n", i, x);
        long long curdp = dp[i];
        while (x > 0)
        {
            int it = lower_bound(v.begin(), v.end(), x) - v.begin();
            if (it > 0 && v[it] >= x)
                it--;
            long long y = v[it];
            long long k = x / y;
            eprintf("x = %lld, y = %lld, curdp = %lld\n", x, y, curdp);

            if (it == 0)
                answer[x] += curdp;
            else
                dp[it] += curdp * k;
            
            x = x % y;
        }
    }

    for (int i = n; i >= 1; i--)
        answer[i - 1] += answer[i];


    
    
    for (int i = 1; i <= n; i++)
        printf("%lld\n", answer[i]);

    //eprintf("sz = %d\n", sz);

	return 0;
}




Measured memory_bytes: 4212
#include <iostream>
#include <memory.h>
//#include <limits.h>
//#include <math.h>
//#include <stdio.h>
//#include <stdlib.h>
//#include <algorithm>
using namespace std;

char map[51][51];

bool check(int x, int y)
{
    return map[x][y] == '#';
}

int main()
{
    memset(map, '.', sizeof map);
    int n, m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>map[i][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(map[i][j] == '.')
                map[i][j] = '0' + check(i-1, j-1) + check(i-1, j) + check(i-1, j+1) + check(i, j-1) + check(i, j+1) + check(i+1, j-1) + check(i+1, j) + check(i+1, j+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cout<<map[i][j];
        }
        cout<<endl;
    }
	return 0;
}

Measured memory_bytes: 256
n = int(input())

a = list(map(int,input().split()))
a.sort(reverse=True)

if a[-1] == 0:
	print(0)
	exit()

m = 10 ** 18
ans = 1
for i in range(n):
	ans *= a[i]
	if ans > m:
		print(-1)
		exit()
print(ans)


Measured memory_bytes: 21740
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		while(true) {
			int x=sc.nextInt();
			int y=sc.nextInt();
			if(x==0&&y==0) {
				break;
			}else{
				if(x>y) {
					int abc=x;
					x=y;
					y=abc;
				}
			}
			System.out.println(x+" "+y);
		}
		
	}

}




Measured memory_bytes: 35424
#include<bits/stdc++.h>
using namespace std;
  
int main(){
  int m,f,b;
  cin>>m>>f>>b;
  if(b-m>f){
    cout<<"NA"<<endl;
  }else{
    cout<< max(b-m,0) <<endl;
  }
  return 0;
}


Measured memory_bytes: 3104
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];
  myout(N - K + 1);
}

Measured memory_bytes: 7372
// ==========
// 入力例
// ==========
// 5
// 5 3 2 4 1

// ==========
// 出力例
// ==========
// 1 2 3 4 5
// 8
#include <iostream>
using namespace std;

int main()
{
  int n;

  cin >> n;

  int R[n];

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

  int flag, temp;
  int swapCount = 0;

  flag = 1;
  while (flag)
  {
    flag = 0;
    for (int k = n - 1; k > 0; k--)
    {
      if (R[k] < R[k - 1])
      {
        temp = R[k];
        R[k] = R[k - 1];
        R[k - 1] = temp;
        flag = 1;
        swapCount++;
      }
    }
  }

  for (int i = 0; i < n; i++)
  {
    cout << R[i];
    if (i == n - 1)
    {
      cout << endl;
    }
    else
    {
      cout << ' ';
    }
  }
  cout << swapCount << endl;

  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  int ans;
  REP(i,1,sqrt(N)){
    if(N%i==0) ans=i+N/i;
  }
  cout<<ans-2<<endl;
  }


Measured memory_bytes: 256
# ABC126D - Even Relation
def dfs(r: int) -> None:
    stack = [r]
    while stack:
        v = stack.pop()
        for u, w in T[v]:
            if D[u] == -1:
                D[u] = (D[v] + w) % 2
                stack.append(u)


def main():
    global T, D
    N, *A = map(int, open(0).read().split())
    T = [[] for _ in range(N + 1)]
    for i in range(0, (N - 1) * 3, 3):
        v, u, w = A[i : i + 3]
        T[v] += [(u, w)]
        T[u] += [(v, w)]
    D = [-1] * (N + 1)  # D[i] := parity of distance from vertex 1 (root)
    D[1] = 0
    dfs(1)
    print(*D[1:], sep="\n")


if __name__ == "__main__":
    main()

Measured memory_bytes: 42792
import { readFileSync } from 'fs'

function main(input: string[]) {
  let n = Number(input)
  let ans = 1000 - n % 1000
  if (ans === 1000) ans = 0
  console.log(ans)
}

const lines: any[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

reader.on('line', function (line: any) {
  lines.push(line);
});
reader.on('close', function () {
    main(lines)
});

Measured memory_bytes: 30092
using System;

class ABC079B
{
	static public void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		long[] L = new long[87];

		L[0] = 2;
		L[1] = 1;
		for(int i=2; i<=N; i++)
			L[i] = L[i-1] + L[i-2];

		Console.WriteLine(L[N]);
	}

}


Measured memory_bytes: 11220
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	R := nextInt()
	fmt.Println(float64(R) * math.Pi * 2)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 1792
//Author: Bishal Sarang
#include <bits/stdc++.h>
using namespace std;

//typedefs
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef map<int, int> mii;
typedef priority_queue<pii, vpii, greater<pii> > pq;
typedef tuple<int, int, int> tp;

//Constants
const int INF = (int)2 * 1e9;
const ll MOD = 1000000007;
const long double PI = 3.1415926;
const long double EPS = 1e-6;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define what(x) cerr << #x << " => " << x << endl;
#define print_r(x) for(auto i = 0; i < x.size(); i++) what(x[i]);
#define print_grid(x) for(auto i = 0; i < x.size(); i++){for(auto j = 0; j < x[0].size(); j++){cout << x[i][j];}cout << endl;}
#define gridM(type, n, m) vector<vector<type>> grid(n, vector<type>(m))

template <typename T>vector<T> prefix_sum(vector<T> nums){vector<T> pre_sum(nums.size());partial_sum(nums.begin(), nums.end(), pre_sum.begin());return pre_sum;}
vector<string> split(string s, char sep){int prev_index = 0;int i = 0;vector<string> words;for(i = 0; i < s.size(); i++){if(s[i] == sep){words.push_back(s.substr(prev_index, i - prev_index));prev_index = i + 1;}}words.push_back(s.substr(prev_index, (s.size() - prev_index )));return words;}

void read(){
  //stime = clock();
  #ifdef DEBUG
    freopen("in.txt", "r", stdin);
   #endif // DEBUG
   cin.sync_with_stdio(false);
   cin.tie(0);
}


int main(){
 read();
 int n, m; cin >> n >> m;
 int correct = 0, penalties = 0;
 map<int, int> mp;

 for(int i = 0; i < m; i++){
  int prob;
  string verdict;
  cin >> prob >> verdict;
  if(verdict[0] == 'A'){
    if(mp[prob] != -1){
      correct++;
      penalties += mp[prob];
      mp[prob] = -1;
    }
  }
   else{
      if(mp[prob] != -1){
        mp[prob]++;
      }
    }
 }
 cout << correct << " " << penalties;

 return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    int n,m; cin >> n >> m;
//    vector<int> a(n), b(n); rep(i, n) {cin >> a[i] >> b[i];}
    Graph g(n);
    rep(i, m){
        int a,b; cin >> a >> b;
        g[a-1].pb(b-1);
        g[b-1].pb(a-1);
    }
    bool d[n]; rep(i,n) d[i]= false;
    queue<int> que;
    int ans[n];
    que.push(0);
    d[0] = true;
    while(que.size()){
        int q = que.front(); que.pop();
        for(int road : g[q]){
            if(!d[road]){
                que.push(road);
                ans[road]=q+1;
                d[road] = true;
            }
        }
    }
    rep(i,n){
        if(!d[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i=1; i<n; i++) cout << ans[i] << endl;
    return 0;
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ b.cpp
./a.out
*/

Measured memory_bytes: 10364
#include<bits/stdc++.h>
using namespace std;
    int main(){
        string S;
            int x = 0;
                cin >> S;
                    for(int i; i < S.size(); i++){
                        if(i % 2 == 0){
                            if(S.at(i) == 'L'){
                                x = 1;
                            }else{}
                        }else{
                            if(S.at(i) == 'R'){
                                x = 1;
                            }else{}
                        }
                }
                    if(x == 1){
                        cout << "No" << endl;
                    }else{
                        cout << "Yes" << endl;
                    }
    return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x) ((x) * (x))
#define bit(n) (1LL<<(n))
#define pcnt(x) __builtin_popcountll(x)
#define PB push_back
#define MP make_pair
#define endl "\n"
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
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; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main() {
  string s; cin >> s;
  int n = s.length();
  bool iss = true;
  FOR(i,0,(n-1)/2-1){
    if(s[i]!=s[n-1-i]) iss = false;
    if(s[i]!=s[(n-1)/2-1-i]) iss = false;
    if(s[n-1-i]!=s[(n+3)/2-1+i]) iss = false;
    // cout << n-1-i << " " << (n+3)/2+i << "\n";
  }
  if(iss) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
// AOJ 0121 http:/judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0121/

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <sstream>

using namespace std;

string swp(string s,const int&a,const int&b){swap(s[a],s[b]);return s;}

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

    string s = "01234567";

    queue<string> q;
    unordered_map<string, int> m;

    q.push(s);
    m[s] = 0;

    while (q.size()) {
        string t = q.front(); q.pop();
        int idx = t.find('0');
        string u;
        if (idx - 1 >= 0 && idx != 4) {
            u = swp(t, idx, idx - 1);
            if (m.find(u) == m.end()) {
                m[u] = m[t] + 1;
                q.push(u);
            }
        }
        if (idx + 1 < 8 && idx != 3) {
            u = swp(t, idx, idx + 1);
            if (m.find(u) == m.end()) {
                m[u] = m[t] + 1;
                q.push(u);
            }
        }
        if (idx - 4 >= 0) {
            u = swp(t, idx, idx - 4);
            if (m.find(u) == m.end()) {
                m[u] = m[t] + 1;
                q.push(u);
            }
        }
        if (idx + 4 < 8) {
            u = swp(t, idx, idx + 4);
            if (m.find(u) == m.end()) {
                m[u] = m[t] + 1;
                q.push(u);
            }
        }
    }

    string line; stringstream ss;
    while (getline(cin, line)) {
        ss << line;
        string t = "";
        for (int i = 0; i < 8; ++i) {char c;ss >> c;t += c;}
        cout << m[t] << endl;
    }
}

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

int main(){
    
    while(true){
        int n, x, count=0;
        cin >>n >>x;

        if(n==0&&x==0){
            break;
        } 
        for(int i=1;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                for(int k = j+1;k<=n;k++){
                    if(i+j+k==x){
                        count++;
                    }
                }          
            }
        }
        cout << count << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3080
a=int(input())
l=[]
for i in range(1,a+1):
    l.append(i)
k=[]
for i in range(1,a+1):
    if not i % 5 or not i % 3:
        k.append(i)
s=sum(k)
k=sum(l)
print(k-s)

Measured memory_bytes: 67144
#include<stdio.h>

int main(void){
	long long int d, sum=0;
	long long int i;
	
	while(scanf("%lld",&d)!=EOF){
		for(i=0;i<600;i+=d){
			sum += i*i*d;
		}
		printf("%lld\n",sum);
		sum = 0;
	}
	
	return 0;
}

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

using namespace std;

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

  int n,m;cin>>n>>m;
  bool ans=false;
  string a[n+1],b[m+1];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<m;i++) cin>>b[i];
  for(int i=0;i<n-m+1;i++){
      for(int j=0;j<n-m+1;j++){
          bool flag=true;
          for(int k=0;k<m;k++){
              for(int l=0;l<m;l++){
                  if(a[i+k][j+l]!=b[k][l]) flag=false;
              }
          }
          ans=(ans || flag);
      }
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

#define ll long long
#define PB push_back
#define PII pair<int, int>
#define MP make_pair
#define all(x) x.begin(), x.end()
#define REP(x, y, z) for(int x = (y); x <= (z); x++)
#define REPP(x, y, z) for(int x = (y); x >= (z); x--)
#define F first
#define S second
#define MSET(x, y) memset(x, y, sizeof(x)) 
#define EB emplace_back
#define maxn

//structure

//declaration

//functions

int main(void)
{
	#ifdef DBG
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
	#endif

    ll a, b, n;

    cin >> a >> b >> n;

    if(a > n)
    {
        a -= n;
    }
    else
    {
        n -= a;
        a = 0;
        
        if(b > n)
        {
            b -= n;
        }
        else
            b = 0;
    }

    cout << a << ' ' << b << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include<algorithm>
using namespace std;
struct qujian
{
    int a;
    int b;
};
struct rulel
{
    bool operator()(const qujian &s1,const qujian &s2)const{return s1.b<s2.b;}
};
int main()
{
    int n;
    scanf("%d",&n);
    struct qujian tab[n];
    int i=0,t=n,j;
    while(t--)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        tab[i].a=x-y;
        tab[i].b=x+y;
        i++;
    }
    sort(tab,tab+n,rulel());
    int s=0;
    j=1;
    for(i=0;i<n;)
    {

        if(tab[i].b<=tab[j].a){s++;i=j;j++;}
        else {j++;}
    }
    printf("%d",s);
    return 0;
}

Measured memory_bytes: 1024
#Lupin The 4th: O(2^n)
def f(a, b, visited):
    w = W[visited] * 20
    return float(abs(lengths[a] - lengths[b])) / (2000. / (70 + w))

def solve():
    cache = dict([((i, 0), (0., [i])) for i in xrange(n)])
    def dfs(top, visited):
        if (top, visited) in cache:
            return cache[(top, visited)]
        ret = (1 << 30, [-1])
        for i in xrange(n):
            if (visited >> i) & 1 == 1:
                tmp = dfs(i, visited ^ (1 << i))
                c = tmp[0] + f(top, i, visited)
                if c < ret[0]:
                    ret = (c, tmp[1])
        cache[(top, visited)] = (ret[0], ret[1] + [top])
        return cache[(top, visited)]
    mask = (1 << n) - 1
    ret = (1 << 30, -1)
    for i in xrange(n):
        ret = min(ret, dfs(i, mask ^ (1 << i)))
    return ret[1]

n = input()
num, lengths, weights = zip(*[map(int, raw_input().split()) for _ in xrange(n)])
W = [0] + [sum(weights[i] for i in xrange(n) if (b >> i) & 1 == 1)  
           for b in xrange(1, 1 << n)]
print " ".join(map(lambda i:str(num[i]), solve()))

Measured memory_bytes: 100896
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s, t;
    cin >> s >> t;
    REP(i, s.size()) {
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
        char last_character = s.back();
        s.pop_back();
        s.insert(s.begin(), 1, last_character);
    }
    cout << "No" << endl;
    return 0;
}

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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define str string
#define s_vec(data,name,vertical,horizontal) vector<vector<(data)>> (name)((vertical),vector<(data)>((horizontal)));


int main(){
    int n,k,x,y;

    cin>>n>>k>>x>>y;

    int ans;
    if(k<n){
       ans = k*x + (n-k)*y;
    }else{
        ans = n*x;
    }
    
    cout<<ans;

}

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

namespace debug
{
    public static partial class Program
    {
        public static void Main()
        {
            var abc = Console.ReadLine().ToLongArray();
            Console.WriteLine(Math.Max(abc[2] - (abc[0] - abc[1]), 0));
        }
    }

    public static partial class Program
    {
        //テンプレここから
        private static long Gcd(long aaa, long bbb) => bbb == 0 ? aaa : Gcd(bbb, aaa % bbb);
        private static long Lcm(long aaa, long bbb) => aaa * bbb / Gcd(aaa, bbb);
        private static long ToLong(this double ddd) => (long) ddd;
        private static long ToLong(this string str) => long.Parse(str);
        private static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
        private static long[] ToLongArray(this string str, char opr = ' ') => str.Split(opr).ToLong();
        private static long Diff(long aaa, long bbb) => Math.Abs(Math.Max(aaa, bbb) - Math.Min(aaa, bbb));
        private static long Sign(this long iii) => Math.Sign(iii);
        private static bool IsEven(this long iii) => iii % 2 == 0;
        private static bool IsEven(this int iii) => iii % 2 == 0;

        private static readonly int[] Dx =
        {
            0, -1, 0, 1
        };

        private static readonly int[] Dy =
        {
            -1, 0, 1, 0
        };

        public const int Mod = 1000000007;
        public const string UpperAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const string LowerAlphabet = "abcdefghijklmnopqrstuvwxyz";
        private static long ToLong(this char ccc) => ccc.ToString().ToLong();
        private static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
        private static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

        private static string JoinToStr(this IEnumerable<long> array, string sep = "") =>
            array.Select(xxx => xxx.ToString()).Join(sep);

        public static string JoinToStr(this IEnumerable<int> array, string sep = "") =>
            array.Select(xxx => xxx.ToString()).Join(sep);

        //テンプレここまで
    }
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s[3];

int main() {
	inc(i, 3) { cin >> s[i]; }
	
	inc(i, 3) {
		printf("%c", s[i][0] - 'a' + 'A');
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
from functools import reduce
from functools import lru_cache


# \n
def input():
    return sys.stdin.readline().rstrip()

def main():

    N=int(input())
    S=list(input())

    R=[0]*N
    G=[0]*N
    B=[0]*N
    r=0
    g  =0
    b=0
    count =0
    for i in range(N-1,-1,-1):
        if S[i] =="R":
            r+=1
        elif S[i] =="G":
            g+=1
        else:
            b+=1
        R[i]=r
        G[i]=g
        B[i]=b

    count =0
    for i in range(N):



        for j in range(i+1,N):
            SE = set(["R", "G", "B"])
            I = S[i]
            SE.remove(I)
            J =S[j]
            if I==J:
                continue
            SE.remove(J)
            if "G" in SE:
                count+=G[j]
                if j+j-i <N and S[j+j-i] =="G":
                    count -=1

            elif "R" in SE:
                count+=R[j]
                if j+j-i <N and S[j+j-i] =="R":
                    count -=1
            else:
                count+=B[j]
                if j+j-i <N and S[j+j-i] =="B":
                    count -=1



    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 69796
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	int zh(string x);
	int s;
	s1+=s2;
	s=zh(s1);
	if(int(sqrt(s))==sqrt(s))
		cout<<"Yes";
	else
		cout<<"No";
}
int zh(string x){
	int s=0,i;
	for(i=0;i<x.size();i++) s=s*10+(x[i]-'0');
	return s;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<string.h>
#include<vector>
#include<set>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
long long fact[310000];
long long inv[310000];
long long finv[310000];
int p[110000];
int cnt[110000];
vector<int>g[110000];
vector<int>rev[110000];
int v[110000];
int cur;
int num[110000];
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		b/=2;a=a*a%mod;
	}
	return ret;
}
void dfs(int a){
	for(int i=0;i<g[a].size();i++){
		if(v[g[a][i]])continue;
		v[g[a][i]]=1;
		dfs(g[a][i]);
	}
	num[cur++]=a;
}
int scc[110000];
void dfs2(int a){
	scc[a]=cur;
	for(int i=0;i<rev[a].size();i++){
		if(v[rev[a][i]])continue;
		v[rev[a][i]]=1;
		dfs2(rev[a][i]);
	}
}
int dfs3(int a,int b){
	int ret=1;
	for(int i=0;i<rev[a].size();i++){
		if(b==scc[rev[a][i]])continue;
		ret+=dfs3(rev[a][i],b);
	}
	return ret;
}
int cy[110000];
int in[110000];
int out[110000];
int sz[110000];
int fi[110000];
 
int ren[110000];
 
long long dp[110000];
int main(){
	fact[0]=finv[0]=1;
	inv[1]=1;
	for(int i=1;i<310000;i++){
		fact[i]=fact[i-1]*i%mod;
	}
	for(int i=2;i<310000;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<310000;i++){
		finv[i]=finv[i-1]*inv[i]%mod;
	}
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);p[i]--;
		cnt[p[i]]++;
	}
	for(int i=0;i<a;i++)if(cnt[i]>2){
		printf("0\n");return 0;
	}
	for(int i=0;i<a;i++){
		g[i].push_back(p[i]);
		rev[p[i]].push_back(i);
	}
	for(int i=0;i<a;i++){
		if(v[i])continue;
		v[i]=1;
		dfs(i);
	}
	cur=0;
	for(int i=0;i<a;i++)v[i]=0;
	for(int i=a-1;i>=0;i--){
		if(v[num[i]])continue;
		v[num[i]]=1;
		fi[cur]=num[i];
		dfs2(num[i]);
		cur++;
	}
	for(int i=0;i<a;i++){
		in[scc[p[i]]]++;
		sz[scc[i]]++;
		if(scc[p[i]]!=scc[i])out[scc[i]]++;
	}
	for(int i=0;i<a;i++){
		if(cnt[i]>1&&scc[i]!=scc[p[i]]){
			printf("0\n");return 0;
		}
	}
	long long ret=1;
	for(int i=0;i<cur;i++){
		//printf("%d %d\n",in[i],sz[i]);
		if(out[i])continue;
		if(in[i]==sz[i]){
			cy[sz[i]]++;
			continue;
		}
		if(out[i])continue;
		vector<int>L;
		int at=fi[i];
		while(1){
			L.push_back(dfs3(at,scc[at])-1);
			at=p[at];
			if(at==fi[i])break;
		}
 
		int now=0;
		for(int j=0;j<L.size()*2;j++){
			ren[j%L.size()]=now;
			if(L[j%L.size()]==0)now++;
			else now=1;
		}
		for(int j=0;j<L.size();j++){
			if(L[j]==0)continue;
			if(ren[j]<L[j])ret*=0;
			else if(ren[j]>L[j])ret=ret*2%mod;
		}
	}
	for(int i=1;i<=a;i++){
		long long tmp=0;
		for(int j=0;j*2<=cy[i];j++){
 
			long long ks=pw(i,j)*fact[cy[i]]%mod*finv[cy[i]-j*2]%mod*finv[j]%mod*pw(500000004,j)%mod;
			if(i%2&&i!=1){
				ks=ks*pw(2,cy[i]-j*2)%mod;
			}
			tmp=(tmp+ks)%mod;
		}
		ret=ret*tmp%mod;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 26492
import java.util.Scanner;

public class Main {

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


        int N = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(N, K));
    }

    public static double solve(int N, int K) {
        double sum = 0;
        double prob = (double)1/N;

        for (int i=1; i<=N; i++) {
            if (i>= K) {
                sum += 1;
                continue;
            }

            sum += Math.pow(0.5, count2(K, i));
        }

        return sum * prob;
   }

   private static int count(int K, int n) {
        int count = (int)Math.ceil((Math.log(K) - Math.log(n)) / Math.log(2.0));
        if (count <= 0) {
            count = 1;
        }

        return count;
   }
   
   private static int count2(int K, int n) {
        for (int i=0;;i++) {
            if (n >= K) return i;
            
            n *= 2;
       }
   }
}

Measured memory_bytes: 21204
#include <stdio.h>

#define INF 200000
typedef struct{
  int prev;
  int next;
  int c;
}Data;

void dijkstra(int);

int n;
Data G[500000];

int main(){
  int i,j,u,k,a,b,num = 0;

  scanf("%d",&n);
   
  for(i = 0;i < n; i++){
    scanf("%d %d",&u,&k);
    
    for(j = 0;j < k; j++){
     scanf("%d %d",&G[num].next,&G[num].c);
     G[num].prev = u;
     num++;
  }
}
  dijkstra(num);
  return 0;
}

void dijkstra(int num){
  int i,flag = 1;
  int d[10001];
  
  for(i = 0;i < n; i++){
    d[i] = INF;
  }

  d[0] = 0;
 
  while(flag == 1){
    flag = 0;

    for(i = 0; i < num; i++){
      if(d[G[i].prev] + G[i].c < d[G[i].next]){
         d[G[i].next] = G[i].c + d[G[i].prev];
	 flag = 1;
      }
    }
  }
  
  for(i = 0; i < n; i++){
    printf("%d %d\n",i,d[i]);
  
  }
}



Measured memory_bytes: 7560
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n,k,arr[200005];
ll ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>k;
    for(int i=1;i<=(n);i++){
        cin>>arr[i];
    }
    sort(arr+1,arr+n+1);
    for(int i=1;i<=(n-k);i++){
        ans+=(ll)arr[i];
    }
    cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const double DINF = 5e14, eps = 1e-10;
const long long MOD = 1e9 + 7, INF = 5e18;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

int n, a, b;

int main() {
	cin >> n;
	n--;
	if (!n)cout << "Hello World" << endl;
	else {
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}


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

const long long MOD=1000000007;

int main(){
  int a[4]={};
  for(int i=0; i<3; i++){
    int x,y; cin >> x >> y;
    a[x-1]++; a[y-1]++;
  }
  if(a[0]==3||a[1]==3||a[2]==3||a[3]==3) cout << "NO" << endl;
  else cout << "YES" << endl;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    bool[long] D;
    long free;
    foreach (a; A)
    {
        if (3200 <= a)
        {
            free++;
            continue;
        }
        D[a / 400] = true;
    }
    long a = D.keys.length;
    if (a == 0)
    {
        writefln("1 %s", free);
        return;
    }

    writefln("%s %s", a, a + free);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int carry = 0;
	long long int res = 0;
	for (int i = s.size() - 1; i >= 0; i--) {
		int n = s[i] - '0';
		n += carry;
		carry = n / 10;
		n = n % 10;
		if (n < 5)
			res += n;
		else if (n > 5) {
			carry += 1;
			res += 10 - n;
		}
		else {
			if (i > 0 && s[i - 1] >= '5') {
				carry += 1;
				res += 5;
			}
			else {
				res += 5;
			}
		}
	}
	if (carry == 1)
		res++;
	cout << res << endl;
}









Measured memory_bytes: 1412
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



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

	int n, a;
	cin >> n >> a;
	int t = n % 500;
	if (t <= a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}
 

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int life, atk;
	int atkCount = 0;

	scanf("%d%d", &life, &atk);

	/* モンスターの体力が0以下になるまで、攻撃回数を数える */
	while (life > 0)
	{
		life -= atk;
		atkCount++;
	}

	printf("%d", atkCount);

	return 0;
}

Measured memory_bytes: 128