akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;


int main(){

    //freopen("input.txt","r",stdin);

    int row, col;
    string image[150];
    // string st_image[300];


    cin >> row >> col ;

    for(int i=0; i<row; i++){
        cin >> image[i];
    }

    for(int i=0; i< 2*row; i++){
        int p = (i)/2;
        cout << image[p] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  int it = 0;
  int n;
  string str; int a, b, c;
  while (cin >> n) {
    if (n == 0) break;
    if (it++ != 0) cout << endl;
    vector< pair<pair<int, int>, string> > data(n);
    for (int i = 0; i < n; ++i) {
      cin >> str >> a >> b >> c;
      int val = a*3 + c;
      data[i] = make_pair(make_pair(val, n-i), str);
    }
    sort(data.begin(), data.end());
    for (int i = n-1; i >= 0; --i) {
      cout << data[i].second << "," << data[i].first.first << endl;
    }
  }
}


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

struct Point{
  double x, y;
};


void koch(int n, Point a, Point b){
  if(n == 0) return ;
  Point s, t, u;
  double th = M_PI * 60.0 / 180.0;

  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n-1, a, s);
  cout << showpoint << s.x << " " << showpoint << s.y << endl;
  koch(n-1, s, u);
  cout << showpoint << u.x << " " << showpoint <<  u.y << endl;
  koch(n-1, u, t);
  cout << showpoint << t.x << " " << showpoint << t.y << endl;
  koch(n-1, t, b);

}
int main(){
  Point a, b;
  int n;
  cin >> n;
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  cout << showpoint << a.x << " " << showpoint << a.y << endl;
  koch(n, a, b);
  cout << showpoint << b.x << " " << showpoint << b.y << endl;

  return 0;
}

Measured memory_bytes: 3208
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(4):
            for _ in range(4):
                for _ in range(4):
                    is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                    if is_same_element: 
                        is_same = True
                    self.__rot(self.dice2)
                self.dice2.move_next_rows()
            self.dice2.move_next_cols()
            
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.cols[3]
        dice.cols[3] = dice.rows[3]
        dice.rows[3] = dice.cols[1]
        dice.cols[1] = temp

        
d1 = list(map(int, input().split(" ")))
d2 = list(map(int, input().split(" ")))
dice1 = Dice(d1)
dice2 = Dice(d2)

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()



Measured memory_bytes: 5612
#include<bits/stdc++.h>
#define A 100000
using namespace std;
int miti[100010],a,n,m,here=1,ans;

int main(){
    cin >> n >> m;
    for(int i=0;i<n-1;i++){
        cin >> a;
        miti[i+2]=a+miti[i+1];
    }
    for(int i=0;i<m;i++){
        cin >> a;
        if(a>0){
            ans+=miti[here+a]-miti[here];
            here+=a;
            ans%=A;
        }else{
            ans+=miti[here]-miti[here+a];
            here+=a;
            ans%=A;
        }
    }

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

Measured memory_bytes: 3416
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string S = ReadLine();
            string ans ="Good";
            for(int i=0;i<3;i++){
                if(S[i]==S[i+1]){
                    ans = "Bad";
                }
            }
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator =' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

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

int main(){
	int64_t n, a;
	cin >> n >> a;
	int64_t ans = n;
	for(int p = 1; p < 50; p++){
		multiset<int64_t> ss;
		for(int i = 0; i < p + 1; i++) ss.insert(2);
		while(true){
			int64_t tt = 1;
			for(auto& s:ss) tt *= s;
			if(tt >= n) break;
			auto mi = *ss.begin();
			ss.erase(ss.begin());
			ss.insert(mi + 1);
		}
		int64_t cur = 0;
		for(auto& s:ss) cur += s;
		cur += p * a;
		ans = min(ans, cur);
	}
	cout << ans << endl;
}

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

int main(void)
{
  int n = 0;
  std::cin >> n;
  int b = 0;
  int preB = -1;
  int sum = 0;
  for(int count = 0; n - 1 > count; ++count)
  {
    std::cin >> b;
    if(-1 == preB)
    {
      sum += b;
    }
    else
    {
      sum += (std::min)(b, preB);
    }
    preB = b;
  }
  sum += b;
  std::cout << sum;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+10;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    2019;
ll arr[N];
int main()
{  fast
ll n;
cin>>n;
map<ll,ll> mp;
for(ll i=1;i<=n;i++)
{
	cin>>arr[i];
	mp[i-arr[i]]++;
	arr[i]+=i;
}
ll ans=0;
for(ll i=1;i<=n;i++)
ans+=mp[arr[i]];
cout<<ans;
}


Measured memory_bytes: 27876
S = gets.chomp

ref = '0'
def count(init)
	count = 0
	ref = init
	S.each_char do |char|
		if ref == char
			count += 1
			ref = char == '0'? '1' : '0'
		else
			ref = char
		end
	end
	count
end

countA = count('0')
countB = count('1')

if countA < countB
	puts countA
else
	puts countB
end


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

int main(){
  int n;
  long sum = 0, a = 0;
  cin >>  n;
  vector<long> yama(n), dam(n);
  rep(i, n, 0){
    cin >> dam[i];
    sum += dam[i];
    if(i % 2 == 1) a += dam[i];
  }
  
  yama[0] = sum - 2 * a;
  rep(i, n-1, 0) yama[i+1] = 2 * dam[i] - yama[i];
  rep(i, n, 0) cout << yama[i] << " ";
  cout << endl;
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
using namespace std;
const int P=(1e9)+7,mid=25500000,lid=10000000;
#define mod(x) ((x%P+P)%P)
int bra,num[mid+2];
inline long long qw(int x) {
	long long ans=1,o=10;
	while(x) {
		if(x&1) ans=(ans*o)%P;
		o=(o*o)%P,x>>=1;
	}
	return ans;
}
inline int ans1() {
	int s=0,ans=0;
	for(int cnt=1,_pow=10,j=1; cnt<8; cnt++,j=_pow,_pow*=10) for(int i=j; i<_pow; i++) num[i]=cnt;
	for (int i=lid; i<=mid; i++) num[i]=8;
	for(int l=1,r=0; l!=lid && r!=mid; l++) {
		s-=num[l-1];
		while(s+num[r+1]<=bra && r<mid) s+=num[++r];
		if(s==bra) ans++;
	}
	return ans;
}
inline int ans2() {
	int lim=bra/8,ans=lim;
	for(int t=1; t<=lim; t++) if(!(bra%t)) ans=mod(ans+mod(1ll*qw(bra/t-1)*9)-t);
	return ans;
}
#define AKIOIakNoip() {scanf("%d",&bra),printf("%d\n",mod(ans1()+ans2()));}
int main() {
	AKIOIakNoip();
}

Measured memory_bytes: 99968
import sys

def main():
    input = sys.stdin.readline
    n, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    key = 50
    nn = n
    while nn > 0:
        key += 1
        nn //= 2
    
    for _ in range(min([key, k])):
        b = [0]*n
        for i in range(n):
            l, r = max([i-a[i], 0]), min([i+a[i], n-1])
            b[l] += 1
            if r != n-1:
                b[r+1] -= 1
        for i in range(n):
            a[i] = 0
            a[i] += b[i]
            if i != 0:
                 a[i] += a[i-1]
    print(*a)

if __name__ == "__main__":
    main()


Measured memory_bytes: 171788
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
using ll=long long;

ll  n, k, p, m=0, sa, min_sa=1e9;
set<ll> v;

string solve(){
    auto iter=v.begin();
    p=*iter;

    for(; iter!=v.end(); iter++){
        sa=*iter-p;
        if(sa != 0){
            min_sa=min(sa, min_sa);
        }
        p=*iter;
    }
    return min_sa!=1e9 && k%min_sa==0          ? "POSSIBLE" 
        : v.count(k)==1 ? "POSSIBLE" 
        :                                        "IMPOSSIBLE";
}

int main(){
    ios::sync_with_stdio(false);
    cin >> n >> k;
    ll in;
    for(int i=0; i<n; i++){
        cin >> in; 
        v.insert(in);
    }
    if(k - *max_element(v.begin(), v.end()) > 0){
        cout << "IMPOSSIBLE" << endl;
    }else{
        cout << solve() << endl;
    }
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#define LL long long
#define INF (0x7ffffffffffffffll)
#define pii pair<int, int>
#define MAXN (1000 + 5)
using namespace std; // 000 001 011 111 110 100 101 010
LL a[MAXN], ans = -INF, ca[MAXN][3];
int n, m;
void solve()
{
	LL f[MAXN];
	memset(f, 0x8f, sizeof(f));
	f[0] = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = m; j >= 0; j--)
			if (f[j] + a[i] > f[j + 1])
				f[j + 1] = f[j] + a[i];
	}
	ans = max(ans, f[m]);
}
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%lld%lld%lld", &ca[i][0], &ca[i][1], &ca[i][2]);
	for (int i = 0; i < 8; i++)
	{
		memset(a, 0, sizeof(a));
		for (int j = 1; j <= n; j++)
			for (int k = 0; k <= 2; k++)
			{
				LL x = ca[j][k];
				if (i & (1 << k))
					x = -x;
				a[j] += x;
			}
		solve();
	}
	printf("%lld", ans);
	return 0;
}


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

int main()
{
    int n;
    cin >> n;
    lli x[200005], s[200005];
    rep(i, n) cin >> x[i] >> s[i];
    ll cur = 0;
    ll sum = 0;
    ll ans = 0;
    rep(i, n)
    {
        sum += s[i];
        ans = max(ans, (ll)s[i]);
        ans = max(ans, sum - (ll)x[i] - cur);
        cur = min(cur, sum - (ll)x[i] - (ll)s[i]);
    }
    cout << (lli)ans << endl;
}


Measured memory_bytes: 3328
<?php
fscanf(STDIN, "%d%d", $N, $K);
for($i = 0; $i < $N; $i++){
    fscanf(STDIN, "%d%d", $a[], $b[]);
}
array_multisort($a, $b);

for($i = 0; $i < $N; $i++){
    $K -= $b[$i];
    if($K<=0){
        echo $a[$i];exit;
    }
}


Measured memory_bytes: 26228
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    string S;
    cin >> S;
    if (S == "SUN") {
        cout << 7 << endl;
    } else if (S == "MON") {
        cout << 6 << endl;
    } else if (S == "TUE") {
        cout << 5 << endl;
    } else if (S == "WED") {
        cout << 4 << endl;
    } else if (S == "THU") {
        cout << 3 << endl;
    } else if (S == "FRI") {
        cout << 2 << endl;
    } else if (S == "SAT") {
        cout << 1 << endl;
    }
    return 0;
}


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

int main() {
  long long n,a,b,c,x=0;
 
  bool ok;
  cin >> n >> a >> b >> c;
  vector<string> s(n);
  for(long long i=0;i<n;i++)
  {cin >> s.at(i);
  }
  for(long long i=0;i<n;i++)
  { 
    if(s.at(i)=="AB")
	{   		x=max(a,b);

      if(a==1&&b==1&&c==0&&i!=n-1)
    {if(s.at(i+1)!="AB")
    {if(s.at(i+1)=="BC")
      {
        b++;
        a--;
        s.at(i)="B";
        goto FIN;
      }
        else if(s.at(i+1)=="AC")
        {
          a++;
          b--;
          s.at(i)="A";
          goto FIN;
        }
        
    }   
          
        
    }
		if(x==a)
		{b++;
	     a--;
		s.at(i)="B";
		}
		else
		{
			a++;
			b--;
			s.at(i)="A";
		}
	}
	 if(s.at(i)=="AC")
	{  		x=max(a,c);
    
    
       if(a==1&&b==0&&c==1&&i!=n-1)
    {    if(s.at(i+1)!="AC")
    {
      if(s.at(i+1)=="BC")
      {
        c++;
        a--;
        s.at(i)="C";
        goto FIN;
      }
        if(s.at(i+1)=="AB")
        {
          a++;
          c--;
          s.at(i)="A";
          goto FIN;
        }
    }}
		if(x==a)
		{c++;
	     a--;
		s.at(i)="C";
		}
		else
		{
			a++;
			c--;
			s.at(i)="A";
		}
	}
	 if(s.at(i)=="BC")
	{ x=max(c,b);
       if(a==0&&b==1&&c==1&&i!=n-1)
    {    if(s.at(i+1)!="BC")
    {
      if(s.at(i+1)=="AC")
      {
        c++;
        b--;
        s.at(i)="C";
        goto FIN;
      }
        else if(s.at(i+1)=="AB")
        {
          b++;
          c--;
          s.at(i)="B";

        goto FIN;}
    }
    }	
	if(x==c)
		{b++;
	     c--;
		s.at(i)="B";
		}
		else
		{
			c++;
			b--;
			s.at(i)="C";
		}
	}
    FIN:
	if(a<0||b<0||c<0)
		break;
  }
  if(a>=0&&b>=0&&c>=0)
  {
	  cout << "Yes" << endl;
	  for(long long i=0;i<n;i++)
		  cout << s.at(i) << endl;
  }
  else
  {
	  cout << "No";
  }
}


Measured memory_bytes: 6372
#include <iostream>
#include <algorithm>

bool judge_triangle(int j_edge[])
{
    std::sort(j_edge, j_edge + 3); 
    return j_edge[2] * j_edge[2] == j_edge[0] * j_edge[0] + j_edge[1] * j_edge[1];
}

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

    for (int i = 0; i < num; i++) {

        int edge[3];
        std::cin >> edge[0] >> edge[1] >> edge[2];

        if (judge_triangle(edge)) {
            std::cout << "YES" << std::endl;
        } else {
            std::cout << "NO" << std::endl;
        }
    }   
    return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()

{

    ll  s=0,s1=0;
    for(ll i=  0; i < 3; i++)
    {

        for(ll j = 0; j < 3; j++)
        {

            ll x;
            cin >> x;
            s+=x;
            if(i==j)
                s1+=x;
        }
    }
    if(s%3==0)
    {

        if(s1==(s/3))
            cout << "Yes";
        else
            cout << "No";
    }
    else
        cout << "No";
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//s.find(w[i])==string::npos
//findの使い方

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y,txa,txb,tya,tyb,xcmp=0,ycmp=0;

string s,w;

vector<int> z;

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

       cin >> a>> b >> c >> x;
       rrep(i,0,a+1){
           rrep(j,0,b+1){
               rrep(k,0,c+1){
                   if(500*i+100*j+50*k==x){
                       ans++;
                   }
               }
           }
       }
       cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
object Main extends App {
	var Array(n, x, y) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
	val dist = new Array[Int](n)

	x -= 1
	y -= 1

	for(i<-0 until n){
		for(j<-i+1 until n){
			val tp = math.min(math.min(j-i, math.abs(x - i) + 1 + math.abs(y-j)), math.abs(x - j) + 1 + math.abs(y-i))
			dist(tp) += 1
		}
	}

	for(i<-1 until n){
		println(dist(i))
	}
}


Measured memory_bytes: 25824
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let S: String = read();
    let T: String = read();
    let s: Vec<_> = S.chars().collect();
    let t: Vec<_> = T.chars().collect();
    for i in 0..N {
        print!("{}", s[i]);
        print!("{}", t[i]);
    }
    println!();
}


Measured memory_bytes: 4352
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	string s;
	cin >> s;

	if (N & 1) cout << "No" << "\n";
	else {
		if (s.substr(0, N / 2) == s.substr(N / 2)) cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll dp[100010][2];

int main() { 
    string L; cin >> L;
    int len = L.size();
    rep(i, 100010)rep(j ,2) dp[i][j] = 0;
    dp[0][0] = 1;

    rep(i, len){
        if(L[i] == '0'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1] * 3 % MOD;
        }else{
            dp[i+1][0] = dp[i][0] * 2 % MOD;
            dp[i+1][1] = (dp[i][1] * 3 % MOD + dp[i][0]) % MOD;
        }
    }
    cout << (dp[len][0] + dp[len][1]) % MOD << ln;
}




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

using namespace std;

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

    int n;
    cin >> n;

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

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

    double res = a[0];
    for (int i = 1 ;i < a.size() ;i++)
        res = (res + a[i]) / 2.0;


    cout << fixed << setprecision(10) << res;
}

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

int main() {
	int debt = 100000; int n; cin >> n;
	for (int i = 0; i < n; i++) {
		debt *= 1.05;
		debt += (debt % 1000 > 0 ? 1000 - debt % 1000 : 0);
	}
	cout << debt << endl;
	return 0;
}


Measured memory_bytes: 3028
from collections import deque

n, start1, start2, end1, end2 = map(lambda x: int(x) - 1, input().split())
n += 1
if start2 < start1:
    start1, start2 = start2, start1
    end1, end2 = end2, end1
s = list(input())

def bfs(start, end, otherEnd, inBetween=False):
    visited = [False] * n
    visited[start] = True
    q = deque()
    q.append(start)
    while q:
        cur = q.popleft()
        if cur == end:
            s[cur] = '#'
            return cur
        if inBetween and cur != otherEnd and s[cur - 1] == s[cur + 1] == '.':
            s[cur] = '#'
            return cur
        for next in (cur + 1, cur + 2):
            if next < n and s[next] == '.' and not visited[next]:
                visited[next] = True
                q.append(next)
    return -1

secondPos = bfs(start2, end2, end1, inBetween=True)
if secondPos == -1:
    print('No')
    exit()
if bfs(start1, end1, end2) == -1:
    print('No')
    exit()
print('Yes' if bfs(secondPos, end2, end1) else 'No')

Measured memory_bytes: 6580
N, M, Q = map(int, input().split())
ans = 0
zenbu = []
def tukuru(cur, last):
    if len(cur) == N:
        zenbu.append(cur)
        return
    for j in range(last, M+1):
        tukuru(cur+[j], j)
tukuru([], 1)
D = [0]*len(zenbu)
for i in range(Q):
    a, b, c, d = map(int, input().split())
    for i, p in enumerate(zenbu):
        if p[b-1] - p[a-1] == c:
            D[i] += d
print(max(D))

Measured memory_bytes: 26344
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

const ll mod = 1e9+7;

ll fastExpo(ll base, ll po){
    if(po == 0) return 1;
    if(po == 1) return base;
    ll ans = fastExpo(base,po/2);
    ans *= ans;
    ans %= mod;
    if(po&1) ans = (ans*base)%mod;
    return ans;
}

ll modInv(ll num){
    return fastExpo(num, mod-2);
}

ll factorial[5001];
ll invfactorial[5001];

ll choose(ll n, ll k){
    ll ans = 1;
    ans *= factorial[n];
    ans *= invfactorial[k];
    ans %= mod;
    ans *= invfactorial[n-k];
    ans %= mod;
    return ans;
}

void add(ll &a, ll b){
    a += b;
    if(a >= mod) a -= mod;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    factorial[0] = 1;
    F0R(i,1,5000) factorial[i] = ((ll)(i)*factorial[i-1])%mod;
    FOR(i,5001) invfactorial[i] = modInv(factorial[i]);
    int s; cin >> s;
    int maxsz = s/3;
    ll ans = 0;
    F0R(i,1,maxsz) add(ans, choose(s-2*i-1,i-1));
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define mxn 200005

using namespace std;
typedef long long ll;

int A, B, C, D;

int main(){
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    cin >> A >> B >> C >> D;
    int t1 = C/B, t2 = A/D;
    if (C%B) t1++;
    if (A%D) t2++;
    
    if (t1 <= t2)
        cout << "Yes\n";
    else cout << " No\n";

    return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> PLL;
const LL N = 2e5 + 10;
const LL INF = 1e18;
LL a[N], f[N][3][2];
LL n;

void iniv() {
	for (LL i = 0; i <= n; i++) {
		for (LL j = 0; j < 3; j++) {
			for (LL k = 0; k < 2; k++) {
				f[i][j][k] = -INF;
			}
		}
	}
	f[0][0][0] = 0;
}

void dp() {
	for (LL i = 0; i < n; i++) {
		for (LL j = 0; j < 3; j++) {
			for (LL k = 0; k < 2; k++) {
				if (k == 0) f[i + 1][j][1] = max(f[i + 1][j][1], f[i][j][k] + a[i + 1]);

				LL nj = j;
				if (k == 0) nj++;
				if (nj < 3) f[i + 1][nj][0] = max(f[i + 1][nj][0], f[i][j][k]);
			}
		}
	}
}

int main() {
	cin >> n;
	for (LL i = 1; i <= n; i++) cin >> a[i];

	iniv(); dp();

	LL res = (n % 2 ? max(f[n][1][0], f[n][2][1]) : max(f[n][0][0], f[n][1][1]));
	cout << res << endl;

	return 0;
}

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

using namespace std;

int main() {

  string s;

  cin>>s;

  int sum=0;

  for(int i=0;i<s.size();i++)
  {
      if(s[i]=='+')
      {
          sum=sum+1;
      }
      else
      {
          sum=sum-1;
      }
  }

  cout<<sum<<"\n";

  return 0;
}



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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split();
        int N = int.Parse(input[0]);
        int D = int.Parse(input[1]);
        int[,] X = new int[N, D];
        for(int i =0; i < N; i++)
        {
            var input1 = Console.ReadLine().Split();
            for(int j = 0; j < D; j++)
            {
                X[i,j]=int.Parse(input1[j]);
            }
        }
        int count = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = i+1; j < N; j++)
            {
                double sum = 0;
                for (int k = 0; k < D; k++)
                {
                    sum += Math.Pow(Math.Abs(X[i, k] - X[j, k]),2);
                    if (k == D - 1) { sum = Math.Sqrt(sum);
                        if (sum == (int)sum) { count++; }
                    }
                }
            }
        }
        Console.WriteLine(count);

    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	int L=min(a, min(b, c)), R=max(a, max(b, c));
	cout<<R-L<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <random>
#include <map>
#include<iomanip>

//AtCoderC++.cpp

using namespace std;


#define rep(i,from,to) for(int i=from;i<to;i++)
#define ints(name,n) vector<int> name;name.resize(n)

template<typename T> void Show(vector<vector<T>> v, string delimiter = " ") {
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			cout << v[i][j];
			if (j != v[i].size() - 1) {
				cout << delimiter;
			} else {
				cout << endl;
			}
		}
	}
}
template<typename T> void Show(vector<T> v, string delimiter = " ") {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
		if (i != v.size() - 1) {
			cout << delimiter;
		} else {
			cout << endl;
		}
	}
}
template<typename T> vector<T> getUniform(T value, int n) {
	vector<vector<T>> ts;
	ts.resize(n);
	for (int i = 0; i < n; i++) {
		ts[i] = value;
	}
	return ts;
}
template<typename T> vector<vector<T>> getUniform(T value, int row, int col) {
	vector<vector<T>> ts;
	ts.resize(row);
	for (int i = 0; i < row; i++) {
		ts[i].resize(col);
		for (int j = 0; j < col; j++) {
			ts[i][j] = value;
		}
	}
	return ts;
}
bool All(vector<vector<bool>> ts) {
	int h = ts.size();
	int w = ts[0].size();
	rep(i, 0, h) {
		rep(j, 0, w) {
			if (!ts[i][j])return false;
		}
	}
	return true;
}



int main() {
	string s;
	cin >> s;
	auto zCount = 0, oCount = 0;
	for (size_t i = 0; i < s.length(); i++) {
		if (s[i] == '0')zCount++;
		else oCount++;
	}
	cout << min(oCount, zCount) * 2 << endl;
}






Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i%3 != 0 && i%5 != 0) ans += i;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<string> a(n);
    int b=n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1]){
            b--;
        }
    }
    cout<<b<<endl;
}

Measured memory_bytes: 9604
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
string normalize(string s)
{
    stack<char>C,D;
    int i;
    fo(i,0,sz(s))
    {
        if(s[i]=='(')C.push('(');
        else
        {
            if(!C.empty())
            {
                if(C.top()=='(')
                C.pop();
                else
                C.push(')');
            }
            else C.push(')');
        }
    }
    
    string ans;
    while(!C.empty()){D.push(C.top());C.pop();}
    while(!D.empty()){ans.pb(D.top());D.pop();}
    return ans;
}
void get_a_b(int &a,int &b,string &s)
{
    a=0;
    b=0;
    int i=0;
    while(s[i]==')')i++;
    b=i;
    a=sz(s)-b;
}
bool compare(pair<pair<int,int>,string>& a,pair<pair<int,int>,string> &b)
{
    return((a.F.S-a.F.F)<(b.F.S-b.F.F));
}
void solve()
{
  int n,i;cin>>n;
  vector<pair<pair<int,int>,string>>P;
  string O,C;
  fo(i,0,n)
  {
      string s;cin>>s;
      s=normalize(s);
      int a,b;
      get_a_b(a,b,s);
      if(a>0&&b>0)
      P.pb(mp(mp(a,b),s));
      else
      {
          if(a==0)C+=s;
          else O+=s;
      }
  }
  sort(all(P),compare);
  string ans;ans+=O;
  fo(i,0,sz(P))ans+=P[i].S;
  ans+=C;
  
  ans=normalize(ans);
  if(sz(ans))cout<<"No\n";
  else cout<<"Yes\n";
}
int main()
{
   fastio
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//If wrong on pretest 2 means logically wrong


/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 13684
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll X[100100];
int main(){
    int N;
    ll A,B;
    cin >> N >> A >> B;
    REP(i,N){
        ll x;
        cin >> x;
        X[i] = x;
    }

    ll ans = 0;
    ll x = X[0];
    for(int i = 1; i < N; i++){
        ll next = X[i];
        ll diff = next - x;
        ll cost = diff*A;
        if(cost < B) ans += cost;
        else ans += B;
        x = next;
    }

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, d;
vvi g;
int dfs(int v = 1, int p = 1) {
	int x = 0, y = 0;
	for(auto i : g[v]) {
		if(i == p) continue;
		int t = 1+dfs(i, v);
		if(x<t)y=x,x=t;
		else if(y<t) y = t;
	}
	d = max(d, x+y);
	return x;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	g.resize(n+1);
	for(int f, t, i = 1; i < n; i++) {
		cin >> f >> t;
		g[f].pb(t);
		g[t].pb(f);
	}
	dfs();
	cout << (((d-1)%3)?"First":"Second");
	return 0;
}


Measured memory_bytes: 23168
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(__typeof(b) i = a; i < b; i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i > b; i--)

typedef vector<int> vi;		typedef vector<ll> vl;
typedef pair<int, int> ii; 	typedef vector<ii> vii;

// code start here //

bool dp[2005][100005];
int a[2005];

signed main() {
	fastio;
	int n; cin >> n;
	int sum = 0;
	rep(i, 0, n) {
		cin >> a[i];
		sum += a[i];
	}
	dp[0][a[0]] = 1;
	rep(i, 1, n) {
		rep(j, 0, 100005) {
			if(dp[i - 1][j]) {
				if(j > a[i]) {
					dp[i][j - a[i]] = 1;
				}
				else {
					dp[i][a[i] - j] = 1;
				}
				if(a[i] + j < 100005) {
					dp[i][a[i] + j] = 1;
				}
			}
		}
	}
	rep(i, 0, 100005) {
		if(dp[n - 1][i]) return cout << (sum + i) / 2 << endl, 0;
	}
}


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

int main() {
    std::string s;
    std::cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if(i%2 == 0) {
            std::cout << s[i];
        }
    }

    std::cout << "\n";
}

Measured memory_bytes: 3620
# Title: Christmas Eve Eve Eve
# Link: https://abc115.contest.atcoder.jp/tasks/abc115_a

import sys


sys.setrecursionlimit(10 ** 6)

read_single_int = lambda: int(sys.stdin.readline().strip())

def solution(d: int):
    return {22:'Christmas Eve Eve Eve', 23:'Christmas Eve Eve', 24:'Christmas Eve', 25:'Christmas'}[d]


def main():
    d = read_single_int()
    print(solution(d))


if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int x;
    std::cin >> x;
    if (x == 7 || x == 5 || x == 3) std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin>>S;
    int ans;
    ans=0;
    for (int i=0;i<4;i++)
        if (S[i]=='+')
            ans+=1;
        else
            ans-=1;
    cout<<ans<<endl;
}


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

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main(){
    double a,b,h,m;
    cin >> a >> b >> h >> m;

    double minute = M_PI * m / 30.0;
    double hour = M_PI * h / 6.0 + minute / 12.0;

    double rad = abs(minute - hour);

    double len = sqrt(a*a+b*b-2.0*a*b*cos(rad));

    cout << fixed << setprecision(20) << len << endl;

    return 0;
}

Measured memory_bytes: 4136
#!/usr/bin/env python3
#ABC135 A

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

a,b = map(int,input().split())

if a-b == 0:
    print(1)
elif (a+b) % 2 == 0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 38384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n, a;

  scanf("%d", &n);

  map<int,int> mm[2];

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

    mm[i%2][a]++;
  }

  pair<int,int> p[2][2] = {};

  for(int i=0;i<2;i++){
    for(pair<int,int> q : mm[i]) {
      swap(q.first, q.second);
      p[i][1] = max(q, p[i][1]);
      if (p[i][0] < p[i][1]) swap(p[i][0], p[i][1]);
    }
  }

  int ans = 0;

  if(p[0][0].second == p[1][0].second) {
    ans = max(ans, p[0][1].first + p[1][0].first);
    ans = max(ans, p[0][0].first + p[1][1].first);
  } else {
    ans = max(ans, p[0][0].first + p[1][0].first);
  }

  cout << n - ans << endl;

  return 0;
}


Measured memory_bytes: 4992
#include <cstddef> // size_t
#include <cstring> // strlen, strcpy
#include <iostream>

using namespace std;





    int main(){
        int a, b;

        cin >> a >> b;
        if(2 * b >= a)
            cout << 0;
        else{
            cout << a - 2 * b;
        }
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];
  sort(h.begin(), h.end());
  ll ans = 0;
  rep(i, n-k)
    ans += h[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
package main

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

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

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

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

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	x := scanInts(n)

	ans := 1 << 60
	
	for i := 0; i < 101; i++ {
		sum := 0
		for j := 0; j < n; j++ {
			sum += (x[j]-i)*(x[j]-i)
		}
		ans = min(ans, sum)
	}

	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int INF = 100000000;
int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<bool>> E(N, vector<bool>(N, false));
  for (int i = 0; i < M; i++){
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    E[A][B] = true;
    E[B][A] = true;
  }
  vector<vector<int>> E2(N);
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      if (!E[i][j]){
        E2[i].push_back(j);
        E2[j].push_back(i);
      }
    }
  }
  vector<int> c(N, -1);
  vector<array<int, 2>> cnts;
  bool ok = true;
  for (int i = 0; i < N; i++){
    if (c[i] == -1){
      c[i] = 0;
      array<int, 2> cnt = {1, 0};
      queue<int> Q;
      Q.push(i);
      while (!Q.empty()){
        int v = Q.front();
        Q.pop();
        for (int w : E2[v]){
          if (c[w] == -1){
            c[w] = 1 - c[v];
            cnt[c[w]]++;
            Q.push(w);
          } else if (c[w] == c[v]){
            ok = false;
            break;
          }
        }
        if (!ok){
          break;
        }
      }
      cnts.push_back(cnt);
      if (!ok){
        break;
      }
    }
  }
  if (!ok){
    cout << -1 << endl;
  } else {
    int ccnt = cnts.size();
    vector<vector<bool>> dp(ccnt + 1, vector<bool>(N + 1, false));
    dp[0][0] = true;
    for (int i = 0; i < ccnt; i++){
      for (int j = 0; j <= N - cnts[i][0]; j++){
        if (dp[i][j]){
          dp[i + 1][j + cnts[i][0]] = true;
        }
      }
      for (int j = 0; j <= N - cnts[i][1]; j++){
        if (dp[i][j]){
          dp[i + 1][j + cnts[i][1]] = true;
        }
      }
    }
    int ans = INF;
    for (int i = 0; i <= N; i++){
      if (dp[ccnt][i]){
        ans = min(ans, i * (i - 1) / 2 + (N - i) * (N - i - 1) / 2);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 5980
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
static const double EPS = pow(10,-10);
typedef long long ll;
static const int IN = 2;
static const int ON = 1;
static const int OUT = 0;


class Vector2{
  public:
  double x, y;
  Vector2(){}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator + (Vector2 v) {
    return Vector2(x + v.x , y + v.y);
  }
  Vector2 operator - (Vector2 v) {
    return Vector2(x - v.x , y - v.y);
  }

  Vector2 operator * (double d){
    return Vector2(d*x, d*y);
  }

  double norm(){
    return x*x + y*y;
  }

  double abs(){
    return sqrt(norm());
  }

};

double dot(Vector2 a, Vector2 b){
  return a.x*b.x + a.y*b.y;
}

double cross(Vector2 a, Vector2 b){
  return a.x*b.y - a.y*b.x;
}

int contain(Vector2 poly[], int n, Vector2 p){
  bool isContain = false;
  Vector2 a,b ;
  rep(i,n){
    a = poly[i] - p;
    b = poly[(i+1) % n] - p;
    if(abs(cross(a,b)) < EPS && dot(a,b) < EPS) return ON;
    if(a.y > b.y) swap(a,b);
    if(a.y < EPS && b.y > EPS && cross(a,b) > EPS) isContain = !isContain;
  }
  return (isContain ? IN: OUT);
}

int main(){
  Vector2 point, polygon[100];
  int n, queri;
  cin >> n;
  rep(i,n){
    cin >> polygon[i].x >> polygon[i].y;
  }
  cin >> queri;
  rep(i,queri){
    cin >> point.x >> point.y;
    cout << contain(polygon, n, point) << endl;
  }
  return 0;
}


Measured memory_bytes: 3228
#include<stdio.h>
#include<math.h>
int main(){
  char a[4];
  int i,ans = 0;
  for (i=0;i<4;i++){
    scanf("%c",&a[i]);
    if(a[i]=='+') ans++;
    if(a[i]=='-') ans--;
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	vector<int> a(3);
	cin >> a;
	sort(ALL(a));
	OUT((a[0] == a[1] && a[1] != a[2]) || (a[0] != a[1] && a[1] == a[2]) ? "Yes" : "No");
}


Measured memory_bytes: 256