akhauriyash/Code-Regression huggingface dataset:
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int INF=1e9+7;
const int maxn=2e5+5;

void add(int &a,int b){a=(a+b>=INF)?(a+b-INF):(a+b);}

int n,m,ans=0;
int a[maxn],f[maxn],g[maxn],sum[maxn];

int main(){
	scanf("%d",&m);
	REP(i,1,m){
		int x;scanf("%d",&x);
		if(x==a[n]) continue;
		a[++n]=x;
	}
	f[0]=sum[0]=1;
	REP(i,1,n){
		f[i]=g[a[i]];
		sum[i]=(f[i]+sum[i-1])%INF;
		if(i-2>=0) add(g[a[i-1]],sum[i-2]);
	}
	//REP(i,0,n) printf("%d ",f[i]);
	//puts("");
	REP(i,0,n) add(ans,f[i]);
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 3328
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            int[] n = io.r<int>(' ');
            if (n[0] == 0 && n[1] == 0) { break; }
            int c = 0;
            for (int i = 1; i <= n[0]; i++)
            {
                for (int j = 1; j <= n[0]; j++)
                {
                    for (int k = 1; k <= n[0]; k++)
                    {
                        if (i != j && i != k && j != k)
                        {
                            if (n[1] == i + j + k)
                            {
                                c++;
                            }
                        }
                    }
                }
            }
            io.w(c / 6);
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 10336
#include<stdio.h>

int main()
{
	int a,b=0,ans;
	
	while(scanf("%d",&a) !=EOF){
		b=a;
		ans=0;
		while(b<600){
			ans+=a*b*b;
			b+=a;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979
using ll = long long;
using P = pair<int,int>;

ll divisor=1e9+7;
int main(){
	ll x;
  	cin>>x;
	ll a=100,c=0;
	
	while(a<x){
		a*=1.01;
		c++;
	}
	puts(c);
}

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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main(){
  ll N;
  cin >>N;
  queue<ll> qa, qb,qc,qd,qe,qf,qg;
  ll a, b, c;
  qa.push(3LL);
  qa.push(5LL);
  qa.push(7LL);
  ll ta = 0LL;
  ll A = 0LL;
  while(ta<=N){
    ta=qa.front();
    qa.pop();
    qa.push(ta*10LL+3LL);
    qa.push(ta*10LL+5LL);
    qa.push(ta*10LL+7LL);
    A++;
  }
  qb.push(3LL);
  qb.push(5LL);
  ll tb = 0LL;
  ll B=0LL;
  while(tb<=N){
    tb=qb.front();
    qb.pop();
    qb.push(tb*10LL+3LL);
    qb.push(tb*10LL+5LL);
    B++;
  }
  qc.push(3LL);
  qc.push(7LL);
  ll tc = 0LL;
  ll C=0LL;
  while(tc<=N){
    tc=qc.front();
    qc.pop();
    qc.push(tc*10LL+3LL);
    qc.push(tc*10LL+7LL);
    C++;
  }
  qd.push(5LL);
  qd.push(7LL);
  ll td = 0LL;
  ll D=0LL;
  while(td<=N){
    td=qd.front();
    qd.pop();
    qd.push(td*10LL+5LL);
    qd.push(td*10LL+7LL);
    D++;
  }
  qe.push(3LL);
  ll te = 0LL;
  ll E=0LL;
  while(te<=N){
    te=qe.front();
    qe.pop();
    qe.push(te*10LL+3LL);
    E++;
  }
  qf.push(5LL);
  ll tf = 0LL;
  ll F=0LL;
  while(tf<=N){
    tf=qf.front();
    qf.pop();
    qf.push(tf*10LL+5LL);
    F++;
  }
  qg.push(7LL);
  ll tg = 0LL;
  ll G=0LL;
  while(tg<=N){
    tg=qg.front();
    qg.pop();
    qg.push(tg*10LL+7LL);
    G++;
  }
  cout<<A-B-C-D+E+F+G-1LL<<endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main(){

int n,t,a;
int h[100001];
cin >> n >> t >> a;
for (int i = 1;i <= n;i++){
  cin >> h[i];
}
int mini = 1000000,tem,place;
for (int i = 1;i <= n;i++){
  tem =abs(a*1000 - (t*1000-h[i]*6));

  if(tem < mini){
    mini = tem;
    place = i;
  }
  
}
cout << place << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
int INF = 1e9 + 1;
int MOD = 1e9+7;
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b&&b!=c){
        cout << "Yes";
        return 0;
    }if(a==c&&c!=b){
        cout << "Yes";
        return 0;
    }if(c==b&&c!=a){
        cout << "Yes";
        return 0;
    }
    cout << "No";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,k=0;
    cin>>a>>b;
    int c[b],d[b][a],e[a];
    for(int i=0;i<a;i++){
        e[i]=0;
    }
    for(int i=0;i<b;i++){
        cin>>c[i];
        for(int j=0;j<c[i];j++)cin>>d[i][j];
        for(int j=0;j<c[i];j++){
            e[d[i][j]-1]=1;
        }
    }
    for(int i=0;i<a;i++){
        if(e[i]==0){
            k++;
        }
    }
    cout<<k;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
long long n,k,dp[100005],c[105],sum[100005];
int main()
{
	cin >> n >> k;
	for(int i=1; i<=n; i++) cin >> c[i];
	dp[0]=sum[0]=1;
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=k; j++) sum[j]=(dp[j]+sum[j-1]);
		for(int j=1; j<=k; j++) dp[j]=(sum[j]-(j<=c[i]?0:sum[j-c[i]-1]))%MOD;
	}
	//for(int j=0; j<=k; j++) cout << sum[j] << ' ';cout<<'\n';
	cout << dp[k];
	return 0;
}

Measured memory_bytes: 5112
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
int oo(int x){return (x + 9) / 10 * 10;}
int re(int x){return oo(x) - x;}

int main() {
    char s;
    cin >> s;
    if(s == 'A') puts("T");
    else if(s == 'T') puts("A");
    else if(s == 'G') puts("C");
    else if(s == 'C') puts("G");
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define endl "\n"
#define MOD 1000000007
#define DEB(x) cout<<"##"<<x<<"##"<<endl;
void solve()
{ 
	int n;
	ll ans=1,flag=-1;
	cin>>n;
	ll ar[n];
	rep(i,n)
	cin>>ar[i];
	rep(i,n){	
		if(ar[i]==0)
		{
			ans=0;
			break;
		}
		if(ans>(ll)1e18/ar[i])
			flag=0;
		ans*=ar[i];
	}
	if(ans==0)
		cout<<0;
	else if(flag==0)
		cout<<-1;
	else
		cout<<ans;
} 
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int tt=1;
	//cin>>tt;
	while(tt--)
	solve(); 	
	return 0;
}


Measured memory_bytes: 4424
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <type_traits>
#include <map>


using namespace std;


int main(int argc, const char * argv[]) {
  string sd, t;
  cin >> sd >> t;
  string ans = "UNRESTORABLE";
  if(sd.size() < t.size()){
    cout << ans << endl;
    return 0;
  }
  for(int i = 0; i <= sd.size() - t.size(); i++){
    bool check = true;
    for(int j = 0; j < t.size(); j++){
      if(i+j >= sd.size() || sd[i+j] != '?'){
        //cout << sd[i+j] << "," << t[j] << endl;
        if(sd[i+j] != t[j]){
          check = false;
          break;
        }
      }
    }
    if(check == true){
      ans = sd.substr(0, i) + t + sd.substr(i+t.size(), sd.size() - t.size() - i);
      //cout << sd.substr(0, i) << "," <<  t <<"," << sd.substr(i+t.size(), sd.size() - t.size() - i) << endl;
      //break;
    }
  }
  
  for(int i = 0; i < ans.size(); i++){
    if(ans[i] == '?'){
      ans[i] = 'a';
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    string S; cin >> S;
    for(int i=0; i<(int)S.size()-1; i++){
        if(S[i+1]==S[i]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
    
}


Measured memory_bytes: 256
object Main extends App {
  import scala.collection.mutable

  val n: Int = io.StdIn.readLine().toInt
  val k: Int = 10000
  val count: Array[Int] = Array.fill(k+1)(0)
  val result: Array[Int] = Array.fill(n)(0)
  val buf: mutable.ArrayBuffer[Int] = mutable.ArrayBuffer.empty[Int]
  var nbuf: Int = 0
  for (c <- io.StdIn.readLine()) {
    if (c == ' ') {buf += nbuf; count(nbuf) += 1; nbuf = 0}
    else nbuf = nbuf*10 + c.getNumericValue
  }
  count(nbuf) += 1; buf += nbuf
  val arr: Array[Int] = buf.toArray

  for (i <- 1 to k) count(i) += count(i-1)
  for (i <- n-1 to 0 by -1) {
    result(count(arr(i))-1) = arr(i)
    count(arr(i)) -= 1
  }

  println(result.mkString(" "))
}

Measured memory_bytes: 411704
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
using namespace std;

int main() {
    char n[4];
    scanf("%s", n);
    rep(i, 3) {
        if (n[i] == '7') {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 3600
@buffer = ""
def swap(i, j)
  @buffer[i], @buffer[j] = @buffer[j], @buffer[i]
end
def cursor
  @buffer.index("^")
end

def forwardChar
  swap(cursor, cursor+1) unless cursor == @buffer.size-1
end
def forwardWord
  while cursor < @buffer.size-1 && @buffer[cursor+1] == " " do
    swap(cursor, cursor+1)
  end
  while cursor < @buffer.size-1 && @buffer[cursor+1] != " "
    swap(cursor, cursor+1)
  end
end
def backwardChar
  swap(cursor, cursor-1) unless cursor == 0
end
def backwardWord
  while cursor > 0 && @buffer[cursor-1] == " " do
    swap(cursor, cursor-1)
  end
  while cursor > 0 && @buffer[cursor-1] != " "
    swap(cursor, cursor-1)
  end
end
def insert(text)
  @buffer.insert(cursor, text)
end
def deleteChar
  @buffer.slice!(cursor+1) if @buffer[cursor+1]
end
def deleteWord
  return if @buffer[cursor+1, @buffer.size-cursor-1] !~ /[^ ]/
  while cursor < @buffer.size-1 && @buffer[cursor+1] == " " do
    @buffer.slice!(cursor+1)
  end
  while cursor < @buffer.size-1 && @buffer[cursor+1] != " " do
    @buffer.slice!(cursor+1)
  end
end

gets.to_i.times do
  @buffer = "^"+gets.chomp
  gets.to_i.times do
    case gets.chomp
      when "forward char"
        forwardChar
      when "forward word"
        forwardWord
      when "backward char"
        backwardChar
      when "backward word"
        backwardWord
      when "delete char"
        deleteChar
      when "delete word"
        deleteWord
      when /insert "(.*)"/
        insert($1)
    end
  end
  puts @buffer
end

Measured memory_bytes: 6136
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define fi first
#define se second
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};

signed main(){
  int n,k;
  cin>>n>>k;
  int l=0,r=0;
  int a[n];
  r(i,n)cin>>a[i];
  l=a[0];
  r=a[k-1];
  int ans=(r-l)+(min(abs(r),abs(l)));
  for(int i=k;i<n;i++){
    r=a[i];
    l=a[i-k+1];
    ans=min(ans,(r-l)+(min(abs(r),abs(l))));

  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
      	long ans = sc.nextLong();
      	BigDecimal x = BigDecimal.valueOf(ans);
      	BigDecimal sum = BigDecimal.valueOf(100);
      	BigDecimal foo = BigDecimal.valueOf(1.01);
      	for(int i = 1 ; sum.compareTo(x) == -1; i++){
			sum = sum.multiply(foo).setScale(0, BigDecimal.ROUND_DOWN);
          if(sum.compareTo(x) >= 0){
          System.out.println(i);
        	}
        }

		
	}
}



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



int main(){
    string s;
    cin>>s;
    map<char,int> mp;
    rep(i,4){
        mp[s[i]]++;
    }
    bool ok=true;
    int c=0;
    for(auto &p: mp){
        c++;
        if(p.second!=2) ok=false;
    }
    if(c!=2) ok=false;
    cout<<(ok?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int main(void){
    int N, M, i;
  	long int G = 0;
    priority_queue<int> Q;

    cin >> N >> M;

    vector<int> A(N);
    
    for(i = 0; i < N; i++){
        cin >> A[i];
        Q.push(A[i]);
    }

    for(i = 0; i < M; i++){
        Q.push(Q.top()/2);
        Q.pop();
    }

    while(!Q.empty()){
        G += Q.top();
        Q.pop();
    }

    cout << G << endl;

    return 0;
}

Measured memory_bytes: 1276
n,a,b,c,d=map(int,input().split())
s=input()
def f(x,y):
  return "##" not in s[x:y-1]
if c<d:
  print("Yes" if f(a,c) and f(b,d) else "No")
else:
  if f(a,c)==False or f(b,d)==False:
    print("No")
  else:
    if "..." in s[b-2:d+1]:
      ans=True
    else:
      ans=False
    print("Yes" if ans==True else "No")

Measured memory_bytes: 3572
import sys
input = sys.stdin.readline


class RollingHash:
    def __init__(self, string):
        self.n = len(string)
        self.BASE = 1234
        self.MASK30 = (1 << 30) - 1
        self.MASK31 = (1 << 31) - 1
        self.MASK61 = (1 << 61) - 1
        self.MOD = self.MASK61
        self.hash = [0] * (self.n + 1)
        self.pow = [1] * (self.n + 1)

        for i, char in enumerate(string):
            self.hash[i + 1] = self.calc_mod(self.mul(self.hash[i], self.BASE) + ord(char))
            self.pow[i + 1] = self.calc_mod(self.mul(self.pow[i], self.BASE))

    def calc_mod(self, x):
        """x mod 2^61-1 を返す。"""
        xu = x >> 61
        xd = x & self.MASK61
        x = xu + xd
        if x >= self.MOD:
            x -= MASK61
        return x

    def mul(self, a, b):
        """a*b mod 2^61-1 を返す。"""
        au = a >> 31
        ad = a & self.MASK31
        bu = b >> 31
        bd = b & self.MASK31
        mid = ad * bu + au * bd
        midu = mid >> 30
        midd = mid & self.MASK30
        return self.calc_mod(au * bu * 2 + midu + (midd << 31) + ad * bd)

    def get_hash(self, l, r):
        """string[l:r]のハッシュ値を返す。O(1)"""
        res = self.calc_mod(self.hash[r] - self.mul(self.hash[l], self.pow[r - l]))
        return res


n = int(input())
s = [input()[:-1] for i in range(n)]


s.sort(key=len)
str_set = set()
cnt = 0

for string in s:
    string = string[::-1]
    n = len(string)
    rh = RollingHash(string)

    for r in range(1, n + 1):
        if rh.get_hash(0, r) in str_set:
            cnt += 1

    set_char = set()
    for r in range(1, n + 1)[::-1]:
        set_char.add(string[r - 1])
        for char in set_char:
            if char == string[r - 1]:
                continue
            h = rh.calc_mod(rh.mul(rh.hash[r - 1], rh.BASE) + ord(char))
            if h in str_set:
                cnt += 1
    str_set.add(rh.get_hash(0, n))

print(cnt)

Measured memory_bytes: 135008
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    int M;
    cin >> M;
    priority_queue<ll> A;
    for(int i = 0; i < N; i++){
        ll value;
        cin >> value;
        A.push(value);
    }
    for(int i = 0; i < M; i++){
        int tmp = A.top();
        A.pop();
        tmp /= 2;
        A.push(tmp);
    }
    ull sum = 0;
    while(true){
        sum += A.top();
        A.pop();
        if(A.empty())break;
    }
    cout << sum << endl;
}

Measured memory_bytes: 1400
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[100010];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    int f=0;
    for(int i=0; i<n;)
    {
        if(a[i]==a[i+1])
            i+=2;
        else
        {
            f+=1;
            i++;
        }
    }
    printf("%d\n",f);
    return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


ll N, X;
ll thick[100];
ll patty[100];

ll dfs(ll i, ll x){
    if(x <= 1) return 0;
    ll ret = 0; x--;
    if(x < thick[i - 1]) return ret + dfs(i - 1, x);
    ret += patty[i - 1]; x -= thick[i - 1];
    if(x <= 0) return ret;
    else if(x == 1) return ret + 1;
    ret++; x--;
    if(x < thick[i - 1]) return ret + dfs(i - 1, x);
    ret += patty[i - 1];
    x -= thick[i - 1];
    return ret;
}

void init(){
    thick[0] = patty[0] = 1;
    REP(i, N){
        thick[i + 1] = 2 * thick[i] + 3;
        patty[i + 1] = 2 * patty[i] + 1;
    }
}

signed main(){
    cin >> N >> X;
    init();
    PRINT(dfs(N, X));
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};

}  // namespace atcoder

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, q;

    cin >> n >> q;

    atcoder::dsu t(n);

    while (q--) {
        int op, u, v;
        cin >> op >> u >> v;
        if (op == 0) {
            t.merge(u, v);
        } else {
            cout << (int)t.same(u, v) << "\n";
        }
    }

    return 0;
}


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




int main()

{ 

	ios::sync_with_stdio(0);
	cin.tie(0);

	long long n, a, b;
	cin>> n>>a>>b;
	

	if ((a * n)<b)
	{
		cout<< a * n<<"\n";
	}
	else{
		cout<<b;
	}

}

Measured memory_bytes: 3664
#include<iostream>
#include<cmath>

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

        double a,b,x;
        std::cin >> a;
        std::cin >> b;
        std::cin >> x;

        auto x_ = x / a; // 断面積
        auto height = x_ / b * 2; // bに対する高さ

        // 水が少なめ
        if(height < a)
        {
                // std::cout << x_ << std::endl;
                // std::cout << height << std::endl;

                printf("%.10f\n", atan2f(b, height) * 180 / 3.14159265358979);
        }
        // 水が多め
        else
        {
                x_ = x_ - (a * b / 2); // 考慮する面積は半分
                height = x_ / a * 2;
                auto h_ = b - height;

                // std::cout << x_ << std::endl;
                // std::cout << h_ << std::endl;

                printf("%.10f\n", atan2f(h_, a) * 180 / 3.14159265358979);
        }

        return 0;
}


Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#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<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
//作者:中国江苏南京丁天行
using namespace std;
int a[5],ans;
int main(){
    for(int i=1;i<=3;++i)scanf("%d",a+i);
    sort(a+1,a+4);
    if(a[2]==a[3]){
        int k=a[2]-a[1];
        if(k&1)printf("%d\n",k/2+2);
        else printf("%d\n",k/2);
        return 0;
    }
    ans=a[3]-a[2]-1;
    a[1]+=ans,a[2]=a[3]-1;
    int k=a[3]-a[1];
    if(k&1)printf("%d\n",ans+k/2+1);
    else printf("%d\n",ans+k/2+2);
	//system("pause");
	return 0;
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
S = S[::-1]
N = len(S)

dp0 = [INF] * (N+1)
dp1 = [INF] * (N+1)
dp0[0] = 0
for i, s in enumerate(S):
    s = int(s)
    dp0[i+1] = min(dp0[i+1], dp0[i] + s)
    dp1[i+1] = min(dp1[i+1], dp0[i] + 10-s)
    dp0[i+1] = min(dp0[i+1], dp1[i] + (s+1))
    dp1[i+1] = min(dp1[i+1], dp1[i] + 10-(s+1))
ans = min(dp0[N], dp1[N]+1)
print(ans)


Measured memory_bytes: 74480
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
const int  inf=10000000;

int main(){
  int h,w;cin>>h>>w;
  P s,g;
  int cnt=0;
  char cor[h][w];
  rep(i,h){
    rep(j,w){
      cin>>cor[i][j];
      if(cor[i][j]=='#') cnt++;
    }
  }

  vector<int> dx,dy;
  dx={1,0,-1,0};
  dy={0,1,0,-1};
  queue<P> q;
  int dist[h][w];
  rep(i,h){
    rep(j,w){
      dist[i][j]=-1;
    }
  }
  q.push(P(0,0));
  dist[0][0]=0;
  while(!q.empty()){
    P now=q.front();q.pop();
    rep(i,4){
      int nx=now.first+dx[i];
      int ny=now.second+dy[i];
      if(0<=nx&&nx<h&&0<=ny&&ny<w&&cor[nx][ny]=='.'
         &&dist[nx][ny]==-1){
        q.push(P(nx,ny));
        dist[nx][ny]=dist[now.first][now.second]+1;
      }
    }
  }
  if(dist[h-1][w-1]!=-1){
  cout<<h*w-dist[h-1][w-1]-cnt-1<<endl;
  }
  else{
    cout<<-1<<endl;
  }
}
        
  
  

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

int main() {
    long N;
    cin>>N;
    long ansh, ansn, answ;
    for(long h=1;h<=3500;++h){
        for(long n=1;n<=3500;++n){
            if(4*h*n-N*n-N*h>0){
                if((N*h*n)%(4*h*n-N*n-N*h)==0){
                    ansh = h;
                    ansn = n;
                    answ = N*h*n/(4*h*n-N*n-N*h);
                    break;
                }
            }
        }
    }
    cout<<ansh<<" "<<ansn<<" "<<answ<<endl;
}


Measured memory_bytes: 256
import math
a, b, h, m = [int(i) for i in input().split(' ')]

a_theta = (h / 12.0) * 360 + (m / 60.0) * 30
a_x = a * math.sin((2*math.pi)*((a_theta)/360.0))
a_y = a * math.cos((2*math.pi)*((a_theta)/360.0))

b_theta = (m / 60.0) * 360
b_x = b * math.sin((2*math.pi)*((b_theta)/360.0))
b_y = b * math.cos((2*math.pi)*((b_theta)/360.0))

print(math.sqrt((a_x - b_x) ** 2 + (a_y - b_y) ** 2))

Measured memory_bytes: 9476
while True:
    a, op, b = input().split()
    a, b = int(a), int(b)

    if op == "?":
        break
    elif op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(int(a/b))



Measured memory_bytes: 5596
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
    private static final Scanner sc = new Scanner(System.in);
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args){
        final int n = Integer.parseInt(sc.next());
        final int m = Integer.parseInt(sc.next());
        final int l = Integer.parseInt(sc.next());
        final int a[][] = new int[n][m];
        final int b[][] = new int[m][l];
        for(int i = 0; i<n; i++){
            for(int j = 0; j<m; j++){
                a[i][j] = Integer.parseInt(sc.next());
            }
        }
        for(int i = 0; i<m; i++){
            for(int j = 0; j<l; j++){
                b[i][j] = Integer.parseInt(sc.next());
            }
        }
        for(int i = 0; i<n; i++){
            for(int j = 0; j<l; j++){
                long ans = 0;
                for(int k = 0; k<m; k++){
                    ans += a[i][k]*b[k][j];
                }
                if(j!=0) out.print(' ');
                out.print(ans);
            }
            out.println();
        }
        out.flush();
    }
}

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

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

    while(true){
        int h, w;
        std::cin >> h >> w;
        if(h==0 && w==0) break;
        for(int i=0; i<h; ++i){
            for(int j=0; j<w; ++j){
                std::cout << "#";
            }
            std::cout << "\n";
        }
        std::cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 1176
#!/usr/bin/ruby

class Node

  attr_reader :num, :raw, :painted
  def initialize(num)
    @num = num
    @raw = {}
    @painted = []
  end

  @@list = Hash.new { |h,k| h[k] = self.new(k) }
  def self.list
    @@list
  end
  def self.get(num)
    @@list[num]
  end
end

class Line
  attr_reader :index, :node
  attr_accessor :color
  def initialize(i, a, b)
    @index = i
    @node = { a => Node.get(a), b => Node.get(b) }
    @node[a].raw[i] = self
    @node[b].raw[i] = self
    @color = nil
  end
end

n = ARGF.gets.to_i
lines = (n-1).times.map do |i|
  a, b = ARGF.gets.split.map(&:to_i)
  Line.new(i, a, b)
end

puts Node.list.map {|k,n| n.raw.length }.max

while node = Node.list.first
  queue = [node[1]]
  while node = queue.shift

    Node.list.delete(node.num)

    palette = (0...(node.raw.length + node.painted.length)).to_a
    node.painted.each { |line| palette[line.color] = nil }
    palette.compact!

    while lineindex = node.raw.shift
      index, line = lineindex

      line.color = palette.shift
      node.painted.push(node.raw.delete(index))
      line.node.delete(node.num)
      num, peer = line.node.shift
      peer.painted.push(peer.raw.delete(index))
      queue.push(peer) if peer.raw.length > 0
    end
  end
end

lines.each { |line| puts line.color + 1 }


Measured memory_bytes: 98940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll k, a, b;
    cin >> k >> a >> b;
    ll i = 0, cnt = k + 1;
    while (i * 2 <= k){
        ll tmp = k - 2 * i;
        if (tmp + 1 >= a){
            cnt = max(cnt, tmp + 1 + i * (b - a));
        }
        i ++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		double x=0;
		String u="";
		int z=0;
		double y=0;
		while(z<N){
			x=stdIn.nextDouble();
			u=stdIn.next();
			if(u.equals("BTC"))
				y+=x*380000;
			else
				y+=x;
			z++;
		}
		System.out.println(y);
	}

}

Measured memory_bytes: 24788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
ll arr[100*1000+5];
ll dp[100*1000+5];

ll solve(ll arr[], ll i){
	if (i >= N-1) return 0;
	
	if(dp[i] != -1) return dp[i];
	
	if (i+2<N)
		dp[i] = min(solve(arr, i+1) + abs(arr[i+1]-arr[i]), solve(arr, i+2) + abs(arr[i+2]-arr[i]));
	else if (i+1<N)
		dp[i] = solve(arr, i+1) + abs(arr[i+1]-arr[i]);
	else
		dp[i] = 1e6;
	
	return dp[i];
}

int main(){
	cin>>N;
	for(int i = 0;i<N;i++)cin>>arr[i];
	memset(dp, -1, sizeof dp);
	cout<<solve(arr, 0)<<endl;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n;
    cin >> n;
    vector<pair<string, Int>> v(n);
    for (Int i = 0; i < (Int)v.size(); i++) {
        cin >> v[i].fi >> v[i].se;
    }
    string s;
    cin >> s;
    Int res = 0;
    bool check = false;
    for (Int i = 0; i < n; i++) {
        if (check) {
            res += v[i].se;
        }
        if (v[i].fi == s) {
            check = true;
        }
    }
    dump(res);
    return 0;
}


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

using namespace std;

int main(){
    string s;
    cin>>s;
    int l=299999,r=-1;
    
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='A'){
            l=i;
            break;
        }
    }
    
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='Z') r=i;
    }
    
    cout<<r-l+1<<endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int a, b;
  cin >> a >> b;
  if(a%2 != 0 && b %2 != 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int sumL[100010];
int sumR[100010];

int ansL[2][100010];
int ansR[2][100010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, C;
    cin >> N >> C;
    int x[100010], v[100010];
    rep(i, N) cin >> x[i] >> v[i];
    rep(i, N) {
        sumL[i + 1] = sumL[i] + v[i];
    }
    rep(i, N) {
        sumR[i + 1] = sumR[i] + v[N - i - 1];
    }
    rep(i, N) {
        ansL[0][i + 1] = max(ansL[0][i], sumL[i + 1] - x[i]);
        ansL[1][i + 1] = max(ansL[1][i], sumL[i + 1] - x[i] * 2);
    }
    rep(i, N) {
        ansR[0][i + 1] = max(ansR[0][i], sumR[i + 1] - (C - x[N - i - 1]));
        ansR[1][i + 1] = max(ansR[1][i], sumR[i + 1] - 2*(C - x[N - i - 1]));
    }
    int ans = 0;
    rep(i, N + 1) {
        ans = max(ans, ansL[0][i] + ansR[1][N - i]);
        ans = max(ans, ansL[1][i] + ansR[0][N - i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9900
#include <bits/stdc++.h>
#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;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i, j, k, l, n, m;
    cin >> n;
    vector<pair<ll, ll>> data1, data2;
    vector<ll> temp1, temp2, temp3, temp4;
    for (i = 1;i<=n;i++){
        cin >> k >> l;
        data1.pb({k, l});
        temp1.pb(k + l);
        temp2.pb(k - l);
        temp3.pb(-k + l);
        temp4.pb(-k - l);
    }
    sort(temp1.begin(), temp1.end());
    sort(temp2.begin(), temp2.end());
    sort(temp3.begin(), temp3.end());
    sort(temp4.begin(), temp4.end());
    ll ans = max(max(temp1[n - 1] - temp1[0], temp2[n - 1] - temp2[0]), max(temp3[n - 1] - temp3[0], temp4[n - 1] - temp4[0]));
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 16912
import java.io.BufferedReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max

fun main() = abc100d()

@OptIn(ExperimentalStdlibApi::class)
fun abc100d() = SimpleFastIOWithToken_abc100d().exec {
    data class Cake(val x: Long, val y: Long, val z: Long)

    val (n, m) = readInt() to readInt()
    val cakes = List(n) { Cake(readLong(), readLong(), readLong()) }

    val posNeg = listOf(1, -1)
    var answer = 0L

    for (xpn in posNeg) for (ypn in posNeg) for (zpn in posNeg) {
        val sorted = cakes.sortedWith(kotlin.Comparator { o1, o2 ->
            (o1.x * xpn + o1.y * ypn + o1.z * zpn).compareTo(o2.x * xpn + o2.y * ypn + o2.z * zpn)
        })
        val fold = sorted.take(m).fold(Cake(0, 0, 0)) { acc, cake ->
            Cake(acc.x + cake.x, acc.y + cake.y, acc.z + cake.z)
        }
        val point = abs(fold.x) + abs(fold.y) + abs(fold.z)
        answer = max(answer, point)
    }

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_abc100d(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_abc100d.() -> Unit) {
        var t: Throwable? = null
        Thread(null, { action() }, "solve", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, t1 -> t = t1 } }
            .apply { start() }.join()
        t?.let { throw it }
        kotlin.io.print(sb)
    }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 39688
#include<iostream>
#include<queue>
using namespace std;
class Dice
{
public:
	enum face{ top, front, right, left, rear, bottom };
public:
	int *label;
public:
	Dice()
	{
		label = new int[6];
		for (int i = 0; i < 6; i++)
			label[i] = 0;
	}
	Dice(int set[])
	{
		label = new int[6];
		for (int i = 0; i < 6; i++)
			label[i] = set[i];
	}
	~Dice()
	{
		delete[] label;
	}
	void rollNorth()
	{
		int tmp =label[top];
		label[top] = label[front];
		label[front] =label[bottom];
		label[bottom] =label[rear];
		label[rear] = tmp;
	}
	void rollSouth()
	{	
		int tmp = label[top];
		label[top] = label[rear];
		label[rear] =label[bottom];
		label[bottom] = label[front];
		label[front] = tmp;
	}
	void rollEast()
	{
		int tmp = label[top];
		label[top] = label[left];
		label[left] = label[bottom];
		label[bottom] = label[right];
		label[right] = tmp;
	}
	void rollWest()
	{
		int tmp = label[top];
		label[top] = label[right];
		label[right] = label[bottom];
		label[bottom] = label[left];
		label[left] = tmp;
	}
	void clockwiseRotation()
	{
		int tmp = label[right];
		label[right] = label[rear];
		label[rear] = label[left];
		label[left] = label[front];
		label[front] = tmp;
	}
	void anticlockwiseRotation()
	{
		int tmp = label[right];
		label[right] = label[front];
		label[front] = label[left];
		label[left] = label[rear];
		label[rear] = tmp;
	}
	int *getLabel()
	{
		return label;
	}
	int getTop()
	{
		return label[top];
	}
	int getFront()
	{
		return label[front];
	}
	int getRight()
	{
		return label[right];
	}
	int getLeft()
	{
		return label[left];
	}
	int getRear()
	{
		return label[rear];
	}
	int getBottom()
	{
		return label[bottom];
	}
};
int main()
{
	int set[6];
	for (int i = 0; i < 6; i++)
		cin >> set[i];
	Dice D(set);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int top, front;
		cin >> top >> front;
		if (D.getLeft() == top)
			D.rollEast();
		if (D.getRight() == top)
			D.rollWest();
		while (D.getTop() != top)
			D.rollNorth();
		while (D.getFront() != front)
			D.clockwiseRotation();
		cout << D.getRight() << endl;
	}
}


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

using namespace std;

int n;

bool check(string str){
    for(int i = 0;i < str.length()/2;i++){
        if(str[i] != str[str.length()-i-1]){
            return false;
        }
    }
    return true;
}

void solve(){
    int i,j;
    string str;
    cin >> str;
    if(check(str) && check(str.substr(0,(str.length()-1)/2)) && check(str.substr((str.length()+1)/2))){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

int main(){
    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;

int f(int b, int n) {
  if(n < b) return n;

  return f(b, n / b)  + n % b;
}

signed main() {
  int n, s; cin >> n >> s;
  if(n == s) {
    cout << n + 1 << endl;
    return 0;
  }
  if(s < n) {
    int b;
    for(b = 2; b * b <= n; b++) {
      if(f(b, n) == s) {
        cout << b << endl;
        return 0;
      }
    }
    for(int i = b; i >= 1; --i) {
      b = (n-s) / i+1;
      if(b >= 2 && f(b, n) == s) {
        cout << b << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    int n = s.size();
    bool ans = true;
    rep(i, n) {
        if (i == a) {
            if (s[i] != '-') ans = false;
        } else {
            if (!('0' <= s[i] && s[i] <= '9')) ans = false;
        }
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
# include<stdio.h>
long long GCD(int a,int b)
{
int temp;
while(b!=0)
{
temp=a%b;
a=b;
b=temp; 
}
return a;
}
int main()
{
int a,b,gcd,lcm;
while(scanf("%d%d",&a,&b)==2)
{
gcd=GCD(a,b);
lcm=(a/gcd)*(b/gcd)*gcd;
printf("%d %d\n",gcd,lcm);
}
return 0;
}

Measured memory_bytes: 596
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

long[] perm_prod(const long[] A, const long[] P) {
    auto ret = A.dup;
    foreach (i; 0..A.length) {
        ret[i] = A[P[i].to!int];
    }
    return ret;
}

long[] perm_pow(const long[] A, long x) {
    long[] P = A.dup;
    long[] ret = new long[](P.length);
    foreach (i; 0..P.length) ret[i] = i;
    while (x) {
        if (x % 2) ret = perm_prod(ret, P);
        P = perm_prod(P, P);
        x /= 2;
    }
    return ret;
}

void main() {
    auto N = readln.chomp.to!int;
    auto X = readln.split.map!(to!long).array;
    auto s = readln.split.map!(to!long);
    auto M = s[0].to!int;
    auto K = s[1];
    auto A = readln.split.map!(x => x.to!int - 1).array;

    auto D = new long[](N - 1);
    foreach (i; 0..N-1) D[i] = X[i + 1] - X[i];

    auto B = new long[](N - 1);
    foreach (i; 0..N-1) B[i] = i;
    foreach (i; 0..M) swap(B[A[i] - 1], B[A[i]]);

    B = perm_pow(B, K);
    D = perm_prod(D, B);

    auto ans = new long[](N);
    ans[0] = X[0];
    foreach (i; 0..N-1) ans[i + 1] = ans[i] + D[i];

    ans.each!writeln;
}


Measured memory_bytes: 23092
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main()
{
    int n;

    scanf("%d",&n);

    int a[n],i;
    double x;

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

    sort(a,a+n);
    x=a[0];
    for(i=1; i<n; i++)
    {
        x=(x+a[i]*1.0)/2.0;
    }
    printf("%lf\n",x);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 2000000000;
int main(){
  long long N;
  cin >> N;
  string S;
  while (N != 0){
    S += ((N + INF) % 2) + '0';
    N -= (N + INF) % 2;
    N /= -2;
  }
  reverse(S.begin(), S.end());
  if (S == ""){
    cout << "0";
  } else {
    cout << S;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	for (int i = 1; i < 4; i++) {
		if ((a*b*i) % 2 == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
  int A, B, a, b, d, e, x;
  cin >> A >> B;
  
  for (int i = A; i <= B; i++) {
    a = i % 10;
    b = i / 10 % 10;
    d = i / 1000 % 10;
    e = i / 10000;
    if (a == e && b == d) {
      x++;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256