akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds; 
using namespace std;
 
#define ld long double
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define int long long
#define ull unsigned long long 
#define pii pair<int,int>
#define vii vector<int>
#define f first
#define s second
#define endl "\n"
#define all(container) container.begin(), container.end()
#define onlyunique(v) v.erase(unique(all(v)), v.end());
 
#define TRACE
#ifdef AYUSH
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const unordered_set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const ordered_set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << '{'<<v.first << ' ' << v.second << '}'; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero)
 
int const mod = 1e9+7;
int const inf = 1e18;
 
int power(int x, int y, int mod = 2e18){ int ans = 1;x %= mod;while(y){if(y&1)ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
int modinv(int a, int m){return power(a, m-2, m);}
const ld PI = 3.1415926535897932384626433832795;

void solve() {
    int n, x, t; cin >> n >> x >> t;
    int ans = (n/x + ((n)%x==0?0:1)) * t;
    cout << ans << endl;
}
signed main() {
    IOS
    int t = 1, T = 1;
    // cin>>t;
    while (t--) {
        // cout<<"Case #"<<T<<": ";
        solve();
        // ++T;
    }
    return 0;
}

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<int> A;
    cin >> n;
    A.resize(n);
    for (int i = 0; i < n; i++)
        cin >> A[i];
    sort(A.begin(), A.end());
    // cout << "A: " << A << endl;
    int ans = 0;
    int ans2 = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            auto first = A.begin() + j + 1;
            auto last = lower_bound(A.begin(), A.end(), A[i] + A[j]);
            ans += last - first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
n, a, b = list(map(int, input().split()))
m = 10**9 + 7

def func(n, i):
    x = 1
    y = 1
    for j in range(1, i+1):
        x = (x * (n - (j - 1))) % m
        y = (y * j) % m
    return (x * pow(y, m-2, m)) % m

print(((pow(2, n, m) - 1 - func(n, a) - func(n, b)) % m))



Measured memory_bytes: 38640
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())

    N = int(input())
    As = list(map(int, input().split()))

    allprod = 1
    for A in As:
        allprod *= A
    
    total = 0
    for A in As:
        total += allprod / A

    print(allprod / total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int k;

void dfs(ll x, int& cnt, vector<ll>& v, int& keta) {
    if (keta > 12) return;
    v.push_back(x);
    int last = x % 10;
    int next = keta + 1;
    for (int i = max(0, last-1); i <= min(last+1, 9); i++) {
        dfs(10 * x + i, cnt, v, next);
    }
}

int main() {
    cin >> k;

    vector<ll> v;
    //rep(i, 9) v.push_back(i+1);
    rep(i, 9) {
        int cnt = 0;
        int keta = 1;
        dfs(i+1, cnt, v, keta);
    }
    sort(all(v));
    cout << v[k-1] << endl;
}


Measured memory_bytes: 18792
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  string s;
  cin>>s;
  int re=0;
  rep(i,s.size()-1) re+=s[i]!=s[i+1];
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 512
n = input()
if len(n) ==1:
    print(int(n))
elif len(n) == 2:
    print(9)
elif len(n) == 3:
    print(9 + int(n) - 100 + 1)
elif len(n) == 4:
    print(9 + 900)
elif len(n)==5:
    print(9 + 900 + int(n) - 10000 + 1)
else:
    print(9 + 900 + 90000)

Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iomanip>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a[3 * n];
    rep(i, 0, 3 * n) cin >> a[i];
    sort(a, a + 3 * n);

    ll rsl = 0;
    rep(i, 0, n) {
        rsl += a[3 * n - 2 * i - 2];
    }
    cout << rsl << endl;

}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
# define pb push_back
# define FOR(i,a,n) for(int i=a;i<n;i++)
# define mp make_pair
# define RFOR(i,a,n) for(int i=n;i>a;i--)
# define pii pair<long long int,long long int>
#define ub upper_bound
#define lb lower_bound
#define MOD 1000000007
typedef long long int ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
        cout.tie(0);
	ll n;
	cin>>n;
	ll arr[n];
	ll sum=0;
	ll mark[100009]={0};
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		mark[arr[i]]++;
		sum+=arr[i];
	}
	ll q;
	ll c,b,k;
	cin>>q;
	while(q--)
	{
		cin>>b>>c;
		k=mark[b];
		mark[c]+=mark[b];
		sum-=b*k;
		sum+=c*k;
		mark[b]=0;
		cout<<sum<<endl;
	}
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= 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
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n;
  string s;
  int q;
  cin >> n >> s >> q;
  vector<set<int>> ch(26);
  rep(i, n) ch[s[i]-'a'].insert(i+1);
  vector<int> ans;
  rep(K, q) {
    int f; cin >> f;
    if(f == 1) {
      int i;
      char c;
      cin >> i >> c;
      rep(j, 26) ch[j].erase(i);
      ch[c-'a'].insert(i);
    }
    else {
      int l, r; cin >> l >> r;
      int count = 0;
      rep(j, 26) if(ch[j].lower_bound(l) != ch[j].upper_bound(r)) ++count;
      ans.push_back(count);
    }
  }
  for(auto x : ans) cout << x << endl;
}


Measured memory_bytes: 27480
#include <iostream>
#include <vector>
#include <set>
#include <cassert>
constexpr int P = 1'000'000'007;
int n;
std::vector<int> a, deg, ans, b;
std::set<int> s;
std::set<std::pair<int, int>> d;
std::vector<bool> used;
void dfs(int c, int lim) {
    if (c == n) {
        for (int i = 0; i < n; ++i)
            std::cout << ans[i] + 1 << " \n"[i == n - 1];
        exit(0);
    }
    for (int i = 0; i < int(b.size()); ++i) {
        if (used[b[i]] || b[i] == lim)
            continue;
        ans[c] = b[i];
        used[b[i]] = true;
        dfs(c + 1, a[b[i]]);
        used[b[i]] = false;
    }
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cin >> n;
    if (n == 2) {
        std::cout << -1 << "\n";
        return 0;
    }
    a.resize(n);
    deg.resize(n);
    ans.resize(n);
    used.resize(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> a[i];
        --a[i];
        ++deg[a[i]];
    }
    for (int i = 0; i < n; ++i)
        s.insert(i);
    for (int i = 0; i < n; ++i)
        d.emplace(-deg[i], i);
    int lim = -1;
    for (int i = 0; i < n - 5; ++i) {
        int u;
        if (-d.begin() -> first == n - i - 1) {
            u = d.begin() -> second;
        } else if (*s.begin() != lim) {
            u = *s.begin();
        } else {
            u = *std::next(s.begin());
        }
        s.erase(u);
        d.erase({-deg[u], u});
        used[u] = true;
        if (!used[a[u]]) {
            d.erase({-deg[a[u]], a[u]});
            --deg[a[u]];
            d.emplace(-deg[a[u]], a[u]);
        }
        lim = a[u];
        ans[i] = u;
    }
    b.assign(s.begin(), s.end());
    dfs(std::max(0, n - 5), lim);
    std::cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 11520
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, k; cin>>n>>k;
    double ans=0;
    for(int i=1; i<=n; i++){
        double p=1.0/(double)n;
        int a=i;
        while(a<k){
            a*=2;
            p*=0.5;
        }
        ans+=p;
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
dp=[0]*N
dp[1]=abs(A[1]-A[0])

for i in range(2,N):
    dp[i]=min((dp[i-2]+abs(A[i]-A[i-2])),dp[i-1]+abs(A[i]-A[i-1]))

print(dp[-1])


Measured memory_bytes: 13980
n=int(input())

ans=n
for i in range(n+1):
    count=0
    pow6=6
    while pow6<=i:
        count+= (i%(pow6*6))//pow6
        pow6*=6
    pow9=9
    while pow9<=n-i:
        count+= ((n-i)%(pow9*9))//pow9
        pow9*=9
    count+= (i%6)+((n-i)%9)
    ans=min(ans,count)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	char ch1, ch2;
	cin >> ch1 >> ch2;
	if (ch1 > ch2)cout << '>' << endl;
	else if (ch1 < ch2)cout << '<' << endl;
	else cout << "=" << endl;
}

Measured memory_bytes: 256
n =int(input())
a = int(input())
b =[a]
v = 0
if a == 1:
    v = 1
if a%2 ==1:
    ans = 1
else:
    ans = -1
    q = 1
for i in range(1,n):
    a = int(input())
    b.append(a)
    if a == 1:
        v =1
    if a%2==1:
        v= 1
if ans == 1 or v == 1:
   print('first')
else:
    print('second')

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

int main() {
	while (1) {
		int a, b;
		cin >> a >> b;
		if (a + b == 0)
			break;
		for (int i = 1; i <= a * b; i++) {
			if (i % b == 0){
				cout << "#" << endl;
				continue;
			}
			if (i < b || i > a * b - b || i % b == 1)
				cout << "#";
			else
				cout << ".";
		}
		cout << endl;
	}
}



Measured memory_bytes: 3052
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    s = list(input())
    s.reverse()
    len_s = len(s)
    t = 0
    while True:
        if t == len_s:
            print("YES")
            exit()
        elif t > len_s:
            break
        else:
            if "".join(s[t:t+5]) == "maerd":
                t += 5
            elif "".join(s[t:t+7]) == "remaerd":
                t += 7
            elif "".join(s[t:t+5]) == "esare":
                t += 5
            elif "".join(s[t:t+6]) == "resare":
                t += 6
            else:
                break
    print("NO")


if __name__=="__main__":
    main()


Measured memory_bytes: 10000
#include <stdio.h>
#include <string.h>

int
main(int argc, char *argv[])
{
  int n; char s[100][100]; int min_length = 51; int k; 
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%s", s[i]);
    if(min_length > strlen(s[i])){
	min_length = strlen(s[i]);
	k = i;
    }
  }

  char t[100]; int l; int flag[100];
  if(k != 0){
  strcpy(t, s[k]); strcpy(s[k], s[0]); strcpy(s[0], t);
  }

  for(int i = 0; i < min_length; i++){
    l = 0;
    for(int j = 1; j < n; j++){
      for(int x = 0; x < strlen(s[j]); x++){
	if(s[j][x] == s[0][i]){
	  s[j][x] = '.';
	  l++;
	  break;
	}
      }
    }
    if(l == n - 1) flag[i] = 1;
    else flag[i] = 0;
  }

   char ss[100]; int h = 0;

  for(int i = 0; i < min_length; i++){
    if(flag[i] == 1){
      ss[h] = s[0][i];
      h++;
    }
  }

  ss[h] = '\0';

  char d;

  for(int i = 0; i < h - 1; i++){
    for(int j = i + 1; j < h; j++){
      if(ss[i] > ss[j]){
	d = ss[i];
	ss[i] = ss[j];
	ss[j] = d;
      }
    }
  }

  printf("%s\n", ss);

  return 0;
}

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

int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a;
  return 0;
}

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

using namespace std;
typedef pair<string, int> P;

int main() {
  int n;
  cin >> n;
  
  vector<P> st(n);
  for (int i = 0; i < n; ++i) {
    string s;
    int t;
    cin >> s >> t;
    st[i] = P(s, t);
  }
  
  string x;
  cin >> x;
  bool should_add = false;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (should_add) ans += st[i].second;
    if (st[i].first == x) should_add = true;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
P = 10**9 + 7

N = int(input())
A = [int(x) for x in input().split()]

S, T = 0, 0
for i in range(N):
    S = (S + A[i]) % P
    T = (T + A[i] * A[i]) % P

U = (S * S - T) % P
ans = (U * (5 * 10**8 + 4)) % P
print(ans)

Measured memory_bytes: 31900
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	long first;
	long second;

	Pair(long first, long second) {
		this.first = first;
		this.second = second;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		String s = in.next();
		String t = in.next();
		HashMap<Character, Character> map = new HashMap<Character, Character>();
		HashMap<Character, Character> map2 = new HashMap<Character, Character>();
		char arr[] = s.toCharArray();
		char arr2[] = t.toCharArray();
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			if (map.containsKey(arr[i]) && map.get(arr[i]) != arr2[i]) {
				flag = true;
				break;
			}
			if (map2.containsKey(arr2[i]) && map2.get(arr2[i]) != arr[i]) {
				flag = true;
				break;
			}
			map.put(arr[i], arr2[i]);
			map2.put(arr2[i], arr[i]);
		}
		if (flag) {
			pw.println("No");
		} else {
			pw.println("Yes");
		}
	}

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

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 28172
#include <iostream> 
#include <cstring> 
using namespace std;
int c[1001][1001];

int lcs(string x, string y)
{
    int maxl = 0;
    int m = x.length(), n = y.length();
 
    for (int i = 0; i <= m; i++) c[i][0] = 0;
    for (int j = 0; j <= n; j++) c[0][j] = 0;


    for (int i = 1; i <= m; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (x[i-1] == y[j-1])
            { 
                // if(i==0 || j==0) c[i][j] = 1;
                c[i][j] = c[i-1][j-1] + 1; 
            }else
            {
                // if(i==0 || j==0) c[i][j] = 0;
                c[i][j] = max(c[i][j-1], c[i-1][j]);
            }
            maxl = max(maxl, c[i][j]);
        } 
    } 
    // printf("%d\n", c[m][n]);
    return c[m][n];
}

int main()
{
    string x,y;
    int q;
    cin>>q;
    while(q--)
    {
        cin>>x>>y;
        int ans = lcs(x, y);
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 7124
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	int X=1;
	int x=X;
	while ((int)X*1.08<N){
		X++;
	}
	if ((int)(X*1.08)==N){
		cout<<(int)X<<endl;
	}else{
		cout<<":("<<endl;
	}


	return 0;
}

Measured memory_bytes: 256
function abc100_b()

	# STEP.01
	# get the number of the slice of cake
	D, N = Base.parse.( Base.split( Base.readline( Base.STDIN ) ) )

	if Base.isequal( N, 100 )
		num_presents = 101*100^D
	else
		num_presents = N*100^D
	end

	# STEP.02
	Base.println( Base.STDOUT, num_presents )

	# STEP.TRUE_END
	return Base.nothing

end

#==================================================================================================#

Main.abc100_b()


Measured memory_bytes: 121036
from collections import deque

k = int(input())

q = deque([1,2,3,4,5,6,7,8,9])

num = 0

while True:
    x = q.popleft()
    num += 1
    if num == k:
        break
    y = x % 10
    if y != 0:
        q.append(10 * x + y - 1)
    q.append(10 * x + y)
    if y != 9:
        q.append(10 * x + y + 1)

print(x)

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

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

/*
    verified https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_1_C
*/
int main() {
    int n; cin >> n;
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int tmp; cin >> tmp;
        if (is_prime(tmp)) ++res;
    }
    cout << res << endl;
}



Measured memory_bytes: 3016
use std::io;
use std::io::BufRead;

fn main() {
  let stdin = io::stdin();
  let input = stdin.lock().lines().next().unwrap().unwrap();
  let n = input.parse::<i32>().unwrap();

  for i in 1..n + 1 {
    if i % 3 == 0 {
      print!(" {}", i);
    } else {
      let mut x = i;
      while x > 0 {
        if x % 10 == 3 {
          print!(" {}", i);
          break;
        }
        x /= 10;
      }
    }
  }
  println!();
}


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

int main(){
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; i++)
    {
        cin >> s.at(i);
    }

    int M;
    cin >> M;
    vector<string> t(M);
    for (int i = 0; i < M; i++)
    {
        cin >> t.at(i);
    }
    
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int l = 0;
        string str = s.at(i);
        for (int j = 0; j < N; j++)
        {
            if(str == s.at(j)) l++;
        }
        for (int j = 0; j < M; j++)
        {
            if(str == t.at(j)) l--;
        }
        
        ans = max(ans, l);

    }
    
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 2019;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

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

  ll arr[200100];
  ll count[3000];

  int keta = 0;
  for (int i = s.size() - 1; i >= 0; i--)
  {
    struct mint m(10);
    struct mint tmp(s[i] - '0');
    int val = (tmp * m.pow(keta)).x;
    if (i == s.size() - 1)
      arr[i] = val % 2019;
    else
      arr[i] = (arr[i + 1] + val) % 2019;
    count[arr[i]]++;
    keta++;
  }

  ll ans = 0;
  rep(i, 2019)
  {
    if (i == 0)
    {
      if (count[i] == 0)
        continue;
      if (count[i] == 1)
      {
        ans++;
        continue;
      }
      ans += ((count[i] + 1) * count[i]) / 2;
      continue;
    }

    ans += (count[i] * (count[i] - 1)) / 2;
  }

  cout << ans << endl;

  return 0;
}


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


int main(){
  string S; cin >> S;
  string ans;
  if (S == "Sunny") ans = "Cloudy";
  if (S == "Cloudy") ans = "Rainy";
  if (S == "Rainy") ans = "Sunny";
  cout << ans << endl;
}

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

using namespace std;

int main(){
	int N;
	int D1[100];
	int D2[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> D1[i] >> D2[i];
	}
	int count = 0;

	for (int i = 0; i < N; i++) {
		if (D1[i] == D2[i]) {
			count++;
			if ( count == 3) {
				cout << "Yes" << "\n";
				return 0;
			}
		}
		else {
			count = 0;
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 3632
/**
*    author:  yuya1234
*    created: 22.07.2020 14:35:05
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(15);

  ll n,p;
  cin>>n>>p;
  ll ans=1;

  for(auto P:prime_factor(p))
  {
    ans*=pow(P.first,P.second/n);
  }

  cout<<ans<<endl;

  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    void Calc()
    {
        cin = new Scanner();

        int a = cin.nextInt();
        int b = cin.nextInt();

        int towerIndex = b - a;

        int[] towerHeight = new int[1000];

        for (int i = 1; i <= 999; ++i)
        {
            towerHeight[i] = towerHeight[i - 1] + i;
        }

        Console.WriteLine(towerHeight[towerIndex] - b);
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

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

    public long nextLong()
    {
        return long.Parse(next());
    }

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

    public double nextDouble()
    {
        return double.Parse(next());
    }


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


Measured memory_bytes: 11092
// D - Lucky PIN
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define all(x) (x).begin(),(x).end()
#define ubound(x,c) upper_bound(all(x),(c))-(x).begin()

int main(){
	int N; string S; cin>>N>>S; S = "-" + S;
	vector<vi> ix(10, vi());
	rp(i, 1, N+1) ix[S[i]-'0'].push_back(i);
	int ans = 0;
	rp(a, 0, 10){
		int p = ubound(ix[a], 0); if(p >= ix[a].size()) continue;
		rp(b, 0, 10){
			int q = ubound(ix[b], ix[a][p]); if(q >= ix[b].size()) continue;
			rp(c, 0, 10) if(ubound(ix[c], ix[b][q]) < ix[c].size()) ans++;
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(A: "List[int]"):
    if sum(A) >= 22:
        print("bust")
    else:
        print("win")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [int(next(tokens)) for _ in range(3)]  # type: "List[int]"
    solve(A)


if __name__ == '__main__':
    main()


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

using namespace std;
using P = pair<int, int>;

int main(void){
  int n, k;
  cin >> n >> k;
  
  vector<int> a(n, 0);
  for(int i = 0;i < n;i++) cin >> a[i];
  
  vector<P> v(n);
  for(int i = 0;i < n;i++){
    v[i].second = i+1;
    v[a[i]-1].first++;
  }
  
  sort(v.begin(), v.end(), greater<P>());
  
  int ans = 0;
  for(int i = k;i < n;i++){
    ans += v[i].first;
    //cout << "key:" << v[i].first << " value:" << v[i].second << endl;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<string> A(N);
  vector<string> B(M);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>B.at(i);
  }
  for(int i=0;i<=N-M;i++){
    for(int j=0;j<=N-M;j++){
      int count=0;
      for(int k=0;k<M;k++){
          if(B.at(k)==A.at(k+i).substr(j,M)){
            count++;
          }
      }
      if(count==M){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input().strip() for _ in range(N)]
cnt = 0
for k in range(N):
    flag = 0
    T = [S[i][k:]+S[i][:k] for i in range(N)]
    for i in range(N-1):
        for j in range(i+1,N):
            if T[i][j]!=T[j][i]:
                flag = 1
                break
        if flag==1:break
    if flag==0:
        cnt += 1
print(cnt*N)

Measured memory_bytes: 55132
#include<bits/stdc++.h>
using namespace std;
 
int N,M;
string S;
string ks[13];
 
int sc[(1<<12)];
bool dp[(1<<12)];
 
bool solve(int id){
  memset(dp,0,sizeof(dp));
  dp[0] = 1;
  int n = S.size();
  if( n-id < sc[(1<<N)-1] ) return false;
  for(int i=0;i<(1<<N);i++){
    if( !dp[i] ) continue;
    for(int j=0;j<N;j++){
      if( i & (1<<j) ) continue;
      if( S.compare(id+sc[i],ks[j].size(),ks[j]) == 0 ){
    //  cout << S.substr(id+sc[i]) << " "<< ks[j] << " " << S.compare(id+sc[i],ks[j].size(),ks[j]) << endl;
    dp[i|(1<<j)] = 1;     
      }
    }
  }
  return dp[(1<<N)-1];
}
 
int main(){
  while( cin >> N >> M && (N||M) ){
 
    memset(sc,0,sizeof(sc));
 
    for(int i=0;i<N;i++){
      cin >> ks[i];
    }
 
    for(int i=0;i<(1<<N);i++){
      for(int j=0;j<N;j++){
    if( i & (1<<j) ) sc[i] += (int)ks[j].size();
      }
    }
     
    S.clear();
    for(int j=0;j<M;j++){
      string s;
      cin >> s;
      S+=s;
    }
    int res = 0;
    for(int i=0;i<(int)S.size();i++){
      if( solve(i) ) res++;
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1260
/*
    i have no idea
*/

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

int main(){
    IOS;
    int n; cin >> n;
    int a[n], b[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];

    int ans = 0;
    for (int i = 0; i < n; i++)
        if (a[i] - b[i] > 0) ans += (a[i] - b[i]);

    cout << ans;
}


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

const int N = 2e5 + 5;

pair<int, int> tab[N];

int n, b;

bool cmp( pair<int, int> A, pair<int, int> B ){
    if(A.second == B.second)
        return A.first < B.first;
    return A.second < B.second;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> tab[i].first >> tab[i].second;
    sort( tab + 1, tab + n + 1, cmp );
    
    int p = 0;
    for(int i = 1; i <= n; i++){
        p += tab[i].first;
        if( p > tab[i].second ){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int h,ans=1;
    cin>>h;
    while(h>1){
    	h/=2;
    	ans*=2;
	}
	if(h==1&&ans>1){
		ans*=2;
			ans--;
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define DIM 100005
using namespace std;
int n, i, sum, x, y;
int s[DIM];
vector<int> v[DIM];
void dfs(int nod, int t){
    int i, vecin;
    for(i = 0; i < v[nod].size(); i++){
        vecin = v[nod][i];
        if(vecin != t){
            dfs(vecin, nod);
            s[nod] ^= (s[vecin] + 1);
        }
    }
}
int main(){
    cin>> n;
    for(i = 1; i < n; i++){
        cin>> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    if(v[1].size() == 1){
        cout<<"Alice";
        return 0;
    }
    dfs(1, 0);
    if(s[1] == 0){
        cout<<"Bob";
    }
    else{
        cout<<"Alice";
    }
}


Measured memory_bytes: 9984
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(void){
 
  int N;
  cin >> N;
  vector<int> a(3*N);
  for (int i=0; i<3*N; i++) cin >> a[i];
 
  sort((a).rbegin(), (a).rend());
  long long sum =0;
  for (int i=0; i<N; i++){
    sum += a[ i*2 + 1 ];
  }
  
  cout << sum << "\n";
}

Measured memory_bytes: 4556
#include<stdio.h>
int main(void){
    int n;
    char s[1000];
    int ans;
    scanf("%s",s);
    
    if(s[0]=='S'){
        printf("Cloudy\n");
    }else if(s[0]=='C'){
        printf("Rainy\n");
    }else if(s[0]=='R'){
        printf("Sunny\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

#define Max 500001

typedef struct{
  int key;
  int parent;
  int left;
  int right;
}Node;

void maxHeapify(Node *, int, int);
void buildMaxHeap(Node *, int);

int main(){
  int i, H;
  Node T[Max];

  scanf("%d",&H);
  /*for(i = 1; i <= H; i++){
    T[i].parent = NULL;
    T[i].left = NULL;
    T[i].right = NULL;
  }*/
  for(i = 1; i <= H; i++){
    scanf("%d",&T[i].key);
    if(i > 1) T[i].parent = T[i / 2].key;
  }
  /*for(i = 1; i <= H; i++){
    T[i].left = T[2 * i].key;
    if(2 * i > H) T[i].left = NULL;
    T[i].right = T[2 * i + 1].key;
    if(2 * i + 1 > H) T[i].right = NULL;
  }*/

  buildMaxHeap(T, H);
  
  for(i = 1; i < H; i++){
    printf(" %d", T[i].key);
  }
  printf(" %d\n", T[i].key);

  return 0;
}


void maxHeapify(Node *A, int i, int H){
  int l, r, largest, n;

  l = i * 2;
  r = i * 2 + 1;

  if((l <= H) && (A[l].key > A[i].key)) largest = l;
  else largest = i;

  if((r <= H) && (A[r].key > A[largest].key)) largest = r;

  if(largest != i){
    n = A[i].key;
    A[i].key = A[largest].key;
    A[largest].key = n;
    maxHeapify(A, largest, H);
  }

}

void buildMaxHeap(Node *A, int H){
  int i;

  for(i = H / 2; i >= 1; i--){
    maxHeapify(A, i, H);
  }
}

Measured memory_bytes: 8408
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.random;
      
void main() {
  auto x = readln.chomp.split.map!(to!int);
  writeln(x[0]/x[1]);
  writeln(x[0]%x[1]);
  writefln("%.7f", x[0].to!double/x[1]);
}

Measured memory_bytes: 1128
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;

    int ab = 0;
    int a = 0;
    int b = 0;
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    int ans = 0;
    rep(i, n){
        rep(j, SZ(s[i]) - 1){
            if(s[i][j] == 'A' && s[i][j+1] == 'B'){
                ans++;
            }
        }

        if(s[i].front() == 'B' && s[i].back() == 'A'){
            ab++;
            continue;
        }
        if(s[i].front() == 'B'){
            b++;
        }
        if(s[i].back() == 'A'){
            a++;
        }
    }

    if(ab > 0){
        ans += ab - 1;
        if(a > 0){
            a--;
            ans++;
        }
        if(b > 0){
            b--;
            ans++;
        }
    }

    cout << ans + min(a, b) << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int h, w;
int main () {
    cin >> h >> w;
    while ((h!=0)||(w!=0)) { 
        for (int j=1;j<=h;j++) {
            for (int i=1;i<=w;i++) {
            	cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    	cin >> h >> w;
    }
}


Measured memory_bytes: 3104
#include<stdio.h>
#include<stdlib.h>

int main(void){

  long long  l,r;
  int min;
  int tmp;
  long long i,j;
  scanf("%lld%lld",&l,&r);
  min=(l*(l+1))%2019;
  for(i=l;i<r;i++){
    for(j=i+1;j<=r;j++){
      tmp=(i*j)%2019;
      if(tmp<min)
      min=tmp;
      if(min==0){
        printf("%d",min);
        return 0;
      }
    }
  }
  printf("%d",min);
  return 0;
}


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

int main(void){
    int n;
    while(true){
        int cnt=0;
        cin >> n;
        if(n==0) break;
        if(n==1 || n==2) {cout << "0" << endl; continue;}
        for(int i=1;i<=n/2;++i){
            int sum = 0, p = i;
            while(sum < n){
                sum += p;
                ++p;
            }
            if(sum==n) ++cnt;
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 2996
#include<stdio.h>
int main(void){
	int a;
	int x=0,y=0;
	int i;
	for(i=0;i<3;i++){
		scanf("%d",&a);
		if(a==5){
			x++;
		}else if(a==7){
			y++;
		}
	}
	if(x==2&&y==1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 128
a = list(map(int,input().split()))
a.sort()
counter = 0
if (a[1]-a[0])%2 == 0:
	counter = a[2]-a[1]
	counter = counter + (a[1]-a[0])//2
else:
	counter += 1
	counter = a[2]+1-a[1]
	counter = counter+ (a[1]-a[0]+1)//2
print(counter)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main { 
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 26044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    string N;
    cin >> N;
    if (N[0] == '7' || N[1] == '7' || N[2] == '7')
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

int main()
{
    long long n;
    cin >> n;
    
    map<long long, long long> prime_n;
    vector<long long> prime_k;

    long long int buf = n;
    for (long long int i = 2; i * i <= n; i++)
    {
        if(buf % i == 0)
        {
            if(prime_n.count(i))
            {
                prime_n[i] = 0;
            }
            prime_k.push_back(i);
        }
        while (buf % i == 0)
        {
            prime_n[i]++;
            buf /= i;
        }
    }
    if(buf != 1)
    {
        if(prime_n.count(buf))
        {
            prime_n[buf] = 0;
        }
        prime_k.push_back(buf);
        prime_n[buf]++;
    }

    long long ans = 0;
    long long e = 0;
    for (long long i = 0; i < prime_k.size(); i++)
    {
        //cout << prime_k[i] << " " << prime_n[prime_k[i]] << endl;
        for (long long j = 1; j <= prime_n[prime_k[i]]; j++)
        {
            ans ++;
            prime_n[prime_k[i]] -= j;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() { 
    int n, a, b;
    cin >> n >> a >> b;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        int num = i;
        int digit = 0;
        while (num > 0) {
            digit += num % 10;
            num /= 10;
        }
        if (digit >= a && digit <= b) {
            res += i;
        }
    }
    cout << res << endl;
}




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

using namespace std;

int main()
{
    string S;
    int count = 0;

    cin >> S;

    for(int i=0; i<S.length()-1; i++){
        if(S.at(i) == S.at(i+1)){
            switch(S.at(i)){
                case '0':
                    S.at(i+1) = '1';
                break;
                case '1':
                    S.at(i+1) = '0';
                break;
            }

            count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 512