akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define For(i,m,n) for(int i=m;i<n;i++)
#define Forr(i,m,n) for(int i=m;i>n;i--)
#define Sort(a) sort(a.begin(),a.end())
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll>>
#define INF 999999999999

int main(){
  int N,count=1;string S;
  cin>>N>>S;

  int i=0;
  while(i!=S.size()-1){
    if(S[i]!=S[i+1]) count++;
    i++;
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))


def bubbleSort(A, N):
    change = 0
    flag = True
    while flag:
        flag = False
        for j in reversed(range(1, N)):
            #print(j, N)
            if A[j] < A[j-1]:
                A[j-1], A[j] = A[j], A[j-1]
                flag = True
                change += 1
                #print(A,j)
    return A, change

result, change_n = bubbleSort(a, n)


print (" ".join(map(str,result)))
print(change_n)



Measured memory_bytes: 5600
package main

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

//=====I/O=====

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

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	n, k := scanInt(), scanInt()
	a := scanInts(n)

	sums := make([]int, n+1)

	for i := 0; i < n; i++ {
		sums[i+1] = (sums[i]+a[i]-1)%k
	}

	// fmt.Println(sums)

	c := make(map[int]int, 0)

	ans := 0
	
	for i := 0; i < n+1; i++ {
		ans += c[sums[i]]
		c[sums[i]]++
		if i >= k-1 {
			c[sums[i-k+1]]--
		}
	}

	fmt.Println(ans)

}


Measured memory_bytes: 13952
#include <cmath>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int n; double x[100000], y[100000];
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%lf", &x[i]);
        scanf("%lf", &y[i]);
    }
    
    pair<double, double> p1[100000], p2[100000];
    
    for(int i = 0; i < n; i++)
    {
        p1[i] = make_pair(x[i], y[i]);
    }
    
    for(int i = 0; i < n; i++)
    {
        p2[i] = make_pair(y[i], x[i]);
    }
    
    sort(p1, p1 + n);
    sort(p2, p2 + n);
    
    double sqr_ans = 100000000.0;
    
    const int loops = 111;
    
    for(int i = 0; i < n - 1; i++)
    {
        int r = min(loops, n - i - 1);
        
        for(int j = 1; j <= r; j++)
        {
            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);
        
            sqr_ans = min(distance_, sqr_ans);
        }
    }
    
    for(int i = 0; i < n - 1; i++)
    {
        int r = min(loops, n - i - 1);
        
        for(int j = 1; j <= r; j++)
        {
            double distance_ = (p2[i + j].first - p2[i].first) * (p2[i + j].first - p2[i].first) + (p2[i + j].second - p2[i].second) * (p2[i + j].second - p2[i].second);
        
            sqr_ans = min(distance_, sqr_ans);
        }
    }
    
    printf("%.9f\n", sqrt(sqr_ans));
    
    return 0;
}

Measured memory_bytes: 7396
#include<iostream>
#include <algorithm> 
#include<queue>
#include<stack>

using namespace std;


int main() {
	int N, M, t=0;
	cin >> N >> M;
	for (int i = 1; i < 10000; i++) {
		int a = N + (N - 1) * (i - 1);
		int b = N + (N - 1) * (i - 2);
		if (a >= M && b < M) {
			t = i;
			break;
		}
	}
		cout << t << endl;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Usize1;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused)]
const ALPHA_SMALL: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];
#[allow(unused)]
const ALPHA: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
fn main() {
    input!(R: usize, C: usize, K: usize);
    let mut values = vec![vec![0; C + 1]; R + 1];
    for _ in 0..K {
        input!(r: usize, c: usize, v: usize);
        values[r][c] = v;
    }

    let mut dp = vec![vec![vec![0; 4]; C + 1]; R + 1];
    for i in 1..R + 1 {
        for j in 1..C + 1 {
            let m = line_max(i, j, &mut dp);

            dp[i][j][0] = max(m, dp[i][j - 1][0]);
            dp[i][j][1] = max(
                m + values[i][j],
                max(dp[i][j - 1][0] + values[i][j], dp[i][j - 1][1]),
            );
            dp[i][j][2] = max(
                m + values[i][j],
                max(dp[i][j - 1][1] + values[i][j], dp[i][j - 1][2]),
            );
            dp[i][j][3] = max(
                m + values[i][j],
                max(dp[i][j - 1][2] + values[i][j], dp[i][j - 1][3]),
            );
        }
    }

    let ans = max(dp[R][C][0], max(dp[R][C][1], max(dp[R][C][2], dp[R][C][3])));
    println!("{}", ans);
}

fn line_max(i: usize, j: usize, dp: &mut Vec<Vec<Vec<usize>>>) -> usize {
    let mut ret = 0;
    for k in 0..4 {
        ret = max(ret, dp[i - 1][j][k])
    }
    ret
}


Measured memory_bytes: 708996
#include <iostream>
using namespace std;
int main(void){
    int x, y;
    int c=1;
    while(true){
        cin>> x;
        if(x==0){
            break;
            
        }
        cout <<"Case"<<" "<<c<<":"<<" "<<x<<endl;
        c = c + 1;
    }
    
}



Measured memory_bytes: 3040
import java.io.*;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    try {
      // 標準入力受け取り
      Scanner scan = new Scanner(System.in);      
      Long sum      = Long.parseLong(scan.next());
      Long blue     = Long.parseLong(scan.next());
      Long red      = Long.parseLong(scan.next());
      Long result;
      
      //算出
      if(sum%(blue+red)<=blue) {
        result = sum/(blue+red)*blue+sum%(blue+red);
      } else {
        result = sum/(blue+red)*blue+blue;
      }
      
      System.out.println(result);
      
    } catch (Exception e) {     
      System.out.print("error");
    }
  }
}


Measured memory_bytes: 23124
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Harshad
 */

#include <iostream>
#include <fstream>

#include <iostream>

class TaskA {
public:
    void solve(std::istream &in, std::ostream &out) {
        std::string s;
        in >> s;
        int res = 0;
        for (int i = 0; i < s.length(); ++i) {
            if (s[i] == '1') res++;
        }
        out << res;
    }
};


int main() {
    TaskA solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main(void) {
    int64_t H,N;
    int64_t A;
    int64_t sum = 0;
    cin >> H >> N;

    for(int i=0;i<N;i++) {
        cin >> A;
        sum += A;
    }

    if(H > sum) {
        cout << "No\n";
    } else {
        cout << "Yes\n";

    }
    
    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

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

  while(true){
	string line; cin >> line;
	if(line == "#") break;
	int n = 0, ang = 0, m = 1;
	for(int i=SZ(line)-1;i>=0;++n){
	  ang *= 2;
	  if(line[i] == 'h'){
		if(m == 1)
		  ang = 0;
		else
		  ang = ang - 90;
		i-=5;
	  }
	  else{
		if(m == 1)
		  ang = 90;
		else
		  ang = ang + 90;
		i-=4;
	  }
	  m *= 2;
	}
	m /= 2;
	int t = gcd(ang, m);
	ang /= t, m /= t;
	cout << ang;
	if(m>1) cout << "/" << m;
	cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1192
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as BS

main = do
  n <- readLn
  strings <- V.replicateM n BS.getLine
  let breakAB = BS.breakSubstring "AB"
      findAB_loop !n s | BS.null s = n
                       | otherwise = case breakAB s of
                           (t,u) | BS.null u -> n
                                 | otherwise -> findAB_loop (n+1) (BS.drop 2 u)
      findAB = findAB_loop 0
  let ab_in_str = V.sum (V.map findAB strings)
  let (ends_with_A, does_not_end_with_A) = V.partition (\s -> BS.last s == 'A') strings
      (b_a, x_a) = V.partition (\s -> BS.head s == 'B') ends_with_A
      (b_y, x_y) = V.partition (\s -> BS.head s == 'B') does_not_end_with_A
      n_BA = V.length b_a
      n_xA = V.length x_a
      n_By = V.length b_y
  let m = case (n_xA, n_By) of
        (0, 0) -> max 0 (n_BA - 1)
        (_, 0) -> n_BA
        (0, _) -> n_BA
        (_, _) -> min n_xA n_By + n_BA
  print (ab_in_str + m)


Measured memory_bytes: 2300
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

#define INF UINT64_C(101010101010101010)

#define KI_MAX (1 << 17) /* 131072 */
#define KI_ARRAY_MAX (KI_MAX * 2 - 1)

uint64_t ookikunaihou(uint64_t a, uint64_t b) {
	return a <= b ? a : b;
}

uint64_t ki[KI_ARRAY_MAX], ki_all[KI_ARRAY_MAX];

void ki_add_i(int idx, int qs, int qe, int ss, int se, uint64_t value) {
	if (qe <= ss || se <= qs) { /* セグメントがクエリから完全に外れている */
		/* nop */
	} else if (qs <= ss && se <= qe) { /* セグメントがクエリに完全に含まれる */
		ki_all[idx] = ookikunaihou(ki_all[idx], value);
	} else {
		int sm = ss + (se - ss) / 2, lidx = idx * 2 + 1, ridx = idx * 2 + 2;
		ki_all[lidx] = ookikunaihou(ki_all[lidx], ki_all[idx]);
		ki_all[ridx] = ookikunaihou(ki_all[ridx], ki_all[idx]);
		ki_all[idx] = INF;
		ki_add_i(lidx, qs, qe, ss, sm, value);
		ki_add_i(ridx, qs, qe, sm, se, value);
		ki[idx] = ookikunaihou(ookikunaihou(ki[lidx], ki_all[lidx]), ookikunaihou(ki[ridx], ki_all[ridx]));
	}
}

void ki_add(int qs, int qe, uint64_t value) {
	if (qs < qe) ki_add_i(0, qs, qe, 0, KI_MAX, value);
}

uint64_t ki_get_i(int idx, int qs, int qe, int ss, int se) {
	if (qe <= ss || se <= qs) { /* セグメントがクエリから完全に外れている */
		return INF;
	} else if (qs <= ss && se <= qe) { /* セグメントがクエリに完全に含まれる */
		return ookikunaihou(ki[idx], ki_all[idx]);
	} else {
		int sm = ss + (se - ss) / 2, lidx = idx * 2 + 1, ridx = idx * 2 + 2;
		uint64_t lv = ki_get_i(lidx, qs, qe, ss, sm);
		uint64_t rv = ki_get_i(ridx, qs, qe, sm, se);
		return ookikunaihou(ookikunaihou(lv, rv), ki_all[idx]);
	}
}

uint64_t ki_get(int qs, int qe) {
	return qs < qe ? ki_get_i(0, qs, qe, 0, KI_MAX) : INF;
}

struct asumikana {
	int L, R, C;
};

int kitaeri(const void* x, const void* y) {
	struct asumikana a = *(const struct asumikana*)x, b = *(const struct asumikana*)y;
	if (a.L != b.L) return a.L < b.L ? -1 : a.L > b.L;
	return a.R < b.R ? -1 : a.R > b.R;
}

int N, M;
struct asumikana sumipe[114514];

int main(void) {
	int i;
	uint64_t notomamiko;
	for (i = 0; i < KI_ARRAY_MAX; i++) {
		ki[i] = ki_all[i] = INF;
	}
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d%d%d", &sumipe[i].L, &sumipe[i].R, &sumipe[i].C) != 3) return 1;
	}
	qsort(sumipe, M, sizeof(*sumipe), kitaeri);
	ki_add(1, 2, 0);
	for(i = 0; i < M; i++) {
		uint64_t min_cost = ki_get(sumipe[i].L, sumipe[i].R + 1);
		ki_add(sumipe[i].L, sumipe[i].R + 1, min_cost + (uint64_t)sumipe[i].C);
	}
	notomamiko = ki_get(N, N + 1);
	if (notomamiko < INF) {
		printf("%" PRIu64 "\n", notomamiko);
	} else {
		puts("-1");
	}
	return 0;
}


Measured memory_bytes: 7828
#include <stdio.h>

#define LMAX 1002

int FindCharacter(char c,char string[]);

int main(void){
	char string[LMAX];
	int f1,f2,f3,f4;
	
	scanf("%s",string);
	f1=FindCharacter('N',string);
	f2=FindCharacter('S',string);
	f3=FindCharacter('E',string);
	f4=FindCharacter('W',string);
	
	if((f1!=f2) || (f3!=f4)){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	
	return 0;
}

int FindCharacter(char c,char string[]){
	int i;
	for(i=0;string[i]!='\0';i++){
		if(string[i]==c){
			return 1;
		}
	}
	return 0;
}

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


int main(){
  int d,t,s;
  cin>>d>>t>>s;
  if(d<=s*t){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define reg register
#define inf 99824435300000000
#define int long long
using namespace std;
inline int  read() {
    reg int s = 0, t = 0; reg char ch = getchar();
    while(ch > '9' || ch < '0') t |= ch == '-', ch = getchar();
    while(ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}
int n, a[111];
int solve(int l, int r, int x, int y){
	int ans = inf; if(l + 1 == r) return 0;
	for(int i = l + 1; i < r; i++){
		int sum = (x + y) * a[i] + solve(l, i, x, x + y) + solve(i, r, x + y, y);
		ans = min(ans, sum);
	}	
	return ans;
}
signed main()
{
	n = read(); 
	for(int i = 1; i <= n; i++) a[i] = read();
	cout << solve(1, n, 1, 1) + a[1] + a[n];
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define fi first
#define se second
const int inf = 1e9+7;
int mod = 1e9+7;

int tmp[100][10], v[100][11], a[100], n;
int popcnt(int x){
	int ret = 0;
	while(x){
		if(x&1)ret++;
		x >>= 1;
	}
	return ret;
}

void disp(int x){
	drep(i,9,0)printf("%lld", (int)!!(x&(1<<i)));
	printf("\n");
}

int dfs(int bit, int p){
	if(p == 10){
		if(bit == 0)return -inf;	
		int sum = 0;
		rep(i,n){
			int t = popcnt(a[i]&bit);
			sum += v[i][t];
		}
		//if(sum == 0)disp(bit);
		return sum;
	}
	int ans = -inf;
	ans = max(ans, dfs(bit*2+1, p+1));
	ans = max(ans, dfs(bit*2, p+1));
	return ans;
}

signed main(){
	scanf("%lld", &n);
	rep(i,n)rep(j,10)scanf("%lld", &tmp[i][j]);
	rep(i,n)rep(j,11)scanf("%lld", &v[i][j]);
	/*printf("\n");
	rep(i,n){
		rep(j,11)printf("%lld ", v[i][j]);
		printf("\n");
	}*/
	rep(i,n){
		int t = 0;
		rep(j,10)t = t*2+tmp[i][j];
		a[i] = t;
	}
	
	int ans = dfs(0, 0);
	printf("%lld\n", ans);
	//rep(i,n)disp(a[i]);
	return 0;
}


Measured memory_bytes: 256
///Nahid Hasan Raju
#include <bits/stdc++.h>
#define ll long long
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
using namespace std;

#define P(XX) cout<<XX<<endl
#define P1(XX) cerr<<"db1: "<<XX<<endl
#define P2(XX,YY) cerr<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cerr<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define pb push_back
#define pll pair<ll,ll>
#define pii pair<int,int>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007ll
#define MX 2000006  ///200005

ll m, n;
ll a[MX], b[MX];
string s,s1;
map<ll,int>mp;

void func(ll p)
{

}
int main()
{
    int test=1, tc=0, i, j;
    #ifndef ONLINE_JUDGE
    //Fin;
    test=3;
    #endif
    ll k, ans, t, kk;
    //scanf("%d", &test);
    while(test--)
    {
        j=k=ans=0;
        cin>>s>>s1;
        n=s.size();
        m=s1.size();
        for(t=0;t<=n-m;t++){
            k=j=0;
            for(i=t;i<t+m;i++, j++)
            {
                if(s[i]==s1[j]){
                    k++;
                }
            }
            ans=max(ans, k);
        }

        P(m-ans);
        return 0;

        if(t)puts("YES");
        else puts("NO");

        printf("%lld\n", ans);
        for(i=0;i<ans;i++)
        {
            printf("%lld", b[i]);
        }
    }
    return 0;
}



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

#define OM ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define pi 3.14159265358979323846

typedef long long ll;

/*LETS BEGIN WITH THE NAME OF MAHADEV*/


/*ll mul(ll a, ll b, ll m){
	ll res = 0;
	a = a % m;
	while(b){
		if(b & 1)
			res = (res + a) % m;
		a = (a + a) % m;
		b >>= 1; 
	}
	return res;
}
*/
int main()
{
	OM;
	int n;
	cin >> n;
	const ll m = 1e9 + 7;
	vector<ll> v(n), pref(n);
	for(int i = 0; i < n; ++i){
		cin >> v[i];
		pref[i] = i ? (pref[i - 1] + v[i]) % m : v[i] % m;
	}
	ll answer = 0;
	for(int i = 0; i < n; ++i){
		answer = (answer + (v[i] * (pref[n - 1] - pref[i] + m) % m) % m) % m;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 6328
N, M = gets.split.map(&:to_i)
fav_counter = [-1] + [0] * M
$stdin.each_line{|ln|
	_, *favs = ln.split.map(&:to_i)
	favs.each{|fav|
		fav_counter[fav] += 1
	}
}
p fav_counter.count{|_| _ == N }


Measured memory_bytes: 1788
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    double sum = 0;
    for(int i = 0;i < n;i++){
        double x;
        char s[4];
        scanf("%lf", &x);
        scanf("%s", &s);
        if(s[0] == 74 && s[1] == 80 && s[2] == 89)sum += x;
        else sum += x * 380000;
    }
    printf("%lf\n", sum);
    return 0;
}

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

int main(){
  int n;
  string s, t;
  cin >> n;
  cin >> s >> t;

  string u = "";
  rep(i, n){
    u += s[i];
    u += t[i];
  }

  cout << u << endl;

}


Measured memory_bytes: 256
h, w = list(map(int, input().split()))
table = [str(input()) for _ in range(h)]

# for r in table:
#     print(r)

# row
for i in range(h):
    # print(h-i)
    row = table[h-1-i]
    row = list(set(row))
    if row == ["."]:
        table.pop(h-1-i)

# print("=========")
# for r in table:
#     print(r)

# col
l = []
for j in range(w):
    # print("==")
    # print(w-j)
    col = [r[w-1-j] for r in table]
    # print(col)
    col = list(set(col))
    if col == ["."]:
        # print("YY")
        l.append(w-1-j)
        # for i in range(h):
        #     table[i] = table[i].pop(w-1-j)


# print("=========")
# for r in table:
#     print(r)

out = []
for r in table:
    ll = list(r)
    for ind in l:
        ll.pop(ind)

    out.append("".join(ll))


# print("=========")
for r in out:
    print(r)


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

int main(){
int W,H,C,A,B;

cin >> W >> H >> C;

A = 1;

if(W == H)A = W;

if(W > H){
for(int i =2; i<=H;i++)if(W % i == 0 && H % i == 0) A = i;}

if(H > W){
for(int i=2;i<=W;i++)if(H % i == 0 && W % i ==0) A = i;}

 B = (W / A) * (H / A) * C;

cout << B << endl;
 }


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

int main(){
    int n;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    int cnt=0;
    rep(i,n){
        if(a[i]==i+1){
            swap(a[i],a[i+1]);
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
#define ci(n,a)   vi a(n); rep(i,(n)) cin>>a[i];
#define rep(i,n)  for(ll i = 0; i < (n); ++i)
#define red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define all(a)    begin(a),end(a)
#define pb(a)     push_back(a)
#define mp(a,b)   make_pair(a,b)
#define yn(a)     cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+7, LINF = 1e18;


int main(int argc,char* argv[])
{
    char c;
    cin>>c;
    if(c=='A')c='T';
    else  if(c=='T')c='A';
    else  if(c=='C')c='G';
    else  if(c=='G')c='C';

    cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
 
int main(){
    int H, W;
    cin >> H >> W;
    bool S[H][W];
    vec<string> ss(H);
    int ans = 0;
    for (int h = 0; h<H; h++) cin >> ss[h];

    for (int h=0; h<H; h++) for (int w=0; w<W; w++){
        if (ss[h][w]=='#') continue;
        vec<vec<int>> dist(H, vector<int>(W, INF));
        queue<P<int, int>> q;
        auto update = [&](int i, int j, int x){
            if(dist[i][j]!=INF) return;
            dist[i][j] = x;
            q.push(P<int, int>(i, j));
        };
        update(h, w, 0);
        while(!q.empty()){
            int i = q.front().first;
            int j = q.front().second;
            q.pop();
            for (int dir=0; dir<4; dir++){
                int ni = i + dx[dir];
                int nj = j + dy[dir];
                //cout << ni << " " << nj << endl;
                if (ni<0||ni>H-1||nj<0||nj>W-1) continue;
                if (ss[ni][nj]=='#') continue;
                update(ni, nj, dist[i][j]+1);
            }
        }
        for (int ih=0; ih<H; ih++) for (int iw=0; iw<W; iw++){
            if (dist[ih][iw]==INF) continue;
            ans = max(ans, dist[ih][iw]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define IT ::iterator
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);

  

int main()
{
	ll n,i;
	lsc(n);
	ll a[n];
	ll xr=0LL;
	rep(i,n)
	{
		lsc(a[i]);
	}
	rep(i,n)
	{
		xr^=a[i];
	}
	rep(i,n)
	{
		ll aa=xr^a[i];
		cout << aa << " " ;
	}
    return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

int count(int n) {
  return n == 0 ? 0 : count(n & n - 1) + 1;
}

vector<int> f(int m, int a, int b) {
  if (m == 0) return {a};
  if (m == 1) return {a, b};
  int x = (a ^ b) & m;
  x = x & -x;
  int y = m ^ x;
  y = y & -y;
  auto l = f(m ^ x, a, a ^ y);
  auto r = f(m ^ x, a ^ y ^ x, b);
  l.insert(l.end(), r.begin(), r.end());
  return l;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (count(A ^ B) % 2 == 0) {
    cout << "NO\n";
    return 0;
  }
  vector<int> ans = f((1 << N) - 1, A, B);
  cout << "YES\n";
  for (int x : ans) cout << x << ' ';
  cout << '\n';
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    int n, m;
    cin >> n >> m;
    int b, c_tmp;
    vector<int> a(m);
    vector<int> c(m);
    rep(i,m) {
        cin >> a[i] >> b;
        rep(j,b) {
            cin >> c_tmp;
            c_tmp--;
            c[i] += (1 << c_tmp);
        }
    }
    vector<vector<int>> dp(m, vector<int>(1 << n, INF));
    rep(i,1 << n) {
        if (i == 0) {dp[0][i] = 0; continue;}
        if ((i & ~c[0]) == 0) dp[0][i] = a[0];
    }
    rep(i,m-1) {
        rep(j,1 << n) {
            if (j == 0) {dp[i+1][j] = 0; continue;}
            dp[i+1][j] = min(dp[i][j], dp[i][j & ~c[i+1]] + a[i+1]);
        }
    }
    int ans = (dp[m-1][(1 << n) - 1] == INF ? -1 : dp[m-1][(1 << n) - 1]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16384
#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>
#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>
#include <assert.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;

const int MAXN = 100000;
int cnt[4];

void no() {
    cout << "No\n";
    exit(0);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        cnt[x % 4]++;
    }
    vector<int> v;
    while(cnt[1] && cnt[0]) {
        v.push_back(1);
        v.push_back(0);
        cnt[1]--;
        cnt[0]--;
    }
    if(cnt[1] > 0) {
        v.push_back(1);
        cnt[1]--;
    }
    while(cnt[3] && cnt[0]) {
        v.push_back(3);
        v.push_back(0);
        cnt[3]--;
        cnt[0]--;
    }
    if(cnt[3] > 0) {
        v.push_back(3);
        cnt[3]--;
    }
    if(!v.empty() && v.back() != 0 && cnt[2] != 0)
        no();
    for(int i = 1; i < (int)v.size(); i++) {
        if((v[i - 1] * v[i]) % 4 != 0)
            no();
    }
    if(cnt[1] || cnt[3])
        no();
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// ここにコードを挿入
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int D = sc.nextInt();
		int x = sc.nextInt();
		for (int i = 0; i < 10; i++) {
			x = r * x - D;
			System.out.println(x);
		}
	}

}

Measured memory_bytes: 21716
#include <stdio.h>
#include<iostream>
using namespace std; 
int main(void){
    // Your code here!
    int A,B;
    int i,j;
    int c = 0;
    int i1,i2,i3,i4,i5;
    
    cin >> A;
    cin >> B;
    
    for( i = A; i <= B; i++ ){
        
        i1 = i % 10;
        i2 = (i / 10) % 10;
        i4 = (i / 1000) % 10;
        i5 = (i / 10000) % 10;
        
        if( (i1 == i5) && (i2 == i4)) c++;
        
    }
    
    cout << c;
}


Measured memory_bytes: 256
mi = {"1": 2, "2": 5, "3": 5, "4": 4, "5": 5, "6": 6, "7": 3, "8": 7, "9": 6}
n, m = map(int, input().split())
A = input().split()
dpn = [0] + [-1] * 10010
dp = [""] * 10010
for a in A:
    for i in range(n - mi[a] + 1):
        if dpn[i] != -1:
            cnt = dpn[i] + 1
            if dpn[i + mi[a]] < cnt:
                dpn[i + mi[a]] = cnt
                dp[i + mi[a]] = max(a + dp[i], dp[i] + a)
            elif dpn[i + mi[a]] == cnt:
                dp[i + mi[a]] = max(dp[i + mi[a]], a + dp[i], dp[i] + a)
print(dp[n])


Measured memory_bytes: 28504
#include<iostream>

using namespace std;

int main() {
	int n, count;

	while (cin >> n) {
		count = 0;
		if (n <= 36) {
			if (n > 18) n = 36 - n;
			for (int i = 0; i <= 9; i++) {
				if (i > n) break;

				for (int j = 0; j <= 9; j++) {
					if (i + j > n) break;

					for (int k = 0; k <= 9; k++) {
						if (i + j + k > n) break;

						for (int l = 0; l <= 9; l++) {
							if (i + j + k + l == n) {
								count++;
								break;
							}
						}
					}
				}
			}
		}
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 0
import kotlin.comparisons.compareBy
import kotlin.comparisons.thenBy

fun main(args: Array<String>) {

    val map = mutableMapOf<String, Int>()
    var max = 0
    repeat(readLine()!!.toInt()) {
        readLine()!!.let {
            val value = map.getOrElse(it, { 0 }) + 1
            map.put(it, value)
            max = Math.max(value, max)

        }
    }

    map.toList().filter { it.second == max }
        .sortedWith(compareBy<Pair<String, Int>> { it.second }.thenBy { it.first })
        .forEach {
            println(it.first)
        }
}



Measured memory_bytes: 95780
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define rep(i,l,r) for(rint i=l;i<=r;i++)
#define per(i,l,r) for(rint i=l;i>=r;i--)
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fir first
#define sec second
#define mset(s,t) memset(s,t,sizeof(s))
template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
int read(){
  int x=0,f=0;
  char ch=getchar();
  while(!isdigit(ch))f|=ch=='-',ch=getchar();
  while(isdigit(ch))x=10*x+ch-'0',ch=getchar();
  return f?-x:x;
}
const int N=105;
int d[N][2];
int n;
int main(){
  n=read();
  for(int i=1;i<=n;i++){
    d[i][0]=read(),d[i][1]=read();
  }
  for(int i=1;i<=n-2;i++){
    if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]){
      puts("Yes"),exit(0);
    }
  }
  puts("No");
}

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

#define task "test"

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define X first
#define Y second

const ll LINF = 1E18;
const int INF = 1E9;
const int MOD = 1E9 + 7;

const int nmax = 1;

int t = 1;
ll n;

void Input()
{
     cin >> n;
}

void Solve()
{
     cout << abs(1 - n);
}

int main()
{
     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
     if(fopen(task ".inp", "r")) {
          freopen(task ".inp", "r", stdin);
          freopen(task ".out", "w", stdout);
     }
     //cin >> t;
     while (t--) {
          Input();
          Solve();
     }
     return 0;
}




Measured memory_bytes: 3660
#include <iostream>

 

using namespace std;

 

int main() 
{
    int a, b, c, i, d;
    cin >> a >> b >> c ;
    d = 0;
    for(i=a; i<=b; i++)
    {
        if(c % i == 0)
        d++;
        
    }
    cout << d << endl;
    
}


Measured memory_bytes: 3112
#include<stdio.h>

#define N 100

int n, x[N][N];
int ch[N], d[N], f[N], num;

void depth(int u){
  int v;
  ch[u]=1;
  d[u]=++num;
  for(v=0 ; v<n ; v++){
    if(x[u][v]==0)continue;
    if(ch[v]==0)depth(v);
  }
  ch[u]=2;
  f[u]=++num;
}

void dfs(){
  int u;
  for(u=0 ; u<n ; u++)ch[u]=0;
  num=0;
  for(u=0 ; u<n ; u++)if(ch[u]==0)depth(u);
  for(u=0 ; u<n ; u++)printf("%d %d %d\n", u+1, d[u], f[u]);
}

int main(){
  int u, v, k, i, j;
  scanf("%d", &n);
  for(i=0 ; i<n ; i++){
    for(j=0 ; j<n ; j++){
      x[i][j]=0;
    }
  }
  for(i=0 ; i<n ; i++){
    scanf("%d%d", &u, &k);
    u--;
    for(j=0 ; j<k ; j++){
      scanf("%d", &v);
      v--;
      x[u][v]=1;
    }
  }
  dfs();
  return 0;
}



Measured memory_bytes: 2112
#include<unordered_map>
#include<iostream>
#include<algorithm>
#include<utility>
#include<climits>
#include<fstream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<list>
#include<map>
#include<set>
#define inf 0x7f7f7f
#define p(x) (x)*(x)
using namespace std;

typedef vector<vector<int> > vtype;
typedef long long ll;

int main()
{
	//ios::sync_with_stdio(false);
	int a = 0, b = 0,sum = 0;
	cin >> a >> b; 
	for(int i = 0; i < b; ++i){
		int mid = 0;
		cin >> mid;
		sum += mid;
	}
	if(sum >= a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
    return 0;
}















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

int main(void){
	int n;
	while(cin >> n,n){
		string words[55];
		rep(i,n) cin >> words[i];

		rep(start,n){
			int num = 0,step = 0;
			int tar[5]={5,7,5,7,7};

			for(int j = start; j < n;++j){
				num += words[j].size();
				if(step < 5 and tar[step] == num){
					step++;
					num = 0;
				}
			}

			if(step == 5){
				cout << start+1 << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
long long P[N];
for(int i=0;i<N;i++){
    cin>>P[i];
}
sort(P,P+N);
long long sum=0;
for(int i=0;i<N-1;i++){
    sum+=P[i];
}
cout << fixed << setprecision(0) <<P[N-1]/2+sum;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

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

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

    int tot = accumulate(w.begin(), w.end(), 0);

    int prev = INT_MAX;
    int rsum = 0;
    int ans = INT_MAX;
    for (int i = 0; i < n; i++) {
        if (i != 0 && prev != w[i]) {
            ans = min(ans, abs(rsum - (tot - rsum)));
        }
        rsum += w[i];
        prev = w[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
	
	int S;
	int h=0,m=0,s=0;
	scanf ("%d",&S);
	s=S%60;
	m=((S%3600)-s)/60;
	h=(S-(m+s))/3600;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

const long long mod = 1000000007;

struct mint {
	long long x;
	mint(long long x = 0) : x((x%mod+mod)%mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x -= a.x) < 0) x += mod;
		return *this;
	}
	mint& operator*=(const mint& a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(long long n) const {
		if (n == 0) return 1;
		mint res = pow(n >> 1);
		res *= res;
		if (n & 1ll) res *= *this;
		return res;
	}
	mint inv() const {
		return pow(mod - 2);
	}
	mint operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}
	long long get() const { return x; }
};

ostream& operator<<(ostream& os, const mint& m) {
	os << m.x;
	return os;
}

mint mod_comb(long long n, long long r) {
	mint numer(1);
	for (int i = 0; i < r; ++i) numer *= mint(n - i);
	mint denom(1);
	for (int i = 1; i <= r; ++i) denom *= mint(i);
	return numer / denom;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << mint(2).pow(n) - 1 - mod_comb(n, a) - mod_comb(n, b) << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
    if a[i]%2==1:
        print('0')
        exit()
    else:
        while a[i]%2==0:
            cnt += 1
            a[i] /=  2
        b.append(cnt)
        cnt = 0
print(min(b))

Measured memory_bytes: 9156
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



void solve(){
    int n, x = 0, y = 0, cnt = 0, j;
    cin>>n;
    int a[n+4], b[n+4], c[n+4];
    f(i,n)cin>>a[i];
    f(i,n)cin>>b[i];
    f(i,n)c[i] = i + 1;
    while(next_permutation(c, c + n)){
        cnt++;
        for(j = 0; j < n; j++) if(a[j] != c[j])break;
        if(j == n)x = cnt;
        for(j = 0; j < n; j++) if(b[j] != c[j])break;
        if(j == n)y = cnt;
        if(x != 0 && y != 0)break;
    }
    cout<<abs(x-y);
}


int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }
  sort(h.rbegin(), h.rend());
  for (int i = 0; i < min(n, k); ++i) {
    h[i] = 0;
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += h[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;

int n, m, a, b, c;
LL d;
int main() {
	while ( ~scanf( "%d %d", &n, &m ) && n && m ) {
		LL mp[ 100 ][ 100 ];
		for ( int i = 0; i < n; i++ ) {
			for ( int j = 0; j < n; j++ ) {
				mp[ i ][ j ] = LL_INF;
			}
		}
		for ( int i = 0; i < n; i++ ) {
			mp[ i ][ i ] = 0;
		}
		for ( int i = 0; i < m; i++ ) {
			scanf( "%d", &a );
			switch ( a ) {
				case 0:
					scanf( "%d %d", &b, &c );
					if ( mp[ b - 1 ][ c - 1 ] == LL_INF ) {
						printf( "-1\n" );
					}
					else {
						printf( "%lld\n", mp[ b - 1 ][ c - 1 ] );
					}
					break;
				case 1:
					scanf( "%d %d %lld", &b, &c, &d );
					if ( mp[ b - 1 ][ c - 1 ] > d ) {
						mp[ b - 1 ][ c - 1 ] = mp[ c - 1 ][ b - 1 ] = min( d, mp[ b - 1 ][ c - 1 ] );
						for ( int j = 0; j < n; j++ ) {
							for ( int k = 0; k < n; k++ ) {
								for ( int l = 0; l < n; l++ ) {
									mp[ k ][ l ] = mp[ l ][ k ] = min( mp[ k ][ l ], mp[ k ][ j ] + mp[ j ][ l ] );
								}
							}
						}
					}
					break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1272
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#define ll long long 
#define PI 3.14159265358979323846
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(x,n) for(ll x=1;x<(ll)n+1;x++)
using namespace std;
const ll INF = 100000;
int main() {
	ll ans = 0;
	string S, T;
	cin >> S >> T;
	rep(i, S.size()) {
		if (S[i] != T[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3848
A,B,M = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))

min_cost = min(a_list)+min(b_list)
for _ in range(M):
    x,y,c = map(int,input().split())
    cost = a_list[x-1] + b_list[y-1] -c
    if cost<min_cost:
        min_cost = cost
print(min_cost)

Measured memory_bytes: 18736
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();
	vector<int> pos(n, NIL), dp(n, 1);

	for(int i = 0; i < n; ++i) {
		int val = fetch<int>() - 1;
		pos[val] = i;
	}

	for(int i = 1; i < n; ++i) {
		if(pos[i] > pos[i - 1]) {
			dp[i] = max(dp[i], dp[i - 1] + 1);
		}
	}

	cout << n - *max_element(dp.begin(), dp.end()) << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


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

int main(void){
    int n = 0; 
    int a[200001] = {0};
    int tmp = 0;
    int yes = 1;

    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%ld", &a[i]);
    }

    sort(a, a + n);

    for(int i = 0; i < n - 1; i++){
        if(a[i] == a[i + 1]){
            yes = 0;
        }
    }


    if(yes == 1){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;

} 


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){

  int N;
  cin>>N;
  int i;
  int count=0;
  int x;
  int y;
  int z;
  for(i=1;i<=N;i++){
  
    count=0;
    for(x=1;x*x<i;x++){
    
      for(y=x;y*y<i;y++){
      
        for(z=y;z*z<i;z++){
        
          if(x*x+y*y+z*z+x*y+y*z+z*x==i){
          
            if(x==y){
              
              if(y==z){
              
                count+=1;
              }
              else{
              
                count+=3;
              }
            }
            else if(y==z){
            
              count+=3;
            }
            else{
              
              count+=6;
            }
            //cout<<x<<","<<y<<","<<z<<endl;
          }
        }
      }
    }
    cout<<count<<endl;
  }
}

Measured memory_bytes: 3580
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
    sc.Split(bufio.ScanWords)
    a := nextInt()
    b := nextInt()
    ans := (a - 1) * (b - 1)
    fmt.Println(ans)
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    Scanner sc;
    int[] d = {0,1,2,3};
    void run() {
        sc = new Scanner(System.in);

        while (true) {
            int wh=0,wl=0;
            int hh=0,hl=0;
            int n = sc.nextInt();
            if(n==0) break;
            Square[] sq = new Square[n];
            sq[0] = new Square(0);
            for (int i=1;i<n;i++) {
                sq[i] = new Square(i, sq[sc.nextInt()], sc.nextInt());
                hh = Math.max(sq[i].getHight(),hh);
                hl = Math.min(sq[i].getHight(),hl);
                wh = Math.max(sq[i].getWide(),wh);
                wl = Math.min(sq[i].getWide(),wl);
            }
            System.out.println((wh-wl+1) + " " + (hh-hl+1));
        }
    }
    
    public static void main(String[] args) {
        new Main().run();
    }

    int[] px = {-1,0,1,0};
    int[] py = {0,-1,0,1};
    class Square {
        int n;
        int h0;
        int w0;
        Square (int n) {
            this.n = n;
            h0 = 0;
            w0 = 0;
        }
        Square (int n, Square s, int d) {
            this.n = n;
            h0 = s.getHight() + py[d];
            w0 = s.getWide() + px[d];
        }
        int getHight() {
            return h0;
        }
        int getWide() {
            return w0;
        }
    }

}

Measured memory_bytes: 12000