akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

long long ggcd(long long m, long long n){
    if(m < n) swap(m, n);
    if(m % n == 0) return n;
    else return ggcd(n, m % n);
}

long long llcm(long long m, long long n){
    return m * n / ggcd(m, n);
}

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

    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    if(c == 1 and d == 1 and a == 1 and b == 1){
        cout << 0 << endl;
        return 0;
    }

    long long a1 = (a == 1 ? 1 : a - 1) / c;
    long long b1 = b / c;
    long long a2 = (a == 1 ? 1 : a - 1) / d;
    long long b2 = b / d;
    long long a3 = (a == 1 ? 1 : a - 1) / llcm(c, d);
    long long b3 = b / llcm(c, d);

    long long ans = b - a + 1 - (b1 + b2 - b3 - (a1 + a2 - a3));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int x;
    cin >> x;
    string ans;
    if (x < 1200) ans = "ABC";
    else if (x < 2800) ans = "ARC";
    else ans = "AGC";
    cout << ans << endl;
    return 0;
}

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

int main(void){
	long int A,V,B,W,T;
	cin >> A >> V;
	cin >> B >> W;
	cin >> T;
	if(V<=W){
		cout << "NO\n";
	}else{
		if(abs(A-B)<=T*(V-W)){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	}
	return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a))
#define mp make_pair
#define All(a) (a).begin(), (a).end()
template <typename T=int>
inline T IN(){T x; cin>>x; return(x);}
inline void CIN(){}
template <class Head,class... Tail>
inline void CIN(Head&& head,Tail&&... tail){
    cin>>head;
    CIN(move(tail)...);
}
#define CINT(...) int __VA_ARGS__;CIN(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CIN(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CIN(__VA_ARGS__)

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int,V,greater<int>> PQG;

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

int Q;
const int rmax=1e5;
bool is_prime[rmax+1];
int prime[rmax+1];
int prisum[rmax+1];

int sieve(int n){
    int p=0;
    REP(i,n+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    REP(i,n+1){
        if(is_prime[i]==true){
            prime[p++]=i;
            for(int j=2*i; j<=n; j+=i){
                is_prime[j]=false;
            }
        }
    }
    return p;
}

int main(){
    cin>>Q;
    sieve(rmax);
    REP(i,rmax+1){
        if(is_prime[i]==true && is_prime[(i+1)/2]==true){
            prisum[i]=1;
        }
    }
    FOR(i,1,rmax+1){
        prisum[i]+=prisum[i-1];
    }
    REP(i,Q){
        CINT(l,r);
        cout<<prisum[r]-prisum[l-1]<<"\n";
    }
    return 0;
}


Measured memory_bytes: 1152
/*input
3
3 6 7
4
1 2 4 8
5
7 8 8 8 8

3
3 6 7
4
1 2 4 8
5
7 8 8 8 8

*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define mp make_pair
#define int long long
#define N 100005
#define bit(x,y) ((x>>y)&1LL)
#define show(x) cout << (#x) << ": " << x << endl;
#define ii pair<int,int>
ostream& operator << (ostream &os, vector<int>&x) {
	for (int i = 0; i < x.size(); i++) os << x[i] << sp;
	return os;
}
ostream& operator << (ostream &os, pair<int, int> x) {
	cout << x.fi << sp << x.se << sp;
	return os;
}
ostream& operator << (ostream &os, vector<pair<int, int> >&x) {
	for (int i = 0; i < x.size(); i++) os << x[i] << endl;
	return os;
}

int n;
int a[N];
int curTurn = 0;
void done(int x) {
	if (x % 2 == 1) cout << "Second" << endl;
	else cout << "First" << endl;
	exit(0);
}

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

void process() {
	int l = 0; int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += a[i] - 1;
		if (a[i] % 2 == 1) {
			l++; a[i]--;
		}
	}
	if (sum % 2 == 1) {
		done(curTurn + sum);
	}
	if (l == 1) {
		int gcd = a[1];
		for (int i = 1; i <= n; i++) {
			gcd = GCD(a[i], gcd);
		}
		for (int i = 1; i <= n; i++) {
			a[i] /= gcd;
		}
		curTurn++;
	}
	else {
		done(curTurn + sum);
	}
}

void check() {
	bool have1 = false;
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] == 1) have1 = true;
		else sum += a[i] - 1;
	}
	if (!have1) return;
	done(curTurn % 2 + sum % 2);
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#ifdef UncleGrandpa
	freopen("1test.inp", "r", stdin);
#endif
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	curTurn = 1;
	for (int i = 1;; i++) {
		check();
		process();
	}
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
const ll MOD = 1e9+7;
int n = 2,m = 2;
struct Matrix{
	vector<vector<ll>> a;
	vector<ll>& operator[](int x){ return a[x]; }
	inline int r(){ return a.size(); }
	inline int c(){ return (a.size() ? a[0].size() : 0); }
	
	Matrix(int r_ = 0, int c_ = 0, bool I = 0){
		a.resize(r_, vector<ll>(c_));
		if(I){
			assert(r_ == c_);
			for(int i = 0; i < r_; i++) a[i][i] = 1;
		}
	}
	inline Matrix(const vector<vector<ll>>& v){ a = v; }
	inline void operator=(const vector<vector<ll>>& v){ a = v; }
};
Matrix operator*(Matrix A, Matrix B){
	assert(A.c() == B.r());
	const ll MOD2 = ll(MOD) * MOD; //MOD
	Matrix C(A.r(), B.c());
	for(int i = 0; i < A.r(); i++){
		for(int j = 0; j < B.c(); j++){
			ll w = 0;
			for(int k = 0; k < A.c(); k++){
				w += ll(A[i][k]) * B[k][j];
				if(w >= MOD2) w -= MOD2; //MOD
			}
			C[i][j] = w % MOD; //MOD
		}
	}
	return C;
}
Matrix operator^(Matrix A, ll b){
	assert(A.r() == A.c());
	Matrix R = Matrix(A.r(), A.r(), 1);
	for(; b; b >>= 1){
		if(b & 1) R = R * A;
		A = A * A;
	}
	return R;
}
int main()
{
	ll n,k;
	cin>>n>>k;
	Matrix mat(n,n);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>mat[i][j];
		}
	}
	mat = mat^k;
	ll ans = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			ans+=mat[i][j];
			ans%=MOD;
		}
	}
	cout<<ans;
	
}


Measured memory_bytes: 3768
package main

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

//•*¨*•.¸¸♪I/O•*¨*•.¸¸♪

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	h := scanInt()
	a := scanInt()

	fmt.Println((h+a-1)/a)
}


Measured memory_bytes: 640
fn solve() {
    let n: usize = read();
    let (mut a, mut b, mut c, mut d) = (0, 0, 0, 0);

    for i in 0..n {
        let mut s: String = read();
        s.pop();
        match s.pop().expect("s wrong") {
            'A' => a += 1,
            'W' => b += 1,
            'L' => c += 1,
            'R' => d += 1,
            _ => unreachable!(),
        }
    }
    println!("AC x {}", a);
    println!("WA x {}", b);
    println!("TLE x {}", c);
    println!("RE x {}", d);
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2260
import Data.Array.IO
    
main :: IO ()
main = getLine >> getContents >>= kousha . map (map toInt . words) . lines >>=
       getElems >>= putStrLn . init . unlines . format
    where toInt = read :: String -> Int

kousha :: [[Int]] -> IO (IOArray (Int, Int, Int) Int)
kousha [] = newArray ((1,1,1), (4,3,10)) 0
kousha ([b,f,r,v]:xs) = do
  k <- kousha xs
  oldV <- readArray k (b,f,r)
  writeArray k (b,f,r) (oldV + v)
  return k
  
format :: [Int] -> [String]
format [] = []
format xs = rep f ys 3 10 ++ (if null zs then [] else replicate 20 '#' : format zs)
    where (ys, zs) = splitAt 30 xs
          f = (' ':) . unwords . map show

rep :: ([a] -> b) -> [a] -> Int -> Int -> [b]
rep _ _ _ 0  = []
rep _ [] _ _ = []
rep f xs n l = f ys : rep f zs (n-1) l
    where (ys, zs) = splitAt l xs

Measured memory_bytes: 4272
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;
typedef long long ll;

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a){
        return mint(v) *= a;
    }

    mint operator+(mint a){
        return mint(v) += a;
    }

    mint operator-(mint a){
        return mint(v) -= a;
    }

    mint pow(long long k){
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> ss;
    vector<ll> ts;
    ss.resize(n);
    for(ll i = 0; i < n; ++i){
        cin >> ss.at(i);
    }
    ts.resize(m);
    for(ll i = 0; i < m; ++i){
        cin >> ts.at(i);
    }

    vector<vector<mint> > dp;
    dp.resize(n + 1);
    for(ll i = 0; i <= n; ++i){
        if(i < n){
            dp.at(i).resize(m + 1, 0);
            dp.at(i).at(m) = 1;
        }else{
            dp.at(n).resize(m + 1, 1);
        }
    }

    for(ll i = n - 1; i >= 0; --i){
        for(ll j = m - 1; j >= 0; --j){
            if(ss.at(i) == ts.at(j)){
                dp.at(i).at(j) =
                    dp.at(i + 1).at(j) +
                    dp.at(i).at(j + 1);
            }else{
                dp.at(i).at(j) =
                    dp.at(i + 1).at(j) +
                    dp.at(i).at(j + 1) -
                    dp.at(i + 1).at(j + 1);
            }
        }
    }
     cout << dp.at(0).at(0).v << endl;
    return 0;
}


Measured memory_bytes: 31616
import numpy as np
N,L = [int(x) for x in input().split(' ')]
s = np.sum(range(N+1)) + (N - 1) * L - (N - 1)
#print(s)
off = L - 1
#print('off',off)

if off >= 0:
  s -= 1
else:
  if -off >= N:
    off = -N
  s += off
print(s)

Measured memory_bytes: 12424
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  ll t;
  t=a;
  a=b;
  b=t;
  t=c;
  c=a;
  a=t;
  cout<<a<<" "<<b<<" "<<c;
  return 0;
}


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

using namespace std;

typedef long long ll;

const int mx = 100050;

int rnk[mx];
int par[mx];

int fnd(int i)
{
    if(par[i] == i)return i;
    return par[i] = fnd(par[i]);
}
void unn(int u, int v)
{
    int a = fnd(u);
    int b = fnd(v);
    if(a == b)return ;

    if(rnk[a] < rnk[b])
    {
        par[a] = b;
    }
    else if(rnk[a] > rnk[b])
    {
        par[b] = a;
    }
    else
    {
        par[a] = b;
        rnk[b]++;
    }

}

int main()
{
    int i , j , k , n , x,  y, z , m;

    scanf("%d %d",&n,&m);

    for(i = 1 ; i <= n ; i++)
    {
        rnk[i] = 0;
        par[i] = i;
    }

    for(i = 0 ; i < m ; i++)
    {
        scanf("%d %d %d",&x,&y,&z);
        unn(x,y);
    }
    memset(rnk,0,sizeof(rnk));
    for(i = 1 ; i <= n ; i++)
    {
        k = fnd(i);
        rnk[k]++;
    }
    k = 0;
    for(i = 1 ; i <= n ; i++)if(rnk[i])k++;

    printf("%d\n",k);

}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    string s;
    cin >> s;
    int ans = 0;
    rep(i,s.size()){
        if(s[i] == 'o'){
            ans++;
        }
    }
    cout << (15 - s.size() + ans >= 8 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3512
def assign(s,ans,n):
    for i in range(1,n-1):
        if s[i] == "o":
            if ans[i] == "S":
                if ans[i-1] == "S":
                    ans[i+1] = "S"
                else:
                    ans[i+1] = "W"
            else:
                if ans[i-1] == "S":
                    ans[i+1] = "W"
                else:
                    ans[i+1] = "S"
        else:
            if ans[i] == "S":
                if ans[i-1] == "S":
                    ans[i+1] = "W"
                else:
                    ans[i+1] = "S"
            else:
                if ans[i-1] == "W":
                    ans[i+1] = "W"
                else:
                    ans[i+1] = "S"
    return ans

def judge(s,ans):
    check = True
    if s[0] == "o":
        if ans[0] == "S":
            if ans[1] != ans[-1]:
                check = False
        else:
            if ans[1] == ans[-1]:
                check = False
    else:
        if ans[0] == "S":
            if ans[1] == ans[-1]:
                check = False
        else:
            if ans[1] != ans[-1]:
                check = False

    if s[-1] == "o":
        if ans[-1] == "S":
            if ans[-2] != ans[0]:
                check = False
        else:
            if ans[-2] == ans[0]:
                check = False
    else:
        if ans[-1] == "S":
            if ans[-2] == ans[0]:
                check = False
        else:
            if ans[-2] != ans[0]:
                check = False
    return check


n = int(input())
s = list(input())
whole = False
for i in range(4):
    ans = [1 for i in range(n)]
    if i == 0:
        ans[0] = "S"
        ans[1] = "S"
    elif i == 1:
        ans[0] = "S"
        ans[1] = "W"
    elif i == 2:
        ans[0] = "W"
        ans[1] = "S"
    elif i == 3:
        ans[0] = "W"
        ans[1] = "W"
    ans = assign(s,ans,n)
    check = judge(s,ans)
    if check:
        for i in range(n):
            if i != n-1:
                print(ans[i],end = "")
            else:
                print(ans[i])
        whole = True
        break
if whole == False:
    print("-1")
        


Measured memory_bytes: 6916
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    int x;
    int ans=0;
    for(int i=0;i<n;i++){
        cin >> x;
        ans +=2*min(abs(x-k),abs(x));
    }
    cout << ans;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;;
const int MaxN = 1e5 + 5;

map <int, int> cnt;

struct point {
    int x, y, t;
} mapp[MaxN];

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        int x, y, t;
        scanf("%d%d%d", &t, &x, &y);
        mapp[i].x = x, mapp[i].y = y, mapp[i].t = t;
    }
    mapp[0].x = 0, mapp[0].y = 0, mapp[0].t = 0;
    for(int i = 1; i <= n; i++) {
        int s, t;
        s = fabs(mapp[i].x - mapp[i - 1].x) + fabs(mapp[i].y - mapp[i - 1].y);
        t = fabs(mapp[i].t - mapp[i - 1].t);
        if(s > t || s % 2  != t % 2 ) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e10 + 7
#define FOR for(lo i = 0 ; i < n ; i++)
#define FORV for(lo i = 0 ; i < (lo)v.size() ; i++)
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
#define si pair<string,lo>
lo a,b,c,d,e,n,m,k,t,h,x,y,a1[20][20],a2[100005];
char c1,c2,c3,c4;
string s1,s2,s3,s4;
double d1,d2,d3;
vector <lo> v;
map <lo,lo> mp1;
map <lo,lo> mp2;
set <lo> stt;
queue <lo> q;
priority_queue <lo> pq;
lo vis [10000];
int main() {
    // freopen("gir.gir", "r", stdin);
    // freopen("cik.cik", "w", stdout);
    cin >> n >> d;
    for(lo i = 0 ; i < n ; i++){
        for(lo j = 0 ; j < d ; j++){
            cin >> a1[i][j];
        }
    }
    lo ans = 0;
    for(lo i = 0 ; i < n ; i++){
        for(lo j = i + 1 ; j < n ; j++){
            a = 0;
            for(lo k = 0 ; k < d ; k++){
                a += (abs(a1[i][k] - a1[j][k]) * abs(a1[i][k] - a1[j][k]));
            }
            if((double)sqrt((double)a) == (int)sqrt(a)){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}
	String alphabet = "abcdefghijklmnopqrstuvwxyz";
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int cnt[][]= new int[n][26];
		for(int i=0; i<n; i++) {
			String s = sc.next();
			for(int j=0; j<s.length(); j++) {
				cnt[i][s.charAt(j)-'a']++;
			}
		}
		StringBuilder ans = new StringBuilder();
		for(int j=0; j<26; j++) {
			int min=50;
			for(int i=0; i<n; i++) {
				min = Math.min(min, cnt[i][j]);
			}
			ans.append(String.join("", Collections.nCopies(min, alphabet.substring(j, j+1))));
		}
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   string s, t;
   cin >> s >> t;
   s += t[t.size() - 1];
   if (s == t)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main(void){
	ll x,y,z,k;
	cin>>x>>y>>z>>k;
	ll a,b,c;
	vector<ll> A,B,C;
	rep(i,x){
		cin>>a;
		A.push_back(a);
	}
	rep(i,y){
		cin>>a;
		B.push_back(a);
	}
	rep(i,z){
		cin>>a;
		C.push_back(a);
	}

	vector<ll> deka;
	rep(i,y){
		rep(j,z){
			deka.push_back(B[i]+C[j]);
		}
	}
	sort(deka.begin(),deka.end());
	reverse(deka.begin(),deka.end());
	sort(A.begin(),A.end());
	reverse(A.begin(),A.end());

	vector<int> idx;
	rep(i,A.size()){
		idx.push_back(0);
	}

	rep(i,k){
		int ai=0,di=0;
		ll ans = -1;
		rep(j,x){
			if(ans < A[j] + deka[idx[j]]){
				ans = A[j] + deka[idx[j]];
				ai = j;
				di = idx[j];
			}
		}
		cout<<ans<<endl;
		idx[ai]++;
	}
	return 0;
}


Measured memory_bytes: 10616
#include <bits/stdc++.h>
using namespace std;
#define long long long
#define read cin >>
#define echo cout <<
#define fin << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int h, w;
bool visited[25][25];
int dist[25][25];
int fx[] = {0, 1, 0, -1};
int fy[] = {1, 0, -1, 0};
vector<string> data(25);

int search(int now_h, int now_w) {
  queue<pair<int, int>> q;
  q.push(make_pair(now_h, now_w));
  visited[now_h][now_w] = true;
  int move_dist = 0;
  while (!q.empty()) {
    // cout << "while!" << endl;
    pair<int, int> p = q.front();
    q.pop();
    // cout << p.first << " " << p.second << endl;
    REP(i, 4) {
      int next_h = p.first + fx[i];
      int next_w = p.second + fy[i];
      if (next_h >= 0 && next_h < h && next_w >= 0 && next_w < w &&
          !visited[next_h][next_w] && data[next_h][next_w] == '.') {
        visited[next_h][next_w] = true;
        int next_dist = dist[p.first][p.second] + 1;
        dist[next_h][next_w] = next_dist;
        // cout << "push" << endl;
        q.push(make_pair(next_h, next_w));
        move_dist = max(move_dist, next_dist);
      }
    }
  }
  return move_dist;
}

int main() {
  read h >> w;
  REP(i, h) { read data[i]; }
  int ans = 0;
  REP(i, h) {
    REP(j, w) {
      if (data[i][j] == '.') {
        memset(visited, false, sizeof(visited));
        memset(dist, 0, sizeof(dist));
        ans = max(ans, search(i, j));
        // debug
        /*cout << "i = " << i << " "
             << "j = " << j << endl;
        REP(i, h) {
          REP(j, w) {
            if (j == w - 1) {
              cout << dist[i][j] << endl;
            } else {
              cout << dist[i][j];
            }
          }
        }*/
      }
    }
  }
  echo ans fin;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
bool f(int a)
{
	for(int i=2;i*i<=a;i++)if(a%i<1)return 0;
	return 1;
}
main()
{
	cin>>n;
	for(int i=11;n;i+=5)
	{
		if(f(i))
		{
			n--;
			if(i!=11)cout<<" ";
			cout<<i;
		}
	}
	cout<<endl;
}


Measured memory_bytes: 256
N = int(input())
S = [ list(map(int, input().split())) for _ in range(N) ]

def main():
    for i in range(101):
        for j in range(101):
            H = 0
            for x,y,h in S:
                if h==0:
                    continue
                else:
                    H = h+abs(x-i)+abs(y-j)
                    break
            flg = True
            for x,y,h in S:
                if h != max(0, H-abs(x-i)-abs(y-j)):
                    flg = False
                    break
            if flg:
                print(i, j, H)
                return

main()
            

                



Measured memory_bytes: 41328
from collections import deque
h,w = map(int,input().split())
s = [0]*(h+2)
s[0]  = ["#"]*(w+2)
s[-1] = ["#"]*(w+2)
for i in range(h):
    s[i+1] = ["#"] + list(input()) + ["#"]
ans = 1
for i in range(h+2):
    for j in range(w+2):
        if s[i][j] != ".":
            pass
        else:
            xs,ys = j,i
            qx = deque([])
            qx.append(xs)
            qy = deque([])
            qy.append(ys)
            reach = [[0 for _1 in range(w+2)] for _2 in range(h+2)]
            reach[ys][xs] = 1
            while qx:
                x = qx.popleft()
                y = qy.popleft()

                if s[y-1][x] == "." and reach[y-1][x] == 0:
                    qx.append(x)
                    qy.append(y-1)
                    reach[y-1][x] = reach[y][x] + 1
                if s[y+1][x] == "." and reach[y+1][x] == 0:
                    qx.append(x)
                    qy.append(y+1)
                    reach[y+1][x] = reach[y][x] + 1
                if s[y][x-1] == "." and reach[y][x-1] == 0:
                    qx.append(x-1)
                    qy.append(y)
                    reach[y][x-1] = reach[y][x] + 1
                if s[y][x+1] == "." and reach[y][x+1] == 0:
                    qx.append(x+1)
                    qy.append(y)
                    reach[y][x+1] = reach[y][x] + 1
            m = 1
            for k in range(h+2):
                m = max(m,max(reach[k][:])-1)
            ans = max(ans,m)
print(ans)

Measured memory_bytes: 3316
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>

using namespace std;

void Solution()
{
    long int a;
    
    cin>>a;
    
    int b[10000] = {0};
    long int sum = 0;
    
    for (int i = 0; i < a; i++)
    {
        cin>>b[i];
        
        sum = sum + b[i];
    }
    
    sort(b, b + a);
    cout<<b[0]<<" "<<b[a - 1]<<" "<<sum<<endl;
}

int main()
{
    Solution();
    return 0;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int main(){
    int N, M;
    cin >> N >> M;

    static int64_t dp[301][302][302];
    dp[0][1][0] = 1;
    for(int i=0; i<M; i++) for(int j=0; j<=N; j++) for(int k=0; k<=N; k++){
        if(dp[i][j][k] == 0) continue;
        int r = N-j-k;
        add(dp[i+1][j+k][0], dp[i][j][k] * j);
        add(dp[i+1][j][k], dp[i][j][k] * k);
        add(dp[i+1][j][k+1], dp[i][j][k] * r);
    }
    cout << dp[M][N][0] << endl;
    return 0;
}


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

int main() {
  int N, a;
  cin >> N;

  string ans = "second";
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (a % 2 == 1) {
      ans = "first";
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n;
    cin >> n;
    rep(i,n){
        lli a;
        cin >> a;
        if(a%2==0){
            if(a%3!=0&&a%5!=0){
                out("DENIED");
                return 0;
            }
        }
    }
    out("APPROVED");
}

Measured memory_bytes: 3604
N = int(input())
if (N%100)%10 == 3:
    print('bon')
elif (N%100)%10 == 0 or (N%100)%10 ==1 or (N%100)%10 ==6 or (N%100)%10 ==8:
    print('pon')
else:
    print('hon')


Measured memory_bytes: 9160
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;
long long dp[100010];

int main() {
	int N, K; cin >> N >> K;
	vector<long long> h(N);
	for (int i = 0; i < N; ++i) cin >> h[i];

	// 初期化 (最小化問題なので INF に初期化)
	for (int i = 0; i < 100010; ++i) dp[i] = INF;

	// 初期条件
	dp[0] = 0;

	// ループ
	for (int i = 1; i < N; ++i) {
		for (int j = max(i - K, 0); j < i; ++j) {
			chmin(dp[i], dp[j] + abs(h[i] - h[j]));
		}
	}

	// 答え
	cout << dp[N-1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int M=2e6+10;
int a[M],n,b[M];
int gcd(int x,int y){
	return (y ? gcd(y,x%y) : x);
}
int main(){
	n=read();
	int d=0;
	F(i,1,n){
		a[i]=read();
		b[a[i]]++;
		d=gcd(d,a[i]);
	}
//	cout<<d<<"\n";
	F(i,2,M/2){
		int tmp=0;
		for (int j=i;j<=M/2;j+=i){
			tmp+=b[j];
		}
		if (tmp>1){
			if (d==1) puts("setwise coprime");
			else puts("not coprime");
			return 0;
		}
	}
	puts("pairwise coprime");
	return 0;
}


Measured memory_bytes: 11436
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {
	string s;
	cin >> s;
	int sz = s.size();
	int c = 0;
	for (int i = 0; i < sz; i++) {
		if (i == 0) {
			string a, b;
			a = "0";
			b = s;
			int aa, bb;
			stringstream ss;
			ss << a;
			ss >> aa;
			ss.clear();
			ss << b;
			ss >> bb;
			//cout << aa << ' ' << bb << endl;
			if (bb >= aa) {
				if ((aa+bb) % 2 == 0) {
					c++;
				}
			}
		} else {
			string a, b;
			a = s.substr(0, i);
			b = s.substr(i);
			if (b[0] == '0') {
				continue;
			}
			int aa, bb;
			stringstream ss;
			ss << a;
			ss >> aa;
			ss.clear();
			ss << b;
			ss >> bb;
			//cout << aa << ' ' << bb << endl;
			if (bb >= aa) {
				if ((aa+bb) % 2 == 0) {
					c++;
				}
			}
		}
	}
	cout << c << endl;
	return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


class Set {
    multiset<ll> s;

public:
    void insert(ll l) {
        s.insert(-l);
    }

    ll find(ll l) {
        auto it = s.upper_bound(-l);
        if (it == s.end()) return -1;
        return -(*it);
    }

    void erase(ll l) {
        s.erase(s.find(-l));
    }

};

int main() {
    Set s;

    int n;
    cin >> n;
    rep(i, 1 << n) {
        ll a;
        cin >> a;
        s.insert(a);
    }

    ll top = s.find(INF);
    multiset<ll> used;
    used.insert(-top);

    s.erase(top);

    rep(i, n) {
        vector<ll> next;
        for (ll u : used) {
            u = -u;
            ll t = s.find(u);
            if (t == -1) {
                cout << "No" << endl;
                ret();
            }
            s.erase(t);
            next.push_back(t);
        }
        for (ll l : next) used.insert(-l);
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 17100
fun main(args: Array<String>) {
    readLine()
    readLine()!!.split(" ").map{ it.toLong() }
            .map {
                //２で割れる回数を返す
                var c=0
                var x=it
                while(x%2==0L){
                    c++
                    x/=2
                }
                return@map c
            }
            .sum()
            .let{ println(it) }

}

Measured memory_bytes: 41936
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
class Program
{



    static void Main(string[] args)
    {
        string[] inp = null;
        var pq = new PriorityQueue<long>();

        while (true)
        {
            inp = Console.ReadLine().Split(' ');
            if (inp[0][2] == 'd') break;

            if (inp[0][0] == 'i')
            {
                pq.Enqueue(long.Parse(inp[1]));
            }
            else
            {
                Console.WriteLine(pq.Dequeue());
            }

        }
    }


}

public class PriorityQueue<T> where T : IComparable
{
    private List<T> data;

    public PriorityQueue()
    {
        this.data = new List<T>();
    }

    public void Enqueue(T item)
    {
        data.Add(item);
        int ci = data.Count - 1;
        while (ci > 0)
        {
            int pi = (ci - 1) / 2;
            if (data[ci].CompareTo(data[pi]) <= 0)
                break;

            T tmp = data[ci];
            data[ci] = data[pi];
            data[pi] = tmp;
            ci = pi;
        }
    }

    public T Dequeue()
    {
        int li = data.Count - 1;
        T front = data[0];
        data[0] = data[li];
        data.RemoveAt(li);

        --li;
        int pi = 0;
        while (true)
        {
            int ci = pi * 2 + 1;
            if (ci > li)
                break;
            int rc = ci + 1;
            if (rc <= li && data[rc].CompareTo(data[ci]) > 0)
                ci = rc;
            if (data[pi].CompareTo(data[ci]) >= 0)
                break;

            T tmp = data[pi];
            data[pi] = data[ci];
            data[ci] = tmp;
            pi = ci;
        }
        return front;
    }

}



Measured memory_bytes: 30856
fun main(arr:Array<String>) {
    val count = readLine()!!.toInt()
    val rates = readLine()!!.split(" ").map { it.toInt() }
    val underRed = rates.filter { it < 3200 }.map { it / 400 }.distinct()
    val overRed = rates.count { it >= 3200 }
    val min = Math.max(underRed.size,1)
    val max = underRed.size + overRed
    println("%d %d".format(min,max))
}

Measured memory_bytes: 37740
#include<stdio.h>
#include<string.h>
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
const int maxn=110;
int vis[maxn];
int main(){
	int i,j,n,m,k,u,v;
	scanf("%d%d",&n,&m);
	mem(vis,0);
	int ans=0;
	for(i=1;i<=n;i++){
		scanf("%d",&k);
		for(j=0;j<k;j++){
			scanf("%d",&u);
			vis[u]++;
			if(vis[u]==n) ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> a(n), b(n);
  rep(i,n-1) cin >> b[i];
  a[0] = b[0];
  b[n-1] = b[n-2];
  rep(i,n-1) {
    a[i+1] = min(b[i], b[i+1]);
  }
  int ans = 0;
  rep(i,n) ans += a[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
/*
 * 16-9-11_ABC045_A.cpp
 *
 *  Created on: 2016/09/11
 *      Author: ryoma
 */

#include<iostream>

using namespace std;

int main(){
	int a,b,h;
	cin >> a >> b >> h;
	cout << (a+b)*h/2<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define for1(i, a, b) for(i = a; i <= b; ++i)
#define for0(i, a, b) for(i = a; i < b; ++i)
#define forw1(i, a, b) for(i = a; i >= b; --i)
#define forw0(i, a, b) for(i = a - 1; i >= b; --i)
#define fora(v, a) for(auto v : a)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

using namespace std;
using cd = complex<double>;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<cd> vcd;
typedef vector<ii> vii;
typedef vector<vector<int> > vvi;

const int modd1 = 1e9 + 7, modd2 = 998244353, maxn = 10, K = 26, inf = 1e9, infll = 1e18;
const double pi = acos(-1);

bool scp(int x){
    int d = sqrt(x);
    return d * d == x;
}

void solve(){
    int n, i, j, k, l, r, ans = 0, uoc = 0;
    cin >> n;
    int temp = n; vi luu;
    for1(i, 2, sqrt(temp)){
        if(temp % i == 0){
            int cnt = 0; 
            while(temp % i == 0){
                cnt++; temp /= i;
            }
            luu.pb(cnt);
        }
    }
    if(temp > 1){
        temp = 1; luu.pb(1);
    }
    for0(i, 0, luu.size()){
        int f = luu[i];
        while(!scp(8 * f + 1)){
            f--;
        }
        int kek = sqrt(8 * f + 1);
        kek = (kek - 1) / 2;
        ans += kek;
    }
    cout << ans;
}

signed main() {
    //freopen(".INP", "r", stdin); 
    //freopen(".OUT", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}

Measured memory_bytes: 3672
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>

using namespace std;

int min(int a,int b){
    return (a<b) ? a : b ;
}

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


int main() {

    string S ;
    cin >> S ;
    stack<char> s ;

    for (int i = 0; i < S.size(); i++)
    {
        if(S[i]=='0') s.push('0') ;
        if(S[i]=='1') s.push('1') ;
        if(S[i]=='B'){
            if(!s.empty())
            {
                s.pop() ;
            } 
        } 
        //cout << s.top() << endl ;
    }

   // cout << s.size() << endl ;

    stack<char> ans ;
    while (!s.empty())
    {   
         ans.push(s.top()) ;
         s.pop() ;
    }
    
    //cout << "ANs " << ans.size() << endl ;

    while (!ans.empty())
    {   
        cout << ans.top() ;
         ans.pop() ;
    }

    cout << endl ;

 return 0 ;
}  


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

al = [int(input()) for _ in range(n)]

if n == 1:
    print(al[0] // 2 * 2 // 2)
    exit()
ans = 0
for i in range(n-1):
    rest = ((al[i] + al[i+1]) // 2) * 2
    ans += rest
    for j in range(2):
        if al[i+j] >= rest:
            al[i+j] -= rest
            break
        else:
            rest -= al[i+j]
            al[i+j] = 0


print(ans//2)

Measured memory_bytes: 49880
#include <iostream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		// ll n;
		// cin >> n;
		// ll arr[n];
		// for (ll i = 0; i < n; i++)
		// 	cin >> arr[i];
		char s;
		cin >> s;
		if (isupper(s))
			cout << "A" << endl;
		else
			cout << "a" << endl;
	}
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>

using namespace std;

int main()
{
	int N, K;
	long long ans = 0;
	cin >> N >> K;

	if (K % 2 == 0)
	{
		int z_count = 0, k_count = 0;
		for (int i = 1; i <= N; i++)
		{
			if (i % K == 0)
			{
				z_count++;
			}

			if (i % K == K / 2)
			{
				k_count++;
			}
		}

		ans = pow(z_count, 3) + pow(k_count, 3);
	}
	else
	{
		int count = 0;
		for (int i = 1; i <= N; i++)
		{
			if (i % K == 0)
			{
				count++;
			}
		}

		ans = pow(count, 3);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    List<Integer> n_m = Stream.of(sc.nextLine().split(" "))
                                  .map(Integer::parseInt)
                                  .collect(Collectors.toList());
        HashMap<Integer, List<Integer>> a = new HashMap<>();
        IntStream.rangeClosed(1, n_m.get(0))
                 .forEach(i -> {
                     List<Integer> an = Stream.of(sc.nextLine().split(" "))
                                              .map(Integer::parseInt)
                                              .collect(Collectors.toList());
                     a.put(i, an);
                 });
        HashMap<Integer, Integer> b = new HashMap<>();
        IntStream.rangeClosed(1, n_m.get(1))
                 .forEach(m -> {
                     b.put(m, Integer.parseInt(sc.nextLine()));
                 });
        IntStream.rangeClosed(1, a.size())
                 .forEach(n -> {
                     List<Integer> an = a.get(n);
                     int p = IntStream.rangeClosed(1, an.size())
                              .map(m -> {
                                  return an.get(m - 1) * b.get(m);
                              })
                              .sum();
                     System.out.println(p);
                 });
    }
}




Measured memory_bytes: 35512
#include<cstdio>
using namespace std;
static const int MAX_N = 100000;

int n, q;

int n_;
int dat[4 * MAX_N], laz[4 * MAX_N];

void init(){
	n_ = 1;
	while(n_ < n) n_ *= 2;
	for(int i = 0; i < 2 * n_ - 1; i++){
		dat[i] = 0;
		laz[i] = -1001;
	}
}
void prop(int k){
	if(laz[k] == -1001) return;
	if(2 * k + 1 < 2 * n_ - 1){
		laz[2 * k + 1] = laz[k] / 2;
		laz[2 * k + 2] = laz[k] / 2;
	}
	dat[k] = laz[k];
	laz[k] = -1001;
}
void update(int a, int b, int x, int k, int l, int r){
	prop(k);
	if(r <= a || b <= l) return;
	if(a <= l && r <= b){
		laz[k] = x * (r - l);
		return;
	}
	prop(k);
	update(a, b, x, 2 * k + 1, l, (l + r) / 2);
	update(a, b, x, 2 * k + 2, (l + r) / 2, r);
	int vl = (laz[2 * k + 1] == -1001 ? dat[2 * k + 1] : laz[2 * k + 1]);
	int vr = (laz[2 * k + 2] == -1001 ? dat[2 * k + 2] : laz[2 * k + 2]);
	dat[k] = vl + vr;
}
int find(int a, int b, int k, int l, int r){
	prop(k);
	if(r <= a || b <= l) return 0;
	if(a <= l && r <= b) return dat[k];
	int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
	int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
	return vl + vr;
}

int main(){
	scanf("%d %d", &n, &q);
	init();
	for(int i = 0; i < q; i++){
		int op;
		scanf("%d", &op);
		if(op == 0){
			int s, t, x;
			scanf("%d %d %d", &s, &t, &x);
			update(s, t + 1, x, 0, 0, n_);
		}else{
			int s,t;
			scanf("%d %d", &s, &t);
			printf("%d\n", find(s, t + 1, 0, 0, n_));
		}
	}
	return 0;
}



Measured memory_bytes: 4776
import sys
input = sys.stdin.readline
from collections import deque
import math
def solve():
  n,h = (int(i) for i in input().split())
  a = []
  b = []
  for i in range(n):
    ta,tb = (int(i) for i in input().split())
    a.append(ta)
    b.append(tb)
  amax = max(a)
  b = deque(sorted(b,reverse=True))
  
  damage = 0
  ct = 0
  while damage < h:
    if len(b):
      throw = b[0]
    else:
      throw = -99
      
    if throw > amax:
      throw = b.popleft()
      ct += 1
      damage += throw
      continue
    else:
      sabun = h-damage
      ct += math.ceil(sabun/amax)
      damage += amax*math.ceil(sabun/amax)
  print(ct)
solve()

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define REV(x) reverse(ALL((x)))
#define pb push_back

vec divisor(ll N)
{
    vec D;
    int i;
    
    D.pb(N);
    for(i=2; i*i<N; ++i) {
        if(N % i == 0) {
            D.pb(i);
            D.pb(N/i);
        }
    }
    if(N % (i*i) == 0) D.pb(i*i);
    DESC(D);

    return D;
}

int main()
{
    ll N, K;
    cin >> N >> K;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll sum = 0;
    REP(i,0,N) sum += A[i];
    vec D = divisor(sum);
    vec B(N), lsum(N+2), rsum(N+2);

    ll k, m = 1;
    FORR(d,D) {
        REP(i,0,N) B[i] = A[i] % d;
        ASC(B);
        REP(i,0,N+2) {
            lsum[i] = 0;
            rsum[i] = 0;
        }
        REP(i,1,N+1) {
            lsum[i] = B[i-1] + lsum[i-1];
            rsum[N-i+1] = d - B[N-i] + rsum[N-i+2];
        }
        k = INF;
        REP(i,1,N) {
            if(lsum[i] == rsum[i+1]) {
                k = lsum[i];
                break;
            }
        }
        if(k <= K) m = MAX(m,d);
    }

    PR(m);


    return 0;
}

/*



*/

Measured memory_bytes: 3652