akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i : c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

  VAR(int, H, W);
  VEC(string, C, H);

  int cnt = 0;
  REP(hi, H) {
    OUT(C[hi])BR;
    OUT(C[hi])BR;
  }
  
  return 0;
}


Measured memory_bytes: 384
import sys
import bisect
from collections import defaultdict
input = sys.stdin.buffer.readline

H, W, N = map(int, input().split())
block = [defaultdict(int) for _ in range(W+1)]
for _ in range(N):
    x, y = map(int, input().split())
    block[y][x] = 1
for w in range(1, W+1):
    block[w][H+1] = 1

h, w = 1, 1
ans = min(list(block[1].keys())) - 1
if ans <= 1:
    print(1)
    exit()
while True:
    if block[w][h+1] == 1:
        ans = min(ans, h)
        break
    h += 1
    if w == W:
        break
    if block[w+1][h] == 0:
        w += 1
        block_w = []
        for k in block[w].keys():
            if block[w][k] == 1:
                block_w.append(k)
        block_w.sort()
        hmin = block_w[bisect.bisect_left(block_w, h)]
        ans = min(ans, hmin-1)

print(ans)


Measured memory_bytes: 130480
#include<stdio.h>

#define MAX 101

void initialize(int array[], int count_max);
int count(int input[], int array[], int count_max);
void judge(int array[], int max);

main()
{
	int input[MAX]; //入力代入用の配列
	initialize(input, MAX); //配列の初期化
	
	int array[MAX]; //出力用配列
	initialize(array, MAX); //初期化
	
	int i = 0; //制御変数
	int max = 0; //最頻値の個数を代入
	
	while(scanf("%d", &input[i]) != EOF)
	{
		i++;
	}
	
	max = count(input, array, i); //整数の入力された回数をカウント
	judge(array, max); //最頻値(mode)を判別
	return 0;
}

void initialize(int array[], int count_max)
{
	int i = 0;
	for(i = 0; i < count_max; i++)
	{
		array[i] = 0;
	}
}

int count(int input[], int array[], int count_max)
{
	int i = 0, max = 0;
	for(i = 0; i < count_max; i++)
	{
		array[input[i]]++;
		if(array[input[i]] >= max)
		{
			max = array[input[i]];
		}
	}
	//printf("max = %d\n", max);
	return max;
}

void judge(int array[], int max)
{
	int i = 0;
	//printf("max = %d\n", max);
	for(i = 1; i < MAX; i++)
	{
		if(max == array[i])
		{
			printf("%d\n", i);
		}
	}
}

Measured memory_bytes: 596
import java.util.Scanner;
public class Main {
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        double pi = Math.PI;
        double r = sc.nextDouble();

        double area = r*r*pi;
        double length = 2*pi*r;

        System.out.printf("%f %f",area, length);
    }
}


Measured memory_bytes: 28280
N = int(input())
dp = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
    a,b,c = map(int,input().split())
    dp[i][0] = max(dp[i-1][1] + a,dp[i-1][2] + a)
    dp[i][1] = max(dp[i-1][2] + b,dp[i-1][0] + b)
    dp[i][2] = max(dp[i-1][0] + c,dp[i-1][1] + c)
ans = max(dp[N][0],dp[N][1],dp[N][2])
print(ans)

Measured memory_bytes: 24356
#![allow(unused_imports, unused_macros, non_snake_case)]
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

//{{{ macros missing in 1.15.1
#[macro_use]
mod macros {
    macro_rules! eprint {
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = write!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! eprintln {
        () => { eprintln!(""); };
        ($($t:tt)*) => {{
            use ::std::io::Write;
            let _ = writeln!(::std::io::stderr(), $($t)*);
        }};
    }
    macro_rules! dbg {
        ($val:expr) => {
            match $val {
                tmp => {
                    eprintln!(
                        "[{}:{}] {} = {:#?}",
                        file!(),
                        line!(),
                        stringify!($val),
                        &tmp
                    );
                    tmp
                }
            }
        };
    }
}
//}}}

const MOD: usize = 998244353;

fn solve() -> usize {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    let n: usize = sc.read();
    let d: Vec<usize> = sc.read_vec(n);
    for i in 0..n {
        if i == 0 && d[i] != 0 {
            return 0;
        }
        if i != 0 && d[i] == 0 {
            return 0;
        }
    }

    let mut counter = HashMap::new();
    for i in 0..n {
        *counter.entry(d[i]).or_insert(0) += 1;
    }

    let mut answer = 1;
    let mut last = 1;
    for i in 1..n {
        let x = *counter.get(&i).unwrap_or(&0);
        for _ in 0..x {
            answer *= last;
            answer %= MOD;
        }
        last = x;
    }
    answer
}

fn run() {
    println!("{}", solve());
}

fn main() {
    std::thread::Builder::new()
        .name("run".to_string())
        .stack_size(1024 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap()
}

//{{{ Scanner
pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
//}}}


Measured memory_bytes: 16636
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {    
    int n;
    cin >>n;
    vector<ll>a(5,0);
    for(int i=0;i<n;i++){
        string t;
        cin >>t;
        if(t.at(0)=='M')a.at(0)++;
        if(t.at(0)=='A')a.at(1)++;
        if(t.at(0)=='R')a.at(2)++;
        if(t.at(0)=='C')a.at(3)++;
        if(t.at(0)=='H')a.at(4)++;
    }
    ll ans =0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                 
                ans+=a.at(i)*a.at(j)*a.at(k);
            }
        }
    }
    cout<<ans<<endl;
}
    



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

int main() {
  int N,X,T;
  cin >> N >> X >> T;
  if(N % X != 0) {
    cout << (N/X + 1)*T << endl;
  }
  else {
    cout << (N/X)*T << endl;
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  vector<int> c(N);
  int sum = 0;
  for(int i=0; i<K;i++){
    int d=0;
    cin >> d;
    vector<int> A(d);
    for(int j=0;j<d;j++){
  		cin >> A[j];
  		c[A[j]-1]=1;
    }    
  }  
  
  for(int i=0;i<N;i++){
  	if(c[i]==0){
    sum=sum+1;
    }
  }
  cout << sum <<endl;
  return 0; 
}







Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;


int main(){
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;
	return 0;
}


Measured memory_bytes: 3676
n,x = map(int,input().split())

c = list(map(int,input().split()))
c.append(x)

def gcd(a,b):
    n = max(a,b)
    m = min(a,b)
    if n%m==0:
        return m
    else:
        return gcd(m,n%m)


c.sort()
ans = c[1]-c[0]

for i in range(n-1):
    ans = gcd(ans,c[i+2]-c[i+1])

print(ans)

Measured memory_bytes: 62576
#include<stdio.h>
#include<math.h>
int main(void){
    int a,b,c;
    double d;
    double x;
    double S,L,h;
    scanf("%d %d %d",&a,&b,&c);
    x=c/180.0*M_PI;
    S=a*b*sin(x)/2;
    d=sqrt(a*a+b*b-2*a*b*cos(x));
    L=a+b+d;
    h=b*sin(x);
    printf("%lf %lf %lf\n",S,L,h);
    return 0;
}

Measured memory_bytes: 636
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        ans = -1
        break

print(ans)

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

int main() {
  int N;
  cin >> N;
  ll len = 0;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (len <= a) {
      len = a;
      continue;
    }
    ans += (len - a);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var S = sc.ReadStr();
        var a = S.IndexOf('A');
        var z = S.LastIndexOf('Z');
        var ans = z - a + 1;
        Console.WriteLine(ans);
    }

    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 12512
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    
    // 定義：各、出発時刻を「 departureTime 」と置く
    vector<int> departureTime;
    
    // 定義・代入：飯盛山行きのバスの数を表す整数「 N 」と置く
    int N;
    cin >> N;
    
    // 定義：飯盛山行きのバス出発時刻「 h , m 」と置く
    int h, m;
    
    
    // 反復・代入：飯盛山行きのバス出発時刻「 h , m 」を入力
    for(int i = 0; i < N; i++){
        cin >> h >> m;
        departureTime.push_back(h*60+m);
    }   
    
    // 定義・代入：鶴ケ城行きのバスの数を表す整数「 M 」と置く
    int M;
    cin >> M;
    
    // 定義：鶴ケ城行きのバス出発時刻「 h , m 」と置く
    int k, g;
    
    //　反復・代入：鶴ケ城行きのバス出発時刻「 h , m 」を入力
    for(int i = 0; i < M; i++){
        cin >> k >> g;
        departureTime.push_back(k*60+g);
    }  
    
    // ソート：出発時刻を「 departureTime 」を昇順に並べ替え ➡　早い順に並べるから
    sort( departureTime.begin(), departureTime.end() );
    
    // 重複削除： sort と unique で erase の重複要素を削除する
    departureTime.erase(unique( departureTime.begin(),  departureTime.end()),  departureTime.end());

    
    // 出力：departureTimeから時間の形に変換して表示
    for(int i = 0; i < departureTime.size(); i++){
        
        //計算：departureTimeに60分を掛けたから元に戻すために60分で割る　＋　分数を求めるために60分の余りを求める
        cout << departureTime[i] / 60 << ":" << ( (departureTime[i] % 60 < 10) ? "0" : "" ) << departureTime[i] % 60  << ( (i != departureTime.size()-1) ? " " : "\n" );
    }
    
}



Measured memory_bytes: 3172
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	int low_o, low_s;
	cin >> low_o >> low_s;
	for(int i = 1; i < n; i++){
		int a, b;
		cin >> a >>b;
		if(a > low_o){
			low_o = a;
			low_s = b;
		}
	}
	cout << low_o + low_s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int ans=3;
    if(a==b)
        ans--;
    if(a==c)
        ans--;
    if(b==c)
        ans--;
    if(ans==0)
        ans=1;
    
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;
PII x[100010], y[100010];
vector<TIII> e;
int par[100010];


void makePar(){
	iota(RNG(par, 0, N), 0);
}


int root(int x){
	if(par[x] == x) return x;
	return par[x] = root(par[x]);
}


bool same(int x, int y){
	return root(x) == root(y);
}


void unite(int x, int y){
	x = root(x);
	y = root(y);
	if(x == y) return;
	par[x] = y;
}


void makeE(){
	sort(RNG(x, 0, N));
	sort(RNG(y, 0, N));
	rep(i, 0, N-1) e.pb(mt(x[i+1].fi-x[i].fi, x[i].se, x[i+1].se));
	rep(i, 0, N-1) e.pb(mt(y[i+1].fi-y[i].fi, y[i].se, y[i+1].se));
}


int kruskal(){
	sort(ALL(e));
	int ans = 0;
	for(TIII t : e)
		if(!same(get<1>(t), get<2>(t))) ans += get<0>(t), unite(get<1>(t), get<2>(t));
	return ans;
}


signed main(){
	cin >> N;
	rep(i, 0, N) cin >> x[i].fi >> y[i].fi, x[i].se = y[i].se = i;

	makePar();
	makeE();

	cout << kruskal() << endl;

	return 0;
}

Measured memory_bytes: 6772
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int k = Integer.parseInt(sa[0]);
		int q = Integer.parseInt(sa[1]);

		sa = br.readLine().split(" ");
		int[] d = new int[k];
		for (int i = 0; i < d.length; i++) {
			d[i] = Integer.parseInt(sa[i]);
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			sa = br.readLine().split(" ");
			int n = Integer.parseInt(sa[0]) - 1;
			int x = Integer.parseInt(sa[1]);
			int m = Integer.parseInt(sa[2]);

			long[] d2 = new long[k + 1];
			int[] zero = new int[k + 1];
			for (int j = 0; j < d.length; j++) {
				zero[j + 1] += zero[j];
				d2[j + 1] = d2[j] + d[j] % m;
				if (d2[j] == d2[j + 1]) {
					zero[j + 1]++;
				}
			}

			int a = n / k;
			int b = n % k;
			BigInteger b0 = BigInteger.valueOf(x);
			BigInteger b1 = BigInteger.valueOf(d2[k]);
			BigInteger b2 = BigInteger.valueOf(a);
			BigInteger b3 = BigInteger.valueOf(d2[b]);
			BigInteger b4 = BigInteger.valueOf(m);
			BigInteger total = b0.add(b1.multiply(b2)).add(b3);
			long rem1 = total.divide(b4).longValueExact() - x / m;
			long rem2 = zero[k] * a + zero[b];
			long ans = n - rem1 - rem2;
			pw.println(ans);
		}
		pw.flush();
		br.close();
	}
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1e9+7) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

// ------------------------------------------------------------------------------------------

struct edge { int to, cost; };
typedef pair<int, int> P; // firstは最短距離、secondは頂点の番号

const int VV = 10000;
const int INF = 1e8;
int V;
vector<edge> G[VV];
int d[VV];

void dijkstra(int s) {
   // 最短距離firstが小さい順に取り出せるようにする
   priority_queue<P, vector<P>, greater<P>> que;
   fill(d, d + V, INF); // 距離全てをINFで初期化
   d[s] = 0; // スタート地点を0で初期化
   que.push(P(0, s)); // キューに初期位置のコスト、初期位置をpush

   while (que.size()) {
      P p = que.top(); que.pop(); // p: 今の{最短距離、頂点番号}
      int v = p.second; // 今の頂点番号
      if (d[v] < p.first) continue; // 今見ている頂点の歴代最小距離 < 今見ている頂点の最短距離
      for (int i = 0; i < G[v].size(); i++) { // 今の頂点に隣接する頂点を調べる
         edge e = G[v][i];
         if (d[e.to] > d[v] + e.cost) { // 遷移先の頂点の歴代最小距離 > 今の距離 + 遷移コスト
            d[e.to] = d[v] + e.cost; // 歴代最小距離の更新
            que.push(P(d[e.to], e.to)); // 更新した遷移先の頂点をキューに突っ込む
         }
      }
   }
}

int a[5], b[5];
map<int, int> mp;

signed main() {
  rep (i, 3) {
    cin >> a[i] >> b[i];
    mp[a[i]]++;
    mp[b[i]]++;
  }

  int one = 0, two = 0;
  repp (i, 1, 5) {
    if (mp[i] == 1) one++;
    if (mp[i] == 2) two++;
  }

  if (one == 2 && two == 2) {
    puts("YES");
  } else {
    puts("NO");
  }

  return 0;
}

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

namespace MyProgram{
    class AtCoder{
        static void Main(){
            long[] input = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            long N = input[0];
            long M = input[1];
            long waru = 1000000007;
            long kai_N = kai(N,waru);
            long kai_M = kai(M,waru);
            long result=0;
            
            if(N==M){
                result = ((kai_N%waru) * (kai_M%waru) * 2 ) % waru;
            }else if(N==M+1||N==M-1){
                result = ((kai_N%waru) * (kai_M%waru))%waru;
            }
            Console.WriteLine(result);

        }
        static long kai(long m,long n){
            long sum = 1;
            for(var i=1;i<=m;i++){
                sum *= i;
                sum = sum % n;
            }
            return sum;
        }
    } 
}

Measured memory_bytes: 11220
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

ll n, k, m;
string s;

int main()
{
  ll a, p;
  cin >> a >> p;
  ll ans = (a / 2 + p);

  cout << (a * 3 + p) / 2 << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFizzBuzzSum solver = new BFizzBuzzSum();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFizzBuzzSum {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt();
            long ans = 0;
            for (int i = 1; i <= n; i++) if (i % 3 != 0 && i % 5 != 0) ans += i;
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 25864
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,M;
	cin>>N>>M;
	int A,B;
	int cnt=0;
	static vector<long long> H(N+20);
	static vector<bool> anses(N+20);
	for(int i=1;i<=N;i++){
		cin>>H[i];
		anses[i]=true;
	}
	for(int i=0;i<M;i++){
		cin>>A>>B;
		if(H[A]<=H[B]&&anses[A]){
			anses[A]=false;
		}
		if(H[A]>=H[B]&&anses[B]){
			anses[B]=false;
		}
	}
	for(int i=1;i<=N;i++){
		if(anses[i])cnt++;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 3992
def dfs(i, f):
    if i == len(s) - 1:
        return sum(list(map(int,f.split("+"))))

    return dfs(i+1, f + s[i+1]) + dfs(i+1, f + "+" + s[i+1])

s = input()
print(dfs(0,s[0]))

Measured memory_bytes: 3060
#include <iostream>                                                                                       
                                                                                                          
using namespace std;                                                                                      
                                                                                                          
void call(int n) {                                                                                        
  for (int i=1; i<=n; i++) {                                                                              
    int x = i;                                                                                            
    if (x%3 == 0) {                                                                                       
      cout << " " << i;                                                                                   
    } else {                                                                                              
      while (x) {                                                                                         
        if (x % 10 == 3) {                                                                                
          cout << " " << i;                                                                               
          break;                                                                                          
        }                                                                                                 
        x /= 10;                                                                                          
      }                                                                                                   
    }                                                                                                     
  }                                                                                                       
  cout << endl;                                                                                           
}                                                                                                         
                                                                                                          
int main(void) {                                                                                          
  int n;                                                                                                  
  cin >> n;                                                                                               
  call(n);                                                                                                
                                                                                                          
}                                                                                                         
                                                                                                          
                                       

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int main(){
		#ifndef ONLINE_JUDGE					
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int N, K;
    cin >> N >> K;
    vector<int64_t> A, Apos, Aneg;
    int z = 0;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        A.push_back(abs(a));
        if(a > 0){
            Apos.push_back(a);
        }else if(a < 0){
            Aneg.push_back(abs(a));
        }else{
            z++;
        }
    }
    sort(Apos.rbegin(), Apos.rend());
    sort(Aneg.rbegin(), Aneg.rend());
    int szp = Apos.size(), szn = Aneg.size();

    int64_t ans = 1;
    if(szp + szn/2*2 >= K && (K%2 == 0 || szp > 0)){
        int pp = 0, pn = 0;
        if(K%2){
            ans = Apos[0];
            pp++;
            K--;
        }
        while(K){
            int64_t v1 = (szp-pp >= 2 ? Apos[pp] * Apos[pp+1] : 0);
            int64_t v2 = (szn-pn >= 2 ? Aneg[pn] * Aneg[pn+1] : 0);
            if(v1 >= v2){
                mul(ans, v1 % MOD);
                pp += 2;
            }else{
                mul(ans, v2 % MOD);
                pn += 2;
            }
            K -= 2;
        }
    }else if(z){
        ans = 0;
    }else{
        sort(A.begin(), A.end());
        for(int i=0; i<K; i++) mul(ans, A[i]);
        ans = (MOD-ans) % MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 7612
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  string s;cin>>s;
  if(n%2){
    cout<<"No"<<endl;
  }else{
    for(int i=0;i<n/2;i++){
      if(s[i] != s[i+n/2]){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
class Combination:
    def __init__(self, n):
        self.fac = [1] * (n + 1)
        for i in range(1, n + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (n + 1)
        self.invmod[n] = pow(self.fac[n], mod - 2, mod)
        for i in range(n, 0, -1):
            self.invmod[i - 1] = (self.invmod[i]  * i) % mod
    
    def calc(self, n, k):
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod

n, m, k = map(int, input().split())
mod = 998244353
c = Combination(n)

ans = 0
for i in range(k + 1):
    tmp = c.calc(n - 1, n - i - 1) * m * pow(m - 1, n - i - 1, mod) % mod
    ans = (ans + tmp) % mod

print(ans)


Measured memory_bytes: 24608
n = int(input())
s = input()
cnt = 0

for i in range(1000):
  kazu = (3 - len(str(i))) * '0' + str(i)
  if kazu[0] in s:
    p1 = s.index(kazu[0])
    if kazu[1] in s[p1+1:]:
      p2 = s[p1+1:].index(kazu[1])
      if kazu[2] in s[p1+p2+2:]:
        cnt+=1
print(cnt)
  

Measured memory_bytes: 3060
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

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

using ll = long long int;

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

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int main(){
    int n, sum = 0;
    cin >> n;
    rep(i, n){
        int a;
        cin >> a;
        if(a != (i + 1)){
            sum += 1;
        }
    }
    if(sum <= 2){
        cout << "YES" << endl;
    } else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
vector<vi> res;int n,m,q;
int cnt  =0;

int main(){
    int n,m;
    cin>>n>>m;
    int h[n];
    rep(i,n)cin>>h[i];
    vi edge[n];
    bool f[n];
    rep(i,n)f[i]=true;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        if(h[a]>h[b])f[b]=false;
        if(h[b]>h[a])f[a]=false;
        if(h[a]==h[b]){
            f[a]=false;
            f[b]=false;
        }
    }
    int ans =0;
    rep(i,n){
        if(f[i])ans++;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 6464
#include<stdio.h>
#include<math.h>
int main(void){
int ch1[110]={0},ch2[110]={0},a,b,c,d, ans=0;
scanf("%d%d%d%d", &a,&b,&c,&d);
ans = ((b-a)+(d-c)-abs(a-c)-abs(b-d)) / 2;
if(ans<0) ans=0;
printf("%d\n",ans);
return 0;
}

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

int main() {
	int a, b; cin >> a >> b;
	string s; cin >> s;
	if (s.size() != a + b + 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < a + b + 1; i++) {
		if (i == a) {
			if (s[i] != '-') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (!(0 <= s[i]-'0' && s[i]-'0' <= 9)) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int dp[45];

int fib(int n)
{
	if (n == 0 || n == 1) {
		dp[n] = 1;
	}
	if (dp[n] != -1) return dp[n];
	dp[n] = fib(n - 1) + fib(n - 2);

	return dp[n];
}

int main()
{
	int i, n, f;
	scanf("%d", &n);

	for (i = 0; i <= n; i++)
		dp[i] = -1;

	f = fib(n);
	printf("%d\n", f);

    return 0;
}




Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e9

signed main()
{
    int n;
    cin >> n;
    while (n > 0)
    {
        if (n % 10 == 7)
        {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	int n;cin >> n;
	vector<ll> v(n);
	vector<P> g(n);
	REP(i, n){
		v[i] = i;
		ll a, b;cin >> a >> b;
		g[i] = MP(a, b);
	}

	double ans = 0;
	ll cou = 1;
	REP(i, n)cou *= (i+1);

	REP(i, cou){
		REP(i, n - 1){
			int id_a = v[i];
			int id_b = v[i+1];
			double xx = (g[id_a].FI - g[id_b].FI) * (g[id_a].FI - g[id_b].FI);
			double yy = (g[id_a].SE - g[id_b].SE) * (g[id_a].SE - g[id_b].SE);
			ans += sqrt(xx + yy);
		}
		next_permutation(ALL(v));
	}

	cout << Decimal << ans/cou << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    string s;
    cin>>s;
    if(s[s.size()-1]=='s') s+="es";
    else s+="s";
    cout<<s;
    return 0;
}


Measured memory_bytes: 3636
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[N];
		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int i = 0; i < a.length; i++) {
			map.put(sc.nextInt(), i);
		}
		int i = 0;
		for(Map.Entry<Integer, Integer> e : map.entrySet()) {
			System.out.print(e.getValue() + 1);
			i++;
			if (i<N) {
				System.out.print(" ");
			}
		}
	}
}


Measured memory_bytes: 70412
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int a, b;
	cin >> a >> b;
	cout << max(a - 2 * b, 0) << '\n';
 	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
E = 0
for i in range(N):
    if S[i] == 'E':
        E += 1
ne = 0
nw = 0
ansl = []
for i in range(N):
    if S[i] == 'E':
        ansl.append(nw+E-ne-1)
        ne += 1
    else:
        ansl.append(nw+E-ne)
        nw += 1
print(min(ansl))

Measured memory_bytes: 15500
#include <iostream>
#include <cmath>
#include <map>

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

    std::multimap<int, int> a;
    int val;
    for(int i = 0; i < n; ++i){
        std::cin >> val;
        a.insert(std::make_pair(val, i));
    }

    int max = a.rbegin()->first;
    for(int i = 0; i < n; ++i){
        int ans = max;
        if(a.find(max)->second == i){
            std::map<int, int>::reverse_iterator rit = a.rbegin();
            ++rit;
            ans = rit->first;
        }
            
        std::cout << ans << std::endl;
    }

    return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define nmax 200005

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef tree<
ll,
null_type,
less_equal<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

ll a[nmax]={};

int main(){
	int n,k; cin >> n >> k;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		a[i]+=a[i-1];
	}
	ordered_set s;
	s.insert(0);
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=s.order_of_key(a[i]-1ll*k*i+1);
		s.insert(a[i]-1ll*k*i);
	}
	cout << ans << endl;
	return 0;
}



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

void func_A() {
    int A, B;
    cin >> A >> B;
    int res = A > 2 * B ? A - 2 * B : 0;
    cout << res << endl;
}
void func_B() {
    int N;
    cin >> N;
    vector<ll> d(N);
    rep(i, N) {
        cin >> d[i];
    }
    ll res = 0;
    for(int i = 0; i < N - 1; i++) {
        for(int j = i + 1; j < N; j++) {
            res += d[i] * d[j];
        }
    }
    cout << res << endl;
}
void func_C() {
    int N;
    string S, res;
    cin >> N;
    cin >> S;
    char now = S[0];
    rep(i, N) {
        if(now != S[i]) {
            res += now;
            now = S[i];
        }
    }
    if(res[res.size() - 1] != S[N - 1]) res += S[N - 1];
    cout << res.size() << endl;
}
int main() {
    func_C();
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Possible"; }
  string_type do_falsename() const { return "Impossible"; }
};

void solve(ll A, ll B) {
  cout << (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll B;
	ll A;
	scanf("%lld", &A);
	scanf("%lld", &B);
	solve(A, B);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int m[10],out[3]={0,0,0};

	for(int i=0;i<10;i++) //???????????????
		scanf("%d",&m[i]);

	for(int i=0;i<10;i++){
		if(out[0]<=m[i]){
			out[2]=out[1];
			out[1]=out[0];
			out[0]=m[i];
		}else if(out[1]<=m[i]){
			out[2]=out[1];
			out[1]=m[i];
		}else if(out[2]<=m[i]){
			out[2]=m[i];
		}
	}

	for(int i=0;i<3;i++)
		printf("%d\n",out[i]);

	return 0;
}

Measured memory_bytes: 2680