akhauriyash/Code-Regression huggingface dataset:
import sys
import bisect
N,M=map(int,input().split())
grid = []
for i in range(M):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
pre = []
pos = []
for ships in grid:
  if ships[0] == 1:
    pre.append(ships[1])
  if ships[1] == N:
    pos.append(ships[0])
if pre == [] or pos == []:
  print('IMPOSSIBLE')
  sys.exit()
pre.sort()
pos.sort()
def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return 1
    return 0
for nums in pre:
  if index(pos,nums) == 1:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')


Measured memory_bytes: 51748
N, A, B = map(int, input().split())
def getSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n%10
        n //= 10  # completely divied
    return sum

total = 0
for n in range(1, N+1):
    sum = getSumOfDigits(n)
    if sum >= A and sum <= B:
        total += n 
        
print(total)

Measured memory_bytes: 2940
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)


let n, m = readIntArray() |> fun x -> (x.[0], x.[1])

(n - 1) * (m - 1) 
|> printfn "%d"

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

namespace ABC_148b
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            string res = null;
            for(int i= 0; i < num; i++)
            {
                res += input[0][i];
                res += input[1][i];
            }
            Console.WriteLine(res);
            Console.Read();
        }
    }
}


Measured memory_bytes: 27516
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>
#include <cmath>
#define rep(i, n) for(int i = 0;i < (int)(n); i++)
#define pb push_back
typedef long long ll;

using namespace std;







int main() {
    ll sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    ll dy = ty - sy;
    ll dx = tx - sx;

    rep(i, dy) cout << "U";
    rep(i,dx) cout << "R";
    rep(i, dy) cout << "D";
    rep(i , dx) cout << "L";
    //１周目

    cout << "L";
    rep(i, dy + 1) cout << "U";
    rep(i,dx + 1) cout << "R";
    cout << "D";
    cout << "R";
    rep(i , dy + 1) cout << "D";
    rep(i,dx + 1) cout << "L";
    cout << "U" << endl;

    return 0;
}


Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	double n, k; cin >> n >> k;
	vector<double> v(n);
	rep(i, n) cin >> v[i];
	double buf=0;
	rep(i, k) buf += (v[i] + 1.0) / 2.0;
	double ans = buf;
	rep(i, n - k) {
		buf -= (v[i] + 1.0) / 2.0;
		buf += (v[i + k]+1.0) / 2.0;
		ans = max(ans, buf);
	}
	cout << fixed <<setprecision(10)<< ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <stdio.h>

int main(){
  int n,s,g;
  std::cin >> n;
  std::vector<int> l(n);
  for(int i=0;i<n;i++){
    std::cin >> l[i];
  }

  std::sort(l.begin(),l.end());
  
  s=l.size()-1;
  for(int c=0;c<s;c++){
    g=g+l[c];
  }
  s=l.back();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ;
  if(g>s){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h>
#include <cmath>

using namespace std;

typedef unsigned long long ull;
typedef unsigned int uint;
typedef unsigned char uchar;
#define umap unordered_map
const static ull INVALID_DIGIT = ~(ull)0;

int main()
{
    ull N, M;
    cin >> N >> M;

    struct Light {
        std::vector<int> switches;
        int p;
    };

    std::vector<Light> lights(M);
    for (size_t i = 0; i < M; i++) {
        // get light info
        int k; cin >> k;
        lights[i].switches.resize(k);
        for (int switchI = 0; switchI < k; switchI++) {
            cin >> lights[i].switches[switchI];
            lights[i].switches[switchI]--;
        }
    }
    // get each light switch should be even or odd
    for (size_t i = 0; i < M; i++) {
        int p;
        cin >> p;
        lights[i].p = p;
    }

    int successCount = 0;
    int lightOnOffBits = 0;
    int maxValue = 1 << N;
    while (lightOnOffBits < maxValue)
    {
        bool success = true;
        for (const auto &light : lights)
        {
            int onCount = 0;
            for (auto switchIdx : light.switches)
            {
                onCount += ((lightOnOffBits >> switchIdx) & 0x01) == 1;
            }
            if (onCount % 2 != light.p)
            {
                success = false;
                break;
            }
        }
        if (success)
        {
            successCount++;
        }
        lightOnOffBits++;
    }

    cout << successCount << endl;

    return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  int K[N+1];
  int A[N+1][31];
  for(int i=1; i<=N; ++i){
    cin >> K[i];
    for(int j=1; j<=K[i]; ++j){
      cin >> A[i][j];
    }
  }
  static int count[30];
  for(int i=1; i<=N; ++i){
    for(int j=1; j<=K[i]; ++j){
      count[A[i][j]] +=1;
    }
  }
  int ans=0;
  for(int i=1; i<=M; ++i){
    if(count[i]==N) ans += 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
<?php
$n = trim(fgets(STDIN));
$a = explode(" ", trim(fgets(STDIN)));
 
$total = array_sum($a);
$ans = abs($total - 2 * $a[0]);
$x = 0;
for ($i = 0; $i < $n-1; $i++)
{
    $x += $a[$i];
	$ans = min($ans, abs($total - 2*$x));
}
echo $ans;

Measured memory_bytes: 39668
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

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

struct node{
  int me;
  struct node *parent;
  struct node *left;
  struct node *right;
};
typedef struct node *point;
point root;
  
void insert(int );
void list(point);
void list1(point);

int main(){
  int n,i,num1;
  char com[8];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    if((strcmp(com,"insert"))==0){
      scanf("%d",&num1);
      insert(num1);
    }
    else{
      list(root);
      printf("\n");
      list1(root);
      printf("\n");
    }
  }
  return 0;
}
void insert(int id){
  point x,y,z;
  z=malloc(sizeof(struct node));
  z->me=id;
  z->right=NULL;
  z->left=NULL;
  y=NULL;
  x=root;
  while(x!=NULL){
    y=x;
    if(z->me < x->me)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;
  if(y==NULL)
    root = z;
  else if(z->me < y->me)
    y->left = z;
  else
    y->right = z;
}
void list(point x){
  if(x!=NULL){
    list(x->left);
    printf(" %d",x->me);
    list(x->right);
  }
}
void list1(point x){
  if(x!=NULL){
    printf(" %d",x->me);
    list1(x->left);
    list1(x->right);
  }
}



Measured memory_bytes: 25240
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15

struct lex_compare {
    bool operator() (pp(ll) p1,pp(ll) p2){
        ll x1 = (p1.ff*(p1.ss-p1.ss/2));
        ll x2 = (p2.ff*(p2.ss-p2.ss/2));
        return x1 > x2;
    }
};

int main(){
    FIO;
    db d,t,s; cin >> d >> t >> s;
    if( s*t >= d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

public class Main{
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int a = Integer.parseInt(chr[0]);
			int b = Integer.parseInt(chr[1]);
			int c = Integer.parseInt(chr[2]);
			 System.out.println(a+b+c>=22? "bust" : "win");
		}
	}
}

Measured memory_bytes: 25400
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// bit全探索

func main() {
	H, W, K := nextInt(), nextInt(), nextInt()
	Chw := make([][]string, H)
	for i := 0; i < H; i++ {
		c := nextLine()
		Chw[i] = strings.Split(c, "")
	}
	var ans int
	for maskR := 0; maskR < 1<<H; maskR++ {
		for maskC := 0; maskC < 1<<W; maskC++ {
			var black int
			for i := 0; i < H; i++ {
				for j := 0; j < W; j++ {
					if (maskR>>i)&1 == 0 && (maskC>>j)&1 == 0 && Chw[i][j] == "#" {
						black++
					}
				}
			}
			if black == K {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

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

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

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}

// ここから拝借
// https://shoman.hatenablog.com/entry/2020/02/25/185456
// Stackは[]intのエイリアス
type Stack []int

// Push adds an element
func (s *Stack) Push(v int) {
	*s = append(*s, v)
}

// Pop removes the top element and return it
func (s *Stack) Pop() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	v := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return v, nil
}

// Peek returns the top value
func (s *Stack) Peek() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	return (*s)[len(*s)-1], nil
}

// Size returns the length of stack
func (s *Stack) Size() int {
	return len(*s)
}

// Empty returns true when stack is empty
func (s *Stack) Empty() bool {
	return s.Size() == 0
}

// NewStack generates stack
func NewStack() *Stack {
	s := new(Stack)
	return s
}


Measured memory_bytes: 1816
#include<bits/stdc++.h>
#include<iostream>
#define LL long long int
using namespace std;
int main()
{
/*	int t;
	cin>>t;
	while(t--)*/
	{
		LL a,b;
		cin>>a>>b;
		cout<<(LL)a*b<<"\n";
	
		
		
	}
}


Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int max = nCk(n-1,2,1000000007);
		if(n==2) {
			if(k==0) {
				System.out.println(1);
				System.out.println("1 2");
			}else {
				System.out.println(-1);
			}
		}
		else if(max<k) System.out.println(-1);
		else {
			StringBuilder sb = new StringBuilder();
			String ls = System.lineSeparator();
			int add_count = max-k;
			sb.append(n-1+add_count);
			sb.append(ls);
			for(int i=2;i<=n;i++) {
				sb.append(1 + " " + i);
				sb.append(ls);
			}
			int l = 2;
			int r = 3;
			for(int i=0;i<add_count;i++) {
				sb.append(l + " " + r);
				sb.append(ls);
				if(r==n) {
					l++;
					r = l+1;
				}else {
					r++;
				}
			}
			System.out.println(sb.toString());
		}
		in.close();

	}

	
	//return a^b mod M O(logB)
	public static long pow(long a,long b,int M) {
		long ret = 1;
		long tmp = a;
		while(b>0) {
			if((b&1)==1) ret = (ret * tmp) % M;
			tmp = (tmp * tmp) % M;
			b = b>>1;
		}
		return ret;
	}
	
	//return nCk mod M (M must be prime number) O(min(k,n-k)*logM)
	public static int nCk(int n,int k,int M) {
		long ret = 1;
		int min = Math.min(k, n-k);
		for(int i=1;i<=min;i++) {
			ret = (ret * pow(i,M-2,M)) % M;
		}
		for(int i=n-min+1;i<=n;i++) {
			ret = (ret * i) % M;
		}
		return (int)ret;
	}
}


Measured memory_bytes: 22740
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);
            var c = int.Parse(_[2]);

            var m = a - b;
            Console.WriteLine(c - m >= 0 ? c - m : 0);
        }
    }
}


Measured memory_bytes: 11220
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int N,i;
	char* s;
	scanf("%d",&N);
	s = (char*)malloc(sizeof(char)*N);
	for(i=0;i<N;i++) scanf(" %c",&s[i]);
	for(i=0;i<N;i++) {
		if(s[i]=='Y'){
			printf("Four\n");
			return 0;
		}
	}
	printf("Three\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt();
        int[] aa = new int[10000];
        aa[1]=1;
        for (int i=2;i<aa.length;i++) {
            aa[i] = aa[i - 1] + i;
//            System.out.println(aa[i]);
        }
        int diff = b-a;
        boolean chk=false;
        int len1=0,len2=0;
        for (int i=2;i<aa.length;i++){
            if(aa[i]-aa[i-1]==diff){
                chk=true;
                len1=aa[i-1];
                len2=aa[i];
                break;
            }
        }
        System.out.print(chk?Math.abs(len2-b):1);
    }
}


Measured memory_bytes: 23764
n = int(input())
INF = 10**18
ans = INF


def F(a, b):
    return max(len(str(a)), len(str(b)))


for i in range(1, int(n**.5)+1):
    if n % i == 0:
        x = F(i, n//i)
        if x < ans:
            ans = x
print(ans)

Measured memory_bytes: 3060
import heapq
N, M = map(int, input().split())
G = [[] for n in range(N)]
for m in range(M):
  a, b, c = map(int, input().split())
  G[a - 1].append([b - 1, c, m])
  G[b - 1].append([a - 1, c, m])
E = [1 for m in range(M + 1)]
def Dijkstra(s):
  L = [[10 ** 7, n, 0] for n in range(N)]
  L[s] = [0, 0, 0]
  Q = []
  heapq.heappush(Q, [0, s, M])
  while Q:
    q = heapq.heappop(Q)
    if L[q[1]][2] == 0:
      L[q[1]][2] = 1
      E[q[2]] = 0
      for adj in G[q[1]]:
        if q[0] + adj[1] < L[adj[0]][0]:
          L[adj[0]][0] = q[0] + adj[1]
          heapq.heappush(Q, [q[0] + adj[1], adj[0], adj[2]])
for n in range(N):
  Dijkstra(n)
print(sum(E))


Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int H, W, N;
	cin >> H >> W >> N;

	map<pair<int, int>, int> MAP;

	rep(i, N) {
		int A, B;
		cin >> A >> B;
		rep(ii, 3) {
			rep(iii, 3) {
				MAP[mp(A + ii - 1, B + iii - 1)]++;
			}
		}
	}

	ll kotae[10] = {};
	ll kazu = 0;
	for (auto itr : MAP) {
		if (itr.first.first > 1 && itr.first.first < H && itr.first.second > 1 && itr.first.second < W) {
			kotae[itr.second]++;
			kazu++;
		}
	}
	kotae[0] = 1ll * (H - 2) * (W - 2) - kazu;

	rep(i, 10) co(kotae[i]);

	Would you please return 0;
}

Measured memory_bytes: 58496
//int x=1;
//string yn[2] = { "Yes","No" };
//int x=1;
//string yn[2] = { "YES","NO" };
// string alp="abcdefghijklmnopqrstuvwxyz";
// string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//総和
/*
int t_sum(int x) {
int sum = 0;
while (x > 0) {
sum += x % 10;
x = x / 10;
}
return sum;
}
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#include <iomanip>
#define MAX_N 100
#define INF 10000000

using namespace std;

string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int n,a,b,c;
string s,t;

void solve(){
	int ans = 0;
	if (a < 105) ans = 0;
	else if (a < 135) ans = 1;
	else if (a < 165) ans = 2;
	else if (a < 189) ans = 3;
	else if (a < 195) ans = 4;
	else ans = 5;
	cout << ans << endl;
}

int main() {
	cin >> a;
	solve();
	return 0;
}


Measured memory_bytes: 256
import numpy as np
input_initial=input().split()
a=int(input_initial[0])
b=int(input_initial[1])
h=int(input_initial[2])
m=int(input_initial[3])

time=60*h+m
a_kakudo=0.5*time
b_kakudo=6*m

if a_kakudo>=b_kakudo:
    kakudo=a_kakudo-b_kakudo
    if kakudo>180:
        kakudo=360-kakudo

else:
    kakudo=b_kakudo-a_kakudo
    if kakudo>180:
        kakudo=360-kakudo

kakudo=2*np.pi*kakudo/360

c=np.sqrt(a**2+b**2-2*a*b*np.cos(kakudo))
float(c)
print(c)

Measured memory_bytes: 27244
s = gets.chomp
n = s.size
if n & 1 == 1 then
    n -= 1
    s.slice!(-1)
else
    s = s[0..(n-3)]
    n -= 2
end

while s[0...(n/2)] != s[(n/2)...n]
    s = s[0..(n-3)]
    n -= 2
end

puts s.size

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

int main(void){
    string s;
    deque<char> ans;
    int q;
    bool hanten=false;
    cin >> s >> q;
    for(char c:s){
        ans.push_back(c);
    }
    rep(i,q){
        int ti,fi;
        char ci;
        cin >> ti;
        if(ti==1){
            hanten=!hanten;
        }else{
            cin >> fi >> ci;
            if(fi==1+(hanten)){
                ans.push_front(ci);
            }else{
                ans.push_back(ci);
            }
        }
    }
    rep(i,ans.size()){
        int idx=hanten?ans.size()-1-i:i;
        cout << ans.at(idx);
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 896
package main

import (
	"fmt"
	"sort"
	"strings"
)

type evaluate struct {
	n     int
	city  *string
	value int
}

type evaluates []evaluate

func (es evaluates) Len() int {
	return len(es)
}

func (es evaluates) Less(i, j int) bool {
	e1 := es[i]
	e2 := es[j]
	cmp := strings.Compare(*e1.city, *e2.city)
	if cmp == -1 {
		return true
	}
	if cmp == 1 {
		return false
	}
	return e1.value > e2.value
}

func (es evaluates) Swap(i, j int) {
	es[i], es[j] = es[j], es[i]
}

func main() {
	var N int
	fmt.Scanf("%d", &N)
	S := make([]string, N)
	P := make([]int, N)
	var es evaluates
	for i := 0; i < N; i++ {
		fmt.Scanf("%s %d", &S[i], &P[i])
		es = append(es, evaluate{
			n:     i + 1,
			city:  &S[i],
			value: P[i],
		})
	}
	sort.Sort(es)
	for _, v := range es {
		fmt.Println(v.n)
	}
}


Measured memory_bytes: 640
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main(){
	int m;
	int max[3] = {0};
	for(int i = 0; i < 10; i++){
		cin >> m;
		if(m > max[0]){
			max[2] = max[1];
			max[1] = max[0];
			max[0] = m;
		}else if(m > max[1]){
			max[2] = max[1];
			max[1] = m;
		}else if(m > max[2]){
			max[2] = m;
		}
	}
	
	cout << max[0] << endl;
	cout << max[1] << endl;
	cout << max[2] << endl;
	
    return 0;
}

Measured memory_bytes: 3048
"""Merge Sort."""

def merge(A, left, mid, right):
    """Merge the two sorted partial sequences A[left:mid] and A[mid:right].

    To count the number of comparisons,
    make a global declaration for the variable cnt.
    """
    L = A[left:mid]
    L.append(10**9 + 1)
    R = A[mid:right]
    R.append(10**9 + 1)
    i = 0
    j = 0
    global cnt
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def mergeSort(A, left, right):
    """Sort elements in list A using Merge Sort algorithm.

    left is the starting index, initially 0.
    right is the value added 1 to the last index, initially the length of A.
    """
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)


n = int(input())
S = list(map(int, input().split()))

cnt = 0

mergeSort(S, 0, n)

print(*S)
print(cnt)

Measured memory_bytes: 63788
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n=0ll,k=0ll,r=0ll;
    cin>>n>>k;
    if(n==k)
        cout<<"0";
    else if(n>k)
    {
        r=n%k;
        cout<<min(r,k-r);
    }
    else
    {
        r=k-n;
        cout<<min(r,n);
    }
    cout<<endl;
}


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

const int N = 2e5 + 5;

typedef class Edge {
	public:
		int u, v, w;
		
		Edge(int u, int v, int w) : u(u), v(v), w(w) {	}

		boolean operator < (Edge b) const {
			return w > b.w;
		}
} Edge;

int n, m;
int uf[N];
priority_queue<Edge> Q;

int find(int x) {
	return uf[x] == x ? x : (uf[x] = find(uf[x]));
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		uf[i] = i;
	}
	for (int i = 1, u, v, w; i <= m; i++) {
		scanf("%d%d%d", &u, &v, &w);
		Q.push(Edge(u, v, w));
		Q.push(Edge((u + 1) % n, v, w + 1));
	}
	long long ans = 0;
	while (!Q.empty()) {
		Edge e = Q.top();
		Q.pop();
		int u = find(e.u), v = find(e.v);
		if (u ^ v) {
			uf[u] = v;
			ans += e.w;
			Q.push(Edge((u + 1) % n, (v + 1) % n, e.w + 2));
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 9072
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip> 
#include <cstring>
#include <queue>
#include <stack> 
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
int n,x,y;
int dis[2005][2005];
int vis[2200];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> x >> y;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			dis[i][j] = dis[j][i] = abs(i - j);
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			dis[i][j] = min(dis[i][j],dis[i][x] + 1 + dis[y][j]);
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = i + 1;j <= n;j++){
			vis[dis[i][j]]++;
		}
	}
	for(int i = 1;i <= n - 1;i++){
		cout << vis[i] << endl;
	}
	return 0;
}

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

const int Maxn = 150;

int N, K, Mod;

inline void add(int &n, int m) {
	n += m;
	if(n >= Mod) n -= Mod;
}

namespace Subtask1 {
	int f[Maxn + 5][Maxn + 5];
	int calc(int n, int k) {
		memset(f, 0, sizeof f);
		f[0][0] = 1;
		for(int i = 1; i <= n; i++) {
			f[i][0] = f[i - 1][0];
			for(int j = 1; j <= k; j++)
				add(f[i][0], f[i - 1][j]), add(f[i][j], f[i - 1][j - 1]);
		}
		int ret = 0;
		for(int i = 0; i <= k; i++)
			add(ret, f[n][i]);
		return ret;
	}
	void Solve() {
		printf("%lld\n", 1LL * calc(N >> 1, K >> 1) * calc(N - (N >> 1), K >> 1) % Mod);
	}
}

namespace Subtask2 {
	int f[Maxn + 5][Maxn + 5][Maxn + 5];
	void Solve() {
		f[0][0][0] = 1;
		for(int i = 1; i <= N; i++) {
			int r = (i << 1), l = r - K;
			bool fl = (1 <= l && l <= N), fr = (1 <= r && r <= N);
			for(int j = 0; j <= N; j++)
				for(int k = 0; k <= K + 1; k++) {
					add(f[i][0][0], f[i - 1][j][k]);
					if(fr) add(f[i][j + 1][0], f[i - 1][j][k]);
					if(fl && k + 1 < K + 2) add(f[i][0][k ? k + 1 : k], f[i - 1][j][k]);
					if(fl && fr && max(j + 2, k + 1) < K + 2)
						add(f[i][j + 1][max(j + 2, k + 1)], f[i - 1][j][k]);
				}
		}
		int ans = 0;
		for(int i = 0; i <= N; i++)
			for(int j = 0; j <= K + 1; j++)
				add(ans, f[N][i][j]);
		printf("%d\n", ans);
	}
}

int main() {
#ifdef LOACL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	scanf("%d %d %d", &N, &K, &Mod);
	if(K % 2 == 0) Subtask1::Solve();
	else Subtask2::Solve();
	return 0;
}

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

unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned count = 0;
  for(unsigned i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void shell_sort(unsigned a[], unsigned n){
  int8_t i;
  uint8_t gap_num = 11;
  while(gaps[--gap_num] > n);

  unsigned count = 0;
  for(i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);

  cout << (gap_num+1) << '\n';

  for(i = gap_num; i; i--) cout << gaps[i] << ' ';
  cout << gaps[0] << '\n';

  cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n,i;
  cin >> n;
  auto a = new unsigned[n];
  for(i = 0; i < n; i++) cin >> a[i];
  shell_sort(a,n);
  for(i = 0; i < n; i++) cout << a[i] << '\n';
  delete[](a);
}

Measured memory_bytes: 4888
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
const LL lm=1LL*mod*mod;

int main(){
    int n,k;
    cin>>n>>k;
    vl h(n+1,0);
    FOR(i,0,n){
        cin>>h[i+1];
    }
    vll dp(n+2,vl(k+2,lm));
    dp[0][0]=0;
    FOR(i,0,n+1){
        FOR(j,0,k+1){
            LL nw=dp[i][j];
            FOR(p,0,k-j+1){
                if(p+1+i>n+1)break;
                if(p+1+i==n+1){
                    dp[p+1+i][j+p]=min(dp[p+1+i][j+p],nw);
                }else{
                    dp[p+1+i][j+p]=min(dp[p+1+i][j+p],nw+max(0LL,h[p+1+i]-h[i]));
                }
            }
        }
    }
    LL ans=lm;
    FOR(i,0,k+1){
        ans=min(ans,dp[n+1][i]);
    }
    cout<<ans;
    



}


Measured memory_bytes: 1024
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(str(input().rstrip('\n')))
    a = collections.Counter(a)
    cnt = 1
    for k, v in a.items():
        cnt = (cnt * (v + 1) % (10 ** 9 + 7))
    print(cnt - 1)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 49392
#include <bits/stdc++.h>
using namespace std;
//typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
//define
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

int main(){
    int n,k;
    cin >> n >> k;
    vi h(n);
    rep(i,n) cin >> h.at(i);
    int ans = 0;
    FOR(i,0,n){
        if(h.at(i) >= k){
            ans++;
        }
    }
    cout << ans << endl;
 return 0;
}

Measured memory_bytes: 640
package main

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

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	var result string
	nums := readIntsFromStdin()[0]
	a, b, c := nums[0], nums[1], nums[2]

	if a < b && b < c {
		result = "Yes"
	} else {
		result = "No"
	}

	fmt.Fprintln(writer, result)
}

// ReadInts parses lines of inputs into 2D int array.
func readIntsFromStdin() [][]int {
	out := [][]int{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var ints []int

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.Atoi(s)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into int.", err)
				os.Exit(1)
			}

			ints = append(ints, i)
		}

		out = append(out, ints)
	}

	return out
}



Measured memory_bytes: 1104
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long n;
	cin >> n;
	long long A[n+1];
	long long B[n];
	for(long long i = 0; i <= n; ++i){
		cin >> A[i];
	}
	for(long long i = 0; i < n; ++i){
		cin >> B[i];
	}
	long long count = 0;
	for(long long i = 0; i < n; ++i){
		if(A[i] + A[i+1] <= B[i]){
			count += A[i] + A[i+1];
			A[i+1] = 0;	
		} 
		else{
			if(A[i] <= B[i]){
				A[i+1] -= B[i] - A[i];
				count += B[i];
			}	
			else{
				count += B[i];
			}
		} 
	}
	cout << count << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
  int H,W,i,j;
  while(1){
  scanf("%d %d",&H,&W);
  if(H==0&&W==0){
    break;
  }
  else{
  for(i=0;i<H;i++)
  {
    for(j=0;j<W;j++){
      printf("#");
    }
    printf("\n");
  }
  printf("\n");
  }}
  return 0;
}


Measured memory_bytes: 2060
package main

// Solution for https://atcoder.jp/contests/abc069/tasks/arc080_a

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n, a0, a2, a4 int
	con.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		con.Scan(&a)
		switch a % 4 {
		case 0:
			a4++
		case 2:
			a2++
		default:
			a0++
		}
	}
	possible := true
	if a0 > a4+1 {
		possible = false
	}
	if a2 > 0 {
		if a0 > a4 {
			possible = false
		}
	}
	if a2 == 1 {
		if a4 == 0 {
			possible = false
		}
	}
	if possible {
		con.Println("Yes")
	} else {
		con.Println("No")
	}
	return nil
}


Measured memory_bytes: 2944
N, T = map(int, input().split())
minCost = 1e99
for i in range(N):
    c, t = map(int, input().split())
    if(t <= T):
        minCost = min(minCost, c)
if(minCost == 1e99):
    print('TLE')
else:
    print(minCost)


Measured memory_bytes: 2940
import collections
n, k = map(int, input().split())
r,s,p = map(int, input().split())
t = list(input())

for j in range(k, len(t)):
    if t[j] == t[j-k]:
        t[j] = ''
ts = collections.Counter(t)
print(ts['p']*s + ts['s']*r + ts['r']*p)

Measured memory_bytes: 4340
A, B, C, X, Y = map(int, input().split())

ans = 10 ** 12
for i in range(10 ** 5 + 1):#2 * i枚のABピザを購入
  money = 2 * i * C
  money += A * max(0, X - i)
  money += B * max(0, Y - i)
  ans = min(ans, money)
  
print(ans)  

Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    int N;
    cin >> N;
    set<string> s;
    rep(i,N){
        string x;
        cin >> x;
        s.insert(x);
    }
    cout << s.size() << endl;
}

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

int mod=1e9+7;

int mpow(ll a,ll b) {
    ll c=1;
    while (b) {
        if (b%2) c=c*a%mod;
        b/=2;
        a=a*a%mod;
    }
    return c;
}

int C(ll a,ll b) {
    ll nume=1;
    for (int i=a;i>a-b;i--)
        nume=nume*i%mod;
    ll deno=1;
    for (int i=2;i<=b;i++)
        deno=deno*i%mod;
    return nume*mpow(deno,mod-2)%mod;
}

int main() {
    int x,y;cin>>x>>y;
    int a=(x+y)/3;
    int b=x-a;
    int c=y-a;
    if ((x+y)%3!=0||b<0||c<0) {
        cout<<0<<endl;
        return 0;
    }
    cout<<C(b+c,b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){

    long long  cnt = 0;
    long long  t;

    while(1){
        cin>>t;
        if(t == 0) break;
        else cout<<"Case "<<cnt+1<<": "<<t;
        cout<<"\n";
        cnt++;
    }
    return 0;
}


Measured memory_bytes: 3088
n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)
b = [a[i]*f[i] for i in range(n)]

def judgement(x):
    judge = -1
    cnt = 0
    for i in range(n):
        if b[i]>x:
            cnt += -((x-b[i])//f[i])
        if cnt > k:
            judge = False
            break
    if cnt <= k:
        judge = True
    return judge

low=0
high=max(b)
while low<high:
    mid = (low + high)//2
    if judgement(mid) == False:
        low=mid+1
    else:
        high=mid
print(low)

Measured memory_bytes: 121036
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    int problems_count;
    int drinks_count;
    vector<int> solve_times;

    int solve_time_sum = 0;

    cin >> problems_count;

    for(int i = 0; i < problems_count; i++){
        int t;
        cin >> t;

        solve_times.push_back(t);
        solve_time_sum += t;
    }

    cin >> drinks_count;

    for(int i = 0; i < drinks_count; i++){
        int problem_num;
        int alter_time;

        cin >> problem_num >> alter_time;

        cout << solve_time_sum - solve_times[problem_num - 1] + alter_time << endl;
    }

    return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


void solve(ll N, ll K, vector<ll> A, vector<ll> B) {
    ll ans = 0;
    for (int i = 31; i >= 0; i--) {
        if (K >> i & 1) {
            ll L = K ^ (1 << i) | ((1 << i) - 1);

            ll sub = 0;
            for (int k = 0; k < N; k++) {
                if ((L | A[k]) == L) {
                    sub += B[k];
                }
            }
            ans = max(ans, sub);
        }
    }
    {
        ll sub = 0;
        for (int k = 0; k < N; k++) {
            if ((K | A[k]) == K) {
                sub += B[k];
            }
        }
        ans = max(ans, sub);
    }
    cout << ans << endl;
}


void main_(istream &cin) {
    ll K;
    ll N;
    cin >> N;
    vector<ll> A(N - 1 + 1);
    vector<ll> B(N - 1 + 1);
    cin >> K;
    for (int i = 0; i <= N - 1; i++) {
        cin >> A[i];
        cin >> B[i];
    }
    solve(N, K, A, B);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <bitset>
#include <math.h>

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

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;

int main()
{
    char decimal;
    ll A, B_int;
    ld B_frac;

    std::cin >> A >> B_int >> decimal >> B_frac;
    print(std::fixed << (ll)(A * (B_int*100 + B_frac) / 100));
    return 0;
}

Measured memory_bytes: 3684
S = input()
N = len(S)
for k in range(0, (N-1)//2):
  if S[k] == S[(N-1)//2 - k -1] == S[(N-1)//2 + k + 1] == S[-k-1]:
    continue
  else:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 9124
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>    // std::reverse
#include <vector>       // std::vector

using namespace std;


int main(){

  string s ;

  cin >> s;
  if(s.length() == 2){
  	cout << s << endl;
  }else{
  	reverse(s.begin(),s.end());
  	cout << s << endl;
  }

}

Measured memory_bytes: 764
import java.util.*;

public class Main {
  static int n;
  static ArrayList[] e;
  static int[] d1;
  static int[] d2;
  static ArrayList<Integer> g = new ArrayList<Integer>();
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int u = sc.nextInt() - 1;
    int v = sc.nextInt() - 1;
    d1 = new int[n];
    d2 = new int[n];
    e = new ArrayList[n];
    for(int i = 0; i < n; i++) {
      e[i] = new ArrayList<Integer>();
    }
    for(int i = 0; i < n - 1; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      e[a].add(b);
      e[b].add(a);
    }

    dfs1(u, -1);
    dfs2(v, -1);

    int ans = 0;

    for(int i = 0; i < n; i++) {
      if(d1[i] < d2[i]) {
        ans = Math.max(ans, d2[i] - 1);
      }
    }

    int p = 0;
    int p1 = 0;

    for(int i = 0; i < e[u].size(); i++) {
      int t = (int)e[u].get(i);
      if(t == v) {
        p1 = 1;
      } else {
        p = 1;
      }      
    }

    if((p == 0) && (p1 == 1)) ans = 0;
    System.out.println(ans);
  }

  public static void dfs1(int v, int p) {
    int t = 0;
    ArrayList<Integer> list = e[v];
    for(int i = 0; i < list.size(); i++) {
      int s = list.get(i);
      if(s != p) {
        t++;
        d1[s] = d1[v] + 1;
        dfs1(s, v);
      }
    }
    if(t == 0) g.add(p);
  }

  public static void dfs2(int v, int p) {
    ArrayList<Integer> list = e[v];
    for(int i = 0; i < list.size(); i++) {
      int s = list.get(i);
      if(s != p) {
        d2[s] = d2[v] + 1;
        dfs2(s, v);
      }
    }
  }  
}

Measured memory_bytes: 113016
using System;

class ABC_142_B
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);

        int ans = 0;
        string[] input2 = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++)
        {
            int h = int.Parse(input2[i]);
            if (h >= K) ans++;
        }

        Console.WriteLine(ans);
    }
}


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

int main() {
  int n; int ans; string S; int x=0;int y=0;
  cin >> S;
  n=S.size();
  for(int i=0;i<n;i++){
   if(i%2==0&&S.at(i)=='0'){x++;
                         }
   else if(i%2==1&&S.at(i)=='1'){x++;
                              }
   else if(i%2==0&&S.at(i)=='1'){y++;
                              }
   else if(i%2==1&&S.at(i)=='0'){y++;
                              }
  }
  if(x>=y){
  ans=n-x;
  }
  else{
  ans=n-y;
  }
  //cout << x <<y<<n << endl;
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
      ll a,b;
      cin >> a >> b;
      if(a*b%2==0)
      cout <<"No"<< endl;
      else
      {
          cout << "Yes" << endl;
      }
      
      

  }


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

int main() {
    set<int> a, b;
    a.insert(4);
    a.insert(6);
    a.insert(9);
    a.insert(11);
    b.insert(1);
    b.insert(12);
    b.insert(3);
    b.insert(5);
    b.insert(7);
    b.insert(8);
    b.insert(10);
    int x, y;
    cin >> x >> y;
    if (x == 2 || y == 2) {
        cout << "No" << endl;
    }
    else if ((a.count(x) && a.count(y)) || b.count(x) && b.count(y)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

typedef long long ll;
const ll mod = 1000000007;
int n, m;

ll fac(int n)
{
    ll res = 1;

    for (int i = 1; i <= n; i++)
    {
        res = res * i % mod;
    }

    return res;
}

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

    if (abs(n - m) > 1)
    {
        cout << 0 << endl;
        return 0;
    }

    ll ans = fac(n) * fac(m);

    if (n == m)
    {
        ans *= 2;
    }

    ans %= mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    A, B, C = mis()
    K = ii()
    q = []
    q.append((A, B, C))
    nq = []
    for _ in range(K+1):
        while q:
            a, b, c = q.pop()
            if a < b < c:
                print(Yes)
                return
            nq.append((a*2, b, c))
            nq.append((a, b*2, c))
            nq.append((a, b, c*2))
        nq, q = q, nq
    print(No)





main()



Measured memory_bytes: 9992
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		sc.close();

		BigDecimal three = new BigDecimal("3");
		BigDecimal bigL = new BigDecimal(String.valueOf(l));
		BigDecimal len = bigL.divide(three, 8, RoundingMode.HALF_UP);

		BigDecimal answer = len.multiply(len).multiply(len);

		print(answer);
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int x;
	while(1){
		int count = 0;
		cin>>x;
		if(x == 0) break;
		while(x != 1){
			if(x%2==0) x /= 2;
			else	   x = 3*x+1;
			count++;
		}
		cout<<count<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160