akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    string s;
    cin >> s;
    int n = s.length();

    if(n % 2 == 0) {
        cout << "No\n";
        return 0;     
    }
    else {
        for (int i = 1; i <= n / 2; ++i) {
            if(s[n/2 + i] != s[n/2 - i]) {
                cout << "No\n";
                return 0;
            }
        }
        for (int i = 1; i <= (n-1) / 4; ++i) {
            if(s[0+i] != s[(n-1)/2-1-i]) {
                cout << "No\n";
                return 0;
            }
            if(s[n-1-i] != s[(n+3)/2-1+i]) {
                cout << "No\n";
                return 0;
            }
        }
        cout << "Yes\n";
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
 for j in range(1,105):
  for k in range(1,105):
   v = i*i+j*j+k*k+i*j+j*k+k*i;
   if v<10050:
     ans[v]+=1
for i in range(n):
  print(ans[i+1])

Measured memory_bytes: 9196
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int x = 0;
    int y = 0;

      x = 800 * N;
      y = (N / 15 * 200);
      System.out.println(x - y);

  }
}


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

int main()
{
	int n;
	double a[100];
	
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	
	double v=0.0;
	for(int i=0;i<n;i++) v+=1.0/a[i];
	
	cout<<setprecision(10)<<1/v<<endl;
	
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i

edges = Array.new(n){Array.new}

(n-1).times do |i|
  u, v, w = gets.split.map(&:to_i)
  edges[u-1] << [v-1, w]
  edges[v-1] << [u-1, w]
end

dist = Array.new(n, 0)
visited = Array.new(n,false)
s = [0]

while !s.empty? do
  from = s.pop
  visited[from] = true

  edges[from].each do |(to, wgt)|
    next if visited[to]
    dist[to] = dist[from] + wgt
    s << to
  end
end

n.times do |i|
  if dist[i] %2 == 0
    puts "0"
  else
    puts "1"
  end
end


Measured memory_bytes: 28284
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

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

    vector<int> b = a;
    sort(b.rbegin(), b.rend());
    for(int i = 0; i < n; i++){
        if(a[i] == b[0]){
            cout << b[1] << endl;
        }
        else{
            cout << b[0] << endl;
        }
    }
}


Measured memory_bytes: 3200
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.List (unfoldr)
import Control.Monad
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Data.IntMap.Strict as IntMap
import qualified Data.IntSet as IntSet
import Data.Foldable
import Control.Monad.ST

main = do
  [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  edges <- U.replicateM m $ do
    [u,v] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (u-1,v-1)
  [s,t] <- map (subtract 1) . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let graph :: IntMap.IntMap IntSet.IntSet
      graph = U.foldl' (\m (u,v) -> insertGraph (3 * u) (3 * v + 1)
                                    $ insertGraph (3 * u + 1) (3 * v + 2)
                                    $ insertGraph (3 * u + 2) (3 * v)
                                    $ m) IntMap.empty edges
      result = runST $ do
        visited <- UM.replicate (3 * n) False
        let !target = 3 * t
        -- bfs :: Int -> [Int] -> ST s (Maybe Int)
        let bfs !depth ss = do
              forM_ ss $ \u ->
                UM.write visited u True
              let ts = foldMap (\u -> IntMap.findWithDefault IntSet.empty u graph) ss
              if target `IntSet.member` ts
                then return $ Just (depth `quot` 3)
                else do ts' <- filterM (\v -> not <$> UM.read visited v) (IntSet.toList ts)
                        if null ts'
                          then return Nothing
                          else bfs (depth+1) ts'
        bfs 1 [3 * s]
  case result of
    Nothing -> putStrLn "-1"
    Just d -> print d

-- insertGraph key val == IntMap.insertWith IntSet.union key (IntSet.singleton val)
insertGraph :: Int -> Int -> IntMap.IntMap IntSet.IntSet -> IntMap.IntMap IntSet.IntSet
insertGraph !key !val = IntMap.alter (Just . f) key
  where f Nothing = IntSet.singleton val
        f (Just set) = IntSet.insert val set

foldMap_IntSet :: (Monoid n) => (Int -> n) -> IntSet.IntSet -> n
foldMap_IntSet f set = go set
  where
    go set = case IntSet.splitRoot set of
               [] -> mempty
               [x] -> foldMap f (IntSet.toList x)
               xs -> foldMap go xs

forM_IntSet :: Monad m => IntSet.IntSet -> (Int -> m ()) -> m ()
forM_IntSet set f = go set
  where
    go set = case IntSet.splitRoot set of
               [] -> return ()
               [x] -> forM_ (IntSet.toList x) f
               xs -> forM_ xs go

foldMapM_IntSet :: (Monoid n, Monad m) => (Int -> m n) -> IntSet.IntSet -> m n
foldMapM_IntSet f set = go set
  where
    go set = case IntSet.splitRoot set of
               [] -> return mempty
               [x] -> foldlM (\x v -> mappend x <$> f v) mempty (IntSet.toList x)
               xs -> foldlM (\x set' -> mappend x <$> go set') mempty xs


Measured memory_bytes: 55676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<int>house(N,0);
  
  for(int i=0;i<N;i++){
    cin >> house[i];
  }
  
  sort(house.begin(),house.end());
  
  int ans = 0;
  int now_house = house[0];
  
  for(int i=1;i<N;i++){
    ans += house[i] - now_house;
    now_house = house[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FASTIO                     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define REP(i,n)                   for(int i=1 ; i<=n ; i++)
#define mod                        1000000007
#define pi                         pair<int,int>
#define vi                         vector<int>
#define vii                        vector<pair<int,int>>
#define lli                        long long int
#define pb                         push_back
#define Mp                         make_pair
#define ff                         first
#define ss                         second
#define endl                       '\n'

using namespace std;

int main()
{
    FASTIO;
    int n,x,y;
    cin>>n;

    int D1[101], D2[101];

    for(int i=1; i<=n ; i++)
        cin>>D1[i]>>D2[i];

    bool flag = false;

    for(int i=1 ; i<= n-2 ; i++)
    {
        if(D1[i] == D2[i])
        {
            if((D1[i+1] == D2[i+1])  && (D1[i+2]==D2[i+2]))
            {
                flag = true;
                break;
            }
        }
    }

    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 3632
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
M = []
w = 0
h = 0
num = 1
def solve2(p, q, r, s, ans):
    global num
    for i in range(p, q+1):
        for j in range(r, s+1):
            ans[i][j] = num
    num += 1
    return ans

def solve(p, q, ans):
    v = []
    for i in range(p, q+1):
        for j in range(w):
            if M[i][j] == '#':
                v.append(j)
    v.sort()
    prev = 0
    for i, b in enumerate(v):
        if i == len(v)-1:
            ans = solve2(p, q, prev, w-1, ans)
        else:
            ans = solve2(p, q, prev, b, ans)
            prev = b+1
    return ans

def main():
    global M, h, w
    h, w, k = list(map(int, input().strip().split()))
    M = [0] * h
    G = [False] * h
    ans = [[0] * w for _ in range(h)]
    total1Row = 0
    for i in range(h):
        M[i] = input().strip()
        if '#' in M[i]:
            G[i] = True
            total1Row += 1
    prev = 0
    vc = 0
    for i, v in enumerate(G):
        if v and vc == total1Row-1:
            ans = solve(prev, h-1, ans)
        elif v:
            vc += 1
            ans = solve(prev, i, ans)
            prev = i+1

    for i in range(h):
        print(" ".join(str(s) for s in ans[i]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 44764
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair

bool check(char a,char b,char c)
{
    return (a=='R'||b=='R'||c=='R')&&(a=='G'||b=='G'||c=='G')&&(a=='B'||b=='B'||c=='B');
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll red=0,green=0,blue=0;
    vector<char>ara(n+1);
    for(ll i=1;i<=n;i++)
    {
        cin>>ara[i];
        if(ara[i]=='R')red++;
        if(ara[i]=='G')green++;
        if(ara[i]=='B')blue++;
    }
    ll ans=red*green*blue;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i+1;j<=n;j++)
        {
            ll k=2*j-i;
            if(k>n)break;
            if(check(ara[i],ara[j],ara[k]))
                ans--;
        }
    }
    cout<<ans<<endl;

    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


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

	int ans = 0;
	for(int i = 0; i < n; ++i)
	{
		for(int j = i + 1; j < n; ++j)
		{
			ans += d[i] * d[j];
		}
	}

	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
//#include<algorithm>

using namespace std;

void print(multiset<int>& col){
  for(multiset<int>::iterator it = col.begin(); it != col.end();it++){ 
    cout << *it << " ";    
  }
  cout << endl;
}

int main(){
  int n,a;
  cin >> n;
  multiset<int> col{-1};

  for(int i = 0; i < n; i++){
    cin >> a;
    multiset<int>::iterator it = col.lower_bound(a);
    if(it == col.begin() ){
      col.insert(a);
      //      cout << "insert" << endl;
      //      print(col);
    }else{
      it--;
      col.erase(it);
      col.insert(a);
      //      cout << "change" <<endl;
      //      print(col);
    }
  }

  cout << col.size() << endl;
  
}


Measured memory_bytes: 4992
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int c = sc.nextInt();
    int[][] table = new int[r+1][c+1];
    for(int i = 0; i < r; i++){
      for(int j = 0; j < c; j++){
        table[i][j] = sc.nextInt(); 
        table[i][c] += table[i][j];
        table[r][j] += table[i][j];
      }
      table[r][c] += table[i][c];
    }
    for(int i = 0; i < r+1;i++){
      for(int j = 0; j < c+1;j++){
        System.out.print(table[i][j]);
        if(j != c) {
        	System.out.print(" ");
        }
      }
      System.out.println("");
    }
  }
}



Measured memory_bytes: 42428
def main():
    num = list(map(int, input().split()))
    max_num = max(num)
    answer = 0
    for i in range(3):
        answer += (max_num - num[i]) // 2
        num[i] += ((max_num - num[i]) // 2) * 2
    num.sort()
    if num[0] == num[1] and num[1] != num[2]:
        answer += 1
    elif num[1] == num[0] + 1:
        answer += 2
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

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

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5128
function Main(s){
	s=s.split(/\s/);
	s.forEach(function(e,i,a){a[i]=Number(a[i]);});
	var a=s[1]-s[0];
	var b=0;
	for(var i=0;i<a;i=(i+1)|0){b+=i;}
	console.log(b-s[0]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
long long A[200005] = {};
long long B[500][500] = {};
long long C[205][205] = {};
long long D[200005] = {};
long long E[200005] = {};
bool f, ff;
string S[2];
set <long long>sll;
pl bufpl;
vector <long long>vl;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


bool fs[2005][2005] = {};

int main() {


	cin >> a >> b>>c;
	a -= c;

	cout << a / (b + c) << endl;
	

	return 0;

}


Measured memory_bytes: 2304
k = int(input())

lun = [[0] * 12 for _ in range(10)]
for i in range(1, 11):
    lun[0][i] = 1
for i in range(1, 10):
    for j in range(1, 11):
        lun[i][j] = lun[i - 1][j - 1] + lun[i - 1][j] + lun[i - 1][j + 1]

res = []
i = 0
start = 1
while k > 0 and i < 10:
    for j in range(start, 11):
        if not res and j == 1:
            continue
        if k == lun[i][j] == 1:
            res.append(j - 1)
            k = 0
            break
        if k > lun[i][j]:
            k -= lun[i][j]
            continue
        res.append(j - 1)
        start = j - 1
        i -= 1
        break
    else:
        i += 1


print(*res, sep="")


Measured memory_bytes: 3064
N,M = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(M)]

s = [sc[i][0] for i in range(len(sc))]
c = [sc[i][1] for i in range(len(sc))]

judge=False
for i in range(len(s)):
    for j in range(len(s)):
        if s[i]==s[j] and c[i] != c[j]:
            print(-1)
            judge=True
            break
        break




target = [0 for i in range(N)]

if N != 1 and target[0]==0:
    target[0]=1

for i in range(M):
    target[sc[i][0]-1] = sc[i][1]

if judge==False:
    res=0
    for i in range(N):
        res = res + target[i]*(10**(N-i-1))
    if len(str(res)) != N:
        print(-1)
    else:
        print(res)


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

int N, M;
vector<int> D, T;

int main(void) {
	cin >> N;
	D.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> D[i];

	cin >> M;
	T.resize(M);
	for (int i = 0; i < M; ++i)
		cin >> T[i];

	if (N < M) {
		cout << "NO\n";
		return 0;
	}

	sort(D.begin(), D.end());
	sort(T.begin(), T.end());
	bool ans = includes(D.begin(), D.end(), T.begin(), T.end());
	if (ans)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n, c;
  cin >> n >> c;
  vector<vector<int>> d(c, vector<int>(c)), g(n, vector<int>(n));
  REP(i, c) REP(j, c) cin >> d[i][j];
  REP(i, n) REP(j, n) cin >> g[i][j], g[i][j]--;

  vector<vector<int>> cost(3, vector<int>(c, 0));
  REP(k, c) REP(i, n) REP(j, n) cost[(i+j)%3][k] += d[g[i][j]][k];

  int ans = INF;
  int a[3];
  for(a[0] = 0; a[0] < c; a[0]++){
    for(a[1] = 0; a[1] < c; a[1]++){
      if(a[0] == a[1]) continue;
      for(a[2] = 0; a[2] < c; a[2]++){
        if(a[0] == a[2] || a[1] == a[2]) continue;
        int t = 0;
        REP(i, 3) t += cost[i][a[i]];
        chmin(ans, t);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
s = [int(input())]
i = 0
while True:
    if s[i] % 2:
        a = s[i] * 3 + 1
    else:
        a = s[i] // 2
    if a in s:
        print(i+2)
        exit()
    s.append(a)
    i += 1


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

double cross_product (xy_t a, xy_t b) {
    return (conj(a) * b).imag();
}

xy_t P[110];

int main() {
    cout << fixed;
    cout << setprecision(1);
    int n;
    cin >> n;
    double x, y;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        P[i] = xy_t(x, y);
    }
    double ans = 0;
    xy_t a = P[0];
    for (int i = 0; i < n - 2; i++) {
        xy_t b = P[i + 1], c = P[i + 2];
        ans += 0.5 * cross_product(b - a, c - a);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3280
#include <iostream>
#include <vector>

int main(void) {
    int n;
    int diff;
    int diff_min;
    while (1) {
        std::cin >> n;
        if (n == 0) {
            break;
        }
        std::vector<int> score(n);
        diff_min = 1e09;
        for (int i = 0; i < n; i++) {
            std::cin >> score[i]; 
        }
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                diff = score[i] - score[j];
                if (diff < 0) {
                    diff *= (-1);
                }
                if (diff < diff_min) {
                    diff_min = diff;
                }
            }
        }
        std::cout << diff_min << std::endl;
    }

    return 0;
}

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

int main() {
    std::cout << std::fixed << std::setprecision(10);
    int L;
    cin >> L;

    double tate = (double)L / 3.0F;
    double yoko = tate;
    double takasa = (double)L - tate - yoko;

    cout << tate * yoko * takasa << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    else return gcd(b, a % b);
}
int main() {
    int n;
    cin >> n;
    cout << 2 * n / gcd(2, n) << endl;
}

Measured memory_bytes: 764
#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 << "Balanced" << endl;
  }
  else if ((a+b) < (c+d)){
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

}



Measured memory_bytes: 32516
n,m=input().split()
if int(m)>=10:
    ans=0
    for i in range(4,int(n)+1):
      for j in range(2,int(m[0])):
        for k in range(2,10):
          if i==j*k:
            ans+=1
    for i in range(4,int(n)+1):
      for j in range(2,int(m[1])+1):
          if i==j*int(m[0]):
            ans+=1
    print(ans)
else:
  print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    char c;
    cin >> c;
    if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!(n: usize, a: [u64; 1 << n]);
    let mut dp: Vec<_> = a.iter().map(|&x| [0, x]).collect();
    for i in 0..n {
        for bs in (0..1 << n).filter(|&bs| bs >> i & 1 == 1) {
            let mut v = [dp[bs][0], dp[bs][1], dp[bs ^ 1 << i][0], dp[bs ^ 1 << i][1]];
            v.sort();
            dp[bs] = [v[2], v[3]];
        }
    }
    let mut ans = 0;
    for bs in 1..1 << n {
        let x = dp[bs][0] + dp[bs][1];
        if ans < x {
            ans = x;
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 12068
#include <stdio.h>
int main(){
	int n,i,j,m,f;
	char a[256],b[256],x;
	while(1){
	scanf("%d",&n);
	if(n==0){
		break;
        }

	for(i=0;i<n;i++){
		scanf("%s%s",&a[i],&b[i]);
	}
	
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%s",&x);
		f=0;
		for(j=0;j<n;j++){
		 if(x==a[j]){
			printf("%c",b[j]);
			f=1;
			break;
		 }
	    }
	 if(f==0){
	    printf("%c",x);
	 }
	}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1004
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  vector<bool> v(3, true);
  cin >> a >> b;
  a--, b--;
  v[a] = v[b] = false;
  rep(i, 3) {
    if (v[i])
      cout << i+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1LL << 40;
#define MOD 1000000007;
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define prique priority_queue
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
struct edge {
    int to, cost;
};

double dp[3000][3000];

int main() {
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    int n;
    cin >> n;
    vector<double> p(n);
    rep(i, n) cin >> p[i];
    rep(i, n) {
        rep(j, n) {
            dp[i + 1][j + 1] += dp[i][j] * p[i];
            dp[i + 1][j] += dp[i][j] * (1 - p[i]);
        }
    }
    double res = 0;
    REP(i, n / 2 + 1, n + 1) { res += dp[n][i]; }
    cout << setprecision(10) << fixed << res << endl;
}


Measured memory_bytes: 70656
object Main {
  def main(args: Array[String]) {
    val SEP = "####################"

    val input = scala.io.Source.stdin.getLines().toList.tail.map(_.split(' ').map(_.toInt))

    val houseMap = List.tabulate(4, 3, 10) { (b, f, r) =>
      input.collect { case Array(x, y, z, v) if x - 1 == b && y - 1 == f && z - 1 == r => v }.sum
    }

    println(houseMap.map(_.map(_.map(" " + _).mkString).mkString("\n")).mkString("\n" + SEP + "\n"))
  }
}

Measured memory_bytes: 58624
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

int a[200009];
int l[200009];
int r[200009];

int main(){
	DRI(n);
	REP(i,n){
		RI(a[i]);
	}
	l[0]=-1;
	REPP(i,1,n){
		l[i]=i-1;
		while(l[i]>=0&&a[i]<a[l[i]]){
			l[i]=l[l[i]];
		}
	}
	r[n-1]=n;
	for(int i=n-2;i>=0;i--){
		r[i]=i+1;
		while(r[i]<n&&a[i]<a[r[i]]){
			r[i]=r[r[i]];
		}
	}
	LL ans=0;
	REP(i,n){
		ans+=(LL)(i-l[i])*(LL)(r[i]-i)*a[i];
	}
	printf("%lld",ans);
}


Measured memory_bytes: 2560
/*
                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {   if(n % 2 ==1)
        result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
return result % M;
}      
bool isPrime(int n) 
{ 
if (n <= 1) 
    return false; 
if (n <= 3) 
    return true; 
if (n % 2 == 0 || n % 3 == 0) 
    return false; 
for (int i = 5; i * i <= n; i = i + 6) 
    if (n % i == 0 || n % (i + 2) == 0) 
        return false; 
return true; 
} 
signed main()
{   jaldi
    string str;
    cin>>str;
    for(int i=0;i<str.length();i++)
    cout<<'x';
}

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

static class Program
{
    static int Cycle(int N, int[] next)
    {
        int i = 0;
        int cnt = 1;
        while (i < N)
        {
            if (next[i] <= i) { ++cnt; }
            i = next[i] + 1;
        }
        return cnt;
    }

    static int[] Make(int N, int[] A, int[] next, int cnt)
    {
        if (cnt == 0) { return new int[] { }; }
        int i = 0;
        while (cnt > 1)
        {
            if (next[i] <= i || next[i] + 1 == N) { --cnt; }
            i = (next[i] + 1) % N;
        }
        var list = new List<int>();
        while (i < N)
        {
            if (next[i] > i)
            {
                i = next[i] + 1;
            }
            else
            {
                list.Add(A[i]);
                ++i;
            }
        }
        return list.ToArray();
    }

    static int[] Solve(int N, long K, int[] A)
    {
        var next = new int[N];
        var dict = new Dictionary<int, List<int>>();
        for (int i = 0; i < N; ++i)
        {
            if (!dict.ContainsKey(A[i])) { dict[A[i]] = new List<int>(); }
            dict[A[i]].Add(i);
        }
        foreach (var list in dict.Values)
        {
            int C = list.Count;
            for (int i = 0; i < C; ++i)
            {
                next[list[i]] = list[(i + 1) % C];
            }
        }
        int cycle = Cycle(N, next);
        return Make(N, A, next, (int)(K % cycle));
    }

    static void Main(string[] args)
    {
        var V1 = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        var A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Console.WriteLine(string.Join(" ", Solve((int)V1[0], V1[1], A)));
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> s(N);
  REP(i, N) cin >> s[i];

  sort(s.begin(), s.end());
  int ans = accumulate(s.begin(), s.end(), 0);
  for(int i = 0; i < N; i++) {
    if(ans % 10 != 0) { break; }
    if(s[i] % 10 == 0) { continue; }
    ans -= s[i];
  }
  if(ans % 10 == 0) ans = 0;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


string s;

int main(){
	cin >> s;
	
	int ans = 0;
	int n = s.size();
	for(int i = 0; i < s.size()/2; i++){
		if(s[i] != s[n-i-1]){
			ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

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

int main(){
  string s;
  cin>>s;
  if((s[0]==s[1])&&(s[1]==s[2])&&(s[2]==s[3]))cout<<"No";
  else if((s[0]==s[1] && s[2]==s[3])||(s[0]==s[2] && s[1]==s[3])||(s[0]==s[3] && s[1]==s[2]))cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
//#pragma comment (linker,"/STACK:256000000")
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define next(a) ( ((a)+1)%SIZE )
#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000
#define SIZE 100000

#define INF 1000000000
#define LLINF 10000000000000000

typedef long long ll;

typedef struct queue
{
	int front;
	int rear;
	int *data;
}queue;

/*
void init(queue* p)
{
	p->front = 0;
	p->rear = 0;
}

void enqueue(queue *p,int x)
{
	if (next(p->rear) == p->front)
		printf("OVERFLOW!\n");
	p->data[p->rear] = x;
	p->rear = next(p->rear);
}

int dequeue(queue *p)
{
	int x;

	if (p->front == p->rear)
		printf("NO DADA\n");

	x = p->data[p->front];
	p->front = next(p->front);

	return x;
}

int empty(queue *p)
{
	return p->front == p->rear;
}

void print(char* str, int a, int b)
{
	int i;

	for (i = a; i <= b; i++)
		printf("%c", str[i]);
	printf("\n");
}
*/

void reverse(char* str, int a, int b)
{
	int i,j=0;
	char t;

	for (i = a; i <= (a + b) / 2; i++)
	{
		t = str[i];
		str[i] = str[b - j];
		str[b - j] = t;
		j++;
	}
}

void replace(char* str, int a, int b, char* temp)
{
	int i, j=0;

	for (i = a; i <= b; i++)
	{
		str[i] = temp[j];
		j++;
	}
}

double rad(int C)
{
	return M_PI * C / 180;
}

double distance(int* a, int* b, int n, int p)
{
	double sum = 0.0;

	int i, j;

	int max = 0;

	for (i = 0; i < n; i++)
	{
		sum += pow(ABS(a[i] - b[i]), p);

		if (ABS(a[i] - b[i]) > max)
			max = ABS(a[i] - b[i]);
	}

	if (p == INF)
		return max;

	return pow(sum, (double)1 / p);
}

/*
typedef struct Vector
{
	int data[10];
	int size;
	int max;
}Vector;

Vector *init()
{
	Vector* p;

	//p = malloc(sizeof(int)*(10+2));
	p = (Vector*)(sizeof(int) * 12);
	//p->data = (int*)malloc(sizeof(int) * 10);
	p->size = 0;
	p->max = 10;

	return p;
}

Vector* Extend(Vector* p)
{
	Vector* q;

	q = (Vector*)malloc(sizeof(int) * p->max * 2);

	memcpy(q, p, sizeof(int) * p->size);

	p->max *= 2;

	free(p);

	return q;
}

Vector *pushBack(Vector *p,int x)
{
	if (p->size == p->max)
		p = Extend(p);

	p->data[p->size++] = 1;

	return p;
}

int randomAccess(Vector* p,int x)
{
	return p->data[x];
}

Vector* popBack(Vector* p)
{
	//free(p->data[--(p->size)]);
	--p->size;
	return p;
}
*/


int main()
{
	ll a,b,c;
	ll max = -LLINF, min = LLINF;

	scanf("%lld%lld%lld", &a, &b, &c);

	if (a > max)
		max = a;
	if (b > max)
		max = b;
	if (c > max)
		max = c;

	if (a < min)
		min = a;
	if (b < min)
		min = b;
	if (c < min)
		min = c;

	printf("%lld %lld\n", min, max);

	return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int N = 1e5+5;

const int mod = 1e9+7;

int n;
vector<int> al[N];
int dp[N][2];

void dfs(int u, int p) {
    dp[u][0] = dp[u][1] = 1;
    for (auto v : al[u]) if (v != p) {
        dfs(v, u);

        dp[u][0] = (int)(((ll)dp[u][0] * (dp[v][0] + dp[v][1])) % mod);
        dp[u][1] = (int)(((ll)dp[u][1] * dp[v][0]) % mod);
    }
}

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    FOR(i,1,n-1){
        int x,y; cin >> x >> y;
        al[x].pb(y);
        al[y].pb(x);
    }

    dfs(1,0);
    cout << (dp[1][0]+dp[1][1])%mod << '\n';
}



Measured memory_bytes: 13440
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        char[] postcode = sc.next().toCharArray();
        for (int i = 0; i < a + b + 1; i++) {
            if(i == a && !String.valueOf(postcode[i]).equals("-")) {
                System.out.println("No");
                System.exit(0);
            }
            if(i != a && 0 > Character.getNumericValue(postcode[i]) || Character.getNumericValue(postcode[i]) > 9) {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'

#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#ifndef __LOCAL
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout); FAST;
#else
#define FILES(namein, nameout) FAST;
#endif //__LOCAL

using namespace std;
using namespace __gnu_pbds;
using python = void;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned short uss;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type> ordered_set;

const ll M = 1e9+7;
const ll N = 108;
constexpr ll inf = 0x3f3f3f3f3f3f3f3f;
ll w[N], v[N];
ll dp[100100];
python solve(){
	FAST;
	ll n, sw;
	cin >> n >> sw;
	for(ll i = 0;i<n;i++){
		cin >> w[i] >> v[i];
		for(ll se = sw;se>=w[i];--se) dp[se] = max(dp[se], dp[se-w[i]]+v[i]);
	}
	ll mv = 0;
	for(ll i = 1;i<=sw;i++) mv = max(dp[i], mv);
	cout << mv << '\n';
}

signed main(){
	FAST;
	ll q = 1;
	//cin >> q;
	while(q--){
		solve();
	}
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,m;
int main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	in(n);in(m);
	if(n==m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define maxn 201000
#define mod 1000000007
using namespace std;
ll po(ll x,ll y){
	ll ans=1;
	while(y){
		if(y%2) ans=ans*x%mod;
		x=x*x%mod;
		y/=2;
	}
	return ans;
}
int main(){
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll ans=po(2,n)-1;
	ll sum=1;
	for(ll i=1;i<=a;i++){
		sum=sum*(n-i+1)%mod;
		sum=sum*po(i,mod-2)%mod;
	}
	ans-=sum;
	while(ans<0) ans+=mod;
	for(ll i=a+1;i<=b;i++){
		sum=sum*(n-i+1)%mod;
		sum=sum*po(i,mod-2)%mod;
	}
	ans-=sum;
	while(ans<0) ans+=mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

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

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var s string

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

	s = nextStr()
	lens := len(s)
	ans := -1
	for i := lens - 2; i > 0; i -= 2 {
		tmp := s[:i]
		if string(tmp[:i/2]) == string(tmp[i/2:]) {
			ans = len(tmp)
			break
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1776
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<long double,long double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<62;
const double pi=acos(-1);
const long double eps=1e-7;
const ll mod=1e6+3;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,a,b;

int main(){
	cin>>n>>a>>b;
	int res=0;
	for(int i=1;i<=n;i++){
		int t=i,tmp=0;
		while(t){
			tmp+=t%10;
			t/=10;
		}
		if(a<=tmp&&tmp<=b) res+=i;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)));
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(typename vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

char s[100010];
int ans;

int main(){
	scanf("%s" , s);
	int x;
	for(x = 0 ; s[x] != 0 ; ++x){
		if(s[x] == 'g') ++ans;
	}
	printf("%d\n" , ans - (x + 1) / 2);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

typedef pair<string, int> P;
bool pairCompare(const P &firstElof, const P &secondElof)
{
    if (firstElof.first == secondElof.first)
    {
        return firstElof.second < secondElof.second;
    }
    else
    {   
        return firstElof.first > secondElof.first;
    }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    map<pair<string, ll>, int> ma;
    vector<pair<string, ll>> v;
    for (int i = 0; i < N; i++)
    {
        string s;
        ll p;
        cin >> s >> p;
        ma[make_pair(s, p)] = i;
        v.push_back(make_pair(s, p));
    }
    sort(v.begin(), v.end(), pairCompare);
    reverse(v.begin(),v.end());
    for (auto &&i : v)
    {
        cout << ma[i] + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256