akhauriyash/Code-Regression huggingface dataset:
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
ll A[100005] = {};
ll B[300005] = {};
ll C[300005] = {};
bool f, ff;
string S,T;
set <long long>sll;
pl bufpl;
vector <long long>vl;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
multiset<ll> llmset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}



ll minn, maxx;
double ansa;
bool fl[30] = {};


string ss, sss;

int LL;


ll GCD(ll aa, ll bb) {
	while (1) {
		if (aa < bb) swap(aa, bb);
		if (!bb) break;
		aa %= bb;
	}
	return aa;
}

int main() {


	cin >> a>>b>>c>>d;

	N = GCD(c, d);
	N = c * d / N;
	a--;
	A[0] = a - a / c - a / d + a / N;
	A[1] = b - b / c - b / d + b / N;
	
	cout << A[1] - A[0] << endl;

	return 0;

}


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

int main()
{
  string A, B, C;
  cin >> A >> B >> C;
  if(A[A.length()-1] == B[0] && B[B.length()-1] == C[0])
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n, m, k;
    cin >> n >> m >> k;
    
    vector<int> a(n);
    vector<int> b(m);
    
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    
    vector<long long> sumA(n+1);
    vector<long long> sumB(m+1);
    
    for (int i = 1; i <= n; i++) sumA[i] = sumA[i-1] + a[i-1];
    for (int i = 1; i <= m; i++) sumB[i] = sumB[i-1] + b[i-1];
    
    int ans = 0;
    
    for (int i = 0; i <= n; i++){
        long long temp = k - sumA[i];
        if (sumA[i] > k) continue;
        if (temp < 0 || sumA[i] == k) ans = max(ans,i);
        
        int numberOfB = upper_bound(sumB.begin(),sumB.end(),temp) - sumB.begin()-1;
        
        ans = max (ans, i + numberOfB);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 8012
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 998244353


#############
# Main Code #
#############

# N:ブロック
# M:色（バリエーション）
# K:隣合う組み
# N, M, K = 6, 2, 3のとき
# K = 0 のとき
# 121212, 212121
# K = 1のとき,
# 12121 のどこかに同じ数字を挟み込めば
# 112121, 122121という風にできる
# K = 2のとき
# 1212 のどこかに同じ数字を挟む　を２回行う
# 112212, 112122もできるし
# 111212, 122212もできる
N, M, K = getNM()

# 重複組み合わせのため
# 繰り返し使うのでこのタイプ
Y = N + K + 1
fact =[1] #階乗
for i in range(1, Y + 1):
    fact.append(fact[i - 1] * i % mod)

facv = [0] * (Y + 1) #階乗の逆元
facv[-1] = pow(fact[-1], mod - 2 , mod)

for i in range(Y - 1, -1, -1):
    facv[i] = facv[i + 1] * (i + 1) % mod

def cmb(n, r):
    if n < r:
        return 0
    return fact[n] * facv[r] * facv[n - r] % mod

ans = 0
for i in range(K + 1):
    opt = M * pow(M - 1, N - i - 1, mod) * cmb(N - i + i - 1, i)
    ans += opt % mod
print(ans % mod)

Measured memory_bytes: 119276
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
 
        int ans = 0;
 
        for(int i = a; i <= b; i++){
            if(c%i == 0)ans++;
        }
 
        System.out.printf("%d\n",ans);
    }
}


Measured memory_bytes: 26440
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;

int main()
{
	long long N,K,tmp;
    cin >> N >> K;
	tmp=N%K;
	cout << min(tmp,K-tmp)<<endl;
	
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

    ll n,k;cin >> n >> k;
    n %= k;
    ll ans = n;
    while(true){
        n = (ll)abs(n-k);
        if(chmin(ans,n) == false)break;
    }

    cout << ans << endl;
    return 0;
}

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


int main()
{

ll n, k; cin>>n>>k;

ll a[111], b[111], dp[111111];

for(ll i=1; i<=n; i++) cin>>a[i]>>b[i];

for(ll i=1; i<=n; i++)
{
	for(ll j=k; j>=a[i]; j--)
	{
		//cout<<dp[j]<<" "<<dp[j-a[i]];
		dp[j]= max(dp[j], dp[j-a[i]]+b[i] );
		//cout<<dp[j]<<endl;
	}
}

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

Measured memory_bytes: 4372
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, a, p[7];
int main() {
	while (true) {
		scanf("%d", &n);
		if (n == 0) break;
		for (int i = 0; i < 7; i++) p[i] = 0;
		for (int i = 0; i < n; i++) scanf("%d", &a), p[min(a / 10, 6)]++;
		for (int i = 0; i < 7; i++) printf("%d\n", p[i]);
	}
	return 0;
}

Measured memory_bytes: 2724
#include<iostream>

using namespace std;

int main(){

  int card[11];
  int c[3];

  while(cin >> c[0] >> c[1] >> c[2]){

    for(int i = 0; i < 11; i++) card[i] = 0;

    for(int i = 0; i < 3; i++) card[c[i]] = 1;

    int sum = 20 - (c[0] + c[1]);

    int p = 0;

    for(int i = 1; i <= sum; i++){
      if(card[i] == 0) p++;
    }

    if(p >= 4) cout << "YES";
    else cout << "NO";
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int hash[1000001];
    for(int i=0;i<1000001;i++)
        hash[i] = 0;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        hash[a[i]]++;
    }
    int c = 0;
    for(int i=1;i<1000001;i++)
    {
        if(hash[i] == 0)
            continue;
        if(hash[i] == 1)
            c++;
        for(int j=i*2;j<1000001;j=j+i)
        {
            hash[j] = 0;
        }
    }
    cout<<c<<endl;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) cin >> a[i];

    double sum = 0;
    rep(i, n)
    {
        sum += 1. / a[i];
    }
    cout << 1. / sum << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<long long> vl;
typedef pair<long long, long long> pl;
typedef vector<vector<long long>> matrix;

#define F 						first
#define S 						second
#define PB 						push_back
#define MP 						make_pair
#define all(c) 					c.begin(), c.end()
#define f(i,a,b) 				for(ll i=a; i<b; i++)
#define rep(i,n) 				f(i,0,n)
#define tr(c,i) 				for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) 			(c.find(x) != c.end())	//for set and map
#define cpresent(c,x) 			(find(all(c),x) != c.end())	//for vectors
#define w(t)					ll t; cin>>t; while(t--)
#define epsilon 				1e-9
#define MOD						(ll)1e9

void doublade() {
	ios::sync_with_stdio(false); cin.tie(0); cout.precision(10);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	doublade();
	// w(t) {
		ll x, k, d;
		cin >> x >> k >> d;
		if(x<0) x = abs(x);
		ll p = x/d;
		if(k<p) {
			ll ans = x - (k*d);
			cout<<ans<<"\n";
		}else {
			k -= p;
			ll ans = x - (p*d);
			if(k%2==0) cout<<ans<<"\n";
			else cout<<abs(ans-d)<<"\n";
		}		
	// }
	return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n;
int a[101010];
void solve(){
	cin >> n;
	int l = 0, r = n;
	cout << 0 << endl;
	string s;
	cin >> s;
	if(s == "Vacant") return;
	if(s == "Male") a[0] = 1;
	if(s == "Female") a[0] = 2;
	
	while(1){
		int c = (l+r)/2;
		cout << c << endl;
		cin >> s;
		if(s == "Vacant") return;
		if(s == "Male") a[c] = 1;
		if(s == "Female") a[c] = 2;
		
		if((c-l)%2 ^ a[c]==a[l]){
			l = c;
		}
		else{
			r = c;
		}
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


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

int MAX_VALUE = 1e5+10; //Maximum value we can get from items without restriction
int W;									//Capacity of knapsack
int N;									//Number of items
int w;									//weight of item
int v;									//value of item
vector <long long> ks; 
/*
 * this time we have very big capacity knapsack so we will try to minimize
 * weight for given value
 */

int main(){
	cin>>N>>W;
	
	ks.resize(MAX_VALUE+1,INT_MAX);
	ks[0]=0;

	for(int i=1;i<=N;i++){
		cin>>w>>v;
		
		for(int j=MAX_VALUE;j>=v;j--){
			if(ks[j-v]!=INT_MAX)
				ks[j] = min( ks[j], ks[j-v]+w );
		}

	}

	//taking biggest value whose weight is still under W
	for(int j=MAX_VALUE;j>=0;j--){
		if(ks[j]<=W){
			cout<<j<<endl;
			break;
		}
	}
}


Measured memory_bytes: 1152
#include <stdio.h>

char suits[100005];
int num[100005];

int partition(int A[], int p, int r) {
  int x = A[r];
  int i = p - 1;
  int j, temp;
  char tempLetter;

  for (j = p; j < r; j++) {
    if (num[A[j]] <= num[x]) {
      i++;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }

  i++;
  temp = A[i];
  A[i] = A[r];
  A[r] = temp;

  return i;
}

void quicksort(int A[], int p, int r) {
  if (p < r) {
    int q = partition(A, p, r);
    quicksort(A, p, q-1);
    quicksort(A, q+1, r);
  }
}

int isStable(int A[], int n) {
  int i;

  for(i = 2; i <= n; ++i) {
    if(num[A[i-1]] == num[A[i]] && A[i-1] > A[i])
      return 0;
  }

  return 1;
}


int main() {
  int n, i;
  char dump;

  scanf("%d%c", &n, &dump);
  int C[100005];

  for (i = 1; i < n + 1; ++i) {
    scanf("%c%c%d%c", &suits[i], &dump, &num[i], &dump);
    C[i] = i;
  }

  quicksort(C, 1, n);

  if (isStable(C, n))
      printf("Stable\n");
  else
    printf("Not stable\n");

  for (i = 1; i < n + 1; ++i) {
    printf("%c %d\n", suits[C[i]], num[C[i]]);
  }
}



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

int main(){
	int i;
	int list[10];
	for(i=0;i<10;i++){
		cin >> list[i];
	}
	sort(list,list+10);
	for(i=0;i<3;i++){
		cout << list[9-i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
n = int(input())
p = list(map(int, input().split()))


ans = 0
for i in range(n):
  if i == 0 or i == len(p) - 1:
    continue
  if sorted([p[i-1], p[i], p[i+1]])[1] == p[i]:
    ans += 1

print(ans)

Measured memory_bytes: 3060
file = File.exist?('in.in') ? File.new('in.in','r') : STDIN
n, k = file.gets.chomp.split.map(&:to_i)
vec = file.gets.chomp.split.map(&:to_i)

dp = Array.new(n, Float::INFINITY)

dp[0] = 0

for i in 1...vec.size
  j=1
  while(j<=k && i-j >= 0)
    c = dp[i-j]+(vec[i-j]- vec[i]).abs
    dp[i] = c if c < dp[i]
    j+=1
  end
end

puts dp.last


Measured memory_bytes: 11148
// OURL: https://atcoder.jp/contests/abc133/tasks/abc133_b
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,D;
  cin >> N >> D;
  auto ps = make_v<int>(N,D);
  REP(i,N) REP(j,D){
    cin >> ps[i][j];
  }
  int ans = 0;
  REP(i,N-1) RREP(j,i+1,N) {
    double d=0;
    REP(k,D) {
      d += pow(ps[i][k]-ps[j][k],2);
    }
    d = sqrt(d);
    if (d - int(d) == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb emplace_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed;
// cout << setprecision(10) << val;

double W, H, x, y;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> W >> H >> x >> y;
  cout << fixed << setprecision(10) << W * H / 2.0 << " " << (x == W / 2.0 && y == H / 2.0) << endl;
  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <iterator>
#include <iomanip>
#include <queue>
using namespace std;

vector<vector<long long> > g;
vector<long long> c;

void dfs(long long v, long long to){
    if(c[v] != -1) return;
    c[v] = to;
    for(long long y:g[v]) dfs(y, to);
}

int main(){
    long long n, m, k, f, t;
    cin >> n >> m >> k;
    g.resize(n);
    c.assign(n, -1);
    for(int i = 0; i < m; ++i){
        cin >> f >> t;
        f--, t--;
        g[f].push_back(t);
        g[t].push_back(f);
    }
    long long cn = 0;
    for(int i = 0; i < n; ++i){
        if(c[i] == -1){
            dfs(i, cn++);
        }
    }
    vector<long long> nm(cn);
    for(long long y:c) nm[y]++;
    vector<long long> ans(n);
    for(int i = 0; i < n; ++i){
        ans[i] = nm[c[i]] - g[i].size() - 1;
    }
    for(int i = 0; i < k; ++i){
        cin >> f >> t;
        f--, t--;
        if(c[f] == c[t]){
          ans[f]--;
          ans[t]--;
        }
    }
    for(int i = 0; i < n; ++i) cout << ans[i] << " ";
}


Measured memory_bytes: 9088
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long int ll;
static const int MAX_N = 100000;
static const int MOD = 1000000007;

string S;
int N;
ll numa[MAX_N + 1], numc[MAX_N + 1], numq[MAX_N + 1];

ll mod_pow(ll x, ll n){
	if(n == 0LL) return 1LL;
	ll res = mod_pow(x * x % MOD, n / 2);
	if(n % 2 == 1) res = res * x % MOD;
	return res;
}

int main(){
	cin >> S;
	S = " " + S;
	N = S.length();
	fill(numa, numa + N, 0LL);
	fill(numc, numc + N, 0LL);
	fill(numq, numq + N, 0LL);
	for(int i = 1; i < N; i++){
		if(S[i] == 'A') numa[i] = numa[i - 1] + 1LL;
		else numa[i] = numa[i - 1];
		if(S[i] == 'C') numc[i] = numc[i - 1] + 1LL;
		else numc[i] = numc[i - 1];
		if(S[i] == '?') numq[i] = numq[i - 1] + 1LL;
		else numq[i] = numq[i - 1];
	}
	ll res = 0LL;
	for(int i = 2; i < N - 1; i++){
		if(S[i] == 'B'){
			res += (numa[i - 1] * (numc[N - 1] - numc[i])) * mod_pow(3LL, numq[N - 1]);
			res += (numa[i - 1] * (numq[N - 1] - numq[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 1LL));
			res += (numq[i - 1] * (numc[N - 1] - numc[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 1LL));
			res += (numq[i - 1] * (numq[N - 1] - numq[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 2LL));
		}else if(S[i] == '?'){
			res += (numa[i - 1] * (numc[N - 1] - numc[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 1LL));
			res += (numa[i - 1] * (numq[N - 1] - numq[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 2LL));
			res += (numq[i - 1] * (numc[N - 1] - numc[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 2LL));
			res += (numq[i - 1] * (numq[N - 1] - numq[i])) * mod_pow(3LL, max(0LL, numq[N - 1] - 3LL));
		}
		res %= MOD;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2812
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc()) 
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const ll LLINF = 1ll << 60;
const int N = 2010;
struct edge {
  int la,b;
} con[N << 1];
int tot, fir[N];
void add_edge(int from,int to) {
  con[++tot] = (edge) {fir[from], to};
  fir[from] = tot;
}
int n;
char str[N];
ll sum[N], low[N];
int sz[N], dep[N];
void dfs(int pos,int fa) {
  dep[pos] = dep[fa] + 1;
  sz[pos] = str[pos] - '0';
  sum[pos] = 0;
  int mx = 0;
  for (int i = fir[pos]; i; i = con[i].la) {
    if (con[i].b == fa) continue;
    dfs(con[i].b, pos);
    sz[pos] += sz[con[i].b];
    sum[pos] += sum[con[i].b] + sz[con[i].b];
    if (low[con[i].b] + sum[con[i].b] + 2 * sz[con[i].b] > low[mx] + sum[mx] + 2 * sz[mx])
      mx = con[i].b;
  }
  low[pos] = max((sum[pos]%2), low[mx] + sum[mx] + 2 * sz[mx] - sum[pos]);
}
ll solve(int rt) {
  dep[0] = -1;
  dfs(rt, 0);
  if (low[rt] == 0 && sum[rt] % 2 == 0) return sum[rt] / 2;
  else return LLINF;
}
int main() {
  int x,y;
  read(n);
  scanf("%s", str+1);
  rep (i, 1, n-1) {
    read(x), read(y);
    add_edge(x, y);
    add_edge(y, x);
  }
  ll ans = LLINF;
  rep (i, 1, n)
    ans = min(ans, solve(i));
  if (ans >= LLINF) puts("-1");
  else printf("%lld\n", ans);
  return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<bool>> a(h + 2, vector<bool>(w + 1));
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < w; j++) {
      a[i + 1][j + 1] = s[j] == '#';
    }
  }
  bool r = true;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      r &= !a[i][j] || a[i + 1][j] || a[i][j + 1] || a[i - 1][j] || a[i][j - 1];
    }
  }
  cout << (r ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 384
#ifndef TEMPLATE
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define mp make_pair
#define sz(a) ((int)(a).size())
#define mem(x,v) memset((x),(v),sizeof((x)));
#define A(x) (x).begin(),(x).end()
#define re(i,n) for(int i=0;i<(int)n;i++)
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define erp(i,k,n) for(int i=n;i>=k;i--)
#define input(v,n) re(i,n)cin>>v[i]
using vi = vector<int>;
using vpi = vector<pair<int,int>>;
using vvi = vector<vi>;
using tp = tuple<int,int,int>;
using pi = pair<int,int>;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)9e6;
#endif
// ===================== MANASH =================== //

int n;
char ch[3001][3001];
pair<int,int> par[3001][3001];
void test() {
      
      string a,b;
      cin >> a >> b; int m; n = sz(a), m = sz(b);
      vvi dp(n+1,vi(m+1));
      for( int i = 1; i <= n; i++) {
            for( int j = 1; j <= m; j++) {
                  if(a[i-1] == b[j-1]) {
                        dp[i][j] = 1 + dp[i-1][j-1];
                        ch[i][j] = a[i-1];
                        par[i][j] = {i-1,j-1};
                  }
                  else if(dp[i-1][j] > dp[i][j-1]) {
                        dp[i][j] = dp[i-1][j];
                        ch[i][j] = ch[i-1][j];
                        par[i][j] = par[i-1][j];
                  } else {
                        dp[i][j] = dp[i][j-1];
                        ch[i][j] = ch[i][j-1];
                        par[i][j] = par[i][j-1];
                  }
            }
      }
      string res;
      int i = n, j = m;
      while(ch[i][j]) {
            assert(ch[i][j]);
            res.push_back(ch[i][j]);
            auto [x,y] = par[i][j];
            i = x, j = y;
      }
      reverse(A(res));
      cout << res;
}

signed main() {

      ios_base :: sync_with_stdio(false);
      cin.tie(NULL);
      #ifdef LOCAL
      freopen("input.txt","r",stdin);
      #endif
      int T = 1;
      //cin >> T;
      for( int tt = 1; tt <= T; tt++) {
            //cout << "Case #" << tt << " ";
            test();
            cout << "\n";
      }
      return 0;

}

Measured memory_bytes: 223232
def f1():
    t = 0
    for y, line in enumerate(M):
        for x, cell in enumerate(line):
            if M[y][x] == '1':
                f2(x, y)
                t += 1
    return t


def f2(x, y):
    if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
        return
    if M[y][x] == '1':
        M[y][x] = '0'
        for i in range(4):
            if i == 0:  # U
                f2(x, y-1)
            elif i == 1:  # D
                f2(x, y+1)
            elif i == 2:  # R
                f2(x+1, y)
            elif i == 3:  # L
                f2(x-1, y)


def get_input():
    while True:
        try:
            yield input()
        except EOFError:
            break
            

M = []
for line in list(get_input()):
    if line == '':
        print(f1())
        M = []
    else:
        M.append(list(line))
print(f1())

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

int n;

int main() {
    long a1=0,pm=1;
    cin>>n;
    long a[n];
    for(int i=0; i<n; i++) {
        cin>>a[i];
        a[i]*=2;
        a1+=a[i]*pm;
        pm*=-1;
    }
    a1/=2;
    long prev=a1;
    cout<<a1<<" ";
    for(int i=0; i<n-1; i++) {
        cout<<a[i]-prev;
        if(i!=n-2) cout<<" ";
        prev=a[i]-prev;
    }
}

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

int gcd(int a, int b)
{
	if(a == 0)
		return b;
	else if (b == 0)
		return a;
	else
		return gcd(b, a%b);
}
int main()
{
    int n;
    cin >> n;
    long long sum = 0;
    for(int i = 1; i  <= n; i++)
    {
		for(int j = 1; j <= n; j++)
		{
			for(int k = 1; k <= n; k++)
			{
				sum += gcd(i, gcd(j,k));
			}
		}
	} 
	cout << sum << endl;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int a[3][3];
  int n;
  int b[10];

  int bingo_board[3][3];

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      bingo_board[i][j] = 0;
    }
  }

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

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

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (b[i] == a[j][k]) {
          bingo_board[j][k] = 1;
        }
      }
    }
  }

  int bingo = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (bingo_board[i][j] == 0) {
        break;
      }
      if (j == 2) {
        bingo = 1;
      }
    }
  }

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (bingo_board[j][i] == 0) {
        break;
      }
      if (j == 2) {
        bingo = 1;
      }
    }
  }

  if (bingo_board[0][0] == 1 && bingo_board[1][1] == 1 &&
      bingo_board[2][2] == 1) {
    bingo = 1;
  }

  if (bingo_board[2][0] == 1 && bingo_board[1][1] == 1 &&
      bingo_board[0][2] == 1) {
    bingo = 1;
  }
  
  if (bingo == 1) {
    printf("Yes");
  } else {
    printf("No");
  }

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }



    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();


        string s = sc.str;
        long ans = INF;

        //even
        int sum = 0;
        for(int i = 0; i < s.Length; ++i)
        {
            if (i % 2 == 0 && s[i] == '0')
            {
                sum++;
            }
            if (i % 2 == 1 && s[i] == '1')
            {
                sum++;
            }
        }
        ans = Math.Min(ans, sum);
        //odd
        sum = 0;
        for (int i = 0; i < s.Length; ++i)
        {
            if (i % 2 == 1 && s[i] == '0')
            {
                sum++;
            }
            if (i % 2 == 0 && s[i] == '1')
            {
                sum++;
            }
        }
        ans = Math.Min(ans, sum);

        wr.wri(ans);
    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int counter = 0;
    for(int i = a;i <= b;i++){
        if(c % i == 0){
            counter++;
        }
    }
    cout << counter << endl;
    
    
}



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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

string s;
ll x,y;
vector<ll> a,b;
bool dp1[2][20011],dp2[2][20011];

int main(){
	cin>>s>>x>>y;
  s+="T";
  ll n=s.size();
  ll crt=0,sum=0;
  rep(i,n){
    if(s[i]=='T'){
      if(crt==0)a.push_back(sum);
      else b.push_back(sum);
      sum=0;
      crt=1-crt;
    }else{
      sum++;
    }
  }

  crt=0;
  ll nxt=1;
  dp1[crt][10000]=true;
  rep(i,a.size()){
    memset(dp1[nxt],0,sizeof(dp1[nxt]));
    rep(j,20001){
      if(!dp1[crt][j])continue;
      if(i==0){
        if(j+a[i]<=20000)dp1[nxt][j+a[i]]=true;
      }else{
        if(j+a[i]<=20000)dp1[nxt][j+a[i]]=true;
        if(j-a[i]>=0)dp1[nxt][j-a[i]]=true;
      }
    }
    swap(crt,nxt);
  }

  if(!dp1[crt][x+10000]){
    cout<<"No"<<endl;
    return 0;
  }

  crt=0;
  nxt=1;
  dp2[crt][10000]=true;
  rep(i,b.size()){
    memset(dp2[nxt],0,sizeof(dp2[nxt]));
    rep(j,20001){
      if(!dp2[crt][j])continue;
      if(j+b[i]<=20000)dp2[nxt][j+b[i]]=true;
      if(j-b[i]>=0)dp2[nxt][j-b[i]]=true;
    }
    swap(crt,nxt);
  }

  if(!dp2[crt][y+10000]){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;

	return 0;
}


Measured memory_bytes: 512
H,W,A,B=map(int,input().split())
MOD=10**9+7
max_n=10**5*2
fac=[1]*(max_n+1)
inv=[1]*(max_n+1)
ifac=[1]*(max_n+1)
for n in range(2,max_n+1):
    fac[n]=(fac[n-1]*n)%MOD
    inv[n]=MOD-inv[MOD%n]*(MOD//n)%MOD
    ifac[n]=(ifac[n-1]*inv[n])%MOD
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    return (fac[n]*ifac[k]*ifac[n-k])%MOD
a=0
for i in range(min(H-A,W-B)):
    a+=comb(H-A+B-1,B+i)*comb(W-B+A-1,W-B-i-1)
    a%=MOD
print(a)

Measured memory_bytes: 27236
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<cstring>
#include<string>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define pb push_back
#define LL long long
#define pairint pair<int,int>
#define fi first
#define se second
#define mp make_pair

namespace i207M
{

template<class T>il void in(T &x)
{
    x=0; bool f=0; char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-') f=1;
        c=getchar();
    }
    while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
    if(f) x=-x;
}

#define N 4010
#define md 1000000007
int n;
pairint p[200005];
int f[N][N];
int fac[N<<1],inv[N<<1];
int qpow(int a,int b)
{
	int res=1;
	for(;b;b>>=1,a=(LL)a*a%md) if(b&1) res=(LL)res*a%md;
	return res;
}
int c(int n,int m)
{
	return n<m?0:(LL)fac[n]*inv[m]%md*inv[n-m]%md;
}
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
#endif
	in(n);
	for(ri i=1;i<=n;++i) in(p[i].fi),in(p[i].se),++f[2001-p[i].fi][2001-p[i].se];
	for(ri i=1;i<=4001;++i)
		for(ri j=1;j<=4001;++j) f[i][j]=((LL)f[i][j]+f[i-1][j]+f[i][j-1])%md;
	fac[0]=1;
	for(ri i=1;i<=8000;++i) fac[i]=(LL)fac[i-1]*i%md;
	inv[8000]=qpow(fac[8000],md-2);
	for(ri i=8000;i>=1;--i) inv[i-1]=(LL)inv[i]*i%md;
	int ans=0;
	for(ri i=1;i<=n;++i)
	{
		(ans+=f[2001+p[i].fi][2001+p[i].se])%=md;
		(ans+=md-c((p[i].fi<<1)+(p[i].se<<1),(p[i].fi<<1)))%=md;
	}
	ans=(500000004ll*ans)%md;
	printf("%d",ans);
    return 0;
}




}

signed main()
{
    i207M::main();
    return 0;
}

Measured memory_bytes: 64640
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

using Pii = pair<int, int>;

constexpr int INF = 1 << 30;

template<typename T>class BIT {
    public:
    int n;
    vector<T> bit;
    
    BIT(int n): n(n){
        bit.resize(n);
        fill(bit.begin(), bit.end(), (T)0);
    }

    void add(int idx, T x){
        for(int i=idx;i<=this->n;i+=i&-i) bit[i] += x;
    }

    //bit[1]からbit[end]までの和 (閉区間)
    T sum(int end){
        T ret = (T)0;
        for(int i=end;i>=1;i-=i&-i) ret += bit[i];
        return ret;
    }

    T count_swap(vector<int> &v){
        T ret = (T)0;
        int m = v.size();
        for(int i=1;i<=m;++i){
            add(v[i-1], 1);
            ret += i - sum(v[i-1]);
        }
        return ret;
    }
};


int main() {
    int n;
    cin >> n;
    vector<Pii> a(n);
    for(int i=0;i<n;++i) cin >> a[i].first;
    for(int i=0;i<n;++i) cin >> a[i].second;

    int ans = INF;
    for(unsigned int bi=0;bi<(1<<n);++bi) { // カードを裏返す/裏返さないの組み合わせ
        if(__builtin_popcount(bi) % 2) continue; // 裏返っているカードの数が奇数にはならない

        vector<Pii> v[2];   // v[0]: 偶数番目に配置されるべきカード, v[1]: 奇数番目に配置されるべきカード
        {
            vector<Pii> tmp_v(n);
            for(int i=0;i<n;++i) {
                if(bi & (1 << i)) {
                    v[1-i%2].emplace_back(a[i].second, i);
                } else {
                    v[i%2].emplace_back(a[i].first, i);
                }
            }
            sort(v[0].begin(), v[0].end());
            sort(v[1].begin(), v[1].end());
        }

        bool is_ok = true;
        int prev_v = -1;
        vector<int> u(n);
        for(int i=0;i<n;++i) {
            if(i/2 >= v[i%2].size() || prev_v > v[i%2][i/2].first) {
                is_ok = false;
                break;
            }
            prev_v = v[i%2][i/2].first;
            u[i] = v[i%2][i/2].second + 1;
        }
        if(!is_ok) continue;

        BIT<int> tree(100);
        ans = min(ans, tree.count_swap(u));
    }

    cout << ((ans == INF)?-1:ans) << endl;
}


Measured memory_bytes: 256
# @author 

import sys

class AFiftyFifty:
    def solve(self):
        s = list(input().strip())
        s.sort()
        print("Yes" if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2]) else "No")


solver = AFiftyFifty()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 2940
#include <iostream>

int main()
{
    long X;
    std::cin >> X;
    constexpr int RANGE_MAX = 120;
    long pow5[RANGE_MAX];
    for (int i = 0; i < RANGE_MAX; i++)
    {
        long x = i;
        pow5[i] = x * x * x * x * x;
    }

    for (int A = 0; A < RANGE_MAX; A++)
    {
        for (int B = 0; B < A; B++)
        {
            if (pow5[A] - pow5[B] == X)
            {
                std::cout << A << " " << B << std::endl;
                return 0;
            }
            else if (pow5[A] + pow5[B] == X)
            {
                std::cout << A << " " << -B << std::endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3580
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	cout << fixed << setprecision(15);
	const ld pi = 3.14159265;
	ld r;
	cin >> r;
	cout << 2 * r * pi << endl;
}


Measured memory_bytes: 3788
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
#show_flg=True

n,m=MI()
g=[[] for _ in range(n)]
t=1<<n
mask=t-1
for i in range(m):
    a,b=LI_()
    g[a].append(b)
    g[b].append(a)

dp=[[0]*n for _ in range(t)]
dp[1][0]=1

for s in range(t):
    for h in range(n):
        if s&(1<<h)==0:
            #show('pas1')
            continue
        for f in g[h]:
            if s&(1<<f)==0:
                #show('pas2')
                continue
            
            dp[s][h]+=dp[s-(1<<h)][f]
            show('!dp','s,h,f',bin(s+t)[3:],h,f,'|',dp[s][h],dp[s-(1<<h)][f])

ans=0
for i in range(1,n):
    ans+=dp[t-1][i]

print(ans)
show(g)
show(dp)


Measured memory_bytes: 40688
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}


ll a, b, tmp, ans = 1;

int main() {

	cin >> a >> b;

	tmp = gcd(a, b);

	REP(i, 2, 1000002) {
		if (tmp % i == 0) {
			ans++;
			while (tmp % i == 0)tmp /= i;
		}
	}
	if (tmp > 1)ans++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long int k,a,b,n;
    cin>>k>>a>>b;
    n=1;
    if (b-a<=2 || k<=a) cout<<k+1<<endl;
    else{
        while (k>0){
            if (n<a || k==1) {
                n++;
                k--;
            }
            else{
                k-=2;
                n+=b-a;
            }
        }
        cout<<n<<endl;
    }
}


Measured memory_bytes: 256
n = gets.chomp.to_i
s = gets.chomp

ss = s.split('')

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""

ss.each do |x|
  i = alpha.index(x)
  i += n
  if i >= 26
    i -= 26
  end
  ans += alpha[i]
end

puts ans


Measured memory_bytes: 19836
#include<bits/stdc++.h>
using namespace std;
bool all(string s, char c){
    for(int i=0;i<s.size();i++)
        if (s[i] != c) return false;
    return true;
}

int main(){
    string s;
    cin >> s;
    int ans = 10000;
    for(char c = 'a'; c <= 'z'; c++){
        int cnt = 0;
        string subs = s;
        while(!all(subs, c)){
            cnt++;
            string ss = "";
            for(int i=0;i<subs.size()-1;i++){
                if(subs[i] == c || subs[i+1] == c)
                    ss += c;
                else
                    ss += subs[i];
            }
            subs = ss;
        }
        if(cnt != s.size())
            ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::vector<ll> v(n);
  rep(i,0,n)std::cin>>v[i];

  std::sort(all(v));

  double ans=(v[0]+v[1])/(double)2;

  rep(i,2,n)ans=(ans+v[i])/(double)2;

  std::cout<<ans;

  return 0;
}

Measured memory_bytes: 256
#include <atcoder/fenwicktree>
#include <cstdio>

using namespace std;
using namespace atcoder;

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

    fenwick_tree<long long> fw(n);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        fw.add(i, a);
    }

    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        if (t == 0) {
            int p, x;
            scanf("%d %d", &p, &x);
            fw.add(p, x);
        } else {
            int l, r;
            scanf("%d %d", &l, &r);
            printf("%lld\n", fw.sum(l, r));
        }
    }
}


Measured memory_bytes: 8232
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

T gcd(T)(T a, T b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int calc(int[] a) {
    int n = cast(int)a.length;

    // lt[i] = A_0, A_1, ..., A_{i-1} の最大公約数
    auto lt = new int[n + 1];
    // rt[i] = A_i, A_{i+1}, ..., A_{N-1} の最大公約数
    auto rt = new int[n + 1];

    for (int i = 0; i < n; i++)
        lt[i + 1] = gcd(lt[i], a[i]);

    for (int i = n - 1; i >= 0; i--)
        rt[i] = gcd(rt[i + 1], a[i]);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = max(ans, gcd(lt[i], rt[i + 1]));
    }
    return ans;
}

// 別解:
// 1 つしか削除できないのだから、任意の 2 つの約数の最大値が答えになる
int calc2(int[] a) {

    size_t f(int n) {
        return a.count!(e => e % n == 0);
    }

    int n = cast(int)a.length;
    int ans = 0;
    foreach (x; a.take(2)) {
        for (int i = 1; i * i <= x; i++) {
            if (x % i == 0) {
                if (f(i) >= n - 1) ans = max(ans, i);
                if (f(x / i) >= n - 1) ans = max(ans, x / i);
            }
        }
    }
    return ans;
}

void main() {
    readint;
    auto a = readints;
    // writeln(calc(xs));
    writeln(calc2(a));
}


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

int main() {
    int n, m;
    cin >> n >> m;

    int total = 0;
    while (m--) {
        int temp;
        cin >> temp;
        total += temp;
    }

    if (n - total < 0)
        cout << -1;
    else
    cout << n - total;
}

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

int main() {
	int A = 0;
	int B = 0;

	cin >> A >> B;

	if(13 <= A) {
		cout << B << endl;
	} else if(6 <= A && A <= 12) {
		cout << B / 2 << endl;
	} else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256