akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	a, s := nextInt(), next()
	if a >= 3200 {
		fmt.Println(s)
	} else {
		fmt.Println("red")
	}
}


Measured memory_bytes: 640
N,K=gets.split.map(&:to_i)
es=gets.split.map(&:to_i)
ans = Float::INFINITY
(N-K+1).times do |i|
    jdm = es[i+K-1]-es[i] + [es[i].abs,es[i+K-1].abs].min
    ans = jdm < ans ? jdm : ans
end
puts ans

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n;
	cin>>n;
	cout<<48-n;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	vector<int> digit(3, -1);

	int N, M;
	cin >> N >> M;

	for (int i = 0; i < M; i++)
	{
		int s, c;
		cin >> s >> c;

		s--;
		if (digit[s] != -1 && digit[s] != c)
		{
			cout << -1;
			return 0;
		}

		digit[s] = c;
	}

	if ((N == 2 || N == 3) && digit[0] == 0)
	{
		cout << -1;
		return 0;
	}
	
	if (N == 1)
	{
		if (digit[0] == -1)
		{
			cout << 0;
			return 0;
		}
		else
		{
			cout << digit[0];
			return 0;
		}
	}
	else if (N == 2)
	{
		for (int i = 10; i < 100; i++)
		{
			int digit1 = i / 10;
			int digit2 = i % 10;

			bool check1 = false;
			if (digit[0] == -1) check1 = true;
			else if (digit[0] == digit1) check1 = true;

			bool check2 = false;
			if (digit[1] == -1) check2 = true;
			else if (digit[1] == digit2) check2 = true;

			if (check1 && check2)
			{
				cout << i;
				return 0;
			}
		}
	}
	else if (N == 3)
	{
		for (int i = 100; i < 1000; i++)
		{
			int digit1 = i / 100;
			int digit2 = (i % 100) / 10;
			int digit3 = ((i % 100) % 10);

			bool check1 = false;
			if (digit[0] == -1) check1 = true;
			else if (digit[0] == digit1) check1 = true;

			bool check2 = false;
			if (digit[1] == -1) check2 = true;
			else if (digit[1] == digit2) check2 = true;

			bool check3 = false;
			if (digit[2] == -1) check3 = true;
			else if (digit[2] == digit3) check3 = true;

			if (check1 && check2 && check3)
			{
				cout << i;
				return 0;
			}
		}
	}

	cout << -1;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
int A,B,C;
bool ok(){
	if(A&1)return false;
	if(B&1)return false;
	if(C&1)return false;
	return true;
}
int main(){
	cin >> A >> B >> C;
	if(!ok()){
		cout << 0 << endl;
		return 0;
	}
	if(A==B&&B==C){
		cout << -1 << endl;
		return 0;
	}
	int ans = 0;
	while(ok()){
		int a = (B+C)/2;
		int b = (A+C)/2;
		int c = (B+A)/2;
		A = a;
		B = b;
		C = c;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	var A []int
	var B []int
	var sum int

	for i := 0; i < N+1; i++ {
		val, _ := strconv.Atoi(read())
		A = append(A, val)
	}
	for i := 0; i < N; i++ {
		val, _ := strconv.Atoi(read())
		B = append(B, val)
	}
	for i := 0; i < N; i++ {
		if A[i] <= B[i] {
			sum += A[i]
			B[i] -= A[i]
			if A[i+1] <= B[i] {
				sum += A[i+1]
				A[i+1] = 0
			} else if B[i] > 0 {
				sum += B[i]
				A[i+1] -= B[i]
			}
		} else if B[i] > 0 {
			sum += B[i]
		}
	}
	fmt.Printf("%d\n", sum)
}


Measured memory_bytes: 7680
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        long a=scan.nextLong();
        long b=scan.nextLong();
        long c=0;
        if(b>=1&&b<10){
            c=a*10+b;
        }
        if(b>=10&&b<99){
            c=a*100+b;
        }
        if(b==100){
            c=a*1000+b;
        }
        if(Math.sqrt(c)%1==0){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}



Measured memory_bytes: 24020
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] mass = new char[H+2][W+2];
		for( int i=0; i<=H+1; i++ ){
			for( int j=0; j<=W+1; j++ ){
				mass[i][j] = '?';
			}
		}
		for( int i=1; i<=H; i++ ){
			String ss = sc.next();
			for( int j=1; j<=W; j++ ){
				mass[i][j] = ss.charAt(j-1);
			}
		}
		loop:for( int i=1; i<=H; i++ ){
			for( int j=1; j<=W; j++ ){
				if( mass[i][j]=='#' ){
					if( mass[i-1][j]!='#' && mass[i+1][j]!='#' && mass[i][j-1]!='#' && mass[i][j+1]!='#' ){
						System.out.println("No");
						break loop;
					}
				}
			}
			if( i==H ){
				System.out.println("Yes");
				break loop;
			}
		}
	}
}


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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> ss(N);
  rep(i, N) cin >> ss[i];

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

  rep(i, N) {
    cout << ss[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

int main ()
{
	int a,b,c,d,ans;
	scanf ("%d%d%d%d",&a,&b,&c,&d);
	ans=min(b,d)-max(a,c);
	if (ans<0)
		printf ("0\n");
	else
		printf ("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	ll n, m;
	cin >> n >> m;
	if( abs(n-m) >=2 ){
		cout << '0' << endl;
		return 0;
	}
	ll factn = 1;
	ll factm = 1;
	for( ll i = 1; i <= n; ++i ){
		factn *= i;
		factn %= MOD;
	}
	for( ll i = 1; i <= m; ++i ){
		factm *= i;
		factm %= MOD;
	}
	if( abs(n-m) == 0 ){
		cout << ( factn * factm ) % MOD * 2 % MOD << endl;
	}
	else{
		cout << ( factn * factm ) % MOD << endl;
	}
	return 0;
}

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

using ll = long long int;
int a[20];
double dp[20][200001];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	fill((double*)dp, (double*)(dp + 20), 1<<30);
	for (int i = 1; i < 2 * a[0]; i++) {
		dp[0][i] = (double)abs(a[0] - i) / a[0];
	}
	double ans = 1;
	for (int i = 0; i + 1 < N; i++) {
		for (int j = 1; j < 2 * a[i]; j++) {
			if (dp[i][j] == 1<<30) continue;
			for (int k = 1; j*k < 2 * a[i+1]; k++) {
				dp[i + 1][j*k] = min(dp[i + 1][j*k], max(dp[i][j], (double)abs(j*k - a[i + 1]) / a[i + 1]));
			}
		}
	}
	for (int i = 1; i < 2 * a[N - 1]; i++) {
		if (dp[N - 1][i] == 1<<30) continue;
		ans = min(ans, dp[N - 1][i]);
	}
	printf("%.15lf\n", ans);
	return 0;
}


Measured memory_bytes: 34464
S=input()
acgt=['A','C','G','T']
ans=0
flag=0
for s in S:
  if flag==0:
    if s in acgt:
      flag+=1
  else:
    if s in acgt:
      flag+=1
    else:
      if flag>ans:
        ans=flag
      flag=0
if flag>ans:
  ans=flag
print(ans)

Measured memory_bytes: 9056
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
while True:
    c = 0
    exist = False
    for i in range(n):
        if a[i] > n-1:
            c = a[i] // n
            a[i] %= n
            for j in range(n):
                if j != i:
                    a[j] += c
            ans += c
            exist = True
    if not exist:
        break

print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

/*
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    int dp[100100];
    int h[100100];
    Fill(dp, 1001001001);
    dp[0] = 0;
    rep(i,0,N) cin >> h[i];
    rep(i,1,N){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if(i > 1) chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[N-1] << endl;
}
*/


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    int dp[100100];
    int h[100100];
    Fill(dp, 1001001001);
    dp[0] = 0;
    rep(i,0,N) cin >> h[i];
    rep(i,0,N){
        chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i]));
        chmin(dp[i+2], dp[i] + abs(h[i+2] - h[i]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 4384
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums() {
	return readln().chomp.split.map!(to!int);
}

void main() {
	auto numsCount = readNums();
	bool before = false;
	size_t count = 0;
	foreach(i, n; readNums().enumerate) {
		if(!before && (i + 1) == n) {
			++count;
			before = true;
		} else {
			before = false;
		}
	}
	writefln("%d", count);
}


Measured memory_bytes: 4284
#include <stdio.h>
	int array[500000];
	int a[500000];


	int main(){
		
		int n;
		scanf("%d",&n);
		for( int i = 0;i < n; i++){
			scanf("%d",&a[i]);
		}
		int left = 250000, right = left+1;
		for(int i =0; i<n; ++i){
			if(i%2 == (n-1)%2){
				array[left--]=a[i];
			}else{
				array[right++]=a[i];
			}
		}

		for(int i = left +1; i< right; ++i){
				printf("%d ",array[i]);
		}
		
		return 0;
	}

Measured memory_bytes: 3712
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val (l, r) = readLongList()
    val end = Math.min(l + 2018, r)
    var ans = 2020L
    for (i in l..end) {
        for (j in (i + 1)..end) {
            ans = min(ans, ((i % 2019) * (j % 2019)) % 2019)
        }
    }
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 36308
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
using namespace std;


#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull testcase;cin>>testcase;while(testcase--)
#define pb push_back
#define mkp make_pair
#define nl cout<<"\n"
#define prime 1000000007
#define debug(x) cout<<(#x)<<" : "<<x,nl
#define debug2(x,y) cout<<(#x)<<" : "<<x<<" "<<(#y)<<" : "<<y,nl
#define debug3(x,y,z) cout<<(#x)<<" : "<<x<<" "<<(#y)<<" : "<<y<<" "<<(#z)<<" : "<<z,nl
#define f first
#define s second
#define oa(a,n) loop(i,0,n)cout<<a[i]<<" ";nl;
#define ov(a) loop(i,0,a.size()) cout<<a[i]<<" ";nl;
#define MOD(a) (((a%prime)+prime)%prime)



int main()
{


    ld sum,n,k,j;
    ll i;
    cin >> n >> k;
    sum = 0;
    for(i=1;i<=n;i++)
    {
    	if(i<k)
    		j = (floor(log2(k/i)) == log2(k/i))? log2(k/i) : floor(log2(k/i))+1;
    	else
    		j=0;
    	// if(i<=24)
    	//cout << j << endl;
    	sum += pow(0.5,j);
    }
    //cout << sum << endl;
    cout << setprecision(10) << sum/n;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int len[3],ans,lim,oth;
bool dp[3][3][2005];
char s[2][2005];
int lef(int x,int y)
{
	if(x!=0&&y!=0)return 0;
	if(x!=1&&y!=1)return 1;
	if(x!=2&&y!=2)return 2;
}
int main()
{
	scanf("%s%s%s",s[0]+1,s[1]+1,s[2]+1);
	for(int i=0;i<3;i++)len[i]=strlen(s[i]+1);
	ans=len[0]+len[1]+len[2];
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			if(i==j)continue;
			for(int k=1;k<=len[i];k++)
			{
				dp[i][j][k]=true;
				for(int u=k;u<=len[i]&&u-k+1<=len[j];u++)
				{
					if(s[i][u]=='?'||s[j][u-k+1]=='?'||s[i][u]==s[j][u-k+1])continue;
					dp[i][j][k]=false;
					break;
				}
			}
		}
	}
	bool o1,o2;
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			if(i==j)continue;
			oth=lef(i,j);
			for(int k=1;k<=len[i];k++)
			{
				if(!dp[i][j][k])continue;
				lim=max(len[i],len[j]+k-1);
				ans=min(ans,lim+len[oth]);
				for(int u=1;u<=lim;u++)
				{
					o1=true;o2=true;
					if(u<=len[i])o1=dp[i][oth][u];
					if(!(u+len[oth]-1<k||u>k+len[j]-1))
					{
						if(u<k)o2=dp[oth][j][k-u+1];
						else o2=dp[j][oth][u-k+1]; 
					}
					if(o1&&o2)ans=min(ans,max(lim,u+len[oth]-1));
				}
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100000

int N, h[MAXN + 3], dp[MAXN + 3];

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

    dp[1] = 0;
    for (int i = 2; i <= N; i++) {
        dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]);
        if (i > 2)
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
    }

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


Measured memory_bytes: 1024
class Ball
    attr_reader :id, :x, :y

    def initialize(id, x, y)
        @id = id
        @x = x
        @y = y
    end
end

class ZeroCostCounter
    def initialize
        @counter = {}
    end

    def inc(x, y)
        @counter["#{x},#{y}"] = (@counter["#{x},#{y}"] || 0) + 1
    end

    def max
        @counter.inject(0) {|m, (_, v)| m = (v > m) ? v : m }
    end
end

n = gets.chomp!.to_i

balls = n.times.map {|i|
  x, y = gets.chomp!.split(" ").map!(&:to_i)
  Ball.new(i, x, y) 
}

counter = ZeroCostCounter.new
balls.permutation(2).each do |ball1, ball2|
  diff_x = ball1.x - ball2.x
  diff_y = ball1.y - ball2.y
  counter.inc(diff_x, diff_y)
end

puts n - counter.max


Measured memory_bytes: 2172
//written by libra9z
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <valarray>
#include <utility>
#include <numeric>
#include <memory>
#include <functional>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <complex>
#include <locale>
using namespace std;
bool av[3005];
bool as[3005];
int a,b,c,d,e,f;
int main()
{
	cin>>a>>b>>c>>d>>e>>f;
	long long bw=100*a;
	long long bs=0;
	av[0]=true;
	for (int i=1;i<=f;++i)
	{
		if ((i>=100*a && av[i-100*a]) || (i>=100*b && av[i-100*b]))
		{
			av[i]=true;
		}
	}
	as[0]=true;
	for (int i=1;i<=f;++i)
	{
		if ((i>=c && as[i-c]) || (i>=d && as[i-d]))
		{
			as[i]=true;
		}
	}
	for (int i=0;i<=f;++i)
	{
		for (int j=0;i+j<=f;++j)
		{
			if (av[i] && as[j] && (j<=(i/100)*e))
			{
				if (bs*(i+j)<j*(bs+bw))
				{
					bs=j;
					bw=i;
				}
			}
		}
	}
	cout<<bs+bw<<" "<<bs<<"\n";
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
a-=1
b-=1
c-=1
d-=1
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[b-1:d+2] and "##" not in s[a:c]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[a:d+1]:
    print("Yes")
  else:
    print("No")

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

bool func(int a, int b){
  return abs(a-12)>abs(b-12);
}

int main(){
  int N; cin>>N;
  int t[N+1];
  t[0] = 0;
  for(int i=1;i<=N;++i){
    cin >> t[i];
  }
  sort(t+1,t+N+1,func);
  int d[N+2];
  d[0] = 0;
  d[N+1] = 24;
  bool right = true;
  for(int i=1;i<=N;++i){
    if(right){
      if(t[i]<=12){
        d[i] = t[i];
      }else{
        d[i] = 24-t[i];
      }
    }else{
      if(t[i]<=12){
        d[i] = (24-t[i]);
      }else{
        d[i] = t[i];
      }
    }
    right = !right;
  }
  sort(d,d+N+1);
  int s = 100;
  for(int i=0;i<=N;++i){
    chmin(s, (d[i+1]-d[i])%24 );
  }
  cout << s << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
/* Type alias */
using ll = long long;
using ld = long double;

using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

using set_i = std::set<int>;
using set_ll = std::set<ll>;
using set_ld = std::set<ld>;

using uset_i = std::unordered_set<int>;
using uset_ll = std::unordered_set<ll>;
using uset_ld = std::unordered_set<ld>;

/* IO macros */
#define in(i)            int i; std::cin >> i
#define in2(i, j)        int i, j; std::cin >> i >> j
#define in3(i, j, k)     int i, j, k; std::cin >> i >> j >> k
#define in_(i)           std::cin >> i
#define in2_(i, j)       std::cin >> i >> j
#define in3_(i, j, k)    std::cin >> i >> j >> k
#define in_ll(i)         ll i; std::cin >> i
#define in2_ll(i, j)     ll i, j; std::cin >> i >> j
#define in3_ll(i, j, k)  ll i, j, k; std::cin >> i >> j >> k
#define in_ll_(i)        std::cin >> i
#define in2_ll_(i, j)    std::cin >> i >> j
#define in3_ll_(i, j, k) std::cin >> i >> j >> k
#define in_ld(i)         ld i; std::cin >> i
#define in2_ld(i, j)     ld i, j; std::cin >> i >> j
#define in3_ld(i, j, k)  ld i, j, k; std::cin >> i >> j >> k
#define in_ld_(i)        std::cin >> i
#define in2_ld_(i, j)    std::cin >> i >> j
#define in3_ld_(i, j, k) std::cin >> i >> j >> k
#define in_c(i)          char i; std::cin >> i
#define in2_c(i, j)      char i, j; std::cin >> i >> j
#define in3_c(i, j, k)   char i, j, k; std::cin >> i >> j >> k
#define in_c_(i)         std::cin >> i
#define in2_c_(i, j)     std::cin >> i >> j
#define in3_c_(i, j, k)  std::cin >> i >> j >> k
#define in_str(s)        std::string s; std::cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){std::cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){std::cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){std::cin>>x;}

#define print(x)   std::cout << x
#define println(x) std::cout << x << "\n"
#define print_fixed(x)   std::cout << std::fixed << x
#define println_fixed(x) std::cout << std::fixed << x << "\n"
#define print_vec(v) for (auto &x:v) { std::cout << x << " ";}
#define println_vec(v) for (auto &x:v) { std::cout << x << " ";} std::cout << "\n";
#define print_long_vec(v) for (auto &x:v) { std::cout << x << "\n";}
#define println_long_vec(v) for (auto &x:v) { std::cout << x << "\n";} std::cout << "\n";

/* Loops */
#define rep(i, n) for (auto i = 0; i < n; ++i)

/* Vector manipulation */
#define vec_sort(v) std::sort(v.begin(), v.end())

using namespace std;
/* Code Starts Here*/
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in2_ll(N, K);
    vector<vec_i> next(64, vec_i(N));
    rep(i, N) { in_(next[0][i]); next[0][i]--; }
    rep(i, 63) rep(j, N) next[i + 1][j] = next[i][next[i][j]];
    int v = 0;
    rep(i, 64) if (K & (1LL << i)) v = next[i][v];
    println(v + 1);
    return 0;
}


Measured memory_bytes: 54172
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <random>
#include <time.h>
#include <queue>

using namespace std;
#define int long long
const int INF = 1e16 + 7;
const int MAXN = 2e5 + 7;

int pref[MAXN], post[MAXN];

signed main() {
    ios_base::sync_with_stdio(false);

    int n, c;
    cin >> n >> c;

    vector <pair <int, int>> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;

    int curr = 0, last = 0;
    for (int i = 0; i < n; ++i) {
        curr += a[i].second - (a[i].first - last);
        last = a[i].first;
        pref[i + 1] = max(pref[i], curr);
    }

    curr = 0;
    last = c;
    for (int i = 0; i < n; ++i) {
        int num = n - i - 1;
        curr += a[num].second - (last - a[num].first);
        last = a[num].first;
        post[i + 1] = max(post[i], curr);
    }
    
    int ans = max(pref[n], post[n]);

    int sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += a[i].second;
        ans = max(ans, sum - a[i].first * 2 + post[n - i - 1]);
    }
    
    sum = 0;
    for (int i = 0; i < n; ++i) {
        int num = n - i - 1;
        sum += a[num].second;
        ans = max(ans, sum - (c - a[num].first) * 2 + pref[n - i - 1]);
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if (a+b>=c) cout << b+c << endl;
    else cout << a+b+b+1 << endl;
}

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

int main( void )
{
    int a,b,c;
    cin >> a >> b >> c;
    
    int ans = 1;
    
    if ( a != b )
        ans++;
    if ( a != c && b != c)
        ans++;
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

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

using namespace std;

typedef long long LL;
typedef double db;

const int N = 1000003;
const int mo = 998244353;

LL js[N],inv[N],ny[N];
int n,m;
LL v0[N],v1[N];

LL comb(int n,int m){
if (n<0||m<0)return 0;
	return js[n+m]*ny[n]%mo*ny[m]%mo;
}

LL nycomb(int n,int m){
	return ny[n+m]*js[n]%mo*js[m]%mo;
}

int main(){
	scanf("%d%d",&n,&m);
	if (n>m)swap(n,m);
	js[0]=inv[0]=js[1]=inv[1]=ny[0]=ny[1]=1;
	fo(i,2,1e+6)js[i]=js[i-1]*i%mo;
	fo(i,2,1e+6)inv[i]=1ll*(mo-mo/i)*inv[mo%i]%mo;
	fo(i,2,1e+6)ny[i]=ny[i-1]*inv[i]%mo;
	int w=m;
	fd(i,n+m-1,0){
		if (w&&max(i+1-w,w)>max(i-w+1,w-1)){
			w--;
			if (w<m-1)v0[i]=(v0[i+1]+comb(n-(i-w+1),m-(w+1))*comb(i-w,w)%mo)%mo;
			else v0[i]=comb(i-w,w);
		}
		else
		if (w<m&&w)v0[i]=(v0[i+1]+mo-comb(n-(i-w+1),m-(w+1))*comb(i-w+1,w-1)%mo)%mo;
	}
	w=n;
	fd(i,n+m-1,0){
		if (w&&max(i+1-w,w)>max(i-w+1,w-1)){
			w--;
			if (w==n-1)v1[i]=comb(i-w,w);
			else v1[i]=(v1[i+1]+comb(n-(w+1),m-(i-w+1))*comb(i-w,w)%mo)%mo;
		}
		else
		if (w<n&&w)v1[i]=(v1[i+1]+mo-comb(n-(w+1),m-(i-w+1))*comb(i-w+1,w-1)%mo)%mo;
	}
	LL now=comb(n,m)*m%mo,ans=now*inv[n+m]%mo;
	fd(i,n+m-1,1){
		now=(now+mo-v0[i])%mo;
		now=(now+mo-v1[i])%mo;
		ans=(ans+now*inv[i]%mo)%mo;
	}
	ans=ans*nycomb(n,m)%mo;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 39424
#include <bits/stdc++.h>
using namespace std;
int N,M,X,A,lcount=0,rcount=0;
int main(){
  cin >> N >> M >> X;
  for(int i=0;i<M;i++){
    cin >> A;
    if(A<=X-1) lcount++;
    else rcount++;
  }
  cout << min(lcount,rcount) << endl;
  return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

long long gcd( long long m, long long n ){
    if ( n == 0) return m;
    return gcd(n,m%n);
  }//最大公約数

  long long lcm( long long m, long long n ){
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) ) return 0;

  return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//最小公倍数

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  rep(i,n) cin >> a[i];

  reverse(all(a));

  ll l = 2;
  ll r = 2;

  for(ll x : a){
    l = (l+x-1)/x * x;
    r = r / x * x;
    if(l > r){
      cout << -1 << endl;
      return 0;
    }
    r = r+x-1;
  }

  cout << l << ' ' << r << "\n";
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int,bool>;
using ll = long long;
const int MX = 300005, MOD = 1e9+7;

int h, w, a[85][85], b;
bitset<13000> bt[85][85];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    rep(i,h) rep(j,w) cin >> a[i][j];
    rep(i,h) rep(j,w){
        cin >> b;
        a[i][j] = abs(a[i][j] - b);
        bitset<13000> tmp(0);
        if(i) tmp |= bt[i-1][j];
        if(j) tmp |= bt[i][j-1];
        if(i+j==0) tmp[6500] = 1;
        bt[i][j] = (tmp << a[i][j]) | (tmp >> a[i][j]);
    }
    rep(i,6400) if(bt[h-1][w-1][i+6500]){
        cout << i << '\n';
        break;
    }
}

Measured memory_bytes: 11008
<?php

fscanf(STDIN, "%d", $s);

$a_arr = [$s];

$i = 0;
while(1) {
    if ($a_arr[$i] % 2 === 0) {
        $a = $a_arr[$i] / 2;
    } else {
        $a = 3 * $a_arr[$i] + 1;
    }

    ++$i;
    if (in_array($a, $a_arr)) {
        break;
    }

    $a_arr[] = $a;
}


echo $i + 1;


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

int N, M;

int main() {
    cin >> N >> M;
    int ans=0;
    for (int i = 0; i < M; i++) {
        int day;
        cin >> day;
        ans += day;
    }
    if (ans > N) {
        cout << "-1" << "\n";
    }
    else {
        cout << N-ans << "\n";
    }
    return 0;
}


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

int main(){
string s;
cin >> s;
for(int i=0; i<3; ++i){
if(s[i] == '1') s[i] = '9';
else if(s[i] == '9') s[i] = '1';
}
cout << s << "\n";
}

Measured memory_bytes: 256
/*
[ ( ^ _ ^ ) ]
*/

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;


    void solve(InputReader in, PrintWriter out) throws IOException {
        double L = in.nextInt();
        double x = (L*L*L)/(3*3*3);
        // out.println(x);
        System.out.printf("%f\n", x);
    }
    
    
    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }
    
    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
    
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 19412
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
typedef long long ll;
const double eps = 1e-4;
int n, k;
int a[maxn];
bool check(int x) {
    int sum = k;
    for (int i = 1; i <= n; i++) {
        sum -= (a[i]+x-1)/x-1;
    }
    return sum >= 0;
}
int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int left = 1, right = 1e9, ans;
    while (left <= right) {
        int mid = (left + right) / 2;
        if(check(mid)) {
            ans = mid;
            right = mid - 1;
        }
        else left = mid + 1;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 4452
#include <bits/stdc++.h>
#define X first
#define Y second
#define MAX 100005
#define PB push_back
using namespace std;

int main()
{
	//freopen("In.txt" , "r" , stdin);
	int N;
	cin >> N;
	vector<int> a(N);
	for(auto &x : a)
		cin >> x;
	int ans = 1000 * 1000 * 1000;
	for(int to = -100; to <= 100; to++)
	{
		int curAns = 0;
		for(auto x : a)
			curAns += (to - x) * (to - x);
		ans = min(ans , curAns);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    ll a[n];
    rep(i, 0, n){
        cin >> a[i];
    }

    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    ll flag = 2;

    ll count = 1;
    rep(i, 0, n - 1){
        if(flag == 1 && a[i+1] - a[i] < 0){
            count++;
            flag = 2;
        }else if(flag == 0 && a[i+1] - a[i] > 0){
            count++;
            flag = 2;
        }else if(a[i+1] - a[i] < 0){
            flag = 0;
        }else if(a[i+1] - a[i] > 0){
            flag = 1;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int gc(int x) {
  if (x < 5) {
    return 0;
  } else if (x < 500) {
    auto h = x / 5;
    return h * 5 + gc(x % 5);
  } else {
    auto h = x / 500;
    return h * 1000 + gc(x % 500);
  }
}

int main() {
  int x;
  cin >> x;
  cout << gc(x);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MAXVALUE 99999999

int main(void) {
	int N,M,X;
	int price[12];
	int rikai[12][12];
	int i,j,k,min,tmp, totalprice;
	int Ms[12];
	
	scanf("%d %d %d^n", &N,&M,&X);
	for (i = 0; i < N; i++) {
        scanf("%d", &price[i]);
		for (j = 0; j < M; j++) {
			scanf("%d", &rikai[i][j]);
		}
	}
	
	// 本を買う買わないの組み合わせでループ
	min = MAXVALUE;
	tmp = (int)pow(2, N);
	for (i = 0; i < tmp; i++) {
		totalprice = 0;
		memset(Ms, 0x00, sizeof(Ms));
		for (j = 0; j < N; j++) {
			if ((i >> j & 1) == 1) {
				totalprice += price[j];
				for (k = 0; k < M; k++) {
					Ms[k] += rikai[j][k];
				}
			}
		}
		// アルゴリズムの理解度チェック
		for (k = 0; k < M; k++) {
			if (Ms[k] < X) {
				totalprice = MAXVALUE;
				break;
			}
		}
		
		if (totalprice < min) {
			min = totalprice;
		}
	}
	
    if (min == MAXVALUE) min = -1;
	printf("%d\n", min);
	return(0);
}



Measured memory_bytes: 2600
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X;
	cin>>X;
	int n=0;
	for(int i=1;i<=X;i++){
		int x=i;
		for(int j=1;j<=X;j++){
			x=x*i;
			if(x<=X)n=max(n,x);
		}
	}cout<<n<<endl;
				
				
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll x,y,a,b,c;cin>>x>>y>>a>>b>>c;
  vector<ll> pA(a);
  vector<ll> pB(b);
  vector<ll> pC(c);
  rep(i,a){
    cin>>pA[i];
  }
  rep(i,b){
    cin>>pB[i];
  }
  rep(i,c){
    cin>>pC[i];
  }
  sort(all(pA),greater<ll>());
  sort(all(pB),greater<ll>());
  sort(all(pC),greater<ll>());
  vector<ll> ans;
  rep(i,x){
    ans.push_back(pA[i]);
  }
  rep(i,y){
    ans.push_back(pB[i]);
  }
  sort(all(ans));
  ll idx=0;
  rep(i,c){
    if(pC[i]>ans[idx]){
      ans[idx++]=pC[i];
    }
    if(idx>=ans.size()){
      break;
    }
  }
  ll sum=0;
  rep(i,ans.size()){
    sum+=ans[i];
  }
  cout<<sum<<endl;
  return 0;
}


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

int find(int x, vector<int> &P){
  if(P[x]==x) return x;
  int ret = find(P[x],P);
  P[x] = ret;
  return ret;
}

void unite(int x, int y, vector<int> &P){
  x = find(P[x],P);
  y = find(P[y],P);
  if(x!=y) P[y] = x;
  return;
}

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> V(N+1),par(N+1);
  for(int i=1;i<=N;i++){
    cin >> V[i];
    par[i] = i;
  }
  
  for(int i=0;i<M;i++){
    int x,y;
    cin >> x >> y;
    unite(x,y,par);
  }
  
  int ans=0;
  for(int i=1;i<=N;i++){
    if(find(V[i],par)==find(i,par)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] a=br.readLine().split(" ");
        int m=Integer.parseInt(a[0]);
        int f=Integer.parseInt(a[1]);
        int r=Integer.parseInt(a[2]);
		int k=m+f;
        while(!(m==-1&&f==-1&&r==-1)){
    		String g=null;
        	if(m==-1||f==-1||k<30){
        		g="F";
        	}else if(30<=k&&k<50){
        		if(r>=50){
        			g="C";
        		}else{
        			g="D";
        		}
        	}else if(50<=k&&k<65){
        		g="C";
        	}else if(65<=k&&k<80){
        		g="B";
        	}else{
        		g="A";
        	}
            System.out.println(g);
        	a=br.readLine().split(" ");
            m=Integer.parseInt(a[0]);
            f=Integer.parseInt(a[1]);
            r=Integer.parseInt(a[2]);
            k=m+f;
        }
	}
}

Measured memory_bytes: 17100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  int ans = 0;
  for(int i = 0; i < n-1; i++){
    ans = max(ans, a[i+1]-a[i]);
  }
  ans = max(ans, k+a[0]-a[n-1]);
  cout << k-ans << endl;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import itertools

ABCD = input()
l = len(ABCD)
cs = itertools.product(['+', '-'], repeat=l-1)

ans = 0
for c in cs:
    ex = ''.join([ABCD[i] + c[i] for i in range(l-1)] + [ABCD[-1]])
    exec("ans = {}".format(ex))
    if ans == 7:
        break

print(ex + "=7")


Measured memory_bytes: 3188
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	long k = read.to!long;
	
	if(n >= k * 2 - 1) writeln("YES");
	else writeln("NO");
}


Measured memory_bytes: 256
//#pragma GCC optimize("O3")
//#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define M2 998244353
#define ll long long
#define pll pair<long, long>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define db pop_back
#define mp make_pair
#define mt make_tuple
#define g(a, b) get<a>(b)
#define INF (ll)1e18 + 100
#define vl vector<ll>
#define vi vector<int>
#define vll vector<pair<ll, ll>>
#define vii vector<pair<int, int>>
#define all(v) v.begin(),v.end()
#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);
 
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}
 
ll modI(ll a, ll m)
{
   return powM(a, m-2, m);
}
 
void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}
int main()
{
    ll a, b, k;
    cin>>a>>b>>k;
    if(a >= k){
        cout<<a-k<<" "<<b;
    }
    else{
        //a = 0;
        b = max(0LL, b-k+a);
        cout<<0<<" "<<b; 
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;



int main(void) {
    ll N, K;
    cin >> N >> K;
    ll a[MAX];
    ll i, j;
    ll cnt[44]={};
    
    for(i=0; i<N; i++) {
        cin >> a[i];
        
        for(j=0; j<40; j++) {
            if(1&a[i]>>j) cnt[j]++;
        }
    }
    
    ll ans=0;
    for(i=0; i<N; i++) ans+=K^a[i];
    
    for(j=0; j<40; j++) {
        if(!(1&K>>j)) continue;
        
        ll mask=(K>>(j+1))<<(j+1);
        for(i=0; i<j; i++) {
            if(cnt[i]<=N-cnt[i])
                mask+=1LL<<i;
        }
        
        
        ll t=0;
        for(i=0; i<N; i++)
            t+=mask^a[i];
        
        chmax(ans, t);
    }
    
    pt(ans);
    
}







Measured memory_bytes: 1024
#include<stdio.h>
#include<stdio.h>
int main(){
  int i,j,k,h,m,a,l;
  char n[202],x;
  while(scanf("%s",n)){
    if(strcmp(n,"-")==0)break;
    scanf("%d",&m);
    int len  =strlen(n);
    for(i=0;i<m;i++){
      scanf("%d",&a);
      for(l=0;l<a;l++){
	x=n[0];
	for(j=0;j<len;j++){
	  n[j]=n[j+1];
      }
	n[len-1]=x;
      }
    }
    for(k=0;k<len-1;k++){
      printf("%c",n[k]);
    }
    printf("%c\n",n[len-1]);
  }
  return 0;
}

Measured memory_bytes: 600
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    p = [list(map(int, input().split())) for i in range(n)]

    p0, p1 = [0]*n, [0]*n

    for i in range(n):
        p0[i] = p[i][0] - p[i][1]
        p1[i] = p[i][0] + p[i][1]
    
    ans = max(max(p0)-min(p0), max(p1)-min(p1))
    print(ans)



    
if __name__ == "__main__":
    main()



Measured memory_bytes: 61256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){

  string s;
  vector<int> v;

  cin >> s;

  for(int i = 0; i < s.size(); i++){
    if(s[i] == '0') v.push_back(0);
    else if(s[i] == '1') v.push_back(1);
    else if(!v.empty())v.pop_back();
  }

  for (int i : v) cout << i;
  cout << endl;

  return 0;

}


Measured memory_bytes: 256
function Main(input) {
	var lines = input.split("\n");
	var nums = lines[0].replace(/\s/g, '')
	console.log(nums.replace('5', '').replace('5', '').replace('7', '').length === 0 ? 'YES' : 'NO')
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
int N, K;
cin>>N>>K;
vector<int> h(N);
for (int i = 0; i < N; i++) {
    cin >> h.at(i);
}
int ans = 0;
for (int i = 0; i < N; i++) {
    if (h.at(i)>=K){
        ans++;
    }
}
cout << ans << endl;
}


Measured memory_bytes: 640
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N, Q;
int main() {
  cin >> N >> Q;
  queue<pair<string,int>> P;
  string name; int t;
  for (int i = 0; i < N; i++) {
    cin >> name >> t;
    P.push(make_pair(name,t));
  }
  int now = 0;
  while (!P.empty()) {
    name = P.front().first; t = P.front().second;
    if (t > Q) {
      now += Q;
      P.push(make_pair(name,t-Q));
    } else {
      now += t;
      cout << name << ' ' << now << endl;
    }
    P.pop();
  }
}



Measured memory_bytes: 6180