akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if(a>b){
    if(b>c) printf("%d %d %d\n",c,b,a);
    else if(c>a) printf("%d %d %d\n",b,a,c);
    else printf("%d %d %d\n",b,c,a);
  }
  else {
    if(a>c) printf("%d %d %d\n",c,a,b);
    else if(c>b) printf("%d %d %d\n",a,b,c);
    else printf("%d %d %d\n",a,c,b);
  }

 return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int A, B, K; cin >> A >> B >> K;
  for (int i=A;i<=min(B,A+K-1);i++) cout << i << endl;
  for (int i=max(B-K+1,A+K);i<=B;i++) cout << i << endl;

  // cout << fixed << setprecision(6);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};

int main(){
    string s;cin >> s;
    int d = 0;
    FOREACH(a,s){
        d += a - '0';
    }
    Yes(stoi(s)%d==0);
    return 0;
}


Measured memory_bytes: 256
w, h, n = gets.chomp.split().map(&:to_i)

grouped_dots = {1 => [], 2 => [], 3 => [], 4 => []}

n.times do
  dot = gets.chomp.split().map(&:to_i)
  if dot[-1] == 1 || dot[-1] == 2
    grouped_dots[dot[-1]].push(dot[0])
  else
    grouped_dots[dot[-1]].push(dot[1])
  end
end

x_min = grouped_dots[1].max || 0
x_max = grouped_dots[2].min || w
y_min = grouped_dots[3].max || 0
y_max = grouped_dots[4].min || h
x = x_max - x_min < 0 ? 0 : x_max - x_min
y = y_max - y_min < 0 ? 0 : y_max - y_min
print(x * y)


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  int i,j;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  vector<int>boxes(n);
  int tmp;
  for(i=n;i>0;i--){
    tmp = 0;
    for(j=2*i;j<=n;j+=i){
      if(boxes[j-1]==1)tmp++;
    }
    if(tmp%2==a[i-1])boxes[i-1]=0;
    else boxes[i-1]=1;
  }
  tmp=0;
  for(i=0;i<n;i++){
    if(boxes[i]==1)tmp++;
  }
  cout<<tmp<<endl;
  for(i=0;i<n;i++){
    if(boxes[i]==1)cout<<i+1<<" ";
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> N;
	int maxp = 55555;
	vector<int>eratos(maxp+1,1);
	vector<int>prime;
	eratos[0] = 0; eratos[1] = 0;
	for (int i = 2; i <= maxp; i++) {
		if (eratos[i] == 0)continue;
		prime.push_back(i);
		for (int j = i; i + j <= maxp; j += i) {
			eratos[i + j] = 0;
		}
	}
	for (int i = 0; i < prime.size(); i++) {
		if (ans == N)break;
		if (prime[i] % 10 == 1) {
			cout << prime[i] << endl;
			ans++;
		}
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>

using namespace std;

string s, t;

int main() {
    while (cin >> s >> t) {
        int i, n = s.size();
        if (s == t) { puts("Yes"); continue; }
        for (i = 0; i <= n; ++i) {
            s = (s[n - 1]) + s;
            s.resize(n);
            if (s == t) {
                puts("Yes");
                break;
            }
        }
        if (i > n) puts("No");
    }
    return 0;
}


Measured memory_bytes: 256
#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(b=1;H>=b;b++){
			for(a=1;W>=a;a++){if(b%2==1 && a%2==0)printf(".");
							else{if(b%2==0 && a%2==1){printf(".");}
								else{printf("#");}}
				}printf("\n");
		}printf("\n");
}
return 0;
}


Measured memory_bytes: 2044
# 1.input
n = int(input())
x = list(map(int, input().split()))

# 2.check half- and half+
x_copy = sorted(x, reverse=False)
half = int(n/2)
half_minus = x_copy[half-1]
half_plus = x_copy[half]


# 3. judge
#    if removed number is smaller than or equal to half- -> half+
#    else -> half-
for xi in x:
    if xi <= half_minus:
        print(half_plus)
    else:
        print(half_minus)

Measured memory_bytes: 26180
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// B2D
// 2013/09/19
public class Main{
	Scanner sc=new Scanner(System.in);

	int n;
	String s;

	void run(){
		n=sc.nextInt();
		s=sc.next();
		solve();
	}

	void solve(){
		int N=(1<<n)+2, l0=N-2, l1=N-1;
		int[] ch0=new int[N], ch1=new int[N];
		for(int i=0; i<N; i++){
			ch0[i]=i*2;
			ch1[i]=i*2+1;
		}
		for(int i=0; i<1<<(n-1); i++){
			int os=1<<(n-1);
			ch0[os+i]=s.charAt(i*2)=='0'?l0:l1;
			ch1[os+i]=s.charAt(i*2+1)=='0'?l0:l1;
		}
		make(N);
		int node=(1<<n)-1;
		for(int b=n-1; b>=0; b--){
			int s=1<<b, t=s*2;
			for(int i=s; i<t; i++){
				for(int j=s; j<t; j++){
					if(find(ch0[i])==find(ch0[j])&&find(ch1[i])==find(ch1[j])){
						if(union(i, j)){
							node--;
						}
					}
				}
			}
		}
		for(int i=1; i<1<<n; i++){
			if(find(i)==i&&find(ch0[i])==find(ch1[i])){
				node--;
			}
		}
		println(node+"");
	}

	int[] p;

	void make(int n){
		p=new int[n];
		fill(p, -1);
	}

	int find(int x){
		return p[x]<0?x:(p[x]=find(p[x]));
	}

	boolean union(int x, int y){
		x=find(x);
		y=find(y);
		if(x!=y){
			p[x]=y;
		}
		return x!=y;
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 21720
import sys
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
def main():
    N = int(input())
    p = sieve_of_eratosthenes(55555)
    res = []
    for i in p:
        if i % 5 == 1:
            res.append(i)
    print(*res[:N],sep = " ")
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)


if __name__ == "__main__":
    main()

Measured memory_bytes: 5688
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

fn main() {
    let (n,x) = {
        let xs = read_vec_i64();
        (xs[0] as usize, xs[1])
    };
    let xs = {
        let mut xs = vec![];
        for _ in 0..n {
            let x = read_i64();
            xs.push(x);
        }
        xs
    };
    let sum = xs.iter().fold(0, |sum, &x| sum + x);
    let min_x = xs.iter().fold(xs[0], |m, &x| min(m, x));
    let res = n as i64 + (x - sum) / min_x;
    println!("{}", res);
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c ;
  if(a<b&&a<c){

        if(b<c)
          cout << "Yes" << endl;
    }
  
  else{
    cout<< "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3136
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: [usize; 5],
    }
    for i in 0..5 {
        if a.get(i).unwrap().clone() == 0 {
            println!("{}", i + 1);
            return;
        }
    }
}


Measured memory_bytes: 2136
import numpy as np
N,M = map(int, input().split())
S = []
for i in range(M):
    k,*s = map(int, input().split())
    T = [0]*N
    for j in s:
        T[j-1]=1
    S.append(T)
P = list(map(int, input().split()))
ans =0
for x in range(2**N):
    y = format(x,"0{}b".format(N))
    z = list(map(int,y))
    if all(np.dot(den,z)%2==P[nmb] for nmb,den in enumerate(S)):
        ans +=1
            
print(ans)   

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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define chinko long long

using namespace std;


int main(){
	int n,d;
	cin>>n>>d;
	if(500*n<d)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=100005;
int n;
int p[max_n];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",p+i);
    int ans=0;
    for(int i=1;i<n;i++){
        if(p[i]==i){
            ans++;
            swap(p[i],p[i+1]);
        }
    }
    if(p[n]==n)ans++;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int w[10], k[10], ans1, ans2;
	
	for (int i = 0; i < 10; i++){
		scanf("%d", &w[i]);
	}
	for (int i = 0; i < 10; i++){
		scanf("%d", &k[i]);
	}
	
	sort(w, w+10);
	sort(k, k+10);
	
	ans1 =  w[9] + w[8] + w[7];
	ans2 =  k[9] + k[8] + k[7];
	
	
	printf("%d %d\n", ans1, ans2);
	
	return (0);
}

Measured memory_bytes: 1040
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	int MOD = 1000000007;
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F();
		var A = G();
		var c = 0;
		var i = 0;
		while (i < N)
		{
			c++;
			var j = i + 1;
			while (j < N && A[j] == A[i]) j++;
			if (j == N) break;
			if (A[j - 1] < A[j]) while (j < N && A[j - 1] <= A[j]) j++;
			else while (j < N && A[j - 1] >= A[j]) j++;
			i = j;
		}
		WriteLine(c);
	}
}

Measured memory_bytes: 19680
#include <bits/stdc++.h>
using namespace std;
int main(){
    int slen;
    string s;
    char ss='s';
    cin >> s;
    slen=s.size();
    if(s.at(slen-1)==ss){
        s=s+"es";
        cout << s;
    }else{
        s=s+"s";
        cout << s;
    }
}

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include<unordered_set>
#include<unordered_map>

//by Skeef79

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

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define for0(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define REP(a,i,b) for (int i = a;i<b;i++);

using namespace std;

const int INF = 2000000000;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}


void solve()
{
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	string ans;

	for (int i = 0; i < 2 * n; i++)
		if (i % 2 == 0)
			ans += s[i / 2];
		else
			ans += t[i / 2];
	cout << ans;
}


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


#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	//freopen("journey.in", "r", stdin);
	//freopen("journey.out", "w", stdout);


	int tst = 1;
	//cin >> tst;
	while (tst--)
		solve();


}

Measured memory_bytes: 256
#include<stdio.h>

#define NMAX 10000

int linearSearch(int A[], int n, int key){
	int i = 0;
	A[n] = key;
	while(A[i] != key){
		i++;
	}
	return i != n;
}

int main(void){
	int x,i,n,q,key,sum = 0;
	int A[NMAX+1];
	scanf("%d" ,&n);
	for(i = 0; i < n; i++){
		scanf("%d" ,&A[i]);
	}
	scanf("%d" ,&q);
	for(i = 0; i < q; i++){
		scanf("%d" ,&key);
		x = linearSearch(A,n,key);
		if(x != 0){
			sum++;
		}
	}
	printf("%d\n" ,sum);
	return 0;
}


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

void doStdOut(const char *str){ cout << str << endl; }

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if( x < r || y < r || x + r > W || y + r > H )
	{
		doStdOut("No");
	}
	else
	{
		doStdOut("Yes");
	}
	return 0;
}

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

using namespace std;

char c1[] = { '#', '.', '#', '.' };
char c2[] = { '.', '#', '#', '.' };

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> s1, s2, rs1, rs2;
    char resp[5];
    bool rev = false;
    for (int i = 0; i < n; ++i) {
        if (!rev) {
            bool ok = false;
            for (int t = 0; t < 4; ++t) {
                for (int k = 0; k < s1.size(); ++k) printf("%c", s1[k]);
                printf("%c\n", c1[t]);
                for (int k = 0; k < s2.size(); ++k) printf("%c", s2[k]);
                printf("%c\n", c2[t]);
                fflush(stdout);
                scanf("%s", resp);
                if (resp[0] == 'e') {
                    return 0;
                }
                else if (resp[0] == 'T') {
                    ok = true;
                    s1.push_back(c1[t]), s2.push_back(c2[t]);
                    break;
                }
            }
            if (!ok) rev = true;
        }
        if (rev) {
            for (int t = 0; t < 4; ++t) {
                printf("%c", c1[t]);
                for (int k = rs1.size()-1; k >= 0; --k) printf("%c", rs1[k]);
                for (int k = 0; k < s1.size(); ++k) printf("%c", s1[k]);
                puts("");
                printf("%c", c2[t]);
                for (int k = rs2.size()-1; k >= 0; --k) printf("%c", rs2[k]);
                for (int k = 0; k < s2.size(); ++k) printf("%c", s2[k]);
                puts("");
                fflush(stdout);
                scanf("%s", resp);
                if (resp[0] == 'e') {
                    return 0;
                }
                else if (resp[0] == 'T') {
                    rs1.push_back(c1[t]), rs2.push_back(c2[t]);
                    break;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

const int N=1e6+10;
ll a[N];
int sum[11];
main(){
    ios
    int h,w,n;scanf("%d%d%d",&h,&w,&n);
    h-=2,w-=2;
    int x;int y;
    int cnt=0;
    ll m=(ll)h*w;
    rep(iii,n){
        scanf("%d%d",&x,&y);
        rep(i,3)if( x-i>=1 && x-i<=h){
            rep(j,3)if(y-j>=1 && y-j<=w){
            a[cnt++]=((ll)(x-i)<<32)+(y-j);
            }
        }
    }
    sort(a,a+cnt);
    ll t=1;
    rep(i,cnt){
        if(a[i]==a[i+1])t++;
        else sum[t]++,t=1,m--;
    }
    cout<<m<<" ";
    rep2(i,1,9)cout<<sum[i]<<" ";
}



Measured memory_bytes: 7296
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int d = scan.nextInt();
		int t = scan.nextInt();
		int s = scan.nextInt();
		
		if(d <= t*s) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


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

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++) cin >> P[i];

    vector<int> positions(N);
    for (int i = 0; i < N; i++) positions[P[i] - 1] = i;

    int maxLen = 0;
    int left = 0, right = 0;
    while (right < N) {
        while (right < N - 1 && positions[right] < positions[right + 1]) {
            right++;
        }
        maxLen = max(maxLen, right - left + 1);
        left = ++right;
    }

    cout << N - maxLen << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  cout << ((a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) ? "Possible"
                                                          : "Impossible")
       << endl;
  return 0;
}


Measured memory_bytes: 256
use proconio::input;
fn main() {
    input!{
        mut s: String,
        t: String
    }
    if let Some((l, _)) = s[..s.len()-t.len()+1]
        .chars().enumerate()
        .filter(|&(i, _)| t.chars()
            .zip(s[i..i+t.len()].chars())
            .filter(|&(y, z)| z=='?' || y == z )
            .count() == t.len())
        .last()
    {   
        println!("{}{}{}", 
        s[..l].chars().map(|x|if x =='?' {'a'} else{x}).collect::<String>(),
        t,
        s[l+t.len()..].chars().map(|x|if x =='?' {'a'} else{x}).collect::<String>());
    }
    else{
        println!("UNRESTORABLE");
    }
    
}





Measured memory_bytes: 2192
def pow_n(n,k): #kをnで何科いわれるか
    pow_n = 0
    while k //n != 0:
        pow_n += 1
        k = k//n
    return(pow_n)

n = int(input())
dp= [0]*(n+1)
dp[0] = 0
#print(pow_n(6,39),pow_n(9,33))
for i in range(1,n+1):
    pow_6 = pow_n(6,i)
    pow_9 = pow_n(9,i)
    dp[i] = dp[i-1]+1
    for j in range(1,pow_6+1):
        dp[i] = min(dp[i],dp[i-6**j]+1)
    for j in range(1,pow_9+1):
        dp[i] = min(dp[i],dp[i-9**j]+1)
#print(dp[21],dp[15],dp[12])
print(dp[n])

Measured memory_bytes: 43500
// In The Name Of Allah //
#include <bits/stdc++.h>
#define pb emplace_back
#define inf (int)1e9
#define ff first
#define ss second
#define ll long long
#define sp(n) cout << setprecision(n) << fixed
#define hellcat ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define give(x) cout << #x << " " << x << endl
#define debug cout << "dddd" << '\n'
#define debarr(a, n) for (int i = 0; i < n; ++i) cout << a[i] << ' '; cout << endl
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

template <class S, class T>
inline S smax(S &l, T r) {
  return l = max(l, (S)r);
}
template <class S, class T>
inline bool smin(S &l, T r) {
  return l = min(l, (S)r);
}

const int MAXN = 1e5 + 10;
int h[MAXN];
ll dp[MAXN];

int32_t main () {
	hellcat;

	int n;
	cin >> n;

	for (int i = 0; i < n; ++i) cin >> h[i];

	for (int i = 1; i < n; ++i)
		dp[i] = ((i == 1) ? (abs(h[1] - h[0])) : (min((dp[i - 1] + abs(h[i] - h[i - 1])), (dp[i - 2] + abs(h[i] - h[i - 2])))));

	cout << dp[n - 1] << '\n';

	return 0;
}


Measured memory_bytes: 1408
N,M = map(int,input().split())
a = [True]*(N+1)
for _ in range(M):
  b = int(input())
  a[b] = False

mod = 10**9+7
dp = [0]*(N+1)
dp[0] = 1
for i in range(N):
  for j in range(i+1,min(i+2,N)+1):
    if a[j]:
      dp[j] += dp[i]
      dp[j] %= mod


print(dp[-1])

Measured memory_bytes: 7700
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
#include <string>
#include <cstdio>
#define ll long long
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef pair<int,int> pii;
const ll mod = 1000000007 ;
const int INF=0x3f3f3f3f;
#define test(n) cout<<"Test "<<n<<endl;
#define pb push_back
#define rp(n) for(int i=1;i<=n;i++)
#define rep(n,m) for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
ll ksm(ll x,ll n){ll ans=1;while (n){if (n&1)ans=(ans*x)%mod;x=x*x%mod;n>>=1;}return ans;}
using namespace std;
double pi = atan(1.0)*4 ;
const int mxn = 1e3+7 ;
int n,t,m,k,l,r;
/// ll mat[mxn][mxn], prime[mxn], isprime[mxn];
ll phi[mxn];
string str;char ch[27][27] ;
int a[mxn][mxn];
ll exgcd(ll a,ll b, ll &x ,ll &y)
{
    if(!a&&!b) return -1;/// 无最大公约数
    if(!b) {x=1,y=0;return a;}
    ll d=exgcd(b,a%b,y,x);
    y-=a/b*x ;
    return d;
}
int vis[mxn][mxn];
int main()
{

    rep(3,3) vis[i][j] = 0 ;
    map<int,pair<int,int> >mp;
    rep(3,3) {cin>>a[i][j];mp[ a[i][j] ] = {i,j} ;}
    cin>>n;
    rp(n){ cin>>k;pair<int,int>tmp = mp[k];

    if(mp.find(k)!=mp.end() && tmp.first<=3 && tmp.second<=3 && tmp.first>0 && tmp.second>0)
        vis[ tmp.first ][ tmp.second ] = 1 ;
    }
    int f1 = 0 ;
    for(int i=1;i<=3;i++)
    {
        int ans = 0 ;
        for(int j=1;j<=3;j++)
            if(vis[i][j]==1)
                ans++;
        if(ans==3) {cout<<"Yes"<<endl;f1=1;break;}
    }
    if(!f1)
    {
        if(vis[1][1]&&vis[2][2]&&vis[3][3] || vis[1][3]&&vis[2][2]&&vis[3][1])
            {cout<<"Yes"<<endl;f1=1;}
    }
    if(!f1)
    {
        for(int i=1;i<=3;i++)
        {
            int ans = 0 ;
            for(int j=1;j<=3;j++)
                if(vis[j][i]==1)
                    ans++;
            if(ans==3) {cout<<"Yes"<<endl;f1=1;break;}
        }
    }
    if(!f1) cout<<"No"<<endl;
}



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

signed main(void)
{
	int n, m; 
	vector<int> v[100001];
	int p[100000], y[100000];

	cin >> n >> m;
	rep(i, m)
	{
		cin >> p[i] >> y[i];
		p[i]--;
		v[p[i]].push_back(y[i]);
	}
	rep(i, n) sort(v[i].begin(), v[i].end());
	rep(i, m)
	{
		printf("%06d%06d\n",p[i]+1, lower_bound(v[p[i]].begin(), v[p[i]].end(), y[i]) - v[p[i]].begin() + 1);
	}
	cout << endl;
	return 0;
}


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

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

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

const long long INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    vector<long long> h(N);
    for(int i = 0; i < N; ++i) cin >> h[i];

    vector<long long> dp(100010);
    for(int i = 0; i < dp.size(); ++i) dp[i] = INF; // すべてのdpテーブルにINFを代入する

    dp[0] = 0; // 初期条件
    for(int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if(i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;

namespace chrono = std::chrono;
using namespace std::literals;

[[gnu::constructor]]
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

int main() {
  int n; cin >> n;
  std::vector<long long> a(n);
  for (auto& x: a) cin >> x;
  a.insert(a.begin(), 0);
  n += 1;
  std::unordered_map<long long, int> partial;
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    s += a[i];
    partial[s] += 1;
  }
  s = 0;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    s += a[i];
    partial[s] -= 1;
    ans += partial[s];
  }
  cout << ans << endl;
}


Measured memory_bytes: 11364
N = int(input())
cards = list(map(int, input().split()))
alice = []
bob = []
for i in range(N):
    max_card = cards.pop(cards.index(max(cards)))
    if i % 2 == 0:
        alice.append(max_card)
    else:
        bob.append(max_card)
print(sum(alice) - sum(bob))

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


int main() {
	int n;
	scanf("%d", &n);
	int a[n];
	for (int i = 0; i < n; i++) scanf("%d", a + i);
	
	int sum = 0;
	for (int i = 1; i < n; i++) sum += a[i];
	int res = 0;
	for (int i = 0; i + 1 < n; i++) {
		res += a[i] * sum;
		sum -= a[i + 1];
	}
	std::cout << res << std::endl;
	return 0;
}


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

int main()
{
    int n, d = 100000;
    cin >> n;
    for(; n-- ;)
    {
       if((d + d*5/100)%1000 == 0) d = d + d*5/100;
       else
       {
            d = d + d*5/100 + (1000-(d + d*5/100)%1000);
       }
    }
    cout << d << endl;;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  ll sum = 0;
  REP(i,10){
    ll x;
    cin>>x;
    sum += x;
  }
  cout<<sum<<endl;
  return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

//const ll INF=(ll)1e18;
const int INF=(1<<30);


int main(){
  int N;
  cin >> N;
  bool flag=true;

  int ans=0;
  int q = INF;
  REP(i,N){
    int s;
    cin >> s;
    ans += s;
    if(s%10!=0){
      q=min(q,s);
    }
  }

  if(ans%10!=0){
    cout << ans << endl;
  }else if(q==INF){
    cout << 0 << endl;
  }else{
    cout << ans - q << endl;
  }



}



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

int main() {
	int l;
	while (cin >> l, l) {
		int a[12][2];
		for (int i = 0;i < 12;i++) {cin >> a[i][0] >> a[i][1];}
		int c = 0;
		int m = 0;
		int flg = 1;

		for (int i = 0;i < 12;i++) {
			c += a[i][0] - a[i][1];
			m++;
			if (c >= l) {
				flg = 0;
				break;
			}
		}

		if (flg == 1)cout << "NA" << endl;
		else cout << m << endl;
	}
	return 0;
}

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

namespace OJcsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int []a=new int[5];
            a[0] = int.Parse(str[0]); 
            a[1] = int.Parse(str[1]); 
            a[2] = int.Parse(str[2]); 
            a[3] = int.Parse(str[3]);
            a[4] = int.Parse(str[4]);
            Array.Sort(a);
            Array.Reverse(a);
            Console.WriteLine(a[0] + " " + a[1] + " " + a[2] + " " + a[3] + " " + a[4]);
        }
    }
}

Measured memory_bytes: 11904
import java.math.BigInteger;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		BigInteger a = sc.nextBigInteger();
      	BigInteger b = sc.nextBigInteger();
      	if(a.compareTo(b)> 0){
          System.out.println("GREATER");
        }if(a.compareTo(b)< 0){
          System.out.println("LESS");
        }if(a.compareTo(b)== 0){
          System.out.println("EQUAL");
        }
     }
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};



int main(){
  
  int h,w;
  cin >> h >> w;
  vector<string> v(h);
  REP(i,h)cin >> v[i];
  int black = 0;
  REP(i,h)REP(j,w)if(v[i][j] == '#')black++;
  queue<P> que;
  int dist[h][w];
  que.push(make_pair(0,0));
  FILL(dist,h,-1);
  dist[0][0] = 0;
  while(!que.empty()){
    P ov = que.front();que.pop();
    for(int i = 0;i < 4;i++){
      P nv = make_pair(ov.first+dy[i],ov.second+dx[i]);
      if(nv.first < 0 || nv.first >= h || nv.second < 0 || nv.second >= w)continue;
      if(v[nv.first][nv.second] == '#')continue;
      if(dist[nv.first][nv.second] != -1)continue;
      dist[nv.first][nv.second] = dist[ov.first][ov.second]+1;
      que.push(nv);
    }
  }
  if(dist[h-1][w-1] != -1)cout << h*w - black - dist[h-1][w-1] -1 << endl;
  else cout << -1 << endl;
  


  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import numpy as np
A = [int(x) for x in input().split()]
A1 = np.array(sorted(A))
A2 = np.array(sorted(A, reverse=True))
A1 = abs(np.diff(A1)).sum()
A2 = abs(np.diff(A2)).sum()
print(min(A1, A2))

Measured memory_bytes: 21336
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N){
  long long ans;
  if (N % 2 == 0) {
    ans = (N-1)*(N/2);
  } else {
    ans = (N-1)/2*N;
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char s[100];
    char p[100];
    char ss[200];
     
    scanf("%s", s);
    scanf("%s", p);
    strcpy(ss, s);
     
    strcat(ss, s);
     
    if(strstr(ss, p) == NULL){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
     
    return 0;
     
}


Measured memory_bytes: 2112
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrep1(i,n) for(int i=n;i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end())
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


vii G(10000);
vl dp1(10000), dp2(10000);
vector<pll> rect(10000);
vl h(110);
int cnt = 0;
int n;
set<ll> st;

ll mod_pow(ll x, ll p, ll M = MOD) {
	ll a = 1;
	while (p) {
		if (p % 2)
			a = a * x%M;
		x = x * x%M;
		p /= 2;
	}
	return a;
}


void dfs(ll now_h, int left, int right, int parent) {
	if (left == right) {
		return;
	}
	int idx = cnt++;
	if (parent != -1) {
		G[parent].push_back(idx);
	}
	ll nex_h = *st.lower_bound(now_h + 1);
	rect[idx] = pll(nex_h - now_h, right - left);
	REP (i, left, right) {
		if (h[i] == nex_h) {
			dfs(nex_h, left, i, idx);
			left = i + 1;
		}
	}
	dfs(nex_h, left, right, idx);
}

void dp(int now) {
	ll res1 = 1, res2 = 1;
	ll x = rect[now].first, w = rect[now].second;
	rep(i, G[now].size()) {
		dp(G[now][i]);
		res1 = res1 * dp1[G[now][i]] % MOD;
		res2 = res2 * ((dp1[G[now][i]] + dp2[G[now][i]]) % MOD) % MOD;
		w -= rect[G[now][i]].second;
	}
	dp1[now] = res1 * mod_pow(2, x) % MOD;
	dp2[now] = (mod_pow(2, w) * res2 % MOD + (mod_pow(2, x) - 2) % MOD * res1 % MOD) % MOD;
}

int main() {
	cin >> n;
	rep(i, n) {
		cin >> h[i];
		st.insert(h[i]);
	}
	dfs(0, 0, n, -1);
	dp(0);
	cout << dp2[0] << endl;
}

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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        ans += a-1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
int n;
double x[50],y[50];
main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>x[i]>>y[i];
	if(n%2)cout<<"NA"<<endl;
	else
	{
		n=n/2;bool f=1;
		for(int i=0;i<n;i++)
		{
			f&=x[i+1]-x[i]==x[n+i]-x[(n+i+1)%(n*2)];
			f&=y[i+1]-y[i]==y[n+i]-y[(n+i+1)%(n*2)];
		}
		if(f)
		{
			cout<<setprecision(9)<<(x[0]+x[n])/2.<<" "<<(y[0]+y[n])/2.<<endl;
		}
		else cout<<"NA"<<endl;
	}
}



Measured memory_bytes: 3272
n=1<<18;N,m;L[1<<18],p;first[1<<18],next[1<<18];i;
long dat[1<<20],lazy[1<<20],A[1<<18],x;
long update(a,b,k,l,r){
	return a<=l&r<=b?dat[k]+(lazy[k]+=x):l<b&a<r?(dat[k]=fmax(
		update(a,b,2*k+1,l,(l+r)/2),
		update(a,b,2*k+2,(l+r)/2,r)
	))+lazy[k]:dat[k]+lazy[k];
}
long query(a,b,k,l,r){
	return a<=l&r<=b?dat[k]+lazy[k]:l<b&a<r?fmax(
		query(a,b,2*k+1,l,(l+r)/2),
		query(a,b,2*k+2,(l+r)/2,r)
	)+lazy[k]:dat[k]+lazy[k];
}
main(j){
	for(scanf("%d%d",&N,&m);~scanf("%d%d%ld",L+j,&p,A+j);first[p]=j++)next[j]=first[p];
	for(;i++<N;){
		x=query(0,i,0,0,n);
		update(i,i+1,0,0,n);
		for(p=first[i];p!=0;p=next[p])x=A[p],update(L[p],i+1,0,0,n);
	}
	printf("%ld",query(0,N+1,0,0,n));
}

/*
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
*/


Measured memory_bytes: 12800
#include<iostream>
#include<string>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==7&&b==5&&c==5){
    cout<<"YES"<<endl;
  }
  else if(b==7&&a==5&&c==5){
    cout<<"YES"<<endl;
  }
  else if(c==7&&b==5&&a==5){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>

using std::cout;
using std::endl;
using std::cin;
using std::string;

int main() {
	double x1, y1, x2, y2;
	double dist;
	cin >> x1 >> y1 >> x2 >> y2;

	dist = sqrt(std::pow((x2 - x1), 2.0) + std::pow((y2 - y1), 2.0));

	cout << std::fixed << std::setprecision(10) << dist << endl;
	return 0;
}

Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
#define P 1000000007 
long mypow(long x,long y){
  if(y==0)return 1;
  if(y%2)return mypow(x,y-1)*x%P;
  long z=mypow(x,y/2);
  return z*z%P;
}
int main(){
  long N;cin>>N;
  cout<<(mypow(10,N)-mypow(9,N)*2+mypow(8,N)+P*2)%P;
}

/*



*/

Measured memory_bytes: 3620
#include<stdio.h>
int main(){
  double n;
  while(scanf("%lf",&n)!=EOF){
    if(n>91.00){
      printf("heavy\n");
    }
    else if(n>81.00){
	printf("light heavy\n");
      }
    else if(n>75.00){
	printf("middle\n");
      }
    else if(n>69.00){
	printf("light middle\n");
      }
    else if(n>64.00){
	printf("welter\n");
      }
    else if(n>60.00){
	printf("light welter\n");
      }
    else if(n>57.00){
	printf("light\n");
      }
    else if(n>54.00){
	printf("feather\n");
      }
    else if(n>51.00){
	printf("bantam\n");
      }
    else if(n>48.00){
	printf("fly\n");
      }
    else{
	printf("light fly\n");
      }
  }
  return(0);
}

Measured memory_bytes: 608
N,L = map(int,input().split())

eat_apple = 0

if - L >= N:
    eat_apple = N
elif L < 0:
    eat_apple = - L + 1
else:
    eat_apple = 1

total = 0
for i in range(1,N+1):
    total += L  + i  - 1

print(total - (L + eat_apple - 1))


Measured memory_bytes: 2940
def manage(m, n)
  arr = Array.new(m).map { Array.new(n, 0) }
  arr
end

arr = [manage(3, 10), manage(3, 10), manage(3, 10), manage(3, 10)]

gets.chomp.to_i.times do
  num = gets.chomp.split(' ').map { |e| e.to_i - 1 }
  arr[num[0]][num[1]][num[2]] += num[3] + 1
end

sum = 0
arr.each do |i|
  i.each do |j|
    puts "\s" + j.join(' ')
  end
  sum += 1
  puts '#' * 20 if sum < arr.size
end

Measured memory_bytes: 6112
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc;
	static PrintWriter out;
	public static void main(String[] args){
		sc = new FastScanner();
		out = new PrintWriter(System.out);
		out.println(solve());
		out.flush();
	}

	static String solve(){
		int N = sc.nextInt();
		int T = sc.nextInt();
		int minCost = Integer.MAX_VALUE;
		int tmpCost;
		for(int i=0;i<N;i++){
			tmpCost = sc.nextInt();
			if(sc.nextInt()<=T && minCost > tmpCost){
				minCost = tmpCost;
			}
		}
		return (minCost == Integer.MAX_VALUE)? "TLE":String.valueOf(minCost);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		}else{
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){
				return minus ? -n : n;
			}else{
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() { return Double.parseDouble(next());}
}

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

int main()
{
    int i, j, n, count=0;
    cin >> n;
    vector <int> v1, v2;
    for(i=0; i<n; i+=1)
    {
        string s;
        cin >> s;
        int l=s.length();
        if(s[0]=='B')
            v1.push_back(i);
        if(s[l-1]=='A')
            v2.push_back(i);
        for(j=0; j<l-1; j+=1)
        {
            if(s[j]=='A' && s[j+1]=='B')
                count+=1;
        }
    }
    int x=v1.size(), y=v2.size(), flag=0;
    if(x!=y)
        count+=min(x,y);
    else
    {
        sort(v1.begin(),v1.end());
        sort(v2.begin(),v2.end());
        for(i=0; i<x; i+=1)
        {
            if(v1[i]!=v2[i])
            {
                flag=1;
                break;
            }
        }
        if(flag==0&&v1.size()>0)
            count+=x-1;
        else
            count+=x;
    }
    cout << count << endl;
}

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

int main() {

    int N, L;
    cin >> N >> L;

    if (N + L - 1 < 0) {
        cout <<  (L + N + L - 2) * (N - 1) / 2 << endl;
    }
    else if (L > 0) {
        cout <<  (L + 1 + N + L - 1) * (N - 1) / 2 << endl;
    }
    else {
        cout << (L + N + L - 1) * N / 2 << endl;
    }

    return 0;
}


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

int main(){
    ll x;
    cin >> x;
    ll ans = 0, cnt = 0;
    while (ans < x){
        cnt ++;
        ans += cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    vector<ll> a(n),b(n);
    rep(i,n){
      cin >> a[i];
    }
    map<ll,ll> mp;
    ll ans=0;
    rep(i,n){
      ans+=mp[i-a[i]];
      mp[a[i]+i]++;
    }
    cout << ans << endl;
}


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

using namespace std;

bool c(const pair<int, int> &a, const pair<int, int> &b) {
	return (a.second > b.second);
}
int main() {
	int n, h;
	int a, b;
	int cmp = numeric_limits<int>::min();
	cin >> n >> h;
	int cnt = 0;
	vector<pair<int, int>> data(n);
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		cmp = max(cmp, a);
		data[i] = make_pair(a, b);
	}
	sort(data.begin(), data.end(), c);
	for (int i = 0; i < n; i++) {
		if (data[i].second >= cmp) {
			h -= data[i].second;
			cnt++;
			if (h <= 0) break;
		}
	}
	if (h > 0) {
		cnt += h / cmp;
		if (h%cmp != 0) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1024
n, k = map(int, input().split())


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7  # 出力の制限
N = 2*10**5+1
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


ans = 0
for i in range(min(k+1, n)):
    ans += cmb(n, i, mod)*cmb(n-1, n-i-1, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 116804
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
typedef long long ll;
ll a[100001];
int main() {
	int n;
	bool is0 = false;
	    boost::multiprecision::cpp_int ans = 1;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		if (a[i] == 0) {
			is0 = true;
			printf("0\n");
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		ans *= a[i];
		if (ans > 1000000000000000000) {
			ans = -1;
			break;
		}
	}
	std::cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 4532
K, N = map(int, input().split())
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
for i in range(N-1):
    B[i] = A[i+1]-A[i]
B[N-1] = A[0]-A[N-1]+K
print(K-max(B))

Measured memory_bytes: 25928