akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e5 + 5;
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, b[Maxn];
int ans;
int main()
{
	cin >> n;
	for (int i = 1; i < n; i++)
		b[i] = read();
	for (int i = 2; i < n; i++)
		ans += min(b[i], b[i - 1]);
	ans += b[1] + b[n - 1];
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;
int main(){
	ll L, R; cin >> L >> R;

	ll lsum = L/2019, rsum = R/2019;
	if(rsum-lsum >= 1) { cout << 0 << endl; return 0; }

	vector<ll> mod(R-L+1);
	for(ll i = L; i <= R; ++i){
		mod[i-L] = i%2019;
		// cout << mod[i-L] << endl;
	}

	vector<ll> mul(R-L+1);
	for(ll i = 0; i < R-L+1; ++i){
		mul[i] = 20000000000;
		for(ll j = i; j < R-L+1; ++j){
			if(i == j) continue;
			if((mod[i]*mod[j])%2019 < mul[i]) {
				mul[i] = (mod[i]*mod[j])%2019;
			}
		}
	}

	ll min = 20000000000;
	for(ll i = 0; i < R-L+1; ++i){
		if(mul[i] < min) min = mul[i];
	}

	// sort(mod.begin(), mod.end());
	cout << min << endl;

	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	s := IOInitialize()
	A := Int(s)
	B := Int(s)
	K := Int(s)

	nums := []int{}
	m := map[int]int{}

	minNum := min(B, A+K)

	for i := A; i < minNum; i++ {
		nums = append(nums, i)
		m[i] = 1
	}
	init := max(A, B-K+1)
	for i := init; i <= B; i++ {
		if _, ok := m[i]; ok {
			continue
		}
		nums = append(nums, i)
	}
	for _, num := range nums {
		fmt.Println(num)
	}
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func min(nums ...int) int {
	res := nums[0]
	for _, num := range nums {
		if res > num {
			res = num
		}
	}
	return res
}

func max(nums ...int) int {
	res := nums[0]
	for _, num := range nums {
		if res < num {
			res = num
		}
	}
	return res
}

Measured memory_bytes: 640
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  values = list(map(int, input().split()))[::-1]

  for i in range(1, len(values)):
    if values[i] <= values[i - 1]:
      continue
    elif values[i] == values[i - 1] + 1:
      values[i] -= 1
    else:
      print('No')
      return

  print('Yes')


if __name__ == '__main__':
  main()


Measured memory_bytes: 63984
#include<bits/stdc++.h>
using namespace std;
int n,s[100005],q,t;
bool binarySearch(int key){
    int left=0, right=n;
    while(left<right){
        int mid=(left+right)/2;
        if(s[mid]==key){
            return true;
        }
        else if(key < s[mid]){
            right=mid;
        }
        else{
            left=mid+1;
        }
    }
    return false;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++) cin>>s[i];
    cin>>q;
    int ans=0;
    for(int i=0;i<q;i++){
        cin>>t;
        if(binarySearch(t)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3380
N,W = map(int,input().split())
v_list = [[] for i in range(4)]

w_std,v = map(int,input().split())
v_list[0].append(v)
for i in range(N-1):
    wi,vi = map(int,input().split())
    v_list[wi-w_std].append(vi)
for i in range(4):
    v_list[i].sort(reverse=True)
    v_list[i].insert(0,0)

for i in range(4):
    if (len(v_list[i]) > 1):
        for j in range(1,len(v_list[i])):
            v_list[i][j] += v_list[i][j-1]

max_v = 0
for i in range(len(v_list[0])):
    for j in range(len(v_list[1])):
        for k in range(len((v_list[2]))):
            for l in range(len(v_list[3])):
                if (W >= i*w_std+j*(w_std+1)+k*(w_std+2)+l*(w_std+3)):
                    max_v = max(max_v,v_list[0][i]+v_list[1][j]+v_list[2][k]+v_list[3][l])
print(max_v)


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
	int x,y;

	while(1)
	{
		cin >> x >> y;
		if(x == 0 && y == 0)
			break;

		if(x < y)
			cout << x << " " << y << endl;

		else if(x > y)
			cout << y << " " << x << endl;

		else
			cout << x << " " << y << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	ll N,K; cin>>N>>K;
	vector<int> num(N);
	rep(i,N)cin>>num[i];
	ll lat_big = 0, inn_big = 0;
	rep(i,N){
		for(int j = i+1; j<N; ++j){
			if(num[i]>num[j]) ++lat_big;
		}
		rep(j,N){
			if(num[i]>num[j]) ++inn_big;
		}
	}
	ll ans = 0;
	ans += lat_big*K%MOD;
	ans += ((K-1LL)*K/2%MOD) * inn_big %MOD;
	ans %= MOD;
	if(ans < 0)ans += MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	int solve(int m,int n,int a[]){
		int lb = 0,ub = 0;
		for(int i = 0;i < n;i++){
			ub = ub + a[i];
		}
		int mid = ub / m;
		while(true){
			int cnt = 0;
			for(int i = 0;i < m;i++){
				int num = 0;
				while(true){
					if(cnt == n)break;
					if(num + a[cnt] <= mid){
						num = num + a[cnt];
						cnt++;
					}else{
						break;
					}
				}
			}
			if(cnt == n){
				ub = mid;
				mid = (lb+ub)/2;
				if(ub - lb == 1)break;
			}else{
				lb = mid;
				mid = (lb+ub)/2;
				if(ub - lb == 1)break;
			}
		}
		return ub;
	}
	void doIt() { 
		while(true){
			int m = sc.nextInt();
			int n = sc.nextInt();
			if(n+m == 0)break;
			int book[] = new int [n];
			for(int i = 0;i < n;i++){
				book[i] = sc.nextInt();
			}
			System.out.println(solve(m,n,book));
		}
     }
    public static void main(String[] args) {
    	// TODO Auto-generated method stub
    	new Main().doIt();
    }
}

Measured memory_bytes: 20968
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

struct modint{
  li num;

  modint(li a=0){
    num=(a%MOD+MOD)%MOD;
  }
  modint operator+(modint a) {return{(num+a.num)%MOD};} 
  modint operator-(modint a) {return{((num-a.num)%MOD+MOD)%MOD};}
  modint operator*(modint a) {return{num*a.num%MOD};}
  modint inv(const modint& a);
  modint operator/(modint a) {return (*this)*inv(a);}
  modint& operator+=(modint a) {
    (num += a.num)%=MOD;
    return *this;
  }
  modint& operator*=(modint a) {
    (num*=a.num)%=MOD;
    return *this;
  }
};

std::ostream& operator<<(std::ostream& os, const modint& m){
  // ここでストリームに obj を書き込みます。
  li a=m.num;
  a%=MOD;
  a+=MOD;
  a%=MOD;
  cout << a;
  return os;
}

std::istream& operator>>(std::istream& os,modint& m){
  // ここでストリームに obj を書き込みます。
  li a; cin >>a;
  m=a;
  return os;
}

modint pow(modint a,int r){
  modint b=a,ans=1;
  while(r){
    if(r%2) ans*=b;
    b*=b;
    r/=2;
  }
  return ans;
}

int main() {
  int n; cin >>n;
  print(pow(10,n)-pow(9,n)*2+pow(8,n));
}


Measured memory_bytes: 3624
#include <stdio.h>
 
int main(void){
  int h,w,i,j;
 
  scanf("%d%d",&h,&w);
 
  while(h!=0 || w!=0){
    for(j=0;j<w;j++)  printf("#");
    printf("\n");
    for(i=1;i<h-1;i++){
      printf("#");
      for(j=1;j<w-1;j++)  printf(".");
      printf("#\n");
    }
    for(j=0;j<w;j++)  printf("#");
    printf("\n\n");
    scanf("%d%d",&h,&w);
  }
 
  return 0;
}

Measured memory_bytes: 588
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Buffer(make([]byte, 0), 1e6) // maxTokenSize
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	/* --- code --- */
	s, t := next(), next()
	ans := 0
	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

func max(a, b int) int {
	return int(max64(int64(a), int64(b)))
}

func max64(a int64, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func min(a, b int) int {
	return int(min64(int64(a), int64(b)))
}

func min64(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 2700
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
ll mod = 1e9 + 7;
ll Len[55], Pat[55];//バーガーの厚さとパティの総数
ll rec(ll level, ll layer) {
	if (level == 0)return 1;
	if (layer == 1)return 0;
	else if (layer <= Len[level - 1] + 1) {
		return rec(level - 1, layer - 1);
	}
	else if (layer <= Len[level - 1] + 2) {
		return Pat[level - 1] + 1;
	}
	else if (layer <= 2 * Len[level - 1] + 2) {
		return Pat[level - 1] + 1 + rec(level - 1, layer - Len[level - 1] - 2);
	}
	else {
		return 2 * Pat[level - 1] + 1;
	}
}
//レベルNバーガーの下からX層に含まれるパティの総数をrec(N,X)とする
signed main() {
	ll N, X;
	cin >> N >> X;
	Len[0] = Pat[0] = 1;
	for (int i = 1; i <= N; ++i) {
		Len[i] = Len[i - 1] * 2 + 3;
		Pat[i] = Pat[i - 1] * 2 + 1;
	}
	cout << rec(N, X) << endl;
	return 0;
}

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


k = []
s = []
ans = 0

for i in range(m):
    k_temp, *s_temp = list(map(int, input().split()))
    k.append(k_temp)
    s.append(s_temp)

p = list(map(int, input().split()))

for bit in range(1 << n):
    light_on = 0
    for i in range(m):
        switch_on = 0
        for j in range(k[i]):
            if (bit >> (s[i][j] - 1)) & 1:
                switch_on += 1

        if switch_on % 2 == p[i]:
            light_on += 1

    if light_on == m:
        ans += 1

print(ans)


Measured memory_bytes: 3192
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
ll arr[200005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    set<ll> st;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        st.insert(x);
    }
    if(st.size()==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define whln(t) while(t--)
#define whlp(t) while(t++)
ll i=0,j=0;
#define md 1000000007

int main(void){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
   	// ll t;
   	// cin>>t;
   	// whln(t){
    ll n;
    cin>>n;
    vector<ll>v;
    
    rep(i,n){
    	ll a;
    	cin>>a;
    	v.push_back(a);
    }
    sort(v.begin(),v.end());
    ll cnt= 0,k ;
    rep(i,n)
    	rep(j,i)
 	   		rep(k,j)
 	   			if(v[i]!=v[j] && v[j]!=v[k] && (v[i]<v[k]+v[j]))
 	   				cnt++;
 	 cout<<cnt;  			

  	//}
}
//   *****  *******   !
//   *		     *    !
//   ***       *      !
//   *       *        !
//   *****  *******   !

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		long[] A = new long[N];
		String[] a = new String[N];
		long max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
			a[i] = Long.toBinaryString(A[i]);
			max = Math.max(max, A[i]);
		}
		sc.close();
		String k = Long.toBinaryString(K);
		int l = k.length();
		int f = Long.toBinaryString(max).length();

		int g = Math.max(l, f);
		int[] c = new int[g];

		for(int i = 0; i < N; i++) {
			String b = a[i];
			int l1 = b.length();
			for(int j = 0; j < l1; j++) {
				if(b.charAt(j) == '1') {
					c[l1 - j - 1] ++;
				}
			}
		}

		int[] m = new int[l];

		for(int i = 0; i < l; i++) {
			if(k.charAt(i) == '1') {
				m[i] = 1;
			}
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < l; i++) {
			if(c[i] > N / 2) {
				sb.append(0);
			}else {
				sb.append(1);
			}
		}
		sb.reverse();
		//System.out.println(sb.toString());
		long t = Long.parseLong(sb.toString(), 2);
		if(t > K) {
			for(int i = 0; i < l; i++) {
				if(m[i] == 0 && sb.charAt(i) == '1') {
					sb.replace(i, i + 1, "0");
					long r = Long.parseLong(sb.toString(), 2);
					if(r <= K) {
						break;
					}
				}
			}
		}

		long t1 =  Long.parseLong(sb.toString(), 2);
		long sum = 0;
		if(K == 0) t1 = 0;
		for(long i : A) {
			sum += t1 ^ i;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 76492
dp=[0]+[1<<20]*10000
n=int(input())
for i in range(1,n):
    a=int(input())
    for j in range(i//2+1):
        if dp[j]>dp[i-j]+a:dp[j]=dp[i-j]+a
        if dp[i-j]>dp[j]+a:dp[i-j]=dp[j]+a
print(dp[n//2])

Measured memory_bytes: 8012
#define _USE_MATH_DEFINES //M_PI, M_E
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b==c+d) cout<<"Balanced"<<endl;
	else if(a+b>c+d) cout<<"Left"<<endl;
	else cout<<"Right"<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
s = input().split()
a = int(s[0])
b = int(s[1])
h = int(s[2])
m = int(s[3])
th = 30*h + m/2
tm = 6*m
#print(j)
j = math.cos(math.radians(abs(th-tm)))
#print(j)
x = a**2 + b**2 -(2*a*b*j)
x = math.sqrt(x)
print(x)

Measured memory_bytes: 9476
#include <iostream>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <math.h>
#include <vector>
//#include <string>
typedef long long LL;
using namespace std;

struct shop
{
    LL a;
    LL b;

    shop(LL input_a, LL input_b)
    {
        a = input_a;
        b = input_b;
    }
};

bool cmp(const shop &x, const shop &y)
{
    return x.a < y.a;
}

int main(){
    int n;
    int m;
    LL tmp_a;
    LL tmp_b;
    LL ans=0;
    vector<shop> ab;
    cin >> n >> m;
    vector<size_t> indices(n);
    for(int i=0; i<n; i++){
        cin >> tmp_a >> tmp_b;
        ab.push_back(shop(tmp_a, tmp_b));
    }
    sort(ab.begin(), ab.end(), cmp);

    for(int i=0; i<n; i++){
        if(m>=ab[i].b){
            ans += ab[i].a*ab[i].b;
            m -= ab[i].b;
        }else{
            ans += ab[i].a*m;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3188
N = int(input())
S= list(input())

alist = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

for i in S:
    print(alist[(alist.index(i)+N)%26],end="")

Measured memory_bytes: 4596
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

// head

int main(){

  int n = in();
  vector<int> a(n);
  REP(i, n){
    a[i] = in();
  }
  vector<int> dp(n + 2, INF);
  dp[0] = 0;
  REP(i, n){
    FOR(j, 1, 3){
      chmin(dp[i+j], dp[i] + abs(a[i] - a[i+j]));
    }
  }
  cout << dp[n-1] << endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n,a,b,ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        ans+=b-a+1;
    }
    cout<<ans<<endl;
    return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MAX 510000

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

ll MOD=0;

ll	myPow(ll x, ll n) {
	ll r=1;
	while(n>0)
		if (0==n%2) {
			x *=x;
			x %=MOD;
			n /=2;
		} else {
			r *=x;
			r %=MOD;
			n--;
		}
	return r;
}

ll	MPl(ll x, ll y) {
	return (x+y)%MOD;
}

ll	MMi(ll x, ll y) {
	return (x-y+MOD)%MOD;
}

ll	MMul(ll x, ll y) {
	return (x*y)%MOD;
}

// Array
vector<ll> fac(MAX, 0);
vector<ll> finv(MAX, 0);
vector<ll> inv(MAX, 0);

void	DivInit() { // fac, finv, inv
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i=2; i<MAX; i++) {
		fac.at(i) = (fac.at(i-1)*i) %MOD;
		inv.at(i) = MOD - (inv.at(MOD%i)*(MOD/i)) %MOD;
		finv.at(i) = (finv.at(i-1)*inv.at(i)) %MOD; 
	}
}

ll	MDiv(ll x, ll y) {
	if (1!=inv.at(1))
		DivInit();
	return (x*inv.at(y))%MOD;
}

int	main() {
	ll K;
	cin >>K;
	MOD=K;
	vector<bool> D(1000001, true);
	ll S=7;
	ll C=1;
	for (;;) {
		if (!D.at(S)) {
			cout <<-1 <<endl;
			return 0;
		} else if (0==S%K) {
			cout <<C <<endl;
			return 0;
		} else {
			D.at(S)=false;
			S=MMul(S, 10);
			S=MPl(S, 7);
			C++;
		}
	}
	return 0;
}



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

using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  int pos=-1;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]==1){
      pos=i;
    }
  }
  cout << (n-2)/(k-1)+1 << endl;
}


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

#define MOD 1000000007
#define PI 3.141592653589793

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

void testCase() {
	string s;
	cin >> s;
	for(int i = 0; i < (int) s.length(); i++) {
		if((i + 1 == (int) s.length() || !i) && s[i] == '?') {
			s[i] = 'D';
			continue;
		} 
		if(s[i] == '?') {
			if(s[i - 1] == 'P')
				s[i] = 'D';
			else if(s[i - 1] == 'D' && s[i + 1] == 'D') 
				s[i] = 'P';
			else if(s[i - 1] == 'D' && s[i + 1] == 'P') 
				s[i] = 'D';
			else if(s[i - 1] == 'D' && s[i + 1] == '?') 
				s[i] = 'P';
			else if(s[i - 1] == 'P' && s[i + 1] == '?') 
				s[i] = 'D';
		}
	}
	cout << s << "\n";
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int T = 1;
	//cin >> T;
	while(T--) {
		testCase();
	}
}


Measured memory_bytes: 3736
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 100
int num[MAXN+5];
int main() {
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=2*n;i++)
		cin>>num[i];
	sort(num+1,num+2*n+1);
	for(int i=2*n-1;i>=1;i-=2)
		sum+=num[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		int[] line_b = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		int sum;
		int ans=0;

		for (int i = 0; i < line[0]; i++) {
			sum = 0;
			int[] line_a = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
			for (int j = 0; j < line[1]; j++) {
				sum += line_a[j] * line_b[j];
			}
			if (sum > line[2] * -1) {
				ans++;
			}
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 36480
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
int main()
{   
    int N,X;
    cin>>N>>X;
    int sum=0;
    vector<int> L(N);
    for(int i=0;i<N;i++){
    cin>>L.at(i);
    }
    for(int i=0;i<N;i++){
    sum+=L.at(i);
        if(sum>X){
        cout<<i+1<<endl;
            break;
        }
        if(i==N-1&&sum<=X){
        cout<<N+1<<endl;
        }
    }
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/



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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  tx -= sx;
  ty -= sy;
  for (int i = 0; i < tx; ++i) cout << 'R';
  for (int i = 0; i < ty; ++i) cout << 'U';
  for (int i = 0; i < tx; ++i) cout << 'L';
  for (int i = 0; i < ty; ++i) cout << 'D';
  cout << 'D';
  for (int i = 0; i < tx + 1; ++i) cout << 'R';
  for (int i = 0; i < ty + 1; ++i) cout << 'U';
  cout << "LU";
  for (int i = 0; i < tx + 1; ++i) cout << 'L';
  for (int i = 0; i < ty + 1; ++i) cout << 'D';
  cout << 'R';
  cout << endl;
}


Measured memory_bytes: 384
// Try AtCoder
//author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let mut s =  get!();
    
    let mut ans = (753 - s % 1000).abs();
    
    while s >= 100 {
    	let tmp = (753 - s % 1000).abs();
        ans = std::cmp::min(ans, tmp);
        s /= 10;
    }
    
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int N;
    string S;
    cin >> N >> S;
    
    int r=0,g=0,b=0;
    for(int i=0;i<N;i++){
        if(S[i] == 'R') r++;
        if(S[i] == 'G') g++;
        if(S[i] == 'B') b++;
    }
    
    int ans = r*g*b;
    int cnt = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            int k = i*2 - j;
            if(j < k && k < N){
                if(S[i] != S[j] && S[j] != S[k] && S[i] != S[k]) cnt++;
            }
        }
    }
    
    cout << ans - cnt << endl;
    return 0;
}





Measured memory_bytes: 3620
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
const long long MOD = 998244353;
// const long long MOD = 1e9 + 7;

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

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

  ll n;
  std::cin>>n;

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

  std::vector<ll> per(n);
  rep(i,0,n)per[i]=i+1;

  ll cnt=0,pitr=-1,qitr=-1;

  do{
    cnt++;
    if(per==p)pitr=cnt;
    if(per==q)qitr=cnt;
  }while(std::next_permutation(all(per)));

  std::cout<<std::abs(pitr-qitr)<<"\n";

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 0; i < n - 2; i++)
    if(s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C')
      ans++;
  cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n, a, b, mul;
    scanf("%d %d %d", &n, &a, &b);
    mul = n*a;
    if(mul>b){
        printf("%d\n", b);
    }
    else printf("%d\n", mul);

    return 0;
}


Measured memory_bytes: 1708
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n,k;
  cin >> n >> k;
  vi c(n),r(n);
  rep(i,n)cin >> c[i] >> r[i];

  vector<vi> g(n);
  rep(i,k){
    int a,b;
    cin >> a >> b; a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vi dis(n,1e9), use(n,0);
  dis[0] = 0;
  for(;;){
    int v = -1;
    rep(i,n){
      if(!use[i] && (v<0 || dis[v] > dis[i]))v = i;
    }
    if(v<0 || v==n-1)break;
    use[v] = 1;

    vi d(n,-1); d[v] = 0;
    queue<int> q; q.push(v);

    while(q.size()){
      int cur = q.front(); q.pop();
      if(d[cur]==r[v])break;

      for(int nxt : g[cur]){
	if(d[nxt] < 0){
	  dis[nxt] = min(dis[nxt], dis[v] + c[v]);
	  d[nxt] = d[cur] + 1;
	  q.push(nxt);
	}
      }
    }
  }
  cout << dis[n-1] << endl;
}

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

int main()
{
    string s,t;
    cin >> s;
    for(int i = 0;i < s.size();i++){
        if(s[i] == '0'){
            t.push_back('0');
        } else if(s[i] == '1'){
            t.push_back('1');
        } else if(s[i] == 'B'){
            if(t.size() != 0) t.pop_back();
        }
    }
    cout << t << endl;

}

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

int main() {
  ll a;
  double b;
  cin >> a >> b;

  ll bb = 100*b + 0.5;  //bを整数として扱えるようにする.

  ll ans = a*bb/100; //c++だと小数点以下は切り捨て

  //printf("%.f", ans);
  cout << ans << endl;

}


Measured memory_bytes: 3724
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int sum_a = 0;
	int max_b = -MOD;
	vector<pair<int, int>> y(n);
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		y[i] = make_pair(b, a);
		if (a > b) { cout << "No"; return 0; }
		max_b = max(max_b, b);
		sum_a += a;
		if (sum_a > max_b) { cout << "No"; return 0; }
	}
	sort(y.begin(), y.end());
	ll sum = 0;
	rep(i, n) {
		sum += y[i].second;
		if(sum>y[i].first) { cout << "No"; return 0; }
	}
	cout << "Yes";
}



Measured memory_bytes: 1792
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);
    
    int n, w, max, maxP;
    int[] hist;
    double ans;

    void run(){
	while(true){
	    n = sc.nextInt();
	    w = sc.nextInt();
	    if(n==0 && w==0) break;

	    max = 0;
	    maxP = 0;
	    ans = 0;
	    hist = new int[100/w+1];
	    for(int i=0; i<n; i++){
		int k = sc.nextInt()/w;
		hist[k]++;
		max = Math.max(k, max);
		maxP = Math.max(hist[k], maxP);
	    }

	    for(int i=0; i<=max; i++){
		double x = (double)(max-i)/max * hist[i]/maxP;
		//System.out.println(x);
		ans += x;
	    }
	    ans += 0.01;

	    System.out.println(ans);
	}
    }
}

Measured memory_bytes: 23652
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n < 10) {
            System.out.println(n);
            return;
        }
        long c = 0;
        int[][] d = new int[10][10];
        for (int i = 1 ; i <= n ; i++) {
            int a = i % 10;
            String s = String.valueOf(i);
            int b = Integer.valueOf(s.substring(0,1));
            d[a][b]++;
        }

        for (int i = 0 ; i < 10 ; i++) {
            for (int j = 0 ; j < 10 ; j++) {
                c += d[i][j] * d[j][i];
            }
        }




        System.out.println(c);


    }

}


Measured memory_bytes: 39728
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const int INF = 1001001001;
typedef pair<int,int> pii;
typedef pair<int, pii> pip;
#define fi first
#define se second
#define mp make_pair

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

int main(){
  int h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--, cw--;
  dh--, dw--;
  vector<vector<int> > field(h, vector<int>(w));
  rep(i, h){
    rep(j, w){
      char c;
      cin >> c;
      if(c == '.') field[i][j] = INF;
      else if(c == '#') field[i][j] = -1;
    }
  }

  field[ch][cw] = 0;
  priority_queue<pip, vector<pip>, greater<pip> > pq;
  pq.push(mp(0, mp(ch, cw)));
  while(!pq.empty()){
    pip p = pq.top();
    pq.pop();
    int cnt = p.fi;
    int x = p.se.fi;
    int y = p.se.se;
    REP(i, -2, 2){
      REP(j, -2, 2){
        if(i == 0 && j == 0) continue;
        int nx = x + i;
        int ny = y + j;
        if(nx < 0 || h <= nx || ny < 0 || w <= ny) continue;
        if(field[nx][ny] == -1) continue;
        if(chmin(field[nx][ny], field[x][y] + 1)){
          pq.push(mp(field[nx][ny], mp(nx, ny)));
        }
      }
    }
    rep(i, 4){
      int nx = x + dx[i];
      int ny = y + dy[i];
      if(nx < 0 || h <= nx || ny < 0 || w <= ny) continue;
      if(field[nx][ny] == -1) continue;
      if(chmin(field[nx][ny], field[x][y])){
        pq.push(mp(field[nx][ny], mp(nx, ny)));
      }
    }
  }

  if(field[dh][dw] == INF) cout << -1 << endl;
  else cout << field[dh][dw] << endl;

  return 0;
}


Measured memory_bytes: 7608
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7
# MOD = 998244353
INF = float("inf")

n, k = map(int, input().split())
kashi = [True]*n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        kashi[j-1] = False

print(sum(kashi))


Measured memory_bytes: 68436
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L = float(input())
print((L/3)**3)

Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    char s[200005];
    ll n,ans=0;
    scanf("%s",s);
    n=strlen(s);
    ll as=0;
    rep(i,0,n-1){
        if(s[i]=='A'){
            as++;
        }else if(s[i]=='B' && s[i+1]=='C'){
            ans+=as;
            i++;
        }else{
            as=0;
        }   
        // printf("%lld ",ans);
    }

    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <string>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
#define push_back pb
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main(){


string n;
cin>>n;
for(int i=0;i<n.size();i++)
{
    if(n[i]=='1')
    {
        n[i]='9';
    }
    else
    {
        n[i]='1';
    }
}

cout<<n<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxv = 0;
		boolean flg = true;
		for(int i = 0; i< N; i++) {
			int now = sc.nextInt();
			if(maxv < now) {
				maxv = now - 1;
			}else if(maxv == now){
				maxv = now;
			}else {
				flg = false;
				break;
			}
		}
		if(flg) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 46560
import math
deg = int(input())
li_x = list(map(int,input().split()))
li_y = list(map(int, input().split()))
p1_dis = 0.0
p2_dis = 0.0
p2_temp = 0.0
p3_dis = 0.0
p3_temp = 0.0
p4_dis = 0.0
p4_temp = [ ]

for i in range(deg):
	p1_dis += math.fabs(li_x[i] - li_y[i])
	p2_temp += (li_x[i] - li_y[i]) **2.0
	p3_temp += math.fabs(li_x[i] - li_y[i]) **3.0
	p4_temp.append( math.fabs(li_x[i] - li_y[i]) )

p2_dis = math.sqrt( p2_temp )
p3_dis = math.pow(p3_temp, 1.0/3.0)
p4_dis = max(p4_temp)

print('{0:.6f}'.format(p1_dis))
print('{0:.6f}'.format(p2_dis))
print('{0:.6f}'.format(p3_dis))
print('{0:.6f}'.format(p4_dis))

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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const ll _INF = 1e18+7;

int main(){
	setIO();
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a*c, max(a*d, max(b*d, b*c))) << endl;

}

Measured memory_bytes: 3676
N = int(input())
nums = [3, 5, 7]

def count(curr):
    if curr > N:
        return 0
    ret = 0
    for i in nums:
        s = int(curr * 10 + i)
        if s <= N:
            ss = str(s)
            if "3" in ss and "5" in ss and "7" in ss:
                ret += 1
            ret += count(s)
    return ret

print(count(0))


Measured memory_bytes: 2940
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var num = parseInt(line[0]);
    var mod = new Array(10);
    var temp = 0;
    var ans = 0;
    var min = 1000;
    
    for(var i = 0; i < mod.length; i++){
        mod[i] = [];
    }
    
    for(var i = 0; i < num; i++){
        temp = parseInt(input[i+1]);
        ans += temp;
        if(temp < min && temp % 10 != 0){
            min = temp;
        }
//        console.log(input[i+1][1]);
        for(var j = 0; j < 10; j++){
            if(input[i+1][1] == j){
                mod[j].push(temp);
            }
        }
    }
    
    if(ans % 10 != 0){
        console.log(ans);
    } else {
        if(mod[0].length === num){
            console.log(0);
        } else {
            console.log(ans - min);
        }
    }
    
//    console.log(mod);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

const int MAX_H = 50, MAX_W = 50;

int H, W;
char s[MAX_H][MAX_W];
bool used[MAX_H][MAX_W];

int dfs(int i, int j){
    int cnt = 1;
    used[i][j] = 1;
    //cout << i <<" " << j <<endl;

    if( i != 0 && s[i-1][j] == '#' && used[i-1][j] == 0) cnt += dfs(i-1, j);
    if( i != H - 1 && s[i+1][j] == '#' && used[i+1][j] == 0) cnt += dfs(i+1, j);
    if( j != 0 && s[i][j-1] == '#' && used[i][j-1] == 0) cnt += dfs(i, j-1);
    if( j != W - 1 && s[i][j+1] == '#' && used[i][j+1] == 0) cnt += dfs(i, j+1);

    return cnt;
}

int main(){
    cin >> H >> W;
    for(int i = 0; i < H; i++ ){
        for(int j = 0; j < W; j++){
            cin >> s[i][j];
        }
    }
    memset(used, 0, sizeof(used));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(!used[i][j] && s[i][j] == '#'){
                if(dfs(i,j) == 1){
                    cout << "No\n";
                    return 0;
                }
            }
        }
    }
    cout << "Yes\n";

}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstdlib>
#include<map>
#include<vector>
#include<ctime>
#include<stack>
#define mp make_pair
#define pa pair<int,int>
#define INF 0x3f3f3f3f
#define inf 0x3f
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long

using namespace std;

inline ll read()
{
	long long f=1,sum=0;
	char c=getchar();
	while (c<'0' || c>'9')
	{
		if (c=='-')	f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9')
	{
		sum=sum*10+c-'0';
		c=getchar();
	}
	return sum*f;
}
const int MAXN=200010;
const int Mod=998244353;
char s[MAXN];
int f[MAXN][3][3][2];
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	if (n<=3)
	{
		if (n==1)
			cout<<1;
		else if (n==2)
		{
			if (s[1]==s[2])
				cout<<1;
			else
				cout<<2;
		}
		else
		{
			if (s[1]==s[2] || s[2]==s[3])
			{
				if (s[1]==s[2] && s[2]==s[3])
					cout<<1;
				else 
					cout<<6;
			}
			else
			{
				if (s[1]==s[3])
					cout<<7;
				else
					cout<<3;
			} 
		}
		return 0;
	}
	int sum=0,tot=0;
	for (int i=2;i<=n;i++)
		sum+=(s[i]==s[i-1]),tot+=s[i]-'a';
	tot+=s[1]-'a';
	tot%=3;
	if (sum==n-1)
	{
		cout<<1;
		return 0;
	}
	int ans=!sum;
	f[1][1][1][0]=f[1][2][2][0]=f[1][0][0][0]=1;
	for (int i=2;i<=n;i++)
		for (int j=0;j<=2;j++)
			for (int k=0;k<=2;k++)
				for (int p=0;p<=2;p++)
				{
					int last=(j-k+3)%3;
					f[i][j][k][1]+=f[i-1][last][p][1];
					f[i][j][k][1]%=Mod;
					if (k==p)
						f[i][j][k][1]+=f[i-1][last][p][0];
					else
						f[i][j][k][0]+=f[i-1][last][p][0];
					f[i][j][k][1]%=Mod,f[i][j][k][0]%=Mod;
				}
	for (int i=0;i<=2;i++)
		ans+=f[n][tot][i][1],ans%=Mod;
	cout<<ans;
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, k;
	cin>>n>>k;
	if(k == 0){
		cout<<n*1LL*n<<'\n';
		exit(0);
	}
	ll ans = 0;
	for(int b = k + 1; b <= n; b++){
		for(int i = 0; i <= n; i += b){
			int l = i + k;
			int r = min(n, i + b - 1);
			if(l <= r)ans += r - l + 1;
		}
	}
	cout<<ans<<'\n';

	return 0;
}

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

{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n;
	cin>> n;
	if(n<1200)
	{
		cout<<"ABC"<<"\n";
	}
	else
	{
		cout<<"ARC"<<"\n";
	}
}

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

int main() {
	int a, b;
	cin >> a >> b;

	int max_price = 1250, ans = -1;
	for (int i = 1; i <= max_price; i++) {
		int eight = static_cast<float>(i)*0.08;
		int ten = static_cast<float>(i)*0.1;
		if (eight == a && ten == b) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n,h,w;cin >> n >> h >> w;
  ++n;
  cout << (n-h)* (n-w) << endl;
}


Measured memory_bytes: 3592
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.IO

Public Class Program


    Public Shared Sub Main(args As String())

        Dim input1() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split, AddressOf Integer.Parse)
        Dim N As Integer = input1(0)
        Dim M As Integer = input1(1)

        Dim nodes(N + 1) As List(Of Integer)
        For i As Integer = 0 To N
            nodes(i) = New List(Of Integer)
        Next



        For i As Integer = 1 To M
            Dim inputnode() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split, AddressOf Integer.Parse)
            nodes(inputnode(0)).Add(inputnode(1))
            nodes(inputnode(1)).Add(inputnode(0))
        Next

        Dim Queue As New Queue(Of Integer)
        Dim depths = Enumerable.Repeat(-1, N + 1).ToArray()
        depths(1) = 1
        Dim michishirube(N + 1) As Integer
        Dim working As Integer = 1
        Queue.Enqueue(1)

        Do While Queue.Count > 0

            working = Queue.Dequeue()


            For Each NN In nodes(working)

                If depths(NN) = -1 Then
                    depths(NN) = depths(working) + 1
                    Queue.Enqueue(NN)
                    michishirube(NN) = working
                End If

            Next

        Loop

        Console.WriteLine("Yes")

        For i As Integer = 2 To N
            Console.WriteLine(michishirube(i))
        Next



    End Sub




End Class

Measured memory_bytes: 52228
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n;
  string s;
  cin >> n >> s;
  string ans="";
  for(int i=0; i<n;){
    char tmp=s[i];
    ans+=tmp;
    while(s[i]==tmp) i++;
    //cout << i << endl;
  }
  cout << sz(ans) << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int gcd(int a, int b)
{
	if (a % b) return gcd(b, a % b);
	return (b);
}

void swap(int *a, int *b)
{
	int tmp;

	tmp = *a;
	*a = *b;
	*b = tmp;
}

int main(void)
{
	int x, y;

	while (~scanf("%d %d", &x, &y)){
		if (x > y) swap(&x, &y);
		printf("%d\n", gcd(y, x));
	}

	return (0);
}

Measured memory_bytes: 596
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N;
void keisan(int n, string S, int saidai) {
	if (n == N) co(S);
	else {
		rep1(i, saidai + 1) {
			keisan(n + 1, S + char('a' + i - 1), max(saidai, i));
		}
	}
}

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


	cin >> N;

	keisan(0, "", 0);


	Would you please return 0;
}

Measured memory_bytes: 1664