akhauriyash/Code-Regression huggingface dataset:
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m) - 1;i>=(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265359
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

ve<int> dx = {0, 0, 1, -1}, dy = {1, -1, 0, 0};

int main() {
  int N;
  ci(N);
  if(N % 10 == 2 ||N % 10 == 4||N % 10 == 5||N % 10 == 7|| N % 10 == 9){
    co("hon");
  }
  else if(N % 10 == 0 ||N % 10 == 1||N % 10 == 6||N % 10 == 8){
    co("pon");
  }
  else{
    co("bon");
  }
}

Measured memory_bytes: 3632
import std.stdio, std.string, std.array, std.conv, std.range;

void main() {
    int[] tmp = readln.chomp.split.to!(int[]);
    int n = tmp[0], k = tmp[1], q = tmp[2];
    int[] points = repeat(k-q, n).array;
    foreach (i; 0 .. q) {
        int a = readln.chomp.to!int - 1;
        ++points[a];
    }
    foreach (x; points) {
        writeln(x > 0 ? "Yes" : "No");
    }
}

Measured memory_bytes: 3964
a = input()
a_list = a.split(" ")
# print(a_list)
a_list0 = int(a_list[0])
a_list1 = int(a_list[1])
a_list2 = int(a_list[2])
# print(a_list0)
# print(a_list1)
# print(a_list2)
a_list_plus = a_list0+a_list1+a_list2
if a_list_plus >=22:
    print("bust")
else:
    print("win")

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

using namespace std;

int main() {
	int w, q;
	while (cin >> w >> q) {
		if (w == 0 && q == 0) {
			break;
		}
		char c;
		vector<int> hei(w);
		fill(hei.begin(), hei.end(), -1);
		for (int i = 0; i < q; i++) {
			cin >> c;
			if (c == 's') {
				int a, b;
				cin >> a >> b;
				bool hantei2 = true;
				for (int j = 0; j < w; j++) {
					if (hei[j] == -1 && j+b-1 < w) {
						bool hantei = true;
						for (int k = 0; k < b; k++) {
							if (hei[j+k] == -1) {
							} else {
								hantei = false;
								break;
							}
						}
						if (hantei) {
							for (int k = 0; k < b; k++) {
								hei[j+k] = a;
							}
							cout << j << endl;
							hantei2 = false;
							break;
						} 
					}
				}
				if(hantei2) {
					cout << "impossible" << endl;
				}
			} else {
				int a;
				cin >> a;
				for (int j = 0; j < w; j++) {
					if (hei[j] == a) {
						hei[j] = -1;
					}
				}
			}
		}
		cout << "END" << endl;
	}
	return 0;
}

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

int main() {
	double n, m, d;
	int N, M, D;
	double res;
	cin >> N >> M >> D;
	n = (double)N, m = (double)M, d = (double)D;
	if(d==0) res = (m-1.0)/n;
	else res = ((n-d)*2.0*(m-1.0))/(n*n);
	cout << fixed << setprecision(10) << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args)
	{
		// TODO 自動生成されたメソッド・スタブ
		try
		{
			String str1[] = input(1);
			String str2[] = input(Integer.parseInt(str1[0]));
			int[] a = new int[str2.length];
			for(int i = 0; i < str2.length; i++)
			{
				a[i] = Integer.parseInt(str2[i]);
			}
			int swa = SelectionSort(a);
			for(int i = 0; i < a.length; i++)
			{
				System.out.print(a[i]);
				if(i != a.length - 1) System.out.print(" ");
			}
			System.out.println("\n" + swa);
		}
		catch(IOException e)
		{
		}
	}

	public static int SelectionSort(int a[])
	{
		int Select = 0;
		for(int j = 0; j < a.length - 1; j++)
		{
			int[] min = {0, Integer.MAX_VALUE};
			for(int i = j; i < a.length; i++)
			{
				if(min[1] > a[i])
				{
					min[1] = a[i];
					min[0] = i;
				}
			}
			if(j != min[0])
			{
				Select++;
				swap(a, min[0], j);
			}
		}
		return Select;
	}

	public static int BubbleSort(int a[])
	{
		int swapp = 0;
		boolean flag = true;
		while(flag)
		{
			flag = false;
			for(int i = 0; i < a.length - 1; i++)
			{
				if(a[i] > a[i+1])
				{
					swapp++;
					swap(a, i, i+1);
					flag = true;
				}
			}
		}
		return swapp;
	}

	public static void swap(int a[], int x, int y)
	{
		a[x] = a[x] ^ a[y];
		a[y] = a[x] ^ a[y];
		a[x] = a[x] ^ a[y];
	}

	/*
	public static int Calc(int[] a, int f, int e)
	{
		ArrayList<Integer> list[] = new ArrayList[2];
		return e;
	}
	//*/

	public static String[] input(int Num) throws IOException
	{
		String str[] = new String[Num];
		String str2 = br.readLine();
		int j = 0;
		for(int i = 0; i < Num; i++)
		{
			if(i < Num - 1)
			{
				str[i] = str2.substring(j, str2.indexOf(" ", j));
				j = str2.indexOf(" ", j) + 1;
			}
			else
			{
				str[i] = str2.substring(j);
			}
		}
		return str;
	}

}



Measured memory_bytes: 24372
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< long long int ,long long int > iil;
typedef long long ll;
typedef vector< ll > vl;
const ll MOD = 1e9+7,MAX = 1e5;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define EE '\n'
#define ll long long int
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define fornl(i,n) for(ll i=0;i<n;i++)
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define PI 3.14159265
#define g(a,b) a>b?a:b
#define l(a,b) a<b?a:b
#define SOT(A) sort(A.begin(),A.end())
#define SOTR(A) sort(A.rbegin(),A.rend())

//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////



int main(){
    int t=1;
    //cin>>t;
    forn(term,t){
        ll n,m;
        ll s=0;
        cin>>n>>m;
        vl A(n);
        forn(i,n) {cin>>A[i];s+=A[i];}
        SOT(A);
        if(m>n)  {cout<<"No"<<endl;return 0;
        }
        s=ceil(s/(4.0*m));
        if(A[n-m]>=s) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        
    }
}






Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

void CulculateCoordinateAndRadius(double&, double&, double&, double, double, double, double, double, double);
double slope(const double[2], const double[2]);
double n_slope(const double[2], const double[2]);
double intercept(const double, const double[2]);
double center(const double, const double);
double mySqrt(double, const int&);
double myRound(double, const int&);

int main(){

	int NumberOfDataset;  //データセットの数
	double x1, y1, x2, y2, x3, y3; //入力される座標
	double px, py, r;

	std::cin >> NumberOfDataset;

	for (int i = 0; i < NumberOfDataset; i++)
	{
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		CulculateCoordinateAndRadius(px, py, r, x1, y1, x2, y2, x3, y3);
		/*px = myRound(px, 4);
		py = myRound(py, 4);
		r = myRound(r, 4);*/
		//std::cout << px << ' ' << py << ' ' << r << std::endl;
		printf("%0.3f %0.3f %0.3f\n", px, py, r);
	}
}

void CulculateCoordinateAndRadius(double& px, double&py, double&r, double x1, double y1, double x2, double y2, double x3, double y3){
	double point1[2] = { x1, y1 };
	double point2[2] = { x2, y2 };
	double point3[2] = { x3, y3 };
	double center1[2] = { center(point1[0], point2[0]), center(point1[1], point2[1]) };
	double center2[2] = { center(point2[0], point3[0]), center(point2[1], point3[1]) };
	double n_slope_1 = n_slope(point1, point2);
	double n_slope_2 = n_slope(point2, point3);
	double intercept_1 = intercept(n_slope_1, center1);
	double intercept_2 = intercept(n_slope_2, center2);
	if (y1 == y2){
		px = center1[0];
		py = n_slope_2 * px + intercept_2;
	}
	else if (y2 == y3){
		px = center2[0];
		py = n_slope_1 * px + intercept_1;
	}else{
		px = (intercept_2 - intercept_1) / (n_slope_1 - n_slope_2);
		py = n_slope_1 * px + intercept_1;
	}
	r = mySqrt((px - x1) * (px - x1) + (py - y1) * (py - y1), 5);
}


double slope(const double point1[2], const double point2[2]){
	return (point2[1] - point1[1]) / (point2[0] - point1[0]);
}

double n_slope(const double point1[2], const double point2[2]){
	double x1 = -point1[1];
	double y1 = point1[0];
	double x2 = -point2[1];
	double y2 = point2[0];
	return (y2 - y1) / (x2 - x1);
}

double intercept(const double slope, const double POINT1[2]){
	return -slope * POINT1[0] + POINT1[1];
}

double center(const double COODINATE1, const double COODINATE2){
	return (COODINATE1 + COODINATE2) / 2;
}

double mySqrt(double number, const int& SIGNIFICANT_DIGITS){
	double result = 0;
	double digitsOffset = 1;

	for (int i = 0; i < SIGNIFICANT_DIGITS + 1; i++){
		while (number >= (result + digitsOffset) * (result + digitsOffset)){
			result += digitsOffset;
		}
		digitsOffset /= 10;
	}
	return result;
}

double myRound(double number, const int& SIGNIFICANT_DIGITS){
	for (int i = 0; i < SIGNIFICANT_DIGITS; i++){
		number *= 10;
	}
	int targetDigits = static_cast<int>(number) % 10;
	if (targetDigits >= 5){
		number = static_cast<int>(number) + 10 - targetDigits;
	}
	else{
		number = static_cast<int>(number) - targetDigits;
	}
	for (int i = 0; i < SIGNIFICANT_DIGITS; i++){
		number /= 10;
	}
	return number;
}


Measured memory_bytes: 3296
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
def factorial(n):
    if (n==0) or (n==1):
        return 1
    ret = 1
    for i in range(2, n+1):
        ret *= i
    return ret
def combination(n, k):
    return factorial(n)//factorial(k)//factorial(n-k)
sys.setrecursionlimit(1000000)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N = I()
abc = LIR(N)

#dpb[i] = max(dpa[i-1], dpc[i-1])

dpa = [0]*(N+1)
dpb = [0]*(N+1)
dpc = [0]*(N+1)

for i in range(1, N+1):
    dpa[i] = max(dpb[i-1], dpc[i-1]) + abc[i-1][0]
    dpb[i] = max(dpa[i-1], dpc[i-1]) + abc[i-1][1]
    dpc[i] = max(dpa[i-1], dpb[i-1]) + abc[i-1][2]

print(max(dpa[N], dpb[N], dpc[N]))

Measured memory_bytes: 43428
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	H, W := getInt(), getInt()
	a := make(map[int]int)
	for i := 0; i < H; i++ {
		s := getString()
		for j := 0; j < W; j++ {
			a[int(s[j])]++
		}
	}
	// out(a)
	c1 := 0
	c2 := 0
	c4 := 0
	for _, v := range a {
		c4 += v / 4
		c2 += (v % 4) / 2
		c1 += (v % 4) % 2
	}
	// out(c1, c2, c4)

	if W%2 == 1 && H%2 == 1 {
		if c1 == 1 && c2 <= (W+H-2)/2 {
			out("Yes")
		} else {
			out("No")
		}
	} else if W%2 == 1 {
		if c1 == 0 && c2 <= H/2 {
			out("Yes")
		} else {
			out("No")
		}
	} else if H%2 == 1 {
		if c1 == 0 && c2 <= W/2 {
			out("Yes")
		} else {
			out("No")
		}
	} else {
		if c2 != 0 || c1 != 0 {
			out("No")
		} else {
			out("Yes")
		}
	}
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define DBG(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define CIN(type, ...) \
  type __VA_ARGS__;    \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define COUT(...) write_to_cout(__VA_ARGS__);

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int N;
ll A[100000];
ll kMax = 1000000000000000000;

int main() {
  cin >> N;
  REP(i, N) {
    cin >> A[i];
    if (A[i] == 0) {
      cout << "0" << endl;
      return 0;
    }
  }
  ll ans = 1;
  REP(i, N) {
    if (A[i] > kMax / ans) {
      cout << -1 << endl;
      return 0;
    }
    ans *= A[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4380
// ?????????Coin Changing Problem
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <set>
#include <deque>
#include <vector>
#define MAX 50010
#define rep(i,p) for(int i=0;i<p;i++)
#define pb push_back
using namespace std;
int n,m,temp;
std::vector<int> C;
int dp[MAX];
int main(){
  cin >> n >> m;
  rep(i,m) {
    cin >> temp;
    C.pb(temp);
  }
  rep (i,n+10) dp[i] = MAX; 
  dp[0] = 0;
  for (int i=0; i<m ; i++)
    for (int j=C.at(i); j<=n; j++)
      dp[j] = min(dp[j],dp[j-C.at(i)]+1);
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 1412
s = input()
K = int(input())
N = len(s)

abc = 'bcdefghijklmnopqrstuvwxyza'
abc_to_index = {abc[_]: _ for _ in range(26)}

ans = ''
for i in range(N):
    if 25 - abc_to_index[s[i]] > K or i == N - 1:
        ans += s[i]
    else:
        ans += 'a'
        K -= 25 - abc_to_index[s[i]]
ans = ans[:-1] + abc[(abc_to_index[ans[-1]] + K) % 26]
print(ans)


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
char c[200];
int vis;
unsigned int lenth;
int main()
{
	cin>>c;
	lenth=strlen(c);
	for(unsigned int i=0;i<lenth;i++)
	{
		if(c[i]=='C') vis=1;
		if(c[i]=='F'&&vis==1) vis=2;
		if(vis==2) break; 
	}
	if(vis==2) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  int a,b,c,x,ans=0;
  cin>>a>>b>>c>>x;
  for (int i = 0; i <= a; ++i)
  {
    for (int j = 0; j <= b; ++j)
    {
      for (int k = 0; k <= c; ++k)
      {
        ans+=(i*500+j*100+k*50==x?1:0);
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var n = long.Parse(ReadLine());
        var a = new long[5];
        for (int i = 0; i < a.Length; i++)
            a[i] = long.Parse(ReadLine());

        var minA = a.Min();

        var ans = MathExt.DivideAndRoundUp(n, minA) + 4;

        WriteLine(ans);
    }
}
static class MathExt
{
    public static int DivideAndRoundUp(int x, int y) => (x + y - 1) / y; // (int)Math.Ceiling((double)x / (double)y);
    public static long DivideAndRoundUp(long x, long y) => (x + y - 1) / y;
}


Measured memory_bytes: 27936
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.NoSuchElementException;

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

	void run() {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
		}
		int sum = 0;
		for (int i = 0; i < n; ++i) {
			sum += a[i];
		}
		int[][] b = new int[n][2];
		for (int i = 0; i < n; ++i) {
			b[i][0] = Math.abs(sum - a[i] * n);
			b[i][1] = i;
		}
		Arrays.sort(b, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				if (o1[0] != o2[0])
					return Integer.compare(o1[0], o2[0]);
				else
					return Integer.compare(o1[1], o2[1]);
			}
		});
		pw.println(b[0][1]);
		pw.close();
	}

	static class Scanner {
		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 boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		private void skipUnprintable() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr]))
				ptr++;
		}

		public boolean hasNext() {
			skipUnprintable();
			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() {
			return (int) nextLong();
		}
	}

	public static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

public class Main {
	static FastScanner sc = new FastScanner();
	static final double ALLOWABLE_ERROR = 0.00000001;

	public static void main(String[] args) {
		int q = sc.nextInt();
		
		StringBuilder ans = new StringBuilder();
		for(int i=0; i<q; i++) {
			double x0 = sc.nextDouble();
			double y0 = sc.nextDouble();
			double x1 = sc.nextDouble();
			double y1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double y2 = sc.nextDouble();
			double x3 = sc.nextDouble();
			double y3 = sc.nextDouble();
			
			if(x0 >= x1) {
				if((x0<x2 && x0<x3) || (x1>x2 && x1>x3)) {
					ans.append(0);
					ans.append("\n");
					continue;
				}
			} else {
				if((x1<x2 && x1<x3) || (x0>x2 && x0>x3)) {
					ans.append(0);
					ans.append("\n");
					continue;
				}
			}
			
			if(y0 >= y1) {
				if((y0<y2 && y0<y3) || (y1>y2 && y1>y3)) {
					ans.append(0);
					ans.append("\n");
					continue;
				}
			} else {
				if((y1<y2 && y1<y3) || (y0>y2 && y0>y3)) {
					ans.append(0);
					ans.append("\n");
					continue;
				}
			}
			
			if(((x0-x1)*(y2-y0)+(y0-y1)*(x0-x2))*((x0-x1)*(y3-y0)+(y0-y1)*(x0-x3))>0) {
				ans.append(0);
				ans.append("\n");
				continue;
			}
			if(((x2-x3)*(y0-y2)+(y2-y3)*(x2-x0))*((x2-x3)*(y1-y2)+(y2-y3)*(x2-x1))>0) {
				ans.append(0);
				ans.append("\n");
				continue;
			}
			
			ans.append(1);
			ans.append("\n");
		}
		
		System.out.print(ans);
	}

	static 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;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); 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() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)

// N=2000 の O( N^3 ) は bitsetの可能性あり

int main()
{
	ull n = 0;
	cin >> n;
	vector<ll> a( n, 0 );
	REP(i, n) cin >> a[i];
	
	bitset<2000*2000/2+1> bs(1);
	REP(i,n) bs |= bs<<a[i];
	
	ll sum = accumulate( ALL(a), 0 );
	for( ll i = sum / 2; i >= 0; --i )
		if( bs[i] ) { cout << sum - i << endl; break; }

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll gcd(ll p, ll q){
    if(p%q==0) return q;
    else return gcd(q, p%q);
}

int main() {
    ll p, q, m, ans=1;
    cin >> p >> q;
    m = q/gcd(p,q);
    for(ll i=2;i*i<=m;i++){
        if(m%i==0){
            ans *= i;
            while(m%i==0) m/=i;
        }
    }
    if(m!=1) ans *= m;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3108
/******

AUTHOR : RUDRANSH TRIPATHI, IIIT NAGPUR, CCID(rt24) & CFID(rsgt24)

MOTTO : Use criticism as fuel and you will never run out of energy.
        AIM : TO BECOME A BETTER CODER
        INTROSPECT + COURSE CORRECTIONS = CATALYST FOR SUCCESS
        Every moment is an opportunity to better yourself

*******/

#include<bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int MAX = 2e6 + 5;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define pb push_back
#define d(x) cout<<x<<"\n"
#define time_passed	1.0 * clock() / CLOCKS_PER_SEC

vector<int> graph[1000000];
bool visited[1000000];
int total=0;

void dfs(int v){
    
	visited[v] = 1;
	
	for(auto x: graph[v]){
	    
		if(visited[x] == 0)
		{
		    dfs(x);
		}
		
	}
}

void solve()
{
    /*int n;
    cin>>n;
    string x = "";
    for(int i=0;i<n;i++)
    x+="ACL";
    
    cout<<x<<"\n";*/
    
    /*int a,b,c,d;
    cin>>a>>b>>c>>d;
    
    if(a>=c&&a<=d || b>=c&&b<=d)
    cout<<"Yes"<<"\n";
    else if(c>=a&&c<=b || d>=a&&d<=b)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";*/
    int n, m, i, j, u, v;
	cin >> n >>m;
	
    while(m--)
    {
        int u,v;
        cin>>u>>v;
        graph[u].push_back(v);
		graph[v].push_back(u);
    }
    
    for(int i = 1; i <= n ; i++)
    {
        if(!visited[i])
        {
            //cout<<i<<"\n";
            dfs(i);
            total++;
        }
    }
    
	cout << total - 1 << "\n";
	
	for(int i=0;i<100000;i++)
	graph[i].clear();
	
	for(int i=0;i<100000;i++)
	visited[i]=0;
    
}


int32_t main(void)
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	cerr << "\n" << "Time elapsed : " << time_passed << "\n";
	return 0;
}

Measured memory_bytes: 31676
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,x,y) for(int i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

signed main(){
   IOS;
   int n; cin >> n;
   vector<int> a(n),b(n);
   rep(i,0,n){
      cin >> a[i] >> b[i];
   }  
   sort(a.begin(),a.end());
   sort(b.begin(),b.end());
   if(n%2 == 1) cout << b[n/2]-a[n/2]+1 << '\n';
   else cout << b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1 << "\n";
}

Measured memory_bytes: 6356
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int p = sc.nextInt();
		int q = sc.nextInt();
		int r = sc.nextInt();
		System.out.println(Math.min(Math.min(p + q, p + r), q + r));
		sc.close();

	}

}


Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
int main ( void ) {
	long long a;
	cin >> a;
	if ( a == 1 ) {
		cout << "0" << endl;
		return 0; 
	}
	long long ans = 1e16;
	for ( int i = 1 ; i <= sqrt ( a ) ; i++ ) {
		if ( a % i == 0 ) 
			ans = min ( ans , ( i - 1 ) + ( a / i ) - 1 );  
	}
	cout << ans << endl;
	return 0;
}

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

/**
 * 解説通り実装したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int a = scanner.nextInt();
			int[] y = new int[n];
			int maxX = IntStream.range(0, n).map(i -> {
				int x = scanner.nextInt();
				y[i] = x - a;
				return x;
			}).max().getAsInt();
			// 回答の格納する配列
			long[][] dp = new long[n + 1][2 * n * maxX + 1];
			Arrays.fill(dp[0], 0L);
			dp[0][n * maxX] = 1L;
			IntStream.rangeClosed(1, n).forEach(j -> IntStream.range(0, 2 * n * maxX + 1).forEach(t -> {
				if (((t - y[j - 1]) >= 0) && ((t - y[j - 1]) <= 2 * n * maxX)) {
					dp[j][t] = dp[j - 1][t] + dp[j - 1][t - y[j - 1]];
				} else {
					dp[j][t] = dp[j - 1][t];
				}
			}));
			System.out.println(dp[n][n * maxX] - 1);
		}
	}
}


Measured memory_bytes: 28876
#include<iostream>

using namespace std;

int main(){
    string line;
    int m, h, LINE;
    
    while(cin >> line){
        if(line == "-") break;
        cin >> m;
        LINE = line.size();
        for(int i = 0; i < m; i++){
            cin >> h;
            line = line.insert(0, line.substr(h));
            line.erase(LINE);
        }
        cout << line << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define mod 1000000007
#define N 2000009
#define ad(x,y) (x=(x+(y))%mod)
using namespace std;

int n,dp[N],sum[N];
int calc(int l,int r){
	l=max(0,l); r=min(r,n-2);
	if (l<=r) return l?(sum[r]-sum[l-1]+mod)%mod:sum[r];
	else return 0;
}
int main(){
	scanf("%d",&n);
	int i,ans=(n-1+(long long)(n-1)*(n-2))%mod;
	dp[0]=sum[0]=1;
	for (i=1; i<=(n<<1); i++){
		ad(dp[i],dp[i-1]);
		ad(dp[i],calc(i-n-1,i-3));
		sum[i]=(sum[i-1]+dp[i])%mod;
		if (i<n) ad(ans,(long long)dp[i]*(n-1));
		if (i+1<n) ad(ans,(long long)dp[i]*(n-1)%mod*(n-2));
	}
	printf("%d\n",(ans+dp[n<<1])%mod);
	return 0;
}


Measured memory_bytes: 15872
import java.util.*;

public class Main {


    public static void main(String [] commandLineArgument){

        Scanner input = new Scanner(System.in);
        String s = input.next();
        int n = s.length();
        int l = 0 , r = n - 1;
        if(!isPalindrome(s , l , r)){
            System.out.println("No");
            return;
        }
        l = 0 ;
        r = ((n - 1)/2) - 1;
        if(!isPalindrome(s , l , r)){
            System.out.println("No");
            return;
        }

        l = ((n + 3)/2) - 1;
        r = n - 1;
        if(!isPalindrome(s , l , r)){
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
        input.close();
    }

    public static boolean isPalindrome(String s , int l , int r ){
        while(l < r){
            if(s.charAt(l++) != s.charAt(r--)){
                return false;
            }
        }
        return true;
    }
}



Measured memory_bytes: 22608
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
 
using namespace std;
 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
 
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
 
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
 
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
 
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

              

int main(){
  ll N,M;
  cin >> N >> M;
  ll s = 1800*M + 100*N;
  cout << s * pow(2,M) << endl;
  return 0;
}
  
  


Measured memory_bytes: 384
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


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


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };
int dx2[2] = { 1,0 };
int dy2[2] = { 0,1 };

/******************************************************************************************/


int main() {

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


	ll n;
	cin >> n;
	ll ans = 1000 * (n / 500);
	n %= 500;
	ans += 5 * (n / 5);
	cout << ans << endl;


	return 0;
}



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

int main()
{
    int i, n, cnt = 0;
    cin >> n;
    int num[n];

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

    while(1)
    {
        for(i = 0; i < n; i++)
        {
            if((num[i] % 2) == 0) num[i] /= 2;
            else break;
        }

        if(i == n) cnt++;
        else break;

    }

    cout << cnt << endl;
    
    return 0;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<int> a(n);
	int sum = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	
	sort(a.begin(), a.end());
	
	int i = 0;
	while(i < n)
	{
		if(sum % 10 == 0)
		{
			while(a[i] % 10 == 0 && i < n)
			{
				i++;
			}
			sum -= a[i];
			i++;
		}
		else
		{
			cout << sum << endl;
			return 0;
		}
	}
	
	cout << 0 << endl;
	return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N)
{
    bool flg = false;
    for (int i = 1; i <= 9; i++) {
        if (N % i == 0 && N / i < 10) {
            flg = true;
            break;
        }
    }
    if (flg)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


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

int main(){
	int H,W,N,sr,sc;
	string S,T;
	cin >> H >> W >> N >> sr >> sc >> S >> T;
	bool flag=true;
	
	int r,c;
	r=sr;
	for(int i=0;i<N;i++){
		if(S[i]=='U')r--;
		if(r==0)flag=false;
		if(T[i]=='D' && r<H)r++;
	}
	r=sr;
	for(int i=0;i<N;i++){
		if(S[i]=='D')r++;
		if(r==H+1)flag=false;
		if(T[i]=='U' && r>1)r--;
	}
	c=sc;
	for(int i=0;i<N;i++){
		if(S[i]=='L')c--;
		if(c==0)flag=false;
		if(T[i]=='R' && c<W)c++;
	}
	c=sc;
	for(int i=0;i<N;i++){
		if(S[i]=='R')c++;
		if(c==W+1)flag=false;
		if(T[i]=='L' && c>1)c--;
	}
	if(flag)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 776
using System;
using System.Linq;
class Test{
 
  public static void Main(){
    
    var str = Console.ReadLine();
    int len = str.Length;
    var rev = new string(str.Reverse().ToArray());
    var strHead = str.Substring(0,(len-1)/2);
    var strFoot = str.Substring((len+3)/2-1, (len-1)/2);
    var revHead = new string(strHead.Reverse().ToArray());
    var revFoot = new string(strFoot.Reverse().ToArray());
    
    if(str.Equals(rev)&&strHead.Equals(revHead)&&strFoot.Equals(revFoot)){
      Console.Write("Yes") ;
    }else{
      Console.Write("No");
    }
  }
}

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1223372036854775807;
const ll mod = 1000000007;		








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

	VI d(13, 0);
	d[0]++;

	REP(i, n) {
		int a;
		cin >> a;
		d[a]++;
	}

	if (d[0] != 1 || d[12] > 1) {
		cout << 0 << endl;
		return 0;
	}
	REP(i, 13) {
		if (d[i] >= 3) {
			cout << 0 << endl;
			return 0;
		}
	}

	VI v;
	VI x;
	v.push_back(0);
	if (d[12] == 1)v.push_back(12);

	FOR(i, 1, 12) {
		if (d[i] == 2) {
			v.push_back(i);
			v.push_back(24 - i);
		}
		else if (d[i] == 1)x.push_back(i);
	}

	int ans = 0;


	REP(i, (1 << x.size()) + 1) {
		
		VI y = v;
		REP(j, x.size()) {
			if (i & (1 << j))y.push_back(x[j]);
			else y.push_back(24 - x[j]);
		}

		sort(ALL(y));
		y.push_back(24);
		int res = 24;
		REP(i, y.size() - 1)res = min(res, y[i + 1] - y[i]);
		ans = max(ans, res);
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    rep(i,N) A[i]--;
    int now=0;
    int ans=0;
    while(now!=1){
        now=A[now];
        ans++;
        if(ans>=2*N){
            ans=INF;
            break;
        }
    }
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
	int A,B,C;
	scanf("%d %d %d",&A,&B,&C);
	int K;
	scanf("%d",&K);
	int c=0;
	while(A>=B) B*=2,c++;
	while(B>=C) C*=2,c++;
	puts(c<=K?"Yes":"No");
}

Measured memory_bytes: 3684
#include <iostream>
#include <cmath>

using namespace std;

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

	if (abs(a - x) > abs(b - x)) {
		cout << "B" << endl;
	}
	else {
		cout << "A" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>

using namespace std;

int a,b,c,x,y;

inline long calc(int s) {
    return (c * s) + (a * max(0,x - s)) + (b * max(0,y - s));
}

int main(void) {
    cin >> a >> b >> c >> x >> y;
    c = c + c;
    long min_cost = 2147483647;
    for(int i = 0;i <= max(x,y);i++)
        min_cost = min(min_cost,calc(i));
    cout << min_cost << endl;
    return 0;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	ll a=0,b=0;
	rep(i,0,s.size()){
		if(s[i]=='0') a++;
		else b++;
	}
	cout << 2*min(a,b);
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

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

ll n, a, b;
vector<ll> h;

bool check(ll k){
    vector<ll> h_ = h;
    for(int i = 0; i < n; ++i) h_[i] -= b*k;

    ll diff = a-b;
    ll cnt = 0;
    for(ll e: h_){
        if(e <= 0) continue;
        cnt += (e + diff - 1) / diff;
    }

    return cnt <= k;
}

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

    cin >> n >> a >> b;
    h.resize(n);
    rep(i, n) cin >> h[i];

    ll ok = 1100000000;
    ll ng = 0;

    while(ok - ng > 1){
        int mid = (ok + ng) / 2;

        if(check(mid)) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;
    

    return 0;
}

Measured memory_bytes: 4748
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;

int main()
{
    vector<int> vt;
    for(int i=0; i<3; i++){
        int tmp;
        cin >> tmp;
        vt.push_back(tmp);
    }
    sort(vt.begin(), vt.end());
    cout << vt[2]-vt[1]+vt[1]-vt[0];
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
typedef long long int ll;
#define pb push_back
#define F first
#define S second
#define mkp make_pair
#define pow2(i) (1 << (i))
#define modi(a,b) ((a%b+b)%b)
#define uni(a,b) (((a+b)*(a+b+1)/2)+b)
const int MAXN=1e9+7;
ll int_pow(ll base, ll exp){
	ll result=1;
	while (exp){
		if (exp & 1)
		   result *= base;
		exp/=2;
		base*=base;
	}
	return result;
}
ll a[1000000],b[1000000];
deque<ll>q;
int main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,z=0,ans=0;cin >> n;
	for (ll i=0;i<n;i++)cin >> a[i],b[a[i]]++;
	sort(a,a+n);
	for (ll i=0;i<n;i++){
		while (!q.empty() && abs(q[q.size()-1]-a[i]) > 2)q.pop_back();
		q.push_front(a[i]);
		ans = max(ans, (ll)q.size());
	}
	cout << ans;
}

Measured memory_bytes: 5248
#include<stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	long long A[N],B[N],C[N];
	for(int i=0;i<N;i++){
		scanf("%lld%lld",&A[i],&B[i]);
		C[i]=A[i]+B[i];
	}
	
	//sort
	int h=N;
	int swapped=0;
	while(h>1 || swapped==1){
		if(h>1)h=h*10/13;
		swapped=0;
		
		for(int i=0;i+h<N;i++){
			if(C[i]<C[i+h]){
				long long tmp=C[i];
				C[i]=C[i+h];
				C[i+h]=tmp;
				tmp=B[i];
				B[i]=B[i+h];
				B[i+h]=tmp;
				tmp=A[i];
				A[i]=A[i+h];
				A[i+h]=tmp;
				swapped=1;
			}
		}
	}
	
	long long ans=0;
	for(int i=0;i<N;i++){
		if(i%2==0)ans+=A[i];
		else ans-=B[i];
	}
	
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=1e5+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1);
    return 0;
}


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

int n, tingkat, x;
bool d[110];
int main() {
	cin>>n;
	for (int i=0; i<n; i++) {
		cin>>x;
		if (d[x]==false) {
			d[x]=true;
			tingkat++;
		}
	}
	cout<<tingkat<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

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; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};


vector<int> tonari[55];
ll dp[1<<20][51];

int main() {
    int N; cin>>N;
    vector<vector<int>> next_path(N,vector<int>(N,-1));
    int a,b;
    for(int i=0;i<N-1;++i){
        cin>>a>>b; --a; --b;
        tonari[a].push_back(b);
        tonari[b].push_back(a);
        next_path[a][b]=i;
        next_path[b][a]=i;
    }

    int M; cin>>M;
    vector<int> path[21];

    for (int i = 0; i < M; ++i) {
        int u,v;
        cin>>u>>v; --u; --v;
        vector<int> prev(N,-1);
        queue<int> q;
        q.push(u);
        prev[u]=N;
        while(prev[v]==-1){
            int node=q.front();
            //cout<<node<<endl;
            q.pop();
            for(auto tsugi:tonari[node]) {
                if (prev[tsugi] >= 0) continue;
                prev[tsugi] = node;
                q.push(tsugi);
            }
        }
        //cout<<"ok"<<endl;
        int pos =v;
        while(prev[pos]!=N){
            path[i].push_back(next_path[pos][prev[pos]]);
            pos=prev[pos];
        }
        sort(path[i].begin(),path[i].end());
        /*
        cout<<i<<":";
        for(auto p:path[i]) cout<<p<<" ";
        cout<<endl;
        */
    }
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=0;i<N;++i){
        int bits=0;
        for (int k = 0; k < M; ++k) {
            if(binary_search(path[k].begin(),path[k].end(),i)) bits|=(1<<k);
        }
        //cout<<i<<" "<<bits<<endl;
        for (int j = 0; j < (1 << M); ++j) {
            dp[j][i+1]+=dp[j][i];
            //int tmp=j;

            //printf("%d,%d : %d \n",j,i,tmp);
            dp[j|bits][i+1]+=dp[j][i];
        }
    }
    cout<<dp[(1<<M)-1][N]/2<<endl;

    return 0;
}


Measured memory_bytes: 418048