akhauriyash/Code-Regression huggingface dataset:
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		out.println(ni() + ni() + ni() >= 22 ? "bust" : "win");
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 21204
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n, ma, mb;
	cin >> n >> ma >> mb;
	vi a(n), b(n), c(n);
	f_v3I(a, b, c, n);
	vvvi dp(n+1, vvi(401, vi(401, ll_INF)));
	dp[0][0][0] = 0;
	f(i, 0, n) {
		f(j, 0, 401) {
			f(k, 0, 401) {
				if (dp[i][j][k] == ll_INF)continue;
				dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
				dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
			}
		}
	}
	int ans = ll_INF;
	f(i, 1, 401) {
		f(j, 1, 401) {
			if (i*mb == j * ma) {
				ans = min(ans, dp[n][i][j]);
			}
		}
	}
	if (ans == ll_INF) {
		cout << -1;
	}
	else {
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 53504
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    X = list(map(int, input().split()))
    X_sort = sorted(X)
    n = X_sort[N//2]
    for i in range(N):
        if X[i] < n:
            print(X_sort[N//2])
        else:
            print(X_sort[N//2-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 25476
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
AS=[0]
BS=[0]
r=0
for i in A:
  if i+AS[-1]<=k:
    AS.append(i+AS[-1])
  else:
    break
    
for i in B:
  if i+BS[-1]<=k:
    BS.append(i+BS[-1])
  else:
    break
    
j=len(BS)-1
for i in range(len(AS)):
  while AS[i]+BS[j]>k:
    j-=1
  r=max(r,i+j)
print(r)

Measured memory_bytes: 134148
#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 << "Right";
  else if(A + B > C + D)
    cout << "Left";
  else
    cout << "Balanced";
}

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

struct Dice {
  vector<int> num;
  void roll_n() {
    int t = num.at(0);
    num.at(0) = num.at(1);
    num.at(1) = num.at(5);
    num.at(5) = num.at(4);
    num.at(4) = t;
  }
  void roll_s() {
    int t = num.at(0);
    num.at(0) = num.at(4);
    num.at(4) = num.at(5);
    num.at(5) = num.at(1);
    num.at(1) = t;
  }
  void roll_e() {
    int t = num.at(0);
    num.at(0) = num.at(3);
    num.at(3) = num.at(5);
    num.at(5) = num.at(2);
    num.at(2) = t;
  }
  void roll_w() {
    int t = num.at(0);
    num.at(0) = num.at(2);
    num.at(2) = num.at(5);
    num.at(5) = num.at(3);
    num.at(3) = t;
  }
};

int main() {
  Dice d;
  rep(i, 6) {
    int n; cin >> n;
    d.num.push_back(n);
  }
  string s;
  cin >> s;
  rep(i, s.size()) {
    if (s.at(i) == 'N') d.roll_n();
    if (s.at(i) == 'S') d.roll_s();
    if (s.at(i) == 'E') d.roll_e();
    if (s.at(i) == 'W') d.roll_w();
  }
  cout << d.num.at(0) << endl;
}


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

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

  bool a=false, b=false, c=false;
  
  a=s.at(0)=='A';

  int ct=0;
  for(int i=2; i<s.size()-1; i++){
    if(s.at(i)=='C') ct++;
  }
  b=(ct==1);

  ct=0;
  for(int i=0; i<s.size(); i++){
    if(isupper(s.at(i))) ct++;
  }
  c=(ct==2);

  if(a && b && c) cout << "AC" << endl;
  else cout << "WA" << endl;
}


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

int main() {
	long long int r,d,x,ans,newx;
    cin >> r >> d >> x;
    newx=x;
    for(int i=0;i<10;++i) {
        ans = r*newx-d;
        newx=ans;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 256
// 参考:http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4325944#1

#include<bits/stdc++.h>
using namespace std;

#define MAX 10001

struct Edge{
	Edge(int to,int weight){
		this->to = to;
		this->weight = weight;
	}
	int to,weight;
};

int N;
vector<int> Dp[MAX];
int Height[MAX] = {0};
vector<Edge> G[MAX];

int dfs(int node,int edge_index){
	if(Dp[node][edge_index] >= 0){
		return Dp[node][edge_index];
	}
	Dp[node][edge_index] = G[node][edge_index].weight;
	int to = G[node][edge_index].to;

	for(int i = 0; i < G[to].size(); i++){
		int next = G[to][i].to;
		if(next == node)continue;

		Dp[node][edge_index] = max(Dp[node][edge_index],dfs(to,i)+G[node][edge_index].weight);
	}
	return Dp[node][edge_index];
}

void getHeight(){
	for(int i = 0; i < N; i++){
		for(int j = 0;j < G[i].size();++j){
			if(Dp[i][j] >= 0)continue;
			Dp[i][j] = dfs(i,j);
		}
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < G[i].size();++j){
			Height[i] = max(Height[i],Dp[i][j]);
		}
	}
}

int main(){
	scanf("%d",&N);
	int from,to,weight;
	
	for(int i = 0;i < N - 1;++i){
		scanf("%d %d %d",&from,&to,&weight);
		G[from].push_back(Edge(to,weight));
		G[to].push_back(Edge(from,weight));
	}

	for(int i = 0; i < N;++i){
		for(int j = 0;j < G[i].size();++j){
			Dp[i].push_back(-1);
		}
	}
	getHeight();
	for(int i = 0; i < N;++i){
		printf("%d\n",Height[i]);
	}
}


Measured memory_bytes: 5348
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int minv = LINF;
	for(int i = 1;i * i <= n;++i){
		if(n % i == 0) minv = min(minv,i-1 + (n / i-1));
	}
	cout << minv << '\n';
	return 0;
}


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

int main() {
    string stra,strb;
    int x;
    bool r=true;
    cin >> stra;
    cin >> strb;
    x= stra.length();
    for(int i=0;i<x;i++){
        if(stra[i]!=strb[i]){
            r=false;
        } 
    }
    if(r==true){
        cout << "Yes" << endl;
    }else if(r==false){
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3588
package main

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

func main() {
	var t string
	s := wordScanner(100001)
	scanStrings(s, &t)

	ans := 0
	for i := 0; len(t) > i+1; {
		if d := t[i : i+2]; d == "01" || d == "10" {
			ans += 2
			if len(t) > i+1 {
				t = t[:i] + t[i+2:]
				if i > 0 {
					i--
				}
			} else {
				break
			}
		} else {
			i++
		}
	}

	fmt.Println(ans)
}

func wordScanner(n int) *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	b := make([]byte, n)
	s.Buffer(b, n)
	return s
}

func scanStrings(s *bufio.Scanner, vals ...*string) {
	for i := range vals {
		s.Scan()
		*vals[i] = s.Text()
	}
}


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

int main() {
    string s;
    cin >> s;
    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3636
#pragma region Template
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "../../../debug_print.hpp"
#else
#define debug(...)
#endif
#define sort_(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.rbegin(), a.rend())
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; 0 <= i; i--)
#define for_(i, start, end) for (int i = start; i < end; i++)
#define rfor(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD53       = 998'244'353;
constexpr double PI       = 3.14159265358979323846;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}
#pragma endregion Template

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

    string s;
    scan(s);

    auto calc = [](string ss) {
        int sum = ss[0] - '0';
        for (int i = 1; i < ss.size(); i += 2) {
            if (ss[i] == '+') {
                sum += ss[i + 1] - '0';
            } else {
                sum -= ss[i + 1] - '0';
            }
        }
        if (sum == 7) {
            string ans = ss + "=7";
            print(ans);
            exit(0);
        }
    };

    auto rec = [&](auto f, int now, string ss) {
        if (now == 4) {
            calc(ss);
            return;
        }
        f(f, now + 1, ss + "+" + string{s[now]});
        f(f, now + 1, ss + "-" + string{s[now]});
    };
    rec(rec, 1, string{s[0]});

    return 0;
}

Measured memory_bytes: 256
s = input()

ans = 0
if len(s)%2 == 0:
    for i in range(len(s)//2):
        if s[i] != s[len(s)-i-1]:
            ans += 1
else:
    for i in range(len(s)//2):
        if s[i] != s[len(s)-i-1]:
            ans += 1

print(ans)

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

typedef long long ll;
const int N = 200000 + 5;
const int MOD = (int)1e9 + 7;
ll F[N], Finv[N], inv[N];//仓鼠学姐的模板

void init() {
	inv[1] = 1;
	for(int i = 2; i < N; i ++) {
		inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD;
	}
	F[0] = Finv[0] = 1;
	for(int i = 1; i < N; i ++) {
		F[i] = F[i-1] * 1ll * i % MOD;
		Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD;
	}
}

ll C(ll n, ll m) {
	if(m < 0 || m > n) return 0;
	return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD;
}

int num[N], vis[N];

int main(){
	init();
	int n;
	memset(vis, 0, sizeof(vis));
	while(~scanf("%d", &n)) {
		int res, suf;
		for(int i=1; i<=n+1; ++i) {
			scanf("%d", num + i);
			if(vis[num[i]]) suf = i;
			else vis[num[i]] = 1;
		}
		for(int i=1; i<=n+1; ++i) {
			if(num[i] == num[suf]){
				res = i;
				break;
			}
		}
		//cout<<"RES"<<res<<" "<<"SUF"<<suf<<endl;
		ll tot = n + 1 - (suf - res + 1);
		for(int i=1; i<=n+1; ++i) {
			printf("%lld\n", ((C(n+1, i) - C(tot, i-1)) % MOD + MOD) % MOD);
		}
	}
	return 0;
}


Measured memory_bytes: 7040
import java.util.Scanner;

/**
 * http://abc071.contest.atcoder.jp/tasks/abc071_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		System.out.println(Math.abs(x-a)<Math.abs(x-b) ? "A" : "B" ); 

	}

}


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

h,w,m=map(int,input().split())
hs=dict()
ws=dict()
hw=set()
for i in range(m):
    hi,wi=map(int,input().split())
    if hi-1 in ws:
        ws[hi-1]+=1
    else:
        ws[hi-1]=1
    if wi-1 in hs:
        hs[wi-1]+=1
    else:
        hs[wi-1]=1
    hw.add((hi-1,wi-1))    

wmax=max(list(ws.values()))
hh=[]
for ik,wv in ws.items():
    if wv==wmax:
        hh.append(ik)
hmax=max(list(hs.values()))
ww=[]
for jk,hv in hs.items():
    if hv==hmax:
        ww.append(jk)
        
for hi in hh:
    for wi in ww:
        if  not ((hi,wi) in hw):
#            print(hi,wi)
            print(wmax+hmax) 
            sys.exit()
print(wmax+hmax-1)


Measured memory_bytes: 218464
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) {
        String line = readLine(System.in);
        String[] input = line.split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);

        String operator = null;
        if (a < b) {
            operator = "<";
        } else if (a > b) {
            operator = ">";
        } else {
            operator = "==";
        }

        System.out.println("a " + operator + " b");
    }

    private static String readLine(InputStream in) {
        String line = null;
        BufferedReader reader = null;

        try {
            reader = new BufferedReader(new InputStreamReader(in));
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        return line;
    }
}

Measured memory_bytes: 17060
#include <stdio.h>

int check_abc(int a, int b, int c, int A, int B, int C) {
    if(a<=A && b<=B && c<=C) {
        return 1;
    } else {
        return 0;
    }
}

int main() {
    int X, A, B, C, a, b, c;
    scanf("%d %d %d %d", &A, &B, &C, &X);

    a = X/500;
    b = (X - 500*a)/100;
    c = (X - 500*a - 100*b)/50;


    int i, j, k, ans=0, count=0;

    for(i=a; i>=0; i--) {
        // if(i>A) {
        //     continue;
        // }

        count += 1;
        ans += check_abc(i, b, c, A, B, C);
        // printf("%d %d %d\n", i, b, c);

        k = c;

        for(j=b-1; j>=0; j--) {
            k += 2;

            // if(j>B) {
            //     continue;
            // }
            // if(k>C) {
            //     continue;
            // }

            ans += check_abc(i, j, k, A, B, C);
            // printf("%d %d %d\n", i, j, k);
            count += 1;
        }

        b += 5;
    }

    // printf("%d %d\n", ans, count);
    printf("%d\n", ans);

    return 0;
}

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

using namespace std;

int main() {
  char s[3][13];
  scanf("%s%s%s", s[0], s[1], s[2]);
  if (s[0][strlen(s[0]) - 1] == s[1][0] && s[1][strlen(s[1]) -1] == s[2][0]) {
    puts("YES");
  } else {
    puts("NO");
  }
}


Measured memory_bytes: 256
"use strict";

function Main(input) {
  let lines = input.split('\n');
  let ans = "No"
  if(lines[0]%2 == 1){
  	console.log(ans);
    return;
  }
  let first = lines[1].slice(0 ,lines[0]/2);
  let second = lines[1].slice(lines[0]/2,lines[0]);
  if(first === second){
    ans = "Yes";
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

int main(void){
    int h,w;
    cin >> h >> w;
    vector<string> s;
    for(int i=0; i<h; i++){
        string tmp_s;
        cin >> tmp_s;
        s.push_back(tmp_s);
    }
    int L[h][w]; // <-
    int R[h][w]; // ->
    int U[h][w]; // ↑
    int D[h][w]; // ↓

    // 初期化
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            L[i][j] = 0;
            R[i][j] = 0;
            U[i][j] = 0;
            D[i][j] = 0;
        }
    }

    // L,R
    for(int i=0; i<h; i++){
        if(s[i][0]=='.'){
            L[i][0] = 1;
        }
        else{
            L[i][0] = 0;
        }
        if(s[i][w-1]=='.'){
            R[i][w-1] = 1;
        }
        else{
            R[i][w-1] = 0;
        }
    }

    // U,D
    for(int j=0; j<w; j++){
        if(s[0][j]=='.'){
            U[0][j] = 1;
        }
        else{
            U[0][j] = 0;
        }
        if(s[h-1][j]=='.'){
            D[h-1][j] = 1;
        }
        else{
            D[h-1][j] = 0;
        }
    }

    // 前処理
    // L
    for(int i=0; i<h; i++){
        for(int j=1; j<w; j++){
            if(s[i][j] == '.'){
                L[i][j] = L[i][j-1] + 1;
            }
            else{
                L[i][j] = 0;
            }
        }
    }
    // R
    for(int i=0; i<h; i++){
        for(int j=w-2; j>=0; j--){
            if(s[i][j] == '.'){
                R[i][j] = R[i][j+1] + 1;
            }
            else{
                R[i][j] = 0;
            }
        }
    }
    // U
    for(int j=0; j<w; j++){
        for(int i=1; i<h; i++){
            if(s[i][j] == '.'){
                U[i][j] = U[i-1][j] + 1;
            }
            else{
                U[i][j] = 0;
            }
        }
    }
    // D
    for(int j=0; j<w; j++){
        for(int i=h-2; i>=0; i--){
            if(s[i][j] == '.'){
                D[i][j] = D[i+1][j] + 1;
            }
            else{
                D[i][j] = 0;
            }
        }
    }

    int ans = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(ans < L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3){
                ans = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3;
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 66816
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int h, w, k; cin >> h >> w >> k;
	vector<vector<char>> a(h, vector<char>(w));
	REP(i, h) REP(j, w) cin >> a[i][j];
	VVI ans(h, VI(w)); int n = 0, flag;
	VI ns(h, 0);
	REP(i, h) {
		n++; flag = 0;
		REP(j, w) {
			if (a[i][j] == '#') {
				if (flag)
					n++;
				flag = 1;
			}
			ans[i][j] = n;
		}
		if (!flag) {
			ns[i] = 1;
			n--;
		}
	}
	
	REP(i, h) {
		if (ns[i]) {
			for(int j = i + 1;j < h;j++) {
				if (!ns[j]) {
					REP(k, w)
						ans[i][k] = ans[j][k];
					break;
				}
			}
		}
	}
	for (int i = h - 1; i >= 0; i--) {
		if (!ns[i]) {
			for(int j = i + 1;j < h;j++) {
				REP(k, w)
					ans[j][k] = ans[i][k];
			}
			break;
		}
	}
	REP(i, h) {
		REP(j, w) cout << ans[i][j] << ' ';
		cout << endl;
	}
}

Measured memory_bytes: 1280
#include <iostream>
#define ll long long
using namespace std;
ll H,W;
char P[10010][1010];
ll solve(ll x,ll y);
ll dp[1010][1010];

int main(){
  //cout<<123<<endl;
  cin>>H>>W;
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin>> P[i][j];
    }
  }
  for(int i=0;i<=H;i++) P[i][0] ='#';
  for (int j=0; j<=W; j++) P[0][j] = '#';
  
  dp[1][1]=1;
  for(ll i=1;i<=H;i++){
    for (ll j=1; j<=W; j++) {
      if(i != 1 or j !=1){
        if(P[i][j]=='.'){
           dp[i][j] = solve(i,j)%1000000007;
        }
        else continue;
      }
      
    }
  }
  cout<<dp[H][W]<<endl;
  
  return 0;
}

ll solve(ll x,ll y){
  ll ans=0;
  if(P[x-1][y] == '.'){
    ans += dp[x-1][y];
  }
  
  if(P[x][y-1] =='.'){
    ans +=dp[x][y-1];
  }
  
  return ans;
  
}



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

ll solve(ll ai, ll aj, ll bi, ll bj) {
  if (aj > bj) {
    swap(ai,bi);
    swap(aj,bj);
  }
  ll s = 1;
  rep(i,30) s *= 3;
  ll dist = abs(ai-bi) + abs(aj-bj);
  ll res = dist;
  while (1) {
    s /= 3;
    if (s <= 0) break;
    ll nai = ai/s, nbi = bi/s;
    if (nai != nbi) break;
    ll naj = aj/s, nbj = bj/s;
    if (nai%3 == 1 && abs(naj-nbj) > 1) {
      ll up = s*nai-1;
      ll bot = nai*s + s;
      ll loss = min(ai,bi) - up;
      loss = min(loss, bot - max(ai,bi));
      res += loss*2;
      break;
    }
  }
  return res;
}

int main() {
  int q;
  cin >> q;
  rep(qi,q) {
    ll ai,aj,bi,bj;
    cin >> ai >> aj >> bi >> bj;
    ai--; aj--;
    bi--; bj--;
    ll ans = 0;
    ans = max(ans, solve(ai,aj,bi,bj));
    ans = max(ans, solve(aj,ai,bj,bi));
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


int32_t main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS
    int x;
    cin>>x;
    if(x)
        cout<<0;
    else
        cout<<1;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define P pair<ll, ll>
#define VI vector<ll>
#define int long long
using namespace std;

int N;
string S;
int l[26];
int r[26];

int count() {
  int num = 0;
  REP (i, 26) {
    if (l[i] && r[i]) {
      num++;
    }
  }
  return num;
}
void solve() {
  int ans = 0;
  for (char c: S) {
    r[c - 'a']++;
  }
  for (char c: S) {
    l[c - 'a']++;
    r[c - 'a']--;
    ans = max(ans, count());
  }
  cout << ans << endl;
}

signed main() {
  cin >> N;
  cin >> S;

  solve();
}


Measured memory_bytes: 256
int main(void){
    // Your code here!
    char b ;
     int A,C,G,T;
   
    scanf("%c",&b);
    if (b=='A'){
        printf("T");
    }
    else if (b=='T'){
        printf("A");
    }
    else if(b=='C'){
        printf("G");
    }
    else if(b=='G'){
       printf("C");
    }
    else {
        printf("");
    }
  }


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N;
    cin >> N;
    string ans = "";
    while(N > 0){
        N -= 1;
        ans += 'a' + N%26;
        N /= 26;
    }
    reverse(all(ans));
    cout << ans;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
int a[N];
bool check(int n){
	for(int i=1;i<=n;i++)if(a[i]==i)return false;
	return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	int n;
	cin>>n;
	int d = 0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]==i)d++;
	}
	int res=0;
	while(!check(n)){
		for(int i=1;i<=n;i++){
			if(a[i]==i){
				if(a[i+1]!=a[i]&&i+1<=n){
					swap(a[i],a[i+1]);
					res++;
				}
				else if(a[i-1]!=a[i]&&i-1>0){
					swap(a[i],a[i-1]);
					res++;
				}
			}
		}
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define N 8
#define NOT_FREE 1
#define FREE -1

int Q[N][N],col[N],row[N],dpos[2*N-1],dneg[2*N-1];

void printBoard(void){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Q[i][j]){
	if(row[i]!=j) return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;
  if(i==N){
    printBoard();
    return;
  }

  for(j=0;j<N;j++){
    if(col[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE) continue;

    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
    
    recursive(i+1);
    
    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}

int main(){
  int i,j,k,r,c;

  for(i=0;i<N;i++) row[i]=col[i]=FREE;
  for(i=0;i<2*N-1;i++) dpos[i]=dneg[i]=FREE;
  
  for(i=0;i<N;i++) for(j=0;j<N;j++) Q[i][j]=0;
  
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    Q[r][c]=1;
    }

  
  recursive(0);

  return 0;
}



Measured memory_bytes: 2112
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const char sigma[]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
const int L=128;
int len,cnt[70];

int query(const string &s){
    cout<<"? "<<s<<endl; 
    int result;
    cin>>result;
    return result;
}

bool check(const string &s){
    return query(s)==len-s.size();
}

string merge(int l,int r){
    if(l==r) return string(cnt[l],sigma[l]);
    int mid=l+r>>1;
    string a=merge(l,mid),b=merge(mid+1,r),res;
    int i=0,j=0;
    while(i<a.size()&&j<b.size()){
        if(check(res+a[i]+b.substr(j))) res+=a[i++];
        else res+=b[j++];
    }
    while(i<a.size()) res+=a[i++];
    while(j<b.size()) res+=b[j++];
    return res;
}

signed main(){
    for(int i=0;i<62;i++) cnt[i]=L-query(string(L,sigma[i])),len+=cnt[i];
    string ans=merge(0,62);
	cout<<"! "<<ans<<endl;
}

Measured memory_bytes: 3780
#include <stdio.h>

int main(void){
    
    int a,b;
    
    for(int i=1; ;i++){
        scanf("%d%d",&a,&b);
        if(a==0&&b==0){
            break;
        }else{
            if(a>b){
                printf("%d %d\n",b,a);
            }else {
                printf("%d %d\n",a,b);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
const int tr[2][2] = {{2, 2}, {1, 3}};
const LL MOD = 1000000007LL;

int n; char s[2][55];

int main(){
	int i, j, prev; LL ans;
	scanf("%d%s%s", &n, s[0] + 1, s[1] + 1);
	if(s[0][1] == s[1][1]) i = 2, prev = 0, ans = 3;
	else i = 3, prev = 1, ans = 6;
	for(; i <= n; i = j){
		if(s[0][i] == s[1][i]) j = i + 1, ans = ans * tr[prev][0] % MOD, prev = 0;
		else j = i + 2, ans = ans * tr[prev][1] % MOD, prev = 1;
	} cout << ans << endl;
	return 0;
}

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

typedef pair<int,int> P;
struct Point{int x,y;};

int main(){
	int n, m;
	while( cin >> m , m ){
		Point a[200], d[200];
		for(int i=0 ; i < m ; i++ ){
			int x, y;
			cin >> x >> y;
			a[i].x = x;
			a[i].y = y;
		}
		for(int i=0 ; i < m ; i++ ){
			d[i].x = a[i].x - a[0].x;
			d[i].y = a[i].y - a[0].y; 
		}
		
		map<P,bool> memo;
		Point b[1000];
		cin >> n;
		for(int i=0 ; i < n ; i++ ){
			int x, y;
			cin >> x >> y;
			b[i].x = x;
			b[i].y = y;
			memo[P(x,y)] = true;
		}
		for(int i=0 ; i < n ; i++ ){
			bool flag = true;
			int x = b[i].x;
			int y = b[i].y;
			for(int j=1 ; j < m ; j++ ){
				int mx = x + d[j].x;
				int my = y + d[j].y;
				if( !memo.count(P(mx,my)) ){
					flag = false;
					break;
				}
			}
			if( flag ){
				cout << (x - a[0].x) << " " << (y - a[0].y) << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;
typedef pair<P,int>P1;
#define pb push_back
#define fi first
#define sc second

int n,k;
vector<int>x,y,z;
bool used[5000005];
int main(){
    cin >> n >> k;
    int m = n/2;
    int a = k+m;
    int b = k+2*n-1;
    while(a < b){
        x.pb(a); y.pb(b);
        used[a-k] = used[b-k] = 1;
        a++; b-=2;
    }
    vector<int>zan;
    rep(x,2*n) if(!used[x]) zan.pb(x);
    rep(i,zan.size()/2) {
        x.pb(zan[i]+k);
        y.pb(zan[zan.size()-1-i]+k);
    }
    for(int i=2*n;i<3*n;i++) z.pb(k+i); reverse(z.begin(),z.end());
    rep(i,n){
        if(x[i]+y[i] > z[i]){ puts("-1"); return 0;}
    }
    rep(i,n) cout << x[i] << " " << y[i] << " " << z[i] << endl;
}

Measured memory_bytes: 4080
#include <stdio.h>

int max(int a, int b){
	return a > b ? a : b;
}

int main(void){
	int n, m;
	scanf("%d %d", &n, &m);
	int left = 1, right = n;
	int l, r;
	for(int i = 0; i < m; i++){
		scanf("%d %d", &l, &r);
		if(left < l) left = l;
		if(r < right) right = r;
	}
	printf("%d\n", max(right - left + 1, 0));
	return 0;
}


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


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

int main() {
	int a, b;
	cin >> a >> b;
	cout << gcd(a, b) << endl;

	return 0;
}

Measured memory_bytes: 3108
/*
Hanit Banga
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 810, inf = 1e6;

void bfs(int i, int j, int h, int w);

char a[N][N];
bool seen[N][N] = {0};
int dist[N][N], dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};

int main()
{
	int h, w, k;
	cin >> h >> w >> k;
	for (int i = 1; i <= h; ++i)
		cin >> (a[i] + 1);

	int x, y;
	for (int i = 1; i <= h; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			if (a[i][j] == 'S')
			{
				x = i;
				y = j;
				break;
			}
		}
	}

	for (int i = 1; i <= h; ++i)
		for (int j = 1; j <= w; ++j)
			dist[i][j] = inf;

	bfs(x, y, h, w);
	int ans = inf;
	for (int i = 1; i <= h; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			if (dist[i][j] <= k)
			{
				int temp = min(min(i - 1, h - i), min(j - 1, w - j));
				temp = (temp / k) + ((temp % k) ? 1 : 0) + 1;
				ans = min(ans, temp);
			}
		}
	}

	cout << ans << endl;
}

void bfs(int i, int j, int h, int w)
{
	seen[i][j] = true;
	dist[i][j] = 0;
	queue <pii> q;
	q.push({i, j});
	while (!q.empty())
	{
		pii cur = q.front();
		q.pop();

		for (int k = 0; k < 4; ++k)
		{
			int x = cur.first + dx[k], y = cur.second + dy[k];
			if (1 <= x and x <= h and 1 <= y and y <= w and !seen[x][y] and a[x][y] == '.')
			{
				seen[x][y] = true;
				dist[x][y] = 1 + dist[cur.first][cur.second];
				q.push({x, y});
			}
		}
	}
}

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

int main() {
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> P(H, vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> P.at(i).at(j);
    }
  }
  
  for(int i=0; i<H+2; i++){
    for(int j=0; j<W+2; j++){
      if( ( 0 == i ) || ( H+1 == i) || ( 0 == j ) || ( W+1 == j ) ){
        cout << '#';
      }
      else{
        cout << P.at(i-1).at(j-1);
      }
    }
    cout << endl;
  } 
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int ketawa(int a) {
	if (a < 10)return a;
	else return a % 10 + ketawa(a / 10);
}

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	cin >> s; vector<int>x(sz(s));
	if (s[0] == 'A' || s[0] == 'T' || s[0] == 'G' || s[0] == 'C')x[0]++;
	for (int i = 1; i < sz(s);i++) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
			x[i] = 1+x[i - 1];
	}
	sort(all(x), greater<int>());
	cout << x[0]<< endl;

	return 0;
}


Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(auto &x:v)
    {
        cin>>x;
    }
    vector<ll> dp1(n);
    vector<ll> dp2(n);
    dp1[0] = v[0];
    dp2[n-1] = v[n-1];
    for(ll i=1;i<n;i++)
    {
        dp1[i] = gcd(dp1[i-1],v[i]);
    }
    for(ll i=n-2;i>=0;i--)
    {
        dp2[i] = gcd(dp2[i+1],v[i]);
    }
    ll mv = 1;
    for(ll i=0;i<n;i++)
    {
        if(i==0)
        {
            mv = max(dp2[i+1],mv);
        }
        else if(i==n-1)
        {
            mv = max(mv,dp1[i-1]);
        }
        else
        {
            mv = max(gcd(dp1[i-1],dp2[i+1]),mv);
        }
    }
    cout<<mv;
    return 0;
}



Measured memory_bytes: 2560
from collections import namedtuple
from itertools import permutations
from math import sqrt

Point = namedtuple('Point', ['x', 'y'])


def main():
    n = int(input())
    points = []
    for _ in range(n):
        x, y = tuple(map(int, input().split()))
        points.append(Point(x, y))

    ans = 0
    cnt = 0

    for perm in permutations(range(n)):
        dist = 0
        for i in range(1, n):
            p1 = points[perm[i-1]]
            p2 = points[perm[i]]
            dist += sqrt(
                ((p1.x - p2.x) ** 2) + ((p1.y - p2.y) ** 2))
        ans += dist
        cnt += 1

    ans = ans / cnt
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	ll gcdd=a[0];
	for(ll i=1;i<n;i++)gcdd=gcd(gcdd,a[i]);
	cout<<gcdd;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  ll a, b, c; cin >> a >> b >> c;
  ll K; cin >> K;
  auto ans = K % 2 == 0;
  cout << (ans ? a-b : b-a) << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

using namespace std;

int main() {
  int n = 0;
  cin >> n;
  long long ans = 0;
  long long sum = 0;  
  for (int i = 0; i < n; ++i) {
    long long x = 0;
    cin >> x;
    if (x == 0) {
      ans += sum / 2;
      sum = 0;
    }
    sum += x;
  }
  cout << ans + sum / 2;
  return 0;
}


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

#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define VPII vector<PII>
#define LD long double
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000 // array max range

int mod(int a1,int a2){ a1%=a2; return ((a1 < 0) ? a1+a2 : a1); }
void mode(int& a1,int a2){ a1%=a2; a1=((a1 < 0) ? a1+a2 : a1); }

int powm(int x,int n,int m){
    int ret=1;
    R(i,n){
        ret*=x;
        //ret%=m;
        mode(ret,m);
    }
    return ret;
}
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(11);
    cerr << fixed << setprecision(6);
    int n;
    cin >> n;
    cout << mod(powm(10,n,MOD) - 2*(powm(9,n,MOD)-powm(8,n,MOD)) - powm(8,n,MOD),MOD) << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  if(a * b < n || a + b - 1 > n) {
    cout << -1 << '\n';
    return 0;
  }
  ll r = a * b - n;
  vl ans;
  rep(i, a) {
    ll nb;
    if(r < b - 1) {
      nb = b - r;
      r = 0;
    } else {
      nb = 1;
      r -= b - 1;
    }
    rep(j, nb) ans.push_back((i + 1) * b - j);
  }
  vl sa = ans;
  sort(all(sa));
  rep(i, n) {
    ll in = lower_bound(all(sa), ans[i]) - sa.begin();
    cout << in + 1 << (i == n - 1 ? '\n' : ' ');
  }
}

Measured memory_bytes: 7884
#include<bits/stdc++.h>
#define fastio ios_base :: sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define all(a) (a).begin() , (a).end()
typedef long long  int ll;
#define rep(i , a , b) for(int i=a;i<b;i++)
using namespace std;




void solve(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])cout << "Yes";
    else cout << "No";
    cout << endl;
}





int  main(){
    fastio
    int test;
    test = 1;
    while(test--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int n[]=new int[3];
		for(int i=0;i<3;i++){
			n[i]=scan.nextInt();
		}
		scan.close();
		int index,tmp;
		for(int i=0;i<2;i++){
			index=i;
			for(int j=i+1;j<3;j++){
				if(n[j]<n[index]) index=j;
			}
			tmp=n[i];
			n[i]=n[index];
			n[index]=tmp;
		}
		for(int i=0;i<3;i++){
			if(i==0) System.out.print(n[i]);
			else System.out.print(" "+n[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 17164