akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        string S;
        cin >> S;
        ll cnt0 = count(all(S), '0');
        ll cnt1 = count(all(S), '1');
        cout << min(cnt0, cnt1) * 2 << endl;
}

Measured memory_bytes: 512
let
  line=readline()
  s,ans=0,0
  for c in line
    if c=='A'||c=='T'||c=='G'||c=='C'
      s+=1
    else
    ans=max(s,ans)
      s=0
    end
  end
  ans=max(ans,s)
  println(ans)
end

Measured memory_bytes: 163996
N = int(input())
X = sorted(list(map(int, input().split())))
if N == 1:
    print(0)
else:
    r = X[-1] - X[0]
    ans = float("inf")
    for i in range(r + 1):
        R = X[0] + i
        hp = 0
        for j in range(N):
            hp = hp + (R - X[j]) ** 2
 
        ans = min(hp, ans)
    print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
  int n,a,i,ans=0;
  bool d[101]={false};
  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%d",&a);
    if (!d[a]){
      ans++;
      d[a]=true;
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

int main()
{
	long long k,a,b,c=0;
    cin>>k>>a>>b;
    if(a>=k)
    {
        cout<<1<<endl;
        return 0;
    }else if(b>=a){
    	cout<<-1<<endl;
        return 0;
	}else if((k-a)%(a-b)>=1){
    	c=1;
	}
    cout<<((k-a)/(a-b)+c)*2+1<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <string>
#include <vector>

double epsilon = 1e-10;

using namespace std;

int main()
{
    int N;
    if (scanf("%d", &N) < 1) return 0;

    vector<double> time(N, 0), limit(N, 0);

    for (int i = 0; i < N; i++)
    {
        if (scanf("%lf", &time[i]) < 1) return 0;
    }

    for (int i = 0; i < N; i++)
    {
        if (scanf("%lf", &limit[i]) < 1) return 0;
    }

    double bk = 0.0;
    int idx = 0;

    int accTime = (signed int)accumulate(time.begin(), time.end(), 0.0);

    // 0.5 単位 制限
    vector<double> limitv(2 * accTime + 1, 0);

    for (int i = 1; i <= 2 * accTime; i++)
    {
        // i * 0.5 < bk + time[idx]
        if (epsilon < bk + time[idx] - i * 0.5) limitv[i] = limit[idx];
        // i * 0.5 = bk + time[idx]
        else if (fabs(bk + time[idx] - i * 0.5) <= epsilon)
        {
            if (idx == N - 1) limitv[i] = limit[idx];
            else
            {
                double dif = limit[idx + 1] - limit[idx];
                if (epsilon < dif) limitv[i] = limit[idx];
                else bk += time[idx], idx++, limitv[i] = limit[idx];
            }
        }
        else if (idx < N - 1) bk += time[idx], idx++, limitv[i] = limit[idx];
    }

    // 0.5 単位 速度
    vector<double> maxv(2 * accTime + 1, 0);

    // 上り 更新
    // 最終地点は zero 初期化した状態
    for (int i = 1; i <= 2 * accTime - 1; i++)
        maxv[i] = min(limitv[i], maxv[i - 1] + 0.5);

    // 下り 更新
    // 上り で更新した値が最小であるならば 採用
    for (int i = 2 * accTime - 1; 0 <= i; i--)
    {
        double tmp = min(maxv[i], limitv[i]);
        maxv[i] = min(tmp, maxv[i + 1] + 0.5);
    }

    // 0.5 単位 距離
    double ans = 0.0;

    // (上底 + 下底) * 高さ * 0.5(割る2)
    for (int i = 1; i <= 2 * accTime; i++)
        ans += (maxv[i - 1] + maxv[i]) * 0.5 * 0.5;

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


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 30);
const double PI = acos(-1);


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	string S;
	int ind = 0;
	if (n == 0) {
		cout << 0 << endl;
		return 0;
	}
	else {
		while (n != 0) {
			if (abs(n) % 2 != 0) {
				S = "1" + S;
				n -= 1;
			}
			else {
				S = "0" + S;
			}
			n /= -2;
		}
	}
	cout << S << endl;
	PAU;
	return 0;
}


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

namespace ABC072A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, x;
            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            x = a - b;

            if (a-b < 0)
                x = 0;

            Console.WriteLine(x);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int a1,a2,a3;
		cin>>a1>>a2>>a3;
		if(a1+a2+a3>=22) cout<<"bust";
		else cout<<"win";
	}   
}     

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

#define MOD (1000000007)

ll frac[100001];

int main(int argc, char **argv) {
	ll n, m;
	cin >> n >> m;
	if (n < m) swap(n, m);

	frac[0] = 1;
	REP(i, 100000) frac[i + 1] = (i + 1) * frac[i] % MOD;

	if (n - m >= 2) {
		cout << 0 << endl;
		return 0;
	}

	ll res = frac[n] * frac[m] % MOD;
	if (n == m) res = res * 2 % MOD;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; i++)
static const long long INF = 1000000;
using p = pair<int,int>;

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int x = 0;
    int ans = 0;
    rep(i,n){
        if (s[i] == 'A'){
            x = 1;
        }
        else if (x == 1 and s[i] == 'B'){
            x = 2;
        }
        else if (x == 2 and s[i] == 'C'){
            x = 0;
            ans ++;
        }
        else {
            x = 0;
        }
        

    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;


int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n);
    int f1,f2;
    for(int i=0;i<=n;i++) cin >>a[i];
    for(int i=0;i<n;i++) cin >>b[i];
    f1=min(a[0],b[0]), f2=min(a[1],b[0]-f1);
    long long sum=0; sum+= f1+f2;
    for(int i=1;i<n;i++){
        f1=min(a[i]-f2,b[i]);
        f2=min(a[i+1],b[i]-f1);
        sum +=f1+f2;
    }
    cout << sum <<endl;
}


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/2;
const ll MOD = 1e9+7;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  ll a[N];
  for(ll i=0;i<N;i++)cin>>a[i];
  ll b[N]={};
  vll ans;
  for(ll i=N;i>>0;i--){
    b[i-1]=a[i-1];
    for(ll j=2*i;j<=N;j+=i){
      b[i-1] ^= b[j-1];
    }
    if(b[i-1]){
      ans.push_back(i);
    }
  }
  cout<<ans.size()<<endl;
  for(ll i=0;i<(ll)ans.size();i++){
    cout<<ans[i]<<(i+1<(ll)ans.size()? " ":"\n");
  }
  return 0;
}


Measured memory_bytes: 5108
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIGN(x) (((x)>0)?1:(((x)<0)?-1:0))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
#define vv(t) vector< t > 
#define CHC(mp, x) if(mp.end() != mp.find(x))
#define CHCV(mp, x) if(mp.end() != find(ALL(mp), x))
template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}
#define fi first
#define se second
#define el endl
#pragma endregion

const string YES = "YES";
const string NO = "NO";

void Main();
void solve();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

#pragma region mint
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
  operator ll() const{return x;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
#pragma endregion

void Main(){
    ll N, K;
    cin >> N >> K;
    vv(ll) A(N);
    REP(i, N){
        int v;
        cin >> v;
        A[i] = v;
    }
    ll n1 = 0;
    ll n2 = 0;
    REP(i, N){
        REP(j, N){
            if(A[i] > A[j]){
                if(i<j){
                    n1++;
                }else{
                    n2++;
                }
            }
        }
    }
    n2 += n1;
    ll cb=K*(K-1)/2;
    mint ans = mint(n1)*mint(K) + mint(cb)*mint(n2);
    cout << ans << el;
}



Measured memory_bytes: 256
import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = int(input())
dic = defaultdict(int)
dic[s] += 1
cnt = 1
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    cnt += 1
    dic[s] += 1
    if dic[s] > 1:
        print(cnt)
        exit()


Measured memory_bytes: 9456
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
#define MOD 1000000007
#define mod9 1000000009
#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define pb push_back
#define ct ll t;cin>>t;while(t--)
#define bi begin()
#define ei end()
#define fi first 
#define se second  
#define foe(i,a,b) for(ll i=a;i<b;i++)
#define rfoe(i,a,b) for(ll i=a;i>=0;i--)
#define sz(s) s.size() 
#define mem(a,s) memset(a,s,sizeof(a)) 
#define all(v) v.bi,v.ei
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL  
// ll MOD; 
ll add(ll a, ll b){return (a%MOD + b%MOD + ((MAX)/MOD)*MOD)%MOD;}
ll sub(ll a, ll b){return (a%MOD - b%MOD + ((MAX)/MOD)*MOD)%MOD;}
ll mul(ll a, ll b){return ((a%MOD)*(b%MOD) + ((MAX)/MOD)*MOD)%MOD;}
ll fact[1000007]={0};
ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
y=y>>1;x=(1ll*x*x)%MOD;} return res;}
void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
int const N=2e5+9;
ll const INF = 2e9+5;
ll n;
    
void solve()
{ 
   ll n;
   cin>>n;
   cout<<n*n<<"\n";

}
int main()
{
    fast
    // ct
      //  freopen("input.txt", "r", stdin);
        //    freopen("output.txt", "w", stdout);
    { 
        solve();
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;

int main()
{
    fastio;
    int N;
    vector<double> vs;
    cin >> N;
    copy_n(istream_iterator<double>(cin), N, back_inserter(vs));

    sort(vs.begin(), vs.end());

    auto value = accumulate(
        vs.begin(), vs.end(), vs.front(),
        [](auto acc, auto n) { return (acc + n) / 2; });

    cout << value << endl;
    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
ls = [[] for i in range(n+1)]

for _ in range(m):
  p,q = map(int,input().split())
  ls[p].append(q)
  ls[q].append(p)
ans = [None]*(n+1)

cur = 1
que = [1]
count = 1
while que:
  cur = que.pop(0)
  for v in ls[cur]:
    if ans[v] == None:
      ans[v] = cur
      que.append(v)
      

print("Yes")
for s in ans[2:]:
  print(s)

Measured memory_bytes: 34356
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int MX=100+1e5;
vvi v(2*MX);
vi used(2*MX,false);
vi cnt(2,0);

void dfs(int i,int n) {
    if(used[i])return;
    used[i] = 1;
    if(i>MX)cnt[1]++;
    else cnt[0]++;
    for(auto j: v[i]) dfs(j,n);
}

int main() {
    int n;
    cin>>n;
    ll ans=0;
    rep(i,n){
        int x,y;
        cin>>x>>y;
        y+=MX;
        v[x].pb(y);
        v[y].pb(x);
    }
    rep(i,MX) {
        if(used[i])continue;
        cnt = vi(2,0);
        dfs(i,n);
        ans+=(ll)cnt[0]*cnt[1];
    }
    fin(ans-n);
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
using P = pair<int, int>;
typedef long long ll;

int main() {
	ll N,M;
	cin>>N>>M;
	vector<ll> A(N);
	rep(i,N)cin>>A[i];
	sort(all(A));
	vector<P> CB;
	ll b,c;
	rep(i,M){
		cin>>b>>c;
		CB.push_back({c,b});
	}
	sort(all(CB), greater<P>());
	ll now = 0;
	rep(i,M){
		b = CB[i].second;
		c = CB[i].first;
		rep(j,b){
			if(A[now]>c){
				j = b;
				i = M;
			}
			else{
				A[now] = c;
				now++;
			}
		}
	}

	ll ans = 0;
	rep(i,N)ans+=A[i];
	cout<<ans<<endl;
}

Measured memory_bytes: 2168
let () =
    let max = 999999 in
    let is_primes = Array.make (max+1) true in
    for x = 2 to max / 2 do
        if is_primes.(x) then (
            for y = 2 to max / x do
                is_primes.(x*y) <- false
            done ;
        ) ;
    done ;

    let n_primes = Array.make (max+1) 0 in
    let count    = ref 0 in
    for x = 2 to max do
        if is_primes.(x) then (
            count := !count + 1
        ) ;
        n_primes.(x) <- !count
    done ;

    try
        while true do
            let n = read_int () in
            Printf.printf "%d\n" (n_primes.(n))
        done
    with
        End_of_file -> ()

Measured memory_bytes: 18168
n = int(input())
A = list(map(int, input().split()))

A.sort()

def comb(x, y):
    p = 1
    d = 1
    for i in range(y):
        p *= x - i
        d *= y -i
    return p // d

diff = -1
ans = [A[n-1], -1]
for a in A[:n-1]:
    new_diff = min(a, A[n-1]-a)
    if diff < new_diff:
        diff = new_diff
        ans[1] = a
print(*ans)


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

int main()
{

                int K;
        string S;
        cin >> K;
        cin >> S;
        int len= S.length();
        if (len <= K) {
                cout << S << endl;
        }
        else {

                for (int i = 0; i < K; ++i) {
                        cout << S[i];
                }
                cout << "..." << endl;

        }


}


Measured memory_bytes: 3628
X = int(input())
if X == 2:
    print(2)
else:
    for i in range(X, 10**6):
        if i%2 == 0:
            continue
        else:
            for j in range(3, int(i**0.5)+1, 2):
                if i%j == 0:
                    break
            else:
                break

    print(i)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		int N = sc.nextInt();
		for(int i = 0; i < N; i++) {
			int num = sc.nextInt();
			if(map.containsKey(num)) {
				System.out.println("NO");
				return;
			}
			map.put(num, 1);
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 100660
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine();
            LinkedList<char> ret = new LinkedList<char>();
            foreach (var s in r)
            {
                switch (s)
                {
                    case '0':
                        ret.AddLast('0');
                        break;
                    case '1':
                        ret.AddLast('1');
                        break;
                    case 'B':
                        if (ret.Any())
                        {
                            ret.RemoveLast();
                        }
                        break;

                }
            }
            Console.WriteLine(new string(ret.ToArray()));

        }
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(a));i>=((int)(b));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int n, a, b; scanf("%d%d%d", &n, &a, &b);
	vector<pair<int, int>> x(n);
	rep(i, n){
		int ta, tb; scanf("%d%d%d", &ta, &tb, &x[i].sec);
		x[i].fir = tb*a-ta*b;
	}
	int s1 = 0, s2 = 0, c = 0;
	sort(x.begin(), x.end());
	for(;x[c].fir<=0; c++) s1 += x[c].fir;
	for(;c<n; c++) s2 += x[c].fir;
	int s = max(-s1, s2);
	
	vector<int> vt(s*2+1, 50000);
	int* dp = &vt[s];
	
	rep(i, n){
		dp[x[i].fir] = min(dp[x[i].fir], x[i].sec);
		if(x[i].fir < 0){
			reg(j, -s, s){
				if(dp[j] != 50000 && j!=x[i].fir) dp[j+x[i].fir] = min(dp[j+x[i].fir], dp[j]+x[i].sec);
			}
		}else{
			ireg(j, s, -s){
				if(dp[j] != 50000 && j!=x[i].fir) dp[j+x[i].fir] = min(dp[j+x[i].fir], dp[j]+x[i].sec);
			}
		}
	}
	
	if(dp[0] == 50000) printf("-1\n");
	else printf("%d\n", dp[0]);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int n; cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    sort(p.begin(), p.end());
    int l = p[n / 2 - 1];   
    int r = p[n / 2];
    cout << r - l << endl;
    return 0;
}


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

int main() {
    int N;
    int AC = 0, WA = 0, TLE = 0, RE = 0;
    string S;
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> S;
        if (S == "AC") AC++;
        else if (S == "WA") WA++;
        else if (S == "TLE") TLE++;
        else if (S == "RE") RE++;
    }

    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(){

int x,y;int t1=2000,t2=2000;

for(int i=0;i<3;i++)
{scanf("%d",&x);if(t1>x)t1=x;}

for(int i=0;i<2;i++)
{scanf("%d",&y);if(t2>y)t2=y;}


t1=t2+t1-50;
printf("%d\n",t1);
return 0;
}

Measured memory_bytes: 1020
from collections import defaultdict
from heapq import heappop, heappush
import itertools
n, m, r = map(int, input().split())
rli = list(map(int, input().split()))
d = []
for i in range(m):#h:高さ
    d.append([int(m) for m in input().split()])


dist = d

class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]
# (src, dst, weight)
inputs = dist

g = Graph()
for src, dst, weight in inputs:
    g.add_edge(src, dst, weight)
    g.add_edge(dst, src, weight)
spdi = {}

for i in rli:
    for j in rli:
        d = Dijkstra(g, i)
        sp = format(d.shortest_distance(j))
        spdi[str(j) + "+" + str(i)] = int(sp)
realroot = float("INF")
for pa in itertools.permutations(rli, len(rli)):
    root = 0
    for i in range(1, len(pa)):
        root += spdi[str(pa[i]) + "+" + str(pa[i - 1])]
    if root < realroot:
        realroot = root

print(realroot)

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  if(k==0){
    cout<<n*n<<endl;
    return 0;
  }
  ll ans=0;
  reps(i,n){
    ans+=max(0LL,i-k)*(n/i)+max(n%i-k+1,0LL);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
//In the name of Allah
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; 

ll gcd( ll a , ll b ) { 
	if( a > b ) return gcd(b,a); 
	if( a == 0 ) return 0;
	//a <= b	
	ll z = b / a; 
	ll ret = gcd( b % a , a ); 
	ret += z * 2 * a; 
	return ret; 
}

int main() {
	ll n , x; 
	cin >> n >> x; 

	cout << n + gcd(x,n-x) - __gcd(x,n-x) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
const int N=3e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
#define x first
#define y second
int x[N],mx[N],f[N];
pair<int,int>p[N];
inline bool cmp(const pair<int,int> &a,const pair<int,int> &b) { return a.y==b.y?a.x<b.x:a.y<b.y; }
int main()
{
	int n=gi(),i,j,l,r,t,mid,len,ans=0;
	for (i=1;i<=n;i++) p[i].x=gi(),p[i].y=x[i]=gi();
	sort(x+1,x+1+n);len=unique(x+1,x+1+n)-x-1;
	for (i=1;i<=n;p[i++].y=l) for (l=1,r=len;l!=r;p[i].y<=x[mid=(l+r)>>1]?r=mid:l=mid+1);
	sort(p+1,p+1+n);
	for (i=1;i<=n;i++) mx[i]=max(mx[i-1],p[i].y);
	for (i=n,t=1<<30;i;i--) p[i]=make_pair(t=min(t,p[i].y),mx[i]);
	sort(p+1,p+1+n,cmp);
	const int mod=1e9+7;
	f[0]=1;
	for (i=1,j=0;i<=n;i++) {
		/*
		for (t=p[i-1].y+1;t<=p[i].y;t++)
			(f[t]+=f[t-1])%=mod;
		t=f[p[i].y];
		if (p[i].x!=1) (t-=f[p[i].x-2])%=mod;
		(f[p[i].y]+=t)%=mod;*/
		while (p[j].y<p[i].x-1) j++;
		f[i]=(f[i-1]-(j?f[j-1]:0)+mod)%mod;
		if (p[i].y==len) (ans+=f[i])%=mod;
		(f[i]+=f[i-1])%=mod;
	}
	//printf("%d\n",(f[len]-f[len-1]+mod)%mod);
	printf("%d\n",(ans+mod)%mod);
	return 0;
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 200020
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

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

	ll allP = 0; // すべての可能性
	allP = count(s.cbegin(), s.cend(), 'R') * count(s.cbegin(), s.cend(), 'G') * count(s.cbegin(), s.cend(), 'B');

	for (int i = 0; i < n; i++) {
		for (int j = 1; j * 2 + i < n; j++) {
			if (s[i] != s[i + j] && s[i] != s[i + j * 2] && s[i + j] != s[i + j * 2]) {
				--allP;
			}
		}
	}
	out(allP);
	return 0;
}


Measured memory_bytes: 3640
n = int(input())
D = list(map(int, input().split()))
m = int(input())
T = list(map(int, input().split()))

from collections import Counter
cntr = Counter(D)
ans = 'YES'
for t in T:
  if cntr.get(t) == None or cntr.get(t) == 0:
    ans = 'NO'
    break
  else:
    cntr[t] -= 1
print(ans)

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


int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  sort(a,a+n);
  int mx = a[n-1];
  int tmp = INT_MAX;
  rep(i,n-1){
    if(a[i]==mx/2||a[i]==mx/2+mx%2){
      cout << mx << ' ' << a[i] << endl;
      return 0;
    }
  }
  int ans;
  rep(i,n-1){
    if(abs(a[i]-mx/2)<=tmp){
      tmp = abs(a[i]-mx/2);
      ans = a[i];
    }
  }
  cout << mx <<' '<< ans << endl;
  return 0;
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SUBL freopen("/home/ajinkya/Desktop/input.txt","r",stdin); freopen("/home/ajinkya/Desktop/output.txt","w",stdout); 
#define ll long long
#define ull unsigned long long
#define FI(i,a,n) for(int i=a; i<=n; i++)
#define RFI(i,n,a) for(int i=n; i>=a; i--)
#define FLL(i,a,n) for(ll i=a; i<=n; i++)
#define RFLL(i,n,a) for(ll i=n; i>=a; i--)
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pi pair<int, int>
#define GCD(a,b) __gcd(a,b)
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define debug(x) cout << x << endl
#define MOD 1000000007
#define INF LLONG_MAX
#define PI 3.14159265359
using namespace std;




int main()
{
    fastio 
    // SUBL
  	ll a, b;
  	cin >> a >> b;
  	if((a+b)&1) cout << "IMPOSSIBLE";
  	else cout << (a+b)/2;
    return 0;
}         	

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char s1[70],s2[70],s3[70],na[1000][70],s[71];
  int st[1010],n,m,i,j,r,p[1010]={-1};
  while(scanf("%d %d",&n,&m),n||m){
    scanf("\n");
    st[0]=-1;
    for(j=0;j<n;j++){
      fgets(s,71,stdin);
      for(i=0;s[i]==' ';i++);
      st[i+1]=j;
      p[j]=st[i];//printf("%s\n",s+i);
      for(r=0;s[i]-10;i++)na[j][r++]=s[i];
      na[j][r]=0;
    }//printf("a\n");
    //for(i=0;i<n;i++)printf("%d\n",p[i]);
    while(m--){
      scanf("%s %*s %*s %s %*s %s",s1,s2,s3);//printf("%s\n",s3);
      s3[strlen(s3)-1]=0;
      for(i=0;strcmp(na[i],s1);i++);//printf("%d\n",i);
      for(j=0;strcmp(na[j],s3);j++);//printf("%d\n",j);
      if(s2[0]=='c'){
	if(j==p[i])printf("True\n");
	else       printf("False\n");
      }
      if(s2[0]=='a'){
	for(;j+1;j=p[j]){
	  if(i==j)break;
	}
	if(i==j)printf("True\n");
	else    printf("False\n");
      }
      if(s2[0]=='s'){
	if(p[i]==p[j])printf("True\n");
	else          printf("False\n");
      }
      if(s2[0]=='p'){
	if(i==p[j])printf("True\n");
	else       printf("False\n");
      }
      if(s2[0]=='d'){
	for(;i+1;i=p[i]){
	  if(i==j)break;
	}
	if(i==j)printf("True\n");
	else    printf("False\n");
      }
    }
    printf("\n");  
  }
  return 0;
}

Measured memory_bytes: 684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
//stoi(s) : string→int stoll(s) :string→longlong  int→string to_string(i)
const double PI = acos(-1.0);
//小数点の表し方 cout << fixed << setprecision(5);

int main(){
    int x,n;
    cin >> x >> n;
    vector<int> p(n);
    map<int,int> m;
    for(int i=0;i<n;i++){
        cin >> p[i];
        m[p[i]] = 1;
    }
    int abs1=x,abs2=0;
    int cnt1=x,cnt2=0;
    if(m[x]==0){
        cout << x << endl;
        return 0;
    }
    for(int i=x;i<=101;i++){
        if(m[i]==0){
            cnt1 = i;
            abs1 = abs(x-i);
            break;
        }
    }
    for(int i=x;i>=-1;i--){
        if(m[i]==0){
            cnt2 = i;
            abs2 = abs(x-i);
            break;
        }
    }
    if(abs2>abs1){
        cout << cnt1 << endl;
    }else{
        cout << cnt2 << endl;
    }
}

Measured memory_bytes: 3632
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define int long long
const int M = 1000 * 1000 * 1000 + 7, N = 2012;
int a[N];

void solve() {
	int s;
	cin >> s;
	int ans = 0;
	for (int n = 1; n <= s; n++) {
		if (n * 3 > s)
			continue;
		int x = s - n * 2;
		for (int i = 0; i < N; i++)
			a[i] = 0;
		a[0] = 1;
		for (int i = 1; i <= x - 1; i++) {
			for (int j = min(i, n - 1); j > 0; j--) {
				a[j] += a[j - 1];
				a[j] %= M;
			}
		}
		ans += a[n - 1];
		ans %= M;
	}
	cout << ans;
}

int32_t main() {
	int t = 1;
//	cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3648
import java.util.Scanner;

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

        while(input.hasNext()){
            int N = input.nextInt();
            int count2 = 0;

            while(N > 0){
                 int a = input.nextInt();

                 while(a % 2 == 0){
                       ++count2;
                       a /= 2;
                 }

                 --N;
            }

            System.out.println(count2);
       }
    }
}

Measured memory_bytes: 33456
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
	ll N, K;
	cin >> N >> K;
	double ans = 0;
	for (ll i = 1; i <= N; i++)
	{
		ll now = i;
		double temp = 1.0 / N;
		while (now < K) {
			now *= 2;
			temp /= 2;
		}
		ans += temp;
	}
	cout << fixed;
	cout <<setprecision(12) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> cur_v(n,0);




	rep (i, n) {
		cin >> cur_v[i];
	}

	rep(i, k) {
		vector<int> next_v(n,0);
		vector<int> imos(n, 0);
		rep(j, n) {
			int l = j - cur_v[j];
			int r = j + cur_v[j] + 1;
			if (l < 0) {
				l = 0;
			}
			imos[l]++;
			if (r < n) {
				imos[r]--;
			}
		}

		int cur = 0;
		rep(j,n) {
			cur += imos[j];
			next_v[j] = cur;
		}

		if (cur_v == next_v) {
			break;
		}
		cur_v = next_v;
	}

	rep(i, n) {
		cout << cur_v[i] << " "; 
	}
	cout << endl;

	return 0;
}


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

using namespace std;

int a, b;

int main(){
    scanf("%d%d", &a, &b);
    if(a <= 0 && b >= 0){
        printf("Zero\n");
    }
    else if(a > 0){
        printf("Positive\n");
    }
    else{
        if((b - a + 1) % 2 == 1)
            printf("Negative\n");
        else
            printf("Positive\n");
    }
}


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll min(ll a , ll b){
    if(a < b)   return a;
    else   return b;
}

ll n;
ll a[MAXX];

int main()
{
    _FastIO;

    cin >> n;

    ll s = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];;
    }
    ll x = 0;
    ll cavab = 0;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        cavab += ((a[i] - x) * (a[i] - x));
    }
    for(ll x = 1; x < 101; x++){
        ll ans = 0;
    for(ll i = 0; i < n; i++){
        ans += ((a[i] - x) * (a[i] - x));
    }
    cavab = min(cavab , ans);
    }
    cout << cavab << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#include <math.h>
#include<iostream>
using namespace std;
typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

#define sf                  scanf
#define pf                  printf
#define srev                reverse(s.begin(),s.end())
#define sortstr             sort(s.begin(), s.end());
#define gtl(x)              getline(cin, (x))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define PI                  acos(-1)
#define Precision(a) cout << fixed << setprecision(a)
#define FasterIO     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());

int main()
{
    string s;
    cin >> s;
    if(s=="hi" || s=="hihi" || s=="hihihi" || s=="hihihihi" || s=="hihihihihi") cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

using namespace std;

const int Nmax = 2e5 + 5;
const int Mod = 1e9 + 7;
const int oo = 2e9;

int k, a, b;

int main()
{
/**
    #ifndef ONLINE_JUDGE

        ifstream cin("test.in");

    #endif // ONLINE_JUDGE
*/

    cin >> k >> a >> b;

    for(int i = a; i <= b; i++)
        if(i % k == 0)
        {
            cout << "OK\n";
            return 0;
        }

    cout << "NG\n";
    return 0;
}


Measured memory_bytes: 3640
import sys
from math import gcd

input = sys.stdin.buffer.readline


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return (i for i in range(n + 1) if is_prime[i])


N = int(input())
A = tuple(map(int, input().split()))
MAX = 10 ** 6


def pairwise(A):
    table = [0] * (10 ** 6 + 1)
    for a in A:
        table[a] += 1
    for p in primes(MAX):
        ct = 0
        for i in range(p, MAX + 1, p):
            ct += table[i]
        if ct > 1:
            return False
    return True


def setwise(A):
    g = A[0]
    for a in A:
        g = gcd(a, g)
    return g == 1


if pairwise(A):
    print('pairwise coprime')
elif setwise(A):
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 210416
N = int(input())
A = list(map(int, input().split()))
B = sorted(A)
B.append(0)
p = B[0]
y = dict()
u = 0
for k in range(N+1):
    q = B[k]
    if p != q:
        y[p] = u
        u = 0
    u += 1
    p = q
All = 0
for l in y.values():
    All +=l*(l-1)//2
for j in range(N):
    x = A[j]
    print(All+(y[x]-1)*(y[x]-2)//2-y[x]*(y[x]-1)//2)

Measured memory_bytes: 25384
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int p = 700;
        String s = sc.next();
        for (int i = 0;i < s.length();++i){
            if(s.charAt(i) == 'o')p += 100;
        }
        System.out.println(p);
    }
}

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

int main() {
    int K, N;
    cin >> K >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    int ans = A[N-1] - A[0];
    rep(i, N-1) {
        ans = min(ans, K - A[i+1] + A[i]);
    }
    cout << ans << endl;
}

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

int main(){
    int n,l;
    int eat;
    cin >> n >> l;
    int L = l;
    int R = l+n-1;

    if(R<=0) eat=R;
    else if(L>=0) eat=L;
    else eat = 0;

    cout << (L+R)*n/2 - eat <<endl;
    return 0;
}


Measured memory_bytes: 384
def m(L,R):
 global c;c+=len(L)+len(R)
 T=[]
 for l in L[::-1]:
  while R and R[-1]>l:T+=[R.pop()]
  T+=[l]
 T+=R[::-1]
 return T[::-1]
def d(A):s=len(A)//2;return m(d(A[:s]),d(A[s:])) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,input().split()))))
print(c)


Measured memory_bytes: 63124
a = [1]
b = [1]
for _ in range(50):
    a.append(2 * a[-1] + 3)
    b.append(2 * b[-1] + 1)

def num_of_patties(n, x):
    if n == 0:
        return 1

    if x == 1:
        return 0
    elif x <= a[n-1] + 1:
        return num_of_patties(n-1, x-1)
    elif x == a[n-1] + 2:
        return b[n-1] + 1
    elif x <= 2 * a[n-1] + 2:
        return b[n-1] + 1 + num_of_patties(n-1, x-a[n-1]-2)
    else:
        return b[n]


print(num_of_patties(*[int(i) for i in input().split()]))


Measured memory_bytes: 9180
import bisect

n, m = [int(_) for _ in input().split(' ')]

p, y = [], []
for _ in range(m):
    temp = [int(_) for _ in input().split(' ')]
    p.append(temp[0])
    y.append(temp[1])
ys = dict()
for i in range(m):
    if not(p[i] in ys):
        ys[p[i]] = []
    ys[p[i]].append(y[i])

for j in ys.keys():
    ys[j].sort()

for i in range(m):
    print('{0}{1}'.format(str(p[i]).zfill(6), str(bisect.bisect(ys[p[i]], y[i])).zfill(6)))


Measured memory_bytes: 29736
# 入力 : 自然数     ex) 12
# 出力 : 約数リスト ex) [(2,2),(3,1)]
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base ** exponent
    return a


# 入力:整数n      ex)100
# 出力:約数リスト ex)[1, 5, 25, 2, 10, 50, 4, 20, 100]
def divisorEnumulation(n):
    divisor = []
    for div in divisorize(factorize(n)):
        divisor.append(num(div))
    return divisor


n = int(input())
# n!を素因数分解すれば約数の個数は自明
fact = [0 for i in range(10 ** 3 + 1)]
for i in range(2, n+1):
    tmpFact = factorize(i)
    for div in tmpFact:
        fact[div[0]] += div[1]
out = 1
for _fact in fact:
    # print(_fact)
    out *= _fact + 1
    out %= 10**9+7
print(out % (10 ** 9 + 7))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define pi pair<ll,ll>
using namespace std;
int getdigit(int num){
	int digit = 0;
	while(num!=0){
		num /= 10;
		digit++;
	}
	return digit;
}
int main(){
	//	freopen("in.txt","r",stdin);
	long long N;
	cin >> N;
	int i;
	for (i = sqrt(N); i >0; --i)
	{
		if(N%i==0) break; 
	}
	cout << getdigit(N/i) << endl;
	return 0;
}

Measured memory_bytes: 256