akhauriyash/Code-Regression huggingface dataset:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(4100000)

INF = 1 << 60

# ここから書き始める
n = int(input())
h = list(map(int, input().split()))
dp = [INF] * n
dp[0] = 0
for i in range(n):
    if i + 1 < n:
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
    if i + 2 < n:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[-1])


Measured memory_bytes: 16268
public class Main {
	public static void main(String[] args){
		java.util.Scanner sc = new java.util.Scanner (System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a < b){
				System.out.println("a < b");
			}else if(a > b){
				System.out.println("a > b");
			}else{
				System.out.println("a == b");
			}
	}
}

Measured memory_bytes: 26308
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,T;
  cin >>N>>T;
  
  vector<int> c(N),t(N);
  int sensor=0;
  
  for(int i=0;i<N;i++){
    cin >>c.at(i)>>t.at(i);
    
    if(t.at(i)>T){
      c.at(i)=1001;
      sensor++;
    }
  }
  sort(c.begin(),c.end());
  if(sensor==N){cout<<"TLE"<<endl;}
  else{cout <<c.at(0)<<endl;}
  
}

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

template<typename T> inline int chkmin(T &x, T y) { return x > y ? x = y, 1 : 0; }

const int MAXN = 1e5 + 1;
const int MAX = 16;
const int MX = 1 << MAX;

int n, mask, val[MAXN], cnt[MAX];
int ans = 0, rem, dp[MX], status[MX];

int main() {
    mask = (1 << 15) - 1;
    scanf("%d", &n);
    for (int i = 1; i < n; ++i) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        val[u] ^= w, val[v] ^= w;
    }

    for (int i = 0; i < n; ++i) ++cnt[val[i]];
    for (int i = 1; i <= 15; ++i) ans += cnt[i] >> 1, rem |= (cnt[i] & 1) << i - 1;

    // rem 即还剩下多少种数没有被消掉
    // 接下来发现对于一个集合，如果要令这个集合全为 0，那么就意味着这个集合里的数原先异或和为 0（操作不改变集合的异或和）

    for (int i = 1; i <= mask; ++i) dp[i] = __builtin_popcount(i) - 1;
    for (int i = 1; i <= mask; ++i)
        for (int j = 1; j <= 15; ++j)
            if (i >> j - 1 & 1)
                status[i] ^= j;
    
    for (int i = 1; i <= mask; ++i)
        if (!status[i])
            for (int j = i - 1; j; j = j - 1 & i)
                if (!status[j])
                    chkmin(dp[i], dp[j] + dp[i ^ j]);
    
    printf("%d\n", ans + dp[rem]);

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define ff first
#define ss second
#define pi pair<ll,ll>
#define maxn 1000002
#define mod 1000000007

//vector<ll>adj[maxn];
//ll vis[maxn];
//ll cc[maxn];

//ll curr_cc;

ll arr[1000001];

ll f(ll x){
	ll res=0;
    while(x){
        res++;
        ll z=__builtin_popcount(x);
        x%=z;
    }
    return res;
}

int main(){
	ll n,cnt=0;
	string s;
	cin>>n>>s;
	
	for(int i=0;i<n;i++){
		cnt+=s[i]=='1';
	}
	
	vector<ll>a1(n+1,1),a2(n+1,1);
	
	for(int i=1;i<=n;i++){
		a1[i]  =  (a1[i-1]*2LL)%(cnt+1);
		if(cnt>1)
		a2[i] = (a2[i-1]*2LL)%(cnt-1);
	}
	ll x1=0,x2=0;
	for(int i=0;i<n;i++){
		x1 = (x1*2LL + (s[i] == '1'))%(cnt+1);
		
		if(cnt>1){
			x2 = (x2*2LL + (s[i] == '1'))%(cnt-1);
		}
	}
	
	for(int i=0;i<n;i++){
		if(s[i] == '1'){
			if(cnt == 1){
				cout<<"0\n";
				continue;
			}
			else{
				ll res = (x2 - a2[n-i-1] +cnt-1)%(cnt-1);
				cout<<1+ f(res)<<'\n';
			}
		}
		else{
			ll res = (x1 +a1[n-i-1])%(cnt+1);
			cout<<1+f(res)<<"\n";
		}
	}

}
	
	
	
	



Measured memory_bytes: 6752
#include<iostream>
#include<algorithm>
using  namespace  std;
int  main (){
int  d[10];
for(int  i = 1;  i<= 4;  i++)d[i] = 0;
for(int  i = 0;  i<6;  i++){
int  z;
scanf("%d" , &z );
d[z]++;
}
int ans=0;
if(d[1]>=3 || d[2]>=3 || d[3]>=3 || d[4]>=3) ans=1;
if(ans==1)printf("NO\n");
else printf("YES\n" );
}

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

#define ll long long
#define fr first
#define se second

using namespace std;

const long long N = 2e6 + 7;

int res;
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = min( a, d );
    d -= min( a, d );
    d -= min( b, d );
    ans -= min( c, d );
    cout << ans;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

bool valid(string s) {
    for(int i=0; i<=(s.size()-1)/2; i++) 
        if(s[i] != s[s.size()-1-i]) return false;
    return true;
}

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

    if(valid(S) && valid(S.substr(0, (S.size()-1)/2)) && valid(S.substr((S.size()+3)/2-1)))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
}

int main(){
    deque<char> deq;
    {
        string str;
        cin >> str;
        foreach(i,str){
            deq.push_back(i);
        }
    }
    function<void(char)> f1 = [&](char x){
        deq.push_front(x);
    };
    function<void(char)> f2 = [&](char x){
        deq.push_back(x);
    };
    bool front = true;
    ll q = in();
    rep(query,q){
        ll kind = in();
        if(kind==1){
            swap(f1,f2);
            front = !front;
        }else{
            ll isfront = in()==1;
            char c;
            cin >> c;
            if(isfront){
                f1(c);
            }else{
                f2(c);
            }
        }
    }
    while(deq.size()){
        char c;
        if(front){
            c = deq.front();
            deq.pop_front();
        }else{
            c = deq.back();
            deq.pop_back();
        }
        cout << c;
    }
    cout << endl;


    return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N;
  while(cin >>N && N){
    int ans = 0;
    REP(i, N/ 4){
      int n; cin >>n;
      ans += n;
    }
    cout <<ans <<endl;
  }
  return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> flag(101);
	REP(i, N){
		int input;
		cin >> input;
		flag[input] = 1;
	}
	int ans = 0;
	REP(i, 101){
		ans += flag[i];
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
// abc113_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int X, Y;
    cin >> X >> Y;
    
    print(X + Y / 2);


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================




int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	
	double R;
	cin >> R;
	
	cout << 2 * R * PI;
	







}





Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N; cin>>N;
  int ans=-1;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  int key=0;
  rep(i,0,N){
    key=A[key]-1;
    if(key==1){
      ans=i+1;
      break;
    }
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 1024
import sys, heapq, bisect, math, fractions
from collections import deque

N, M = map(int, input().split())
AB = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(M)]

AB.sort(key=lambda x: x[1])
res = 0
bridge = 0

for a, b in AB:
    if not a <= bridge: 
        res += 1
        bridge = b - 1

print(res)


Measured memory_bytes: 31112
#include<bits/stdc++.h>
using namespace std;
double dp[3000];

int main(){
    int n;cin>>n;
    dp[0]=1;
    double ph;
    for(int i=1;i<=n;i++){
        cin>>ph;
        for(int j=i;j>=0;j--){
            dp[j]=(j==0?0:dp[j-1]*ph)+dp[j]*(1-ph);
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++){
        //cout<<dp[i]<<" ";
        ans+=dp[i];
    }
    printf("%.10f\n",ans);
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n, m;
    cin >> n >> m;
    priority_queue<P> pq;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i];

    }
    sort(all(v));

    while(m--) {
        int b, c;
        cin >> b >> c;
        pq.push(MP(c, b));

    }

    int p = 0;
    while(p < v.size() && !pq.empty()) {
        P tmp = pq.top();
        while(tmp.S > 0 && p < v.size() && tmp.F > v[p]) {
            v[p] = tmp.F;
            tmp.S--;
            ++p;

        }
        pq.pop();
    }

    LL res = 0;
    for(int i = 0; i < n; ++i) {
        res += v[i];

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 1784
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define NL << endl

using namespace std;
using ll = long long;

template<typename T>
using Matrix = vector<vector<T>>;

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

int main() {

	int n, k;

	cin >> n >> k;

	if (n % k == 0) {
		cout << 0 NL;
	} else {
		cout << 1 NL;
	}


	return 0;

}


Measured memory_bytes: 256
import sys
import time
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
import bisect
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**21

def routes_from_zero(r,c, factorial, gyaku):
    ret = 0
    for i in range(r + 1):
        tmp = 1
        tmp *= factorial[i+c+1]
        # tmp %= MOD
        tmp *= gyaku[c]
        # tmp %= MOD
        tmp *= gyaku[i+1]
        # tmp %= MOD

        ret += tmp
        ret %= MOD

    return ret

def main():
    r1, c1, r2, c2 = getlist()
    # factorial = [1]
    # tmp = 1
    # t1 = time.time()
    # for i in range(1, r2 + c2 + 5):
    #     tmp *= i
    #     tmp %= MOD
    #     factorial.append(tmp)
    # print(time.time() - t1)
    # gyaku = [pow(i, MOD - 2, MOD) for i in factorial]
    # print(time.time() - t1)
    SIZE = 2 * 10 ** 6 + 10 ** 5
    SIZE += 1
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
    factorial = fac
    gyaku = finv
    # print(time.time() - t1)
    # return
    # gyaku = [1 for i in range(2000000)]
    # print(routes_from_zero(r2, c2))
    # print(routes_from_zero(r1, c2))
    # print(routes_from_zero(r2, c1))
    # print(routes_from_zero(r1, c1))
    ans = routes_from_zero(r2, c2, factorial, gyaku) - routes_from_zero(r1 - 1, c2, factorial, gyaku)\
          - routes_from_zero(r2, c1 - 1, factorial, gyaku) + routes_from_zero(r1 - 1, c1 - 1, factorial, gyaku)
    print(ans % MOD)

if __name__ == '__main__':
    main()


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int n,q;
  cin >> n >> q;
  vector<pair<int,pair<int,int>>> v(2*n);
  int s,t,x;
  rep(i,n){
    cin >> s >> t >> x;
    v[2*i]={s-x,{x,1}};
    v[2*i+1]={t-x,{x,0}};
  }
  sort(all(v));
  map<int,int> mp;
  int idx=0,d;
  rep(t,q){
    cin >> d;
    while(idx<2*n){
      if(v[idx].first>d) break;
      if(v[idx].second.second){
        mp[v[idx].second.first]++;
      }else{
        auto itr = mp.find(v[idx].second.first);
        itr->second--;
        if(itr->second==0) mp.erase(itr);
      }
      idx++;
    }
    if(mp.size()==0) cout << -1 << endl;
    else cout << (mp.begin()->first) << endl;
  }
  return 0;
}


Measured memory_bytes: 15360
/*
ex3_4
tomatokan
*/
#include<stdio.h>
 
int main(void){
    int n;
    int flag=0;/*bは出力がyesなら1,noなら0*/
    scanf("%d",&n);
    for (int i=0;i<9;i++){
        /*nが(i+1)の段にあるか判定*/
        if(n%(i+1)==0&&n/(i+1)<=9){
            printf("Yes\n");
            flag=1;
            break;
        }
    }
    if (flag==0){
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> value(N);
  for(int i = 0;i < N;i++){
    cin >> value.at(i);
  }
  sort(value.begin(),value.end());
  double ans = 0.0;
  ans = (value.at(0) + value.at(1)) / 2.0;
  //cout << fixed << setprecision(16) << ans << endl;
  for(int i = 2;i < N;i++){
    ans = (ans + value.at(i)) / 2.0;
  }
  cout << fixed << setprecision(16) << ans << endl;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=a;i<=b;++i)
#define FOR(i,a,b) for(register int i=a;i>=b;--i)
using namespace std;
typedef long long ll;

const int maxn=3e5+10,mod=998244353;
int s[maxn];
ll jc[maxn],inv[maxn];

inline ll qpow(ll a,ll x)
{
	ll ret=1;
	while(x)
	{
		if(x&1)
			ret=ret*a%mod;
		x>>=1;
		a=a*a%mod;
	}
	return ret;
}

int main()
{
	ll aa,bb,ans=0,n,a,b,k,x,y,gcd,lcm,bs;
	cin>>n>>a>>b>>k;
	jc[0]=1;
	For(i,1,maxn-1)
		jc[i]=jc[i-1]*i%mod;
	inv[maxn-1]=qpow(jc[maxn-1],mod-2);
	FOR(i,maxn-1,1)
		inv[i-1]=inv[i]*i%mod;
	For(i,0,n)
	{
		int j=(k-a*i)/b;
		if(k-a*i<0)
			break;
		if(j<=n&&b*j+a*i==k)
			(ans+=jc[n]*inv[i]%mod*inv[n-i]%mod*jc[n]%mod*inv[j]%mod*inv[n-j])%=mod;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    ll a;double b;
    cin >>a >>b;
    ll ib = b*100+0.5;
    ll ans = ib*a/100;
    cout<<ans<<endl;
}
    



Measured memory_bytes: 3716
#include<cstdio>
#include<cstring>
const int maxn=105;
char a[maxn],b[maxn],c[maxn],flag='a';
int x,y,z;
int main()
{
	scanf("%s %s %s",a,b,c);
	int lena=strlen(a),lenb=strlen(b),lenc=strlen(c);
	while(x<=lena && y<=lenb && z<=lenc)
	{
		if(flag=='a')
		{
			flag=a[x];
			x++;
		}
		else if(flag=='b')
		{
			flag=b[y];
			y++;
		}
		else
		{
			flag=c[z];
			z++;
		}
	}
	if(x==lena+1) printf("A");
	else if(y==lenb+1) printf("B");
	else printf("C");
	return 0;
}

Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>
using namespace std;
int main()
{
	string A;
	cin >> A;
	if (A=="Sunny")
	{
		cout << "Cloudy" << endl;
	}
	else if (A == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else if (A == "Rainy") {
		cout << "Sunny " << endl;
	}
}


Measured memory_bytes: 256
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

#pragma endregion

const int N = 100005;

int n, a, b, c, d;

pls give {
    AC;
    cin >> n;
    if (n >= 30) cout << "Yes" << nl;
    else cout << "No" << nl;
}
    

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

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

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    while(cin>>a)
    {
        int digit=a%10;
        if(digit==2 || digit==4 || digit==5 || digit==7 || digit==9)
        {
            cout<<"hon"<<endl;
        }
        else if(digit==0 || digit==1 || digit==6 || digit==8)
        {
            cout<<"pon"<<endl;
        }
        else
        {
            cout<<"bon"<<endl;
        }
    }
}

Measured memory_bytes: 3600
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
bool palindrome(int x) {
	string s = to_string(x), t = s;
	reverse(t.begin(), t.end());
	return s == t;
}
int main() {
	int A, B;
	cin >> A >> B;
	int ret = 0;
	for (int i = A; i <= B; i++) {
		ret += palindrome(i);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 2000 + 10, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
vl v;
ll n, a, b, x;
inline bool can(ll m) {
	ll z = 0;
	for (auto u : v) {
		ll l = 0, r = m, ans = -1;
		while (l <= r) {
			ll mid = (l + r) >> 1;
			if (mid * a + (m - mid) * b >= u) {
				r = mid - 1;
				ans = mid;
			} else
				l = mid + 1;
		}
		z += ans;
		if (z > m || ans == -1)
			return false;
	}
	return true;
}
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	cin >> n >> a >> b;
	ll l = 1, ans, r = 5;
	lp(i,1,n)
	{
		cin >> x;
		r += ((x + (a - 1)) / a);
		v.pb(x);
	}
	sort(allr(v));
	while (l <= r) {
		ll mid = (l + r) >> 1;
		if (can(mid)) {
			r = mid - 1;
			ans = mid;
		} else
			l = mid + 1;
	}
	f(ans);
	return 0;
}

Measured memory_bytes: 1400
# _*_ coding:utf-8 _*_
#  Atcoder_EducationDP_ContestX-1_other1
#  TODO https://atcoder.jp/contests/dp/tasks/dp_a
#  参考文献 https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E8%A7%A3%E6%B3%95
#  C++ バージョンを上から書き下す
#  TODO　配る型DP https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E5%88%A5%E8%A7%A3-1-%E9%85%8D%E3%82%8B-dp
import sys

# 初期化
# 足場の数となる要素数は足場の値の最大値であるMAX
blockMAXElement = 100010
blockElementRange = range(0,blockMAXElement,+1)
# DPテーブルの中身は今回は最小値を求めるため最大値を利用

dp = [sys.maxsize] * blockMAXElement
# コスト
# 参考文献のC++では配列は宣言時に初期化されるがpythonはそれがないのでまずはあえて0で初期化
h = [0] * blockMAXElement

N = int(input().strip())
inputh = list(map(int,input().strip().split(' ')))
# h配列を入力データから取り出した物に置き換える
for i  in range(0,len(inputh),+1):
	h[i] = inputh[i]

# 初期の条件 0歩の時だけはコストがないので、0にセット
dp[0] = 0
# 現在の位置から最後の一歩手前(N-2歩き目)まで(仮にそこで2歩進んだ場合もDPテーブルはあるのでエラーにはならず)
for position in range(0,N-1,+1):
#   現在の岩場で最適な値のコスト
	nowMinCost = dp[position]
#   1歩進んだときのコスト計
	nextOneCost = nowMinCost+abs(h[position+1]-h[position])
#   一歩次の足場で設定されている足場へのコストより小さくなるならそれを改めて入れる
	if nextOneCost < dp[position+1]:
		dp[position+1]=nextOneCost
#   2歩足場をまたいだケースを考える。貰う場合と異なるのはpositionは0から始めて良いし
#   逆にN-2の石の足場から2歩飛んでもプログラム上ではエラーにならない
#   それ以降は1個手前からと同じ
	nextTwoCost = dp[position]+abs(h[position+2]-h[position])
	if nextTwoCost < dp[position+2]:
		dp[position+2] = nextTwoCost

print("{}".format(dp[N-1]))

Measured memory_bytes: 15592
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	string s , t ; 
	cin >> s >> t ;
	cout << t+s << endl;
	
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3648
<?php
  
fscanf(STDIN, "%d %d %d", $n, $a, $b);
$total = 0;
for($i =1; $i <= $n; $i++) {
    $sum = 0;
    $i = "$i";
    for($temp = 0; $temp < strlen($i); $temp++) {
        $sum += $i[$temp];
        //  continue 2 とすると、外側のループの次回の処理から続行
        if($sum > $b) continue 2;
    }
    if($sum >= $a) $total += $i;
}
echo($total);

Measured memory_bytes: 4856
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int n, q;
    cin >> n >> q;
    
    string s;
    cin >> s;
    
    vector<char> t(q), d(q);
    for (int i = 0; i < q; i++) {
        cin >> t[i] >> d[i];
    }
    
    auto f = [&](int i) {
        for (int j = 0; j < q; j++) {
            if (t[j] == s[i]) {
                if (d[j] == 'L') {
                    i--;
                    
                    if (i < 0) {
                        return -1;
                    }
                } else {
                    i++;
                    
                    if (i >= n) {
                        return 1;
                    }
                }
            }
        }
        
        return 0;
    };
    
    int ans = n;
    
    {
        int ok = -1;
        int ng = n;
        
        while(ng - ok > 1) {
            int m = (ok + ng) / 2;
            
            if (f(m) == -1) {
                ok = m;   
            } else {
                ng = m;
            }
        }
        
        ans -= ok + 1;
    }
    
    {
        int ok = n;
        int ng = -1;
        
        while(ok - ng > 1) {
            int m = (ok + ng) / 2;
            
            if (f(m) == 1) {
                ok = m;   
            } else {
                ng = m;
            }
        }
        
        ans -= n - ok;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 1088
MOD = 10**9+7


def solve(n, m, ax):
    bx = []

    for i in range(n):
        is_broken = ax[i]
        if i == 0:
            if is_broken == 1:
                bx.append(0)
            else:
                bx.append(1)
        elif i == 1:
            if is_broken == 1:
                bx.append(0)
            else:
                bx.append(bx[0]+1)
        elif is_broken == 1:
            bx.append(0)
        else:
            if ax[i-2] == 1 and ax[i-1] == 1:
                bx.append(0)
            elif ax[i-2] == 1 and ax[i-1] == 0:
                bx.append(bx[i-1])
            elif ax[i-2] == 0 and ax[i-1] == 1:
                bx.append(bx[i-2])
            else:
                bx.append(bx[i-2] + bx[i-1])


    return bx[-1] % MOD


if __name__ == '__main__':
    n, m = map(int, input().split())
    ax = [0]*(n)
    for i in range(m):
        ax[int(input())-1] += 1

    print(solve(n, m, ax))


Measured memory_bytes: 460788
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
const int D = 60;
ll to[D][200005];

signed main(){
	//cout << fixed << setprecision(10);
	rep(i,0,100100){
		int n; cin>>n;
		if(n==0)return 0;
		cout<<"Case "<<i+1<<": "<<n<<endl;
	}

	return 0;
}


Measured memory_bytes: 3008
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll num[50];
//ll num2[50];
ll num[3][3];
set<ll> sll;
//map<string,ll> mp,mp1;
//map<string,ll>::iterator iter;


int main(void)
{
    long long int sum=0,range=0,ceiling;
    double ans=0.0,d;
    long long int m,n,o,i,j,k=1,money;
    long long int a,a1=0,a2=0,a3=0,ar=1,as=1,at1;
    string s;
    char c;
    a=a1=a2=a3=0;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    for(i=0;i<3;i++)
        for(j=0;j<3;j++)
        {
            cin>>a1;
            num[i][j]=a1;
            sll.insert(a1);
        }
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a;
        if(sll.find(a)==sll.end()) continue;
        sum++;
        for(j=0;j<3;j++)
        {
            for(k=0;k<3;k++)
            {
                if(num[j][k]==a) num[j][k]=0;
            }
        }
    }
    if(sum<3) cout<<"No";
    else
    {
        if(num[0][0]==num[0][1]&&num[0][0]==num[0][2]) cout<<"Yes";
        else if(num[1][0]==num[1][1]&&num[1][0]==num[1][2]) cout<<"Yes";
        else if(num[2][0]==num[2][1]&&num[2][0]==num[2][2]) cout<<"Yes";
        else if(num[0][0]==num[1][0]&&num[0][0]==num[2][0]) cout<<"Yes";
        else if(num[0][1]==num[1][1]&&num[0][1]==num[2][1]) cout<<"Yes";
        else if(num[0][2]==num[1][2]&&num[0][2]==num[2][2]) cout<<"Yes";
        else if(num[0][0]==num[1][1]&&num[0][0]==num[2][2]) cout<<"Yes";
        else if(num[2][0]==num[1][1]&&num[2][0]==num[0][2]) cout<<"Yes";
        else cout<<"No";
    }
    return 0;
}





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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    const string first = "MARCH";
    ll n; cin >> n;
    vector<ll> cnt(26, 0);
    rep(i, n) {
        string name; cin >> name;
        cnt[name[0]-'A']++;
    }
    vector<ll> v;
    each(c, first) {
        v.pb(cnt[c-'A']);
    }
    ll ans = 0;
    rep(i, 1<<first.size()) {
        if (__builtin_popcount(i) != 3) continue;
        ll x = 1;
        rep(j, first.size()) {
            if (i>>j & 1) {
                x *= v[j];
            }
        }
        ans += x;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out
//入出力：http://kaitei.net/cpp/iostream/
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

int N;
long T[100];
long ans;

long gcd(long a, long b)
{
    if (a < 0) a = -a;
    if (b < 0) b = -b;
    while (b != 0) {
        a %= b;
        if (a == 0) return b;
        b %= a;
    }
    return a;
}

long lcm(long a, long b) {
    if( a == 0 && b == 0)return 0;
    return a / gcd(a, b) * b;
}

void solve(){
	long least_common_multiple = 1;
	for(int i=0;i<N;i++){
		least_common_multiple = lcm(least_common_multiple,T[i]);
	}
	ans = least_common_multiple;
}

int main(){
	cin >> N;
	for(int i=0;i<N;i++) cin >> T[i];

	solve();

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){

int a,b,c;

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

        int n = 0, count = 0;
            for(n = a; n <= b; n++) {
      
                if(c % n == 0) {
                    count++;
            }
                }
                
            
            printf("%d\n",count);
            
    return 0;    
    
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int sq(int x) {
  int t = sqrt(x) + 1;
  while (t * t < x) ++t;
  while (t * t > x) --t;
  if (t * t == x) return t;
  else return -1;
}

int sq2(int x) {
  if (x % 2) return 0;
  return sq(x / 2);
}

int was[2][605][605];
array<vii, 2> v;
int n;

bool in(int i, int j) {
  return i >= 0 && j >= 0 && i < 2 * n && j < 2 * n;
}

void dfs(int i, int j, int t, int col) {
  if (was[t][i][j]) return;
  was[t][i][j] = col;
  for (pii p : v[t]) {
    int ni = i + p.first, nj = j + p.second;
    if (in(ni, nj)) dfs(ni, nj, t, 3 - col);
  }
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  array<int, 2> d;
  cin >> n >> d[0] >> d[1];
  for (int i = 0; i < 2; ++i) {
    for (int a = 0; a * a <= d[i]; ++a) {
      int b = sq(d[i] - a * a);
      if (b < 0) continue;
      v[i].emplace_back(a, b);
      v[i].emplace_back(-a, b);
      v[i].emplace_back(a, -b);
      v[i].emplace_back(-a, -b);
    }
  }
  for (int t = 0; t < 2; ++t) {
    for (int i = 0; i < 2 * n; ++i) for (int j = 0; j < 2 * n; ++j) if (!was[t][i][j]) dfs(i, j, t, 1);
  }
  vi cnt(4);
  for (int i = 0; i < 2 * n; ++i) for (int j = 0; j < 2 * n; ++j) {
    int ind = was[0][i][j] - 1 + 2 * (was[1][i][j] - 1);
    assert(ind >= 0 && ind < 4);
    cnt[ind]++;
  }
  int ma = 0;
  for (int i = 0; i < 4; ++i) ma = max(ma, cnt[i]);
  for (int m = 0; m < 4; ++m) if (cnt[m] == ma) {
    int c = 0;
    for (int i = 0; i < 2 * n; ++i) for (int j = 0; j < 2 * n; ++j) if (m == was[0][i][j] - 1 + 2 * (was[1][i][j] - 1)) {
      if (c == n * n) break;
      ++c;
      cout << i << ' ' << j << endl;
    }
    break;
  }
  return 0;
}

Measured memory_bytes: 26240
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    string s;
    cin >> s;
    int n = s.size();
    map<int,int> m;
    int sum = 0;
    m[0]++;
    ll ans = 0;
    ll pow10 = 1;
    rrep(i,n) {
        sum += (s[i]-'0')*pow10;
        sum %= 2019;
        pow10 = pow10*10%2019;
        ans += m[sum];
        m[sum]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3736
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
inputb = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

x = int(inputb[0])
y = int(inputb[1])

ans = a*b - x*b - y*a + x*y
print(ans)

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

#define int long long

using namespace std;

int pw (int x) {
    int ans = 1;
    for (int i = 1; i <= x; i++) ans *= 10;
    return ans;
}

void solve(){
    int pos = 0;
    for (int i = 1; i <= 10; i++) {
        cout << "? " << pw(i) << endl;
        string s;
        cin >> s;

        if (s == "N") {
            pos = i;
            break;
        }
    }

    if (!pos) {
        for (int i = 0; i <= 9; i++) {
            cout << "? " << pw(i) + 1 << endl;
            string s;
            cin >> s;

            if (s == "Y") {
                cout << "! " << pw(i) << endl;
                return;
            }
        }
    }

    int l = pw(pos - 1);
    int r = pw(pos) - 1;

    while (l <= r) {
        int mid = (l + r) >> 1;
        cout << "? " << mid * 10 << endl;
        string s;
        cin >> s;

        if (s == "Y") r = mid - 1;
        else l = mid + 1;
    }

    cout << "!" << " " << l << endl;
    return;
}

signed main(){
    solve();
    return 0;
}

Measured memory_bytes: 596
from fractions import gcd

n=int(input())
a_1=list(map(int,input().split()))
a_2=list(reversed(a_1))
l=[0]
r=[0]

for i in range(n):
    l.append(gcd(l[i],a_1[i]))  

for i in range(n):    
    r.append(gcd(r[i],a_2[i]))
    
r=list(reversed(r))

m=[]
for i in range(n):
   m.append(gcd(l[i],r[i+1])) 

print(max(m))

Measured memory_bytes: 96480
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=a;i>=1;i--)
  {
    if(a%i==0 && b%i==0)
      c--;
    if(c==0)
    {
      cout<<i;
      return 0;
    }
  }
}

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

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, k;
	cin >> n >> k;
	ll h[n+1];
	for(ll i = 1; i <= n; i++){
		cin >> h[i];
	}
	ll dp[n+1];
	dp[1] = 0;
	for(ll i = 2; i <= n; i++){dp[i] = INF;}
	rep(i, 1, n){
		for(ll j = 1; j <= k; j++){
			if(i+j <= n){
				dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]), dp[i+j]);
			}
		}
	}
	print(dp[n])
	return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];

    bool ok = false;
    rep(i, N) rep(j, N) {
        if ((i + M - 1 > N - 1) or (j + M - 1 > N - 1)) continue;
        bool same = true;
        rep(a, M) rep(b, M) {
            if (not(B[a][b] == A[i + a][j + b])) same = false;
        }
        if (same) ok = true;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256