akhauriyash/Code-Regression huggingface dataset:
from math import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    left_accumulate_gcd = [0 for _ in range(n + 2)]
    right_accumulate_gcd = [0 for _ in range(n + 2)]
    for i in range(n):
        left_accumulate_gcd[i + 1] = gcd(a[i], left_accumulate_gcd[i])
    for i in range(n - 1, -1, -1):
        right_accumulate_gcd[i] = gcd(a[i], right_accumulate_gcd[i + 1])
    ans = 1
    for i in range(n + 1):
        ans = max(ans, gcd(left_accumulate_gcd[i], right_accumulate_gcd[i + 1]))
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 21004
#include "bits/stdc++.h"

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "Yes"
#define NO  "No"

using namespace std;

signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  flag = true;

  string s[3];
  for (int i = 0; i < 3; ++i) cin >> s[i];

  char c = 'a';

  while (s[c - 'a'].length() > 0) {
    // if (s[c - 'a'].length() == 0) break;
    char _c = s[c - 'a'][0];
    s[c - 'a'] = s[c - 'a'].substr(1);
    c = _c;
  }

  if (c == 'a') cout << "A" << endl;
  else if (c == 'b') cout << "B" << endl;
  else cout << "C" << endl;
  
  // cout << num << endl;
  // cout << (flag ? YES : NO) << endl;
  
  return 0;
}


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

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define test int t; cin >> t; while(t--)
#define skip continue
#define stop break
#define sz(v) v.size()
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define EPS 1e-9
#define FR(i, l, r) for(int i = (l); i <= (r); i++)
#define gcd __gcd 
#define FO(i, a) for(auto & i : a)
#define debug(a) cout << #a << ": " << a << endl
#define debug1(a, l, r) FR(i, l, r) cout << a[i] << " "; cout << endl
#define SET(a, b) memset(a, b, sizeof(a));
#define refresh fflush(stdout);

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <pii> vii;
typedef vector <pll> vll;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
//template <typename T> inline void out(T x) { cout << x; }

/*********** TEMPLATE ENDS HERE *************/

main()
{
	int a, b;
	cin >> a >> b;
	cout << a - b + 1;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int INF = 100000000;

int main(){
  int n, m, x, a[13][13], c[13];
  scanf("%d%d%d",&n,&m,&x);
  rep(i,n) {
    scanf("%d",&c[i]);
    rep(j,m) scanf("%d",&a[i][j]);
  }
  
  int ans = INF;
  rep(s,1<<n) {
    int cost = 0;
    int d[13] = {0};
    rep(i,n) {
    	if (s>>i&1) {//ビット演算子を用いて二進数的に事象を調べ上げる
      	  cost += c[i];
          rep(j,m) {
            d[j] += a[i][j];
          }
    	}
    }//各事象のコストの和と理解度の和を求める
    //printf("%d\n",cost);
    
    bool ok = true;
    rep(j,m) {
      //printf("%d\n",d[j]);
      if (d[j] < x) {
        ok = false;
        break;
      }
    }//調べたものが条件を満たしているかを判定する
    
    if((ok) && (cost < ans)) ans = cost;
    //もし最安値を更新したらansに代入
  }
  
  if (ans == INF) printf("%d",-1);
  else printf("%d\n", ans);
  return 0;
  
}
    

Measured memory_bytes: 1688
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int x,y; cin >> x >> y;
    cout << x+y/2 << endl; return 0; 
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <tuple>
#include <map>

using namespace std;

typedef long long ll;
const ll mod =  998244353;
const int inf = 1e9;

#define SIZE 500000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit() {
    inv[1] = 1;
    for (ll i = 2; i <= SIZE; i++) {
        inv[i] = mod - (mod / i)*inv[mod%i] % mod;
    }
    kai[0] = invkai[0] = 1;
    for (ll i = 1; i <= SIZE; i++) {
        kai[i] = kai[i - 1] * i%mod;
        invkai[i] = invkai[i - 1] * inv[i] % mod;
    }
}

ll com(ll a, ll b) {
    if (b < 0 || a < b) return 0;
    return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}

ll po(ll a, ll b) {
    if (b == 0)return 1;
    ll z = po(a, b / 2);
    z = z*z%mod;
    if (b % 2 == 1) z = z*a%mod;
    return z;
}

int main() {
    invinit();
    int n,m,k; cin >> n >> m >> k;
    ll ans = 0;
    for (int i = 0; i <= k; i++) {
        ll res =  m * po(m-1,n-1-i) % mod * com(n-1,i) % mod;
        ans += res;
        ans %= mod;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 15356
/* ex5_3
   key_tree */

#include <stdio.h>
// マス目の範囲を指定
#define ROW 100
#define COL 100

int main(void){
    int row, col, i, j;
    // 黒マスの含まれる行列を1で記録するためのもの
    int brack_row[ROW] = {0}, brack_col[COL] = {0};
    // マス目を受け取る2次元配列
    char value_array[ROW][COL];
    scanf("%d %d",&row, &col);

    // マス目をinput
    for(i = 0; i < row; i++){
        for(j = 0; j < col; j++){
            scanf(" %c", &value_array[i][j]);
        }
    }

    // 黒マスが含まれるとき、1を記録する
    for(i =0; i < row; i++){
        for(j = 0; j < col; j++){
            if(value_array[i][j] == '#'){
                brack_row[i] = 1;
                brack_col[j] = 1;
            }
        }
    }
    for(i = 0; i < row; i++){
        // 黒マスがない行は0となっているので飛ばす
        if(brack_row[i] == 0)
            continue;
        for(j = 0; j < col; j++){
            // 黒マスがない列は0となっているので飛ばす
            if(brack_col[j] == 0)
                continue;
            printf("%c", value_array[i][j]);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll 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 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling, digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vpll flag, D; vll path;
//***********//
//main内でCOMinit(N+1)を忘れずに！
vl fac, finv, inv;
void COMinit(ll N) {
	fac.resize(N);
	finv.resize(N);
	inv.resize(N);
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
	ll x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	COMinit(2100000);
	for (ll r = y1; r <= y2; r++) {
		(ans += (COM(x2 + r + 1, r + 1) - COM(x1 + r, r + 1)) % MOD + MOD) %= MOD;
	}
	co(ans);
}

Measured memory_bytes: 52600
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 100001
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define d double
void solve(){
	int r,c;
	cin>>r>>c;
	vector<string> vec(r);
	rep(i,0,r) cin>>vec[i];
	vvl dp(r,vl(c));
	dp[0][0]=1;
	for(int j=1;j<c&&vec[0][j]!='#';j++) dp[0][j]=1;
	for(int i=1;i<r&&vec[i][0]!='#';i++) dp[i][0]=1;
	for(int i=1;i<r;i++){
		for(int j=1;j<c;j++){
			if(vec[i][j]=='#') dp[i][j]=0;
			else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	cout<<dp[r-1][c-1];
	
	
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
 
}

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
int main(){
    ll n; cin >> n;
    string s;cin >> s;
    bool ok = true;
    if(n%2 == 0){
        string t = s.substr(n/2);
        rep(i,n/2){
            if(s[i] != t[i])ok = false;
        }
    }
    else ok = false;
    cout << (ok ? "Yes" : "No") << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

using Graph = vector<vector<pair<int, ll>>>;

Graph g;
vector<bool> seen;
vector<int> color;

void dfs(int v, int c) {
    seen[v] = true;
    color[v] = c;
    for(auto x : g[v]) {
        if(seen[x.first]) continue;
        if(x.second % 2 == 0) dfs(x.first, c);
        else dfs(x.first, 1-c);
    }
}

int main() {
    int n; cin >> n;
    g.resize(n);
    rep(i, n-1) {
        int u, v; ll w; cin >> u >> v >> w; u--; v--;
        g[u].push_back(make_pair(v, w));
        g[v].push_back(make_pair(u, w));
    }
    seen.resize(n, false);
    color.resize(n, 0);
    dfs(0, 0);
    rep(i, n) cout << color[i] << endl;
}


Measured memory_bytes: 12300
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(ll i=a ; i<n ; i++)
#define r0 return 0;
#define PI 3.141592653589793

int main()
{
	fastio
	ll x;
	cin>>x;
	ll a=100,y=0;
	while(a<x)
	{
		a+=a/100;
		y++;
	}
	cout<<y<<"\n";
}


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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}

// const int mxN = 1e9 + 7;
const int M = 1e9 + 7;

ll pw(ll b, ll e)
{
	ll res = 1;
	while (e)
	{
		if (e % 2)
			res = (res * b) % M;
		b = (b * b) % M;
		e >>= 1; // e/=2;
	}
	return res;
}

int main()
{
	fast;
	int n;
	cin >> n;
	vll a(n), b;
	FOR(n)
	cin >> a[i];
	sort(all(a), greater<int>());
	FOR(n)
	{
		b.pb(a[i]);
		if (i)
			b.pb(a[i]);
	}
	ll ans = 0;
	FOR(n - 1)
	ans += b[i];
	cout << ans << en;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int k;
  string s;
  cin >> s >> k;
  priority_queue<string, vector<string>, greater<string>> v;
  unordered_set<string> st;
  int ss = s.size();
  for (int i = 0; i < ss; ++i) {
    for (int j = 1; i + j <= ss; ++j) {
      if (j > k) continue;
      string ss = s.substr(i, j);
      if (st.find(ss) == st.end()) {
        st.insert(ss);
        v.push(ss);
      }
    }
  }

  rep(i, k - 1) v.pop();
  cout << v.top() << endl;
  return 0;
}


Measured memory_bytes: 1664
import java.util.Scanner;


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

		//????????£????????????
		Scanner sc = new Scanner(System.in);
		//???
		int a = sc.nextInt();


		//?¨?
		int b = sc.nextInt();
		
		//??¢?????¨??¨?????????
		System.out.println(a * b +" "+ (a * 2 + b * 2));
	}
}

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

int main(){
  int n;  cin >> n;
  string s;  cin >> s;
  int l = 0, r = 0;
  for(int i=0; i<n; i++)
    if(s[i] == '(')  r++;
    else
      if(r > 0)  r--;
      else  l++;

  for(int i=0; i<l; i++)  cout << '(';
  cout << s;
  for(int i=0; i<r; i++)  cout << ')';
  cout << endl;

  return 0;
}


Measured memory_bytes: 3628
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    int n;
    cin >> n;
    vll v;
    rep(i,n) {
        ll a;
        cin >> a;
        v.push_back(a);
    }
    sort(v);
    int ans = 1e+9;
    REPI(i, -100, 100) {
      int sum = 0;
      rep(j,v.size()) sum += pow(abs(v[j]-i), 2);
      if(sum<=ans) ans = sum;
    }
    P(ans);

    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long x = Math.abs(sc.nextLong());
    long k = sc.nextLong();
    long d = sc.nextLong();
    if (x / d > k) {
      System.out.println(x - k * d);
    } else {
      long plus = x % d;
      long minus = plus - d;
      long count = k - (x / d);
      if (count % 2 == 0) {
        System.out.println(plus);
      } else {
        System.out.println(Math.abs(minus));
      }
    }
  }
}


Measured memory_bytes: 35564
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;
  cin >> D;
  if (D == 25) {
    cout << "Christmas" << endl;
  }
  
  if (D == 24) {
    cout << "Christmas Eve" << endl;
  }

  if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } 
  
  if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int64, int > Pi;
struct edge {
  int64 to, cost;
};
typedef vector< vector< edge > > Graph;


// なるべく高い位置でいったほうがよさ
// 高さ = 秒数
// コスト = 高さ * 2 + 最初の高さ + 最後の高さがコストっぽい？？
const int64 INF = 1LL << 58;
int N, M, X;
int H[100000];

int64 Dijkstra(const Graph &graph){
  priority_queue< Pi > que;
  vector< int64 > max_height( graph.size(), -INF);
  que.push( Pi( X, 0));
  max_height[0] = X;
  while(!que.empty()){
    Pi p = que.top(); que.pop();
    if(max_height[p.second] > p.first) continue;
    if(p.second == graph.size() - 1) return p.first;
    for(int i = 0; i < graph[p.second].size(); i++){
      const edge& e = graph[p.second][i];
      int64 next_height = min< int64 >( H[e.to], p.first - e.cost);
      if(max_height[e.to] >= next_height) continue;
      max_height[e.to] = next_height;
      que.push( Pi( next_height, e.to));
    }
  }
  return INF;
}

int main(){
 
  cin >> N >> M >> X;
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }
  Graph graph(N);
  for(int i = 0; i < M; i++){
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    if(H[a] - c >= 0) graph[a].push_back( (edge){ b, c});
    if(H[b] - c >= 0) graph[b].push_back( (edge){ a, c});
  }
  int64 ret = Dijkstra(graph);

  if(ret == INF) cout << -1 << endl;
  else  cout << X + H[N - 1] - ret * 2 << endl;
}

Measured memory_bytes: 18792
# -*- coding: utf-8 -*-
import fractions

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

left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
  left[i + 1] = (fractions.gcd(left[i], a[i]))
  right[n - i - 1] = (fractions.gcd(right[n - i], a[n - 1 - i]))

ans = 0
for i in range(n):
  ans = max(ans, fractions.gcd(left[i], right[i + 1]))

print(ans)


Measured memory_bytes: 16124
n=int(input())
import math
import itertools
zahyou=[[0,0]]
for i in range(n):
    tmp=[int(x) for x in input().split()]
    zahyou.append(tmp)

    ans=0
    
for seq in itertools.permutations(range(1,n+1)):
    dist=0
    for i in range(len(seq)-1):
        dist+=math.sqrt((zahyou[seq[i]][0]-zahyou[seq[i+1]][0])**2+(zahyou[seq[i]][1]-zahyou[seq[i+1]][1])**2)
    ans+=dist

print(ans/math.factorial(n))

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

map<int64_t, int64_t> mp;

int64_t com(int64_t u){
    return u * (u - 1) / 2;
}

int main(){
    int64_t n;
    cin >> n;
    int64_t a[n];
    for(int64_t i = 0; i < n; i++){
        int64_t tmp;
        cin >> tmp;
        a[i] = tmp;
        mp[tmp]++;
    }
    int64_t c = 0;
    for(auto p = mp.begin(); p != mp.end(); p++){
        c += com(p -> second);
    }
    for(int64_t i = 0; i < n; i++){
        cout << c - (mp[a[i]] - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 11008
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.next();
        char[] c = str.toCharArray();

        int count = 0;

        for (int i = 0; i < c.length; i++) {
            if (c[i] == 'o') {
                count++;
            }
        }

        if (count + 15 - c.length >= 8) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

        sc.close();
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

int main(){
  vector<vector<ll>> c(3, vector<ll>(3));
  ll sum = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      ll a;
      cin >> a;
      sum +=a;
      c[i][j] = a;
    }
  }
  bool check = false;
  for (int a1 = 0; a1 <= 100; a1++) {
    ll b1 = c[0][0] - a1;
    ll b2 = c[0][1] - a1;
    ll b3 = c[0][2] - a1;
    ll a2 = c[1][0] - b1;
    ll a3 = c[2][0] - b1;
    if(3*(a1+a2+a3+b1+b2+b3)==sum)check = true;
  }
  if(check)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    vector<int> A(3);
    FOR(i, 0, 3) {
        cin >> A[i];
    }
    if (A[0]+A[1]+A[2] >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    
    
    
    return 0;
}


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

using namespace std;




int main(int argc, char *argv[])
{
	string t;

	cin >> t;

	for (size_t i = 0; i < t.length(); ++i){
		if (t[i] == '1'){
			t[i] = '9';
		}
		else{
			t[i] = '1';
		}
	}
	cout << t << endl;

	return 0;
}



Measured memory_bytes: 256
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,t,n){"use strict";e.exports=function(e){for(var t=e[0]+"z",n=t.length,r=0,o=0,u=0;u<n;u++)"A"==t[u]?r++:"B"==t[u]&&"C"==t[u+1]?(o+=r,u++):r=0;console.log(o)}},function(e,t){e.exports=require("fs")}]);

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

using namespace std;

typedef long long LL;
typedef double LF;

#define clr(x, y) memset(x, y, sizeof(x))

const int MAXN = 1e5 + 15;

int fa[MAXN], p[MAXN], n, m, cnt, fafa[MAXN];
set <int> vec[MAXN], vec1[MAXN];
bool vis[MAXN];

inline int getfa(int x){return fa[x] == x ? fa[x] : fa[x] = getfa(fa[x]);}

void work(){
	scanf("%d %d", &n, &m); for(int i = 1; i <= n; i ++) fa[i] = i;
	for(int i = 1; i <= n; i ++) scanf("%d", &p[i]);
	for(int i = 1; i <= m; i ++){
		int x, y; scanf("%d %d", &x, &y);
		int f1 = getfa(x), f2 = getfa(y);
		if(f1 != f2) fa[f1] = f2;
	}
	for(int i = 1; i <= n; i ++){
		int fafafa = getfa(i);
		if(vis[fafafa]) continue;
		vis[fafafa] = 1; fafa[fafafa] = ++ cnt;
	}
	for(int i = 1; i <= n; i ++){
		int j = fafa[getfa(i)];
		vec[j].insert(i);
		vec1[j].insert(p[i]);
	}
	int ans = 0;
	//for(set <int> ::iterator it = vec[1].begin(); it != vec[1].end(); it ++) cout<<*it<<" "; cout<<endl;
	for(int i = 1; i <= cnt; i ++){
		set <int> ::iterator it1 = vec1[i].begin();
		for(set <int> ::iterator it = vec[i].begin(); it != vec[i].end(); it ++){
			if(*it < *it1) continue;
			while(*it > *it1 && it1 != vec1[i].end()) it1 ++;
			if(*it == *it1) ans ++;
		}
	} printf("%d\n", ans);
}

int main(){
	work();
	return 0;
}
/*
3 3
3 2 1
1 2
2 3
*/

Measured memory_bytes: 20224
/*
h s, d't skp th si tll i's svedclTabCtrl
 * ABC141 E
 * ABC145 D
 * ABC147 F
 * ABC174 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
if(y%2==0)
{
int h=y/2;
int k=y/4;
if(y%4!=0)
{
k++;
}
if(x>=k && x<=h)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
else
{
cout<<"No"<<endl;
}
}
/*
 *||||

 */

Measured memory_bytes: 3636
import sys
from typing import List, Tuple


def rec(state: int, v: int, dp: List[List[int]],
        edges: List[List[Tuple[int, int]]]) -> int:
    if (dp[state][v] >= 0):
        return dp[state][v]
    if ((1 << V) - 1 == state and v == 0):
        # Reach all vertices and get back to the starting point.
        dp[state][0] = 0
        return 0

    ans = sys.maxsize
    for to, cost in edges[v]:
        if (not (state >> to & 1)):
            ans = min(ans, rec(state | 1 << to, to, dp, edges) + cost)
    dp[state][v] = ans
    return ans


if __name__ == "__main__":
    V, E = map(lambda x: int(x), input().split())
    edges: List[List[Tuple[int, int]]] = [[] for _ in range(V)]
    for _ in range(E):
        source, target, cost = map(lambda x: int(x), input().split())
        edges[source].append((target, cost))

    dp = [[-1] * V for _ in range(1 << V)]
    print(dp[0][0] if rec(0, 0, dp, edges) != sys.maxsize else -1)



Measured memory_bytes: 17296
def partition(A,p,r):
  q = p
  for i in range(p,r):
    if A[i][1] <= A[r][1]:
      A[q],A[i] = A[i],A[q]
      q += 1

  A[q],A[r] = A[r],A[q]
  return q

def quicksort(A,left,right):
  if left < right:
    q = partition(A,left,right)
    quicksort(A,left,q-1)
    quicksort(A,q+1,right)

def check_stable(A):
  for i in range(1,len(A)):
    if A[i-1][1] == A[i][1]:
      if A[i-1][2] > A[i][2]:
        return "Not stable"
  return "Stable"

n = int(input())
data = []
for i in range(n):
  mark, num = map(str,input().split())
  data += [[mark,int(num),i]]

quicksort(data,0,len(data) -1)
print(check_stable(data))

for line in data:
  print(line[0],line[1])



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

if abs(n-m) >= 2:
  print(0)
  exit()

mod = 10**9+7
ans = 1
# 犬の組み合わせを取得
for i in range(1, n+1):
  ans *= i
  ans %= mod

# 犬の組み合わせに猿の組み合わせを入れる
for j in range(1, m+1):
  ans *= j
  ans %= mod

# 犬と猿が同数の場合は組み合わせが倍になる
# （例） 
# 同数の場合 ⚪⚫⚪⚫ or ⚫⚪⚫⚪
# 片方が多い場合 ⚪⚫⚪⚫⚪
if n == m:
  ans *= 2
  ans %= mod
  
print(ans)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int x, y, z; cin >> x >> y >> z;
  int n = x + y + z;
  struct person { lint a, b, c; };
  V<person> p(n);
  for (int i = 0; i < n; i++) {
    int a, b, c; cin >> a >> b >> c;
    p[i] = person{a, b, c};
  }
  sort(p.begin(), p.end(), [](person x, person y) { return x.a - x.b > y.a - y.b; });

  V<lint> g(z + 1);
  priority_queue<lint> pq;
  for (int i = 0; i < x; i++) {
    pq.push(p[i].c - p[i].a);
    g[0] += p[i].a;
  }
  for (int i = 0; i < z; i++) {
    if (p[x + i].c - p[x + i].a < pq.top()) {
      g[i + 1] = g[i] + p[x + i].a + pq.top();
      pq.pop();
      pq.push(p[x + i].c - p[x + i].a);
    } else {
      g[i + 1] = g[i] + p[x + i].c;
    }
  }

  V<lint> s(z + 1);
  priority_queue<lint>().swap(pq);
  for (int i = 0; i < y; i++) {
    pq.push(p[n - 1 - i].c - p[n - 1 - i].b);
    s[0] += p[n - 1 - i].b;
  }
  for (int i = 0; i < z; i++) {
    if (p[x + z - 1 - i].c - p[x + z - 1 - i].b < pq.top()) {
      s[i + 1] = s[i] + p[x + z - 1 - i].b + pq.top();
      pq.pop();
      pq.push(p[x + z - 1 - i].c - p[x + z - 1 - i].b);
    } else {
      s[i + 1] = s[i] + p[x + z - 1 - i].c;
    }
  }

  lint res = 0;
  for (int i = 0; i < z + 1; i++) res = max(res, g[i] + s[z - i]);
  cout << res << '\n';
}

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

int main() {
    int mn = 124;
    int mx = 0;
    int k, d;
    for (int i = 0; i < 5; i++) {
        cin >> d;
        mn = min(mn, d);
        mx = max(mx, d);
    }
    cin >> k;
    cout << (mx - mn > k ? ":(" : "Yay!") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	string a, b;
	cin >> a >> b;
	string a1 = "GREATER", a2 = "LESS", a3 = "EQUAL";
	if(a.size() > b.size()){
		cout << a1 << endl;
	}else if(a.size() < b.size()){
		cout << a2 << endl;
	}else{
		bool flag = false;
		rep(i, a.size()){
			if(a[i] > b[i]){
				cout << a1 << endl;
				flag = true;
				break;
			}else if(a[i] < b[i]){
				cout << a2 << endl;
				flag = true;
				break;
			}
		}
		if(flag == false){
			cout << a3 << endl;
		}
	}
	return 0;
}

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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int[] h = new int[n];
			for (int i = 0; i < n; i++) {
				h[i] = cin.Int();
			}

			int max = h[0];
			for (int i = 0; i < n; i++) {
				if (h[i] <= max - 2) {
					Console.WriteLine("No");
					return;
				}

				max = Math.Max(max, h[i]);
			}

			Console.WriteLine("Yes");
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;
		
		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 25056
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    }
    for i in 0..n {
        for j in 0..n {
            if i * 4 + j * 7 == n {
                print!("Yes");
                return;
            }
        }
    }
    print!("No");
}



Measured memory_bytes: 2200
(* グラフ上の各点の最短距離を求める *)
(* グラフ上の点の数 n と 各辺の長さ e を引数に取る *)
(* 辺が存在しない場合は各辺の長さに10000とかを入れておく *)
let warshallFloydAlgorithm : int -> int array array -> int array array = fun n e ->
  let d = Array.make_matrix n n 0 in
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      d.(i).(j) <- e.(i).(j)
    done
  done;

  for k = 0 to n - 1 do
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
        if (d.(i).(j) > d.(i).(k) + d.(k).(j)) then
          d.(i).(j) <- d.(i).(k) + d.(k).(j)
      done
    done;
  done;
  d
  
let () =
  let (n, m, l) = Scanf.sscanf (input_line stdin) "%d %d %d" (fun a b c -> (a, b, c)) in
  let e = Array.make_matrix n n 100000000000 in
  for i = 0 to m - 1 do
    let (a, b, c) = Scanf.sscanf (input_line stdin) "%d %d %d" (fun a b c -> (a, b, c)) in
    e.(a - 1).(b - 1) <- c;
    e.(b - 1).(a - 1) <- c;
  done;
  for i = 0 to n - 1 do
    e.(i).(i) <- 0
  done;
  let d = warshallFloydAlgorithm n e in
  let ones = Array.make_matrix n n 100000000000 in
  for i = 0 to n - 1 do
    ones.(i).(i) <- 0
  done;
  for i = 0 to n - 1 do
    for j = 0 to n - 1 do
      if (d.(i).(j) <= l) then
        ones.(i).(j) <- 1
    done
  done;
  let ans = warshallFloydAlgorithm n ones in
  let q = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let ansl = Array.make q (-1) in
  for i = 0 to q - 1 do
    let (s, t) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in 
    if ans.(s - 1).(t - 1) < 100000000000 then
      ansl.(i) <-  ans.(s - 1).(t - 1) - 1
  done;
  for i = 0 to q - 1 do
    print_int ansl.(i);
    print_newline ()
  done;


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

using namespace std;

using int64 = long long;

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

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

  vector<int> ys = xs;
  sort(ys.begin(), ys.end());

  for (int i = 0; i < n; i++) {
    if (xs[i] == ys[n - 1]) cout << ys[n - 2] << endl;
    else cout << ys[n - 1] << endl;
  }
}


Measured memory_bytes: 3200
def euclidean_algorithm(nums)
  x = nums.max
  y = nums.min
  loop do
    z = x % y
    break y if z == 0
    x = y
    y = z
  end
  return y
end

nums = gets.chomp.split(" ").map(&:to_i)
puts euclidean_algorithm(nums)

Measured memory_bytes: 8628
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int k;cin>>k;
    cout<<(k/2)*((k+1)/2)<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

bool ok(int k, int a, int b, int c){
	DEBUG("%d %d %d %d\n", k, a,  b, c);
	if(k == 0){
		return a < b && b < c;
	} else {
		return ok(k-1, a*2, b   ,c  ) ||
		       ok(k-1, a  , b*2 ,c  ) ||
		       ok(k-1, a  , b   ,c*2);
	}
}

int main(){
	int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k);
	if(ok(k, a, b, c)) printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 3760
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	char str[n];
	getchar();
	int x = 0;
	int max = 0;
	for(int i = 0; i < n; i++){
		scanf("%c", &str[i]);
		if(str[i] == 'D'){
			x--;
		} else{
			x++;
		}
		if(x > max){
			max = x;
		}
	}
	printf("%d", max);
	return 0;
}

Measured memory_bytes: 1708
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		//		int n = ni();
		//
		//		long ans = 1l;
		//
		//		long limit = (long) Math.pow(10, 18);
		//
		//		boolean minusflg = false;
		//		boolean zeroflg = false;
		//
		//		for (int i = 0; i < n; i++) {
		//			ans *= nl();
		//
		//			if (ans < 0l) {
		//				minusflg = true;
		//			}
		//
		//			if (ans == 0l) {
		//				zeroflg = true;
		//				break;
		//			}
		//
		//		}
		//
		//		if (zeroflg) {
		//			ans = 0l;
		//		} else if (minusflg || ans > limit) {
		//			ans = -1l;
		//		}
		//		out(ans);

		BigDecimal a = new BigDecimal(n());
		BigDecimal b = new BigDecimal(n());

		BigDecimal ans = a.multiply(b);

		out(ans.toBigInteger());

	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 36020