akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#define inc 1
#define dec -1
#define init 0


using  namespace std;

int main() {
    int n;
    long long c,k;
    cin >> n;
    cin >> c;
    cin >> k;
    vector<long long> T(n);
    for (int i = 0; i < n; ++i)  cin >> T[i];

    sort(T.begin(),T.end());
    long long buses = 0;
    long long passenger = 0;
    long long time = 0;
    for (int j = 0; j < n;j ++) {
        if(T[j] - T[j -passenger] <= k){
            passenger ++;
            if (passenger == c){
                passenger = 0;
                buses++;
            }
        }else{
            buses++;
            passenger = 1;
        }
    }

    if(passenger != 0) buses++;

    cout << buses;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var i = 1;
            while (true)
            {
                var a = int.Parse(Console.ReadLine());
                if (a == 0)
                    break;
                Console.WriteLine("Case {0}: {1}", i, a);
                i = i + 1;
            }
        }
    }
}

Measured memory_bytes: 9328
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(a, max(b, c))
#define MIN(x, y, z) min(a, min(b, c))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  char A, B;
  cin >> A >> B;
  if (A == B) {
    COUT("=");
    return 0;
  }

  if (A < B) {
    COUT("<");
  } else {
    COUT(">");
  }

  return 0;
}

Measured memory_bytes: 3632
from itertools import chain, permutations, dropwhile
from heapq import merge
from functools import wraps

def listify(fn):
  @wraps(fn)
  def wrapper(*args, **kwargs):
    return list(fn(*args, **kwargs))
  return wrapper

def comp_wild(a,b):
  return all(x==y or "?" in (x,y) for x,y in zip(a, b))

@listify
def includers(a,b):
  for i in range(len(a)-len(b)+1):
    if comp_wild(a[i:], b):
      yield i 

@listify
def connectors(a,b):
  for i in range(max(len(a)-len(b)+1, 1), len(a)+1):
    if comp_wild(a[i:], b):
      yield i

class c_int(int):
  def __new__(cls, *args, **kwargs):
    cond = kwargs.pop("cond", lambda:True)
    i = int.__new__(cls, *args, **kwargs)
    i.cond = cond
    return i

def iter_from(it, fm):
  return dropwhile(fm.__gt__, it)

def solve(a, b, c):
  keys = sorted((a,b,c), key=len, reverse=True)
  len_keys = list(map(len, keys))
  inc = { (i,j):includers(keys[i],keys[j]) for i,j in permutations(range(3), 2) }
  con = { (i,j):connectors(keys[i],keys[j]) for i,j in permutations(range(3), 2) }
  
  for i in inc[0,1]:
    for j in inc[0,2]:
      if (
        j+len_keys[2] <= i or i+len_keys[2] <= j or
        j-i in inc[1,2] or j-i in con[1,2] or i-j in con[2,1]
      ):
        return len_keys[0]
  
  def candicates(x,y,z):
    return chain(
      ( c_int(
          i+len_keys[z], 
          cond=lambda:(
            (inc[x,y] and inc[x,y][0]+len_keys[y] <= i) or 
            (inc[z,y] and len_keys[x] <= i+inc[z,y][-1]) or 
            any(
              (i-j in con[y,z] if i > j else j-i in inc[z,y])
               for j in iter_from(inc[x,y]+con[x,y], i-len_keys[y])
            )
          )
        ) for i in iter_from(con[x,z], len_keys[y]-len_keys[z]+1)
      ),
      ( c_int(
          min( i+next(iter_from(q, len_keys[x]-i+1))+len_keys[z] for i in p )
        ) for (p, q) in [sorted((con[x,y], con[y,z]), key=len)]
      ),
    )
  
  for c in merge(*( candicates(*xyz) for xyz in permutations(range(3), 3) )):
    if c.cond():
      return c
  
  return sum(len_keys)

print(solve(*(input() for i in range(3))))


Measured memory_bytes: 52828
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from collections import deque
inf = 10**18
H, W, K = mapint()
y1, x1, y2, x2 = mapint()
query = [list(str(input())) for _ in range(H)]
dirc = [(0, 1), (-1, 0), (0, -1), (1, 0)]

checked = [[-1]*W for _ in range(H)]
checked[y1-1][x1-1] = 0

queue = deque([(y1-1, x1-1)])
def bfs(queue):
    while queue:
        y, x = queue.popleft()
        if y==y2-1 and x==x2-1:
            return checked[y][x]
        for dy, dx in dirc:
            for i in range(1, K+1):
                ny, nx = y+(dy*i), x+(dx*i)
                if ny>=H or ny<0 or nx>=W or nx<0:
                    continue
                if query[ny][nx]=='@':
                    break
                if checked[ny][nx]<0:
                    checked[ny][nx] = checked[y][x]+1
                    queue.append((ny, nx))
                elif checked[ny][nx]<=checked[y][x]:
                    break
    return -1

print(bfs(queue))


Measured memory_bytes: 136844
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

input=sys.stdin.readline
n=int(input())
x=[int(input()) for _ in range(5)]
t=[0]*5
t[0]=math.ceil(n/x[0])
m=x[0]
for i in range(1,5):
    if x[i]>=m:
        t[i]=t[i-1]+1
    else:
        t[i]=i+math.ceil(n/x[i])
        m=x[i]
print(t[-1])

Measured memory_bytes: 63852
#include<cstdio>

using namespace std;

int main()
{
	static bool era[1000000];
	for(int i=2;i<1000;i++){
		if(!era[i])for(int j=i*i;j<1000000;j+=i)era[j]=true;
	}

	static int p[10001];
	for(int i=2,j=0;j<10001;i++)	if(!era[i])	p[j++]=i;

	static int s[10001]={0,p[0]};
	for(int i=1;i<10000;i++)	s[i+1]=s[i]+p[i];

	int n;
	while(scanf("%d",&n),n)	printf("%d\n",s[n]);

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    string L;
    cin >> L;
    int N = L.size();
    ll pw2[N+1], pw3[N+1];
    pw2[0] = 1, pw3[0] = 1;
    rep2(i, 1, N){
        pw2[i] = (pw2[i-1]*2)%MOD;
        pw3[i] = (pw3[i-1]*3)%MOD;
    }
    //これまで何回1があったか
    int cnt = 0;
    ll ans = 0;
    rep(i, N){
        if(L[i] == '0') continue;
        ans += (pw2[cnt] * pw3[N-1-i]) % MOD;
        ans %= MOD;
        cnt++;
    }
    ans += pw2[cnt];
    ans %= MOD;
    cout << ans << endl;
}

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

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll x,y,a,b,c,h;
vll v1,v2,v3,v4;
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>x>>y>>a>>b>>c;
		for(ll i=0;i<a;i++)cin>>h,v1.pb(h);
		for(ll i=0;i<b;i++)cin>>h,v2.pb(h);
		for(ll i=0;i<c;i++)cin>>h,v3.pb(h);
		sort(all(v1));reverse(all(v1));
		sort(all(v2));reverse(all(v2));
		sort(all(v3));reverse(all(v3));
		for(ll i=0;i<x;i++)v4.pb(v1[i]);
		for(ll i=0;i<y;i++)v4.pb(v2[i]);
		sort(all(v4));ll len = min(x+y,c);
		for(ll i=0;i<len;i++)
		{
			if(v3[i]>v4[i])v4[i] = v3[i];
			else break;
		}
		ll sum1 = 0;
		for(ll i=0;i<x+y;i++)sum1+=v4[i];
		cout<<sum1;




}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    
}

Measured memory_bytes: 7156
import java.util.*;
import java.io.*;

class Main
{
    static class Len
    {	
	int a[]; //= new int[2000010];
	int b[]; //= new int[2000010];
	
	Len(int n)
	{
	    a = new int[n+1];
	    b = new int[n+1];
	}
	

    }

    public static void main(String args[])
    {
	int n;
	int i, j, k;

	String line = new String();
	BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
	//PrintStream out = new PrintStream(System.out);

	//Read ----------------
	//Read n
	try{
	    line=line=bin.readLine();
	}	
	catch(IOException e){
	    System.out.println("Error");
	}

	n=Integer.parseInt(line);
	Len len = new Len(n);
	j=0;
	//Read A[]
	try{
	    line=bin.readLine();
	    //System.out.println(line);
	    StringTokenizer str = new StringTokenizer(line);   
	    for(i=0; i<n; i++)
		{
		    len.a[i]=Integer.parseInt(str.nextToken());
		    if(j<len.a[i])j=len.a[i];
		}
	}
	catch(IOException e){
	    System.out.println("Error");
	}

	//bin=null;

	//Read end------------


	//sort
	countingSort(len, j, n);

	//print
	StringBuffer s = new StringBuffer(100);
	for(i=1; i<=n; i++)
	    {
		s.append(len.b[i]);
		if(i!=n)s.append(" ");
	    }
	System.out.println(s);
	//	out.print(len.b[i]+" ");
	//out.println(len.b[n]);

	/*
	for(i=1; i<n; i++)System.out.print(len.b[i]+" ");
	System.out.println(len.b[n]);*/

    }

    static void countingSort(Len len, int max, int n)
    {
	int i, j, k;
	int[] c = new int[max+1];

	//for(i=0; i<=max; i++)c[i]=0;
	for(i=0; i<n; i++)c[len.a[i]]++;

	for(i=0; i<=max; i++)
	    {
		if(i!=0)c[i]+=c[i-1];
	    }

	for(i=n-1; i>=0; i--)
	    {
		len.b[c[len.a[i]]]=len.a[i];
		c[len.a[i]]--;
	    }
    }
}

Measured memory_bytes: 102000
import bisect
n,a,b = map(int,input().split())
v = list(map(int,input().split()))	
v.sort()
v = v[::-1]

ans = 0
for i in range(a):
    ans += v[i]
print(ans/a)
v = v[::-1]
k = n-bisect.bisect_left(v,v[n-a])
l = n-bisect.bisect_right(v,v[n-a])
ww = k
k = l
l = ww
#print(k,l)
jkl = [1]
for i in range(1,l+1):
    jkl.append(jkl[-1]*i)

ass = 0

if l -k==0:
    print(1)
elif k != 0:
    ass += jkl[l-k]//jkl[a-k]//jkl[l-a]
    print(ass)
else:
    for i in range(a,min(b,l)+1):
        ass += jkl[l]//jkl[i]//jkl[l-i]
    print(ass)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int x, y;
  cin >> x >> y;
  int a, b, c;
  cin >> a >> b >> c;

  priority_queue<int, vector<int>, greater<int> > p, q;
  rep(i, a) {
    int z;
    cin >> z;
    p.push(z);
  }
  rep(i, b) {
    int z;
    cin >> z;
    q.push(z);
  }
  while (sz(p) > x) {
    p.pop();
  }
  while (sz(q) > y) { // debuged, x to y
    q.pop();
  }
  vector<int> r(c);
  cin >> r;
  rep(i, c) {
    if (r[i] <= p.top() && r[i] <= q.top()) continue;
    // どっちかの最小値よりは大きい
    if (r[i] <= p.top()) {
      q.pop();
      q.push(r[i]);
    } else if (r[i] <= q.top()) {
      p.pop();
      p.push(r[i]);
    } else {
      // 両方の最小値より大きい
      if (p.top() < q.top()) {
        p.pop();
        p.push(r[i]);
      } else {
        q.pop();
        q.push(r[i]);
      }
    }
  }
  ll ans = 0;
  while (!p.empty()) {
    ans += p.top();
    p.pop();
  }
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int main() {
   stack<int> v;
   int n;
   while(cin>>n){
       if(n!=0)v.push(n);
       else {
           cout<<v.top()<<endl;
           v.pop();
       }
   }
   
    
    return 0;
}



Measured memory_bytes: 3028
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[] key = new int[256];

	public static void main(String[] args) {
		while (true) {
			StringBuilder sb = new StringBuilder();
			while (true) {
				String line = sc.nextLine();
				if (line.isEmpty()) break;
				sb.append(line);
			}
			char[] input = sb.toString().toCharArray();
			int N = input.length;
			Arrays.fill(key, -1);
			String keys = sc.nextLine();
			for (int i = 0; i < keys.length(); ++i) {
				key[keys.charAt(i)] = i;
			}
			int[] count = new int[keys.length()];
			int l = 0;
			int r = 0;
			int ans = Integer.MAX_VALUE;
			int ansC = 0;
			String repr = "";
			int found = 0;
			while (r < N) {
				while (r < N) {
					if (key[input[r]] >= 0) {
						if (count[key[input[r]]] == 0) ++found;
						count[key[input[r]]]++;
						if (found == keys.length()) break;
					}
					++r;
				}
				if (r == N) break;
				while (true) {
					if (key[input[l]] >= 0) {
						--count[key[input[l]]];
						if (count[key[input[l]]] == 0) {
							--found;
							if (r - l + 1 < ans) {
								ans = r - l + 1;
								ansC = 1;
								repr = String.valueOf(input, l, r - l + 1);
							} else if (r - l + 1 == ans) {
								++ansC;
							}
							++l;
							break;
						}
					}
					++l;
				}
				++r;
			}

			if (ansC == 0) {
				System.out.println(0);
			} else {
				System.out.println(ansC);
				StringBuilder result = new StringBuilder();
				for (int i = 0; i < repr.length(); ++i) {
					if (i % 72 == 0) {
						result.append('\n');
					}
					result.append(repr.charAt(i));
				}
				System.out.println(result);
			}
			System.out.println();
			if (!sc.hasNext()) break;
			sc.nextLine();
		}
	}

}

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

int main()
{
    int w,s,n,e,up,down;
    cin>>up>>s>>e>>w>>n>>down;
    int z;
    cin>>z;
    string st="SSSSRRRRWSSSSRRRRWSSSSRRRRWSSSSRRRR";
    REP(j,z)
    {
        int a,b;
        cin>>a>>b;
        REP(i,st.size())
        {
            if(up==a&&s==b){cout<<e<<endl;break;}
            int temp;
            if(st.at(i)=='S')
            {
                temp=s;
                s=up;
                up=n;
                n=down;
                down=temp;
            }
            if(st.at(i)=='W')
            {
                temp=w;
                w=up;
                up=e;
                e=down;
                down=temp;
            }if(st.at(i)=='R')
            {
                temp=s;
                s=e;
                e=n;
                n=w;
                w=temp;
            }
            if(up==a&&s==b){cout<<e<<endl;break;}
        }
    }
}


Measured memory_bytes: 3216
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
#define pint pair<int,int>
#define vi(v) rep(i,v.size())cin >> v[i]
#define vc(v) rep(i,v.size())cout << v[i] << endl
#define ni(n) cin >> n
#define nc(n) cout << n << endl
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  int n,m,k;
  cin >> n >> m >> k;
  bool ans = false;
  rep(i,n + 1)rep(j,m + 1){
    if(i * j + (n - i) * (m - j) == k)ans = true;
  }
  if(ans)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    def dfs(x):
        ans[x] = bisect_left(dp, inf)
        for e in edg[x]:
            if d[e]:
                d[e] = 0
                i = bisect_left(dp, a[e])
                p = dp[i]
                dp[i] = a[e]
                dfs(e)
                dp[i] = p
    n = II()
    a = LI()
    dp = [inf] * n
    edg = [[] for i in range(n)]
    for _ in range(n - 1):
        u, v = LI_()
        edg[u].append(v)
        edg[v].append(u)
    d = [1] * n
    ans = [1] * n
    d[0] = 0
    dp[0] = a[0]
    dfs(0)
    for a in ans:
        print(a)
    return


#main
if __name__ == '__main__':
    solve()


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  int res = 0;
  for (int a = 1; a < N + 1; a++) {
    int b = 1;
    while (a * b < N) {
      res++;
      b++;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int ans = 2 * (n / 11);
        if(n % 11 == 0){
            cout << ans << '\n';
        }else if(n % 11 <= 6){
            cout << ans + 1 << '\n';
        }else{
            cout << ans + 2 << '\n';
        }
    }
}


Measured memory_bytes: 31488
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main() {
  while(1) {
    int x, h;
    double area,x2;
    cin >> x >> h;
    if(x==0 && h==0) break;

    area=x*x;
    x2=(double)x/2;
    area+=(double)2*sqrt(h*h+x2*x2)*x;

    printf("%f\n",area);
  }
  return 0;
}


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

int max(int a,int b){return a > b ? a : b;}
int min(int a,int b){return a < b ? a : b;}

int main()
{
    int a,b,c,ans = 0;
    scanf("%d %d %d",&a,&b,&c);

    int sum = a + b + c;
    if(sum % 2 == max(a,max(b,c)) % 2)
    {
        ans = (max(a,max(b,c)) * 3 - sum) / 2;
    }
    else
    {
        ans = 1 + (max(a,max(b,c)) * 3 - sum + 1) / 2;
    }
    
    
    printf("%d",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;


int main(){
	int d = in.nextInt();
	vi v;
	int x = in.nextInt();
	rep(i, x){
		char c;
		int p;
		cin>>c>>p;
		if(c == 'D') v.pb(p);
	}
	vi u;
	int y = in.nextInt();
	rep(i, y){
		string s = in.next();
		int p = in.nextInt();
		if(s == "DD") u.pb(p);
	}
	sort(rall(v));
	sort(rall(u));
	int ans = 0;
	for(int i = 0; i <= u.size() && i * 2 <= d; i++){
		int j = d - i * 2, tmp = 0;
		j = min(j, (int)v.size());
		rep(k, j) tmp += v[k];
		rep(k, i) tmp += u[k];
		ans = max(tmp, ans);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1284
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    cin>>H>>W;
    char L[H+3][W+3];
    int D[H+3][W+3][5];
    
    for(int i=0;i<H+3;i++){
        for(int j=0;j<W+3;j++){
            L[i][j]='#';
        }
    }
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            cin>>L[i][j];
        }
    }
    for(int i=0;i<H+3;i++){
        for(int j=0;j<W+3;j++){
            for(int k=0;k<4;k++){
                D[i][j][k]=0;
            }
        }
    }
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            if(L[i][j]=='.'){
                D[i][j][0]+=D[i][j-1][0]+1;
                D[i][j][1]+=D[i-1][j][1]+1;
            }
        }
    }
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            if(L[H+1-i][W+1-j]=='.'){
                D[H+1-i][W+1-j][2]+=D[H+1-i][W+2-j][2]+1;
                D[H+1-i][W+1-j][3]+=D[H+2-i][W+1-j][3]+1;
            }
        }
    }
    int ans,cnt;
    ans=0;
    cnt=0;
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            cnt=0;
            for(int k=0;k<4;k++){
                cnt+=D[i][j][k];
            }
            if((cnt-3)>ans){
            ans=(cnt-3);
                
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A + B > C + D) {
    cout << "Left" << endl;
  }
  else if(A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

D, G = reads()
p = [0] * D; c = [0] * D
for i in range(D):
  p[i], c[i] = reads()

def subsets(s):
  return 

def divceil(a, b):
  return (a + b - 1) // b

ans = sum(p)
for sub in chain(*(combinations(range(D), r) for r in range(D))):
  rest = G - sum((i+1) * 100 * p[i] + c[i] for i in sub)
  k = max(set(range(D)).difference(sub))
  if rest <= p[k] * (k+1) * 100:
    n = max(divceil(rest, (k+1) * 100), 0)
    ans = min(ans, sum(p[i] for i in sub) + n)
print(ans)



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

int main(){
  int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  
  vector<int> op(N,1);
  int flag=0;
  int ad=0;
  for(int i=0;i<N-1;i++){
    if(ad==0){
      H.at(i)--;
    }
    if(H.at(i)>H.at(i+1)){
      flag=1;
      break;
    }else if(H.at(i)==H.at(i+1)){
      ad=1;
    }else{
      ad=0;
    }
  }
  if(flag==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>

using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const ll INF = 1000010000;
static const ll MOD = 1000000007;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

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

struct graph {
  int L, R;
  vector<vector<int>> adj;
  graph(int L, int R) : L(L), R(R), adj(L+R) { }
  void add_edge(int u, int v) {
    adj[u].push_back(v+L);
    adj[v+L].push_back(u);
  }
  int maximum_matching() {
    vector<int> visited(L), mate(L+R, -1);
    function<bool(int)> augment = [&](int u) { // DFS
      if (visited[u]) return false;
      visited[u] = true;
      for (int w: adj[u]) {
        int v = mate[w];
        if (v < 0 || augment(v)) {
          mate[u] = w;
          mate[w] = u;
          return true;
        }
      }
      return false;
    };
    int match = 0;
    for (int u = 0; u < L; ++u) {
      fill(all(visited), 0);
      if (augment(u)) ++match;
    }
    return match;
  }
};

int main(){
	int n;
  cin >> n;
  int ans = 0;
  REP(i, n){
    int k = i + 1;
    if(k % 2 == 0) continue;
    int cnt = 0;
    REP(i, k){
      if(k % (i + 1) == 0) cnt++;
    }
    if(cnt == 8) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mx = 100005;
int n, m, a, b, c;
int p[mx];

void ufini(int n){ fill(p, p+n, -1);}
int find(int x){return (p[x] < 0 ? x : p[x] = find(p[x]));}
void uni(int x, int y){
    x = find(x); y = find(y);
    if(x != y){
        if(x < y) swap(x, y);
        p[x] += p[y];
        p[y] = x;
        n--;
    }
}

int main(){
    scanf("%d%d", &n, &m);
    ufini(n+3);
    for(int i = 0; i < m; i++){
        scanf("%d%d%d", &a, &b, &c);
        uni(a, b);
    }
    printf("%d\n", n);
}

Measured memory_bytes: 768
#include <vector>
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		int out = 0;
		int base = 0;
		int score = 0;
		while (out < 3){
			char s[128];
			scanf("%s", s);
			if (s[1] == 'I'){
				if (base == 3) score++;
				else base++;
			}
			else if (s[1] == 'O'){
				score += base + 1;
				base = 0;
			}
			else out++;
		}
		printf("%d\n", score);
	}
}

Measured memory_bytes: 1188
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut ab: Vec<(usize, usize)> = (0..n).map(|_| (read(), read())).collect();
    ab.sort();

    let mut nkr = m;
    let mut sum = 0;
    for i in 0..n {
        let (a, b) = ab[i];
        if nkr < b {
            sum += a * nkr;
            break;
        } else {
            nkr -= b;
            sum += a * b;
        }
    }
    println!("{}", sum);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 6396
#include <stdio.h>

int main() {

  int i, x[10001], y[10001];
    i = 0;
  while(1) {
    scanf("%d %d", &x[i], &y[i]);
    if ((x[i] == 0) && (y[i] == 0))
	break;
    i++;
  }
  i = 0;
  while(1) { 
    if ((x[i] == 0) && (y[i] == 0))
      break;
    if (x[i] < y[i])
      printf("%d %d\n", x[i], y[i]);
    else
      printf("%d %d\n", y[i], x[i]);
    i++;
  }

  return 0;

}

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

def isprime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for m in range(3, int(n**0.5) + 1, 2):
        if n % m == 0:
            return False
    return True

ans = [2]
p = 3
while len(ans) < N:
    p += 2
    if isprime(p) and p % 5 == 1:
        ans.append(p)
print(" ".join(map(str, ans)))

Measured memory_bytes: 3060
#include<stdio.h>
int main (){

	int a,b,c,x;
	int cnt=0;
	int sum=0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&x);
	
	for(int i=0;i<=a;i++){
    	for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
			sum=500*i+100*j+50*k;
			if(sum==x) cnt++;
			 
            }
		}
    }
	printf("%d",cnt);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdint>

std::int64_t dp[99][21];

int main() {
	int n;
	std::cin >> n;

	int head;
	std::cin >> head;
	dp[0][head] = 1;

	for (int i = 1; i < n - 1; ++i) {
		int a;
		std::cin >> a;
		for (int j = 0; j < 21; ++j) {
			if (dp[i - 1][j] == 0)
				continue;
			if (j + a <= 20)
				dp[i][j + a] += dp[i - 1][j];
			if (j - a >= 0)
				dp[i][j - a] += dp[i - 1][j];
		}
	}

	int tail;
	std::cin >> tail;
	std::cout << dp[n - 2][tail] << std::endl;
}

Measured memory_bytes: 3092
#include <stdio.h>
#include <set>
#include <utility>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main(void) {
  int c, n, i, j, k, ans = 0;
  scanf("%d%d", &c, &n);
  int m = n / 2;
  set< pair<int, int> > s;
  char p[n][n + 10], num[m][m];
  rep(i, n) scanf("%s", p[i]);
  rep(i, n) rep(j, n) p[i][j] -= '0';
  rep(i, m) rep(j, m) num[i][j] = 0;
  rep(i, n) rep(j, n){
    if(p[i][j]) {
      int t = i, r = j;
      if(i >= m) t = n - i - 1;
      if(j >= m) r = n - j - 1;
      num[t][r]++;
    }
  }
  rep(i, m) rep(j, m) if(num[i][j] && num[i][j] != 4) {
    pair<int,int> p = make_pair(i, j);
    s.insert(p);
  }
  if(s.empty()) ans++;
  rep(i, c - 1) {
    int d;
    scanf("%d", &d);
    rep(j, d) {
      int r, c, ss = 0;
      scanf("%d%d", &r, &c);
      r--, c--;
      if(p[r][c]) {
        ss = 1;
        p[r][c] = 0;
      } else {
        p[r][c] = 1;
      }
      if(r >= m) r = n - r - 1;
      if(c >= m) c = n - c - 1;
      pair<int, int> p = make_pair(r, c);
      if(ss) {
        num[r][c]--;
      } else {
        num[r][c]++;
      }
      set< pair<int, int> >::iterator it = s.find(p);
      if(num[r][c] && num[r][c] != 4) {
        if(it == s.end()) s.insert(p);
      } else {
        if(it != s.end()) s.erase(it);
      }
    }
    if(s.empty()) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 12904
//
//  main.cpp
//  Logout Records
//
//  Created by x15071xx on 2017/06/21.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    
    
    while (1) {
        
        int N,M,r,t,n,m,s,q,ts,te,i,j,k;
        int PC[1000][720]={0};
        
        cin >> N >> M;
        
        if (N == 0 && M == 0) {
            break;
        }
        
        //?????°???????????°??¢???????¨????
        cin >> r;
        
        for (i = 0; i < r ; i++) {
            cin >> t >> n >> m >> s;
            
            t -= 540;
            
            //????????????PCn?????????m????????°??????????????°??¢?????????
            if (s == 1) {
                //login
                PC[n-1][t] = m;
            } else {
                //logout
                for (j = t-1; PC[n-1][j] != m; j--) {
                    PC[n-1][j] = m;
                }
            }
            
        }
        
        //?§£??? ????????£??????????????????????????????
        cin >> q;
        
        for (i = 0; i < q ; i++) {
            int count = 0;
            cin >> ts >> te >> m;
            ts -= 540;
            te -= 540;
            for (k = ts; k < te; k++) {
                for (j = 0; j < N; j++) {
                    if (PC[j][k] == m) {
                        count++;
                        break;
                    }
                }
            }
            
            cout << count << endl;
        }
        
    }
    return 0;
}

Measured memory_bytes: 5852
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (long long int i = 0; i <= (n); ++i)
#define rep1(i,n) for (long long int i = 1; i <= (n); ++i)
#define REP(a,b) for (long long int i = a; i <= (b); ++i) 
#define ps push_back 
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main() {
		int a; scanf("%d", &a);
		int L = a / 100;
		int R = a % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)printf("AMBIGUOUS\n");
			else printf("MMYY\n");
		}
		else {
			if (1 <= R && R <= 12)printf("YYMM\n");
			else printf("NA\n");
		}

		return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fori(a,b,c) for(int i=a;i<=b;i+=c)
#define forj(aa,bb,cc) for(int j=aa;j<=bb;j+=cc)
#define fork(aaa,bbb,ccc) for(int k=aaa;k<=bbb;k+=ccc)
#define forl(aaaa,bbbb,cccc) for(int l=aaaa;l<=bbbb;l+=cccc)
#define ll long long
#define dd cout<<endl//前面都没啥用的宏定义。
using namespace std;
int k,x;
int main()
{
    cin>>k>>x;
    fori(x-k+1,x+k-1,1)
    {
    	cout<<i<<" ";
	}
	dd;
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))

    Ap=[x for x in A if x>=0 ]
    Am=[abs(x) for x in A if x<0]

    if K==N:
        out=1
        for a in A:
            out*=a
            out%=10**9+7
        print(out)
        return


    if K%2==1 and len(Ap)==0:
        Am.sort()
        out=1
        for i in range(K):
            out*=Am[i]
            out%=10**9+7
        print((-out)%(10**9+7))
        return

    Ap.sort(reverse=True)
    Am.sort(reverse=True)
    
    ap_idx=0
    am_idx=0
    result=1

    for _ in range(0,K-1,2):
        if K%2==0 and ap_idx+1<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        elif K%2==1 and ap_idx+2<len(Ap):
            pmax=Ap[ap_idx]*Ap[ap_idx+1]
        else:
            pmax=-1

        if am_idx+1<len(Am):
            mmax=Am[am_idx]*Am[am_idx+1]
        else:
            mmax=-1

        if pmax==-1 and mmax==-1:
            break

        if pmax>mmax:
            result*=pmax
            ap_idx+=2
        else:
            result*=mmax
            am_idx+=2

        result%=(10**9+7)
    
    if K%2==1:
        result*=Ap[ap_idx]

    print(result%(10**9+7))

main()

Measured memory_bytes: 102640
#include <stdio.h>
#define N 100

int main(){
  int n,i,j,A[N],minj,temp,count=0,m;

  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  for(i=0;i<n-1;i++){
    minj = i;
    m = A[i];
    
    for(j=i;j<n;j++){
      if(A[j] < m){
	m = A[j];
	minj = j;
      }
    }
    if(m != A[i]){
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;
    count++;
  }
  }

  for(i=0;i<n;i++){
    if(i == n-1) printf("%d",A[i]);
    else printf("%d ",A[i]);
  }
  printf("\n%d\n",count);
  return 0;
}



Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
vector<pair<int, int>> arr;
int n;
double calDis(pair<int, int> a, pair<int, int> b){
	return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
double solve1(int arr1[]){
	double res = 0;
	for(int i = 1; i < n; i++){
		res += calDis(arr[arr1[i - 1]], arr[arr1[i]]);
	}
	//cout<<res<<endl;
	return res;
}
void solve(){
	cin>>n;
	arr.resize(n);
	for(int i = 0; i < n; i++){
		int x, y;
		cin>>x>>y;
		arr[i] = {x, y};
	}
	int arr1[n];
	for(int i = 0; i < n; ++i) arr1[i] = i;
	double fact = 1;
	for(int i = 2; i <= n; ++i) fact *= i;
	//cout<<fact<<endl;
	double sum = 0;
	sum += solve1(arr1);
	//cout<<sum<<endl;
	while(next_permutation(arr1, arr1 + n)){
		sum += solve1(arr1);
	}
	//sum += solve1(arr);
	//cout<<sum<<endl;
	cout<<setprecision(20)<<sum / fact;
}
int main(){
	io;
	solve();
	return 0;
}


Measured memory_bytes: 3824
N, A, B = map(int, input().split())
S = input()

ac_count = 0
ac_b_count = 0
for s in S:
    if ac_count < A + B:
        if s == 'a':
            print('Yes')
            ac_count += 1

        elif s == 'b' and ac_b_count < B:
            print('Yes')
            ac_count += 1
            ac_b_count += 1

        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 9232
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(LL, n, m, k);
	vector<LL> a(n), b(m);
	cin >> a >> b;
	
	LL sb = 0;
	RF(e, b) { sb += e; }
	int j = m;
	
	LL ans = 0, sa = 0;
	inc(i, n + 1) {
		if(sa > k) { break; }
		until(sa + sb <= k) { j--; assert(j >= 0); sb -= b[j]; }
		setmax(ans, i + j);
		if(i == n) { break; }
		sa += a[i];
	}
	OUT(ans);
}


Measured memory_bytes: 6420
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[101],b[101];
	cin>>a>>b;
	int n=strlen(a),m=strlen(b);
	for(int i=0;i<(n+m)/2;i++)
		cout<<a[i]<<b[i];
	if(n>m) for(int i=m;i<n;i++) cout<<a[i];
	if(m>n) for(int i=n;i<m;i++) cout<<b[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int inf=1<<30;

int h,w,q;
string s,t;
vi a,b,c[4];

int f(int x,int y,int X,int Y,bool fx=1,bool fy=1){
	int I=a[x],J=b[y];
	bool bx=0,by=0;
	if(I==1&&Y<=y||I==3&&y<=Y) bx=1;
	if(J==0&&X<=x||J==2&&x<=X) by=1;
	if(bx&&by){
		if(I==a[X]||J==b[Y]) return abs(x-X)+abs(y-Y);
		auto ix=lower_bound(c[I].begin(),c[I].end(),X);
		auto iy=lower_bound(c[J].begin(),c[J].end(),Y);
		if(J==0) ix--;
		if(I==1) iy--;
		int tx=(0<=*ix&&*ix<h?abs(*ix-x)+abs(*ix-X)+abs(y-Y):inf);
		int ty=(0<=*iy&&*iy<w?abs(*iy-y)+abs(*iy-Y)+abs(x-X):inf);
		return min(tx,ty);
	}
	auto ix=lower_bound(c[(I+2)%4].begin(),c[(I+2)%4].end(),x);
	auto iy=lower_bound(c[(J+2)%4].begin(),c[(J+2)%4].end(),y);
	if(J==0) ix--;
	if(I==1) iy--;
	int tx=(fx&&0<=*ix&&*ix<h?f(*ix,y,X,Y,0,1)+abs(*ix-x):inf);
	int ty=(fy&&0<=*iy&&*iy<w?f(x,*iy,X,Y,1,0)+abs(*iy-y):inf);
	return min(tx,ty);
}

int main(){
	cin>>h>>w>>q>>s>>t;
	a=vi(h,1);
	b=vi(w);
	for(int i=0;i<4;i++) c[i].push_back(-1);
	for(int i=0;i<h;i++){
		if(s[i]=='E') a[i]=3;
		c[a[i]].push_back(i);
	}
	for(int i=0;i<w;i++){
		if(t[i]=='S') b[i]=2;
		c[b[i]].push_back(i);
	}
	for(int i=0;i<4;i++) c[i].push_back(inf);
	for(int i=0;i<q;i++){
		int x,y,X,Y;
		cin>>x>>y>>X>>Y;
		int res=f(x-1,y-1,X-1,Y-1);
		cout<<(res>=inf?-1:res)<<endl;
	}
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    LL A, B;
    cin >> A >> B;
    LL x = A * B;
    if(A<B){
        LL dummy = A;
        A = B;
        B = dummy;
    }
    LL r = A%B;
    while(r!=0){
        A = B;
        B = r;
        r = A%B;
    }
    cout << x/B << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val N: String = kotlin.io.readLine() ?: return
    val n = Integer.parseInt(N)
    var a = longArrayOf(0, 0, 0, 0, 0)
    var ans: Long = 0
    for(i in 1..n){
        val s = kotlin.io.readLine() ?: return
        when(s[0]){
            'M' -> a[0]++
            'A' -> a[1]++
            'R' -> a[2]++
            'C' -> a[3]++
            'H' -> a[4]++
        }
    }
    for(i in a.indices){
        for(j in a.indices){
            if(i == j) continue
            for(k in a.indices){
                if(i == k || j == k) continue
                ans += a[i] * a[j] * a[k]
            }
        }
    }
    println(ans/6)
}

Measured memory_bytes: 37876