akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int a[3];
  int k;

  cin >> a[0] >> a[1] >> a[2];
  cin >> k;
  sort(a, a+3);
  reverse(a, a+3);
  for(int i = 0; i < k; i++){
  	a[0] *= 2;
  }
  cout << a[0] + a[1] + a[2] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int ans = 0;
  vector<int> B(N-1);
  for(int i=0;i < N-1;i++) cin >> B[i];
  ans += B[0];
  ans += B[N-2];
  for(int i=0;i < N - 2;i++) ans += min(B[i],B[i + 1]);
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
a_i = map(int,input().split())
index = 0
count = 0
a_i_list = list(a_i)
while index < N-1:
    if a_i_list[index] == a_i_list[index+1]:
        count+=1
        index+=1
    index+=1
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 100000000
using ll = long long ;

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> avec;
    vector<int> bvec;
    rep(i,n) {
        int a,b;
        cin >> a >> b;
        avec.push_back(a);
        bvec.push_back(b);
    }

    vector<int> cvec;
    vector<int> dvec;
    rep(i,m) {
        int c,d;
        cin >> c >> d;
        cvec.push_back(c);
        dvec.push_back(d);
    }
    for(int i=0;i<n;i++){
        int ans = 0;
        int tmp=(abs(avec[i]-cvec[0]) + abs(bvec[i]-dvec[0]));
        for (int j=1;j<m;j++){
            int tmp2 = (abs(avec[i]-cvec[j]) + abs(bvec[i]-dvec[j]));
            if (tmp2 < tmp) {
                tmp = tmp2;
                ans = j;
            }
        }
        cout << ans+1 << endl;
    }
    
}

Measured memory_bytes: 256
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

n,k = map(int,input().split())
a = list(map(int,input().split()))


li = [0 for i in range(n+1)]
for i in range(n):
    li[a[i]] += 1

li = sorted(li,reverse = True)

ttl = 0
for i in range(n+1):
    ttl += li[i]

    if i == k-1:
        break

ans = n-ttl

print(ans)






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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  cout << N + (X - accumulate(A.begin(), A.end(), 0)) / *min_element(A.begin(), A.end()) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int H, W, i, k;
    while(1) {
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0) break;
        for(i = 0; i < H; i++) {
            for(k = 0; k < W; k++) printf("#");
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1756
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

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

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	n, w := sc.nextInt(), sc.nextInt()
	W := make([]int, n)
	V := make([]int, n)
	for i := 0; i < n; i++ {
		W[i] = sc.nextInt()
		V[i] = sc.nextInt()
	}
	base := W[0]
	var nums [4][]int
	for i := 0; i < n; i++ {
		idx := W[i] - base
		nums[idx] = append(nums[idx], V[i])
	}
	for i := 0; i < 4; i++ {
		sort.Sort(sort.Reverse(sort.IntSlice(nums[i])))
	}
	ans := 0
	for i := 0; i <= len(nums[0]); i++ {
		for j := 0; j <= len(nums[1]); j++ {
			for k := 0; k <= len(nums[2]); k++ {
				for l := 0; l <= len(nums[3]); l++ {
					if base*(i+j+k+l)+j*1+k*2+l*3 > w {
						continue
					}
					total := 0
					for _, num := range nums[0][:i] {
						total += num
					}
					for _, num := range nums[1][:j] {
						total += num
					}
					for _, num := range nums[2][:k] {
						total += num
					}
					for _, num := range nums[3][:l] {
						total += num
					}
					ans = max(ans, total)
				}
			}
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
 long K,A,B,i,c,al;
  cin>>K>>A>>B;
  al=A+2;
  if(al>B){
  cout<<K+1<<endl;
  }else{
    al=K-A+1;
    
 if(al%2==0){
   al=al/2;
 cout<<A+(B-A)*al<<endl;
 }else{
   al=al/2;
 cout<<A+(B-A)*al+1<<endl;
 }
  }
}

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

int main(){
	string s,t;
    cin>>s>>t;
    int sum=0;
    for(int i=0;i<s.size()&&i<t.size();i++){
    	if(s[i]!=t[i])sum++;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
#include <cstring>
#include <iostream>
#define pie acos(-1)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sl(a) scanf("%lld",&a)
#define sll(a,b) scanf("%lld %lld",&a,&b)
#define slll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define ss(st) scanf("%s",st)
#define sch(ch) scanf("%ch",&ch)
#define ps(a) printf("%s",a)
#define newLine() printf("\n")
#define pi(a) printf("%d",a)
#define pii(a,b) printf("%d %d",a,b)
#define piii(a,b,c) printf("%d %d %d",a,b,c)
#define pl(a) printf("%lld",a)
#define pll(a,b) printf("%lld %lld",a,b)
#define plll(a,b,c) printf("%lld %lld %lld",a,b,c)
#define pd(a) printf("%lf",a)
#define pdd(a,b) printf("%lf %lf",a,b)
#define pddd(a,b,c) printf("%lf %lf %lf",a,b,c)
#define pch(c) printf("%ch",c)
#define debug1(str,a) printf("%s=%d\n",str,a)
#define debug2(str1,str2,a,b) printf("%s=%d %s=%d\n",str1,a,str2,b)
#define debug3(str1,str2,str3,a,b,c) printf("%s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c)
#define debug4(str1,str2,str3,str4,a,b,c,d) printf("%s=%d %s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c,str4,d)
#define for0(i,n) for(i=0;i<n;i++)
#define for1(i,n) for(i=1;i<=n;i++)
#define forab(i,a,b) for(i=a;i<=b;i++)
#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define NL puts("")
#define sd(a) scanf("%lf",&a)
#define sdd(a,b) scanf("%lf %lf",&a,&b)
#define sddd(a,b,c) scanf("%lf %lf %lf",&a,&b,&c)
#define SP printf(" ")
#define LL long long int
#define ULL unsigned long long int
#define N 1000007
#define MOD 100000009
#define pub(x) push_back(x)
#define pob(x) pop_back(x)
#define mem(ara,value) memset(ara,value,sizeof(ara))
#define INF INT_MAX
#define eps 1e-8
#define checkbit(n, pos) (n & (1<<pos))
#define setbit(n, pos) (n | (1<<pos))
#define para(a,b,ara)\
for(int i=a;i<=b;i++){\
    if(i!=0){printf(" ");}\
    printf("%d",ara[i]);\
}\
printf("\n");
#define pvec(vec)\
for(int i=0;i<vec.size();i++){\
    if(i!=0){printf(" ");}\
    printf("%d",vec[i]);\
}\
printf("\n");
#define ppara(n,m,ara)\
for(int i=0;i<n;i++){\
    for(int j=0;j<m;j++){\
        if(j!=0){printf(" ");}\
        printf("%d",ara[i][j]);\
    }\
    printf("\n");\
}
#define ppvec(n,vec)\
for(int i=0;i<n;i++){\
    for(int j=0;j<vec[i].size();j++){\
        if(j!=0){printf(" ");}\
        printf("%d",vec[i][j]);\
    }\
    printf("\n");\
}
#define sara(a,b,ara)\
for(int i=a;i<=b;i++){\
    scanf("%d",&ara[i]);\
}
using namespace std;
int M;
void input(){
    si(M);
}
void solve(){
    pi(24-M+24);NL;
}
int main(){
//    freopen("input.txt","r",stdin);
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	String ans = "";
    	
    	int sx = sc.nextInt();
    	int sy = sc.nextInt();
    	int tx = sc.nextInt();
    	int ty = sc.nextInt();
    	
    	int c1 = ty-sy;
    	int c2 = tx-sx;
    	
    	for(int i=0; i<c1; i++){
    		ans = ans + "U";
    	}
    	for(int i=0; i<c2; i++){
    		ans = ans + "R";
    	}
    	for(int i=0; i<c1; i++){
    		ans = ans + "D";
    	}
    	for(int i=0; i<c2; i++){
    		ans = ans + "L";
    	}
    	ans = ans + "L";
    	for(int i=0; i<c1+1; i++) ans = ans + "U";
    	for(int i=0; i<c2+1; i++) ans = ans + "R";
    	ans = ans + "D";
    	ans = ans + "R";
    	for(int i=0; i<c1+1; i++) ans = ans + "D";
    	for(int i=0; i<c2+1; i++) ans = ans + "L";
    	ans = ans + "U";
    	

    	
    	System.out.println(ans);
    

    }
}


Measured memory_bytes: 207048
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

ll choose2(ll cnt)
{
  if (cnt < 2)
  {
    return 0;
  }
  return cnt * (cnt - 1) / 2;
}

signed main()
{
  ll N;
  vector< ll > vec;
  unordered_map< ll, ll > m;

  cin >> N;
  REP(i, N)
  {
    ll a;
    cin >> a;

    vec.push_back(a);
  }

  for (ll i = 0; i < vec.size(); i++)
  {
    ll a = vec[i];
    m[a] = m[a] + 1;
  }

  ll all = 0;
  for (pair< ll, ll > p : m)
  {
    // cout << p.first << " " << p.second << endl;
    all += choose2(p.second);
  }

  REP(i, N)
  {
    ll a = vec[i];
    ll ans = all - (m[a] - 1);
    cout << ans << endl;
  }
}


Measured memory_bytes: 10096
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int x;
  	cin>>x;
  	int k=1;
  	while (1) {
      	if(k*x%360==0) {
          	cout<<k<<endl;
          	break;
      	}
      	k++;
    }  
}


Measured memory_bytes: 3604
// 4/26 リアルタイム参加

#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

    while (true) {
        // cout << "here?" << endl;
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }

        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }

    // cout << "end" << endl;
}


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

int main(){
    int x,y;
    cin>>x>>y;
    int turu=0;
    rep(i,2*x){
        int kame=x-turu;
        int p=2*turu+4*kame;
        if(p==y && (turu>=0 && turu<=x)){
            cout<<"Yes\n";
            return 0;
        }
        turu++;
    }
    cout<<"No\n";
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll a[200005];
ll dp[200005];
ll b[4];
int main() {
    ll n;
    cin >> n;
    rep(i , n)
        cin >> a[i];
    dp[0] = a[0];
    reps(i, n-1){
        dp[i] = dp[i-1] + a[i];
    }
    ll ans = 1 << 30;
    ll lf, rt;
    lf = 0;
    rt = 2;
    for(ll i = 2; i < n; i++){
        ll lmn = 1L << 60;
        ll rmn = 1L << 60;
        for(ll j = lf; j < i ; j++){
            if(lmn >= abs(dp[j] -abs(dp[i-1] - dp[j]))){
                b[0] = dp[j];
                b[1] = dp[i-1] -dp[j];
                lmn =abs(dp[j] -abs(dp[i-1] - dp[j]));
                lf = j;
            }else{break;}
        }
        for(ll j = rt; j < n; j++){
            if(rmn >= abs(abs(dp[j] - dp[i-1]) -abs(dp[n-1] - dp[j]))){
                b[2] = dp[j] - dp[i-1];
                b[3] = dp[n-1] - dp[j];
                rmn = abs(abs(dp[j] - dp[i-1]) -abs(dp[n-1] - dp[j]));
                rt  = j;
            }else break;
        }
        sort(b, b+4);
        ans = min(ans, b[3] - b[0]);
    } 
    cout << ans << endl;
}



Measured memory_bytes: 3328
import java.io.*;
import java.math.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" "); int i,pos=0;
        for(i=0;i<5;i++)
        if(Integer.parseInt(s[i])==0) {pos=i+1; break;}
        System.out.print(pos);
    }
}


Measured memory_bytes: 32428
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  int ans = 0;
  int length = s.size();
  for(int i = length; i >= 0; i-=2) {
    string t = s.substr(0,i/2);
    if(s.substr(i/2) == t && i != length) {
      ans = s.size();
      break;
    }
    s.pop_back();
    s.pop_back();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
struct Bulb {
    p: usize,
    switches: Vec<usize>,
}

fn dfs(switches: &mut Vec<usize>, bulbs: &Vec<Bulb>, n: usize, now_n: usize) -> usize {
    let mut sum = 0usize;

    for i in 0..2 {
        switches[now_n] = i;

        if now_n == n-1 {
            let mut light_all = true;
            for bulb in bulbs {
                let mut switch_sum = 0;
                for switch in &bulb.switches {
                    switch_sum += switches[*switch - 1];
                }
                if switch_sum % 2 != bulb.p {
                    light_all = false;
                    break;
                }
            }

            if light_all {
                sum += 1;
            }
        }
        else {
            sum += dfs(switches, bulbs, n, now_n+1);
        }
    }

    sum
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();


    let mut bulbs = Vec::new();
    for _i in 0..m {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let _k: usize = iter.next().unwrap().parse().unwrap();
        let switches = iter.map(|x| x.parse::<usize>().unwrap()).collect::<Vec<_>>();
        bulbs.push(Bulb{p: 0, switches: switches});
    }

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    for i in 0..m {
        bulbs[i].p = iter.next().unwrap().parse().unwrap();
    }

    let mut switches = vec![0; n];
    let ans = dfs(&mut switches, &bulbs, n, 0);

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void func_A() {

    int s, w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe";
    else cout << "safe";
}

void func_B() {

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (a > 0) {
        c -= b;
        if (c <= 0) break;
        a -= d;
    }

    if (c <= 0) cout << "Yes";
    else cout << "No";
 
}

void func_C() {

    //2重ループで実行時間超過

    int n;
    cin >> n;

    unsigned long long count = 0;
    string temp;
    cin >> temp;
    vector<string> str;
    str.push_back(temp);
    ++count;
    for (int i = 0; i < n - 1; ++i) {
        string temp;
        cin >> temp;
        
        for (int j = 0; j < str.size(); ++j) {
            if (str[j] == temp) break;
            if (j == str.size() - 1) {
                str.push_back(temp);
                ++count;
            }
        }
    }

    cout << count;
}

void func_Cfix() {

    int n;
    cin >> n;

    vector<string> str(n);

    int count = 0;
    string check = "";
    for (int i = 0; i < n; ++i) {
        cin >> str[i];
        string temp = " " + str[i] + " ";
        if (check.find(temp) != string::npos) continue;
        check += temp;
        ++count;
    }

    cout << count;
}

void func_Cfix2() {

    int n;
    cin >> n;
    
    vector<string> str(n);
    for (int i = 0; i < n; ++i) cin >> str[i];

    sort(str.begin(), str.end());
    int count = 1;
    for (int i = 1; i < n; ++i) {
        if (str[i - 1] != str[i])  ++count;
    }

    cout << count;
         
}

void func_D() {


}

int main() {

    //func_A();
    //func_B();
    //func_C();
    //func_Cfix();
    func_Cfix2();
    //func_D();

    return 0;

}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,H,W; cin >> N >> H >> W;
    int ans=0;
    for (;N--;){
        int A,B; cin >> A >> B;
        ans+=(H<=A&&W<=B);
    }
    cout << ans << '\n';
}

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

int main() {
    list<int> list1;
    int n, tmp;
    string string1;
    cin >> n;
    while (n--) {
        cin >> string1;
        if (string1 == "insert") {
            cin >> tmp;
            list1.push_front(tmp);
        } else if (string1 == "delete") {
            cin >> tmp;
            auto itend = list1.end();
            for (auto it = list1.begin(); it != itend; it++) {
                if (*it == tmp) {
                    list1.erase(it);
                    break;
                }
            }
        } else if (string1 == "deleteLast") {
            list1.pop_back();
        } else if (string1 == "deleteFirst") {
            list1.pop_front();
        }
    }
    int i = 0;
    for (auto &&item : list1) {
        if (i++)
            printf(" ");
        printf("%d", item);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 34468
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX INT_MAX
#define MIN INT_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
set <int> s;
bool ar[100001];
void seive() {
	ar[0] = ar[1] = true;

	for(int p=2; p*p<=100001; p++) {
		if(ar[p] == false) {
			for(int i=p*p;i<=100001;i+=p)
				ar[i] = true ;
		}
	}

	for(int p=2;p<=100001;p++) {
		if(ar[p] == false)
			s.insert(p);
	}
}
void solve() {
	int n;
	cin >> n;
	cout << (n+1)/2 << endl;
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::ops::*;
use std::slice::*;
use std::*;

const MOD: isize = 1000000007;
fn main() {
    let (A, B) = {
        let vs: Vec<usize> = read_vec();
        (vs[0], vs[1])
    };

    // ans*1.08 == A && ans * 1.1 == B

    for i in 0..2000 {
        if ((i as f32 * 0.08) as usize == A && (i as f32 * 0.1) as usize == B) {
            println!("{}", i);
            return;
        }
    }
    println!("{}", -1);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace() // iter
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func do(m [][]int, ci []int, c int, preChanged []int) ([]int, int, []int, bool) {
	ci2 := make([]int, len(ci))
	copy(ci2, ci)
	checked := make([]bool, len(m))
	changed := make([]int, 0, len(m))
	flag := false
	j := len(m[0])
	for _, i := range preChanged {
		if checked[i] {
			continue
		}
		if ci[i] >= j {
			continue
		}
		n := m[i][ci[i]]
		if checked[n-1] {
			continue
		}
		if ci[n-1] >= j {
			flag = false
			break
		}
		if m[n-1][ci[n-1]] == i+1 {
			ci[i] = ci[i] + 1
			checked[i] = true
			ci[n-1] = ci[n-1] + 1
			checked[n-1] = true
			flag = true
			c++
			changed = append(changed, i)
			changed = append(changed, n-1)
		}
	}
	if !flag {
		return nil, c, nil, true
	}
	return ci, c, changed, false
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	var n int
	fmt.Scan(&n)
	m := make([][]int, n)
	for i := 0; i < n; i++ {
		v := nextInts(n - 1)
		m[i] = v
	}
	var day int
	var c int
	ci := make([]int, len(m))
	max := (n * (n - 1)) / 2
	preChanged := make([]int, 0, len(m))
	for i := 0; i < len(m); i++ {
		preChanged = append(preChanged, i)
	}
	for c < max {
		checked := make([]bool, len(m))
		changed := make([]int, 0, len(m))
		flag := false
		j := len(m[0])
		for _, i := range preChanged {
			if checked[i] {
				continue
			}
			if ci[i] >= j {
				continue
			}
			n := m[i][ci[i]]
			if checked[n-1] {
				continue
			}
			if ci[n-1] >= j {
				flag = false
				break
			}
			if m[n-1][ci[n-1]] == i+1 {
				ci[i] = ci[i] + 1
				checked[i] = true
				ci[n-1] = ci[n-1] + 1
				checked[n-1] = true
				flag = true
				c++
				changed = append(changed, i)
				changed = append(changed, n-1)
			}
		}
		if !flag {
			day = -1
			break
		}
		preChanged = changed
		day++
	}
	fmt.Println(day)
}


Measured memory_bytes: 18432
from scipy.sparse import csr_matrix as csr
from scipy.sparse.csgraph import connected_components as cc


def solve(string):
    n, m, *xyz = map(int, string.split())
    return str(cc(csr(([1] * m, (xyz[::3], xyz[1::3])), shape=(n + 1, n + 1)))[0] - 1)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(m)])))

Measured memory_bytes: 44704
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
 
int main() {
 
  int long long t=0,i=0,j=0,S,W;
  double sum=0;
  string ans;

  cin >> S >> W;
  
  if (S>W)
  {
    ans="safe";
  }else
  {
    ans="unsafe";
  }
  
  
  
  
  cout << ans << endl;
  
  
  
  return 0;
}

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

int main() {
  string O, E;
  cin >> O >> E;

  for (int i=0; i<min(O.size(), E.size()); i++) {
    cout << O[i] << E[i];
  }
  if (O.size() > E.size()) {
    cout << O[O.size()-1];
  }
  if (O.size() < E.size()) {
    cout << E[E.size()-1];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char b[10];
    scanf("%s", &b);
    if (b[2] == b[3] && b[4] == b[5])
    {
        printf("Yes\n");
    }
     else 
	{
        printf("No\n");
    }
    return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

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

void solve() {
  long long a, b, n; scanf("%lld%lld%lld", &a, &b, &n);
  if (n >= b) printf("%lld", a*(b-1)/b);
  else printf("%lld", a*n/b);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    ll n,a[3],b[3],c[3],i,j;
    for(i=0;i<3;i++) cin>>a[i];
    for(i=0;i<3;i++) cin>>b[i];
    for(i=0;i<3;i++) cin>>c[i];
    cin>>n;
    vector<ll> d(n);
    map<ll,ll> mp;
    for(i=0;i<n;i++) cin>>d[i],mp[d[i]]++;
    for(i=0;i<3;i++)
    {
        if(mp[a[i]] && mp[b[i]] && mp[c[i]]) {cout<<"Yes";return 0;}
    }
    if(mp[a[0]] && mp[a[1]] && mp[a[2]]) {cout<<"Yes";return 0;}
    if(mp[b[0]] && mp[b[1]] && mp[b[2]]) {cout<<"Yes";return 0;}
    if(mp[c[0]] && mp[c[1]] && mp[c[2]]) {cout<<"Yes";return 0;}
    if(mp[a[0]] && mp[b[1]] && mp[c[2]]) {cout<<"Yes";return 0;}
    if(mp[c[0]] && mp[b[1]] && mp[a[2]]) {cout<<"Yes";return 0;}
    cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 100005
#define inf 1000000000000000008LL
ll arr[102], dp[102][mx], weight[102], value[102];
int n;
int main()
{
    int cap;
    scanf("%d%d",&n, &cap);
    for(int i=1; i<=n; i++)
        scanf("%lld%lld",&weight[i], &value[i]);
    memset(dp, 0, sizeof dp);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=cap; j++){
            if(j - weight[i] >=0)
                dp[i][j] = max(dp[i-1][j], value[i] + dp[i-1][ j-weight[i] ]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    printf("%lld\n", dp[n][cap]);
}



Measured memory_bytes: 80000
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  list <int> L;
  auto it = L.end();

  auto insert=[&](int x){
    L.insert(it, x);
    it--;
  };

  auto move =[&](int d){
    while( d > 0 ) d--, it++;
    while( d < 0 ) d++, it--;
  };

  auto erase=[&](){
    auto tmp = it++;
    L.erase(tmp);
  };

  int q;
  cin>>q;
  while(q--){
    int cmd;
    cin>>cmd;
    if(cmd == 0){
      int x;
      cin>>x;
      insert(x);
    }
    if(cmd == 1){
      int d;
      cin>>d;
      move(d);
    }
    if(cmd ==2){
      erase();
    }
  }
  
  for(int l:L) cout<<l<<endl;
  return 0;
}



Measured memory_bytes: 18496
import sys
N = int(input())
X = []
Y = []
H = []
for i in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
while H[0] == 0:
    X.append(X[0])
    Y.append(Y[0])
    H.append(H[0])
    X = X[1:]
    Y = Y[1:]
    H = H[1:]
x1 = X[0]
y1 = Y[0]
h1 = H[0]
for Cx in range(101):
    for Cy in range(101):
        h = h1 + abs(x1-Cx) + abs(y1-Cy)
        i = 1
        while i < N and H[i] == max(h - abs(X[i]-Cx) - abs(Y[i]-Cy), 0):
            i += 1
        if i == N:
            print(Cx, Cy, h)
            sys.exit()

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



def solve(s):
  s = s.replace("dream","D")
  s = s.replace("erase","E")
  s = s.replace("Der","")
  s = s.replace("Er","")
  s = s.replace("D","")
  s = s.replace("E","")
  if len(s) == 0:
    return "YES"
  else:
    return "NO"

if __name__ == "__main__":
  S = str(input())
  print(solve(S))

Measured memory_bytes: 3188
/*input
5
1 1 1 2 2
*/

#include <bits/stdc++.h>

using namespace std;

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

	int n;
	cin >> n;

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

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

	if(a[n-1] - a[0] > 1) {
		cout << "No\n";
	}
	else if(a[n-1] - a[0] == 0) {
		if(a[0] == n-1) {
			cout << "Yes\n";
		}
		else if(2*a[0] <= n) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	else {
		int unq = 0;
		for(int i = 0; i < n; i++) {
			if(a[i] == a[0]) unq++;
		}

		int rem = a[n-1] - unq;
		int sz = n - unq;

		if(rem <= 0) {
			cout << "No\n";
		}
		else if(2*rem <= sz) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}

	return 0;  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define VMAX 100000
#define WMAX 1000000000
vector<int> dp(VMAX+1, WMAX+1);
 
int main(){
	int N,W; cin>>N>>W;
	dp[0] = 0;
	for(int i=1; i<=N; i++){
		int w,v; cin>>w>>v;
		for(int j=VMAX; j>=v; j--) dp[j] = min(dp[j], dp[j-v] + w);
	}
 
	int a = 0;
	for(a=VMAX; a>=1; a--) if(dp[a]<=W) break;
	cout<< a <<endl;
}

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

using i64 = int64_t;

int main(){
    string s;
    while(cin >> s, s != "#"){
        int y, m, d;
        cin >> y >> m >> d;
        string g;
        if(y > 31 || y == 31 && m > 4){
            g = "?";
            y -= 30;
        }
        else g = s;
        cout << g << " " << y << " " << m << " " << d << endl;
    }

    return 0;
}



Measured memory_bytes: 3144
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    int x, y;
    cin >> y >> x;
    char l[50][50];
    int m[50][50];
    fill(m[0], m[50], 0);
    fill(l[0], l[50], '.');
    for(int i = 0; i < y; i++){
        for(int j = 0; j < x; j++){
            cin >> l[i][j];
        }
    }
    for(int i = 0; i < y; i++){
        for(int j = 0; j < x; j++){
            if(l[i][j] == '#'){
                if(i != 0) m[i-1][j]++;
                if(i != 0 && j != 0) m[i-1][j-1]++;
                if(j != 0) m[i][j-1]++;
                if(i != y-1 && j != 0) m[i+1][j-1]++;
                if(i != y-1) m[i+1][j]++;
                if(i != y-1 && j != x-1) m[i+1][j+1]++;
                if(j != x-1) m[i][j+1]++;
                if(i != 0 && j != x-1) m[i-1][j+1]++;
            }
        }
    }
    for(int i = 0; i < y; i++){
        for(int j = 0; j < x; j++){
            if(l[i][j] == '#') cout << '#';
            else printf("%c", m[i][j] + '0');
        }
        cout << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<intmax_t> a(n+1);
  for (auto& ai: a) scanf("%jd", &ai);

  if (n == 0) {
    if (a[0] == 1) return puts("1"), 0;
    return puts("-1"), 0;
  }

  if (a[0] != 0) return puts("-1"), 0;

  intmax_t const inf = 1e17;
  std::vector<intmax_t> pow2(n+10, inf);
  pow2[0] = 1;
  for (size_t i = 1; i <= n; ++i) {
    pow2[i] = std::min(inf, pow2[i-1] * 2);
  }
  std::vector<std::pair<intmax_t, intmax_t>> dp(n+1);
  dp[n] = {a[n], a[n]};
  for (size_t i = n; i--;) {
    auto [min, max] = dp[i+1];
    dp[i].first = (min+1) / 2 + a[i];
    dp[i].second = max + a[i];
    if (dp[i].first > pow2[i]) return puts("-1"), 0;
    dp[i].second = std::min(dp[i].second, pow2[i]);
  }

  intmax_t res = 0;
  intmax_t cur = 1;
  for (size_t i = 0; i <= n; ++i) {
    cur -= a[i];
    // fprintf(stderr, "cur: %jd\n", cur);
    res += cur + a[i];
    if (i < n)
      cur = std::min(2*cur, dp[i+1].second);
  }

  printf("%jd\n", res);
}


Measured memory_bytes: 5936
# https://atcoder.jp/contests/abc164/tasks/abc164_d

from operator import mul
from functools import reduce
from collections import defaultdict

def combination(n, r):
    if not 0 <= r <= n: return 0
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

S = input()

res = 0

T = [0]
x = 0
L = len(S)
for i, s in zip(range(L),reversed(S)):
    """ 累積和 """
    x = (int(s)*pow(10,i,2019) + x)%2019
    T.append(x)

reminder = [0]*2019
for i in range(L+1):
    reminder[T[i]%2019] += 1

for c in reminder:
    res += combination(c,2)

print(res)

Measured memory_bytes: 83608
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
x,y = LI()
f = [0,1,2,1,3,1,3,1,1,3,1,3,1]
if f[x] == f[y]:
    print("Yes")
else:
    print("No")
"""
#B
h,w = LI()
a = SR(h)
print("#"*(w+2))
for i in range(h):
    print("#",end = "")
    for j in a[i]:
        print(j,end = "")
    print("#")
print("#"*(w+2))

#C
"""
h,w = LI()
ans = float("inf")
x = w//2
y = h//2
if not w%2:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        ans = min(ans,abs(w*i-x*(h-i)))
else:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        if w*i < x*(h-i):
            ans = min(ans,abs(w*i-(x+1)*(h-i)))
        elif w*i < (x+1)*(h-i):
            ans = min(ans,h-i)
        else:
            ans = min(ans,abs(w*i-x*(h-i)))
if not h%2:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        ans = min(ans,abs(h*i-y*(w-i)))
else:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        if h*i < y*(w-i):
            ans = min(ans,abs(h*i-(y+1)*(w-i)))
        elif h*i < (y+1)*(w-i):
            ans = min(ans,w-i)
        else:
            ans = min(ans,abs(h*i-y*(w-i)))
print(ans)
"""

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    ll a, b;
    int k;
    cin >> a >> b >> k;

    rep(i, k) {
        if (i % 2 == 0) {
            if (a % 2 == 1) a--;
            a /= 2;
            b += a;
        } else {
            if (b % 2 == 1) b--;
            b /= 2;
            a += b;
        }
    }

    cout << a << ' ' << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int LL
#define zero 0LL
using namespace std;
template<typename T> inline void maximize(T &a,T b){a=max(a,b);}
template<typename T> inline void minimize(T &a,T b){a=min(a,b);}
template<typename T> inline bool middle(T a,T b,T c){return b<=a && a<=c;}
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
inline void outputVI(VI x){REP(i,SI(x)){cout << three(i," ","") << x[i];}OUT("");}
const int SIZE=1e6;
const int SIZE2=5010;
const int SIZE3=400;
const LL p=7+1e9;
const LL INF=1LL<<60;
const long double EPS=1e-7;
string S;
ut N,M,K,X,L,W,H;
// ut A,B,C,D,E,F,G,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL a[SIZE],x[2],vals[SIZE],nums[SIZE],maps[SIZE2][SIZE2],answer=zero;
VI v[2];
map<int,int> times;
bool DP[4000][2];
bool able(int now){

}
signed main(){
	int N;
	cin >> N;
	REP(i,N){
		cin >> a[i];
		times[a[i]]=times[a[i]]+1;
	}
	int ans=0;
	for(auto it=times.begin();it!=times.end();++it){
		if((*it).first<=(*it).second){
			ans+=(*it).second-(*it).first;
		}else{
			ans+=(*it).second;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 32128
#include <iostream>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
constexpr ll mod = 1000000007;

int main() {
    int n, r;
    cin >> n >> r;
    cout << (n >= 10 ? r : r + (100 * (10-n))) << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] u = new int[N-1];
		int[] v = new int[N-1];
		int[] w = new int[N-1];
		ArrayList<List<Integer>> edge_1 = new ArrayList<List<Integer>>();
		for (int i=0;i<N;i++) {
			List<Integer> x = new ArrayList<Integer>();
			edge_1.add(x);
		}
		for (int i=0;i<N-1;i++) {
			u[i]=Integer.parseInt(sc.next())-1;
			v[i]=Integer.parseInt(sc.next())-1;
			w[i]=Integer.parseInt(sc.next());
			edge_1.get(u[i]).add(u[i]);
			edge_1.get(u[i]).add(v[i]);
			edge_1.get(u[i]).add(w[i]);
			edge_1.get(v[i]).add(v[i]);
			edge_1.get(v[i]).add(u[i]);
			edge_1.get(v[i]).add(w[i]);
		}
		int[] ans = new int[N];
		Arrays.fill(ans,-1);



		Queue<int[]> queue_1 = new ArrayDeque<int[]>();
		ans[0]=0;
		int M = edge_1.get(0).size();
		for (int i=0;i<M/3;i++) {
			int a_i=edge_1.get(0).get(3*i);
			int b_i=edge_1.get(0).get(3*i+1);
			int c_i=edge_1.get(0).get(3*i+2);
			int d_i=(c_i+ans[a_i])%2;
			if (d_i==0) {
				ans[b_i]=0;
			} else {
				ans[b_i]=1;
			}
			int[] add_init = {a_i,b_i,d_i};
			queue_1.add(add_init);

/*			int O = edge_1.get(b_i).size();
			System.out.println(O);
			for (int j=0;j<O/3;j++) {
				int a_j=edge_1.get(b_i).remove(0);
				int b_j=edge_1.get(b_i).remove(0);
				int c_j=edge_1.get(b_i).remove(0);
				int d_j=(c_j+ans[a_j])%2;
				if (ans[b_j]==-1) {
					int[] add = {a_j,b_j,d_j};
					queue_1.add(add);
				}
			}
*/		}

		while(!queue_1.isEmpty()) {
			int[] rem=queue_1.remove();
			int U_x=rem[0];
			int V_x=rem[1];
			int W_x=rem[2];

			int P = edge_1.get(V_x).size();
			for (int i=0;i<P/3;i++) {
				int a_i=edge_1.get(V_x).get(3*i);
				int b_i=edge_1.get(V_x).get(3*i+1);
				int c_i=edge_1.get(V_x).get(3*i+2);
				int d_i=(c_i+W_x)%2;
				if (ans[b_i]==-1) {
					if (d_i==0) {
						ans[b_i]=0;
					} else {
						ans[b_i]=1;
					}
					int[] add = {a_i,b_i,d_i};
					queue_1.add(add);
				}
/*				int O = edge_1.get(b_i).size();
				System.out.println(O);
				for (int j=0;j<O/3;j++) {
					int a_j=edge_1.get(b_i).get(3*j);
					int b_j=edge_1.get(b_i).get(3*j+1);
					int c_j=edge_1.get(b_i).get(3*j+2);
					int d_j=(c_j+ans[a_j])%2;
					if (ans[b_j]==-1){
						int[] add = {a_j,b_j,d_j};
						queue_1.add(add);
					}
				}
*/			}
		}
		for (int i=0;i<ans.length;i++) {
			System.out.println(ans[i]);
		}
	}
}

Measured memory_bytes: 88952
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////


int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=1,mi=a[0];
    rep(i,1,n-1){
        if(mi>a[i]){
            mi=a[i];
            ans++;
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
    int W,H,x,y,z,i,iH;
    for(;;i){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0){
            exit(0);
        }
        for(y=1;y<=H;y++){
            for(x=0;x<W;x++){
                if(y==1 || y==H){
                    printf("#");
                }else{
                    iH=W;
                    iH=iH-2;
                    printf("#");
                    for(z=0;z<iH;z++){
                        printf(".");
                    }
                    printf("#");
                    break;
                }
            }
                printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"SUN", "MON","TUE","WED","THU","FRI","SAT"};

int main(){
    int A, B;
    cin >> A >> B;
    cout << max(0, A - B * 2) << endl;
}


Measured memory_bytes: 256