akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args){
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String n_str, a_str;
		try {
			n_str = new String(in.readLine());
			a_str = new String(in.readLine());
			int n = Integer.parseInt(n_str);
			if(n<1 || n>100) throw new Exception();
			String[] a_str_arr = a_str.split(" ", 0);
			if(n != a_str_arr.length) throw new Exception();
			int[] a_arr = new int[a_str_arr.length];
			int max=0;
			int min=1000;
			for(int i=0; i<a_str_arr.length; i++){
				int a = Integer.parseInt(a_str_arr[i]);
				if(a<0 || a>1000) throw new Exception();
				if(max<a) max = a;
				if(min>a) min = a;
			}
			System.out.println(max-min);
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (Exception e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

// --------- UnionFind木 ---------
class UnionFind {
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) std::swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
private:
	std::vector<int> data;
};

int n;
std::pair<ll, int> xx[100005], yy[100005];
std::vector<std::tuple<ll, int, int>> e;
int main() {
	std::cin >> n;

	for (int i = 0; i < n; ++i) {
		ll x, y;

		std::cin >> x >> y;

		xx[i].first = x;
		xx[i].second = i;

		yy[i].first = y;
		yy[i].second = i;
	}

	std::sort(xx, xx + n);
	std::sort(yy, yy + n);

	for (int i = 0, end = n - 1; i < end; ++i)
		e.emplace_back(xx[i + 1].first - xx[i].first, xx[i].second, xx[i + 1].second);

	for (int i = 0, end = n - 1; i < end; ++i)
		e.emplace_back(yy[i + 1].first - yy[i].first, yy[i].second, yy[i + 1].second);

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

	UnionFind uf(n);
	ll ans = 0;
	for (size_t i = 0, end = e.size(); i < end; ++i) {
		ll l;
		int i1, i2;

		std::tie(l, i1, i2) = e[i];

		if (!uf.findSet(i1, i2)) {
			ans += l;
			uf.unionSet(i1, i2);
		}
	}

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


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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	ll n;
	cin >> n;
	cout << (n * (n - 1)) / 2 << '\n';
}


Measured memory_bytes: 256
Imports System

Module practiceA
    Sub Main()
        Call test1()


    End Sub

    Sub test1()
        Dim K, i, A, B As Integer
        Dim arr(2) As String

        K = Console.ReadLine()
        arr = Split(Console.ReadLine())
        A = arr(0)
        B = arr(1)

        If A <= B Then

            While K * i <= 1000

                If K * i >= A And K * i <= B Then
                    Console.Write("OK")
                    Exit Sub
                Else
                    i = i + 1
                End If

            End While

        End If

        Console.Write("NG")

    End Sub

    Sub test2()
        Dim A, B, C, D, HP_A, HP_B As Integer
        Dim arr(4) As String
        arr = Split(Console.ReadLine())
        A = arr(0)
        B = arr(1)
        C = arr(2)
        D = arr(3)

        HP_B = C - B


        If HP_B <= 0 Then
            Console.Write("Yes")
            Exit Sub
        End If

        HP_A = A - D

        If HP_A <= 0 Then
            Console.Write("No")
            Exit Sub
        End If

        Do While True

            HP_B = HP_B - B

            If HP_B <= 0 Then
                Console.Write("Yes")
                Exit Do
            End If

            HP_A = HP_A - D

            If HP_A <= 0 Then
                Console.Write("No")
                Exit Do
            End If

        Loop

    End Sub

    Sub test3()
        Dim N, i, count As Integer

        count = 1

        N = Console.ReadLine()

        Dim stringlist(N - 1) As String

        For i = 0 To N - 1
            stringlist(i) = Console.ReadLine()
        Next i

        Dim uniqueFoods() As String = stringlist.Distinct.ToArray

        count = uniqueFoods.Length

        Console.WriteLine(count)

    End Sub


End Module

Measured memory_bytes: 28396
#include <stdio.h>

int main()
{
    char s[101];
    long k;
    scanf("%s", s);
    scanf("%ld", &k);
    int count = 0;
    int i = 0;
    while(s[i]=='1'){
        count++;
        i++;
    }
    if(count>=k) printf("1");
    else printf("%c\n", s[i]);
    
    return 0;
}


Measured memory_bytes: 128
while n = gets
  n = n.split(" ").map(&:to_i)
  if n[0] != 0
  card = []
  for i in 0 ... n[0]

    card[i] = n[0] - i
  end

  b = []

  for i in 0 ... n[1]

    m = gets.split(" ").map(&:to_i)
    m[0] = m[0] - 1


    new = card[m[0]..m[0]+m[1]-1]
    card.slice!(m[0],m[1])
    new.push(card)
    card = new.flatten
    #puts card[0]
end

  puts card[0]

  card.slice!(0,card.length)

  new.slice!(0,new.length)
  end
end



Measured memory_bytes: 7628
n = gets.chomp.to_i

ss = []
n.times do
  ss.push gets.chomp
end

h = Hash.new(0)
ss.each do |s|
  h[s] += 1
end

m = h.max{ |x, y| x[1] <=> y[1] }
n = m[1]

as = []
h.each do |k, v|
  as.push k if v == n
end

as.sort.each do |a|
  puts a
end


Measured memory_bytes: 48220
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
map<LL, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, ans, cnt, a[310000], b[310000];
struct query {
	string str;
	LL a, idx;
};
query str[10000];
bool f;
char c[1100][1100];
int main() {
	cin >> n;
	rep(i, n) {
		cin >> str[i].str >> str[i].a;
		str[i].idx = i + 1;
	}
	sort(str, str + n, [](query x, query y) {
		if (x.str > y.str)return 0;
		else if (y.str > x.str)return 1;
		else if (x.a > y.a)return 1;
		else return 0;
	});
	rep(i, n)
		cout << str[i].idx << endl;
	return 0;
}


Measured memory_bytes: 512
n,m=map(int,input().split())
a=[[] for _ in range(n)]
b=[[] for _ in range(m)]

for i in range(n):
    a[i] = input()
for i in range(m):
    b[i] = input()

ans=0
for x in range(n-m+1):
    for y in range(n-m+1):
        k=0
        for i in range(m):
            if k != 0:
                break
            for j in range(m):
                if k != 0:
                    break
                if a[y+j][x+i] != b[j][i]:
                    k=1
        if k==0:
            ans=1

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
def stack(A):
    stack = []
    for opr in A:
        if opr.isdigit():
            stack.append(opr)
        else:
            opr1 = stack.pop()
            opr2 = stack.pop()
            stack.append(str(eval(opr2 + opr + opr1)))
    print stack.pop()

if __name__ == "__main__":
    A = raw_input().split()
    stack(A)

Measured memory_bytes: 6312
#include<iostream>
#include<numeric>
 
using namespace std;
 
long long n, a[1009], t[1009], num[1009];
 
void solve(){
    long long ans=0, mxa=0, mxt=0, k;
    for(int i=0;i<n;i++){
        k = max((ans-1)/num[i]+1, (mxa-1)/a[i]+1);
        k = max(k, (mxt-1)/t[i]+1);
        ans = k*num[i];
        mxa = k*a[i];
        mxt = k*t[i];
    }
    cout << ans << endl;
}
 
int main(){
    cin >> n;
    long long int tmpt, tmpa;
    for(int i=0;i<n;i++){
        cin >> t[i] >> a[i];
        num [i] = t[i]+a[i];
    }
    solve();
}

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

using namespace std;
int main() {
    string s; cin >> s;
    vector<long> v(26,0);
    long n = s.size();
    for(int i=0; i<n; ++i){
       v[s[i]-'a']++;
    }

    long ans = 0;
    for(int i=0; i<26; ++i){
        ans += (long)v[i]*(v[i]-1)/2;
    }
    cout << n*(n-1)/2 - ans + 1 << endl;
}

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

int main(){
  int n,ima=0,i,dan,kotae=1;
  cin>>n;
  for(i=0;i<n;i++){
    cin>>dan;
    if(ima<dan){
      ima=dan-1;
    }else if(ima>dan){
      kotae=0;
      break;
    }
  }
  if(kotae){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

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

using namespace std;

const int MAX_N = 1e5 + 200;

int n;

int main()
{
    scanf("%d", &n);
    if (__builtin_popcount(n) == 1)
        puts("No"), exit(0);
    puts("Yes"), printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2, n + 2, n + 3);
    for (int i = 4; i < n; i += 2)
        printf("1 %d\n%d %d\n1 %d\n%d %d\n", i, i, i + 1 + n, i + 1, i + 1, i + n);
    if (!(n & 1))
    {
        for (int i = 2; i <= n; i++)
        {
            int u = i ^ n ^ 1;
            if (i != 3 && u != 3 && u <= n)
            {
                printf("%d %d\n%d %d\n", i, n, u, 2 * n);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3784
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	char a, b;
	cin >> a >> b;
	if (a == 'H') {
		if (b == 'H') {
			cout << 'H' << endl;
		}
		else {
			cout << 'D' << endl;
		}
	}
	else {
		if (b == 'H') {
			cout << 'D' << endl;
		}
		else {
			cout << 'H' << endl;
		}
	}
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0549
AC
"""
import sys
from sys import stdin
from itertools import accumulate
input = stdin.readline
import array

def main(args):
    n, m = map(int, input().split())
    distances = [int(input()) for _ in range(n-1)]
    inns = list(accumulate(distances))
    moves = [int(input()) for _ in range(m)]

    inns.insert(0, 0)
    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



def main2(args):
    n, m = map(int, input().split())

    pos = 0
    inns = array.array('Q', [0])
    for _ in range(n-1):
        pos += int(input())
        inns.append(pos)
    moves = [int(input()) for _ in range(m)]

    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



def main3(args):
    n, m = map(int, input().split())

    pos = 0
    inns = {0: 0}
    for i in range(n-1):
        pos += int(input())
        inns[i+1] = pos
    moves = [int(input()) for _ in range(m)]

    pos = 0
    total_distance = 0
    for m in moves:
        new_pos = pos + m
        total_distance += abs(inns[new_pos] - inns[pos])
        pos = new_pos

    print(total_distance % 100000)



if __name__ == '__main__':
    main3(sys.argv[1:])

Measured memory_bytes: 24344
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let n: usize = util::get();
    let ab: Vec<(usize, usize)> = (0..n - 1)
        .map(|_| {
            let v: Vec<usize> = util::gets();
            (v[0] - 1, v[1] - 1)
        })
        .collect();

    let edges = {
        let mut edges = vec![Vec::new(); n];
        for &(a, b) in &ab {
            edges[a].push(b);
            edges[b].push(a);
        }
        edges
    };


    let mut cost_from_0 = vec![None; n];
    cost_from_0[0] = Some(0);
    let mut vs = vec![0];
    let mut cost = 0;

    while cost_from_0[n - 1].is_none() {
        let mut next = Vec::new();

        for &v in &vs {
            for &to in &edges[v] {
                if cost_from_0[to].is_none() {
                    cost_from_0[to] = Some(cost + 1);
                    next.push(to);
                }
            }
        }
        vs = next;
        cost += 1;
    }

    let mut route_n_0 = Vec::new();
    let mut pos = n - 1;
    while pos != 0 {
        let next = edges[pos]
            .iter()
            .find(|&&i| {
                cost_from_0[i]
                    .map(|c| c == cost_from_0[pos].unwrap() - 1)
                    .unwrap_or(false)
            })
            .cloned()
            .unwrap();
        if next != 0 {
            route_n_0.push(next);
        }
        pos = next;
    }

    let mut board = vec![None; n];
    board[0] = Some(true);
    board[n - 1] = Some(false);
    for &i in &route_n_0[..route_n_0.len() / 2] {
        // snuke
        board[i] = Some(false);
    }
    for &i in &route_n_0[route_n_0.len() / 2..] {
        // fennec
        board[i] = Some(true);
    }

    let mut updated = true;
    while updated {
        updated = false;
        for i in 0..n {
            if board[i].is_some() {
                for &t in &edges[i] {
                    if board[t].is_none() {
                        board[t] = board[i];
                        updated = true;
                    }
                }
            }
        }
    }

    if board.iter().map(|o| o.unwrap()).filter(|&b| b).count() * 2 > n {
        println!("Fennec");
    } else {
        println!("Snuke");
    }
}


Measured memory_bytes: 16636
#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  vector<char> u(n);
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> u[i];

  map<int, vector<int>> mu, mr, md, ml, mu_s, mu_d, mr_s, mr_d, md_s, md_d, ml_s, ml_d;
  for (int i = 0; i < n; i++) {
    switch (u[i]) {
      case 'U': {
        mu[x[i]].push_back(y[i]);
        mu_s[x[i] + y[i]].push_back(x[i]);
        mu_d[x[i] - y[i]].push_back(x[i]);
        break;
      }
      case 'R': {
        mr[y[i]].push_back(x[i]);
        mr_s[x[i] + y[i]].push_back(x[i]);
        mr_d[x[i] - y[i]].push_back(x[i]);
        break;
      }
      case 'D': {
        md[x[i]].push_back(y[i]);
        md_s[x[i] + y[i]].push_back(x[i]);
        md_d[x[i] - y[i]].push_back(x[i]);
        break;
      }
      case 'L': {
        ml[y[i]].push_back(x[i]);
        ml_s[x[i] + y[i]].push_back(x[i]);
        ml_d[x[i] - y[i]].push_back(x[i]);
        break;
      }
    }
  }

  int r = INF;

  auto f = [&](map<int, vector<int>>& m1, map<int, vector<int>> m2, int s) {
    for (auto& [e, v1] : m1) {
      if (!m2.count(e)) continue;
      auto& v2 = m2[e];
      sort(v1.begin(), v1.end());
      sort(v2.begin(), v2.end());
      for (auto e1 : v1) {
        auto it = lower_bound(v2.begin(), v2.end(), e1);
        if (it == v2.end()) continue;
        r = min(r, s * (*it - e1));
      }
    }
  };

  f(mu, md, 5);       // ^ and v
  f(mr, ml, 5);       // > and <
  f(mr_s, mu_s, 10);  // > and ^
  f(mr_d, md_d, 10);  // > and v
  f(mu_d, ml_d, 10);  // ^ and <
  f(md_s, ml_s, 10);  // v and <

  if (r == INF) {
    cout << "SAFE" << endl;
  } else {
    cout << r << endl;
  }
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int A, B; cin >> A >> B;

    int res = A + B;
    if(res < 10) {
        cout << res << endl;
    } else {
        cout << "error" << endl;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

D = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for _ in range (D)]
M = 26
INF = 10**20

def judge(t,idx,val):
    last = [0]*M
    minus = [0]*M
    score = 0
    for i in range(D):
        ti = t[i]
        if i==idx:
            ti = val
        score += S[i][ti-1]
        last[ti-1] = i+1
        for m in range(M):
            temp = C[m]*(i+1-last[m])
            score -= temp
            minus[m] -= temp
    return score, minus

from random import randint
import time
start = time.time()
ans = [0]*D
lasts = [0]*(M+1)


score = 0
for i in range(D):
    contest = 0
    max_score = -INF
    for m in range(M):
        new_score = score
        new_score += S[i][m]
        for m2 in range(M):
            if m==m2:continue
            new_score -= C[m2]*(i+1-lasts[m2])
        if new_score>max_score:
            contest = m+1
            max_score = new_score
    
    ans[i] = contest
    lasts[contest-1] = i+1
    score = max_score

minus = [0]*M
while (time.time()-start<1.7):
    # 解を変更
    idx = randint(0,D-1)

    # マイナスの寄与が大きいmを選択
    key = [i+1 for i in range(M)]
    mc = zip(minus, key)
    mc = sorted(mc)
    minus, key = zip(*mc)
    val_ = randint(0, 3)
    val = key[val_]
    # スコアが上がっているか？
    new_score, minus = judge(ans, idx, val)
    if new_score>score:
        score = new_score
        ans[idx] = val  

for a in ans:
    print(a)

Measured memory_bytes: 82728
program answer
  implicit none

  integer :: A, B, C, D, E, i
  character linebuf*16

  read(*,*) E
  A=E/1000
  B=(E-A*1000)/100
  C=(E-A*1000-B*100)/10
  D=E-A*1000-B*100-C*10



  if(A+B+C+D==7) then
     write(*,'(i1,"+",i1,"+",i1,"+",i1,"=7")') A, B, C, D
     stop
  else if(A+B+C-D==7) then
      write(*,'(i1,"+",i1,"+",i1,"-",i1,"=7")') A, B, C, D
     stop
   else if(A+B-C+D==7) then
   write(*,'(i1,"+",i1,"-",i1,"+",i1,"=7")') A, B, C, D
      stop
   else if(A+B-C-D==7) then
       write(*,'(i1,"+",i1,"-",i1,"-",i1,"=7")') A, B, C, D
      stop
   else if(A-B+C+D==7) then
       write(*,'(i1,"-",i1,"+",i1,"+",i1,"=7")') A, B, C, D
      stop
   else if(A-B+C-D==7) then
       write(*,'(i1,"-",i1,"+",i1,"-",i1,"=7")') A, B, C, D
      stop
 else if(A-B-C+D==7) then
       write(*,'(i1,"-",i1,"-",i1,"+",i1,"=7")') A, B, C, D
      stop
   else
     write(*,'(i1,"-",i1,"-",i1,"-",i1,"=7")') A, B, C, D
   end if
   stop
  end program answer


Measured memory_bytes: 2896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	char c;
  	cin >> c;
  
 	 if (c == 'a' || c == 'i') {
  	  	cout << "vowel" << endl;
 	 }
  	else if (c == 'u' || c == 'e') {
    	cout << "vowel" << endl;
    }
  	else if (c == 'o') {
    	cout << "vowel" << endl;
    }
  else {
  	cout << "consonant" << endl;
  }
	}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int n = scanner.nextInt();

        int s = n % 10;
        if( s == 2 || s == 4 || s == 5 || s == 7 || s == 9 ) {
            System.out.println("hon");
        }else if( s == 0 || s == 1 || s == 6 || s == 8) {
            System.out.println("pon");
        }else if( s == 3) {
            System.out.println("bon");
        }

        scanner.close();

    }

}

Measured memory_bytes: 35796
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define ceil(a,b) ((a+b-1)/b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int N;
    cin >> N ;
    if (N%2==0)
        cout << N;
    else
        cout << 2*N;
}

Measured memory_bytes: 256
n = int(input())

countA = 0
countB = 0
countAB = 0
kaburi = 0
for i in range(n):
    s = input()

    findAB = 0
    while(findAB != -1):
        findAB = s.find("AB", findAB)
        if(findAB != -1):
            countAB += 1
            findAB += 1

    flag = False
    if(s[0]=="B"):
        countB += 1
        flag = True
    if(s[len(s)-1]=="A"):
        countA += 1
        if(flag):
            kaburi += 1

ans = min(countA, countB) + countAB
if(countA==countB and countA==kaburi):
    if(countA != 0):
        ans -= 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int N=2e5+5;
struct node{
	int u,val;
	node () {}
	node (int _u,int _v){
		u = _u; val = _v;
	}
	bool operator < (const node &b) const {
		return val < b.val;
	}
};
priority_queue<node> q;
int a[N],n,m,col[N],val[N],vis[N];
vector< pair<int,int> > e[N];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	int fl=1,u,v;
	for(int i=1;i<=m;++i){
		cin>>u>>v;
		e[u].push_back(make_pair(v,i));
		e[v].push_back(make_pair(u,i));
		if( a[u] == a[v] && !vis[u] && !vis[v])
			q.push(node(u,a[u])),
			q.push(node(v,a[v])),
			col[u]=1,col[v]=0,
			vis[u]=1,vis[v]=1,
			val[i]=a[u];
	}
	while(!q.empty()){
		int u=q.top().u,V=q.top().val;q.pop();
		for(int i=0;i<e[u].size();++i)
			if(!vis[e[u][i].fi] && a[e[u][i].fi]>=V)
				vis[e[u][i].fi]=1,q.push(node(e[u][i].fi,a[e[u][i].fi])),
				col[e[u][i].fi]=col[u]^1,val[e[u][i].se]=a[e[u][i].fi];
	}
	for(int i=1;i<=n;++i)
		if(!vis[i]) return puts("-1"),0;
	for(int i=1;i<=n;++i)
		cout<<(col[i]==0?"B":"W");
	cout<<endl;
	for(int i=1;i<=m;++i)
		cout<<(val[i]==0?(int)1e9:val[i])<<endl;
	return 0;
}

Measured memory_bytes: 16612
#
# File    : C.rb
# Author  : Kazune Takahashi
# Created : 12/22/2018, 9:01:32 PM
# Powered by Visual Studio Code
#

require 'prime'

n, q = gets.chomp.split(" ").map{|i| i.to_i}
ans = 1
q.prime_division.each{|prime, m|
  ans *= prime ** (m/n)
}
puts ans


Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define pb push_back
#define pair pair<int,int>
#define ll long long
#define f first
#define se second
using namespace std;
double pi=acos(-1.0);
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n;
  cin>>n;
  int h[n];
  for(int i=0;i<n;i++)
    cin>>h[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B=0;
  cin >> A;
  if(A>=100){
    B += 1;
    A -=100;
  }
  if(A>=10){
    B += 1;
    A -=10;
  }
  if(A>=1){
    B += 1;
  }
  cout << B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int mi = 1<<30;
  int ma =0;
  for(int i = 0;i<s.size();i++){
    if( s.at(i) == 'A'){
      mi = min(mi,i);
    }
    else if(s.at(i) == 'Z'){
      ma  = max(ma,i);
    }
  }
  cout << ma -mi+1;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {

//	入力の読み込み
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();

//	500円玉と5円玉の枚数を数える
		int ureshisa500 = total/500;
		int ureshisa5 = (total-ureshisa500*500)/5;

		//	枚数分の 嬉しさ を計算して表示
		System.out.print(ureshisa500*1000 + ureshisa5*5);
	}
}

Measured memory_bytes: 23892
N,K = map(int,input().split())
if K%2==1:
    n = N//K
    print(n**3)
else:
    if N>=K//2:
        n = N//K
        m = 1+(N-K//2)//K
        print(n**3+m**3)
    else:
        print(0)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) { cin >> a.at(i); }
  int ans = 1, mini = a.at(0);
  for (int i = 1; i < n; i++) {
    if (mini > a.at(i)) ans++;
    mini = min(mini, a.at(i));
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 1024
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;
constexpr int64_t kMod1 = 1000000007LL;
constexpr int64_t kMod2 = 998244353LL;
constexpr int64_t kMod3 = 3571L;

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

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  auto OutputResults = [&]() {
    for (int64_t d = 1; d <= D; ++d) {
      cout << contests[d] << endl;
    }
  };

  for (int64_t d = 1; d <= D; ++d) {
    int64_t best_score = INT64_MIN;
    int64_t best_conte = -1;
    for (int64_t c = 1; c <= kN; ++c) {
      contests[d] = c;
      int64_t temp_score = Score(d);
      if (temp_score > best_score) {
        best_score = temp_score;
        best_conte = c;
      }
    }
    contests[d] = best_conte;
  }

  int64_t day_index = 123;
  int64_t contest_index = 2034;
  int64_t ignore_index = 34234;
  int64_t prev_score = Score(D);
  constexpr int64_t kIgnoreBunbo = 10;
  constexpr int64_t kIgnoreBunshi = 0;

  vector<int64_t> best_contests;
  int64_t best_score = INT64_MIN;
  for (int64_t i = 0; i < 10000; ++i) {
    const int64_t day_candidate = (day_index % D) + 1;
    const int64_t original_contest = contests[day_candidate];
    const int64_t contest_candidate = (contest_index % kN) + 1;
    contests[day_candidate] = contest_candidate;
    const int64_t temp_score = Score(D);
    if (temp_score > prev_score) {
      // KEEP
      if (temp_score > best_score) {
        best_score = temp_score;
        best_contests = contests;
      }
    } else if (ignore_index <= kIgnoreBunshi && temp_score > prev_score * 0.9) {
      // KEEP
    } else {
      contests[day_candidate] = original_contest;
    }
    if (temp_score < best_score * 0.7) {
      contests = best_contests;
    }
    day_index = day_candidate + kMod1;
    contest_index = contest_candidate + kMod2;
    ignore_index += kMod3;
    ignore_index %= kIgnoreBunbo;
  }

  contests = best_contests;
  OutputResults();
  return 0;
}


Measured memory_bytes: 3820
typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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 ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int n, m;
    cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
vector<int> a;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  ll k;
    cin >> n>>k;
  	ll ans=k;
    for (int i = 0; i < n-1; i++)
    {
        ans*=(k-1);
    }
    cout << ans << "\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  int Q;
  cin >> Q;
  vector<ll> B(Q), C(Q);
  for (int i=0; i<Q; i++) cin >> B[i] >> C[i];
  ll S = accumulate(A.begin(), A.end(), 0LL); // A[i]の和の初期状態
  map<int, int> dict; // A[i]に登場する数字とその登場回数
  for (int i=0; i<N; i++) {
    if (dict.count(A[i])) dict[A[i]]++;
    else dict[A[i]] = 1;
  }
  for (int i=0; i<Q; i++) {
    S += (C[i]-B[i])*dict[B[i]];
    cout << S << endl;
    dict[C[i]] += dict[B[i]];
    dict[B[i]] = 0;
  }
  return 0;
}

Measured memory_bytes: 9972
#include<iostream>

template<long long modulus>
class ModInt{
    long long num;

    long long mod(long long n){
        if(n < 0LL){
            n = (n % modulus) + modulus;
        }
        return n % modulus;
    }

    long long ext_gcd(long long a, long long b, long long &x, long long &y){
        if(b == 0LL){
            x = 1;
            y = 0;
            return a;
        }

        long long d = ext_gcd(b, a % b, y, x);
        y -= a / b * x;

        return d;
    }

    long long get_inv(long long n){
        long long x, y;
        ext_gcd(n, modulus, x, y);
        return mod(x);
    }

public:
    ModInt(long long n = 0LL){
        num = mod(n);
    }

    long long get(void){
        return num;
    }

    ModInt &operator+=(const ModInt &rhs){
        num += rhs.num;
        if(num >= modulus){
            num -= modulus;
        }
        return *this;
    }

    ModInt &operator-=(const ModInt &rhs){
        if(num < rhs.num){
            num += modulus;
        }
        num -= rhs.num;
        return *this;
    }

    ModInt &operator*=(const ModInt &rhs){
        num = num * rhs.num % modulus;
        return *this;
    }

    ModInt &operator/=(const ModInt &rhs){
        long long inv = get_inv(rhs.num);
        num = num * inv % modulus;
        return *this;
    }

    template<typename T>
    ModInt &operator+=(const T &rhs){
        return *this += ModInt(rhs);
    }

    template<typename T>
    ModInt &operator-=(const T &rhs){
        return *this -= ModInt(rhs);
    }

    template<typename T>
    ModInt &operator*=(const T &rhs){
        return *this *= ModInt(rhs);
    }

    template<typename T>
    ModInt &operator/=(const T &rhs){
        return *this /= ModInt(rhs);
    }

    template<typename T>
    ModInt operator+(const T &rhs) const {
        return ModInt(*this) += ModInt(rhs);
    }

    template<typename T>
    ModInt operator-(const T &rhs) const {
        return ModInt(*this) -= ModInt(rhs);
    }

    template<typename T>
    ModInt operator*(const T &rhs) const {
        return ModInt(*this) *= ModInt(rhs);
    }

    template<typename T>
    ModInt operator/(const T &rhs) const {
        return ModInt(*this) /= ModInt(rhs);
    }

    ModInt &operator=(const ModInt &rhs){
        num = rhs.num;
        return *this;
    }

    template<typename T>
    ModInt &operator=(const T &rhs){
        num = mod(rhs);
        return *this;
    }

    bool operator<(const ModInt &rhs) const {
        return num < rhs.num;
    }
};

template<long long modulus>
std::istream &operator>>(std::istream &lhs, ModInt<modulus> &rhs){
    long long val;
    lhs >> val;
    rhs = val;
    return lhs;
}

template<long long modulus>
std::ostream &operator<<(std::ostream &lhs, ModInt<modulus> rhs){
    lhs << rhs.get();
    return lhs;
}

using mint = ModInt<1000000007LL>;

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

    mint ans = 1;
    for(int i = 1 ; i <= n ; ++i){
        ans *= i;
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var NM = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var (N, M) = (NM[0], NM[1]);
            var graph = new List<int>[N].Select(x => new List<int>()).ToArray();
            for (var i = 0; i < M; i++)
            {
                var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                var a = ab[0] - 1;
                var b = ab[1] - 1;
                graph[a].Add(b);
                graph[b].Add(a);
            }
            for (var i = 0; i < N; i++)
            {
                Console.WriteLine(graph[i].Count);
            }
        }
    }
}


Measured memory_bytes: 28268
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a,b,c,x;
	while(true){
		cin>>n>>a>>b>>c>>x;
		if(n==0)
			break;
		int y,count=0;
		for(int i=0;i<n;i++){
			cin>>y;
			while(true){
			if(x==y){
				x=(a*x+b)%c;
				count++;
				break;
			}
			if(count>10001||count==-1)
				break;
			x=(a*x+b)%c;
			count++;
			}
			if(count>10001)
				count=-1;
		}
		if(count==-1)
			cout<<"-1"<<endl;
		else
			cout<<count-1<<endl;
	}
    return 0;
}

Measured memory_bytes: 1160
const input=require("fs").readFileSync("/dev/stdin","utf8"),lines=input.trim().split("\n");let i=0,n=2,max=2;for(;line=lines.shift();){if(i%2==0){if([n,max]=line.split(" ").map(Number),0===n&&0===max)break}else{const i=line.split(" ").map(Number);let e=0;for(let t=0;t<=n;t++)for(let l=0;l<=n;l++){if(!i[t]||!i[l]||t===l)continue;const n=i[t]+i[l];n<=max&&n>e&&(e=n)}console.log(`${e||"NONE"}`)}i++}


Measured memory_bytes: 18264
#include <bits/stdc++.h>
#define ll long long
#define LL long long
#define PB push_back
#define INF 2000000000
#define X first
#define Y second
using namespace std;
const LL mod = 1000 * 1000 * 1000 + 7;
const LL MAX = 600005;
LL n;
vector<LL> a;
vector<LL> dp[2];
vector<LL> dp2;
vector<LL> getVal(vector<LL> a)
{
	vector<LL> ans(a.size());
	LL poku = 0;
	LL suma = 0 , suma2 = 0;
	for(LL i = 0; i < a.size(); i++)
	{
		poku += a[i];
		if(a[i] == 0)
			suma2 += 2;
		suma2 += a[i] & 1;
		if(poku < suma + suma2)
		{
			ans[i] = poku;
			suma = poku;
			suma2 = 0;
		}
		else
			ans[i] = suma + suma2;
	}
	return ans;
}
vector<LL> getVal2(vector<LL> prev , vector<LL> a)
{
	vector<LL> ans(a.size());
	LL poku = 0;
	LL suma = 0 , suma2 = 0;
	for(LL i = a.size() - 1; i >= 0; i--)
	{
		poku = prev[i];
		suma2 += !(a[i] & 1);
		if(poku < suma + suma2)
		{
			ans[i] = poku;
			suma = poku;
			suma2 = 0;
		}
		else
			ans[i] = suma + suma2;
	}
	return ans;
}
int main()
{
	//freopen("input.txt" , "r" , stdin);
	cin >> n;
	a.resize(n);
	dp2.resize(n);
	for(LL i = 0; i < n; i++)
		cin >> a[i];
	dp[0] = getVal(a);
	reverse(a.begin() , a.end());	
	dp[1] = getVal(a);	
	reverse(dp[1].begin() , dp[1].end());
	reverse(a.begin() , a.end());
	LL ans = dp[0][n - 1];
	dp2 = getVal2(dp[1] , a);
	for(LL i = 0; i < n; i++)
	{
		if(!i)
		{
			ans = min(ans , dp2[0]);
		}
		else
			ans = min(ans , dp[0][i - 1] + dp2[i]);
	}
	cout << ans;
}

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

using namespace std;

int main() {
  int n; cin >> n; n = (1 << n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<vector<int>> dp(n);
  int best = 0;
  for (int i = 0; i < n; ++i) {
    dp[i].push_back(i);
    for (int j = 1; j < n; j *= 2) {
      if (i & j) {
        for (auto x : dp[i ^ j])
          dp[i].push_back(x);
      }
    }
    sort(dp[i].begin(), dp[i].end());
    dp[i].erase(unique(dp[i].begin(), dp[i].end()), dp[i].end());
    sort(dp[i].begin(), dp[i].end(), [&](int i, int j) { return a[i] > a[j]; });
    if (i > 0) {
      dp[i].resize(2);
      best = max(best, a[dp[i][0]] + a[dp[i][1]]);
      cout << best << "\n";
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 43136
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;

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

    int n;
    cin >> n;
    const int MAX = 100010;
    vector<int> S(MAX + 1, 0);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        a--;
        S[a]++; S[b]--;
    }

    rep(i, MAX) {
        S[i + 1] += S[i];
    }

    int ans = 0;
    rep(i, MAX) {
        if (S[i] >= i) {
            ans = max(ans, i);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3624
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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







int main(){
    long long A; long double B;
    std::cin >> A >> B;
    std::cout << (long long)(A * B) << std::endl;
    return 0;
}


Measured memory_bytes: 3756
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;

int main() {
  long int N;
  long int X[200001], Y[200001];
  cin>>N;
  for (int i = 0; i < N; i++) {
    cin>>X[i];
  }
  memcpy(Y, X, sizeof(long int)*N);
  sort(Y, Y+N);
  
  for (long int i = 0; i < N; i++) {
    if (X[i] <= Y[N/2-1]) cout<<Y[N/2]<<endl;
    else cout<<Y[N/2-1]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 5376
#include <cstdio>

using namespace std;

int main(void){
    int lh,lw,h,w;
    scanf("%d %d",&lh,&lw);
    scanf("%d %d",&h,&w);
    int res = (lh-h)*(lw-w);
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for(int i = 0; i < n; i++) {
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

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

int main(void) {
    int N, K;

    std::cin >> N;
    std::cin >> K;

    int64_t ans = 0;
    int Npb = 0;
    int r0 = 0;
    int Ndivb = 0;

    for(int b = K + 1; b <= N; b++) {
        Npb = N % b;
        r0 = Npb;
        Ndivb = N/b;

        if(r0 > b-1)
            ans += (b - K) * (Ndivb + 1);
        else if(r0 < K)
            ans += (b - K) * Ndivb;
        else
            ans += (r0 - K + 1) * (Ndivb + 1) + (b-1-r0) * Ndivb;
    }

    if(K == 0)
        ans -= N;

    std::cout << ans << 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)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  if(s.size()==2){
    cout<<s<<endl;
  }
  else{
    cout<<s.at(2)<<s.at(1)<<s.at(0)<<endl;
  }
}

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

int main()
{
  int N;
  string S, T;
  cin >> N >> S >> T;
  string ans;
  rep(i, N)
  {
    ans.push_back(S[i]);
    ans.push_back(T[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<int,int>
#define iil pair<ll,ll>
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
#define debug(x) std::cerr<<#x<<": "<<(x)<<'\n'
#define all(x) x.begin(), x.end()
using namespace std;
void test_case(){
	ll n, x, m;
	cin>>n>>x>>m;
	ll amid = x;
	map<ll, ll>cnt;
	vector<ll>v;
	v.pb(x);
	int len = 0;
	ll rem = n - 1;
	for(ll i=1;i<n;i++){
		ll a = v[i-1];
		cnt[a] = i - 1;
		a*=a;
		a = a%m;
		if(cnt.count(a)){
			len = 0;
			ll s = 0;
			int l = v.size();
			for(int i=cnt[a];i<l;i++){
				s+=v[i];
				len++;
			}
			ll c = rem / len;
			amid+=c * s;
			rem%=len;
			for(int i = cnt[a];rem;i++, rem--){
				amid+=v[i];
			}
			cout<<amid<<endl;
			return;
		}
		rem--;
		amid+=a;
		v.pb(a);
	}
	cout<<amid<<endl;
}
int main(){
	int t = 1;
	// scanf("%d", &t);
	while(t--)test_case();
}


Measured memory_bytes: 6672
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1])
if __name__ == '__main__':
    main()


Measured memory_bytes: 7400
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<long long, long long> P;
int main(){
    string s;
    cin>>s;
    int po=0;
    int co=0;
    rep(i,s.size()){
        if (s[i]=='1'){
           po++; 
        }
        else{
            co++;
        }
    }
    cout<<2*min(po,co)<<endl;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;

class program{

  static void Main(){
    int D = int.Parse(Console.ReadLine());
    if(D==22){
      Console.WriteLine("Christmas Eve Eve Eve");
    }else if(D==23){
      Console.WriteLine("Christmas Eve Eve");
    }else if(D==24){
      Console.WriteLine("Christmas Eve");
    }else{
       Console.WriteLine("Christmas");
    }
  }
}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    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){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
    COMinit();
    int n,k;
    cin >> n >> k;
    for(int i=1;i<=k;i++){
        cout << (COM(k-1,i-1)*COM(n-k+1,i))%MOD << endl;
    }
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n, x, a[100001];
  long ans = 0;
  cin >> n >> x;
  for(int i = 0; i < n; i++)
    cin >> a[i];
  for(int i = 0; i < n - 1; i++){
    if(a[i] + a[i + 1] > x){
      int tmp = a[i] + a[i + 1] - x;
      a[i + 1] -= min(tmp, a[i + 1]);
      ans += tmp;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640