akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
  int n;
  while(cin >> n) {
    if(n == -1) break;
    int mod = 4*4*4*4*4*4*4*4*4;
    bool r = false;
    for(int i=0;i<10;i++) {
      if( n/mod != 0 || i==9) {
        r = true;
      }
      if(r) {
        cout << n/mod;
      }
      n -= (n/mod) * mod;
      mod/=4;
    }
    cout << endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(){
   int a,b;
   cin >> a >> b;
   string s="";
   if(a>=b){
      for(int i=0;i<a;i++) s+=(char)b + '0';
   }else{
      for(int i=0;i<b;i++) s+=(char)a + '0';
   }
   cout <<s<<endl;
   return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns               #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiWayIf                 #-}
{-# LANGUAGE RankNTypes                 #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE UndecidableInstances       #-}
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State
import           Control.Monad.Trans.State
import           Data.Bits
import qualified Data.ByteString.Char8        as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import           Data.Proxy
import           Data.Sequence                (Seq ((:<|), (:|>)), ViewL ((:<)),
                                               ViewR ((:>)), viewl, viewr, (<|),
                                               (><), (|>))
import qualified Data.Sequence                as Seq
import qualified Data.Set                     as S
import           Data.STRef
import qualified Data.Vector                  as V
import qualified Data.Vector.Mutable          as VM
import qualified Data.Vector.Unboxing         as VU
import qualified Data.Vector.Unboxing.Mutable as VUM
import           Numeric

main :: IO ()
main = do
  s <- getLine

  putStrLn $ if last s == 's' then s <> "es" else s <> "s"


-- converter
unconsChar :: StateT BS.ByteString Maybe Char
unconsChar = StateT BS.uncons

unconsInt :: StateT BS.ByteString Maybe Int
unconsInt = StateT $ BS.readInt . BS.dropWhile isSpace

unconsInteger :: StateT BS.ByteString Maybe Integer
unconsInteger = StateT $ BS.readInteger . BS.dropWhile isSpace

-- 1D Data
-- for list
readLnAsListWith :: StateT BS.ByteString Maybe a -> IO [a]
readLnAsListWith !st = unfoldr (runStateT st) <$> BS.getLine

-- for boxed vector
readLnAsVecWith :: StateT BS.ByteString Maybe a -> Int -> IO (V.Vector a)
readLnAsVecWith !st !n = V.unfoldrN n (runStateT st) <$> BS.getLine

-- for unboxed vector
readLnAsUVecWith :: VU.Unboxable a => StateT BS.ByteString Maybe a -> Int -> IO (VU.Vector a)
readLnAsUVecWith !st !n = VU.unfoldrN n (runStateT st) <$> BS.getLine

-- example: 1D tuple vector
readLnAsUVecWith2Tuple :: VU.Unboxable a => StateT BS.ByteString Maybe a -> Int -> IO (VU.Vector (a,a))
readLnAsUVecWith2Tuple !st !n = VU.replicateM n $ (\vec -> (vec VU.! 0, vec VU.! 1)) <$> readLnAsUVecWith st 2


-- 2D Data
-- n: number of lines
-- m: number of values per a line

-- for boxed vector
readLnAs2DVecWith :: StateT BS.ByteString Maybe a -> Int -> Int -> IO (V.Vector a)
readLnAs2DVecWith !st !n !m = V.unfoldrN (n * m) (runStateT st) . BS.concat <$> replicateM n BS.getLine

readLnAs2DUVecWith :: VU.Unboxable a => StateT BS.ByteString Maybe a -> Int -> Int -> IO (VU.Vector a)
readLnAs2DUVecWith !st !n !m = VU.unfoldrN (n * m) (runStateT st) . BS.concat <$> replicateM n BS.getLine


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
const long long MX =1e18;
int main()
{
    long long int n,ml=1;
    cin>>n;
    vector<long long int>v(n);
    bool zero = false;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]==0)
            zero = true;
    }
    if(zero)
    {
        cout<<"0"<<endl;
        return 0;
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            if(v[i]>MX/ml)
            {
                cout<<"-1"<<endl;
                return 0;
            }
            ml*=v[i];
        }
        cout<<ml<<endl;
    }
    return 0;
}

Measured memory_bytes: 3976
n, m = map(int,input().split())

ans = [-1 for i in range(n)]

pf = True
for i in range(m):
    s,c = map(int,input().split())
    if ((not ans[s-1] == -1) and (not ans[s-1] == c)) or ((not n == 1)and s == 1 and c == 0):
        print(-1)
        pf = False
        break
    else:
        ans[s-1] = c

if pf and n == 1:
    if ans[0] == -1:
        print(0)
    else:
        print(ans[0])
elif pf:
    if ans[0] == -1:
        ans[0] = 1
    for i in range(n):
        if ans[i] == -1:
            ans[i] = 0
    print(''.join(map(str,ans)))


Measured memory_bytes: 3064
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int n;
vector<int> ans, b;

int main() {
    cin >> n;
    b.resize(n);
    REP(i,n){
        cin >> b[i];
    }
    bool ok = true;
    ans.push_back(0);
    for(int i=0;i<n;i++){
        if(ans.size() < b[i]) {
            ok = false;
            break;
        }
        else{
            ans.insert(ans.begin()+b[i],b[i]);
        }
    }
    if(ok){
        ans.erase(ans.begin());
        for(auto i: ans){
            cout << i << endl;
        }
    }
    else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
sx, sy, ex, ey = [int(v) for v in input().split()]


def move(x):
    print(x, end='')


def forward(x1, y1, x2, y2):
    for _ in range(y1, y2):
        move('U')
    for _ in range(x1, x2):
        move('R')


def backword(x1, y1, x2, y2):
    for _ in range(y1, y2):
        move('D')
    for _ in range(x1, x2):
        move('L')


forward(sx, sy, ex, ey)
backword(sx, sy, ex, ey)
move('L')
forward(sx - 1, sy, ex, ey + 1)
move('D')
move('R')
backword(sx, sy - 1, ex + 1, ey)
print('U')


Measured memory_bytes: 4468
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999


int main() {
	int a[10];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7)cout << "YES" << endl;
	else cout << "NO" << endl;


	return 0;
}


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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))


void solve(){
    ll n,t;cin>>n>>t;
    ll a[n];rep(i,0,n)cin>>a[i];
    ll ans=0;
    rep(i,0,n-1){
        if(a[i+1]-a[i]<t)ans+=a[i+1]-a[i];
        else ans+=t;
    }
    cout<<ans+t;

}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 1792
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte in nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  ;; (return-from read-fixnum 0)
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (the fixnum (* result 10))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (as (make-array n :element-type 'uint32))
         (cumul (make-array (+ 1 n) :element-type 'uint32 :initial-element 0))
         (cumul2 (make-array (+ 1 n) :element-type 'uint32 :initial-element 0)))
    (dotimes (i n)
      (setf (aref as i) (read-fixnum)))
    (dotimes (i n)
      (setf (aref cumul (+ i 1))
            (gcd (aref cumul i) (aref as i))))
    (loop for i from n above 0
          do (setf (aref cumul2 (- i 1))
                   (gcd (aref cumul2 i) (aref as (- i 1)))))
    (println
     (loop for i from 0 below n
           maximize (gcd (aref cumul i) (aref cumul2 (+ i 1)))))))

#-swank(main)


Measured memory_bytes: 25188
#include <iostream>

using namespace std;

int v[100002];
int N,M;

int main(){
    cin >> N >> M;
    int n,m;
    for(int i=0;i<100002;i++) v[i] = 0;
    for(int i=0;i<M;i++){
        cin >> n >> m;
        v[n]++;
        v[m+1]--;
    }
    int c = 0;
    for(int i=1;i<100002;i++) v[i] += v[i-1];
    for(int i=0;i<100002;i++){
        if(v[i] == M) c++;
    }
    cout << c << endl;
    return 0;
}

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

int a[100001];
int q[100001];
int sum,nim=1e9+9;
int main()
{
    int n,k,q,x; cin>>n>>k>>q;
    for(int i=0;i<q;i++)
    {
        int x; cin>>x;
        k--;
        a[x]++;
    }
    for(int i=1;i<=n;i++) {

        if(a[i]+k<=0) cout<<"No\n";
    else cout<<"Yes\n";
    }





}


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

void solve() {
  int n,x; cin >> n;
  int lmax = 0, ans = 0;
  for(int i = 0; i < n; ++i) {
    cin >> x;
    ans += (x>=lmax) ? 1 : 0;
    lmax = max(lmax,x);
  }
  cout << ans;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,m,i,j,b;
  cin>>n>>m;
  vector<ll> k(m),p(m),a(n);
  ll sw[m+1][n+1],d[m+1][n+1];;
  for(i=0;i<m;i++){
    for(j=0;j<n;j++){
		sw[i][j]=0;
      	d[i][j]=0;
    }
  }
  for(i=0;i<m;i++){
    cin>>k[i];
    for(j=0;j<k[i];j++){
    	cin>>b;
        sw[i][b-1]=1;  
    }
  }
  for(i=0;i<m;i++){
    cin>>p[i];
  }
  
  
  
  ll t,tmp=0,cnt=0,flag=0;
  for(t=0;t<pow(2,n);t++){
  stringstream ss;
  ss << bitset<11>(t);
  string s = ss.str();
    flag=0;
    for(i=0;i<m;i++){
      tmp=0;
      for(j=0;j<n;j++){
        tmp+=(s[j+11-n])*sw[i][j];
      }
      if((tmp-p[i])%2!=0){
        flag=1;
      }
    }
      if(flag==0){
        cnt++;
      }
  }
 cout<<cnt<<endl;
}
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define vec_rep(itr,v) for(auto itr = v.begin(); itr != v.end(); ++itr)

int main(void){
    double N;
    cin >> N;
    cout << setprecision(10) << pow((N/3),3) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int larger(int a,int b){
    if(a > b) return a;
    else return b;
}


int main(void){
    int i,N;
    scanf("%d",&N);
    int x[N],y[N],h[N];
    
    for(i=0;i<N;i++){
        scanf("%d%d%d",&x[i],&y[i],&h[i]);    
    }
    
    int hmax = 0;
    for(i=0;i<N;i++){
        if(h[i] >= hmax) hmax = h[i];
    }
    
    int Cx,Cy,H,h1,h2,flag;
    for(H=hmax;H<hmax+1010;H++){ 
        for(Cx=0;Cx<101;Cx++){
            for(Cy=0;Cy<101;Cy++){
                for(i=0;i<N;i++){
                    flag = 1;
                    h1 = larger(H - abs(Cx - x[i]) - abs(Cy - y[i]),0);
                    h2 = h[i];
                    //printf("%d %d %d %d %d\n",H,Cx,Cy,h1,h2);
                    if(h1 != h2){
                        flag = 0;
                        break;
                    }
                    //printf("%d\n",flag);
                    if(i == N - 1 && flag == 1){
                    printf("%d %d %d",Cx,Cy,H);
                    return 0;
                    }   
                }
            }
        }
    }
}

Measured memory_bytes: 128
import Data.List (zipWith3)

main = do
  getLine
  li <- getLine
  let ps = map read $ words li
  let answer = compute ps
  print answer

compute :: [Int] -> Int
compute ps = length $ filter id $ zipWith3 prop ps (tail ps) (drop 2 ps)

prop a b c = a < b && b < c || a > b && b > c


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int x;
	cin >> x;
    cout << 1 - x << endl;
	return 0;
}


Measured memory_bytes: 3648
def resolve():
    H, W = map(int, input().split())
    S = []
    for _ in range(H):
        s = input()
        S.append(s)
    for i in range(H):
        ans = ""
        for j in range(W):
            count = 0
            if S[i][j] == "#":
                ans += "#"
            else:
                if i >= 1 and j >= 1:
                    if S[i-1][j-1] == "#":
                        count += 1
                if i >= 1:
                    if S[i-1][j] == "#":
                        count += 1
                if i >= 1 and j <= W-2:
                    if S[i-1][j+1] == "#":
                        count += 1
                if j >= 1:
                    if S[i][j-1] == "#":
                        count += 1
                if j <= W-2:
                    if S[i][j+1] == "#":
                        count += 1
                if j >= 1 and i <= H-2:
                    if S[i+1][j-1] == "#":
                        count += 1
                if i <= H-2:
                    if S[i+1][j] == "#":
                        count += 1
                if i <= H-2 and j <= W-2:
                    if S[i+1][j+1] == "#":
                        count += 1
                ans += str(count)
        print(ans)
resolve()

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<endl
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define PI 3.14159265358979323846264338327
#define INF 2e14
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	setp(6);
	
	int n; cin>>n;
	double arr[n];
	
	forn(i,0,n){
		cin>>arr[i];
	}
	
	sort(arr,arr+n);
	
	double ans=(arr[0]+arr[1])/2.0;
	forn(i,2,n){
		ans=(ans+arr[i])/2.0;
	}
	
	cout<<ans<<'\n';
	
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  ll n=s.size(),ans,judge=0;
  for (ll i=2;i<n;i+=2) {
    for (ll j=0;j<=(n-i)/2-1;j++) {
      if (s.at(j)!=s.at(j+(n-i)/2)) {
        break;
      }
      else {
        if (j==(n-i)/2-1) {
          ans=n-i;
          judge=1;
          break;
        }
      }
    }
    if (judge==1) break;
  }
  
  cout << ans;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

struct UnionFind {
  vll d;
  UnionFind(ll n=0): d(n,-1) {}
  ll find(ll x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(ll x, ll y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(ll x, ll y) { return find(x) == find(y);}
  ll size(ll x) { return -d[find(x)];}
};


const ll MAX_H=400;
const ll MAX_W=400;
bool visited[MAX_H][MAX_W];
vector<string> s(MAX_H);
ll h,w;
void dfs(ll y, ll x, ll root, UnionFind& uf, char pre){
  if(visited[y][x])
    return;

  char now=s[y][x];
  if(pre==now)
    return;

  visited[y][x]=true;

  ll num=y*w+x;
  uf.unite(root,num);
  REP(i,4){
    if(x+dx[i]<0 || w<=x+dx[i] || y+dy[i]<0 || h<=y+dy[i])
      continue;
    if(s[y+dy[i]][x+dx[i]]!=now)
      dfs(y+dy[i],x+dx[i],root,uf,now);
  }
}


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

  cin>>h>>w;
  REP(i,h)cin>>s[i];

  REP(i,h)REP(j,w)visited[i][j]=false;


  UnionFind uf(h*w);
  REP(i,h){
    REP(j,w){
      ll num=i*w+j;
      char pre='a';
      dfs(i,j,num,uf,pre);
    }
  }

  ll ans=0;
  vpl p(h*w);
  REP(i,h){
    REP(j,w){
      ll num=w*i+j;
      ll par=uf.find(num);
      if(s[i][j]=='#')
        p[par].FI++;
      else
        p[par].SE++;
    }
  }

  REP(i,h*w)ans+=p[i].FI*p[i].SE;

  cout<<ans<<endl;

}



Measured memory_bytes: 24320
#include <bits/stdc++.h>
#define int long long
const int INF=1e18;
using namespace std;
int32_t main(){
	int n;cin>>n;
	
	vector<int> arrmv(n);
	for(int i=0;i<n;i++)
		cin>>arrmv[i];
	vector<int> lfsum(n+1,0);
	for(int i=0;i<n;i++){
		lfsum[i+1]=lfsum[i]+arrmv[i];
	}
	reverse(arrmv.begin(),arrmv.end());
	vector<int> rgsum(n+1,0);
	for(int i=0;i<n;i++){
		rgsum[i+1]=rgsum[i]+arrmv[i];
		
	}
	reverse(arrmv.begin(),arrmv.end());
	reverse(rgsum.begin(),rgsum.end());
	int dif=INF;
	for(int i=1;i<n;i++){
	dif=min(dif,llabs(lfsum[i]-rgsum[i]));}
	cout<<dif<<endl;
	return 0;
}

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

using namespace std;

int main ()
{
 	int rn, bn;
  	string red, blue, minus;
  cin >> red >> blue;
  cin >> rn >> bn;
  cin >> minus;
  
  if( red == minus )
    rn -= 1;
  else 
    bn -= 1;
  cout << rn << " " << bn << endl;
  
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);

  int maxL = 0;
  int minR = 100000;
  for(int i = 0; i < M; i++) {
    int L, R;
    scanf("%d %d", &L, &R);
    if(maxL < L) maxL = L;
    if(minR > R) minR = R;
  }

  int X;
  if(minR < maxL) {
    X = 0;
  } else if(N < maxL) {
    X = 0;
  } else if(N < minR) {
    X = N - maxL + 1;
  } else {
    X = minR - maxL + 1;
  }
  printf("%d\n", X);
  return 0;
}


Measured memory_bytes: 128
N=int(input())
L = []
for i in range(1,N+1):
    S,P = input().split()
    if P == "0":
        L.append([i,S+"9999999999"])
    elif 100-int(P) < 10:
        L.append([i,S+"0"+str(100-int(P))])
    else:
        L.append([i,S+str(100-int(P))])

L.sort(key=lambda x:x[1])
for i in range(N):
    print(L[i][0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size()
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define forn(i, n) for (int i = 1; i <= n; i++)
#define ford(i, n) for (int i = n; i >= 0; i--)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define foreach(itr, c) for (__typeof((c).begin(), (c).end()) itr = c.begin(); itr != c.end(); itr++)
#define fill(a, b) memset(a, b, sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<char> vs;
typedef vector<pi> vpi;

using namespace std;

int main()
{
    int d, s, t;
    ll ans = 0;

    cin >> d >> s >> t;

    ans = s * t;

    if (ans >= d)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 3656
import collections
S=input()[::-1]
l=len(S)
T,d=0,1
A=[0]*2019
A[0]=1
for i in range(l):
    T+=int(S[i])*d
    d*=10
    T%=2019
    d%=2019
    A[T]+=1
ans=0
for cnt in A:
    ans+=cnt*(cnt-1)//2
print(ans)
















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

int main()
{
	string s;
	getline(cin,s);

	rep(i,s.size())
	{
		if('a' <= s[i] && s[i] <= 'z')
		{
			s[i] -= 32;
		}
		else if('A' <= s[i] && s[i] <= 'Z')
		{
			s[i] += 32;
		}
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (1e+9) +7;

void affect(ll num, vector<ll> &cnt){
    int p = 0;
    while(num != 0){
        cnt[p++] += num%2;
        num /= 2;
    }
}
int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> cnt(60);
    for(int i=0;i<n;i++){
        cin >> a[i];
        affect(a[i], cnt);
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        vector<ll> tv(60);
        for(int p = 0;p < 60; p++){
            int b = a[i]%2;
            a[i]/=2;
            cnt[p] -= b;
            ans = (ans + ((ll)pow(2,p)%MOD) * (b?(n-i-1)-cnt[p]:cnt[p]))%MOD;
        }
    }
    cout << (ans%MOD) << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,z,w;
    cin>>n>>z>>w;
    Vec a(n);
    rep(i,n){
        cin>>a[i];
    }

    if(n==1){
        cout<<abs(a[0]-w)<<endl;
        return 0;
    }
    ll ans= max(abs(a[n-1]-w),abs(a[n-1]-a[n-2]));
    cout<<ans<<endl;
    return  0;
}


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


int main()
{
    string S, T;
    cin >> S;
    cin >> T;

    
    int beginSubstring = -1;
    // size() は size_t 型であることに注意！
    // - 符号が入ると変な数になってしまう
    for( int i = 0; i <= (int)(S.size()-T.size()); ++i ){
        bool isMatch = true;
        for( int j = 0; j < T.size(); ++j ){
            if( S[i+j] != T[j] && S[i+j] != '?' ){
                isMatch = false;
                break;
            }
        }
        if( isMatch ) beginSubstring = i;
    }

    if( beginSubstring < 0 ) cout << "UNRESTORABLE" << endl;
    else{
        string ans;
        for( int i = 0; i < S.size(); ++i ){
            if( i == beginSubstring ){
                ans += T;
                i += T.size() - 1;
            }else if( S[i] == '?' ) ans += 'a';
            else ans += S[i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def check(n):
  if n%2==0:
    return True
  else:
    return False
n=int(input())
a=list(map(int, input().split()))
a_count = [0 for i in range(n)]
for i in range(n):
  while check(a[i]):
    a_count[i] += 1
    a[i] /= 2
a_count.sort()
print(a_count[0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int main(){
	ll n, a[100010], b[100010];
	cin >> n;
	REP(i,0,n) cin >> a[i];
	REP(i,0,n) cin >> b[i];
	
	ll c = 0, d = 0;
	REP(i,0,n){
		if(a[i] > b[i]) continue;
		c += (b[i] - a[i]) / 2 + (b[i] - a[i]) % 2;
		a[i] = b[i] + (b[i] - a[i]) % 2;
	}
	
	REP(i,0,n){
		if(b[i] > a[i]) continue;
		d += (a[i] - b[i]);
		b[i] = a[i];
	}
	
	REP(i,0,n) if(b[i] < a[i]) c -= a[i] - b[i], d += a[i] - b[i];
	if(c - d >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

void solve(long long N, std::vector<long double> p) {
    vector<long double> dp(N + 1);
    dp[1] = p[0];
    dp[0] = 1 - p[0];
    for (int i = 1; i < N; i++) {
        for (int j = N; j >= 0; j--) {
            dp[j] = dp[j] * (1 - p[i]);
            if (j > 0) dp[j] += dp[j - 1] * p[i];
        }
    }
    long double ans = 0;
    for (int i = (N + 1) / 2; i <= N; i++) ans += dp[i];
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long N;
    scanf("%lld", &N);
    std::vector<long double> p(N);
    for (int i = 0; i < N; i++) {
        scanf("%Lf", &p[i]);
    }
    solve(N, std::move(p));
    return 0;
}


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

using namespace std;
#define endl '\n'
#define what_is(x) cout << #x << " is " << x << endl;
#define ll long long
#define int long long
#define ld long double
#define pii pair<int,int>
#define rand() abs((rand()<<15)|rand())
#define randll() abs(((long long)rand()<<30)|rand())
const int INF = 1000000001;
const int MOD = 1000000007;

int n;

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long seed;
  asm("rdtsc" : "=A"(seed));
  srand(seed);

  cin >> n;
  vector<int> a;
  for(int i = 2; i <= 30000; i+=2)
  	a.push_back(i);
  for(int i = 3; i <= 30000; i+=3)
  	if(i%2)
	  	a.push_back(i);

	while(1) {
		random_shuffle(a.begin(), a.end());
		int gcd = a[0];
		int sum = a[0];
		for(int i = 1; i < n; i++) {
			gcd = __gcd(gcd, a[i]);
			sum += a[i];
		}
		if(gcd != 1) continue;
		bool toContinue = 0;
		for(int i = 0; i < n; i++) {
			sum -= a[i];
			if(__gcd(sum,a[i]) == 1) {
				toContinue = 1;
				break;
			}
			sum += a[i];
		}
		if(toContinue) continue;
		break;
	}
	for(int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int INF = 1e9 + 7;

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = n; i > 0; i -= 2) cout << a[i] << " ";
	for (int i = (n % 2) + 1; i < n; i += 2) cout << a[i] << " ";
	cout << endl;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
   if (A + B > C + D) {
    cout << "Left" << endl;
   }
 
 else if (A + B < C +D) {
    cout << "Right" << endl;
 }
  
 else if (A + B == C + D) {
    cout << "Balanced" << endl;
 }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int taro_score = 0;
        int hanako_score = 0;
        String taro_card;
        String hanako_card;
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            taro_card = scan.next();
            hanako_card = scan.next();
            if (taro_card.compareTo(hanako_card) > 0) {
                taro_score += 3;
            } else if (taro_card.compareTo(hanako_card) == 0) {
                taro_score += 1;
                hanako_score += 1;
            } else {
                hanako_score += 3;
            }
        }
        System.out.println(taro_score + " " + hanako_score);
    }
}

Measured memory_bytes: 20796
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {

  long long int n;
  cin >> n;

  vector< long long int > v, vs;

  for ( long long int i = 0; i < n; i++ ) {

    long long int in;
    cin >> in;
    v.push_back( in );
    vs.push_back( in );

  }

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

  vector< long long int > t;

  long long int mi = 100000;

  for ( long long int i = 0; i < n; i++ ) {
    mi = min( mi, v[i] );
    for ( long long int j = 0; j < n; j++ ) {
      if ( v[i] == vs[j] ) {
	t.push_back( j );
	break;
      }
    }
  }

  long long int ans = 0;

  for ( long long int i = 0; i < n; i++ ) {

    if ( vs[i] != v[i] ) {

      long long int k = t[i];
      long long int m = v[i];
      long long int cnt = v[i];
      long long int num = 1;

      while( k != i ) {
	num++;
	cnt += v[k];
	m = min( m, v[k] );
	swap( v[i], v[k] );
	k = t[k];
      }

      ans += min( ( num - 2 ) * m, m + ( num + 1 ) * mi ) + cnt;

    }
    /*
    for ( long long int j = 0; j < n; j++ ) {
      cout << " " << v[j];
    }
    cout << endl;
    */
  }

  cout << ans << endl;

}

Measured memory_bytes: 1248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace テスト
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, A, x;
            N = int.Parse(Console.ReadLine()); 
            A = int.Parse(Console.ReadLine());
            x = N * N - A;
            Console.WriteLine(x);
            Console.ReadLine();

        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n;
void dfs(ll a, ll b, string s) {
	if (a == n) {
		cout << s << endl;
		return;
	}
	REP(i, b + 1) {
		char c = 'a' + i;
		dfs(a + 1, max(b, i + 1), s + c);
	}
}
int main() {
	
	cin >> n;
	dfs(0, 0, "");
}


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    ll D;
    cin>>D;
    v c(26);
    rep(i,0,26)cin>>c[i];
    vv s(D,v(26));
    rep(i,0,D)rep(j,0,26)cin>>s[i][j];
    v t(D);

    rep(d,0,D){
        ll now = 0;
        rep(i,0,26){
            if(now <= s[d][i]){
                now = s[d][i];
                t[d] = i+1;
            }
        }
    }
    rep(i,0,D)cout<<t[i]<<endl;
    return 0;
}

Measured memory_bytes: 3728
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int N,M;
int D[1<<17];
map<pair<int,int>,int>E;
vector<pair<int,int> >edges;
vector<int>G[1<<17];
int color[1<<17];
main()
{
	cin>>N>>M;
	vector<pair<int,int> >d(N);
	for(int i=0;i<N;i++)
	{
		cin>>D[i];
		d[i]=make_pair(D[i],i);
	}
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;
		u--,v--;
		edges.push_back(minmax(u,v));
		G[u].push_back(v);
		G[v].push_back(u);
	}
	sort(d.begin(),d.end());
	for(int i=0;i<N;i++)
	{
		int u=d[i].second;
		for(int v:G[u])
		{
			if(D[v]<=D[u])
			{
				if(!color[u]&&color[v])
				{
					color[u]=3-color[v];
				}
				else if(!color[u]&&!color[v]&&D[u]==D[v])
				{
					color[u]=1;
					color[v]=2;
				}
				E[minmax(u,v)]=D[u];
			}
		}
		if(!color[u])
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	for(int i=0;i<N;i++)cout<<(color[i]==1?'W':'B');
	cout<<endl;
	for(pair<int,int>p:edges)cout<<E[p]<<endl;
}

Measured memory_bytes: 25712
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
const int N = 3005;
const ll mod = 998244353;
ll ans=0,f[N][N];
int main()
{
	int n,s,a[N];	
	cin>>n>>s;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=s;j++)f[i][j]=f[i-1][j];
		f[i][a[i]]=(f[i][a[i]]+i)%mod;
		for(int j=0;j+a[i]<=s;j++)
		f[i][j+a[i]]=(f[i][j+a[i]]+f[i-1][j])%mod; 
		ans=(ans+f[i][s])%mod;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

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

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i > b; i--)
#define repll(i, a, b) for (ll i = a; i < b; i++)

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

  int r;
  cin >> r;
  cout << 2 * M_PI * r << endl;

  return 0;
}


Measured memory_bytes: 3752
package main

import (
	"fmt"
)

func main() {
	var n, a, b, blue int
	fmt.Scanf("%d %d %d", &n, &a, &b)
	
	if (a + b) > 0 {
		blue = n / (a + b) * a
		x := n % (a + b)
		if (x - a) > 0 {
			blue += a
		} else {
			blue += x
		}
	} else {
		blue = 0
	}
	fmt.Printf("%d\n", blue)
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        
        int n = scan.nextInt();
        int k = scan.nextInt();
        
        int[] x = new int[n];
        for(int i=0;i<x.length;i++)
        {
            x[i] = scan.nextInt();
        }
        
        int cost=0;
        for(int i=0;i<x.length;i++)
        {
            cost += Math.min(2*x[i],Math.abs(x[i]-k)*2);
        }
        
        System.out.println(cost);
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b,x,y;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol c=0,d=0,e=1,f=0,g=0,h=0;
  cin >>a;
  string s;
  cin >>s;
  if(a%2!=0){
      cout <<"No\n";
      return 0;
  }
  for(int n=0;n<a/2;n++){
      if(s[n]!=s[n+a/2]){
	  cout <<"No\n";
	  return 0;
      }
  }
  cout <<"Yes\n";
  return (0);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
  
int main()
{
  unsigned int second=0;
  unsigned int minute = 0;
  unsigned int hour = 0;
  cin>>second;
  if (second >= 60)
  {
	  minute = second / 60;
	  second = second % 60;
  }
  if (minute >= 60)
  {
	  hour = minute / 60;
	  minute = minute % 60;
  }
  cout<<hour<<":"<<minute<<":"<<second<<endl;
    
  return 0;
}

Measured memory_bytes: 3088
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (d (read))
         (width (+ 1 d d)))
    (println (ceiling n width))))

#-swank (main)


;; For Test
#+swank
(defun io-equal (in-string out-string &optional (func #'main))
  "Passes IN-STRING to *STANDARD-INPUT*, executes FUNC, and returns true if the
string output to *STANDARD-OUTPUT* is equal to OUT-STRING."
  (labels ((ensure-last-lf (s)
             (if (and (> (length s) 0)
                      (eql (char s (- (length s) 1)) #\Linefeed))
                 s
                 (uiop:strcat s uiop:+lf+))))
    (equal (ensure-last-lf out-string)
           (with-output-to-string (out)
             (let ((*standard-output* out))
               (with-input-from-string (*standard-input* (ensure-last-lf in-string))
                 (funcall func)))))))

#+swank
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

#+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
#+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))

#+swank
(defun run (&optional thing (out *standard-output*))
  (let ((*standard-output* out))
    (etypecase thing
      (null ; Runs #'MAIN with the string on clipboard
       (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
         (main)))
      (string
       (with-input-from-string (*standard-input* (delete #\Return thing))
         (main)))
      (symbol (5am:run! thing))
      (pathname ; Runs #'MAIN with the string in a text file
       (with-open-file (*standard-input* thing)
         (main))))))

#+swank
(defun gen-dat ()
  (uiop:with-output-file (out *dat-pathname* :if-exists :supersede)
    (format out "")))

#+swank
(defun bench (&optional (out (make-broadcast-stream)))
  (time (run *dat-pathname* out)))


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

using namespace std;

const int maxn = 310;

int binom[maxn][maxn], f[maxn][maxn], g[maxn][maxn], h[maxn][maxn];
int n, k, mod;

int main() {
    scanf("%d%d%d", &n, &k, &mod);
    for (int i = 0; i <= n; i++) binom[i][0] = 1 % mod;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            binom[i][j] = (binom[i-1][j] + binom[i-1][j-1]) % mod;
        }
    }
    for (int i = 1; i <= k+1; i++) f[1][i] = 1 % mod, g[1][i] = i % mod, h[1][i] = (i-1) % mod, h[0][i] = 1 % mod;
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j <= k+1; j++) f[i][j] = h[i-1][j];
        for (int j = 1; j <= k+1; j++) g[i][j] = (g[i][j-1] + f[i][j]) % mod;
        for (int j = 1; j <= k+1; j++) {
            for (int x = 1; x <= i; x++) {
                h[i][j] = (h[i][j] + 1LL * h[i-x][j] * g[x][j-1] % mod * binom[i-1][x-1] % mod) % mod;
            }
        }
    }
    printf("%d\n", h[n][k+1]);
    return 0;
}

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


int main() {
    string s;
    cin>>s;
    for (int i = (int)s.length()-1; i>0;) {
        //cout<<s[i]<<endl;
        if(s[i]=='r'){
            if(s.substr((unsigned)i-5,6)=="eraser")i-=6;
            else if(s.substr((unsigned)i-6,7)=="dreamer")i-=7;
            else{
                cout<<"NO\n"<<endl;
                return 0;
            }
        }
        else if(s[i]=='m'){
            if(s.substr((unsigned)i-4,5)=="dream")i-=5;
            else{
                cout<<"NO\n"<<endl;
                return 0;
            }
        }
        else if(s[i]=='e'){
            if(s.substr((unsigned)i-4,5)=="erase")i-=5;
            else {
                cout << "NO\n" << endl;
                return 0;
            }
        }
        else{
            cout<<"NO\n"<<endl;
            return 0;
        }
    }
    cout<<"YES\n"<<endl;
    return 0;
}


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

class Program
{
    void Calc()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        Console.WriteLine(a*a*a);

    }

    static void Main()
    {
        new Program().Calc();
    }

    class Scanner
    {
        string[] s = new string[0];
        int i = 0;
        char[] cs = new char[] { ' ' };

        public string Next()
        {
            if (i < s.Length) return s[i++];
            s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return s[i++];
        }
        public int NextInt() { return int.Parse(Next()); }
       public long NextLong() { return long.Parse(Next()); }
        public double NextDouble() { return double.Parse(Next()); }
    }
}

Measured memory_bytes: 5604
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template <class T> void swap(T& a, T& b) { T t = std::move(a); a = std::move(b); b = std::move(t); }

int main(void)
{
    ll N, i, count=0, r, l;
    string S;

    cin >> S;

    N = S.size();

    vector<ll> num(N);

    for(i=0; i<N; i++){
        if(i>0) i--;
        r = 0; l = 0;
        while(S[i]=='R'){
            i++; r++;
        }

        while(S[i]=='L'){
            i++; l++;
        }

        /*if((count-1+r) % 2 == 0){
            num.at(count-1+r) += l+r-(l+r)/2;
            num.at(count+r) += (l+r)/2;
        }

        else{
            num.at(count-1+r) += (l+r)/2;
            num.at(count+r) += l+r-(l+r)/2;
        }*/
        if(r%2==0){
            num.at(count-1+r) += (r/2);
        }
        else{
            num.at(count-1+r) += (r/2+1);
        }
        num.at(count-1+r) += (l/2);

        num.at(count+r) = (l+r-num.at(count-1+r));

        count += (r+l);
    }

    for(i=0; i<N; i++){
        cout << num.at(i) << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1408