akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>
using namespace std;

#define EPS 1e-8
#define INF 1e100

typedef complex<double> P;
typedef vector<P> vP;

const P iu(0.0, 1.0);

double dot(P a, P b){
	return real(a) * real(b) + imag(a) * imag(b);
}

double cross(P a, P b){
	return real(a) * imag(b) - imag(a) * real(b);
}

int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > EPS)	return +1;	// counter clockwise
	if (cross(b, c) < -EPS)	return -1;	// clockwise
	if (dot(b, c) < -EPS)	return +2;	// c--a--b on line
	if (norm(b) < norm(c))	return -2;	// a--b--c on line
	return 0;
}

P crosspoint(P a1, P a2, P b1, P b2){
	double t = cross(b1 - a1, b1 - b2) / cross(a2 - a1, b1 - b2);
	return a1 + t * (a2 - a1);
}

P centroid(const vP &pl){
	P s;
	int sz = pl.size() - 1;
	if(sz < 1){ return P(INF, INF); }
	for(int i = 1; i <= sz; ++i){
		s += pl[i];
	}
	return s / (double)sz;
}

vP convex_cut(const vP &pl, P la, P lb) {
	vP Q;
	for (int i = 1; i < pl.size(); ++i) {
		P A = pl[i-1], B = pl[i];
		if (ccw(la, lb, A) != -1){ Q.push_back(A); }
		if (ccw(la, lb, A) * ccw(la, lb, B) < 0){
			Q.push_back(crosspoint(A, B, la, lb));
		}
	}
	if(!Q.empty() && Q.back() != Q[0]){
		Q.push_back(Q[0]);
	}
	return Q;
}

double area(const vP p){
	double s = 0.0;
	for(int i = 1; i < p.size(); ++i){
		s += cross(p[i-1], p[i]);
	}
	return 0.5 * abs(s);
}

double solve(int n, int m){
	int x, y, dx, dy, scr;
	vector<P> pt(n);
	for(int i = 0; i < n; ++i){
		scanf("%d%d", &x, &y);
		pt[i] = P(x, y);
	}

	vector<double> sum(n);
	for(int i = 0; i < m; ++i){
		scanf("%d%d%d%d%d", &x, &y, &dx, &dy, &scr);
		double S0 = dx * dy * 4.0;

		for(int j = 0; j < n; ++j){
			vP plg(5);
			plg[0] = plg[4] = P(x - dx, y - dy);
			plg[1] = P(x + dx, y - dy);
			plg[2] = P(x + dx, y + dy);
			plg[3] = P(x - dx, y + dy);

			for(int k = 0; k < n; ++k){
				if(k != j){
					P mid = 0.5 * (pt[j] + pt[k]);
					P dif = iu * (pt[k] - pt[j]);
					
					vP p1 = convex_cut(plg, mid, mid + dif);
					vP p2 = convex_cut(plg, mid, mid - dif);

					if(p1.empty()){ p1.swap(p2); }
					P cn = centroid(p1);
					plg.swap(norm(pt[j] - cn) < norm(pt[k] - cn) ? p1 : p2);
				}
			}
			
			sum[j] += area(plg) / S0 * scr;
		}
	}

	return *max_element(sum.begin(), sum.end());
}

int main(){
	int n, m;
	while(scanf("%d%d", &n, &m), n){
		printf("%f\n", solve(n, m));
	}
}

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

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    int h, w;
    cin >> h >> w;
    char m[h+2][w+2];
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w+2; j++) m[i][j] = '*';
    }
    for(int i = 1; i <= h; i++){
        string s;
        cin >> s;
        for(int j = 1; j <= w; j++){
            m[i][j] = s[j-1];
        }
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(m[i][j] == '#') continue;
            int bomb = 0;
            for(int t = -1; t <= 1; t++){
                for(int s = -1; s <= 1; s++){
                    if(m[i+t][j+s] == '#') bomb++;
                }
            }
            m[i][j] = char(bomb + '0');
        }
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cout << m[i][j];
        }
        cout << "\n";
    }
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char=小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define str string
#define please return
#define AC 0
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {

	string s;

	cin >> s;

	int x = 0;

	char y = 'a';

	bool cnt = false;

	rep(i, 26) {

		rep(j, s.size()) {

			if (s[j] == y) {

				x++;
			}
		}
		if (x % 2 == 1) {
			cout << "No" << rt;
			return 0;
		}
		y++;
	}

	cout << "Yes" << rt;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
cou=0
count = 0
for i in range(1,n+1):
    count += sum(a1[:i])
    for j in range(i-1,n):
        count +=sum(a2[j:n+1])
        cou=max(cou,count)
        count = 0
print(cou)

Measured memory_bytes: 3064
<?php
// Your code here!
    //$count = fgets(STDIN);
    $weather_array = str_split(fgets(STDIN));

    $day = 0;
    $max_day = 0;
    $continue = FALSE;
    foreach($weather_array as $weather){
        if($weather == 'R'){
            if($continue){
                $day++;
            }else{
                $day = 1;
                $continue = TRUE;
            }
        }else{
            $day = 0;
            $continue = FALSE;
        }
        if($day > $max_day){
            $max_day = $day;
        }
    }
    
    echo $max_day;
    
?>


Measured memory_bytes: 15672
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>

int main () {
  int n;
  while (std::cin >> n) {
    if (n == 0)
    {
      break;
    }
    double ave = 0.0;
    std::vector<double> s;
    for (int i = 0; i < n; i++)
    {
      double a;
      std::cin >> a;
      s.push_back(a);
      ave += a;
    }
    ave /= n;
    double sum = 0.0;
    for (int i = 0; i < n; i++)
    {
      sum += (s[i] - ave) * (s[i] - ave);
    }
    std::cout << std::fixed;
    std::cout << std::setprecision(8) << std::sqrt(sum / n) << "\n";
  }
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<(unsigned) 1e9 + 7>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, H, D; cin >> n >> H >> D;
  Mint c, f = 1;
  for (int i = 1; i <= n; ++i) c += f *= i;
  V<Mint> dp(H + 1);
  for (int i = 1; i <= D; ++i) dp[i] = 1;
  Mint s;
  for (int i = 0; i < H; ++i) {
    s += dp[i];
    if (i >= D) s -= dp[i - D];
    dp[i + 1] += s * c;
  }
  cout << dp.back() * f << '\n';
  /*cerr << "dp(" << dp.size() << ") = {"; for (const auto& e : dp) cerr << e << ", "; cerr << "} (l." << __LINE__ << ")\n";
  {
    VV<Mint> dp(H + 1, V<Mint>(n + 1));
    dp[0][n] = 1;
    for (int m = 0; m <= H; ++m) {
      for (int c = 1; c <= n; ++c) {
        for (int i = 1; i <= D and m + i <= H; ++i) dp[m + i][1] += dp[m][c];
        if (c < n) dp[m][c + 1] += dp[m][c] * (c + 1);
      }
    }
    cerr << "dp(" << dp.size() << ", " << dp[0].size() << ")\n"; for (const auto& v : dp) { for (const auto& e : v) cerr << e << '\t'; cerr << '\n'; }
  }*/
}

Measured memory_bytes: 4224
#include <stdio.h>

int main(void) {
	int N, A, B, C, D;
	int i;
	int count1 = 0;
	int count2 = 0;

	scanf("%d%d%d%d%d", &N, &A, &B, &C, &D);

	char masu[N];

	
	scanf("%s", masu);
	

	if (C < D) {
		for (i = A;i <= C-3;i++) {
			if (masu[i] == '#'&& masu[i+1]=='#'){
				count1++;
			}
		}

		for (i = B;i <= D - 3;i++) {
			if (masu[i] == '#' && masu[i + 1] == '#') {
				count1++;
			}
		}

		if (count1 == 0) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}
	else {
		for (i = A;i <= C - 3;i++) {
			if (masu[i] == '#' && masu[i + 1] == '#') {
				count1++;
			}
		}
		for (i = B - 2;i <= D - 2;i++) {
			if (masu[i] == '.' && masu[i + 1] == '.' && masu[i + 2] == '.') {
				count2++;
			}
		}
		if (count1==0 && count2 > 0) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}

	return 0;

}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	int32_t N;
	cin >> N;

	vector<double> v(N);
	for (int32_t i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	for (int32_t i = 0; i < N - 1; i++) {
		v[i + 1] = (v[i] + v[i + 1]) / 2.0;
	}

	cout << fixed << std::setprecision(std::numeric_limits<double>::max_digits10) << v[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 256
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
      if temp%i==0:
          cnt=0
          while temp%i==0:
              cnt+=1
              temp //= i
          arr.append([i, cnt])

  if temp!=1:
      arr.append([temp, 1])

  if arr==[]:
      arr.append([n, 1])

  return arr

import sys

z = int(input())
dividers = factorization(z)

# zが1の場合
if (z == 1):
  print(0)
  sys.exit()
# そうでない場合
else:
  ans = 0
  for divider in dividers:
    i = 0
    while i*(i+1)/2 <= divider[1]:
      i += 1
    ans += i - 1

print(ans)

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

int main() {

    int n ;
    cin >> n ;

    int a[n] , mx = 0 , cm = 0 ;
    lp(i, n) cin >> a[i] ;
    lp(i, n-1) {
        if(a[i]>= a[i+1]) {
            cm ++ ;
            if(cm > mx) mx = cm ;
        }
        else {
            if(cm > mx) mx = cm ;
            cm = 0 ;
        }
    }
    cout<<mx<<endl ;
}



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

string S;
string X[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};

int main(){
    cin>>S;
    int ans;
    for(int i=0;i<7;i++){
        if(X[i]==S){
            ans=7-i;
            break;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    string s;
  	cin>>s;
  	if(s=="Sunny" || s=="sunny")	cout<<"Cloudy";
  	if(s=="Cloudy" || s=="cloudy")  cout<<"Rainy";
  	if(s=="Rainy" || s=="rainy")  cout<<"Sunny";
    cout<<endl;
    return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x>>y;
	cout<<x+1-y<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)

else:
    ans=int(1)
    for i in range(1,n+1):
        ans*=i
        ans%=1000000007
    
    for i in range(1,m+1):
        ans*=i
        ans%=1000000007

    if n==m:
        ans*=2
        ans%=1000000007
    
    print(ans)

Measured memory_bytes: 3060
x = []
s = ['','']
while 1:
	H,W = map(int, raw_input().split())
	if H == 0 and W == 0:
		break
	tmp = (W+1)/2
	s[0] = ('#.' * tmp)[:W]
	s[1] = ('.#' * tmp)[:W]
	
	for l in range(H):
		print s[l % 2]
	print 

Measured memory_bytes: 4216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    string s;
    std::cin >> s;
    if(s[2]==s[0])std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
from string import ascii_lowercase

S = list(input())

ans = 10 ** 18
# 全てのアルファベットを試す
for moji in ascii_lowercase:
    tmp = S[:]
    count = 0
    while len(set(list(tmp))) != 1:
        for i in range(len(tmp) - 1):
            if tmp[i] == moji or tmp[i + 1] == moji:
                tmp[i] = moji
        tmp = tmp[:-1]
        count += 1
    ans = min(ans, count)
print(ans)



Measured memory_bytes: 9796
#include<stdio.h>
int main(void){
	int H,W,a,b;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0){
			break;
		}
		for(a=0;a<H;a++){
			for(b=0;b<W;b++){
				if(a%2==0 && b%2==0){
					printf("#");
				}else if(a%2!=0 && b%2!=0){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
import math
mod = 998244353
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
pow2 = [1]
for i in range(n):
    pow2.append(pow2[-1] * 2 % mod)
used = [[False] * n for i in range(n)]
ret = (pow2[n] - 1 - n - n * (n - 1) / 2) % mod
for i in range(n):
    for j in range(i):
        if used[i][j]:
            continue
        inline = [i, j]
        for k in range(n):
            if k == i or k == j:
                continue
            if (p[i][1] - p[k][1]) * (p[j][0] - p[k][0]) == (p[j][1] - p[k][1]) * (p[i][0] - p[k][0]):
                inline.append(k)
        for k in range(len(inline)):
            for l in range(len(inline)):
                used[inline[k]][inline[l]] = True
        v = len(inline)
        ret = (ret + mod - pow2[v] + 1 + v + v * (v - 1) // 2) % mod
print(int(ret))


Measured memory_bytes: 44012
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int T = sc.nextInt();
      	int A = sc.nextInt();
      	double[] H = new double[N];
      	for(int i=0;i<N;i++){
        	H[i] = sc.nextInt();
          	H[i] = T- H[i]*0.006;
          	H[i] = Math.abs(H[i]-A);
        }
      	double min = H[0];
      	int num = 0;
      	for(int i=0;i<N;i++){
        	if(min > H[i]){
              min = H[i];
              num = i;
            }
        }
      	System.out.println(num+1);
    }
}

Measured memory_bytes: 23396
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		String s = fs.next();
		
		int maxSeq = 0;
		int nowSeq = 0;
		
		for(int i = 0; i < s.length(); i++) {
			
			if(s.charAt(i) == 'R') {
				nowSeq++;
				maxSeq = Math.max(maxSeq, nowSeq);
			}else {
				nowSeq= 0;
			}
		}
		
		System.out.println(maxSeq);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define mod 1000000007
    #define qmod 998244353
    #define M 10000001
    #define endl "\n"
    #define all(a) (a).begin(),(a).end()
    #define rep(i,a,b) for(int i=a;i<b;++i)
    #define repr(i,a,b) for(int i=a;i>=b;--i)
    #define F first
    #define S second
    #define pb push_back
    #define mp make_pair

    typedef long long ll;
    typedef pair<int,int> pii;
    typedef vector<int> vi;
    typedef vector<string> vs;  
    typedef vector<pii> vii;
    typedef vector<vi> vvi;

    int main(){ 
                            
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);   
    // #endif 

        fast;   
        int t=1;
        // cin>>t; 
        while(t--){ 
            int l,r,d;
            cin>>l>>r>>d;
            cout<<(r/d)-(l-1)/d;
        }  
        return 0;       
    }       


    // First, solve the problem. Then, write the code. 
    

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define all(c) (c).begin(),(c).end()
#define pii pair<long long,long long>
#define endl '\n'

using namespace std;

signed main(){
    std::ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    int sum=0;
    vector <int> A(n,0);
    for(int i=0;i<n;i++){
        cin >> A[i];
        sum+=A[i];
    }
    int coff = sum/(4*m);
    bool b=sum%(4*m);
    sort(all(A));
    if(b){
        coff++;
    }
    if(A[n-m]<coff){
        cout << "No";
    }
    else cout << "Yes";
    
}

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
now = 0
n.times do 
  d = inp
  if d.uniq.size == 1
    now += 1
  else
    now = 0
  end
  if now == 3
    puts "Yes"
    exit
  end
end
puts "No"

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll H, W, A,An, B,Bn;
ll ans[1010][1010];
ll i, j, k;
int main(){
    scanf("%lld%lld%lld%lld", &H, &W, &A, &B);
    
    fornum(i,0,H){
        ll a = i < B;
        fornum(j,0,A){
            ans[i][j] = 0^a;
            printf("%lld", ans[i][j]);
        }
        fornum(j,j,W){
            ans[i][j] = 1^a;
            printf("%lld", ans[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 9088
S = gets.chomp

case S
when "SUN" then
  puts '7'
when "MON" then
  puts '6'
when "TUE" then
  puts '5'
when "WED" then
  puts '4'
when "THU" then
  puts '3'
when "FRI" then
  puts '2'
when "SAT" then
  puts '1'
else 
  puts 'na'
end

Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>

#define MOD 1000000007
#define pi 3.14159265358979

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
	string s;

	cin >> s;
	int ans = 0, counter = 0;

	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'R')
		{
			counter++;
			ans = max(ans, counter);
		}
		else
		{
			ans = max(ans, counter);
			counter = 0;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int main(){
	int a=read(),b=read(),c=read(),minn=0x3f3f3f3f;
	minn=min(minn,abs(a-b)+abs(b-c));
	minn=min(minn,abs(a-c)+abs(b-c));
	minn=min(minn,abs(c-a)+abs(a-b));
	minn=min(minn,abs(c-b)+abs(a-b));
	minn=min(minn,abs(b-a)+abs(a-c));
	minn=min(minn,abs(c-b)+abs(a-b));
	printf("%d",minn);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int x,y,z;
  cin>>x>>y>>z;
  Int l=0,r=1e9;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(m*y+(m+1)*z<=x) l=m;
    else r=m;
  }
  cout<<l<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int z=max(x,y);
  int min1 = 1e10;
  for(int i=0;i<=z;i++){
    int d = 2*c*i + a * max(0,x-i) + b * max(0,y-i);
    min1 = min(min1, d);
  }
  cout<<min1<<endl;
}

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

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cerr << #v "=" << (v) << endl;
#define ppa(v) cerr << "- " << #v << endl; rep(i,v.size()) cerr << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(ALL(v)), v.end() );
#define INF 0x3f3f3f3f
#define LLINF 1000111000111000111LL
#define MOD 1000000007
#define TIME system("date +%M:%S.%N")
using Graph = vector<vector<int>>;
using ll = long long;
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

int main() {
  int n;cin>>n;
  string ans = "";
  while (n != 0) {
    if (n % 2 != 0) {
      n--;
      ans = "1" + ans;
    }
    else ans = "0" + ans;
    n /= -2;
  }
  if (ans == "") ans = "0";
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int w = 0;
		int l = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'o') {
				w++;
			} else {
				l++;
			}
		}
		if (w + (15 - s.length()) >= 8) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}



Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
#include<math.h>
#include<unordered_map>
using namespace std;

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const int mod=10007;
#define ll long long

int main(){
    ll n;
    cin>>n;
    cout<<2*(n/11)+n%11/6+(n%11%6>0)<<endl;
    return 0;
}

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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

using vi = vector<int>;

vi A[1002];

int n, q;

int main(){
	cin.tie(0);
	
	cin>>n>>q;
	
	rep(i, q) {
		int c, t, x;
		cin>>c>>t;
		if(c==0) {
			cin>>x;
			A[t].push_back(x);
		}else if(c==1) {
			rep(i, A[t].size())cout<<(i>0?" ":"")<<A[t][i];
			cout<<endl;
		}else {
			A[t].clear();
		}
	}
	
	return 0;
}



Measured memory_bytes: 5916
import java.util.*;
public class Main {
	public static void main(String[] args){
    
		Scanner sc = new Scanner(System.in);
		// 整数の入力
	
		// 文字列の入力
		String n = sc.next();
    
    /*--------------------------------*/
    //入力
    //String n = "123456789";
		String buf = "";

		//配列に格納
		int x = 0;
		for(int i= 0; i<n.length();i++){
		 buf=n.substring(i,i+1);
		 x += Integer.parseInt(buf);
		 //System.out.println(x);
		}

		//answer
		if(x%9 == 0){
			System.out.println("Yes");
		}else{
				System.out.println("No");
		}

	}
}



Measured memory_bytes: 50012
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


void eating_symbols_easy()
{
  string s;
  cin >> s;

  int cnt = 0;
  for (int i = 0; i < 4; ++i)
  {
    if (s[i] == '+') ++cnt;
    else --cnt;
  }
  cout << cnt << "\n";
}


void multiple_of_2_and_n()
{
  int n;
  cin >> n;

  if (n % 2 == 0) cout << n << "\n";
  else cout << 2 * n << "\n";
}


void task_scheduling_problem()
{
  vector<int> a(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];

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

  cout << a[2] - a[0] << "\n";
}


void rated_for_me()
{
  int r;
  cin >> r;

  if (r < 1200) cout << "ABC\n";
  else if (r < 2800) cout << "ARC\n";
  else cout << "AGC\n";
}


void atcoder_crackers()
{
  int n, k;
  cin >> n >> k;

  if (n % k == 0) cout << 0 << "\n";
  else cout << 1 << "\n";
}


void garden()
{
  int a, b;
  cin >> a >> b;

  cout << (a - 1) * (b - 1) << "\n";
}


void train()
{
  int n, i;
  cin >> n >> i;

  cout << n - i + 1 << "\n";
}


int main()
{
  //eating_symbols_easy();
  //multiple_of_2_and_n();
  //task_scheduling_problem();
  //rated_for_me();
  //atcoder_crackers();
  //garden();
  train();
}

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

int main(){
    int n,k;
    cin >> n >> k;
    if(k%2){
        if(n<k){
            cout << 0 << endl;
            return 0;
        }
        cout << ll(n/k)*ll(n/k)*ll(n/k) << endl;
    }else{
        int na = n/k;
        int nb = n/(k/2) - na;

        ll ans = ll(na)*ll(na)*ll(na) + ll(nb)*ll(nb)*ll(nb);
        cout << ans << endl;
    }
}

Measured memory_bytes: 3596
x, y ,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
 
list.sort(p,reverse=True)
list.sort(q,reverse=True)
list.sort(r,reverse=True)
 
mazemaze =p[:x]+q[:y]+r
list.sort(mazemaze, reverse=True)
print(sum(mazemaze[:x+y]))

Measured memory_bytes: 112236
n,m,x=map(int,input().split())
cc=[list(map(int,input().split())) for _ in range(n)]
from itertools import combinations
s=list(range(n))
ans=10**10
array=[0]*m
res=0
for ii in range(1,n+1):
    for i in combinations(s,ii):
        for j in i:
            res+=cc[j][0]
            for k,l in enumerate(cc[j][1:]):
                array[k]+=l
        if min(array)>=x:
            ans=min(ans,res)
        res=0
        array=[0]*m
    
if ans==10**10:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 68176
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	
	int ans = 0, X = N/R + 1, Y = N/G + 1;
	for_(r,0,X) {
		if (R * r > N) continue;
		for_(g,0,Y) {
			if (R * r + G * g > N) continue;
			int rem = N - R * r - G * g;
			if (rem % B == 0) ++ans;
		}
	}
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) {
        String s = scanner.next();
        String t = scanner.next();
        int count = 0;
        for (int i = 0; i < 3; i++) {
            if (s.charAt(i) == t.charAt(i)) {
                count++;
            }
        }
        System.out.println(count);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int n;
ll a[200100];
ll ans=0;
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	ans+=a[0];
	int now=1;
	while(now<n-1)
	{
		if(n-1-now==1)ans+=a[now/2+1],now++;
		else ans+=a[now/2+1]*2,now+=2;
	}
	cout<<ans<<endl;
	return 0;
}



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

int main() {
  int N,a;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      a++;
    } 
  }
  cout << a << endl;
}

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

int main(){
    int a,b,c; cin >> a >> b >> c;
    int d = a - b;
    cout << max(c - d, 0) << endl;
}

Measured memory_bytes: 3588
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	N := nextInt()

	if N%10 == 7 {
		fmt.Println("Yes")
	} else if N%100/10 == 7 {
		fmt.Println("Yes")
	} else if N/100 == 7 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1756
n, m = map(int, input().split())

ac = [False] * n
wa = [0] * n

for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        ac[p] = True
    else:
        if not ac[p]:
            wa[p] += 1

a = 0
b = 0
for i in range(n):
    if ac[i]:
        a += 1
        b += wa[i]

print(*[a, b])

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

typedef struct data{
  ll v;
  int i,j,k;
  data()=default;
  data(ll d,int a,int b,int c):v(d),i(a),j(b),k(c){}
  bool operator<(const data& rhs)const{return v<rhs.v;}
}dt;

class memo{
public:
  int i,j,k;
  memo()=default;
  memo(int a,int b,int c):i(a),j(b),k(c){}
  bool operator<(const memo& rhs)const{
    return i!=rhs.i ? i<rhs.i : (j!=rhs.j ? j<rhs.j :k<rhs.k);
  }
};

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

  int X=in(),Y=in(),Z=in(),K=in();
  vector<ll> A(X),B(Y),C(Z);
  for(auto& v:A) v=in<ll>();
  for(auto& v:B) v=in<ll>();
  for(auto& v:C) v=in<ll>();
  
  sort(ALL(A),greater<ll>());
  sort(ALL(B),greater<ll>());
  sort(ALL(C),greater<ll>());
  
  int num=0;
  set<memo> m;
  priority_queue<dt> rest;
  rest.emplace(A[0]+B[0]+C[0],0,0,0);
  m.emplace(0,0,0);
  while(!rest.empty() && num<K){
    dt t=move(rest.top());
    rest.pop();
    
    cout << t.v << endl;
    num++;
    
    int i=t.i,j=t.j,k=t.k;
    if(i<X-1){
      auto res = m.emplace(i+1,j,k);
      if(res.second) rest.emplace(A[i+1]+B[j]+C[k],i+1,j,k);
    }
    if(j<Y-1){
      auto res = m.emplace(i,j+1,k);
      if(res.second) rest.emplace(A[i]+B[j+1]+C[k],i,j+1,k);
    }
    if(k<Z-1){
      auto res = m.emplace(i,j,k+1);
      if(res.second) rest.emplace(A[i]+B[j]+C[k+1],i,j,k+1);
    }
  }
  
  return 0;
}

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

using namespace std;

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

  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int h;
    cin >> h;
    ans += h >= k;
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
import math
from itertools import permutations

def dist(x0, y0, x1, y1):
    return math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)

def resolve():
    N = int(input())
    x, y = [], []
    for _ in range(N):
        x_tmp, y_tmp = list(map(int, input().split()))
        x.append(x_tmp)
        y.append(y_tmp)

    ls = list(permutations(list(range(N)), N))
    ans = 0
    for l in ls:
        idx = 0
        while idx + 1 < len(l):
            ans += dist(x[l[idx]], y[l[idx]], x[l[idx+1]], y[l[idx+1]])
            idx += 1

    print(ans / len(ls))
    return

resolve()

Measured memory_bytes: 13984
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            List<int> result = new List<int>();
            int j = 0;
            for(int i = 0; i < S.Length-2; i++)
            {
                int p = int.Parse(S.Substring(i, 3));
                if(p <= 753)
                {
                     j = 753 - p;
                }
                else
                {
                    j = p - 753;
                }
                    result.Add(j);
            }
            result.Sort();
            Console.WriteLine(result[0]);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    string s;
    cin >> s;
    int n = s.size(), ans = 0;
    for(int i = 0; i < n / 2; i++) {
        if(s[i] != s[n - i - 1]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int c = sc.nextInt();
		int[][] nums = new int[r + 1][c + 1];
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				int a = sc.nextInt();
				nums[i][j] = a;
			}
		}

		for (int i = 0; i < r + 1; i++) {
			for (int j = 0; j < c + 1; j++) {
				System.out.print(nums[i][j]);
				if (j != c) {
					System.out.print(" ");
				}

				if (r > i) {
					nums[r][j] += nums[i][j];
					nums[i][c] += nums[i][j];
				}

				if (j == c) {
					System.out.println();
				}
			}
		}
    }
}



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

int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	int flag=0;
	for(int i=0;i<s.size();i++)
	{ 
	    if(s[i]!=t[i])
	    { 
	        flag=-1;
	        break;
	    }
	}
	if(flag==-1)
	 cout<<"No"<<endl;
	else
	 cout<<"Yes"<<endl;
	return 0;
}


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

int v[20000];
int b[10000], e[10000];
int p[20000];

int main()
{
	int n;
	while (scanf("%d", &n), n){
		memset(p, 0, sizeof(p));
		
		for (int i = 0; i < n; i++){
			int h, m, s;
			scanf("%d:%d:%d", &h, &m, &s);
			b[i] = h * 60 * 60 + m * 60 + s;
			scanf("%d:%d:%d", &h, &m, &s);
			e[i] = h * 60 * 60 + m * 60 + s;
			
			v[i * 2] = b[i];
			v[i * 2 + 1] = e[i];
		}
		
		sort(v, v + 2 * n);
		
		for (int i = 0; i < n; i++){
			b[i] = lower_bound(v, v + 2 * n, b[i]) - v;
			e[i] = lower_bound(v, v + 2 * n, e[i]) - v;
			p[b[i]] += 1;
			p[e[i]] -= 1;
		}
		
		int num = 0;
		int res = 0;
		
		for (int i = 0; i < 2 * n; i++){
			num += p[i];
			res = max(res, num);
		}
		
		printf("%d\n", res);
	}
	
	return 0;
}

Measured memory_bytes: 1440
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

int first_N,N;
vector<string> words,rev_words;
vector<int> rev_index;
vector<int> data[8*NUM];


void init(int first_N){
	while(N < first_N)N *= 2;
}

void build(int node_id,int node_left,int node_right){

	if(node_right == node_left){

		if(node_left < first_N){
			data[node_id].push_back(rev_index[node_left]);
		}else{
			data[node_id].push_back(BIG_NUM);
		}
	}else{

		build(2*node_id+1,node_left,(node_left+node_right)/2);
		build(2*node_id+2,(node_left+node_right)/2+1,node_right);

		data[node_id].resize(node_right-node_left+1);
		merge(data[2*node_id+1].begin(),data[2*node_id+1].end(),data[2*node_id+2].begin(),
				data[2*node_id+2].end(),data[node_id].begin());
	}
}

//D未満の数を求める
int query(int search_left,int search_right,int node_id,int node_left,int node_right,int D){

	if(search_right < node_left || search_left > node_right)return 0;

	if(search_left <= node_left && search_right >= node_right){

		if(data[node_id][data[node_id].size()-1] < D){ //Dが最大値より大きい

			return (int)data[node_id].size();

		}else if(data[node_id][0] >= D){ //Dが最小値以上

			return 0;
		}

		int index,L,R,mid;

		//D未満の最大の数字を二分探索で検索
		L = 0,R = data[node_id].size()-1,mid = (L+R)/2;

		while(L <= R){

			if(data[node_id][mid] < D){

				index = mid;
				L = mid+1;
			}else{

				R = mid-1;
			}
			mid = (L+R)/2;
		}

		return index+1;
	}

	//今回のノードの区間に、一部検索区間と重なっている区間がある場合→再帰的に子どもに尋ねる
	int left_num = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2,D);
	int right_num = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right,D);

	return left_num+right_num;
}

int main(){

	int num_query;

	cin >> first_N >> num_query;

	for(int i = 0; i < first_N; i++){

		string input_str;
		cin >> input_str;

		words.push_back(input_str);
		reverse(input_str.begin(),input_str.end());
		rev_words.push_back(input_str);
	}

	sort(words.begin(),words.end());
	sort(rev_words.begin(),rev_words.end());

	//words[i]が、rev_words[i]のどこにあるかを調べる
	for(int i = 0; i < first_N; i++){

		string tmp = words[i];
		reverse(tmp.begin(),tmp.end());
		rev_index.push_back(lower_bound(rev_words.begin(),rev_words.end(),tmp)-rev_words.begin());
	}

	N = 1;
	init(first_N);

	build(0,0,N-1); //セグ木の構築

	int left,right,top,under;

	for(int loop = 0; loop < num_query; loop++){

		string prefix,suffix;

		cin >> prefix >> suffix;
		reverse(suffix.begin(),suffix.end());

		left = lower_bound(words.begin(),words.end(),prefix)-words.begin();
		right = lower_bound(words.begin(),words.end(),prefix+'~')-words.begin();

		top = lower_bound(rev_words.begin(),rev_words.end(),suffix)-rev_words.begin();
		under = lower_bound(rev_words.begin(),rev_words.end(),suffix+'~')-rev_words.begin();

		printf("%d\n",query(left,right-1,0,0,N-1,under)-query(left,right-1,0,0,N-1,top));
	}

	return 0;
}




Measured memory_bytes: 53208
#include <stdio.h>

int main(void)          
{
	int room[4][3][10];
	int i, j, k;

	int n, b, f, r, v;

	for (i = 0; i < 4; i++) 
	{
		for (j = 0; j < 3; j++)
		{
			for (k = 0; k < 10; k++)
			{
				room[i][j][k] = 0;
			}
		}
	}


	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		
			room[b - 1][f - 1][r - 1] = v + room[b - 1][f - 1][r - 1];
	}
		for (i = 0; i < 4; i++) 
		{
			for (j = 0; j < 3; j++)
			{
				for (k = 0; k < 10; k++)
				{
					printf(" %d", room[i][j][k]);
				}
				printf("\n");
			}
			if(i != 3)printf("####################\n");
		}
	return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

///////////////////////////

	
int main() {

	ll Q;
	cin >> Q;

	ll ans1 = -INF;
	ll ans2 = INF;
	ll val = 0;

	priority_queue<ll> s;
	priority_queue<ll, vector<ll>,greater<ll>> t;

	repn(i, Q) {

		ll q, a, b;
		cin >> q;

		if (q == 2) {
			cout << ans1 << " " << val << endl;
			continue;
		}

		cin >> a >> b;

		if (s.size() == t.size()) {
			t.push(a);
			ll x = t.top();
			t.pop();
			s.push(x);
			ll y = s.top();

			val += max(0, max(y - ans2, ans1 - y));
			val += abs(y - a) + b;
			ans1 = y;
			ans2 = y;
		}

		else {
			s.push(a);
			ll x = s.top();
			s.pop();
			t.push(x);

			ll y = s.top();
			ll z = t.top();

			val += abs(a - ans1) + b;

			ans1 = y;
			ans2 = z;

		}



	}
	

	
	system("PAUSE");
}

Measured memory_bytes: 4072