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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
int main()
{
    int N;
    cin >> N;

    vector<tuple<string, int, int>> data;

    rep(i, N)
    {
        string s;
        int p;
        cin >> s >> p;
        data.push_back(make_tuple(s, -p, i + 1));
    }

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

    rep(i, N)
    {
        cout << get<2>(data[i]) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#define rep(i,N) for(int i=0; i<N;i++)
using namespace std;

int main(){
    int A,B,ans;
    cin >>A>>B;
    ans=A*B;
    cout <<ans<<endl;
    return 0;
}


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

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

  ll d[n];

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

  ll sum =0;

  for(ll i=0; i<n; ++i){
    for(ll j=i+1; j<n; ++j){
      sum += d[i] * d[j];
    }
  }
  cout << sum;
}

  

Measured memory_bytes: 256
#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

#[allow(unused_macros)]
macro_rules! trace {
    ($var:expr) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    };
    ($($args:expr),*) => {
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($($args),*), ($($args),*));
    };
}

const M: usize = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut memo = vec![0; 100007];
    for _ in 0..n {
        let x: usize = sc.cin();
        memo[x] += 1;
        memo[x+1] += 1;
        memo[x+2] += 1;
    }
    let mut ans = 0;
    for i in 0..100007 { ans = max(ans, memo[i]); }
    println!("{}", ans);

}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}


Measured memory_bytes: 10492
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}

signed main() {
	int h, a;
	cin >> h >> a;
	if (h % a == 0) cout << h / a << endl;
	else cout << h / a + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	int ans = inf;
	for(int x = -100; x <= 100; x++){
		int s = 0;
		rep(i, n) s += (a[i] - x) * (a[i] - x);
		ans = min(ans, s);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(All(A));
    if(A[0] == 0) {
        cout << 0 << endl;
        return 0;
    }
    ll tmp = 1;
    rep(i, N) {
        if(1e18 / A[i] < tmp) {
            cout << -1 << endl;
            return 0;
        }
        tmp *= A[i];
        if(tmp > (ll)1e18) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << tmp << endl;
    return 0;
}

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

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    long  ans =0;
    for(int i = 0;  i < s.size() ;i++)
    {
        if(s[i] != t[i]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int solve(int n, int m, const vector<vector<int> > & g, int start, int goal) {
    vector<array<int, 3> > dist(n, { INT_MAX, INT_MAX, INT_MAX });
    queue<pair<int, int> > que;
    auto push = [&](int x, int y, int d) {
        if (dist[x][y] != INT_MAX) return;
        dist[x][y] = d;
        que.emplace(x, y);
    };
    push(start, 0, 0);
    while (not que.empty()) {
        int x, y; tie(x, y) = que.front();
        que.pop();
        for (int z : g[x]) {
            push(z, (y + 1) % 3, dist[x][y] + 1);
        }
    }
    if (dist[goal][0] == INT_MAX) return -1;
    assert (dist[goal][0] % 3 == 0);
    return dist[goal][0] / 3;
}

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int> > g(n);
    REP (i, m) {
        int u, v; cin >> u >> v;
        -- u; -- v;
        g[u].push_back(v);
    }
    int s, t; cin >> s >> t;
    -- s; -- t;
    cout << solve(n, m, g, s, t) << endl;
    return 0;
}


Measured memory_bytes: 6912
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
//  order_of_key (k) : Number of items strictly smaller than k .
//  find_by_order(k) : K-th element in a set (counting from zero).
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5 + 5;
const int INF = 1e9 + 5;

int h, n, a[N], sum;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> h >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	if(sum >= h) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}
/*
	If you only do what you can do, 
	You will never be more than you are now!
*/

Measured memory_bytes: 640
N = int(input())
V = input().split()
C = input().split()
V_int = [int(x) for x in V]
C_int = [int(x) for x in C]

ans = 0
Sub = [a - b for a, b in zip(V_int, C_int)]
for x in Sub:
    if x > 0 :
        ans = ans + x
print(ans)

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 60, M = 1010;

LL a, b;

LL get(LL n)
{
	if (n % 4 == 0) return n;
	else if (n % 4 == 1) return 1;
	else if (n % 4 == 2) return n + 1;
	else if (n % 4 == 3) return 0;
}

int main()
{
	cin >> a >> b;
	cout << (get(b) ^ get(a - 1)) << endl;
	return 0;
}

Measured memory_bytes: 256
import Data.List
main=do
 [n,k]<-map read.words<$>getLine
 v<-map read.words<$>getLine
 (print.maximum.(map (g n k v))) [(l,r)|l<-[0..k],r<-[0..k],l+r<=(min k n)]
  where g n k v (l,r) = h (sort((take l v)++(drop (n-r) v))) (k-l-r)
        h l 0 = sum l
        h [] _ = 0
        h l k = if (head l)<0 then (h (tail l) (k-1)) else (sum l)

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

int main(){
    int x,y,w,h,r;
    cin >> w >> h >> x >> y >> r;
    
    if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int N,K;
int x[109];
int main(){
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>x[i];
  }
  int ans=0;
  for(int i=0;i<N;i++){
    ans+=K-x[i]<x[i] ? K-x[i] : x[i];
  }
  cout<<ans*2<<endl;
}

Measured memory_bytes: 256
n = int(input())
d={"AC":0,"WA":0,"TLE":0,"RE":0}

for i in range(n):
  c = str(input())
  d[c]+=1

print("AC x "+ str(d["AC"]))
print("WA x "+ str(d["WA"]))
print("TLE x "+ str(d["TLE"]))
print("RE x "+ str(d["RE"]))

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

const int MAXN = 100010;
void bye() { std::cout << "No\n"; exit(0); }
int deg[MAXN], xs[MAXN], ys[MAXN];
int n, m, vis[MAXN], tc;
int head[MAXN], nxt[MAXN << 1], to[MAXN << 1];
void addedge(int b, int e, int tot) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e;
	nxt[++tot] = head[e]; to[head[e] = tot] = b;
}
int rt;
int dfs(int u, int fa = 0) {
	if (!fa) rt = u;
	vis[u] = true;
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa) {
			if (vis[to[i]] && to[i] == rt) {
				xs[i >> 1] = 0;
				++tc;
				return true;
			}
			if (!vis[to[i]] && dfs(to[i], u)) {
				xs[i >> 1] = 0;
				++tc;
				return true;
			}
		}
	return false;
}
void reducecir() {
	memset(vis, 0, n + 1 << 2);
	memset(head, 0, n + 1 << 2);
	for (int i = 1; i <= m; ++i) if (xs[i])
		addedge(xs[i], ys[i], i * 2 - 1);
	for (int i = 1; i <= n; ++i) if (!vis[i] && dfs(i)) return ;
}

int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		std::cin >> xs[i] >> ys[i];
		++deg[xs[i]]; ++deg[ys[i]];
	}
	for (int i = 1; i <= n; ++i) if (deg[i] & 1) bye();
	int cnt = 0, cnt2 = false;
	for (int i = 1; i <= n; ++i) cnt += deg[i] == 4, cnt2 |= deg[i] > 4;
	if (!cnt2 && cnt < 3) {
		reducecir();
		if (tc < m) reducecir();
		if (tc == m) bye();
	}
	std::cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
	int N, M,ans = 0;
	string s[105];

	map<string, int>mpb,mpr;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> s[i];
		mpb[s[i]]++;
	}

	cin >> M;

	for (int i = 0; i < M; i++) {
		string m;
		cin >> m;
		mpr[m]++;
	}

	for (int i = 0; i < N; i++) {
		ans = max(ans, mpb[s[i]] - mpr[s[i]]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] c = new int[n];
		Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
		for (int i = 0; i < n; i++) {
			int ci = sc.nextInt();
			c[i] = ci;
			if (map.containsKey(ci)) {
				map.get(ci).add(i);
			} else {
				List<Integer> list = new ArrayList<Integer>();
				list.add(i);
				map.put(ci, list);
			}
		}
		sc.close();

		Set<Integer> set = new HashSet<Integer>();
		long[] dp = new long[n];
		dp[0] = 1;
		set.add(c[0]);
		for (int i = 1; i < n; i++) {
			int ci = c[i];
			if (ci == c[i - 1]) {
				dp[i] = dp[i - 1];

			} else if (set.contains(ci)) {
				List<Integer> list = map.get(ci);
				int idx = binarySearch(list, i);
				dp[i] = (dp[i - 1] + dp[list.get(idx)]) % 1000000007;

			} else {
				dp[i] = dp[i - 1];
			}
			set.add(ci);
		}
//		for (int i = 0; i < dp.length; i++) {
//			System.out.print(dp[i] + " ");
//		}
//		System.out.println();
		System.out.println(dp[n - 1] % 1000000007);
	}

	public static int binarySearch(List<Integer> list, int val) {
		int start = -1;
		int end = list.size();

		while (Math.abs(end - start) > 1) {
			int mid = (end + start) / 2;
			if (list.get(mid) >= val) {
				end = mid;
			} else {
				start = mid;
			}
		}
		return start;
	}
}


Measured memory_bytes: 118976
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    ll x, y;
    cin >> x >> y;

    int ans = 0;
    ll a    = x;
    while (a <= y) {
        ans++;
        a *= (ll)2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import copy
import time

t1 = time.time()

def calc(T):
    res = 0
    L = [0]*26
    for i in range(D):
        res += S[i][T[i]-1]
        L[T[i]-1] = i+1
        for j in range(26):
            res -= C[j]*(i+1-L[j])
    return res
    
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)]

T = [0]*D
for i in range(D):
    temp = -1
    for j in range(26):
        if temp < S[i][j]:
            temp = S[i][j]
            idx = j+1
    T[i] = idx

p = calc(T)

i = 0
next = 1
while time.time()-t1 < 1.9:
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp
    i += next
    if i == -1:
        i = 1
        next = 1
    elif i == D:
        i = D-2
        next = -1

for t in T:
    print(t)

Measured memory_bytes: 77260
import sys
sys.setrecursionlimit(10**7)
def f(v):
    if dp[v] != 0:
        return dp[v]
    res = 0
    for i in graph[v]:
        res = max(res,f(i)+1)
    dp[v] = res
    return res
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)
dp = [0]*N
ans = 0
for i in range(N):
    ans = max(ans,f(i))
print(ans)

Measured memory_bytes: 124880
import re

N = int(input())
H = list(map(int, input().split(' ')))

def particles(ht):
	global N
	global H
	s = ''
	for i in range(N):
		if H[i] >= ht:
			s += '#'
		else:
			s += '.'
	return s

result = 0

for j in range(100):
	if particles(j+1).count('#') == 0:
		break
	else:
		result += len(re.compile(r'#+').findall(particles(j+1)))

print(result)

Measured memory_bytes: 3188
K, X = [int(i) for i in input().split()]

X_min = max(-1000000, X - K + 1)
X_max = min(+1000000, X + K - 1)

block_stones = [str(X_min + i) for i in range(X_max - X_min + 1)]
print(" ".join(block_stones))


Measured memory_bytes: 2940
#include <cstdio>
#include <vector>

using namespace std;

int H, W;

inline bool hantei(vector<vector<int> > tatami)
{
	bool ok = true;

	for (int k = 0; k < H - 1; k++)
	{
		for (int l = 0; l < W - 1; l++)
		{
			int c1 = tatami[k][l];
			int c2 = tatami[k][l + 1];
			int c3 = tatami[k + 1][l];
			int c4 = tatami[k + 1][l + 1];

			bool ok2 = !(c1 > 0 && c2 > 0 && c3 > 0 && c4 > 0 && c1 != c2 && c1 != c3 && c1 != c4 && c2 != c3 && c2 != c4 && c3 != c4);

			ok = ok && ok2;
		}
	}

	return ok;
}

inline int dfs(int count_, vector<vector<int> > tatami)
{
	if ((count_ - 1) * 2 == H * W)
	{
		return 1;
	}

	int sum = 0;

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (!tatami[i][j])
			{
				if (H - i - 1)
				{
					if (!tatami[i + 1][j])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i + 1][j] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				if (W - j - 1)
				{
					if (!tatami[i][j + 1])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i][j + 1] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				return sum;
			}
		}
	}

	return 0;
}

int main()
{
	while (true)
	{
		scanf("%d", &H);
		scanf("%d", &W);

		if (H == 0 && W == 0) { break; }

		if (H % 2 == 1 && W % 2 == 1)
		{
			printf("0\n");
		}
		else if (H == 1 || W == 1)
		{
			printf("1\n");
		}
		else if (H == W)
		{
			printf("2\n");
		}
		else
		{
			vector<vector<int> > start(H, vector<int>(W, 0));

			printf("%d\n", dfs(1, start));
		}
	}

	return 0;
}

Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
const int INF = 1e9;
template <class T> T Next() { T buf; cin >> buf; return buf; }

const long INFLL = 1e18;
int main() {
  int a, b, c, z;
  cin >> a >> b >> c >> z;
  
  vector<long> s, t, u;
  s.reserve(a + 1);
  t.reserve(b + 1);
  u.reserve(c + 1);
  for (int i = 0; i < a; ++i) s.push_back(Next<long>());
  for (int i = 0; i < b; ++i) t.push_back(Next<long>());
  for (int i = 0; i < c; ++i) u.push_back(Next<long>());
  
  sort(s.rbegin(), s.rend());
  sort(t.rbegin(), t.rend());
  sort(u.rbegin(), u.rend());
  s.push_back(-INFLL);
  t.push_back(-INFLL);
  u.push_back(-INFLL);
  
  unordered_set<int> st;
  priority_queue<pair<long, int>> Q;
  Q.push(make_pair(s[0] + t[0] + u[0], 0));
  
  int cnt = 0;
  while (cnt < z) {
    auto q = Q.top(); Q.pop();
    long sc = q.first;
    int pos = q.second;
    if (st.count(pos)) continue;
    st.insert(pos);
    
    int i =  pos        & 0x3ff;
    int j = (pos >> 10) & 0x3ff;
    int k = (pos >> 20) & 0x3ff;
    
    cout << sc << endl;
    Q.push(make_pair(s[i + 1] + t[j] + u[k], pos +  1       ));
    Q.push(make_pair(s[i] + t[j + 1] + u[k], pos + (1 << 10)));
    Q.push(make_pair(s[i] + t[j] + u[k + 1], pos + (1 << 20)));
    ++cnt;
  }
}


Measured memory_bytes: 512
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-02 22:48:31
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << (vec.empty() ? "{}" : "}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << (st.empty() ? "{}" : "}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << (mp.empty() ? "{}" : "}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

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

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, q; cin >> n >> m >> q;

  vector<pair<pair<int, int>, pair<int, int>>> in;

  for (int i = 0; i < q; ++i) {
    int a, b, c, d; cin >> a >> b >> c >> d;
    --a; --b;
    in.emplace_back(make_pair(a, b), make_pair(c, d));
  }

  vector<int> tv;

  int64 ans = 0;

  auto dfs = [&](const auto& dfs) -> void {
    if ((int)tv.size() == n) {
      debug(tv);
      int64 t = 0;
      for (int j = 0; j < q; ++j) {
        if (tv[in[j].first.second] - tv[in[j].first.first] == in[j].second.first) {
          t += in[j].second.second;
        }
      }
      ans = max(ans, t);
    } else {
      for (int j = (tv.empty() ? 1 : tv.back()); j <= m; ++j) {
        tv.emplace_back(j);
        dfs(dfs);
        tv.pop_back();
      }
    }
  };

  dfs(dfs);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3592
//おまじないc++
//おまじないc++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
 
int main() {
 

  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  
  int dx=tx-sx;
  int dy=ty-sy;
  
  for(int i=0;i<dx;i++){
    cout<<'R';
  }
  
  
  for(int i=0;i<dy;i++){
    cout<<'U';
  }
  
  for(int i=0;i<dx;i++){
    cout<<'L';
  }
  rep(i,dy){
    cout<<'D';
  }
  
  
  cout<<'D';
  
  for(int i=0;i<dx;i++){
    cout<<'R';
  }
  
  cout<<'R'<<'U';
  
   for(int i=0;i<dy;i++){
    cout<<'U';
  }
  
  
  cout<<'L'<<'U';
  
  for(int i=0;i<dx;i++){
    cout<<'L';
  }
  cout<<'L'<<'D';
  
  rep(i,dy){
    cout<<'D';
  }
  
  cout<<'R';
  
}
  
  
  
  
  
  
  

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
M = 10**6 + 1

counts = [0 for _ in range(M)]
for a in A:
  counts[a] += 1

integers = [1 for _ in range(M)]
integers[0] = 0
integers[1] = 0
max_count = 0
for i in range(M):
   if integers[i] >= 1:
    count = 0
    for j in range(i,M,i):
      count += counts[j]
      integers[j] = 0
    max_count = max(max_count,count)

if max_count == N:
  answer = 'not coprime'
elif max_count >= 2:
  answer = 'setwise coprime'
else:
  answer = 'pairwise coprime'

print(answer)

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, A, B;
    string S;
    cin >> N >> A >> B;
    cin >> S;

    ll c = 0, d = 1;
    REP(i,0,N) {
        if(S[i] == 'a') {
            if(c < A+B) {
                ++c;
                PR("Yes");
            }
            else PR("No");
        }
        else if(S[i] == 'b') {
            if(c < A+B && d <= B) {
                ++c;
                PR("Yes");
            }
            else PR("No");
            ++d;
        }
        else PR("No");
    }


    return 0;
}

/*



*/

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

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<bool> b;
    for (auto x: s) {
        if (x == 'R') b.push_back(false);
        else b.push_back(true);
    }
    int cnt = 0;
    for (int i = 0; i < n-1; i++) {
        if (b[i] != b[i+1]) {
            cnt++;
            int d = 1;
            while (i+d < n && b[i+d] != b[i]) {
                b[i+d] = b[i];
                d++;
            }
            i = i + d - 1;
            if (cnt == k) break;
        }
    }
    int ans = 0;
    for (int i = 0; i < n-1; i++) {
        if (b[i] == b[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3756
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = sorted(a)
    
    for i in range(n):
        if a[i] <=  b[n // 2 - 1]:
            print(b[n // 2])
        elif a[i] >  b[n // 2 - 1]:
            print(b[n // 2 - 1])
        
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 25556
//此程序使用了qt专属名称，请勿模仿。侵权必究！！！
//我真是太菜了啊……
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=410;
int n,m,fa[N],in[N],out[N];
bool v[N];
inline int read()
{
	int sum=0,flag=1; char c;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') flag=-1;
	for(;c>='0'&&c<='9';c=getchar()) sum=(sum<<3)+(sum<<1)+c-'0';
	return sum*flag;
}
inline int getfa(int x)
{
	if(fa[x]^x) fa[x]=getfa(fa[x]);
	return fa[x];
}
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m*2;++i) fa[i]=i;
	for(int i=1;i<=n;++i)
	{
		int a=read(),b=read(),c=read(),d=read(),x,y;
		if(c) x=m-c; else x=m+a;
		if(d) y=m+d; else y=m-b;
		++in[y],++out[x];
		fa[getfa(x)]=getfa(y);
	}
	for(int i=1;i<=m;++i) if(in[i]<out[i]) {puts("NO"); return 0;}
	for(int i=m+1;i<=m*2;++i) if(in[i]>out[i]) {puts("NO"); return 0;}
	for(int i=1;i<=m*2;++i) v[getfa(i)]|=(in[i]^out[i])||(in[i]==0&&out[i]==0);
	for(int i=1;i<=m*2;++i) if((fa[i]==i)&&(!v[i])&&(i^m)) {puts("NO"); return 0;}
	puts("YES"); return 0; 
}

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

vector<int> a(4);
string s("+-*");

int f(int x,int y,int c){
	switch(c){
	case 0:
		return x + y;
	case 1:
		return x - y;
	case 2:
		return x * y;
	}
	return 0;
}

int main(){
	while(cin>>a[0]>>a[1]>>a[2]>>a[3],a[0]||a[1]||a[2]||a[3]){
		sort(a.begin(),a.end());
		int flag = 1;
		do{
			for(int i = 0; i < 3; i++){
				for(int j = 0; j < 3; j++){
					for(int k = 0; k < 3; k++){
						if(f(f(f(a[0],a[1],i),a[2],j),a[3],k) == 10){
							cout<<"((("<<a[0]<<" "<<s[i]<<" "<<a[1]<<")"<<" "<<s[j]<<" "<<a[2]<<")"<<" "<<s[k]<<" "<<a[3]<<")"<<endl;
							i = j = k = 3;
							flag = 0;
							break;
						}
						if(f(f(a[0],a[1],i),f(a[2],a[3],k),j) == 10){
							cout<<"(("<<a[0]<<" "<<s[i]<<" "<<a[1]<<") "<<s[j]<<" ("<<a[2]<<" "<<s[k]<<" "<<a[3]<<"))"<<endl;
							i = j = k = 3;
							flag = 0;
							break;
						}
						if(f(f(a[0],f(a[1],a[2],j),i),a[3],k) == 10){
							cout<<"(("<<a[0]<<" "<<s[i]<<" ("<<a[1]<<" "<<s[j]<<" "<<a[2]<<")) "<<s[k]<<" "<<a[3]<<")"<<endl;
							i = j = k = 3;
							flag = 0;
							break;
						}
						if(f(a[0],f(f(a[1],a[2],j),a[3],k),i) == 10){
							cout<<"("<<a[0]<<" "<<s[i]<<" (("<<a[1]<<" "<<s[j]<<" "<<a[2]<<") "<<s[k]<<" "<<a[3]<<"))"<<endl;
							i = j = k = 3;
							flag = 0;
							break;
						}
					}
				}
			}
		}while(next_permutation(a.begin(),a.end()) && flag);
		if(flag) cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main()
{
	char s1[11], s2[11], s3[11];
	cin >> s1 >> s2 >> s3;
	s1[0] = s1[0] - 32;
	s2[0] = s2[0] - 32;
	s3[0] = s3[0] - 32;
	cout << s1[0] << s2[0] << s3[0] << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long n,x;
  cin >> n >> x;
  vector<long> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  long sum;
  long answer = 0;
  if(a.at(0) > x){
    answer = a.at(0) - x;
    a.at(0) = x;
  }
  rep(i,n-1){
    sum = a.at(i) + a.at(i+1);
    if(sum > x){
      a.at(i+1) -= sum - x;
      answer += sum - x;
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 1024
N = int(input())

dp = [10**18] * (N + 1)
dp[0] = 0

for i in range(N):
    prd = 6
    while i + prd <= N:
        dp[i + prd] = min(dp[i + prd], dp[i] + 1)
        prd *= 6
    prd = 9
    while i + prd <= N:
        dp[i + prd] = min(dp[i + prd], dp[i] + 1)
        prd *= 9

ans = 10**18
for i, c in enumerate(dp):
    ans = min(ans, N - i + c)
print(ans)


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

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

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

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

long long INF = 1LL<<60;
int main( ){
    ll N; cin>>N;
    string ans;
    while(N>0&&N/26!=0){
        ll rem=N%26;
        if(rem<=0)rem+=26,N-=26;
        ans+=(rem-1)+'a';
        N/=26;
    }
    if(N>0)ans+='a'+N-1;
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}




Measured memory_bytes: 3628
n, *hs = $<.read.split($/).map(&:to_i)
hs.sort!.reverse!

count = 0 
unfilled_dist = 0 
capacity = 1 

hs.each_with_index {|h, i|
    break if h < unfilled_dist
    count += h + 1 - unfilled_dist
    capacity -= 1
    if capacity == 0
        unfilled_dist += 1
        capacity = 4 * unfilled_dist - i - 1 
    end 
}

p count

Measured memory_bytes: 6100
n=int(input())
p=list(map(int,input().split()))
l=[0]+[i for i in range(n+1)]#l_i...p_iよりも大きいもので、左側かつp_iに一番近い要素のindex
r=[i+1 for i in range(n+1)]+[n+1]#r_i...l_iの右側ver
d=[0]*(n+1)
for i in range(n):d[p[i]]=i+1
ans=0
for i in range(1,n+1):
  ans+=((r[r[d[i]]]-r[d[i]])*(d[i]-l[d[i]])+(r[d[i]]-d[i])*(l[d[i]]-l[l[d[i]]]))*i#l_iでで一番近い、l_(l_i)で二番目に近い(indexの差分取ってアレコレ計算)
  l[r[d[i]]],r[l[d[i]]]=l[d[i]],r[d[i]]#右側(左側)にある一番近いものを、自分を飛び越えて左側(右側)にくっつける(大小比較はしなくても良くて、どうせ後でまた更新される)
print(ans)

Measured memory_bytes: 19428
INF = float("inf")
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
opens = []
for i in range(N):
    opens.append(nl())
profits = []
for i in range(N):
    profits.append(nl())

max_profit = -INF

import itertools
for p in itertools.product([0, 1], repeat=10):
    if all([i == 0 for i in p]):
        continue
    profit = 0
    for i in range(N):
        count = 0
        for j in range(10):
            count += opens[i][j] * p[j]
        profit += profits[i][count]
    if profit > max_profit:
        max_profit = profit

print(max_profit)



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n),b(n); for(auto&&i:a)cin>>i; for(auto&&i:b)cin>>i;
	priority_queue<int>pq;
	vector<int>v;
	for(int i=0;i<n;++i){
		int dif=a.at(i)-b.at(i);
		if(dif>0)pq.push(dif);
		else if(dif<0)v.emplace_back(dif);
	}
	int ans=0,i=0;
	while(pq.size()&&i<v.size()){
		int tp=pq.top(); pq.pop();
		++ans;
		while(i<v.size()){
			int mix=tp+v.at(i);
			v.at(i)=min(0,mix);
			tp=max(0,mix);
			if(!v.at(i))++ans,++i;
			if(!tp)break;
		}
	}
	cout<<(i!=v.size()?-1:ans)<<"\n"s;
}


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

int main(){
    int a, b, X;
    cin >> a >> b >> X;
    int count = 0, i = a;
    while(a<=i && b>=i){
        if(X%i == 0){
            count++;
        }
        i++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int ans[1000];
int main()
{
    int ara[100][100];
    int a,b,i,j,sum,n,p;
    for(i=1; i<=3; i++)
    {
        for(j=1; j<=3; j++)
        {
            cin>>ara[i][j];
        }
    }
    cin>>n;
    for(p=1; p<=n; p++)
    {
        cin>>a;
        for(i=1; i<=3; i++)
        {
            for(j=1; j<=3; j++)
            {
                if(ara[i][j]==a)
                {
                    ara[i][j]=1;
                }
            }
            /*for(i=1;i<=3;i++)
            {
                for(j=1;j<=3;j++)
                {
                    cout<<ara[i][j];
                }
            }*/
        }
    }
    if(ara[1][1]==1&&ara[1][2]==1&&ara[1][3]==1||ara[2][1]==1&&ara[2][2]==1&&ara[2][3]==1||ara[3][1]==1&&ara[3][2]==1&&ara[3][3]==1||ara[1][1]==1&&ara[2][1]==1&&ara[3][1]==1||ara[1][2]==1&&ara[2][2]==1&&ara[3][2]==1||ara[1][3]==1&&ara[2][3]==1&&ara[3][3]==1||ara[1][1]==1&&ara[2][2]==1&&ara[3][3]==1
            ||ara[1][3]==1&&ara[2][2]==1&&ara[3][1]==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;




int main() {
	int n;
	cin >> n;
	vector<ll> c(n);
	for (int i = 0;i < n; i++) {
		cin >> c[i];
		
	}
	sort(c.begin(), c.end());


	
	int num = 2 * n - 2;

	ll coe = 1;
	ll b = 2;
	for (int i = 0; i <32;i++) {
		
		if (((num >> i) & 1) == 1) {
			coe = (coe*b) % MOD_CONST;
		}
		b = (b * b) % MOD_CONST;
		
		
	}

	

	
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		ll tmp = ((n + 1 - i) * c[i]) % MOD_CONST;
		sum = (sum + tmp) % MOD_CONST;
	}
	

	ll ans = (sum * coe) % MOD_CONST;

	cout << ans << endl;

}



Measured memory_bytes: 1792
N = int(input())
ans = 0

for i in range(1, N + 1, 2):
    d = 0
    for j in range(1, i + 1):
        if i % j == 0:
            d += 1
        else:
            continue
    if d == 8:
        ans += 1
    else:
        continue

print(ans)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;

const double PI = 3.141592653589793;


int main() {
	// fios;
	int r;
	cin >> r;
	cout << 2.0 * PI * (double)r << endl;

}


Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
#define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
#define LL long long
#define ULL unsigned LL
#define fi first
#define se second
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
typedef pair<int,int> pll;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9+7;
const int N = 2e5+10;
LL a[N];
LL b[N];
map<LL, LL> mp;
int main(){
    ///Fopen;
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &a[i]), b[i] = a[i] + b[i-1], mp[b[i]]++;
    map<LL,LL>::iterator it = mp.begin();
    LL ans = 0;
    while(it != mp.end()){
        if(it->first == 0) ans+= it -> second;
        ans += it->se * (it ->se-1) / 2;
        it++;
    }
    printf("%lld\n", ans);
    return 0;
}


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int M, D; cin >> M >> D;
        int ans = 0;
        repeat(i, 1, M+1) {
            repeat(j, 1, D+1) {
                int d1 = j % 10;
                int d2 = j / 10;
                ans+= (d1 >= 2) and (d2 >= 2) and (d1 * d2 == i);
            }
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[][] pattern = new int[n*(n-1)/2][4];//試合結果入力用
		
		int[] tensuu = new int[n];//勝ち得点記録用
		for(int i=0; i<n; i++){//初期化
			tensuu[i] = 0;
		}
		
		int[] rnk = new int[n];//順位用
		for(int i=0; i<n; i++){//初期化
			rnk[i] = 1;
		}
		
		for(int i=0; i<n*(n-1)/2; i++){//試合結果入力
			for(int j=0; j<4; j++){
				pattern[i][j] = s.nextInt();
			}
		}
		
		for(int i=0; i<n*(n-1)/2; i++){//勝ち得点を放り込む
			if(pattern[i][2]==pattern[i][3]){
				tensuu[pattern[i][0]-1]++;
				tensuu[pattern[i][1]-1]++;
			}
			if(pattern[i][2]<pattern[i][3]){
				tensuu[pattern[i][1]-1]+=3;
			}else if(pattern[i][2]>pattern[i][3]){
				tensuu[pattern[i][0]-1]+=3;
			}
		}
		for(int i=0; i<tensuu.length; i++){//順位
			for(int j=0; j<tensuu.length; j++){
				if(tensuu[i]<tensuu[j]){
					rnk[i]++;
				}
			}
		}
		for(int i=0; i<rnk.length; i++){
			System.out.println(rnk[i]);
		}
	}
}

Measured memory_bytes: 44100
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, sum, prod, diff;
	cin>>a>>b;
	sum = a+b;
	prod = a*b;
	diff = a-b;
	if ((sum > prod) &&(sum> diff))
		{
			cout<<sum<<endl;
		}
	else
		if((prod > sum) && (prod > diff))
			{
				cout<<prod<<endl;
			}
		else
			{
				cout<<diff<<endl;
			}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int S,h,m,s;
	scanf("%d",&S);
	h=S/60/60;
	m=S/60%60;
	s=S%60;
	if(S<=86400 && S>=0) {
		printf("%d:%d:%d\n",h,m,s);
	}
	return 0;
}

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

const ll MAX = 1e9;

int main() {
  string s;
  cin >> s;
  int l = 0;
  int r = s.length() - 1;

  int ans = 0;
  while (l <= r) {
    if (s[l] == s[r]) {
      l++;
      r--;
    } else if (s[l] == 'x') {
      ans++;
      l++;
    } else if (s[r] == 'x') {
      ans++;
      r--;
    } else {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;
}


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

int main()
{

	int n;

	while(true){

		int i[1000],p[1000],q[1000],r[1000];

		cin >> n;
		if(n==0)
			break;

		for(int j=0 ;j<n ;j++){

			cin >> i[j] >> p[j] >> q[j] >> r[j];
		}
		int P,Q,R,C;
		int sp=0,sq=0,sr=0;
		int cal[1000];
		int count=0;

		cin >> P >> Q >> R >> C;

		for(int j=0 ;j<n ;j++){
			sp = p[j]*4;
			sq = q[j]*9;
			sr = r[j]*4;
			cal[j] = sp + sq + sr;

			if(P >= p[j] && Q >= q[j] && R >= r[j] && C >= cal[j]){
				count++;
				cout << i[j] << endl;
			}
		}
		if(count == 0)
			cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 880
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);


int main()
{
	int n,i;
	sc(n);
	int a[n],b[n-1];
	rep(i,n-1)
	{
		sc(b[i]);
	}
	ll s=0LL;
	rep(i,n)
	{
		if(i==0)a[0]=b[0];
		else if(i==n-1)a[i]=b[i-1];
		else
		{
			a[i]=min(b[i],b[i-1]);
		}
		s+=(ll)a[i];
	}
	cout << s ;
    return 0;
}


Measured memory_bytes: 3668
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import groupby
from math import factorial

def comb(n,k):
    if(k<0 or n<k): return 0
    return factorial(n)//(factorial(k)*factorial(n-k))

def resolve():
    n,a,b=map(int,input().split())
    V=list(map(int,input().split()))
    V.sort(reverse=1)
    m=sum(V[:a])/a
    print(m)

    cnt=0
    for key,iter in groupby(V):
        k=len(list(iter))
        if(cnt+k>=a): break
        cnt+=k

    ans=0
    if(cnt==0):
        for i in range(a-cnt,min(k,b-cnt)+1):
            ans+=comb(k,i)
    else:
        ans=comb(k,a-cnt)
    print(ans)
resolve()

Measured memory_bytes: 39152
#include <iostream>

using namespace std;


//const int INF{1001001001};
//const int MOD{(int)1e9 + 7};
//const double EPS{1e-9};
////const double PI{acos(-1)};
//const int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1};



int main(){
    int A,B,C;
    
    cin >> A;
    cin >> B;
    cin >> C;
    
    if(A==B && B==C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
namespace aoj {
	public class Program {
		public static void Main() {
			var d = new Dictionary<int, int>();
			var list = new List<int>();
			string str;
			while ((str = Console.ReadLine()) != null) {
				if (str == "") break;
				var data = str.Split(',').Take(2).Select(int.Parse).ToArray();
				if (!d.ContainsKey(data[0])) d.Add(data[0], 1);
				else d[data[0]]++;
			}
			while ((str = Console.ReadLine()) != null) {
				var data = str.Split(',').Take(2).Select(int.Parse).ToArray();
				if (d.ContainsKey(data[0])) {
					list.Add(data[0]);
					d[data[0]]++;
				}
			}
			var sl = list.Distinct().ToList();
			sl.Sort();
			foreach (int p in sl) Console.WriteLine(p + " " + d[p]);
		}
	}
}

Measured memory_bytes: 10172
#include<iostream>
#include<string>

int main(){
  std::string str;

  std::getline(std::cin,str);
  for(int i=0;i<str.size();i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i] -= 32;
    }
  }
  std::cout << str << std::endl;
}

Measured memory_bytes: 3164