akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)

	ans := 0
	for i := 1; i <= n; i++ {
		if i%3 != 0 && i%5 != 0 {
			ans += i
		}
	}
	fmt.Println(ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


Measured memory_bytes: 1824
#include <stdio.h>
#include <ctype.h>

int stack[102]; int top;
char buf[2000];

int main()
{
	int  v1, v2;
	char *p;

	fgets(p=buf, 500, stdin);
	top = 0;
	while (*p >= ' ') {
		while (isspace(*p)) p++;
		if (isdigit(*p)) {
			v1 = 0;
			while (isdigit(*p)) v1 = 10*v1 + (*p++ & 0xf);
			stack[top++] = v1;
		} else {
			v1 = stack[--top];
			v2 = stack[--top];
			if      (*p == '+') v2 += v1;
			else if (*p == '-') v2 -= v1;
			else if (*p == '*') v2 *= v1;
			stack[top++] = v2;
			p++;
		}
	}
	printf("%d\n", stack[--top]);
	return 0;
}



Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static String I = "IMPOSSIBLE";
	public static String B = "Bad";
	public static String G = "Good";
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int a = ni();
		int p = ni();
		int sou = a * 3 + p;

		out(sou / 2);
	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static String n() {
		return sc.next();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

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

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}
}


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

int N, M;
int a[100];

void sit_from_left(int id) {
  for (int i = 0; i < N; ++i) {
    if (a[i] == -1) {
      a[i] = id;
      break;
    }
  }
}

void sit_a() {
  sit_from_left(0);
}

void sit_b() {
  bool sat = false;;
  for (int i = N - 1; i >= 0; --i) {
    if (a[i] != -1) {
      continue;
    }
    if (i > 0 && a[i - 1] == 0) {
      continue;
    }
    if (i < N - 1 && a[i + 1] == 0) {
      continue;
    }
    a[i] = 1;
    sat = true;
    break;
  }

  if (sat) {
    return;
  }

  sit_from_left(1);
}

void sit_c() {
  bool sat = false;
  for (int i = 0; i < N; ++i) {
    if (a[i] == -1) {
      continue;
    }
    if (i < N - 1 && a[i + 1] == -1) {
      a[i + 1] = 2;
      sat = true;
      break;
    }
    if (i > 0 && a[i - 1] == -1) {
      a[i - 1] = 2;
      sat = true;
      break;
    }
  }

  if (sat) {
    return;
  }

  a[N / 2] = 2;
}

void sit_d() {
  int m = 0;
  int mi = 0;
  for (int i = 0; i < N; ++i) {
    if (a[i] != -1) {
      continue;
    }
    int l = N;
    int r = N;
    for (int j = i; j >= 0; --j) {
      if (a[j] != -1) {
        l = i - j;
        break;
      }
    }
    for (int j = i; j < N; ++j) {
      if (a[j] != -1) {
        r = j - i;
        break;
      }
    }
    if (m < min(l, r)) {
      m = min(l, r);
      mi = i;
    }
  }
  a[mi] = 3;
}

void print_seat() {
  for (int i = 0; i < N; ++i) {
    if (a[i] < 0) {
      cout << (char)'#';
    } else {
      cout << (char)('A' + a[i]);
    }
  }
  cout << endl;
}

int main() {
  while (1) {
    cin >> N >> M;
    if (!N && !M) {
      break;
    }
    fill(a, a + N, -1);
    for (int i = 0; i < M; ++i) {
      string s;
      cin >> s;
      if (s == "A") {
        sit_a();
      } else if (s == "B") {
        sit_b();
      } else if (s == "C") {
        sit_c();
      } else if (s == "D") {
        sit_d();
      }
    }
    print_seat();
  }
  return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;

void swap(int &a, int &b) {
    a ^= b;
    b ^= a;
    a ^= b;
}

uint tzcnt(uint x) {
    x = ~x & (x - 1);
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

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

    int n, k;
    cin >> n >> k;

    vector<int> bs;
    bs.reserve(n + 1);

    for (int i = 0; i <= n; i++) {
        bs.push_back(0);
    }

    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        bs[k]++;
    }

    std::sort(bs.begin(), bs.end());

    int res = 0;
    int i = 0;
    for (; i <= n; i++) {
        if (bs[i] > 0) {
            break;
        }
    }

    for (int j = 0; j < n - i - k + 1; j++) {
        res += bs[i + j];
    }

    out(res);

    int ttttttt;
    cin >> ttttttt;
}

Measured memory_bytes: 1024
n = int(input())
v = list(map(int,input().split()))

vo=[0]*(10**5+1)
ve=[0]*(10**5+1)

for i in range(n):
    if i%2==0:
        vo[v[i]] +=1
    else:
        ve[v[i]] +=1


if vo.index(max(vo))==ve.index(max(ve)):
    ans1 = sum(vo)-max(vo)+sum(ve)-sorted(ve)[-2]
    ans2 = sum(vo)-sorted(vo)[-2]+sum(ve)-max(ve)
    print(min(ans1,ans2))
else:
    print(sum(vo)-max(vo)+sum(ve)-max(ve))

Measured memory_bytes: 14404
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  bool flag = 0;
  int sum = 0;
  
  for (int i=0; i<=25; i++) {
    for (int j=0; j<=14; j++) {
      sum = 4*i + 7*j;
      if (n == sum) {
        flag = 1;
        break;
      }
    }
  }
  cout << (flag ?  "Yes":"No") << endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	a := nextInt()
	b := nextInt()
	c := nextInt()
	fmt.Println(intMin(c, a+b+1) + b)
}

func pow(a, b int) int {
	if b == 0 {
		return 1
	}
	r := a
	for ; b > 1; b-- {
		r *= a
	}
	if r <= 0 {
		log.Println("warning : intPow return <=0 value", r)
	}
	return r
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func intMax(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func intMin(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func intSum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func intAbs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = newScanner()
}

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 nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	al = lin()
	bl = lin()
	diff = [a-b for a,b in zip(al, bl)]
	diff.sort()
	if sum(diff) < 0:
		return -1
	tarinai = [v for v in diff if v < 0]
	ret = len(tarinai)
	#pa(ret)
	tv = sum(tarinai)
	if tv >= 0:
		return 0
	#pa(diff)
	for v in diff[::-1]:
		tv += v
		ret += 1
		if tv >= 0:
			break
	return ret

	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  int _a = a;
  REP(i, b) {
    if (_a % b == c) {
      std::cout << "YES" << std::endl;
      return 0;
    }
    _a += a;
  }
  std::cout << "NO" << std::endl;
}

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;

// まずは状態を定義。寿司の順番に意味が無いことに気づくので、状態としては、残りの寿司の個数がk枚の皿がそれぞれ何枚あるかということになる。
// 状態遷移は、サイコロを一回降った時にどうなるかを考える。遷移式はそのままだと0個の皿を引いたときに無限ループになるので式変形する必要あり。
// dp[x][y][z] 残り一個のものがx, 残り二個のものがy, 残り三個のものがzのときの期待値
const int maxn = 301;
long double dp[maxn][maxn][maxn];
bool done[maxn][maxn][maxn];
int n;

long double dfs(int x, int y, int z) {
    if ((x == 0 && y == 0 && z == 0) ||
        (x < 0 || y < 0 || z < 0)) return 0.0;
    if (done[x][y][z]) return dp[x][y][z];
    
    long double s = x + y + z;
    dp[x][y][z] = dfs(x-1, y, z) * x/s + dfs(x+1, y-1, z) * y/s + dfs(x, y+1, z-1) * z/s + n/s;
    done[x][y][z] = true;
    return dp[x][y][z];
}

int main() {
    cin >> n;
    int one = 0, two = 0, three = 0, tmp;
    for(int i = 1; i <= n; i++) {
        cin >> tmp;
        if (tmp == 1) one++;
        if (tmp == 2) two++;
        if (tmp == 3) three++;
    }
    for(int i = 0; i < maxn; i++) {
        for(int j = 0; j < maxn; j++) {
            for(int k = 0; k < maxn; k++) {
                done[i][j][k] = false;
            }
        }
    }
    long double res = 0.0;
    res = dfs(one, two, three);
    cout << fixed << setprecision(10);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 452992
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  int N;
  cin >> N;

  bool isZero = false;
  vector <long long>A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i]==0) isZero = true;
  }
  if (isZero) {
    cout << 0 << endl;
    return 0;
  }

  long long ans = 1;
  for (int i = 0; i < N; i++) {
    // overflow
    if (ans > ans*A[i]) {
      cout << -1 << endl;
      return 0;
    }
    if (ans*A[i] > 1000000000000000000) {
      cout << -1 << endl;
      return 0;
    }
    ans *= A[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
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; }
intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); }
intl lcm(intl a,intl b){ return a / gcd(a, b) * b; }
intl kai(intl k){//k!を求める関数,
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}

//--------------入力受け取る場所----------------------------------------------------
intl n,m;
intl a,b,c,d;
string s,t;

void input_var(){
    cin >> n >> m;
}
//-------------------------------------------------------------------------------

signed main(){
    cout << fixed << setprecision(10);
    input_var();
    intl mi = n * 2;
    intl ma = n * 4;
    bool f = (mi <= m)&&(m <= ma);
    if(f){
        f = !(m % 2);
    }
    fp(f);
    return 0;
}


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

typedef unsigned int U;
#define L 1<<21
bool HA[L];
char T[256];

int main() {
    U n, s, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    getchar();
    while (n--) {
        s = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            s += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[s] = true;
        } else {
            puts( HA[s] ? "yes" : "no" );
        }
    }
    return 0;
}

Measured memory_bytes: 2100
#include <iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define rng(a) a.begin(),a.end()
using ll = long long;

using namespace std;



int main() {
    int n;
    cin>>n;
    vector<int>l(n);
    rep(i,n) cin>>l[i];
    sort(rng(l));
    ll a,b,c;
    ll ans = 0;
    for(int i = n-1; i >= 0; i--) {
        c = l[i];
        for(int j = i-1; j >= 0; j--) {
            b = l[j];
            if(b==c) continue;
            for(int k = j-1; k >= 0; k--) {
                a = l[k];
                if(a==b||c==a) continue;
                if(a!=b&&b!=c&&c!=a&&(a+b)>c) ans++;
            }
        }
    }
    cout<<ans<<endl;
    

    return 0;
}


Measured memory_bytes: 3628
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

int main() {
	int x,y,z; qr(x); qr(y); qr(z);
	printf("%d %d %d\n",z,x,y);
	return 0;
}



Measured memory_bytes: 256
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
let suuji = readInts()
let n = suuji[0]
let l = suuji[1]
var sum = 0
var min = l
for i in 2...n {
  var b = l + i - 1
  sum+=b
  if (abs(b)<abs(min)) {
    sum-=b
    sum+=min
    min=b
  }
}
print(sum)

Measured memory_bytes: 8136
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
// return gcd(a,b)
long long gcd(long long a, long long b) {
    // O(log min(a,b))
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

    ll N, M;
    cin >> N >> M;
    vector<ll> a(N);
    REP(i, N) { cin >> a.at(i); }

    ll l = a[0];
    ll l2 = a[0] / 2;
    REP(i, N - 1) {
        ll d = gcd(l, a[i + 1]);
        l = l / d * a[i + 1];
        if (l / 2 > M) {
            break;
        }
    }

    // cout << l << endl;

    bool flag = false;
    vector<int> div(N);
    REP(i, N) {
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            div[i]++;
        }
    }
    REP(i, N - 1) {
        if (div[0] != div[i + 1]) {
            flag = true;
        }
    }
    if (M >= l / 2 && !flag) {
        // cout << (M - (l / 2)) << endl;
        cout << (M + l / 2) / l << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

class RollingHash(object):
    __base1=1007; __mod1=10**9+9
    __base2=1009; __mod2=10**9+7

    def __init__(self,s):
        self.__s=s; self.__n=len(s)
        b1=self.__base1; m1=self.__mod1
        b2=self.__base2; m2=self.__mod2
        H1,H2=[0]*(self.__n+1),[0]*(self.__n+1)
        P1,P2=[1]*(self.__n+1),[1]*(self.__n+1)
        for i in range(self.__n):
            H1[i+1]=(H1[i]*b1+ord(s[i]))%m1
            H2[i+1]=(H2[i]*b2+ord(s[i]))%m2
            P1[i+1]=P1[i]*b1%m1
            P2[i+1]=P2[i]*b2%m2
        self.__H1=H1; self.__H2=H2
        self.__P1=P1; self.__P2=P2

    def __getitem__(self,x):
        if(isinstance(x,int)): x=slice(x,x+1)
        assert(isinstance(x,slice) and ((x.step is None) or (x.step==1)))
        l=x.start; r=x.stop;
        assert(l<=r)
        return ((self.__H1[r]-self.__P1[r-l]*self.__H1[l]%self.__mod1)%self.__mod1,
                (self.__H2[r]-self.__P2[r-l]*self.__H2[l]%self.__mod2)%self.__mod2)

def bisection(l,r,f,left=True,discrete=True):
    eps=1 if(discrete) else 10**-8
    if((not left)^f(r)): return r if(left) else r+1
    elif(left^f(l)): return l-1 if(left) else l
    while(r-l>eps):
        h=(l+r)//2 if(discrete) else (l+r)/2
        if((not left)^f(h)): l=h
        else: r=h
    return (l+r)/2 if(not discrete) else l if(left) else r

from collections import defaultdict
def resolve():
    n=int(input())
    rh=RollingHash(input())

    def check(k):
        D=defaultdict(lambda:-1)
        for i in range(n-k+1):
            h=rh[i:i+k]
            if(D[h]!=-1):
                if(i-D[h]>=k):
                    return True
            else:
                D[h]=i
        return False

    print(bisection(0,n,check))
resolve()

Measured memory_bytes: 42864
import java.util.*;

public class Main {

    static int n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();

        dfs("", 'a');
    }

    public static void dfs(String s, char mx) {
        if (s.length() == n) {
            System.out.println(s);
        } else {
            for (char c = 'a'; c <= mx; c++) {
                dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
            }
        }
    }
}

Measured memory_bytes: 41372
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n=l()[0]
A=[input() for i in  range(n)]
d={"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(n):
    if A[i][0] in d:
        d[A[i][0]]+=1
s="MARCH"
ans=0
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans+=(d[s[i]]*d[s[j]]*d[s[k]])
print(ans)


Measured memory_bytes: 11952
n, m, l = map(int, input().split())
A = [[0] * m for _ in range(n)]
B = [[0] * l for _ in range(m)]
C = [[0] * l for _ in range(n)]
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(m):
        A[i][j] = a[j]
for i in range(m):
    b = list(map(int, input().split()))
    for j in range(l):
        B[i][j] = b[j]
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
for i in range(n):
    for j in range(l - 1):
        print(C[i][j], end=' ')
    print(C[i][l - 1])



Measured memory_bytes: 7048
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();

        out.println(b - a == c - b ? "YES" : "NO");
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 22612
#include <iostream>

int main(){
	
	int count;
	std::cin >> count;
	//改行を無視
	std::cin.get();
	
	const std::string before_word = "Hoshino";
	const int before_word_length = before_word.length();
	const std::string after_word = "Hoshina";
	
	for(int i = 0; i < count; ++i){
		std::string str;
		std::getline(std::cin, str);
		
		//全ての"Hoshino"を置換するまで無限ループ
		while(true){
			std::size_t found = str.find(before_word);
			if(found != std::string::npos){
				str.replace(found, before_word_length, after_word);
			}
			else break;
		}
		
		std::cout << str << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
using namespace std;
//イントとダブルが入り乱れるときはどちらかに統一しよう。

int main(){
  int w,h,n;
  int x[110]={0},y[110]={0},a[110]={0};
  int a1[110]={0},a2[110]={0},a3[110]={0},a4[110]={0};
  cin >> w >> h >> n;
  for(int i=0;i<n;++i){
    a2[i]=1000;
    a4[i]=1000;
  }
  for(int i=0; i <n ; ++i){
    cin >> x[i] >> y[i] >> a[i];
    if(a[i]==1)a1[i]=x[i];
    if(a[i]==2)a2[i]=x[i];
    if(a[i]==3)a3[i]=y[i];
    if(a[i]==4)a4[i]=y[i];
  }
  sort(a1,a1+n,greater<int>());
  sort(a2,a2+n);
  sort(a3,a3+n,greater<int>());
  sort(a4,a4+n);
//  cout << a1[0] << " " << a2[0]<< " " << a3[0] << " " << a4[0] << endl;
  if(a2[0]!=0)w=min(w,a2[0]);
  if(a4[0]!=0)h=min(h,a4[0]);
  if(w-a1[0]>0&&h-a3[0]>0)cout << (w-a1[0])*(h-a3[0]) << endl;
  else cout << 0 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

vector<int> kmpFailureFunc(const string& S)
{
    const int n = S.size();
    vector<int> F(n + 1, -1);
    F[1] = 0;
    for (int i = 2;i <= n; i++) {
        char c = S[i - 1];
        int l = F[i - 1];
        while (l >= 0 && S[l] != c)
            l = F[l];
        F[i] = l + 1;
    }

    return F;
}

bool check(string& S, int l)
{
    if (l == 0)
        return true;

    const int N = S.size();
    FOR(i, 0, N - l + 1) {
        string key = S.substr(i, l);
        VEC(int) F = kmpFailureFunc(key);

        int s = 0;
        FOR(j, i + l, N) {
            char c = S[j];
            while (s >= 0 && key[s] != c)
                s = F[s];
            s++;

            if (s == l)
                return true;
        }
    }

    return false;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    string S;
    cin >> N >> S;

    int lo = 0, hi = N / 2;
    while (hi - lo > 1) {
        int md = (lo + hi) / 2;
        if (check(S, md))
            lo = md;
        else
            hi = md - 1;
    }

    if (!check(S, hi))
        hi = lo;
    cout << hi << endl;
    return 0;
};

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
  int W,H;
  char room[20][20];
  int i,j,k;
  int count;
  scanf("%d %d",&W,&H);
  while(!(W==0&&H==0)){
    for(i=0;i<H;i++){
      scanf("%s",room[i]);
    }
    for(i=0;i<W*H;i++){
      for(j=1;j<H;j++){
	for(k=0;k<W;k++){
	  if(room[j][k]!='#' && room[j-1][k]=='@'){
	    room[j][k]='@';
	  }
	}
            }
      for(j=0;j<H;j++){
	for(k=1;k<W;k++){
	  if(room[j][k]!='#' && room[j][k-1]=='@'){
	    room[j][k]='@';
	  }
	}
      }
      for(j=0;j<H-1;j++){
	for(k=0;k<W;k++){
	  if(room[j][k]!='#' && room[j+1][k]=='@'){
	    room[j][k]='@';
	  }
	}
      }
      for(j=0;j<H;j++){
	for(k=0;k<W-1;k++){
	  if(room[j][k]!='#' && room[j][k+1]=='@'){
	    room[j][k]='@';
	  }
	}
      }
    }
    count=0;
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
	if(room[i][j]=='@'){
	  count++;
	}
      }
    }
    printf("%d\n",count);
    scanf("%d %d", &W,&H);
  }
  return 0;
}

Measured memory_bytes: 2728
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');

_b(input);

function _b(input: string) {
  const [N, ...S] = input.split('\n');
  const map = new Map<string, number>();

  for (const item of S) {
    const current = map.get(item) || 0;
    map.set(item, current + 1);
  }

  console.log(
    `AC x ${map.get('AC') || 0}
WA x ${map.get('WA') || 0}
TLE x ${map.get('TLE') || 0}
RE x ${map.get('RE') || 0}`
  );
}


Measured memory_bytes: 44540
import sys

def CountingSort(A, B, k):
    C = [0] * (k+1)

    #   C[i] に i の出現数を記録する
    for j in A:
        C[j]+=1

    # C[i] に i 以下の数の出現数を記録する
    for i in range(1,k+1):
        C[i] = C[i] + C[i-1]
    for j in range(n-1, -1, -1): # n downto 1
        B[C[A[j]]-1] = A[j]
        C[A[j]]-=1

    return B


n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
b = [0] * n

CountingSort(a, b, max(a))
print(' '.join(map(str, b)))


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

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;

	public static void main(String[] args) {
		N = sc.nextInt();
		double[] A = new double[N];
		for (int i = 0; i < N; ++i) {
			A[i] = sc.nextDouble();
		}
		final int MAX = 200001;
		double[][] dp = new double[2][MAX];
		double div = 1.0 / A[0];
		for (int i = 1; i < MAX; ++i) {
			dp[0][i] = Math.abs(A[0] - i) * div;
		}
		for (int i = 1; i < N; ++i) {
			int t = i & 1;
			Arrays.fill(dp[t], 1e9);
			div = 1.0 / A[i];
			for (int j = 1; j < MAX; ++j) {
				for (int k = j; k < MAX; k += j) {
					dp[t][k] = Math.min(dp[t][k], Math.max(dp[1 - t][j], Math.abs(A[i] - k) * div));
				}
			}
		}
		double ans = 1e9;
		for (int i = 1; i < MAX; ++i) {
			ans = Math.min(ans, dp[1 - N & 1][i]);
		}
		System.out.printf("%.9f\n", ans);
	}
}

Measured memory_bytes: 26072
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (a == b && a == c && b == c) {
        if (a % 2 == 0) cout << -1 << endl;
        else cout << 0 << endl;
        return 0;
    }

    int ans = 0;
    while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        int ta = a, tb = b, tc = c;
        a = (tb + tc) / 2;
        b = (ta + tc) / 2;
        c = (ta + tb) / 2;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
lli u,k,v;

matb g;

int main(){
    cin >> n;
    g = matb(n+1,vbl(n+1));
    for(lli i = 0;i < n;i++){
        cin >> u >> k;
        for(lli j = 0;j < k;j++){
            cin >> v;
            g[u][v] = true;
        }
    }
    for(lli i = 1;i <= n;i++){
        for(lli j = 1;j <= n;j++){
            cout << g[i][j];
            if(j == n) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 3164
#include"bits/stdc++.h"

void Main() {
    int n, k;
    std::cin >> n >> k;

    int tmp, count = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> tmp;
        if (tmp >= k) {
            ++count;
        }
    }

    std::cout << count << std::endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int x, y;
    while (1) {
        cin >> x >> y;
        if ((x == 0) && (y == 0))
            break;
        if (x > y) {
            int num = x;
            x = y;
            y = num;
        }
        cout << x << " " << y << endl;
    }
    return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll md=(1e+9) +7;
ll dp[401][401]={0};
ll pref[401]={0};
ll f(int i, int j){
    if(dp[i][j]!=0){return dp[i][j];}
    if(i==j){return 0;}
    ll ans=1e+17;
    for(int t=i;t<j;t++){
        ans=min(f(i,t)+f(t+1,j),ans);
    }
    ans+=pref[j+1];
    ans-=pref[i];
    dp[i][j]=ans;
    return dp[i][j];
}
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>pref[i];
        pref[i]+=pref[i-1];
    }
    cout<<f(0,n-1);
    return 0;

}

Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <cassert>

#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

#define rep_init(i, init, n) for(int i = (init); i < (n); ++i)
#define rep(i, n) rep_init(i, 0, n)


void Main()
{
	int N;
	cin >> N;
	int H = 0;
	int M = N;
	while (M != 0)
	{
		H += M % 10;
		M /= 10;
	}

	cout << (N % H == 0 ? "Yes" : "No") << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

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

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long int lli;
#define rept(x, s, n) for (int x = s; x < n; x++)


int i_cins(int n, int* A);
int l_cins2(int n, long* A,long* B);
int s_dsort(const void* a, const void* b);

int main(void) {
	int   N,max=0,min=1000000001;
	int   A,B;
	
	i_cin(N);
	rept(i, 0, N) {
		i_cin2(A,B);
		if (max < A)max = A;
		if (min > B)min = B;
		
	}
	max = min - 0 + max;
	i_cout(max);
	return 0;
}



Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		if (N % 1000 == 0) {
			System.out.println(0);
		} else {
			System.out.println(((N / 1000) + 1) * 1000 - N);
		}

	}

}


Measured memory_bytes: 27052
#include<cstdio>

int main(){
    char a,b;
    scanf("%c %c",&a,&b);
    if(a=='H'){
        if(b=='H'){
            printf("H");
        }
        else {
            printf("D");
        }
    }
    else {
        if(b=='H'){
            printf("D");
        }
        else {
            printf("H");
        }
    }
    return 0;
}


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

int main() {
  int a,b,c,sum;
  cin>>a>>b;
  vector<int> vec(a);
  c=1;
  sum=0;
  for(int i=0;i<a;i++){
  	cin>>vec.at(i);
  }

  for(int i=0;i<a;i++){
  	sum+=vec.at(i);
    if(sum<=b){
    	c++;
    }
  }
  
  
  cout<<c<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
	int n,m;

	int bit[20];
	int run[20],use[20];
	int tmp[20];
	int flag;
	int ans,tans;
	bool fail;

	scanf("%d %d",&n,&m);
	for(int i=0; i<n; i++)
		scanf("%d",&bit[i]);
	for(int i=0; i<m; i++)
		scanf("%d",&run[i]);
	for(int i=0; i<n; i++)
		tmp[i]=bit[i];
	ans=10000;
	int k;
	for(int i=0; i<m; i++)
		use[i]=0;
	flag=0;
	k=0;
	tans=0;
	fail=true;
	for(int i=0; i<n; i++){
		if(k==m){
			fail=false;
			break;
		}
		fail=false;
		for(int j=i; j<n; j++)
			if(tmp[j]==flag){
				fail=true;
				tans+=j-i;
				swap(tmp[i],tmp[j]);
				use[k]++;
				if(use[k]==run[k])
					k++,flag^=1;
				break;
			}
		if(fail==false)
			break;

	}
	if(fail && tans<ans){
		ans=tans;
	}
	for(int i=0; i<m; i++)
		use[i]=0;
	for(int i=0; i<n; i++)
		tmp[i]=bit[i];
	flag=1;
	k=0;
	tans=0;
	fail=true;
	for(int i=0; i<n; i++){
		if(k==m){
			fail=false;
			break;
		}
		fail=false;
		for(int j=i; j<n; j++)
			if(tmp[j]==flag){
				fail=true;
				swap(tmp[i],tmp[j]);
				tans+=j-i;
				use[k]++;
				if(use[k]==run[k])
					k++,flag^=1;
				break;
			}
		if(fail==false)
			break;
	}
	if(fail && tans<ans)
		ans=tans;
	printf("%d\n",ans);
	return 0;
}

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

int main(void){
    int N;
    cin >> N;
    int A[N];
    int ans=INF;
    rep(i,N) cin >> A[i];
    int sum[N+1]={};
    rep(i,N) sum[i+1]=sum[i]+A[i];
    rep(i,N+1) ans=min(ans,abs((sum[N]-sum[i])-sum[i]));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int h1, m1, h2, m2;
    cin >> h1 >> m1 >> h2 >> m2;
    int k;
    cin >> k;
    cout << 60 * (h2 - h1) + m2 - m1 - k << endl;
}


Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, a[2100009], b[100009], N, c[100009], s[100009], NN, ori[100009];
vector<int> vec;
map<int, int> mp, rmp;
long long tot;

void upd(int x, int v)
{
	x += NN;
	while (x) {
		a[x] += v;
		x = x / 2;
	}
}

int query(int A, int B, int l, int r, int x)
{
	if (l >= r) return 0;
	if (l <= A && B <= r) return a[x];
	int mid = (A + B) / 2;
	int retL = 0, retR = 0;
	if (l < mid) retL = query(A, mid, l, r, x + x);
	if (mid < r) retR = query(mid, B, l, r, x + x + 1);
	return retL + retR;
}

long long fun(int v)
{
	long long cnt = 0;
	for (int i = 0; i < n; i++) {
		if (b[i] >= v) c[i] = 1;
		else c[i] = -1;
	}
	s[0] = c[0];
	for (int i = 1; i < n; i++) {
		s[i] = s[i - 1];
		s[i] += c[i];
	}
	for (int i = 0; i < 2 * NN; i++) {
		a[i] = 0;
	}
	upd(s[0] + n, 1);
	if (s[0] >= 0) cnt++;
	for (int i = 1; i < n; i++) {
		int tmp = query(0, NN, 0, s[i] + n + 1, 1);
		cnt += tmp;
		if (s[i] >= 0) cnt++;
		upd(s[i] + n, 1);
	}
	return cnt;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ori[i];
		vec.pb(ori[i]);
	}
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	for (int i = 0; i < (int)vec.size(); i++) {
		mp[vec[i]] = i;
		rmp[i] = vec[i];
	}
	for (int i = 0; i < n; i++) {
		b[i] = mp[ori[i]];
	}
	N = 1;
	while (N < n + 1) N = N << 1;
	NN = N << 1;
	tot = (n) * 1LL * (n - 1) / 2 + n;
	int l = 0, r = (int)vec.size();
	while (l + 1 < r) {
		int mid = (l + r) / 2;
		long long C = fun(mid);
		if (tot - C <= C) l = mid;
		else r = mid;
	}
	cout << rmp[l] << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 14072
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
#define LLI long long int
using namespace std;

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

  LLI h,n,w=0;
  for(h=1;h<=3500;++h){
    for(n=1;n<=3500;++n){
      if(4*h*n-N*n-N*h<=0)continue;
      if((N*h*n)%(4*h*n-N*n-N*h) == 0){
	w = (N*h*n)/(4*h*n-N*n-N*h);
	break;
      }
    }
    if(w)break;
  }

  cout << h << " " << n << " " << w << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int h, w;
    cin >> h >> w;
    string a[h];
    rep(i, h)cin >> a[i];
    ll cnt = 0;
    rep(i, h)rep(j, w)if(a[i][j]=='#')cnt++;

    ll pos =  0;
    ll path = 0;
    rep(i, h){
        while(a[i][pos]=='#')pos++, path++;
        pos--;
        if(i == h-1)break;
        else if(a[i+1][pos]!='#')break;
    }
    if(cnt == path)cout << "Possible\n";
    else cout << "Impossible\n";

}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  long long N;
  cin >> N;
  vector<long long> d(N);
  for (int i = 0; i < N; i++)
    cin >> d[i];
  sort(d.begin(), d.end());
  long long ans = d[N / 2] - d[N / 2 - 1];
  if (ans > 0)
    cout << ans << endl;
  else
    cout << 0 << endl;
}


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

int H;

int A[2000000];

void maxHeapify(int i){
    int left,right,largest;
    left=2*i;
    right=2*i+1;
    
    largest=i;
    if(left<=H && A[left]>A[i]){
        largest=left;
    }
        if(right<=H && A[right]>A[largest]){
            largest=right;
        }
            if(largest!=i){
                int  tmp=A[i];
                A[i]=A[largest];
                A[largest]=tmp;
                maxHeapify(largest);
            }
}


int main(){
    cin>>H;
    int i;
    for(i=1;i<=H;i++){
        cin>>A[i];
    }
    for(i=H/2;i>=1;i--){
        maxHeapify(i);
    }
    for(i=1;i<=H;i++){
            cout<<" "<<A[i];;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5028