akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
         
        int n = sc.nextInt();
        int m = sc.nextInt();
        NodeList[] bs = new NodeList[m];
        for(int i=0;i<m;i++){
        	bs[i] = new NodeList();
        }
        
        int[] p = new int[m];
        
        for(int i=0;i<m;i++){
        	int k = sc.nextInt();
        	for(int j=0;j<k;j++){
        		bs[i].add(sc.nextInt()-1);
        	}
        }
        
        
        for(int i=0;i<m;i++){
        	p[i] = sc.nextInt();
        }
        
        int num = 0;
        
        for(int S = (1<<n)-1;S>=0;S--){
        	int bnum = 0;
        	for(int i=0;i<m;i++){
        		int sum = 0;
        		for(int b:bs[i]){
        			if((S>>b & 1) == 1){
        				sum += 1;
        			}
        		}
        		if(sum%2 == p[i]){
        			bnum += 1;
        		}
        	}
        	if(bnum == m){
        		num += 1;
        	}
        }
        
        System.out.println(num);
        
    }

}

class NodeList extends ArrayList<Integer>{
	private static final long serialVersionUID = -4461479015945373120L;
}

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

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define rep(I, N) for (int I = 1; I <= (N); ++I)
#define repp(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORR(I, A, B) for (int I = (A); I >= (B); I--)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
const int N = 2e5 + 5;
const double eps = 1e-7;
const int mod = 1e9 + 7;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
LL gcd(LL a,LL b){return b>0?gcd(b,a%b):a;}
LL ksm(LL a,LL b){LL ans = 1;while(b){if(b&1) ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans % mod;}
int a[N],b[N];
int main()
{
    int n;
    cin >> n;
    //int maxn = 0;
    for (int i = 1; i <= n;i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b + 1,b + 1 + n);
    int _ = b[n];
    int cnt = 0;
    for (int i = 1;i <= n;i++)
    {
        if(a[i] == _)
            cnt++;
    }
    int __ = b[n - 1];
    for (int i = 1; i <= n;i++)
    {
        if(a[i] != _)
            cout << _ << endl;
        else
            cout << __ << endl;
    }

    return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;
//typedef pair<double, P> T;

const ll mod = 1000000007;
const ll INF = 100000010000;

ll N, x[100010], sum[100010];

ll ans;

ll gcd(ll x, ll y)
{
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2 == 1)
	{
		return x * pow_mod(x, y - 1) % mod;
	}
	else
	{
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x)
{
	return pow_mod(x, mod - 2);
}

void init()
{
	
}

void output()
{
	//cout << ans << endl;
}



void solve()
{
	ll a, b, k;
	cin >> a >> b >> k;
	if (a >= k)
	{
		cout << a - k << ' ' << b << endl;
	}
	else
	{
		cout << 0 << ' ' << max((ll)0, b - (k - a)) << endl;
	}
}

int main()
{
	init();
	
	solve();

	

	output();
	ll N;
	cin >> N;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	string S;
	cin >> S;
	
	string ans = "Yes";
	rep(i, S.size()) {
		if(i%2==0) { // 奇数文字目
			if(S[i]=='L') {
				ans = "No";
				break;
			}
		} else {
			if(S[i]=='R') {
				ans = "No";
				break;
			}
		}
	}

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

Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]

r = 0
ref = 0
ans = 0
for l in range(N):
    while r < N and ref & A[r] == 0:
        ref ^= A[r]
        r += 1

    ans += r - l

    if r == l:
        r += 1
    else:
        ref ^= A[l]

print(ans)

Measured memory_bytes: 23560
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

// 解答
function main(inputs:Array<string>) : void {

    let count: number = Number(inputs[0].split(' ')[0]);
    let numList: number[] = inputs[1].split(' ').map(Number);

    for (let num of numList) {

        if (num % 2 == 0
            && ((num % 3 != 0) && (num % 5 != 0))) {

            return console.log('DENIED');
        }
    }

    return console.log('APPROVED');
}


Measured memory_bytes: 7500
#include <iostream>
#include <stdio.h>
#include <cfenv>
#include <cmath>
using namespace std;
int main(void){
	cin.tie(0);
   	ios::sync_with_stdio(false);

	double a,b,c;
	cin >> a>>b;
	c=(a+b)/2;
	if(ceil(c) == floor(c)){
	    cout << (int)c<<"\n";
	}else{
	    cout << "IMPOSSIBLE" <<"\n";
	}

}

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

int main() {
    int p,q,r;
    cin >> p >> q >> r;

    int ans = 0;
    if (p >= q && p >= r)
    {
        ans = q+r;
    }
    if (q >= p && q >= r)
    {
        ans = p+r;
    }
    if (r >= p && r >= q)
    {
        ans = p+q;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    map<int, bool> schedule[52];
    for (int i = 0; i < n; i++) {
      int t;
      cin >> t;
      for (int j = 0; j < t; j++) {
        int x;
        cin >> x;
        schedule[i][x] = true;
      }
    }

    map<int, bool> dp[32][52];

    int ans = -1;

    for (int i = 0; i < n; i++) {
      dp[0][i][i] = true;
    }

    for (int i = 1; i <= 31; i++) {
      map<int, bool> g;
      for (int j = 0; j < n; j++) {
        if (schedule[j][i]) {
          g[j] = true;
          for (auto e : dp[i - 1][j]) {
            g[e.first] = true;
          }
        }
      }
      for (int j = 0; j < n && ans == -1; j++) {
        if (schedule[j][i]) {
          for (auto e : dp[i - 1][j]) {
            dp[i][j][e.first] = true;
          }
          for (auto e : g) {
            dp[i][j][e.first] = true;
          }
          int cnt = dp[i][j].size();
          if (cnt == n) {
            ans = i;
            break;
          }
        } else {
          dp[i][j] = dp[i - 1][j];
        }
      }
      if (ans != -1) {
        break;
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 6592
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,c,k; cin >> n >> c >> k;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    sort(all(t));
    ll num = 0;
    ll num_t = 0;
    ll time = -1;
    ll time_min = t[0];
    ll ans = 0;
    rep(i,n){
        if(t[i] == time_min + k){
            num_t++;
            while(t[i] >= time_min + k){
                num += min(c,num_t);
                num_t -= min(c,num_t);
                time_min = t[num];
                ++ans;
                // debug(num_t);
            }
        }
        else if(t[i] > time_min + k){
            while(t[i] >= time_min + k){
                num += min(c,num_t);
                num_t -= min(c,num_t);
                time_min = t[num];
                ++ans;
            }
            num_t++;
        }
        else num_t++;
        // debug(i);
        // debug(ans);
    }
    while(num_t > 0){
        num_t -= min(c,num_t);
        ++ans;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
import math

n, a, b = map(int, input().split())
hList = [int(input()) for _ in range(n)]

def check(x):
    defaultDamage = b * x
    cnt = 0
    for h in hList:
        if h > defaultDamage:
            cnt += math.ceil((h - defaultDamage) / (a - b))
    return cnt <= x

left = 0
right = 10 ** 9
while abs(right - left) > 1:
    center = (left + right) // 2
    if check(center):
        right = center
    else:
        left = center
print(right)

Measured memory_bytes: 7068
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int d = sc.nextInt();
        int n = sc.nextInt();
        int ans = 0;
        
        if(d==0 && n!=100) {
		    ans = n;
		}else if(d==0 && n==100) {
			ans = n+1;
		}
		if(d==1 && n!=100) {
			ans = n*100;
		}else if(d==1 && n==100) {
			ans = (n+1)*100;
		}
		if(d==2&& n!=100) {
		    ans = n*10000;
		}else if(d==2 && n==100) {
			ans = (n+1)*10000;
		}
        
		System.out.println(ans);
    }
}


Measured memory_bytes: 35604
package main

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

func main() {

	nextReader = newScanner()

	s := nextString()

	if s[2] == s[3] && s[4] == s[5] {
		fmt.Println("Yes")
		return
	}

	fmt.Println("No")

}

/* --------------------------------------------------------------------------
 *  std.io
 * ------------------------------------------------------------------------- */
var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

/* --------------------------------------------------------------------------
 *  memo
 * ------------------------------------------------------------------------- */


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

public class Main {

	static long[] bottles = new long[4];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        long Q = Integer.parseInt(sc.next());
		long H = Integer.parseInt(sc.next());
		long S = Integer.parseInt(sc.next());
		long D = Integer.parseInt(sc.next());
		long N = Integer.parseInt(sc.next());

		long[] price = {Q*8, H*4, S*2, D};
		Arrays.sort(price);

		double rest = N;

		for(int i = 0; i < price.length; i++) {
			if(price[i] == Q*8) {
				bottles[0] = (long) (rest / 0.25);
				rest -= 0.25 * bottles[0];
			}else if(price[i] == H*4) {
				bottles[1] = (long) (rest / 0.5);
				rest -= 0.5 * bottles[1];
			}else if(price[i] == S*2) {
				bottles[2] = (long) rest;
				rest -= bottles[2];
			}else {
				bottles[3] = (long) (rest / 2);
				rest -= 2 * bottles[3];
			}
		}

		long total = bottles[0] * Q + bottles[1] * H + bottles[2] * S + bottles[3] * D;

		System.out.println(total);

		sc.close();
	}

}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

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

  int ans = 1;
  for(int i=1; i*i<=m; i++){
    if(m%i==0){
      if(i >= n) ans = max(ans, m/i);
      if(m/i >= n) ans = max(ans, i);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------

int main(void)
{
  int k;
  int a,b;
  scanf("%d", &k);
  scanf("%d %d",&a, &b );
  for (size_t i = a; i <= b; i++) {
    if (i % k == 0) {
      printf("OK\n" );
      return 0;
    }
  }
  printf("NG\n" );
  return 0;
}


Measured memory_bytes: 1660
n,y = gets.split().map(&:to_i)
ans = ["-1 -1 -1"]

for a in 0..n do
  for b in 0..n-a do
    c = n - a - b
    if a * 10000 + b * 5000 + c * 1000 == y
      ans[0] = "#{a} #{b} #{c}"
    end
  end
end
puts ans

Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstdlib>
#include <ctime>
#include <deque>
using namespace std;

#define P 1000000007
int n, m;
long long dp[310][310][310], dp1[310][310];

void up(long long &x, long long y) {
	x = (x + y) % P;
}

int main() {
	scanf("%d%d", &n, &m);
	dp1[0][1] = 1;
	for (int i = 1; i <= m; i++) {
		for (int j = 0; j <= n; j++)
			for (int p = 0; j + p <= n; p++)
				if (dp[i - 1][j][p]) {
					up(dp[i][j][p], 1LL * dp[i - 1][j][p] * j % P);
					up(dp[i][0][j + p], 1LL * dp[i - 1][j][p] * p % P);
					up(dp[i][j + 1][p], 1LL * dp[i - 1][j][p] * (n - j - p) % P);
				}
		for (int j = 1; j <= n; j++)
			if (dp1[i - 1][j]) {
				if (j < n) {
					up(dp1[i][j + 1], dp1[i - 1][j] * (n - j) % P);
				}
				up(dp1[i][j], dp1[i - 1][j] * (j - 1) % P);
				up(dp[i][0][j], dp1[i - 1][j]);
			}
	}
	cout << dp[m][0][n] << endl;
}

Measured memory_bytes: 110848
import sys

input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

cnt = [0] * N

for a in A:
    cnt[a - 1] += 1

combination = [0] * N

for a in A:
    combination[a - 1] = cnt[a - 1] * (cnt[a - 1] - 1) // 2

total = sum(combination)

for a in A:
    c = combination[a - 1]
    b = cnt[a - 1]
    ans = total - c + c * (b - 2) // b
    print(ans)


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

int main() {
    int n;
    cin >> n;
    vector<int> num(n);
    vector<int> b(n);
    vector<int> c(n - 1);
    rep(i, n) {
        cin >> num[i];
        num[i]--;
    }
    rep(i, n) {
        cin >> b[i];
    }
    rep(i, n-1) {
        cin >> c[i];
    }
    int sum = b[num[0]];
    for (int i = 1; i < n; i++)
    {
        sum += b[num[i]];
        if(num[i - 1] + 1 == num[i])  {
            sum += c[num[i - 1]];
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main()
{
	string s;
	cin >> s;
	map<int, int> d;
	int h = 0, m;
	d.insert(make_pair(h, 0));
	for (auto c : s) {
		h ^= 1 << c - 'a';
		m = -1;
		for (int i = 0; i < 26; i++) {
			auto it = d.find(h ^ 1 << i);
			if (it != d.end() && (m < 0 || it->second < m))
				m = it->second;
		}
		auto r = d.insert(make_pair(h, m + 1));
		if (r.second)
			continue;
		if (r.first->second > m)
			r.first->second = m + 1;
		else
			m = r.first->second;
	}
	cout << m + 1 << endl;
	return 0;
}


Measured memory_bytes: 9860
<?php
list($a,$b,$c)=explode(" ",trim(fgets(STDIN)));
echo min(abs($b-$a)+abs($c-$b),abs($c-$a)+abs($b-$c),abs($a-$b)+abs($c-$a),abs($c-$b)+abs($a-$c),abs($b-$c)+abs($a-$b),abs($a-$c)+abs($b-$a));

Measured memory_bytes: 4856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string a;
    string b;
    cin>>a>>b;
    bool ok = true;
    for(int i = 0 ; i<a.length() ; i++){
        if(a[i]!=b[i]){
            ok = false;
            break;
        }
    }
    if(ok){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}
// 11 3 , 10 6 , 10 3 , 11 6

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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  vector<int> to(26, n + 1);
  vector<int> dp(n + 2), way(n + 2), alpha(n + 2);
  for (int i = n; i >= 0; i--) {
    dp[i] = n + 10;
    for (int c = 0; c < 26; c++) {
      int nx = to[c]; 
      if (1 + dp[nx] < dp[i]) {
        dp[i] = 1 + dp[nx];
        way[i] = nx;
        alpha[i] = c;
      }
    }
    if (i > 0) {
      to[int(s[i - 1] - 'a')] = i;
    }
  }
  string ans;
  int p = 0;
  while (p != n + 1) {
    ans += char(alpha[p] + 'a');
    p = way[p];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2964
readlines.each do |l|
  s = []
  l.split.each do |i|
    if %w(+ - * /).include?(i)
      a,b = s.pop(2)
      s.push(a.send(i, b))
    else
      s.push(i.to_f)
    end
  end
  puts sprintf("%.6f", s.pop)
end

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

typedef vector<int > vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
#define sz(a)  int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define forn(i,n) for(int i=0;i<n;++i)
#define foru(i,n) for(int i=1;i<=n;++i)
#define fortr(i,v) for(auto &i:v)
#define set(n) __builti
#define ll long long

int main()
{
	int n;
	cin>>n;
	float y=n+.99999999999;
	int x=y/1.08;
	if((int)(x*1.08)==n)
		cout<<x<<endl;
	else cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  SORT(a);
  bool ans = true;

  for (int i = 0; i < n - 1; i++) {
    if (a[i] == a[i + 1]) ans = false;
  }
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int n;
    
    cin >> n;
    
    for(int i=1; i<=n; i++){
        
        if(n*100/100==i*108/100){
            
            cout << i << endl;
            return 0;
            
        }
        
    }
    
    cout << ":(" << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	
	vector<int> arr(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> arr[i];
	}

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

	int ans = 0;
	for (int i = 0; i < k; ++i)
	{
		ans += arr[i];
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    if(a == 0){
        cout << (b / x + 1) << endl;
        return 0;
    }
    cout << (b / x - (a - 1) / x) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for(int i = 0; i < 30; i++){
        for(int j = 0; j < 20; j++){
            if(i * 4 + j * 7 == n){
                cout << "Yes" << '\n';
                return 0;
            }
        }
    }
    cout << "No" << '\n';
}


Measured memory_bytes: 256
N, A, B = [int(i) for i in input().split()]
count = 0

for i in range(1, N+1):
    str_num = str(i)
    if i < 10:
        if i >= A and i <= B:
            count += i
    elif i < 100:
        sum_num = int(str_num[0]) + int(str_num[1])
        if sum_num >= A and sum_num <= B:
            count += i
    elif i < 1000:
        sum_num = int(str_num[0]) + int(str_num[1]) + int(str_num[2])
        if sum_num >= A and sum_num <= B:
            count += i
    elif i < 10000:
        sum_num = int(str_num[0]) + int(str_num[1]) + int(str_num[2]) + int(str_num[3])
        if sum_num >= A and sum_num <= B:
            count += i
    else:
        if 1 >= A and 1 <= B:
            count += i

print(count)
        

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
const int MAX = 510000;
const ll MOD = 1000000007LL;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {// テーブルを作る前処理
	fac[0] = fac[1] = 1LL;
	finv[0] = finv[1] = 1LL;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

long long COM(int n, int k){ // 二項係数:nCk計算
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	int n;
	COMinit();
	int ans=0;
	cin >>n;
	map<int,int>dis;
	int bef;
	int st=0;
	int en=0;
		rep(i, n + 1)
	{
		cin>>bef;
		dis[bef]+=0;
		if(dis[bef]!=0){
			st=dis[bef]-1;
			en=i;
		}else{
			dis[bef]=i+1;
		}
	}
	clog<<st<<" "<<en<<endl;
	clog<<(n+1-en+st)<<endl;
	rep(i,n){
		//if(i==0){
		//	cout<<n<<endl;
		//}else{
			// all , end, begin , inter
			//find : (n+1)C(i) - ((n+2)-en + st)C(i-1)
		//	clog<<COM(n+1,i+1)<<" "<<COM(n-en+st,i)<<" -- "<<endl;
			cout<<(COM(n+1,i+1)-COM(n+st-en,i)+MOD)%MOD<<endl;
		//}

	}
	cout<<1<<endl;
}
/*
1 2 1 3

1 2 3 

11 12 13
21 23

113 121 123 213

1 2 1 3

(1,2,3)
0 0 0 3
0 0 1 1
1 0 1 2
1 1 1 1
1 2 1 init

n, = 3
(n+1)C2 - (doubel second) (atC2) = 4*3/2 - 2*1/2 = 6-1
(n+1)C3
(n+1)C4

1231456

32 (2, -2)
33 -1
528 -3 (2C1+1C1)    ((4-1)C(2-1)=3)
5456-3(2C2-(1C1*2C1))  ((4-1)C(3-1) =3)
40920 -1((4-1)C(4-1)=1)
find : (n+1)C(i) - ((n+2)-en + st)C(i-1)

1 2 1 3

4 -1 ((2-1)C)1-1))
6 -1 ((2-1)C(2-1))
4 -0
1 -0
*/

Measured memory_bytes: 17792
from math import sqrt

A,B = map(int,input().split())

def gcd(a,b):
    if a < b:
        a,b = b,a
    while a % b != 0:
        r = a % b
        a,b = b,r
    return b

def count_prime(n):
    #nを割り切る素数の個数
    if n == 1:
        return 0
    n_is_prime = True
    P = []
    for i in range(2,int(sqrt(n))+1):
        if n % i == 0:
            n_is_prime = False
            P.append(i)
            while n % i == 0:
                n //= i
    if n_is_prime:
        return 1
    elif n == 1:
        return len(P)
    else:
        #この時点で割り切れずに残ったnは未発見の素数
        return len(P)+1

g = gcd(A,B)
c_p = count_prime(g)
print(c_p+1)


Measured memory_bytes: 3064
#include <iostream>

int getValue(int size, int w)
{
	int vs;
	if (size <= 60) vs = 0;
	else if (size <= 80) vs = 1;
	else if (size <= 100) vs = 2;
	else if (size <= 120) vs = 3;
	else if (size <= 140) vs = 4;
	else if (size <= 160) vs = 5;
	else vs = 6;
	int vw;
	if (w <= 2) vw =0;
	else if (w <= 5) vw = 1;
	else if (w <= 10) vw = 2;
	else if (w <= 15) vw = 3;
	else if (w <= 20) vw = 4;
	else if (w <= 25) vw = 5;
	else vw = 6;
	int v = std::max(vs, vw);
	switch (v) {
	case 0:
		return 600;
	case 1:
		return 800;
	case 2:
		return 1000;
	case 3:
		return 1200;
	case 4:
		return 1400;
	case 5:
		return 1600;
	default:
		return 0;
	}
}

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n==0) break;
		int res = 0;
		for (int i=0; i<n; i++) {
			int x, y, h, w;
			std::cin >> x >> y >> h >> w;
			res += getValue(x+y+h, w);
		}
		std::cout << res << std::endl;
	}
	return 0;
}



Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#pragma GCC optimize "trapv"
#define endl '\n'
#define fi first
#define sec second
#define pb push_back 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INF INT_MAX
#define LINF LONG_LONG_MAX
void solve(){
	int n;
	cin>>n;
	int count=0;
	for(int i=1;i<=n;i++){
		int num;
		cin>>num;
		if(i%2==1 && num%2==1){
			count++;
		}
	}
	cout<<count<<endl;
	return;
}
int main(){
	fio;
    int test;
    //cin>>test;
    test=1;
    while(test--){
        solve();
    }
    return 0;
}


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


string S;


void input() {
    cin >> S;
}


int main() {
    input();
    string ans = "No";
    if (S[2] == S[3] && S[4] == S[5]) ans = "Yes";
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <sstream>
#include <cassert>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <ctime>

using namespace std;

#define en '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;

const int INF = 1e9 + 7;
const ll INFLL = 1e18;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int MAX_SIZE = 5e5;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

bool IS_ONE_TEST = 1;
ld START_TIME, TIME;

void fast_in_out() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

void solve() {
    ll n;
    string ans;
    cin >> n;
    while (n > 0) {
        --n;
        ans += ('a' + n % 26);
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << en;
}

int main() {
    START_TIME = clock();
    fast_in_out();
    int TESTS = 1;
    if (!IS_ONE_TEST) cin >> TESTS;
    while (TESTS--) { solve(); }
#ifdef __APPLE__
    TIME = (clock() - START_TIME) / CLOCKS_PER_SEC;
    cerr << en << TIME * 1000 << " ms." << en;
#endif
    return 0;
}

/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 3080
#include <stdio.h>

int main()
{
	int N,K,X,Y,a;
	scanf("%d%d%d%d",&N,&K,&X,&Y);
	if(N>K)
	{
	  	a=K*X+(N-K)*Y;
		printf("%d",a);
	}
	else
	{
		a=N*X;
		printf("%d",a);
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
int main() {
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int a, b;

	scanf("%d %d", &a, &b);

	int n;

	n = b - a;
	int stack = 0;
	for (int i = 1; i <= n; i++) {
		stack += i;
	}
	printf("%d", stack - b);
	
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
    int n,k; cin >> n >> k; vector <ll> h(n);
    for (int i=0;i<n;i++)
    {
        sll(h[i]);
    }
    vector<ll> dp(n,MAX);
    dp[0]=0;
    for (int i=0;i<n;i++)
    {
        for (int j=i+1;j<=i+k;j++)
        {
            if (j<n)
            {
                dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
            }
        }
    }
    cout << dp[n-1];
    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int arr[(int)10e5+1]={0};

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int x,y;cin>>x>>y;
    if (x==2||y==2)cout<<"No"<<endl;
    else if (x==4||x==6||x==9||x==11){
        if (y==4||y==6||y==9||y==11){
            cout<<"Yes"<<endl;
        }else cout<<"No"<<endl;
    }else if (y==1||y==3||y==5||y==7||y==8||y==10||y==12)cout<<"Yes"<<endl;
    return 0;
}

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

int main(){
    
    double x1,x2,x3,y1,y2,y3,xp,yp,A,B,C;
    double s,t;
    
    while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        A=(x2-x1)*(y3-y1) - (x3-x1)*(y2-y1);
        B=(xp-x1)*(y3-y1) - (x3-x1)*(yp-y1);
        C=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        
        s=B/A;
        t=C/A;
        
        if(s>0 && t>0 && 0<s+t && s+t<1)
            printf("YES\n");
        else
            printf("NO\n");
        
    }
    return 0;
    
}

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

int main(){
    long N, A, B, C, D, E;
    cin >> N >> A >>  B >> C >>  D >> E;
    long MIN = min({A, B, C, D, E});
    cout << 5 + (N -1) / MIN << endl;
    
    return 0;
}


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

int main()
{
  ll N,K;cin>>N>>K;
  vector<ll> H(N+1);
  for (ll i=1;i<=N;i++)
  {
    cin>>H[i]; 
  }
  sort(H.begin()+1,H.end(),greater<int>());
  
  ll ans=0;
  for (ll i=K+1;i<=N;i++)
    ans += H[i];
  
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

int main(int argc, char *argv[])
{
	int x, a, b;
	cin >> x >> a >> b;

	cout << (x - a) % b << endl;

	return 0;
}


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

def main():
    vote_list=[]
    n,m = map(int,input().split())
    vote_list=list(map(int,input().split()))
    ans=0

    for i in vote_list:
        if i >= sum(vote_list)/(4*m):
            ans+=1

    if ans>=m:
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()

Measured memory_bytes: 9184
N = int(input())
H = list(map(int, input().split()))

maxdayo = 0
answer="Yes"
for i in range(1, N):
  m = H[i - 1] - H[i]
  if m <= 0:
    continue
  elif H[i] < maxdayo:
    answer="No"
    break
  elif m == 1:
    H[i - 1] -= 1
    maxdayo = max(maxdayo, H[i - 1])
  else:
    answer="No"
    break

print(answer)


Measured memory_bytes: 14396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int e = sc.nextInt();
			if (e == 0) {
				break;
			}
			int ans = e;
			for (int z = 0; z * z * z <= e; z++) {
				int t = e - z * z * z;
				if (t < 0) break;
				for (int y = 0; y <= t; y++) {
					int x = t - y * y;
					if (x < 0) break;
					ans = Math.min(ans, x + y + z);
				}
			}
			System.out.println(ans);
		}
	}

}




Measured memory_bytes: 34072
from fractions import gcd
a,b,c,d = map(int,input().split())
e = c*d//gcd(c,d)
s = b-a+1
def count(z,x=a,y=b):
  if x%z == 0 and y%z == 0:
    return y//z-x//z+1
  elif x%z == 0:
    return y//z-x//z+1
  elif y%z == 0:
    return y//z-x//z
  else:
    return y//z-x//z
t = count(c)
u = count(d)
v = count(e)
print(s-t-u+v)

Measured memory_bytes: 5052
#include <bits/stdc++.h>
#define for0(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;




int main()
{
  int k, n,maxi=0 ;
  cin >>k >> n ;
  vector <int > a(n) ;
  for0(i,n)   cin >> a[i] ;
  a.push_back( a[0]+k );
  for0(i,n){
    maxi = max(maxi,a[i+1]-a[i]) ;
  }
  cout << k- maxi ;

  return 0 ;
}


Measured memory_bytes: 1792
import std.stdio, std.string, std.conv;
import std.algorithm, std.math;

void main() {
	auto input = getStdin!(string[]);
	
	foreach (line; input) {
		if (line == "0") break;
		line.map!(to!(string)).map!(to!(int)).reduce!"a + b".writeln;
	}
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

Measured memory_bytes: 2424
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint as pp
from pprint import pformat as pf

def solve():
    k = int(input())
    a, b = map(int, input().split())
    v = k
    while not (v > b):
        if a <= v <= b:
            print("OK")
            return 0
        v += k
    print("NG")
    return 0


if __name__ == '__main__':
    solve()


Measured memory_bytes: 71532
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d,ans;
    while(cin>>a>>b>>c>>d)
    {
        ans = 0;
        if(c<=b&&c>=a&&d>=b){
            ans = b - c;
        }
        if(a<=d&&c<=a&&b>=d){
            ans = d - a;
        }
        if(a<=c&&d<=b){
            ans = d - c;
        }
        if(c<=a&&b<=d){
            ans = b-a;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,a[3];cin>>n>>a[0]>>a[1]>>a[2];
  vector<string> vs;
  vector<char> v;
  for(int i=0;i<n;i++){ string t; cin>>t; vs.push_back(t); }

  for(int i=0;i<n;i++){
    string s=vs[i]; 
    if(a[s[0]-'A']==0 && a[s[1]-'A']==0){
      cout<<"No"<<endl;
      return 0;
    }else if(a[s[0]-'A']==0){
      a[s[0]-'A']++;
      a[s[1]-'A']--;
      v.push_back(s[0]);
    }else if(a[s[1]-'A']==0){
      a[s[0]-'A']--;
      a[s[1]-'A']++;
      v.push_back(s[1]);
    }else if( i<n-1 && a[s[0]-'A']==1 && a[s[1]-'A']==1 && a[2*'A'+3-s[0]-s[1]]==0 ){
      string s1=vs[i+1]; 
      if(s[0]==s1[0] || s[0]==s1[1]) {
        a[s[0]-'A']++;
        a[s[1]-'A']--;
        v.push_back(s[0]);
      }else if(s[1]==s1[0] || s[1]==s1[1]) {
        a[s[0]-'A']--;
        a[s[1]-'A']++;
        v.push_back(s[1]);
      }
    }else{
      if(a[s[0]-'A']>a[s[1]-'A']){
        a[s[0]-'A']--;
        a[s[1]-'A']++;
        v.push_back(s[1]);
      }else{
        a[s[0]-'A']++;
        a[s[1]-'A']--;
        v.push_back(s[0]);
      }
    }
  }
  cout<<"Yes"<<endl;
  for(auto vi:v){ cout<<vi<<endl; }
  return 0;
}


Measured memory_bytes: 7444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    string s; cin>>s;
    if((s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[2])||(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[1])||s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1])
    cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a = I()

    return a + a**2 + a**3


print(main())




Measured memory_bytes: 10824
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void AnsYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void AnsYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}







//ここまでライブラリ
//ここから本文





int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a.at(i);
	sort(a.begin(), a.end());
	cout << abs(a.at(0) - a.at(a.size() - 1)) << endl;
}


Measured memory_bytes: 256
#include<iostream>
    #include<cstdlib>
    #include<math.h>
    #include<set>
    using namespace std ;
    int main(){
        int a,b;
        cin>>a>>b;
        if(a*b%2==0)cout<<"Even"<<endl;
        else cout<<"Odd"<<endl;
        return 0 ;
    }

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

using namespace std;

int main(void){
    int n;
    cin >> n;
    if(n / 100 >= 1&&n / 100 <= 12){
        if(n % 100 >= 1&&n % 100 <= 12){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl; 
        }
    }else if(n % 100 >= 1&&n % 100 <= 12){
        cout << "YYMM" << endl;
    }else{
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();
		String S  = sc.next();
		
		String S2 = S.replaceAll("AC","10");
		//System.out.println(S2);
		int [] AC = new int [N];
			//System.out.println(S2.charAt(0));
			//System.out.println(S2.charAt(0) == '1');
		if (S2.charAt(0) == '1')
			
			AC[0] = 1;
		for (int i = 1; i < N; i++) {
			if (S2.charAt(i) == '1')
				AC[i] = AC[i-1] + 1;
			else
				AC[i] = AC[i-1];
			//System.out.print(AC[i]);
		}
		int l;
		int r;

		for (int i = 0; i < Q; i++) {
			l = sc.nextInt();
			r = sc.nextInt();
			if (l == 1)
				System.out.println(AC[r-2]);
			else
				System.out.println(AC[r-2] - AC[l-2]);
		}
	}
}


Measured memory_bytes: 68284
import math
def main():
    a, b, x = (int(_) for _ in input().split())
    if 2*x <= pow(a, 2) * b:
        print(math.degrees(math.atan(a * pow(b, 2) / 2 / x)))
    else:
        print(math.degrees(math.atan(2 * (pow(a, 2) * b - x) / pow(a, 3))))
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
function Main(input) {
    parseInt(input);
    var num = input.split("");
    
    var diff = [];
    
    for ( var i=0; i<num.length; i++) {
        var temp = num.slice(i, i+3).join("");
        diff.push(Math.abs( 753 - temp ));
    }
    
    var answer = diff.reduce((n, m) => n <= m? n: m);
    console.log(answer);
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
static const int INFTY = (1 << 21);

class Edge{
public:
    int from, to, cost;
    Edge(int from = 0, int to = 0, int cost = 0) :
            from(from), to(to), cost(cost){}

    bool operator < (const Edge &e) const{
        return cost < e.cost;
    }
    bool operator >(const Edge &e) const{
        return cost > e.cost;
    }

};

class Node{
public:
    vector<Edge> edges;
    int dist;

    Node(){
        dist = INFTY;
    }
};

class Graph{
public:
    vector<Node> nodes;
    Graph(int n) {
        rep(i, n) { Node n;  nodes.push_back(n); }
    }
    Node& operator[](int i){
        return nodes[i];
    }
};

class Data{

public:
    int dist;
    Edge *edge;
    Data(int dist, Edge *edge) {
        this->dist = dist;
        this->edge = edge;
    }

    bool operator < (const Data &d) const{
        return dist < d.dist;
    }
    bool operator >(const Data &d) const{
        return dist > d.dist;
    }
};

Graph G(0);
int V;

int main() {

    cin >> V;
    G = Graph(V);

    rep(i, V){
        int from; cin >> from; from--;
        int e_count; cin >> e_count;

        vint vec;
        rep(j, e_count){
            int to; cin >> to; to--;
            vec.push_back(to);
        }
        sort(vec.begin(), vec.end());
        rep(j, e_count){
            G[from].edges.push_back(Edge(from, vec[j], 1));
        }
    }

    // bfs
    queue<Data> q;
    Edge e(-1, 0, 0);
    q.push(Data(0, &e));
    while(!q.empty()){
        Data d = q.front(); q.pop();
        Edge &e = *(d.edge);
        Node &n = G[e.to];

        if(n.dist != INFTY) continue;
        n.dist = d.dist;

        for(auto &ee: n.edges){
            q.push(Data(n.dist+1, &ee));
        }
    }

    rep(i, V) {
        if (G[i].dist == INFTY) G[i].dist = -1;
    }

    rep(i, V){
        fprintf(stdout, "%d %d\n", i+1, G[i].dist);
    }
}

Measured memory_bytes: 3276