akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=998244353;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res%mod;}
long modInverse(long a) {return powmod(a, mod-2);}



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

    ll n;
    cin>>n;
    ll res=(n/500)*1000;
    n=(n%500);
    res+=((n/5)*5);
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {	
	Scanner in = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		//		while(in.hasNext())
		new AOJ0173();
	}

	class AOJ0173{
		public AOJ0173() {
			Kurasu[] kurasu = new Kurasu[9];
			for(int i=0;i<9;i++)kurasu[i] = new Kurasu(in.next(), in.nextInt(), in.nextInt());
//			Arrays.sort(kurasu);
			for(int i=0;i<9;i++)System.out.println(kurasu[i].name+" "+(kurasu[i].am+kurasu[i].pm)+" "+kurasu[i].kei);
		}
		class Kurasu /*implements Comparable<Kurasu>*/{
			int am,pm;
			int kei;
			String name;
			public Kurasu(String name,int am,int pm) {
				this.am = am;
				this.pm = pm;
				this.name = name;
				kei = am*200+pm*300;
			}
//			public int compareTo(Kurasu o) {
//				if(this.kei>o.kei)return -1;
//				else if(this.kei<o.kei)return 1;
//				return 0;
//			}
		}
	}
}

Measured memory_bytes: 17196
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;

    if(A1+A2+A3 >= 22) {
        cout <<"bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;

}

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

int main() {
	string str,ch;
	cin>>str;
	cin>>ch;
	int w=str.size();
	int cnt=0;
	for (int i=0;i<w;i++){
		if (str[i]!=ch[i]){
			cnt++;
		}
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 3912
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a>b){
        cout << "a > b" << endl;
    }
    else if(a<b){
        cout << "a < b" << endl;
    }
    else cout << "a == b" << endl;
    return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <algorithm>
 
using namespace std;
int main(){
  string strIn,strOut;
  cin>>strIn;
  strOut="Yes";
  char c;
  int num=0;
  
  if(strIn.size()%2!=0){
    strOut="No";
  }else{
    sort(strIn.begin(),strIn.end());
  	for(auto itr = strIn.begin(); itr != strIn.end(); ++itr) {
 		if(c!=*itr){
      		c=*itr;
    		if(num%2==0){
	        	num=0;
        	}
        	else{
          		strOut="No";
          		break;
        	}
    	}
    	num++;
  	}
  }
  cout<<strOut<<endl;
  return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!{
        n: i32,
        p: [i32;n],
    };

    let mut max = i32::min_value();
    let mut sum = 0;
    for &price in p.iter() {
        sum += price;
        if price > max {
            max = price;
        }
    }
    println!("{}", sum - max / 2);
}


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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int X = accumulate(A.begin(), A.end(), 0);
  cout << ((X >= H) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 640
N,M,K = map(int,input().split())

MOD =  998244353
mod = MOD
MAX = N+1
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
def cominit():
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2,MAX):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
def cmb(n,r):
    if n < 0 or r < 0 or r > n:return 0
    if r > n/2: r = n-r        
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod
    
cominit()

ans = 0
for k in range(K+1):
    ans += cmb(N-1,k)*pow(M-1,N-k-1,MOD)*M
    ans %= MOD
print(ans)




# ans = pow(M,N,MOD)
# minus = 0
# for k  in range(K+1,N):
#     minus += M * pow(M-1,N-k-1,MOD) * cmb(N-1,k)
#     minus %= MOD

# ans -= minus 
# ans = (ans+MOD)%MOD
# print(ans)

Measured memory_bytes: 79088
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}


pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: u32 = 1_000_000_007;
const INF: i64 = std::i64::MAX/3;

fn solve() {
	let n = read!(usize);
	let a = read!([usize]);
	let mut b = a.clone();
	b.sort();
	let mut seen = vec![false;1000001];
	let mut flag = vec![false;1000001];
	for i in 0..n {
		if seen[b[i]] {
			flag[b[i]] = true;
			continue;
		}
		seen[b[i]] = true;
		let mut base = b[i];
		for j in 0..1000001 {
			base += b[i];
			if base>1000000 {
				break;
			}
			flag[base] = true;
		}
	}
	let mut ans = 0;
	for i in 0..n {
		if !flag[a[i]] {
			ans += 1;
			// print!("{} ", i+1);
		}
	}
	println!("{}",ans);
}

fn run() {
    solve();
}


Measured memory_bytes: 6604
require 'pp'
x1, y1, x2, y2 = gets.split.map(&:to_i)

#   3-2
#  /
# 4-1
if x1 <= x2 && y1 <= y2
  x3 = x2 - (y2 - y1)
  y3 = y2 + (x2 - x1)
  x4 = x1 - (y2 - y1)
  y4 = y1 + (x2 - x1)
end

#   4-3
#  /
# 1-2
if x1 <= x2 && y2 <= y1
  x3 = x2 + (y1 - y2)
  y3 = y2 + (x2 - x1)
  x4 = x1 + (y1 - y2)
  y4 = y1 + (x2 - x1)
end

#   1-4
#  /
# 2-3
if x2 <= x1 && y2 <= y1
  x3 = x2 + (y1 - y2)
  y3 = y2 - (x1 - x2)
  x4 = x1 + (y1 - y2)
  y4 = y1 - (x1 - x2)
end

#   2-1
#  /
# 3-4
if x2 <= x1 && y1 <= y2
  x3 = x2 - (y2 - y1)
  y3 = y2 - (x1 - x2)
  x4 = x1 - (y2 - y1)
  y4 = y1 - (x1 - x2)
end


puts [x3,y3,x4,y4].join(' ')


Measured memory_bytes: 2300
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            double ans = 0;
            for (int i= 0; i < N; i++)
            {
                ans += (double)1 / (double)A[i];
            }
            ans = 1 / ans;

            //出力
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}


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

int main() {
  // ここにプログラムを追記
  int N;
  cin >> N;
  if(N%1000 == 0){
    cout << 0 << endl;
  }else{
    cout << 1000-N%1000 << endl;
  }
}

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

int main(){
  int N, L;
  cin >> N >> L ;
  int LL = N+L-1;
  int ans = ((L+LL) * N) / 2;
  if(L <= 0 && 0 <= LL) cout << ans << endl;
  else if(L< 0 && LL < 0) cout << ans-LL << endl;
  else if(0<L && 0< LL) cout << ans-L << endl;
  return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) {
		cout << "Alice" << endl;
		return 0;
	}
	else {
		cout << "Borys" << endl;
		return 0;
	}
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	cout << 180 * (n - 2) << endl;
}

Measured memory_bytes: 256
def resolve():
    import heapq
    _,M = map(int,input().split())
    A = list(map(lambda x:(-1)*int(x),input().split()))
    heapq.heapify(A)
    for _ in range(M):
        heapq.heapreplace(A,(A[0]*(-1) // 2)*(-1))
    print((-1) * sum(A))    
resolve()

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

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

//===




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

	int n, m, d;
	cin >> n >> m >> d;

	double ans;

	if (d == 0) {
		ans = (double)(m - 1) / n;
	}
	else {
		ans = (double)2 * (n - d) * (m - 1) / ((double)n * n);
	}

	cout << setprecision(15) << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type task struct {
	a int
	b int
}

type tasks []task

func (t tasks) Len() int {
	return len(t)
}

func (t tasks) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}

func (t tasks) Less(i, j int) bool {
	switch {
	case t[i].b != t[j].b:
		return t[i].b < t[j].b
	default:
		return t[i].a < t[j].a
	}
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	var tasks tasks = make([]task, n)
	for i := 0; i < n; i++ {
		tasks[i].a, tasks[i].b = nextInt(), nextInt()
	}
	sort.Sort(tasks)

	time := 0
	for i := 0; i < n; i++ {
		time += tasks[i].a
		if time > tasks[i].b {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 6272
//FA専用
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long LINF=1e18;
using ld=long double;
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  string s;cin>>s;
  if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}


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

int main(){
    int R;
    cin >> R;
    if(R<1200){
        cout << "ABC" << endl;
    }
    else if(R<2800){
        cout << "ARC" << endl;
    }
    else{
        cout << "AGC" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N;
	cin >> N;
	double ret = 0;
	for(int i = 1;i < N + 1;i++) {
		for(int j = 2;j < 11;j++) {
			if(pow(i,j) <= N) {
				ret = max(ret,pow(i,j));
			}
		}
	}
	cout << ret << endl;
}


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

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

using std::string;
using std::pair;

using std::vector;
using std::sort;
using std::lower_bound;
using std::upper_bound;
using std::find_if;
using std::copy;
using std::copy_if;

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

    while(n>0){
        if(n%10==9){
            cout << "Yes" << endl;
            return 0;
        }
        n/=10;
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V  = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class H> void rsz(V<T> &v, H h) { v.resize(h); }
template<class T, class H, class... R> void rsz(V<T> &v, H h, R... r) { v.resize(h); for (auto&& i : v) rsz(i, r...); }
using P = pair<int, int>;

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> a(1 << n); for (int i = 0; i < 1 << n; i++) cin >> a[i];
  int res = 0;
  for (int k = 1; k < 1 << n; k++) {
    int ma = 0, ma2 = 0;
    for (int i = k;; i = i - 1 & k) {
      if (a[i] >= ma) ma2 = ma, ma = a[i];
      else if (a[i] >= ma2) ma2 = a[i];
      if (!i) break;
    }
    cout << (res = max(res, ma + ma2)) << '\n';
  }
}

Measured memory_bytes: 4224
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

//変数
ll N, X, ans=0;
vector<ll> level(55);
vector<ll> dan(55);
bool is_end = false;

//解法
void solve() {

	rep(i, 55) {
		if (i == 0) {
			level[i] = 1;
			dan[i] = 1;
		}
		else {
			level[i] = level[i - 1] * 2 + 1;
			dan[i] = dan[i - 1] * 2 + 3;
		}
	}

	ll L = N;
	while (1) {
		if (L == 0) {
			if (X == 1) ans++;
			break;
		}

		if (X == 0) {
			break;
		}
		else if (X <= dan[L - 1]) {
			X--;
			L--;
			continue;
		}
		else if (X == dan[L - 1] + 1) {
			ans += level[L - 1];
			break;
		}
		else if (X == dan[L - 1] + 2) {
			ans += level[L - 1] + 1;
			break;
		}
		else if (X<dan[L-1]*2+2) {
			ans += level[L - 1] + 1;
			X -= dan[L - 1] + 2;
			L--;
			continue;
		}
		else {
			ans += level[L - 1] * 2+1;
			break;
		}

	}

	cout << ans;


	return;
}

int main() {
	//入力

	cin >> N >> X;

	solve();
	cout << endl;
	return 0;
}

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

public class Main {

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

    private Scanner scan = new Scanner(System.in);
    private int N;
    private int[][] A;

    public Main() {
	N = Integer.parseInt(scan.next());
	A = new int[N][N];
	for (int i = 0; i < N; i++) {
	    for (int j = 0; j < N; j++) {
		int a = Integer.parseInt(scan.next());
		A[i][j] = a;
	    }
	}
	scan.close();
    }

    public final void answer() {

	int[][] dest = new int[N][];
	for (int i = 0; i < N; i++) {
	    dest[i] = Arrays.copyOf(A[i], N);
	}

	for (int k = 0; k < N; k++) {
	    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
		    dest[i][j] = Integer.min(dest[i][j], dest[i][k] + dest[k][j]);
		}
	    }
	}

	for (int i = 0; i < N; i++) {
	    for (int j = 0; j < N; j++) {
		if(dest[i][j] != A[i][j]) {
		    System.out.println(-1);
		    return;
		}
	    }
	}

	long result = 0;
	for (int i = 0; i < N; i++) {
	    for (int j = i+1; j < N; j++) {
		boolean flag = true;
		for (int k = 0; k < N; k++) {
		    if(i == k || j == k) continue;
		    if(dest[i][j] == A[i][k] + A[k][j]) {
			flag = false;
			break;
		    }
		}
		if(flag) result = result + dest[i][j];
	    }
	}
	System.out.println(result);
    }
}


Measured memory_bytes: 48836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  unsigned long long s,c;
  cin>>s>>c;
  unsigned long long ans=0;

  if(c<=2*s){
    ans=c/2;
  }else{
    ans=s+(c-2*s)/4;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <functional>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
int main(){
    int sx,sy,tx,ty;

    cin >> sx >> sy >> tx >> ty;
    string ans = "";

    for(int i = 0;i < tx-sx;i++)ans += 'R';
    for(int i = 0;i < ty-sy;i++)ans += 'U';
    for(int i = 0;i < tx-sx;i++)ans += 'L';
    for(int i = 0;i < ty-sy;i++)ans += 'D';
    ans += 'D';
    for(int i = 0;i < tx-sx+1;i++)ans += 'R';
    for(int i = 0;i < ty-sy+1;i++)ans += 'U';
    ans += 'L';
    ans += 'U';
    for(int i = 0;i < tx-sx+1;i++)ans += 'L';
    for(int i = 0;i < ty-sy+1;i++)ans += 'D';
    ans += 'R';

    cout << ans << endl;
}


Measured memory_bytes: 256
/*_BELIEVE_*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     __gcd((a),(b))
#define     lcm(a,b)     ((a)*(b))/gcd((a),(b))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(c-(a-b),0ll);
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

ans = 0
for i in range(n):
    x = s[0:i]
    y = s[i:n]
    temp = 0
    for ch in range(ord('a'), ord('z')+1):
        ch = chr(ch)
        if ch in x and ch in y:
            temp += 1
    ans = max(ans, temp)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C,K;
    
    cin >> A >> B >> C;
    cin >> K;
    
    if ((A>=B && A>=C) ){
        for (int i = 0; i < K;i++){
            A *= 2;
        }
        
    }
     else if ((B>A && B>C)  ){
        for (int i = 0; i < K;i++){
            B *= 2;
        }
    }
     else if (C>A && C>B){
        for (int i = 0; i < K;i++){
            C *= 2;
        }
    }
    
    
    cout << A+B+C <<endl;
    
}

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

using namespace std;
int a[100005];
vector<int>v;
int ans=1e9;
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i+k-1<=n;i++)
	{
		int j=i+k-1;
		int cnt=1e9,sum=1e9;
		cnt=min(cnt,(abs(a[j])+abs(a[i]-a[j])));
		sum=min(ans,(abs(a[i])+abs(a[i]-a[j])));
		//cout<<cnt<<" ";
		ans=min(sum,cnt);
	}	
	cout<<ans<<endl;
	return 0;
}
/*
	5 3
	-30 -10 10 20 50
	3 2
	10 20 30
	1 1
	0
	8 5
	-9 -7 -4 -3 1 2 3 4
	
	Accepted
*/


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

int main(){
    string A, B, C; cin >> A >> B >> C;
    int a=0, b=0, c=0;
    char temp='a';
    while((!(temp=='a' && a==A.size())) && (!(temp=='b' && b==B.size())) && (!(temp=='c' && c==C.size()))){
    //while(1){
        if (temp=='a'){
            //if (a==A.size()) break;
            temp=A.at(a);
            a++;
        } else if (temp=='b'){
            //if (b==B.size()) break;
            temp=B.at(b);
            b++;
        } else if (temp=='c'){
            //if (c==C.size()) break;
            temp=C.at(c);
            c++;
        }
    }
    cout << (char)(temp-'a'+'A') << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
double l;
int main()
{
	cin >> l;
	double x = l / 3;
	printf("%.10lf\n", x * x * x);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b, bool usemod = true) {ll c = 1LL; while (b > 0) {if (b & 1LL) {if(!usemod)c*=a;else c = a * c%mod;}if (!usemod) a*=a;else a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}

bool solve() {
	int w,h; cin >> w >> h;
	vp V; int x;
	REP (i,w) cin >> x,V.pb({x,1});
	REP (i,h) cin >> x,V.pb({x,0});
	sort(ALL(V));
	w++, h++;
	int edg = h * w - 1;
	int ans = 0;
	for (auto X : V) {
		if (X.second == 1) ans += X.first*h,w--;
		else ans += X.first*w,h--;
	}
	cout << ans << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,c=0,i,x;
   cin>>n;
   for(i=0;i<n;i++)
   {
    cin>>x;
    if(x%2==0&&x%3!=0&&x%5!=0)
    {
      cout<<"DENIED";
      break;
    }
    else
    c=c+1;
   }
    
   if(c==n)
    cout<<"APPROVED";  
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main( ) {
    int input;
    int count = 0;
 
    while(1) {
        scanf("%d",&input);
        if( input == 0 ) {
            break;
        }
        count++;
        printf("Case %d: %d\n",count ,input);
    }
 
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    int mx = (n-1) * (n-2) / 2;
    if (k > mx) {
        cout << -1 << endl;
        return 0;
    }
    vp ans;
    int minus = 0;
    for (int i = 1; i <= n; ++i) {
        bool flag = false;
        for (int j = i+1; j <= n; ++j) {
            if (i != 1 && mx - minus == k) {
                flag = true;
                break;
            }
            ans.eb(i, j);
            if (i != 1) minus++; 
        }
        if (flag) break;
    }
    cout << sz(ans) << endl;
    rep(t, sz(ans)) {
        cout << ans[t].fi << " " << ans[t].se << endl;
    }
    return 0;
}

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

long long modpow(long long a,long long n,long long MOD){
    int ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}
long long modinv(long long a, long long MOD) {
    return modpow(a, MOD - 2, MOD);
}


int main() {
    int N,K;cin >> N >> K;
    ll fact[N + K] = {};
    fact[0] = 1;
    for (int i = 1;i < N + K;i++){
        fact[i] = fact[i - 1] * i % MOD;
    }
    for (int i = 1;i < K + 1;i++){
        ll res = 0;
        if (i == 1) res = N - K + 1;
        else{
            if ((N - K + 1 - i) < 0) res = 0;
            else{
                ll pb = fact[K - 1] % MOD * modinv(fact[i - 1],MOD) % MOD * modinv(fact[K - i],MOD) % MOD;
                ll pc = fact[N - K + 1] % MOD * modinv(fact[i],MOD) % MOD * modinv(fact[N - K + 1 - i],MOD) % MOD;
                res = pb % MOD * pc % MOD;
                if (res < 0) res += MOD;
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,b,a) for (int i = (b)-1;i >= 0;--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=(n)-1;i>=0;--i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int NUM = 100, VALUE = 100000;
ll dp[NUM + 1][VALUE + 1];

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

	int N, W;
	cin >> N >> W;
	vector<int> w(N), v(N);
	REP(i, N) cin >> w[i] >> v[i];
	fill(dp[0] + 1, dp[0] + VALUE + 1, W + 1);
	REP(i, N) {
		for (int j = VALUE;j >= 0;--j) {
			dp[i + 1][j] = dp[i][j];
			if (j - v[i] >= 0 && dp[i][j - v[i]] < W + 1) {
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			}
		}
	}
	int V = VALUE;
	while (dp[N][V] > W) --V;
	cout << V << endl;

	return 0;
}


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

  vector<string>S(N);

  int i;
  int cnt = 1;
 
  for (i = 0; i < N; i++){
    cin >> S.at(i);
  }

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

  for (i = 0; i < N-1; i++){
    //cout << S.at(i) << " " << S.at(i+1) << endl;
    if(S.at(i) != S.at(i+1)){
      cnt += 1;
    }
  }
  cout << cnt << endl;  
  
}

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

#define fti(i, x, y) for(int i = (x), _y = (y); i <= _y; ++ i)
#define ftd(i, x, y) for(int i = (x), _y = (y); i >= _y; -- i)
#define ll long long

using namespace std;

const int N = 1e5 + 2;
int n, k, h[N], res;

void inp()
{
    scanf("%d %d", &n, &k);
}

void proc()
{
    fti(i, 1, n) {
        scanf("%d", &h[i]);
        if(h[i] >= k) ++ res;
    }
    printf("%d\n", res);
}

int main()
{
    inp();
    proc();
    return 0;
}


Measured memory_bytes: 640
from sys import stdin

def main():
    A=stdin.readline()
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('W')
    indices = [i for i, x in enumerate(A) if x == 'W']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


Measured memory_bytes: 11176
#ifdef INPUT
#include <sstream>
stringstream input(R"(
2
80 70
)");
#define cin input
#endif

#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

ll inv_mod( ll a, ll m )
{
  ll b, x, u, q, abs_m, tmp; 

  abs_m = ( m < 0 ) ? -m : m;
  b = m; x = 1; u = 0; 
  while ( b > 0 ) {
    q = a / b; 
    tmp = u; u = x - q * u; x = tmp;
    tmp = b; b = a - q * b; a = tmp;
  }

  return ( x < 0 ) ? abs_m + x : x;
}

int main()
{
    const ll mod = 1000000007;
	ll n;
	cin >> n;
    --n;

    vector<ll> frac(n + 1);
    frac[0] = 1;
    REP(i, n)
        frac[i + 1] = frac[i] * (i + 1) % mod;

    vector<ll> fraci(n + 1);
    fraci[n] = inv_mod(frac[n], mod);
    for (int i = n; i > 0; --i)
        fraci[i - 1] = fraci[i] * i % mod;

    ll r = 0;
    ll c = 0;

    for (int i = (n - 1) / 2; i >= 0; --i)
    {
        ll x = (frac[n - i - 1] * (fraci[n - 1 - i * 2] % mod * fraci[i] % mod)) % mod * (frac[i] * frac[n - i] % mod) % mod;
        r += (x + mod - c) % mod * (n - i) % mod;
        r %= mod;
        c += (x + mod - c) % mod;
        c %= mod;
    }

	cout << r << endl;

	return 0;
}


Measured memory_bytes: 15872
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();
		int A[] = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		int count = N + X;
		for (int i = 0; i < N; i++) {
			count += D / A[i];
			if (D % A[i] == 0) {
				count--;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <class T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

bool isPrime(ll num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;


    for (ll i = 3; i * i <= num; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
};


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

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

template<class T>
bool is_integer(T x) {
    return std::floor(x) == x;
}

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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

    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    char prev = S[0];
    FOR(i, 1, S.length()) {
        if (prev == S[i])continue;
        ans++;
        prev = S[i];
    }

    ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define fi first
#define se second
#define int long long
//template

//main
signed main(){
  string s;cin>>s;
  int a=0,b=0;
  for(char i:s){
    if(i=='0')a++;
    else b++;
  }
  Cout(min(a,b)*2);
}


Measured memory_bytes: 512
from collections import deque

N,Q=map(int,input().split())
L=[[] for _ in range(N+1)]
for i in range(N-1):
    a,b=map(int,input().split())
    L[a].append(b)
    L[b].append(a)
count=[0]*(N+1)
for j in range(Q):
    p,x=map(int,input().split())
    count[p]+=x

#print(count)

q=deque() #queueとして(popleftとappend)
q.append(1)
parent=[-1]*(N+1)
#parent[1]=1

while q:
    now=q.popleft()
    for k in L[now]:
        if parent[now]==k:
            continue
        count[k]+=count[now]
        parent[k]=now
        q.append(k)
        #print(parent)

print(*count[1:])



Measured memory_bytes: 56152
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AGettingDifference solver = new AGettingDifference();
        solver.solve(1, in, out);
        out.close();
    }

    static class AGettingDifference {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int target = in.nextInt();
            int[] a = new int[n];
            long gcd = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                gcd = Arith.gcd(gcd, a[i]);
            }

            Arrays.sort(a);
            if (a[n - 1] >= target && target % gcd == 0) {
                out.println("POSSIBLE");
            } else {
                out.println("IMPOSSIBLE");
            }

        }

    }

    static class Arith {
        public static long gcd(long a, long b) {
            if (b == 0) return a;
            return a % b == 0 ? b : gcd(b, a % b);
        }

    }
}



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

int main(void){
    vector<int> A(3);
    for(int i=0; i<3; i++) cin >> A[i];
    sort(A.begin(), A.end());

    cout << 10*A[2]+A[0]+A[1] << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long l;
typedef unsigned long ul;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<l,l> pl;
typedef pair<int,int> pi;
typedef vector<ll> vll;
typedef vector<l> vl;
typedef vector<int> vi;

#define pb push_back
#define mp make_pair
#define eb emplace_back

#define fi first
#define se second

int main(){
	ll A, B, C, D, E, F;
	ld MAX = -1;
	pll pm;
	cin >> A >> B >> C >> D >> E >> F;
	for (ll a = 0; a <= 100; ++a){
		for (ll b = 0; b <= 100; ++b){
			for (ll c = 0; c <= 100; ++c){
				for (ll d = 0; d <= 100; ++d){
					if ((a+b) && 100*a*A+100*b*B+c*C+d*D <= F && (c*C+d*D) <= E*(a*A+b*B)){
						if (MAX * (a*A+b*B) * 100 < (c*C+d*D)){
							MAX = (ld) (c*C+d*D) / (ld) (100*a*A+100*b*B);
							pm = mp(100*a*A+100*b*B+c*C+d*D,c*C+d*D);
						}
					}
				}
			}
		}
	}
	cout << pm.fi << " " << pm.se << 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 ans = 0;
		int[] array = new int[N];
		for (int i = 0; i < N; i++) {
			array[i] = Integer.parseInt(sc.next());
			if (i == 0 || i == 1) {
				continue;
			}
			int a = array[i - 2];
			int b = array[i - 1];
			int c = array[i];
			if (a == b && b == c) {
				continue;
			}
			int diff = (a - b) * (b - c);
			if (diff >= 0) {
				ans++;
			}
		}
		sc.close();
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
count = [[0] * 10 for _ in range(10)] # dp[head][tail]
for i in range(1, N+1):
    s = str(i)
    head = int(s[0]); tail = int(s[-1])
    count[head][tail] += 1

answer = 0
for h in range(10):
    for t in range(10):
        answer += count[h][t] * count[t][h]
print(answer)


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <climits>
#include <tuple>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main(void) {
  ll H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
}


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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
//RNG based on mersenne_twister 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }


int _runtimeTerror_()
{
	ll n;
	cin>>n;
	ll val2=0;
	ll ans=100;
	while(ans<n)
	{
		long double val=ans*1.01;
		ans=val;
		ans=floor(ans);
		++val2;
	}
	cout<<val2;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	cerr<<"\n"<<_time_;
	return 0;
}


Measured memory_bytes: 3688
/**
 *  author: mahfuzz
 *  created: 05.05.2020
**/
 
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << #x << ':' << x << "\n"
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    string s; cin >> s;
    int cnt = 0, mx = 0;
    
    for(int i = 0; s[i]; i++){
        if(s[i] == 'A' || s[i] == 'C'
            || s[i] == 'G' || s[i] == 'T')
                ++cnt;
        else{
            mx = max(cnt, mx);
            cnt = 0;
        }
    }
    
    cout << max(cnt, mx) << "\n";
        
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 100000000 
   
int a(void);
int b(char);
void insert(void);
int find(void);

char c[14];
int x[N];
int n;
   
int main(){
char str[7];
int i;
   
 scanf("%d", &n);
 for(i = 0; i < n; i++){
   scanf("%s%s", str, c);
   if(str[0] == 'i'){
     insert();
   }
   else if(str[0] == 'f'){
     if(find())
       printf("yes\n");
     else
       printf("no\n");
   }
 } 
 return 0;
}
  
int a(void){
  int x=0, i, p=1;
  for(i = 0; i < strlen(c); i++){
    x += p*(b(c[i]));
    p *= 5;
  }
  return x;
}
   
int b(char c){
   
  if(c == 'A'){
    return 1;
  }
  else if(c == 'C'){
    return 2;
  }
  else if(c == 'G'){
    return 3;
  }
  else return 4;
   
}
  
void insert(){
  x[a()]=1;
}
int find(){
    int key =a();
       
    if(x[key]){
   return 1;
    }
    else return 0;
} 

Measured memory_bytes: 38628
#include"bits/stdc++.h"
using namespace std;
namespace ORIGIN {
#define LL long long
#define VLL vector<long long>
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define COUT(x) cout<<x<<endl
#define WHOLE(x) x.begin(),x.end()
	double pai = 3.1415926535;
	string atc = "atcoder";
	typedef pair<long long, long long> data_t;
	string strnum = "0123456789";
	string alpS = "abcdefghijklmnopqrstuvwxyz";
	string alpL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int sizealp = (int)(alpS.size());
	int mod = 1e9 + 7;
	bool test = false;
}
using namespace ORIGIN;

void Test(char a) {
	if (test) {
		printf("%c", a);
	}
}
int gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
vector<int> nsinsuu(int base,int keta) {

}
int main() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	k--;
	if (s[k] == 'A')s[k] = 'a';
	else if (s[k] == 'B')s[k] = 'b';
	else s[k] = 'c';
	cout << s << endl;
}

Measured memory_bytes: 256
import math
n = int(input())
a = list(map(int,input().split()))

ans = 1
a.sort()
for i in range(n):
    ans = ans * a[i]
    if ans == 0:
        ans = 0
        break
    if ans > pow(10,18):
        ans = -1
        break

print(ans)

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

#define pi 3.141592654
#define fix(n) cout << fixed << setprecision(n)

#define rep(i,a,b) for(int i=a;i<b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)

#define ll  long long
#define ull unsigned long long

#define mp make_pair
#define pb push_back
#define fi first
#define se second

#define vi      vector<int>
#define pii     pair<int,int>
#define piii    pair<pair<int,int>,int>
#define all(v)  v.begin(), v.end()

int mod = 1000000007;
const int N = 1005;

// gcd
ll gcd(ll a , ll b)
{
    if ( b == 0)
    return a;
    return gcd( b, a % b);
}
int f(int x)
{
	int org = x;
	int sum = 0;
	while ( x)
	{
		sum += x % 10;
		x /= 10;
	}
	return (org%sum == 0);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int x;
	cin >> x;
	int y = f(x);
	if ( y )
		cout << "Yes";
	else
		cout << "No";
   
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<stdlib.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N;
double v[1010];

signed main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }
    sort(v, v + N);
    double ans = v[0];
    for(int i = 1; i < N; i++){
        ans = (ans + v[i]) / 2;
    }
    printf("%.9lf\n", ans);

    return 0;
}
/*


*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

Measured memory_bytes: 3632
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = [int(input()) for _ in range(n)]
    a.sort(reverse=True)
    if n%2 == 0:
        ans = 2*(sum(a[:n//2])-sum(a[n//2:]))
        ans += a[n//2]-a[n//2-1]
    else:
        ans = 2*(sum(a[:n//2])-sum(a[n//2+1:]))
        tmp = max(a[n//2]-a[n//2-1], a[n//2+1]-a[n//2])
        ans += tmp
    print(ans)



                
if __name__ == '__main__':
    main()

Measured memory_bytes: 13336