akhauriyash/Code-Regression huggingface dataset:
// shang tian bu gong a 
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 100;
#define int long long

int n, m, x[N], a[N];
int s[N], p[N];
int tot, k;
int bel[N], dep[N];
int vis[N];
vector <int> v[N];

void dfs(int u, int depth) {
  dep[u] = depth;
  vis[u] = 1;
  bel[u] = tot;
  v[tot].push_back(u);
  if (!vis[p[u]]) {
    dfs(p[u], depth + 1);
  }
}

signed main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x[i]);
  }
  for (int i = 1; i < n; i++) {
    s[i] = x[i + 1] - x[i];
    p[i] = i;
  }
  scanf("%lld %lld", &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%lld", &a[i]);
    swap(p[a[i]], p[a[i] - 1]);
  }
  for (int i = 1; i < n; i++) {
    if (vis[i] == 0) {
      tot++;
      dfs(i, 0);
    }
  }
  printf("%lld\n", x[1]);
  int cur = x[1];
  for (int i = 1; i < n; i++) {
    cur += s[v[bel[i]][(dep[i] + k) % v[bel[i]].size()]];
    printf("%lld\n", cur);
  }
  return 0;
}

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

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

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

int main(){
    int num_price, dif_price, max_profit, min_price;
    cin >> num_price;
    vector <int> price(num_price);
    for(int i=0;i<num_price;i++){
        cin >> price.at(i);
    }
    
    // 最大利益と時刻iまでの最小値の初期化
    max_profit = price.at(1) - price.at(0);
    min_price = price.at(0);
    
    for(int i=1; i<num_price; i++){
        max_profit = max(max_profit, price.at(i)-min_price);
        min_price = min(min_price, price.at(i));
    }
    
    cout << max_profit << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char str[100000];
    int n = 0;
    scanf("%d", &n);
    scanf("%s", &str);
    for (int i = 0; i < strlen(str); i++) {
        str[i] += n;
        if (str[i] > 'Z') {
            str[i] -= 26;
        }
    }
    printf("%s", str);
    return 0;
}


Measured memory_bytes: 256
H,W,N=map(int,input().split())
direc=[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]
dic={}
for i in range(N):
  h,w=map(int,input().split())
  for d in direc:
    if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):
      l=(h+d[0],w+d[1])
      if l in dic:
        dic[l]=dic[l]+1
      else:
        dic[l]=1
A=list(dic.values())
print((H-2)*(W-2)-len(A))
for i in range(1,10):
  print(A.count(i))

Measured memory_bytes: 173492
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long[] a = new long[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            sum += a[i];
        }
        long tmp = 0;
        for (int i = 1; i < n; i+=2) {
            tmp += a[i];
        }
        long yama = sum - tmp*2;
        int[] ans = new int[n];
        for (int i = 0; i < n; i++) {
            if (i == n-1) {
                System.out.println(yama);
                System.exit(0);
            }
            System.out.print(yama + " ");
            yama = (a[i] - yama/2) * 2;
        }
    }

}


Measured memory_bytes: 64048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=2e5+100;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f3f3f3f3f;
ll t,n,k,a[maxn],res;
int main(){
    //freopen("in.txt","r",stdin);
    cin>>t;
    for(int i=0;i<t;i++) cin>>a[i];
    for(int i=0;i<t-1;i++){
        if(a[i]>a[i+1]){
            res+=a[i]-a[i+1];
            a[i+1]=a[i];
        }
    }
    cout<<res<<endl;
	return 0;
}

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

int main()
{
    long long ans=0;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
            for(int k=1; k<=n; k++)
            {
                int x=__gcd(i,j);
                x=__gcd(k,x);
                ans+=x;
            }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define hell 1000000007  
#define endl "\n"
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX_SIZE 100002



int32_t main()
{   
    io
    
    string s;

    cin>>s;

    for(int i=0;i<s.length();i++)
    {

        if(i%2==0)
        {
            if(s[i]=='L')
            {
                cout<<"No";
                return 0;
            }
        }
        else
        {
            if(s[i]=='R')
            {
                cout<<"No";
                return 0;
            }


        }

    }

    cout<<"Yes";


return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

char str[200005];

int main(int argc, char* argv[])
{
    scanf("%s", str);
    long len=strlen(str);
    long stt=0;
    long i;
    for(i=0; i<len; i++) {
        if(str[i]=='A') {
            stt=i;
            break;
        }
    }
    long end=0;
    for(i=len-1; i>=0; i--) {
        if(str[i]=='Z') {
            end=i;
            break;
        }
    }

    printf("%ld\n", end-stt+1);

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>


 int gcd ( int a, int b ){
int c;
while ( a != 0 ) {
 		c = a; a = b%a;  b = c;
}
return b;
 }
int main(){
	int x,y;
	scanf("%d %d",&x,&y);
	printf("%d\n",gcd(x,y));
}

Measured memory_bytes: 2728
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

int main(){
  if(df) printf("*debug mode*\n");
  li a,b,c; cin >>a >>b >>c;
  if(a<c){
    c-=a;
    b=b<c?0:b-c;
    a=0;
  }else{
    a-=c;
  }
  printf("%ld %ld",a,b);
  
}

/// confirm df==0 ///


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
Min = min(a)
Max = max(a)
if Max - Min > 1:
	print("No")
elif Max == Min:
	if a[0] == n - 1 or a[0] <= n // 2:
		print("Yes")
	else:
		print("No")
else:
	c_M = a.count(Max)
	c_m = n - c_M
	if c_m < Max <= c_m + c_M // 2:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
int ctoi(char);
#define MAX_N 200001
#define l long
#define ll long long
#define f(a, b) for (ll i = a; i < b; i++)
#define f0(a) for (ll i=0;i<a;i++)
#define input(d) cin >> d;
#define inputs(n,d) for(int i=0;i<n;i++){cin >> d[i];}
#define output(d) cout << d << endl;
#define outputs(n,d) for(int i=0;i<n;i++){cout << d[i] << endl;}

int main(void) {
	ll n;
	//l n;
	//ll n,x,t;
	ll ans=0;
	input(n)
	vector<ll> a(n);
	//vector<int> d();
	//vector<l> d();
	//vector<ll> d();
	inputs(n,a)

	f(1,n){
		if(a[i]<a[i-1]){
			ans+=(a[i-1]-a[i]);
			a[i]=a[i-1];
		}
	}

	output(ans);

	return 0;
}

int ctoi(char c){
	switch(c){
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default : return -1;
	}
}


Measured memory_bytes: 4808
from itertools import combinations


n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))


answer = ['no']*q
for i in range(1, n+1):
    for nums in combinations(a, i):
        val = sum(nums)
        if val in m:
            index = [i for i, num in enumerate(m) if val == num]
            for i in index:
                answer[i] = 'yes'

for i in answer:
    print(i)



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

int main() {
int N ;
    cin >> N ;
  vector<int> A(N);
for (int i = 0; i < N; i++) {
  cin >> A.at(i);
}
int sum=0;
  for (int i = 0; i < N-1; i++) {
   for (int j = i+1; j< N; j++) 
    sum+=A.at(i)*A.at(j);
}
 cout << sum << endl;  
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	
	public long[] sumUp(int[][] card){
		long[] dp = new long[10001];
		dp[0] = 1;
		for(int i = 0; i < card.length; i++){
			long[] temp = new long[10001];
			for(int j = 10000; j >= 0; j--){
				if( dp[j] > 0 ){
					int k = card[i][1];
					while( k > 0 ){
					//	writer.print((j+card[i][0]*k) + " ");
						temp[j+card[i][0]*k] += dp[j];
						k--;
					}					
				}
			}
			for(int j = 0; j < 10001; j++){
				dp[j] += temp[j];
			}
		}
		return dp;
	}
	public  void solve() throws IOException{
		int n;
		while( (n = nextInt()) != 0 ){
			int[][] card = new int[n][2];
			for(int i = 0; i < n; i++){
				card[i][0] = nextInt();
				card[i][1] = nextInt();
			}			
			long[] check = sumUp(card);
			int m = nextInt();
			for(int i = 0; i < m; i++){
				int x = nextInt();
				writer.println(check[x]);
			}
		}
		writer.flush();
	}
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;
	
	public void run() throws IOException{
		try{
			reader = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
	public int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}		
	public String nextToken() throws IOException{
		while( tokenizer == null || !tokenizer.hasMoreTokens() ){
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}

Measured memory_bytes: 10000
/*input
8 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_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())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	string s;
	cin>>s;
	int ans=700;
	for(char c:s) if(c=='o') ans+=100;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int W;
	int H;
	int x;
	int y;
	int r;


scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

if(x-r<0 || x+r > W || y-r < 0 || y+r>H){
	printf("%s\n","No");
}else{
	printf("%s\n","Yes");
}

	return 0;
}


Measured memory_bytes: 2672
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

template<typename T>
struct Edge{
    int u, v;
    T cost;
    
    Edge() = default;
    Edge(int u, int v, T cost) : u(u), v(v), cost(cost) {}

    bool operator<(const Edge& other) const{
        return cost < other.cost;
    }
};

struct UnionFind{
    int sz;     // vertex number
    vector<int> par;
    vector<int> rank;

    UnionFind(int n) : sz(n) {
        par.resize(sz);
        rank.assign(sz, 0);
        for(int i = 0; i < sz; ++i){
            par[i] = i;
        }
    }

    int find(int x){
        if(par[x] == x) return x;
        else    return par[x] = find(par[x]);
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }

    void unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y)  return;
        if(rank[x] < rank[y])   par[x] = y;
        else{
            par[y] = x;
            if(rank[x] == rank[y])  ++rank[x];
        }
    }
};

template<typename T>
T Kruskal(vector<Edge<T>> &es, int V){
    T res = 0;    
    sort(es.begin(), es.end());
    int sz = es.size();
    UnionFind tree(V);
    for(int i = 0; i < sz; ++i){
        if(!tree.same(es[i].u, es[i].v)){
            tree.unite(es[i].u, es[i].v);
            res += es[i].cost;
        }
    }
    return res;
}

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

    int N;
    cin >> N;
    using T = tuple<int, int, int>;
    vector<T> ps;
    for(int i = 0; i < N; ++i){
        int x, y;
        cin >> x >> y;
        ps.emplace_back(x, y, i);
    }
    vector<Edge<ll>> es;
    sort(ps.begin(), ps.end());
    for(int i = 0; i + 1 < N; ++i){
        int sx = get<0>(ps[i]), tx = get<0>(ps[i + 1]);
        int u = get<2>(ps[i]), v = get<2>(ps[i + 1]);
        es.emplace_back(u, v, tx - sx);
    }
    sort(ps.begin(), ps.end(), [](const T& t1, const T& t2){
        return get<1>(t1) < get<1>(t2);
    });
    for(int i = 0; i + 1 < N; ++i){
        int sy = get<1>(ps[i]), ty = get<1>(ps[i + 1]);
        int u = get<2>(ps[i]), v = get<2>(ps[i + 1]);
        es.emplace_back(u, v, ty - sy);
    }
    cout << Kruskal<ll>(es, N) << endl;
}

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

int C;

int BubbleSort(int A[],int N){
	bool flag=true;
	
	while(flag){
		flag=false;
		
		for(int j=N-1;j>=1;j--){
			if(A[j]<A[j-1]){
				swap(A[j],A[j-1]);
				C++;
				flag=true;
			}
		}
	}
}

int main(){
	int N;
	cin>>N;
	
	int A[100];
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	
	C=0;
	
	BubbleSort(A,N);
	
	for(int i=0;i<N;i++){
		cout<<A[i];
		
		if(i<N-1){
			cout<<' ';
		}
		else{
			cout<<endl;
		}
	}
	
	cout<<C<<endl;
	
	return 0;
}

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

#define FOR(i,n) for(int i=0;i<(n);++i)
#define FORU(i,j,k) for(int i=(j);i<=(k);++i)
#define FORD(i,j,k) for(int i=(j);i>=(k);--i)

#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

using namespace std;

using lli = long long int;
using pll = pair<lli, lli>;

string TYPE(int*)  { return "%d";   }
string TYPE(lli*)  { return "%lld"; }
string TYPE(char*) { return "%c";   }

void RD() {}
template<typename T, typename... Args> 
void RD(T* v, Args... args)
{
    scanf((" " + TYPE(v)).c_str(), v);
    RD(args...);
}

void PR(bool nl = true)
{ if(nl) printf("\n"); }
template<typename T, typename... Args> 
void PR(bool nl, T v, Args... args)
{
    printf((TYPE(&v) + " ").c_str(), v);
    PR(nl, args...);
}
template<typename... Args> 
void PR(Args... args)
{ PR(true, args...); }

vector<string> split(const string& s, char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        v.emplace_back(x);
    return move(v);
}

void err(vector<string>::iterator) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args)
{
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}

const long long int oo = 1000*1000*1000;

struct Coord
{
    int x, y;
    Coord(int x = 0, int y = 0) : x(x), y(y) {}
    Coord operator + (const Coord& droite) const
    {
        return Coord(x + droite.x, y + droite.y);
    }
};

struct AB
{
    int k;
    vector<lli> arbre;
    AB(int _k = 20, lli def = 0)
    {
        k = _k;
        FOR(i, 1 << k)
            arbre.push_back(i < (1 << (k-1)) ? 0LL : def);
        FORD(i, ((1 << (k-1)) - 1), 1)
            arbre[i] = arbre[i << 1] + arbre[(i << 1) ^ 1];
    }
    void set(int i, lli x)
    {
        int feuille = i + (1 << (k-1));
        arbre[feuille] = x;
        iset(feuille >> 1);
    }
    void iset(int noeud)
    {
        if(noeud)
        {
            arbre[noeud] = arbre[noeud << 1] + arbre[(noeud << 1)  ^ 1];
            iset(noeud >> 1);
        }
    }
    lli sum(int deb, int fin, int noeud = 1, int p = 0, int q = -1)
    {
        if(q < p)
            q = 1 << (k-1);
        if(deb <= p && q <= fin)
            return arbre[noeud];
        if(deb >= q || fin <= p)
            return 0LL;
        int mil = (p + q) / 2;
        return sum(deb, fin, noeud << 1, p, mil) + sum(deb, fin, (noeud << 1) ^ 1, mil, q);
    }
};

int main()
{
	char buf[100];
	scanf(" %s", buf);
	string h = buf;
	h[5] = ' ';
	h[13] = ' ';
	printf("%s\n", h.c_str());
    return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		long r = ri();
		Console.WriteLine(r * r);
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
from copy import deepcopy
from collections import deque

H, W, N = map(int, input().split())
town = [list(input()) for i in range(H)]

move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
queue = deque()
stamina = 1
town_tmp = deepcopy(town)

for i in range(H):
    for j in range(W):
        if town[i][j] == 'S':
            queue.append((i, j, 0))
            town_tmp[i][j] = 'X'

while True:
    i, j, time = queue.popleft()
    for di, dj in move:
        ni, nj = i + di, j + dj
        if 0 <= ni < H and 0 <= nj < W:
            if town_tmp[ni][nj] == str(stamina):
                stamina += 1
                if stamina == N + 1:
                    print(time+1)
                    exit()
                town_tmp = deepcopy(town)
                queue = deque()
                queue.append((ni, nj, time+1))
                break
            elif town_tmp[ni][nj] == 'X':
                continue
            else:
                queue.append((ni, nj, time+1))
                town_tmp[ni][nj] = 'X'



Measured memory_bytes: 32940
#include<iostream>
using namespace std;
int main(void){
  int n,l,m,o,a[1000],sum=0;
  cin>>n>>l;
  for(int i=0;i<n;i++){
  a[i]=l+i;
    if(i==0){
      m=a[i];
      o=i;
    }
    else if(abs(a[i])<abs(a[i-1])){
      m=a[i];
      o=i;
  }
  }
  a[o]=0;
 for(int i=0;i<n;i++){
 sum+=a[i];
 }
  cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    bool deny = false;
    int N; cin >> N;
    REP(i, N){
        int A; cin >> A;
        if((!(A%2)) && (A%3 && A%5)) deny = true;
    }
    cout << (deny ? "DENIED" : "APPROVED") << endl;
}


Measured memory_bytes: 256
#include <map>
#include <string>
#include <iostream>

using namespace std;
const int MOD(998244353);

constexpr int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

inline void upd(int &a, int b)
{
	a = Add(a, b);
}

string S;
map<string, int> F;

string& operator&=(string &a, const string &b)
{
	for (int i = 0;i < a.size();++i)
		a[i] = ((a[i] - '0') & (b[i] - '0')) + '0';
	return a;
}

int dp(const string &s)
{
	if (s.empty())
		return 1;
	if (F.count(s))
		return F[s];
	int &Ret(F[s] = Mult(s[0] - '0' + 1, dp(s.substr(1))));
	for (int d = 1;d <= s.size();++d)
	{
		string tmp = s.substr(0, d);
		for (int k = d;k <= s.size() && k + d - 1 < s.size();k += d)
			tmp &= s.substr(k, d), upd(Ret, Mult(dp(tmp), dp(s.substr(k + d))));
	}
	return Ret;
}

int main()
{
	cin >> S;
	cout << dp(S) << endl;
	return 0;
}

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

int main() 
{
    string str1, str2;
    cin >> str1 >> str2;
    
    string rev1=str1, rev2=str2;
    reverse(rev1.begin(), rev1.end());
    reverse(rev2.begin(), rev2.end());
    
    if (str1 == rev2 && str2 == rev1) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

using namespace std;

const long long int mod = 1000000007;
const long long int maxn = 100010;

long long int n;
vector<vector<long long int>> g;
long long int dp[maxn];
long long int cm[maxn];
bool marked[maxn];

void dfs(long long int v){
	marked[v] = true;
	cm[v] = 1;
	dp[v] = 1;
	for (long long int u : g.at(v)){
		if (!marked[u]){
			dfs(u);
			cm[v] = (cm[v] * dp[u]) % mod;
			dp[v] = (dp[v] * cm[u]) % mod;
		}
	}
	dp[v] = (dp[v] + cm[v]) % mod;
}

int main(){
	cin >> n;
	g.resize(n, {});
	for (long long int i = 1;i < n; i++){
		long long int v, u;
		cin >> v >> u;
		g.at(v-1).push_back(u-1);
		g.at(u-1).push_back(v-1);
	}
	dfs(0);
	cout << dp[0] << endl;
	return 0;
}


Measured memory_bytes: 11520
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 100010;

int n;
pair <int, int> a[N];
long long ans[N];

int main() {

    scanf("%d", &n);

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

    sort(a, a + n);

    int id = n;

    for (int i = n - 1; i >= 0;) {
        int j = i;
        while (j >= 0 && a[i].first == a[j].first) {
            j--;
        }
        for (int k = j + 1; k <= i; k++) {
            id = min(id, a[k].second);
        }
        int d = (j < 0) ? a[i].first : a[i].first - a[j].first;
        ans[id] += 1LL * d * (n - (j + 1));
        i = j;
    }

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

    return 0;

}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define LL long long

LL A,B,Ans;

int main()
{
#ifdef h10
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
#endif
	LL i;
	scanf("%lld%lld",&A,&B);
	if (A%3==0||B%3==0) {puts("0"); return 0;}

	Ans=min(A,B);

	for (i=1;i<A;i++)
	{
		LL a=(LL)i*B;
		LL b=((LL)A-i)*(B/2);
		LL c=((LL)A-i)*(B-(B/2));
		LL tmp=max(max(a,b),c)-min(min(a,b),c);
		if (Ans>tmp) Ans=tmp;
	}

	swap(A,B);

	for (i=1;i<A;i++)
	{
		LL a=(LL)i*B;
		LL b=((LL)A-i)*(B/2);
		LL c=((LL)A-i)*(B-(B/2));
		LL tmp=max(max(a,b),c)-min(min(a,b),c);
		if (Ans>tmp) Ans=tmp;
	}

	printf("%lld\n",Ans);
}


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

using namespace std;

int main() {
    int n, w[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
    while (cin >> n) {
        int s = 0;
        vector<int> vec;
        while (n > 0) {
            if (n % 2 == 1) {
                vec.push_back(w[s]);
            }
            n /= 2;
            s++;
        }
        for (int i = 0; i < vec.size() - 1; i++) {
            cout << vec[i] << " ";
        }
        cout << vec[vec.size() - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1216
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
x = 0
for i in range(n):
    y = sum([p*q for p,q in zip(a[i],b)]) + c
    if y > 0:
        x += 1
print(x)

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<int> unhappy;
	rep(i, 26){
		int a;
		cin >> a;
		unhappy.push_back(a);
	}

	vector<vector<int>> input;
	rep(i, D){
		vector<int> v;
		rep(i, 26){
			int a;
			cin >> a;
			v.push_back(a);
		}
		input.push_back(v);
	}

	vector<int> last(D, 0);
	vector<int> ans;

	rep(i, D){
		long long int hmax = LONG_MIN;
		int tmp = 0;

		rep(j, 26){
			long long int unh = 0;

			rep(k, 26){
				if(k == j) continue;
				unh += unhappy[k] * (i + 1 - last[k]);
			}

			if(hmax < input[i][j] - unh){
				hmax = input[i][j] - unh;
				tmp = j;
			}
		}

		ans.push_back(tmp);
		last[tmp] = i + 1;
	}

	rep(i, D){
		cout << ans[i] + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int N, K, X, Y, ans, a;
	cin >> N >> K >> X >> Y;

	if (N <= K) {
		ans = N* X;
		cout << ans << endl;
	}

	else {
		a = N- K;
		cout << K* X + a * Y << endl;
	}

	return 0;
}

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

using namespace std;

int x, a, b;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  while (cin >> x >> a >> b && x) {
    int xa = abs(x-a);
    int xb = abs(x-b);
    if (xa < xb) {
      cout << "A" << endl;
    }
    else{
      cout << "B" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<stack>
#include<queue>
#include<sstream>
#include<string>
#include<set>
#include<array>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i);
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

using namespace std;

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

int px;
int py;
int cnt;
int xr,yr;
vector<string> field;

int dfs(int x, int y) {
  //(x, y) ????????????????????????????????????
    
    if(yr<=y || xr<=x || 0>x || 0>y) return 0;
    if(field[y][x]=='#') return 0;
    if(field[y][x]=='.' || field[y][x]=='@') {field[y][x]='#';cnt++;}
    // ??¨???4??????????????????
    for(int r = 0; r < 4; r++) {
      int nx = x + dx[r];
      int ny = y + dy[r];
      dfs(nx, ny);
    }
  return 0;
}

int main(){

 while(1){
    int x,y;
    cin >> x >> y;
    if(x==0 && y==0) break;
    xr=x; yr=y;
    field.clear(); 
    cnt=0;
    rep(i,y){
      string str;
      cin >> str;
      rep(j,str.size()){
        if(str[j]=='@'){
          px=j;
          py=i;
        }
      }
      field.push_back(str);
    }
   dfs(px,py);
   
   cout << cnt << endl;
  }
}

Measured memory_bytes: 3120
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLUCK 2

void dfs();
void visit(int);

int matrix[200][200];
int color[200];
int sumvirtex;
int time;
int firstvirtextime[200];
int finalvirtextime[200];


int main(){

  int i,j,virtexnum,connectsum,connect;

  scanf("%d",&sumvirtex);

  for(i = 1; i<=sumvirtex; i++){

    scanf("%d",&virtexnum);
    scanf("%d",&connectsum);

    for(j = 1; j <= connectsum; j++){

      scanf("%d",&connect);

      matrix[i][connect] = matrix[i][connect] + 1;

    }
  }

  /* for(i = 1; i<= sumvirtex;i++){

    for(j = 1; j <= sumvirtex;j++){

      printf("%d",matrix[i][j]);

    }

    }*/

  dfs();

    for(i=1; i<= sumvirtex; i++){

    printf("%d %d %d\n",i,firstvirtextime[i],finalvirtextime[i]);

  }
  

  return 0;

}

void dfs(){

  int i;

  for(i = 1; i <= sumvirtex; i++){

    color[i] = WHITE;

  }

  time = 0;

  for(i =1 ; i <= sumvirtex; i++){

    if(color[i] == WHITE){

    visit(i);

    }

  }

  /*for(i = 1; i <= sumvirtex; i++){

    printf("%d %d %d\n",i,firstvirtextime[i],finalvirtextime[i]);

    }*/

}

void visit(int i){

  int j;

  color[i] = GRAY;

  firstvirtextime[i] = ++time;

  for(j = 1; j <= sumvirtex; j++){

    if(matrix[i][j] == 1 && color[j] == WHITE){

      visit(j);

    }

  }

  color[i] == BLUCK;

    finalvirtextime[i] = ++time;

}

Measured memory_bytes: 680
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, ans;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n;
	while(n) {
		ans += n % 10;
		n /= 10;
	}
	if(ans == 1)
		ans = 10;
	cout << ans;
}

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

static const int MAXN = 1e9 + 10;

char data[MAXN];

bool Judge(int x)
{
	if(x & 1)
		return 0;
	int t = x >> 1;
	for(int i = 1 ; i <= t ; ++i)
	{
		if(data[i] != data[i + t])
			{return 0;}
	}
	return 1;
}

int main()
{
	scanf("%s" , data + 1);
	int r = strlen(data + 1) - 2;
	bool flag = 0;
	while(!flag && r > 0)
	{
		if(Judge(r))
			flag = 1;
		else
			--r;
	}
	printf("%d\n" , r);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define dl long double
#define ff first
#define ss second
#define pb push_back
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAXN 100100
using namespace std;
typedef pair<int,int> pii;


int32_t main(){
	fastio;
	int n,k;
	cin>>n>>k;

	double p=0;
	for(int i=1;i<=n;i++){
		double atual = (double)1.0/n;
		int x = i;
		while(x<k){
			x*=2;
			atual=atual/2.0;
		}
		p+=atual;
	}
	cout<<setprecision(12)<<fixed<<p<<endl;
	
}

Measured memory_bytes: 256
#include <cstdio>
 
int main(){
    int n;
    scanf("%d",&n);
    int array[n];
    for(int i = 0;i < n;i++){
        scanf("%d",&array[i]);
    }
    for(int i = n - 1;i >= 1;i--){
        printf("%d ",array[i]);
    }
    printf("%d\n",array[0]);
    return 0;
}


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

using namespace std;

int judge(int n) {
	set<int> dic;
	int i = 1;

	while (pow(i, 2) <= n) {
		if (n % i == 0) {
			dic.insert(i);
			dic.insert(n / i);
		}
		i++;
	}

	return dic.size() == 8;
}

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

	int ans = 0;
	for (int i = 1; i <= N; i += 2) {
		ans += judge(i);
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
import math

n=int(input())
t=int(input())
mint=t
t1=int(input())
if t1<t: mint=t1
maxtt=t1-t


for i in range(2,n):
    t=int(input())
 
    if t-mint>maxtt: maxtt=t-mint
    if t<mint: mint=t
    
print(int(maxtt))   



Measured memory_bytes: 5668
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;

bool FizzBuzz(int i, string s){
	if(i%15 == 0) return s == "FizzBuzz";
	else if(i%3 == 0) return s == "Fizz";
	else if(i%5 == 0) return s == "Buzz";
	else return atoi(s.c_str()) == i;
}

int main(){
	int m, n;
	queue<int> p;
	string s;
	while(cin >> n >> m, n || m){
		for(int i=1; i <= n; i++) p.push(i);

		for(int i=1; i <= m; i++){
			cin >> s;
			if(p.size() == 1) continue;
			if(FizzBuzz(i, s)) p.push(p.front());
			p.pop();
		}
		if(!p.empty()){
			while(p.front() > p.back()){
				p.push(p.front());
				p.pop();
			}

			bool isFirst = true;
			while(!p.empty()){
				if(!isFirst) cout << " ";
				cout << p.front();
				p.pop();
				isFirst = false;
			}
			cout << endl;
		}
	}
}

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

using namespace std;

main(){
  double x;
  while(1){
    cin >> x;
    if(x==0.0) break;
    //    int data=(int)(x*10000000.0);
    int nume=0, deno=1;
    //    int u=(int)(M_PI*10000000.0)+data, d=(int)(M_PI*10000000.0)-data;
    while(1){
      double tmp=(double)nume/deno;
      if(tmp<M_PI+x && tmp>M_PI-x) break;
      if(tmp<M_PI-x){
	nume++;
      }else{
	deno++;
      }
    }
    printf("%d/%d\n", nume, deno);
  }
  return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i,n) cin >> a[i];
    priority_queue<P> pq;
    rep(i,n){
        cin >> b[i];
        pq.emplace(b[i], i);
    }
    ll ans = 0;
    while(!pq.empty()){
        P ele = pq.top();
        pq.pop();
        if(a[ele.second] > ele.first){
            cout << -1 << endl;
            return 0;
        }
        if(a[ele.second] == ele.first) continue;
        int nextLeft = (ele.second + n - 1) % n;
        int nextRight = (ele.second + 1) % n;
        ll vLeft = b[nextLeft];
        ll vRight = b[nextRight];
        vector<P> v;
        while(ele.first <= (vLeft + vRight)){
            v.push_back(ele);
            if(pq.empty()){
                cout << -1 << endl;
                return 0;
            }
            ele = pq.top();
            pq.pop();
            nextLeft = (ele.second + n - 1) % n;
            nextRight = (ele.second + 1) % n;
            vLeft = b[nextLeft];
            vRight = b[nextRight];
        }
        for(auto p : v){
            pq.push(p);
        }
        ll x = (ele.first - (vLeft + vRight) + (vLeft + vRight - 1)) / (vLeft + vRight);
        ll y = (ele.first - a[ele.second]) / (vLeft + vRight);
        ll z = min(x, y);
        ans += z;
        b[ele.second] = ele.first - z * (vLeft + vRight);
        if(b[ele.second] < a[ele.second]){
            cout << -1 << endl;
            return 0;
        }
        else if(b[ele.second] > a[ele.second]){
            if(b[ele.second] > (vLeft + vRight)){
                x = (b[ele.second] - (vLeft + vRight) + (vLeft + vRight - 1)) / (vLeft + vRight);
                ans += x;
                b[ele.second] -= x * (vLeft + vRight);
                if(b[ele.second] < a[ele.second]){
                    cout << -1 << endl;
                    return 0;
                }
                else if(b[ele.second] == a[ele.second]) continue;
            }
            pq.emplace(b[ele.second], ele.second);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

class UnionFind{
private:
    vector<int> Parent;
public:
    UnionFind(int N){
        vector<int> Parent(N,-1);
    }

    int root(int A){
        if(Parent[A]<0) return A;
        return Parent[A]=root(Parent[A]);
    }

    int size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A,int B){
        A=root(A);
        B=root(B);
        if(A==B) return false;
        if(size(A)<size(B)) swap(A,B);
        Parent[A]-=Parent[B];
        Parent[B]=A;
    }
};

int main(){
    int N,M,A,B,C;
    cin >> N >> M;
    typedef pair<int,int> P;
    priority_queue<P> que;
    for(int i=0;i<N;i++){
        cin >> A;
        que.push(P(A,1));
    }
    for(int i=0;i<M;i++){
        cin >> B >> C;
        que.push(P(C,B));
    }
    long long ans=0;
    for(int i=0;i<N;){
        P p = que.top();que.pop();
        while(p.second>0){
            ans+=p.first;
            p.second--;
            i++;
            if(i>=N) break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    string s;
    cin >> s;
    ll n = s.size();
    for(ll i = n-2; i >= 2; i-=2)
    {
        if(s.substr(0, i/2) == s.substr(i/2, i/2)) ANS(i);
    }
}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main() {
    int N;
    cin>>N;
    ll a[N];
    rep(i,N){
        cin>>a[i];
    }
    int count0=0,count2=0,count1=0;
    rep(i,N){
        if(a[i]%2!=0){
            count0++;
        }
        else if(a[i]%4==0){
            count2++;
        }
        else if(a[i]%2==0){
            count1++;
        }

}
if(count1>0){
if(count0<=count2){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
}
else{
    if(count0<=count2+1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

    
return 0;
}



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

string s, t;

int main() {
	cin >> s >> t;
	for (int i = 0; i < (int) s.size(); i++) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 3624
T1,T2=map(int,input().split())
a,b=map(int,input().split())
c,d=map(int,input().split())
e=T1*a
f=T1*c
if e>f:
  g=e-f
  e=T2*b
  f=T2*d
  if e>f:
    print(0)
  else:
    h=f-e
    if g==h:
      print("infinity")
    elif g>h:
      print(0)
    else:
      k=h-g
      if k>g:
        print(1)
      elif (g/k)%1!=0:
        print(1+(g//k)*2)
      else:
        print((g//k)*2)
elif e<f:
  g=f-e
  e=T2*b
  f=T2*d
  if e<f:
    print(0)
  else:
    h=e-f
    if g==h:
      print("infinity")
    elif g>h:
      print(0)
    else:
      k=h-g
      if k>g:
        print(1)
      elif (g/k)%1!=0:
        print(1+(g//k)*2)
      else:
        print((g//k)*2)

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

int main(){
  int N;
  int x1, y1, x2, y2;

  int seal[1001][1001];

  for(int i = 0; i <= 1000; i++){
    for(int j = 0; j <= 1000; j++){
      seal[i][j] = 0;
    }
  }

  scanf("%d", &N);
  for(int i = 1; i <= N; i++){
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    seal[y1][x1]++;
    seal[y1][x2]--;
    seal[y2][x1]--;
    seal[y2][x2]++;
  }

  for(int i = 0; i <= 1000; i++){
    for(int j = 1; j <= 1000; j++){
      seal[i][j] += seal[i][j - 1];
    }
  }

  for(int i = 1; i <= 1000; i++){
    for(int j = 0; j <= 1000; j++){
      seal[i][j] += seal[i - 1][j];
    }
  }

  int ans = 0;
  for(int i = 0; i <= 1000; i++){
    for(int j = 0; j <= 1000; j++){
      if(seal[i][j] > ans) ans = seal[i][j];
    }
  }

  printf("%d\n", ans);
  
  return 0;
}

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

ll a,b,x,y;

void exgcd(ll a,ll b,ll& x,ll& y) {
    if (!b) {
        x=1, y=0;
        return;
    }
    exgcd(b,a%b,y,x);
    y-=a/b*x;
}

int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    exgcd(a,b,x,y);
    cout<<x<<' '<<y<<'\n';
}


Measured memory_bytes: 3220
#include <iostream>
#include <stdio.h>

using namespace  std;

int main() {
    long long a,b,v,w,t;
    scanf("%lld%lld%lld%lld%lld",&a,&v,&b,&w,&t);
    if (w>=v){
        printf("NO\n");
        return 0;
    }
    a-=b;
    if (a<0) a=-a;
    if (t*(v-w)>=a)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;
 
LL gcd(LL a, LL b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
 
int main() {
	LL n;
	cin >> n;
	vector<LL> a(n + 1);
	rep(i, 1, n + 1) cin >> a[i];
	vector<LL> l(n + 2), r(n + 2);
	l[0] = 0;
	rep(i, 0, n) l[i + 1] = gcd(l[i], a[i]);
	r[n + 1] = 0;
	for (int i = n; i > 0; i--) r[i] = gcd(r[i + 1], a[i]);
	LL ans = 0;
	rep(i, 0, n+1) {
		LL m = gcd(l[i], r[i + 1]);
		ans = max(ans, m);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
using ll=long long;
//入力数の桁数を出力
//https://atcoder.jp/contests/abc057/tasks/abc057_c
int cnt_digits(ll n){

    int digits =0;
    while(n > 0){

        digits++;
        n /= 10;

    }
    return digits;
}

int main() {
    
    ll n;

    cin >> n;
    //最大桁数
    int ans = cnt_digits(n);
    for(ll a = 1LL;a * a <= n;a++){
        if(n % a != 0) continue;
        ll b = n / a;

        int keta = max(cnt_digits(a),cnt_digits(b));

        if(keta < ans){
            ans = keta;
        }


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



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  int a[40]={};
  int ans=0;
  for(int i=0;i<n;++i){
	int k;cin>>k;
	for(int j=0;j<k;++j){
	  int x;cin>>x;
	  a[x]++;
	  if(a[x]==n)ans++;
	}
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
N = gets.to_i
ans = 10**10
(1..(N/2)).each do |a|
    b = N - a
    result = 0
    [a, b].each do |num|
      while num > 0
        result += num % 10
        num /= 10
      end
    end
    ans = result if ans > result
end
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	while(n > 0){
		n /= k;
		ans++;
	}
	print(ans)
	return 0;
}

Measured memory_bytes: 256