akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	_, m := r.nextInt(), r.nextInt()
	r.Scan(true)
	a := r.nextStringArray().toInts()

	t := 1
	{
		t = a[0] / 2
		cnt := 1
		w := a[0]
		for {
			if w%2 != 0 {
				break
			}
			cnt *= 2
			w /= 2
		}
		for _, ai := range a[1:] {
			c := gcd(t, ai/2)
			t = t * ai / 2 / c
			if ai%cnt != 0 || ai%(cnt*2) == 0 {
				t = -m
				break
			}
		}
	}
	fmt.Fprintln(stdout, (m/t+1)/2)
}


Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main ()
{
        LL n,x;
        while(cin>>n>>x)
        {
                LL len,ans,xx;
                ans=n;
                if(2*x<=n)
                {
                        len=n-x;
                        xx=x;
                }
                else
                {
                        len=x;
                        xx=n-x;
                }
                while(1)
                {
                     if(len%xx==0)
                     {
                             ans+=(len/xx*2-1)*xx;
                             break;
                     }
                     else
                     {
                             ans+=len/xx*2*xx;
                             LL t=xx;
                             xx=len-len/xx*xx;
                             len=t;
                     }

                }
               cout<<ans<<endl;
        }
}


Measured memory_bytes: 256
'use strict'

const calc = (arr, str) => {
  for (let i = 0;i < arr.length;i++) {
    if (arr[i] == str) return i;
  }
}

function main(arg) {
  arg = arg.split('');
  let gra = arg.slice();
  gra = gra.reverse();
  const a = calc(arg, 'A');
  const z = gra.length - calc(gra, 'Z');
  const str_length = z - a
  if (str_length > 0) {
    console.log(str_length)
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 12748
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    for(int R0, W0, C, R; cin >> R0 >> W0 >> C >> R, R0;){
        int res = 0;
        rep(x, 1e6){
            if(R0 + x * R - C * W0 >= 0){
                res = x;
                break;
            }
        }
        cout << res << endl;
    }

    return 0;
}

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

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

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

signed main(){
  
  string s; cin >> s;
  int n = (int)s.size();
  vector<int> ans(n, 0);
  
  // 'R' を見つける
  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'R') cnt++;
    else{
      if(cnt == 0) continue;
      else{
        if(cnt % 2 == 1){
          ans[i] += cnt / 2;
          ans[i - 1] += cnt / 2 + 1;
        }else{
          ans[i] += cnt / 2;
          ans[i - 1] += cnt / 2;
        }
        cnt = 0;
      }
    }
  }
  cnt = 0;
  reverse(ans.begin(), ans.end());
  reverse(s.begin(), s.end());
  for(int i = 0; i < n; i++){
    if(s[i] == 'L') cnt++;
    else{
      if(cnt == 0) continue;
      else{
        if(cnt % 2 == 1){
          ans[i] += cnt / 2;
          ans[i - 1] += cnt / 2 + 1;
        }else{
          ans[i] += cnt / 2;
          ans[i - 1] += cnt / 2;
        }
        cnt = 0;
      }
    }
  }

  for(int i = n - 1; i >= 0; i--) cout << ans[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 1408
def psolve(positive, As):
    i = 0
    ans = 0
    for a in As:
        if positive:
            if i + a <= 0:
                ans += abs(1 - (i + a))
                a += 1 - (i + a)
        else:
            if i + a >= 0:
                ans += abs(-1 - (i + a))
                a += -1 - (i + a)
        i += a
        positive = not positive
    return ans


def solve(N, As):
    return min(psolve(True, As), psolve(False, As))


if __name__ == "__main__":
    n = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(n, As))


Measured memory_bytes: 14464
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
"""

# import {{{
from collections import ChainMap
from collections import Counter
from collections import defaultdict
from collections import deque
from collections import namedtuple
import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import operator
import pprint
import random
import re
import sys
import time

try:
    import numpy as np
    import scipy as sp
except:
    pass
# }}}

# util {{{
def is_odd(x):
    return x % 2 == 1

def is_even(x):
    return x % 2 == 0

def cmp(x, y):
    return (x > y) - (x < y)

def sgn(x):
    return cmp(x, 0)

def clamp(x, lo, hi):
    assert lo <= hi
    if x < lo:
        return lo
    elif x > hi:
        return hi
    else:
        return x

def chmax(xmax, x):
    if x > xmax:
        return x, True
    else:
        return xmax, False

def chmin(xmin, x):
    if x < xmin:
        return x, True
    else:
        return xmin, False

sys.setrecursionlimit(100000)
# }}}

# ???????????´
PINF = float("inf")
NINF = float("-inf")
EPS  = 1e-9



def main():
    N = int(input())
    R = [int(input()) for _ in range(N)]

    ansmax = NINF
    rmin = R[0]
    for r in R[1:]:
        ansmax, _ = chmax(ansmax, r-rmin)
        rmin, _   = chmin(rmin, r)

    print(ansmax)

if __name__ == "__main__": main()

Measured memory_bytes: 22980
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
	int n, a, i, q, l, r, li[100003] = {};
	bool p[100003] = { false };

	for (n = 2; n <= 100000; n++) {
		for (a = 2; a * a <= n; a++) {
			if (n % a == 0) break;
		}
		if (a * a > n) p[n] = true;
	}

	for (n = 3; n <= 100000; n++) {
		if (n % 2 == 0) {
			li[n] = li[n - 1];
			continue;
		}
		if (p[n] && p[(n + 1) / 2]) li[n] = li[n - 2] + 1;
		else li[n] = li[n - 2];
	}

	cin >> q;
	for (i = 0; i < q; i++) {
		cin >> l >> r;
		cout << li[r] - li[l - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
import Data.List

-- most frequently
freq :: [String] -> [String] -> [Int]
freq xs ws = map (\x -> length $ filter (\w -> w == x) ws) xs

mfreq :: [Int] -> Maybe Int
mfreq ls =
    findIndex (\l -> l == max) ls where
      max = maximum ls

ansf :: [String] -> Maybe Int
ansf ws = mfreq $ freq (nub ws) ws

-- the maximum number of letters
mmaxi :: [Int] -> Maybe Int
mmaxi ls =
    findIndex (\l -> l == max) ls where
      max = maximum ls

bnsf :: [String] -> Maybe Int
bnsf ws = mmaxi $ map length ws

main = do
    input <- getLine
    let ws = words input
    let ans = (ansf ws) >>= (\x -> return $ ws !! x)
    let bns = (bnsf ws) >>= (\x -> return $ ws !! x)
    case (ans, bns) of
      (Just x, Just y) -> putStrLn $ x ++ " " ++ y
      _ -> return ()

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define lbd(a, x) lower_bound(all(a), x)
const int mod = 998244353;
int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	string s; cin >> s;
	int n = s.size();
	for(int i = 0; i + 1 < n; i++) {
		if(s[i] == s[i + 1]) {
			cout << i + 1 << ' ' << i + 2 << '\n';
			return 0;
		} else if(i + 2 < n && s[i] == s[i + 2]) {
			cout << i + 1 << ' ' << i + 3 << '\n';
			return 0;
		}
	}
	cout << "-1 -1\n";
	return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

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

int main() {
  int N; cin >> N;
  string S; cin >> S;
  vector<int> L(N), R(N);
  L[0] = 0, R[N-1] = 0;
  for (int i = 0; i < N-1; ++i) {
    if (S[i] == 'E') L[i + 1] = L[i];
    else             L[i + 1] = L[i] + 1;
  }
  for (int i = N - 1; i > 0; --i) {
    if (S[i] == 'W') R[i-1] = R[i];
    else             R[i-1] = R[i] + 1;
  }

  int vmin = 1e9;
  for (int i = 0; i < N; ++i) vmin = min(vmin, L[i] + R[i]);
  cout << vmin << endl;
}


Measured memory_bytes: 6160
import static java.lang.System.out;
    public class Main {
        public static void main(String[] args){
            int time = new java.util.Scanner(System.in).nextInt();

            int hour = time / 3600;
            int minute = (time % 3600) / 60;
            int second = (time % 3600) % 60;
            out.print(hour + ":");
            out.print(minute + ":");
            out.println(second);
    
        }
    }

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

const long int mod = 1000000007;

long int all(long int n, long int k) {
    if(n == 0)
        return 1;
    
    long int x = all(n/2,k);
    x *= x;
    x %= mod;

    if(n%2 == 1) {
        x *= k;
        x %= mod;
    }
    
    return x;
}

int main() {
    long int n, a, b;
    cin >> n >> a >> b;
    
    long int n_all, a_all, b_all;
    n_all = all(n,2) - 1;
    if(n_all < 0)
        n_all += mod;

    long int c, m;
    
    c = m = 1;
    rep(i,a) {
        c *= n - i;
        c %= mod;
        m *= a - i;
        m %= mod;
    }
    a_all = c * all(mod-2,m);
    a_all %= mod;
    
    c = m = 1;
    rep(i,b) {
        c *= n - i;
        c %= mod;
        m *= b - i;
        m %= mod;
    }
    b_all = c * all(mod-2,m);
    b_all %= mod;

    //cout << n_all << endl;
    //cout << a_all << endl;
    //cout << b_all << endl;
    
    long int ans = n_all - a_all - b_all;
    while(ans < 0) {
        ans += mod;
    }

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




Measured memory_bytes: 3640
#include <bits/stdc++.h>
const int maxn=2e5+7;
int n;
int A,B,C,D;
char s[maxn];
int main(){
	scanf("%d%d%d%d%d%s",&n,&A,&B,&C,&D,s+1);
	for(int i=B;i<D;){
		if(s[i+1]=='.')++i;
		else if(s[i+=2]=='#')
			return puts("No"),0;
	}
	if(D<C){
		bool flag=false;
		for(int i=B;i<=D && !flag;++i)
			flag=(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.');
		if(!flag)return puts("No"),0;
	}
	for(int i=A;i<C;){
		if(s[i+1]=='.')++i;
		else if(s[i+=2]=='#')
			return puts("No"),0;
	}return puts("Yes"),0;
}


Measured memory_bytes: 384
// https://atcoder.jp/contests/abc054/tasks/abc054_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N, M;
  cin >> N >> M;

  V<string> a_mat(N);
  rep(i, N) cin >> a_mat[i];

  V<string> b_mat(M);
  rep(i, M) cin >> b_mat[i];

  rep(h_off, N - M + 1) rep(w_off, N - M + 1) {
    ll ok = true;

    rep(h, M) rep(w, M) {
      if (b_mat[h][w] != a_mat[h + h_off][w + w_off]) {
        ok = false;
      }
    }

    if (ok) drop("Yes");
  }

  drop("No");
}


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

#define EPS (1e-9)
#define EQ(a, b) (abs((a) - (b)) < EPS)

typedef complex<double> Vector2;

vector<Vector2> CircleIntersections(Vector2 a, Vector2 b, double ra, double rb) {
  double d = abs(b - a);
  if (ra + rb < d) return {};
  double c = acos((ra * ra + d * d - rb * rb) / (2 * ra * d));
  double t = atan2(b.imag() - a.imag(), b.real() - a.real());
  Vector2 p1 = a + Vector2(cos(t + c) * ra, sin(t + c) * ra);
  Vector2 p2 = a + Vector2(cos(t - c) * ra, sin(t - c) * ra);
  return {p1, p2};
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<Vector2> v(n);
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y >> c[i];
    v[i] = Vector2(x, y);
  }
  if (k == 1) {
    cout << 0 << endl;
    return 0;
  }

  double r = 1e9;
  for (int top0 = 1; top0 < 1e8; top0 *= 10) {
    double bot = 0, top = top0, mid;
    while (!EQ(bot, top)) {
      mid = bot + (top - bot) / 2;
      bool valid = false;
      for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
          auto u = CircleIntersections(v[i], v[j], mid / c[i], mid / c[j]);
          //
          if (!u.empty()) u.push_back((u[0] + u[1]) / 2.0);
          //
          for (auto e : u) {
            int x = 2;
            for (int l = 0; l < n; l++) {
              if (l == i || l == j) continue;
              x += abs(e - v[l]) <= mid / c[l];
            }
            if (x >= k) valid = true;
          }
        }
      }
      if (valid) {
        top = mid;
      } else {
        bot = mid;
      }
    }
    if (!EQ(top, top0)) r = min(r, bot);
  }
  cout << fixed << setprecision(9);
  cout << r << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int x,y,z,j=0,k,l,i;
    scanf("%d %d %d",&x,&y,&z);
    for(i=x;i<=y;i++)
    {
        if(z%i==0)
            j++;
    }
   printf("%d\n",j);
    return 0;
}





Measured memory_bytes: 2064
// Problem : C - Peaks
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

const int N = 1e5 + 5;
int n, m, h[N], vis[N];

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &h[i]);
  for (int i = 1; i <= m; ++i) {
    int a, b; scanf("%d%d", &a, &b);
    if (h[a] <= h[b]) vis[a] = 1;
    if (h[b] <= h[a]) vis[b] = 1;
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) if (vis[i] == 0) ++res;
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 4620
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N=200005;
ll fact[N];
ll expo(ll x,ll y,ll m=mod){
    ll res=1LL;
    while(y){
        if(y&1) res=(res*x)%m;
        x=(x*x)%m;
        y/=2;
    }
    return res;
}
ll ncr(ll n,ll r)
{
	ll res=fact[n];
	res=(res*expo(fact[r],mod-2))%mod;
	res=(res*expo(fact[n-r],mod-2))%mod;
	return res;
}
void solve()
{
	ll n,m,k,i,j,p,q,ans=0;
	cin>>n>>m>>k;
	fact[0]=1;
	for(i=1;i<=n*m;i++)
		fact[i]=(fact[i-1]*i)%mod;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			{
				ans=(ans+ncr(n*m-2,k-2)*(((i*i-(i*(i+1))/2)*m)%mod))%mod;
				ans=(ans+ncr(n*m-2,k-2)*(((j*j-(j*(j+1))/2)*n)%mod))%mod;

			}		
					
		
	//ans=(ans*expo(2,mod-2))%mod;
	cout<<ans;

}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 1920
#![allow(unused_imports)]

use std::cmp;
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

pub const MOD: usize = 1000000007;

fn main() {
    let n: usize = input();
    let a: Vec<usize> = input_vec();
    let a = a.into_iter().map(|x| x - 1).collect::<Vec<_>>();

    let mut likes = HashMap::new();
    let mut ans = 0usize;
    for (i, r) in a.into_iter().enumerate() {
        if likes.contains_key(&r) && likes[&r] == i {
            ans += 1;
        } else {
            likes.insert(i, r);
        }
    }

    println!("{}", ans);
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 12540
n = int(input())
p = list(map(int,input().split()))
pre = True
premin = p[0]
ans = 1
for i in range(1,n):
  if pre and p[i]<=p[i-1]:
    ans += 1
    premin = p[i]
  elif not pre and p[i]>p[i-1]:
    pre = False
  else:
    if premin>=p[i]:
      ans += 1
      pre = True
      premin = p[i]
    else:
      pre = False
print(ans)

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int S, W;
	cin >> S >> W;

	if(W >= S){
		cout << "unsafe" << endl;
	}
	else{
		cout << "safe" << endl;
	}
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	solve();
	return 0;
}

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

using namespace std;
int main(){
    int n;
    vector<string> ward;
    string tmp_str;
    bool clear = true;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> tmp_str;
        if(ward.end() != find(ward.begin(), ward.end(), tmp_str)){
            clear = false;
        }
        ward.push_back(tmp_str);
    }
    if(clear){
        for(int i = 1; i < n; i++){
            if(ward[i].front() != ward[i-1].back()){
                clear = false;
                break;
            }
        }
    }

    if(clear) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  cout << a[0] << b[1] << c[2];
}

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

using namespace std;

bool good(const char ch){

    return ch=='A' or ch=='T' or ch=='C' or ch=='G';
}

char s[100005];
int dp[100005];

int main(){

    int n,m;
    cin>>n>>m;

    cin>>(s+1);

    for(int i=1;s[i];i++){

        dp[i]=dp[i-1];
        if(s[i]=='C' and s[i-1]=='A')
            dp[i]++;
    }

    while(m--){

        int x,y;
        cin>>x>>y;
        cout<<dp[y]-dp[x]<<'\n';
    }

    return 0;
}


Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main(void){
  bool flag = true;
  int cnt = 0;
  while(flag){
    int x;
    cnt++;
    cin >> x;
    if(x == 0) flag = false;
    else{
      cout << "Case " << cnt << ": " << x << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3044
n,q = map(int,input().split())
s = input()
pref = [0]
for i in range(1,n):
  if s[i-1 : i+1] == "AC":
    pref.append(pref[-1]+1)
  else:
    pref.append(pref[-1])
for i in range(q):
  l,r = map(int, input().split())
  print(pref[r-1] - pref[l-1])


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

#define ll long long
#define ull unsigned long long

int main(void) {
    ll N;
    cin >> N;
    vector<ll> A, B, C;
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        A.push_back(temp);
    }
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        B.push_back(temp);
    }
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        C.push_back(temp);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll count = 0;
    for(auto &b: B) {
        ll a = lower_bound(A.begin(), A.end(), b) - A.begin();
        ll c = C.end() - upper_bound(C.begin(), C.end(), b);
        count += a * c;
    }
    cout << count << endl;
    return 0;
}


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

int main() {
    int n, a[200010];
    list<int> b;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        if (n % 2 == i % 2) {
            b.push_back(a[i]);
        } else {
            b.push_front(a[i]);
        }
    }
    int size = b.size();
    auto itr = b.begin();
    cout << *b.begin();
    for (auto itr = ++b.begin(); itr != b.end(); ++itr) {
        cout << " " << *itr;
    }
    cout << endl;
}

Measured memory_bytes: 9216
#include <stdio.h>
#include <algorithm>

#define lli long long int

using namespace std;

int main() {
	lli n, m, x[100010], a[100010], ans = 0;
	scanf("%lld %lld", &n, &m);
	for (lli i = 0; i < m; i++)
		scanf("%lld", &x[i]);
	sort(x, x + m);
	for (lli i = 1; i < m; i++)
		a[i - 1] = x[i] - x[i - 1];
	sort(a, a + m - 1);
	for (lli i = 0; i < (m - n); i++)
		ans += a[i];
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include "unistd.h"
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream&o,const pair<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
template<typename T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
//V<ll>fac,rfac;void setFac(int n,int mod){fac=rfac=V<ll>(++n);fac[0]=1;FOR(i,1,n)fac[i]=fac[i-1]*i%mod;rfac[n-1]=modInv(fac[n-1],mod);FORR(i,n-1,1)rfac[i-1]=rfac[i]*i%mod;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

void RE(){cout<<1/0;}
void TLE(){sleep(100);}
void WA(){cout<<char(0);exit(0);}

const int N = 1e5;
int n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  dout(double((n+1)/2)/n);
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,s.size()){
        int x= s[i]-'A';
        x=(x+n)%26;
        cout << char('A'+x);
    }
    cout << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();

            var oddDict = new Dictionary<int, int>();
            var eveDict = new Dictionary<int, int>();

            for (var i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    oddDict[array[i]] = 0;
                else
                    eveDict[array[i]] = 0;
            }

            for (var i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    oddDict[array[i]]++;
                else
                    eveDict[array[i]]++;
            }

            oddDict = oddDict.OrderByDescending(k => k.Value).ToDictionary(t => t.Key, t => t.Value);
            eveDict = eveDict.OrderByDescending(k => k.Value).ToDictionary(t => t.Key, t => t.Value);

            var oddMax = oddDict.First().Key;
            var eveMax = eveDict.First().Key;

            // 最大値が同じ場合はずらせないか考慮する
            // 2番目に大きい数値が大きいほうをずらす
            var oddArrayKey = oddDict.Keys.ToArray();
            var oddArrayValue = oddDict.Values.ToArray();
            var eveArrayKey = eveDict.Keys.ToArray();
            var eveArrayValue = eveDict.Values.ToArray();

            // 完全に同じ条件の場合は特殊処理
            if (oddArrayKey.Length == 1 && eveArrayKey.Length == 1 && oddArrayKey[0] == eveArrayKey[0])
            {
                Console.WriteLine(n / 2);
                return;
            }

            for (var i = 0; i < n / 2; i++)
            {
                if (oddArrayKey[i] == eveArrayKey[i])
                {
                    var ooo = oddArrayValue[i] + eveArrayValue[i + 1];
                    var eee = eveArrayValue[i] + oddArrayValue[i + 1];
                    if (ooo > eee)
                    {
                        oddMax = oddArrayKey[i];
                        eveMax = eveArrayKey[i + 1];
                        break;
                    }
                    else
                    {
                        oddMax = oddArrayKey[i + 1];
                        eveMax = eveArrayKey[i];
                        break;
                    }

                }
                else break;
            }

            // oddMaxとeveMaxではない数値を数える
            var total = 0;

            for (var i = 0; i < n; i++)
            {
                if (i % 2 == 0 && array[i] != oddMax)
                    total++;

                if (i % 2 == 1 && array[i] != eveMax)
                    total++;
            }

            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 28896
#include <stdio.h>

////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////
int main(void){
	int x;
	int i;
	int ans = 1;

	scanf("%d", &x);

	for ( i = 0 ; i < 3 ; i++) {
		ans *= x;
	}

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

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

int main(){
  double r, pi=3.141592653589;
  cin >> r;
  printf("%.5lf %.5lf", pi*r*r, 2*pi*r);

  return 0;
}


Measured memory_bytes: 3196
n=int(input())
ans=[int('9'+'0'*i) for i in range(0,8,2)]
p=len(str(n))
if len(str(n))&1==0:
    print(sum(ans[:p//2]))
else:
    print(sum(ans[:p//2])+(n+1-int('1'+'0'*(p-1))))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int j,n,m,po,no,flag,cnt=0,cnt2,ar[200001],x,y,i,co[200001],sum=0,k,ans=INT_MIN,sum1=0;
    string str[1000],ptr,sr,tr,rtr,rt;
    vector<long long int>v1,v2;
    set<string>s;
    queue<long long int>qu;
    set<string>::iterator it;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>ar[i];

    }
    co[0]=0;
    co[1]=0;
    x=ar[1];
   for(i=2;i<=n;i++)
   {
       if(i%2==0)
        co[i]=max((co[i-2]+ar[i]),x);
        else
       {
           co[i]=max((co[i-2]+ar[i]),co[i-1]);
           x+=ar[i];
       }
   }



    cout<<co[n]<<endl;



}


Measured memory_bytes: 6800
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
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;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int d,t,s;
    cin>>d>>t>>s;
    if(d>t*s) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

string s;
int k;

int main()
{
    cin >> s >> k;
    int n = s.length();
    set<string> st;

    for(int i = 0; i <= n; i++){
        for(int j = 1; j <= n - i; j++){
            if(j > k) break;
            st.insert(s.substr(i, j));
        }
    }

    vector<string> vc(st.begin(), st.end());
    sort(all(vc));
    cout << vc[k - 1] << endl;

    return 0;

}

Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  long h,w;
  scanf("%ld",&h);
  scanf("%ld",&w);
  if((h==1)||(w==1)){
    printf("1");
  }else{
  	printf("%ld",((h*w)>>1)+((h*w)&1));
  }
  return(0);
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int i, j, N, minj, temp, A[100], count=0;

  scanf("%d", &N);
  for(i=0;i<N;i++){
    scanf("%d", &A[i]);
  }
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj])minj = j;
    }
    temp=A[i];
    A[i]=A[minj];
    A[minj]=temp;
    if(i!=minj)count++;
  }

  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n%d\n",A[i], count);
  return 0;
}

Measured memory_bytes: 600
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0], 10);
  var ints = input[1].split(" ").map((n) => parseInt(n, 10));
 
  var mean = 0;
  var ans = 0;
  for (var i = 0; i < N; i++) {
    mean += ints[i];
  }
  mean = Math.round(mean / N);
 
  for (var i = 0; i < N; i++) {
    var int = Math.abs(mean - ints[i]);
    var pow = Math.pow(int, 2);
    ans += pow;
  }
  console.log(ans);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: alireza_kaviani
 * Time: 2020-05-22 10:28:13
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , k , ans , A[MAXN];
Tree<pll> tr;

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

    cin >> n >> k;
    for(int i = 1 ; i <= n ; i++)   cin >> A[i] , A[i] -= k;
    partial_sum(A , A + n + 1 , A);
    for(int i = 0 ; i <= n ; i++){
        ans += tr.order_of_key({A[i] , INF});
        tr.insert({A[i] , i});
    }
    cout << ans << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 14336
#include<iostream>
#include<cstdlib>
#include<queue>
using namespace std;

int min_dist(int ix, int iy, int x, int y){
  return max(abs(ix-x),abs(iy-y));
}

int main()
{
  int N;
  while(cin >> N){
    int K;
    cin >> K;
    for(int i = 0; i < K; ++i){
      int x,y;
      int d;
      int ic;
      cin >> x >> y;
      if(N%2==1){
	d = min_dist((N+1)/2,(N+1)/2,x,y);
	ic = ((N+1)/2-1)%3;
      }else{
	d = min(min_dist(N/2,N/2,x,y),
		min(min_dist(N/2,N/2+1,x,y),
		    min(min_dist(N/2+1,N/2,x,y),
			min_dist(N/2+1,N/2+1,x,y))));
	ic = (N/2-1)%3;
      }
      int res = (ic+d)%3;
      if(ic==0){
	if(res==1)res=2;
	else if(res==2)res=1;
      }else if(ic==1){
	if(res==0)res=2;
	else if(res==2)res=0;
      }else{
	if(res==0)res=1;
	else if(res==1)res=0;
      }
      cout << 1+res << endl;
    }
  }
  return 0;
}

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

int main(){
    int A,B;
    cin >> A >> B;
    int cnt = 0;
    while(1){
        if((A-1)*cnt+1>=B) break;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
ll = list(input())

leng = len(ll)
x = [0] * leng

for k in range(leng - 1):
    if ll[k] == 'R' and ll[k + 1] == 'L':
        count_r = 1
        j = k - 1
        while ll[j] == 'R':
            count_r += 1
            j -= 1

        count_l = 0
        j = k + 1
        while ll[j] == 'L':
            count_l += 1
            j += 1
            if j == leng:
                break
        
        x[k] = (count_r + 1) // 2 + count_l // 2
        x[k + 1] = count_r // 2 + (count_l + 1) // 2

x_string = map(str, x)
print(' '.join(x_string))

Measured memory_bytes: 55140
/*
^-^ THINK SIMPLE ^-^
^-^ THINK FAST ^-^
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define mod 1000000007
#define siz 1000001

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	// Ok so the number which we want should be in kth length of cycle
	// k being the input number
	ll k;
	cin >> k;
	
	if(k%2 == 0 || k%5 == 0){
		cout << -1 << "\n";
		return 0;
	}
	
	ll i = 1, ch = 0;
	
	while(true){
		ch = (ch*10 + 7)%k;
		if(ch%k == 0){
			cout << i << "\n";
			break;
		}
		i++;
	}
}























Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S,T="CODEFESTIVAL2016";
  cin>>S;int x=0;
  for(int i=0;i<16;i++){
    if(S.at(i)!=T.at(i))x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s  = sc.next();
		String t = sc.next();
		int plus = t.length() - s.length();
		if(t.startsWith(s)  && plus == 1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35688
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main(){
    // ll a,b,c,k,ans=0;
    // cin>>a>>b>>c>>k;
    // ans+=min(k,a),k-=min(k,a);
    // k-=min(k,b);
    // ans-=min(k,c);
    // cout<<ans<<endl;
    string s,t;
    ll ans=0;
    cin>>s>>t;
    for(ll i=0;i<(ll)s.size();i++)  if(s[i]!=t[i])  ans=-1;
    if(ans==-1) cout<<"No"<<endl;
    else    cout<<"Yes"<<endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

const int INF = 1e7;

template<class T> inline bool chmin(T &a, T b) {
    if (a > b) {a = b; return true;}
    return false;
}

signed main(){
    int n;
    cin >> n;
    
    vector<int> op;
    op.emplace_back(1);
    int six = 6, nine = 9;
    while(six <= n){
        op.emplace_back(six);
        six *= 6;
    }
    while(nine <= n){
        op.emplace_back(nine);
        nine *= 9;
    }
    
    vector<vector<int>> dp(n+1,vector<int>(op.size(),INF));
    dp[0] = vector<int>(op.size(),0);
    
    reps(i,1,n){
        rep(j,op.size()){
            if(i-op[j] >= 0) chmin(dp[i][j], dp[i-op[j]][j] + 1);
            if(j != 0)       chmin(dp[i][j], dp[i][j-1]);
        }
    }
    
    cout << dp[n].back() << endl;
}

Measured memory_bytes: 8832
import itertools
num = str(input())
sign = ("+", "-")
for s1, s2, s3 in itertools.product(sign, repeat=3):
    result = num[0] + s1 + num[1] + s2 + num[2] + s3 + num[3]
    if eval(result) == 7:
        print(result+"=7")
        break

Measured memory_bytes: 3060
N = int(input())

A = list(map(int, input().split()))

A.sort(reverse=True)
ans = 0

ans += A[0]

cnt = 1
i = 1
while cnt < N-2:
    ans += A[i] * 2
    i += 1
    cnt += 2
if cnt == N-2:
    ans += A[i]

print(ans)

Measured memory_bytes: 105244
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, d;
    cin >> n >> d;
    vector<P> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;
    two_sat g(n);
    rep(i, n) rep(j, i) {
        rep(ii, 2) {
            rep(jj, 2) {
                if (abs(v[i].first-v[j].first)<d) {
                    g.add_clause(i, ii==1, j, jj==1);
                }
                swap(v[j].first, v[j].second);
            }
            swap(v[i].first, v[i].second);
        }
    }
    bool ok = g.satisfiable();
    if (!ok) {
        pr("No");
        return 0;
    }
    pr("Yes");
    auto ans = g.answer();

    rep(i, n) {
        if (ans[i]) pr(v[i].first);
        else pr(v[i].second);
    }
    
    return 0;
}


Measured memory_bytes: 3780