akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

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

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int N, a, b, c, sum;
  cin >> N;
  a = N;
  b = N;
  c = N;
  sum = 0;
  FOR(i, 1, N + 1) {
    FOR(j, 1, N + 1) {
      FOR(k, 1, N + 1) { sum += euclidean_gcd(euclidean_gcd(i, j), k); }
    }
  }
  cout << sum << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3660
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <cmath>
#include <random>
#include <cctype>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define MK make_pair
#define PB push_back
#define VI vector<int>
#define VII vector<int,int>
#define MSI map<string,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define W1 while(1);
const int MOD = 1000000007;
int main()
{
	int n;
	int l;
	string ans;
	vector<string> iroha;
	cin >> n;
	cin >> l;
	REP(i, n)
	{
		string temp;
		cin >> temp;
		iroha.PB(temp);
	}
	sort(iroha.begin(),iroha.end());
	REP(i, n)
	{
		ans+=iroha.at(i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int x;cin >> x;
  (x<1200) ? puts("ABC") : puts("ARC");
}


Measured memory_bytes: 256
import           Control.Monad
import qualified Data.Array.IO               as IO
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  [s, t] <- words <$> getLine
  [a, b] <- getIntList
  u <- getLine

  if s == u
    then putStrLn $ show (a-1) ++ " " ++ show b
    else putStrLn $ show a ++ " " ++ show (b-1)

Measured memory_bytes: 380
#include<bits/stdc++.h>
#define int long long int
using namespace std;
const int N = 1e5+50;

int32_t main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("atcoder.txt", "r", stdin);
	int tc = 1;
	for(int T=1; T<=tc; T++){
		string s; cin>>s;
		if(s[0] == 'A' and s[1] == 'A' and s[2] == 'A'){
			cout<<"No\n";
		}
		else if(s[0] == 'B' and s[1] == 'B' and s[2] == 'B'){
			cout<<"No\n";
		}
		else cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 256
// Created by sz
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;

const int N = 1e5 + 5;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int a,b;
    cin>>a>>b;
    cout<<a+b/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n){
    cin >> h.at(i);
  }
  sort(ALLR(h));
  int ans = INF;
  for(int i = 0; i+k-1 < n; i++){
    ans = min(ans,h.at(i)-h.at(i+k-1));
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import itertools

height, width, k = map(int, input().split())
k -= 1

MOD = 1000000007

# 1 つの行について valid な線の引き方を列挙
patterns = []
for r in range(width - 1):
    for pattern in itertools.combinations(range(width - 1), r):
        # 隣り合ってたらだめ
        if all(abs(a - b) != 1 for a, b in zip(pattern[:-1], pattern[1:])):
            patterns.append(pattern)

# counts[w][v]: 1 行で w から v へ行けるパターンの数
counts = [[0 for _ in range(width)] for _ in range(width)]
for pattern in patterns:
    for w in range(width):
        if w in pattern:
            counts[w][w + 1] += 1
        elif w - 1 in pattern:
            counts[w][w - 1] += 1
        else:
            counts[w][w] += 1

# 0 から高さ h の w に行けるパターン数
# dp[h][w]
dp = [[0 for _ in range(width)] for _ in range(height)]
dp[0] = counts[0].copy()
for h in range(height - 1):
    for w in range(width):
        # w に来れるパターン数
        dp[h + 1][w] = sum([dp[h][v] * counts[v][w] for v in range(width)]) % MOD

if width == 1:
    print(1)
else:
    print(dp[-1][k])


Measured memory_bytes: 3064
#include <stdio.h>
int main(){
	long int N,A,B,OUTPUT;
	scanf("%ld %ld %ld",&N,&A,&B);
	if(A>B){
		printf("0");
		return 0;
	}
	if(N==1){
		if(A!=B){
			printf("0");
			return 0;
		}
		printf("1");
		return 0;
	}
	OUTPUT = (N-2)*(B-A);
//	OUTPUT=(B*(N-1)+A) - (A*(N-1)+B);
	if(OUTPUT>0)OUTPUT++;
	if(OUTPUT==0)OUTPUT=1;
	if(OUTPUT<0)OUTPUT=0;
	printf("%ld\n",OUTPUT);
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int x,n;
    cin>>n;
    int cnt[4]={0};
    for(int i=0;i<n;i++){
        cin>>x;
        cnt[x]++;
    }
    double dp[n+1][n+1][n+1];
    memset(dp,0,sizeof dp);
    for(int k=0;k<=n;k++){
        for(int j=0;k+j<=n;j++){
            for(int i=0;i+j+k<=n;i++){
                if((i==0 && j==0 && k==0)||(i+j+k>n))
                    continue;
                double temp=n*1.0/(i+j+k),pi=i*1.0/(i+j+k),pj=j*1.0/(i+j+k),pk=k*1.0/(i+j+k);
                if(i){
                    dp[i][j][k]+=pi*dp[i-1][j][k];
                }
                if(j){
                    dp[i][j][k]+=pj*dp[i+1][j-1][k];
                }
                if(k){
                    dp[i][j][k]+=pk*dp[i][j+1][k-1];
                }
                dp[i][j][k]+=temp;
            }
        }
    }
    cout<<setprecision(11)<<dp[cnt[1]][cnt[2]][cnt[3]]<<endl;
}


Measured memory_bytes: 213376
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}



int main() {
	int n; cin >> n;
	int ans = 1;
	vec p(n); rep(i, n)cin >> p[i];
	int min = p[0];
	for (int i = 1; i < n; i++) {
		if (min > p[i]) {
			min = p[i];
			ans++;
		}

	}
	cout << ans << endl;




	return 0;
}

Measured memory_bytes: 1024
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = -1

if a[0][0] == -1 and a[1][1] == -1 and a[2][2] == -1:
    print("Yes")
    exit()

if a[0][2] == -1 and a[1][1] == -1 and a[2][0] == -1:
    print("Yes")
    exit()

for i in range(3):
    t = []
    for j in range(3):
        if a[i].count(-1) == 3:
            print("Yes")
            exit()
        t.append(a[j][i])
    if t.count(-1) == 3:
        print("Yes")
        exit()

print("No")


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

int main(){
    int n;cin >> n;
    vector<int> x(100000+10),y(100000+10),t(100000+10);
    for(int i=0;i<n;i++) cin >> t.at(i+1) >> x.at(i+1) >> y.at(i+1);
    int flag=1; 
    for(int i=0;i<n;i++){
        int dt;
        dt=t[i+1]-t[i];
        int dist=abs(x.at(i+1)-x[i]) + abs(y.at(i+1)-y[i]);
        if((dt<dist) || (dist%2!=dt%2)) flag=0;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    //cout << ((flag==1)? "Yes":"No") << endl;
}


Measured memory_bytes: 1408
import sys
from itertools import combinations

# https://ikatakos.com/pot/programming_algorithm/data_structure/union_find_tree
class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n
        self.n = n
        self.inconvenience = n * (n - 1) // 2

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        self.inconvenience -= d1 * d2
        if d1 <= d2:
            self.table[r2] = r1
            self.table[r1] += d2
        else:
            self.table[r1] = r2
            self.table[r2] += d1


def main():
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    bridges = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    ans = [0] * m
    ans[-1] = n * (n - 1) // 2
    uf = UnionFind(n)
    for i in range(m - 2, -1, -1):
        uf.union(*bridges[i + 1])
        ans[i] = uf.inconvenience
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 35552
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, m;
    cin >> n >> m;
    vector<plint> p(m);
    REP(i, m){
        cin >> p[i].fst >> p[i].snd;
    }
    sort(ALL(p));
    lint lb = p[0].fst;
    lint rb = p[0].snd;
    REP(i, m){
        lb = max(lb, p[i].fst);
        rb = min(rb, p[i].snd);
    }
    //debugpair(lb, rb);
    lint answer = 0;
    FOR(i, 1, n+1){
        if(lb <= i && i <= rb){
            answer++;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pb push_back
#define log(x,b) (log(b)/log(x))
#define rep(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int mod=1e9+7;

int32_t main()
{
    int w,a,b;
    cin>>w>>a>>b;
    if(b<a)swap(a,b);
    if(a<=b && b<=a+w)cout<<0<<endl;
    else {
        cout<<min(abs(b-(a+w)),abs(b-a))<<endl;
    }

    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const int MAX = 11000000;
const ll MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long FINV(int n){
    if (n < 0) return 0;
    return finv[n];
}

int main() {
    // 前処理
    COMinit();


    int n; cin >> n;
    ll ans = 1;
    rep(i,n){
        ans *= 3;
        ans %= MOD;
    }

    ll tmp = 0;
    ll two = 2;
    rep(i,n/2){
        tmp += COM(n, i) * two;
        tmp %= MOD;
        two *= 2;
        two %= MOD;
    }

    ans += MOD - tmp;
    ans %= MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 258048
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n := readInt()
	a := make([]int64, n)
	for i := range a {
		a[i] = readInt64()
	}
	b := make([]int64, n)
	for i := range b {
		b[i] = readInt64()
	}

	var x, y int64
	for i := 0; i < n; i++ {
		if a[i] < b[i] {
			x += (b[i] - a[i]) / 2
		} else if b[i] < a[i] {
			y += a[i] - b[i]
		}
	}
	if y <= x {
		println("Yes")
	} else {
		println("No")
	}

}

// -----------------------------------------------------------------------------


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	ll n,w;
	cin >> n >> w;
	vector<vector<ll>> dp(n, vector<ll>(w+1));
	for (int q = 0; q < n; q++)
	{
		ll weight,value;
		cin >> weight >> value;
		if (q == 0)
		{
			for (int e = weight; e <= w; e++)
			{
				dp[q][e] = value;
			}
		}
		else
		{
			for (int e = 0; e <= w; e++)
			{
				dp[q][e] = dp[q-1][e];
				if (e >= weight)
				{
					dp[q][e] = max(dp[q][e], value+dp[q-1][e-weight]);
				}
			}
		}
	}
	cout << dp[n-1][w] << "\n";
	return 0;
}


Measured memory_bytes: 79360
# import numpy as np
# import copy
from collections import defaultdict
import queue


q = queue.Queue()

n, m = map(int, input().split())
graph = defaultdict(list)
for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    graph[a].append(b)
    graph[b].append(a)


# l = np.array(l)
# lc = copy.deepcopy(l)
li = [-1 for _ in range(n)]
li[0] = 1

def search(x):
#     if sum(l[x]) == 0:
#         q.queue = False
#         return
    
#     ind_lis = np.where(lc[x] == 1)[0]
#     ind_lis = [e for e in ind_lis if li[e] == -1]
#     print(li)
#     print(lc[x])
    for e in graph[x]:
#         print(e)
        if li[e-1] != -1:
            continue
        li[e-1] = x
#         print('q', i+1)
        q.put(e)
x = 1
search(x)
while q.queue:
    search(q.get())

if li[1:].count(-1) == 0:
    print('Yes')
    for e in li[1:]:
        print(e)
else:
    print('No')


Measured memory_bytes: 39144
// Aizu Vol0 0004: Simultaneous Equation
// 2017.7.30

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char bug[] = "-0.000";

int main()
{
	double a1, b1, c1, a2, b2, c2;
	double d, d1, d2;
	char x[10], y[10], *xp, *yp;

	while (scanf("%lf%lf%lf%lf%lf%lf", &a1, &b1, &c1, &a2, &b2, &c2) == 6) {
		d  = a1*b2 - a2*b1;
		d1 = c1*b2 - c2*b1;
		d2 = a1*c2 - a2*c1;
		sprintf(x, "%.3lf", d1 / d); xp = x;
		sprintf(y, "%.3lf", d2 / d); yp = y;
		if (!strcmp(x, bug)) xp++;
		if (!strcmp(y, bug)) yp++;
		printf("%s %s\n", xp, yp);
	}
	return 0;
}

Measured memory_bytes: 672
s = input().split()

len_id = 0; max_len = 0
cnt_id = 0; max_cnt = 0

for i in range(len(s)):
    l = len(s[i])
    c = s.count(s[i])
    if l > max_len:
        max_len = l
        len_id = i
    if c > max_cnt:
        max_cnt = c
        cnt_id = i
print(s[cnt_id], s[len_id])


Measured memory_bytes: 5552
#include<iostream>

using namespace std;

const int MAX = 100;
static int u[MAX][MAX];


int main() {


	int n, uid, ap, tmp;
	cin >> n;


	for (int i = 0;i < n;i++) {
		cin >> uid >> ap;
		for (int k = 0;k < ap;k++) {
			cin >> tmp;
			u[uid - 1][tmp - 1] = 1;
		}
	}

	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++) {
			if (k > 0) cout << ' ';
			cout << u[i][k];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] list = new int[n];
		int count = 0;

		for (int i = 0; i < n; i++) {
			list[i] = sc.nextInt();

			if (list[i] < k) {
				count++;
			}
		}

		System.out.println(n - count);

		sc.close();

	}
}

Measured memory_bytes: 59300
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 1;
        int c = b + 1;
        while(a > (c + b)){
            count++;
            c = c + 2 * b + 1;
        }
        System.out.print(count);
	}
}

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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0) {
		cout << "Zero" << endl;
		return 0;
	}
	if (a < 0 && (((abs(a) - abs(b)) + 1) & 1)) {
		cout << "Negative" << endl;
	} else {
		cout << "Positive" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string S,T;
  cin>>S>>T;
  int sum;
  int n=S.size();
  for(int i=0;i<n;i++){
    if(S.at(i)!=T.at(i)){
      sum++;
 
    }
  }
  if(sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

#define MAX 1000

int judge(int size,char g[MAX][MAX]){
    int dp[MAX][MAX];
    
    for(int i = 0 ; i < size ; i++){
        dp[0][i] = (g[0][i] == '*') ? 0 : 1;
        dp[i][0] = (g[i][0] == '*') ? 0 : 1;
    }

    int mw = 0;
    for(int i = 1 ; i < size ; i++){
        for(int j = 1 ; j < size ; j++){
            if(g[i][j] =='*') dp[i][j] = 0;
            else{
                dp[i][j] = min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]))+1;
                mw = max(mw,dp[i][j]);
            }
        }
    }
    
    return mw;
}

int main(){
    int n;
    char g[MAX][MAX];
    

    while(cin >> n,n){
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < n ; j++)
            cin >> g[i][j];
    
    cout << judge(n,g) << endl;
    }
    
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split();
        var A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split();
        var B = new int[N];
        for (int i = 0; i < N; i++)
        {
            B[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split();
        var C = new int[N - 1];
        for (int i = 0; i < N-1; i++)
        {
            C[i] = int.Parse(input[i]);
        }

        var ans = B.Sum();
        for (int i = 0; i < N - 1; i++)
        {
            if (A[i] == A[i + 1] - 1)
            {
                ans += C[A[i] - 1];
            }
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13268
#include <stdio.h>

int main()
{
    int x,y;

    for(;;) {
        scanf("%d %d", &x,&y);

        if((x == 0)&&(y == 0)) {
            break;
        }

        if (x <= y) {
          printf("%d %d\n", x,y);
        } else {
          printf("%d %d\n", y,x);
        }
        
    }

    return(0);
}



Measured memory_bytes: 2040
#include"iostream"
#include"vector"
#include "algorithm"
using namespace std;
int main(void) {
	int long long a, b, tmp, res = 0;
	vector<int long long> v;
	cin >> a >> b;

	for (int i = 0; i < a; i++) {
		cin >> tmp;
		v.push_back(tmp);
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());

	for (int i = b; i < a; i++) {
		res += v.at(i);
	}

	cout << res;

	return 0;
}

Measured memory_bytes: 2420
// atcoder/abc089/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<string> v(n);
    cin >> v;
    cout << (count(begin(v), end(v), "Y") ? "Four" : "Three") << endl;

  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
#include <deque>
using namespace std;
int n, m, i, j, k, t=0;
char a[60];
long long l=1;
vector<int> b;
int main(){
	cin>>n;
	cin>>a>>a;
	for(i=0;i<=n-1;i++){
		if(i==0){
			b.push_back(1);
			t++;
		}
		else{
			if(a[i]!=a[i-1]){
			b.push_back(1);
			t++;
			}
			else b[t-1]++;
		}
	}
	for(i=0;i<=t-1;i++){
		if(i==0){
			if(b[i]==1) l*=3;
			else l*=6;
			l%=1000000007;
		}
		else{
			if(b[i-1]==1) l*=2;
			else l*=2*b[i]-1;
			l%=1000000007;
		}
	}
	cout<<l;
	return 0;
}

Measured memory_bytes: 256
import math

def Area_perimeter(r):
    p = 2*math.pi*r
    a = math.pi*pow(r,2)
    return p,a


def main():
    r = float(input())
    p,a = Area_perimeter(r)
    print("%.6f %.6f"%(a,p))

if __name__ == "__main__":
    main()


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

int main() {
	string S;
	cin >> S;
	bool AC=true;
	if (S[0]!='A') AC=false;
	int count=0;
	for (int i=2; i<S.length()-1; i++){
	    if (S[i]=='C') count++;
	}
	if (count!=1) AC=false;
	int COUNT=0;
	for (int i=0; i<S.length(); i++){
	    if (S[i]>='A' && S[i]<='Z') COUNT++;
	}
	if (COUNT!=2) AC=false;
	if (AC) cout << "AC" << endl;
	else cout << "WA" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n, x;
    cin >> n >> x;
    int ans = 1, cur = 0;
    for(int i = 0; i < n; ++i){
        int tmp; cin >> tmp;
        cur += tmp;
        if(cur <= x)ans++;
        else break;
    }
    cout << ans;
    return 0;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long mod=1e9+7;
struct nCk{
	long long pow(long long x,long long n){
		long long ret=1;
		if(n>0){
			ret=pow(x,n/2);
			if(n%2==0){
				(ret=(ret*ret))%=mod;
			}else{
				(ret=((ret*ret)%mod)*x)%=mod;
			}
		}
		return ret;
	}
	long long inv(long long n){
		return pow(n,mod-2);
	}
	long long nck(long long n,long long k){
		long long ret=1;
		for(int i=n;i>n-k;i--){
			(ret*=i)%=mod;
		}
		for(int i=k;i>=1;i--){
			(ret*=inv(i))%=mod;
		}
		return ret;
	}
};
int main(){
	long long n,a,b;
	cin>>n>>a>>b;
	nCk nii;
	long long ans=nii.pow(2,n);
	(ans+=mod-1)%=mod;
	long long A=nii.nck(n,a);
	long long B=nii.nck(n,b);
	(ans+=mod-A)%=mod;
	(ans+=mod-B)%=mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-11 14:10:37 +0900
# LastModified: 2020-09-11 14:16:43 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = input()
    if S.count('0') < S.count('1'):
        print(S.count('0')*2)
    else:
        print(S.count('1')*2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9212
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
if a%3==0 or b%3==0 or (a+b)%3==0:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 74664
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define sz size
#define re return
#define gl getline
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,a,b) for(int i=a;i<=b;i++)
#define all(a) (a).begin(),(a).end()
#define inf 1<<30
long long n;
int main(){
	ios::sync_with_stdio(false),cin.tie(0);
	int ans=0,use=0;
	string fir;
	cin>>n;
	cin>>fir;
	rep(i,0,n)if(fir.at(i)=='R')use++;
	rep(i,0,use)if(fir.at(i)=='W')ans++;
	cout<<ans<<endl;
	re 0;
}

Measured memory_bytes: 3740
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        for(int i=0; i<n; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        int cnt = 0;
        for(int i=0; i<n; i++) {
            double distance = Math.sqrt(Math.pow(x[i],2)+Math.pow(y[i],2));
            if(distance <= d) cnt++;
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 60976
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = 0

    for i in a:
        count = 0
        while i // 2 * 2 == i:
            i = i // 2
            count += 1
        ans += count

    print(ans)

if __name__ == '__main__':
    main()


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

int main()
{
    int n;
    string a,b,c;
    cin>>n;
    cin>>a>>b;
    for(int i=0;i<n;i++)
    {
        c.push_back(a[i]);
        c.push_back(b[i]);
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()

    var a: MutableList<Int> = mutableListOf()

    for (i in 0..n-1) {
        a.add(cin.nextInt())
    }

    var f = 0
    var prev = a[0]
    var ans = 1
    for (i in 0..n-1) {
        if (f == 0) {
            if (a[i] > prev) {
                f = -1
            } else if (prev > a[i]) {
                f = 1
            }
        } else if (f == 1) {
            if (a[i] > prev) {
                ans += 1
                f = 0
            }
        } else if (f == -1) {
            if (prev > a[i]) {
                ans += 1
                f = 0
            }
        }
        prev = a[i]
    }

    println(ans)
}

Measured memory_bytes: 57712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll N;
void dfs(ll n, string s, ll m){
    if(n==N){
        cout << s << "\n";
        return;
    }

    rep(i,m+1){
        char c = 'a' + i;
        dfs(n + 1, s + c, m);
    }
    char next = 'a' + m + 1;
    dfs(n + 1, s+next , m + 1);
}
int main() {
    init();
    cin >> N;
    dfs(1, "a", 0);
}

Measured memory_bytes: 1536
#include <iostream>
using namespace std;
long long n, a, b;
int main()
{
	cin >> n >> a >> b;
	if(n > 1 && b >= a || n == 1 && a == b)
	{
		cout << (n - 2) * (b - a) + 1 << endl;
		return 0;
	}
	cout << 0 << endl;
	return 0;
}


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

using namespace std;

int main()
{
   int n, m;
   cin>>n>>m;
   vector<vector<long long>>dp(n, vector<long long>(m));
   vector<vector<char>>grid(n, vector<char>(m));
   
   for(int i=0; i<n; i++){
       for(int j=0; j<m; j++){
           cin>>grid[i][j];
       }
   }
   
   dp[0][0] = 1;
   for(int i=1; i<m; i++){
       if(grid[0][i] == '.') dp[0][i] = dp[0][i-1];
       else dp[0][i] = 0;
   }
    for(int i=1; i<n; i++){
       if(grid[i][0] == '.') dp[i][0] = dp[i-1][0];
       else dp[i][0] = 0;
   }
   
   for(int i=1; i<n; i++){
       for(int j=1; j<m; j++){
           if(grid[i][j] == '#') dp[i][j] = 0;
           else dp[i][j] = (dp[i-1][j]%1000000007 + dp[i][j-1]%1000000007)%1000000007;
       }
   }
   cout<<(dp[n-1][m-1])<<endl;
   return 0;
}

Measured memory_bytes: 9088
#写経AC
import numpy as np
H,W = map(int,input().split())
L = np.zeros((H,W),int)
R = np.zeros((H,W),int)
D = np.zeros((H,W),int)
U = np.zeros((H,W),int)
S = np.array([list(input()) for h in range(H)])=="."

for h in range(H):
  U[h] = S[h]*(U[h-1]+1)
  D[-h-1] = S[-h-1]*(D[-h]+1)

for w in range(W):
  L[:,w] = S[:,w]*(L[:,w-1]+1)
  R[:,-w-1] = S[:,-w-1]*(R[:,-w]+1)

print(np.max(U+D+L+R)-3)


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


ll mpow(ll m, ll p){
  ll power = m;
  ll res = 1;
  while(p>0){
    if(p&1)
      res = res*power%MOD;
    power = (power*power)%MOD;
    p /= 2;
  }

  return res;
}

ll mod_inv(ll m){
  return mpow(m, MOD-2);
}

struct COM{
  vll fact, fact_inv;
  COM(ll n): fact(n+1,1), fact_inv(n+1,1){
    for(ll i=1; i<=n; i++)
      fact[i] = fact[i-1]*i%MOD;

    fact_inv[n] = mod_inv(fact[n]);
    for(ll i=n; i>=1; i--)
      fact_inv[i-1] = fact_inv[i]*i%MOD;
  }

  ll calc(ll n, ll k){
    if(k<0 || n<k)
      return 0;
    ll res = fact[n]*fact_inv[n-k]%MOD*fact_inv[k]%MOD;
    return res;
  }
};

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

  ll n,m,k;
  cin>>n>>m>>k;

  COM com(n*m);
  ll ans2=0;
  for(ll d=1; d<=m-1; d++){
    ll cost=d*n*n*(m-d)%MOD;
    ans2=(ans2+com.calc(n*m-2,k-2)*cost%MOD)%MOD;
  }
  for(ll d=1; d<=n-1; d++){
    ll cost=d*m*m*(n-d)%MOD;
    ans2=(ans2+com.calc(n*m-2,k-2)*cost%MOD)%MOD;
  }

  cout<<ans2<<endl;
}



Measured memory_bytes: 3328
# バックトラック法
class EightQueens:
    def __init__(self,p):
        self.p = p
        # 前提 8*8の盤
        self.N = 8
        # 下準備
        # row[k] : k行目におけるクイーンの列番号
        self.row = [None] * 8
        # col[n] : n列目上にクイーンがなければFREE,あればNOT_FREE,それが8列分
        self.col = ['FREE'] * 8
        # 8 * 8 のマスに対角線を引いていくと15本引くことができる
        # dpos : 45度方向の対角線　dneg : 135度方向の対角線
        self.dpos = ['FREE'] * 15
        self.dneg = ['FREE'] * 15

        # 入力された位置にクイーンを置く
        i = 0
        while i < len(p):
            self.row[p[i][0]] = p[i][1]
            self.col[p[i][1]] = self.dpos[p[i][0] + p[i][1]] = self.dneg[p[i][0] - p[i][1] + self.N - 1] = 'NOT_FREE'
            i = i + 1


        # self.printBoard()

    """
    盤面の状態を表示
    """
    def printBoard(self):
        i = 0
        while i < self.N:
            j = 0
            while j < self.N:
                if j == self.row[i]:
                    print("Q", end="")
                # elif self.col[j] == 'NOT_FREE' or self.dpos[i+j] == 'NOT_FREE' or self.dneg[i-j + self.N-1] == 'NOT_FREE':
                    # print("N ", end="")
                else:
                    print(".", end="")
                    #print("F ", end="")
                j = j + 1
            print()
            i = i + 1
        return

    def putQueen(self,i):
        N = self.N

        # 初期化で置かれたクイーンだったらスキップ
        k = 0
        while k < len(self.p):
            if i == self.p[k][0]:
                i = i + 1
                k = 0
            k = k + 1


        # iが8(9行目)に到達したら終了
        if i == N:
            # print("解を発見")
            self.printBoard()
            return

        j = 0
        while j < N :
            # print(str(i)+", "+str(j))
            # self.printBoard()

            # 置こうとした位置がそれ以前の行のクイーンの領域だったら次の列へスキップ
            if self.col[j] == 'NOT_FREE' or self.dpos[i+j] == 'NOT_FREE' or self.dneg[i-j + N-1] == 'NOT_FREE':
                # print("置けません")
                j = j + 1
                continue

            # クイーンを(i,j)に置く
            self.row[i] = j

            # print()
            self.col[j] = self.dpos[i+j] = self.dneg[i-j+N-1] = 'NOT_FREE'
            # 次の行にクイーンを置くことを試みる（ダメだったら戻る）
            self.putQueen(i+1)
            # バックトラックキングのために(i,j)からクイーンを取り除く
            self.col[j] = self.dpos[i+j] = self.dneg[i-j+N-1] = 'FREE'
            j = j + 1
        return





def main():
    p = []  ##appendのために宣言が必要
    # 入力受付
    k = int(input())
    i = 0
    while i < k:
        try:
            p.append(list(map(int, input().split())))
            i = i + 1
        except:
            break;

    # 読み込み完了
    # pを行でソート
    p.sort()
    q = EightQueens(p)
    q.putQueen(0)
    return






if __name__ == '__main__':
    main()


Measured memory_bytes: 5632
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll h;
	cin >> h;

	ll x = 0;
	for (ll i = 0; ; i++)
	{
		if (pow(2, i) > h)
		{
			x = i;
			break;
		}
	}

	println((ll)pow(2, x) - 1);
}


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

int main(){
    long int N;
    cin >> N;
    long int a[N];
    map<long int,long int> mp;
    long int ans=0;
    for(long int i=0;i<N;i++){
        cin >> a[i];
        mp[i+1+a[i]]++;
        ans+=mp[i+1-a[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 27896
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
# input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a, b, c, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        if n >= i * a + j * b and (n - i * a - j * b) % c == 0:
            ans += 1
print(ans)


Measured memory_bytes: 41196
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
typedef complex<double> xy_t;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll sum = 0;
    for (ll i = 1; i <= n; ++i) {
        int flg = 0;
        if ((n - i) % i == 0) {
            if ((n - i) / i <= i) {
                flg = 1;
                break;
            }
            sum += (n - i) / i;
        } else {
            long double tmp = (double)(n - i) / i;
            if (tmp <= i) {
                flg = 1;
                break;
            }
        }
        if (flg) break;
    }
    cout << sum << endl;
}


Measured memory_bytes: 256