akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n, x, t;
  cin>>n>>x>>t;
  int ans = (n + x - 1) / x * t;
  cout << ans << endl;
  return 0;
}


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

int solve();

int main()
{
	printf("%d\n", solve());

	return 0;
}

int solve()
{
	int N;
	scanf("%d", &N);
	using vi = std::vector<int>;
	std::vector<vi> id(N, vi(N, -1));
	{
		int counter{};
		for (int i{}; i < N; i++)
			for (int j{}; j < i; j++)
			{
				id[i][j] = counter;
				counter++;
			}
		for (int i{}; i < N; i++)
			for (int j{i + 1}; j < N; j++)
				id[i][j] = id[j][i];
	}
	std::vector<vi> edges(N * (N - 1) / 2);
	for (int i{}; i < N; i++)
	{
		int prev;
		scanf("%d", &prev);
		prev--;
		for (int j{}; j < N - 2; j++)
		{
			int A;
			scanf("%d", &A);
			A--;
			edges[id[i][prev]].push_back(id[i][A]);
			prev = A;
		}
	}

	std::vector<int> rest(edges.size());
	for (auto& e: edges)
		for (auto& f: e)
			rest[f]++;
	
	std::vector<int> count(edges.size(), -1);
	std::queue<int> que;
	int max{-1};
	for (int i{}; i < (int)rest.size(); i++)
	{
		if (rest[i] > 0) continue;
		que.push(i);
		count[i] = 1;
	}
	while (!que.empty())
	{
		auto now{que.front()};
		que.pop();
		max = std::max(max, count[now]);
		for (auto& e: edges[now])
		{
			rest[e]--;
			if (rest[e] == 0)
			{
				if (count[e] >= 0) return -1;
				que.push(e);
				count[e] = count[now] + 1;
			}
		}
	}
	for (auto& e: count)
		if (e == -1)
			return -1;
	return max;
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#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 all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll X, ll K, ll D) {
  ll ans = LINF;
  X = abs(X);

  if (X / D >= K) {
    ans = X - D * K;
  } else {
    ll l = K - X / D;
    if (l % 2 == 0) {
      ans = X - (X / D) * D;
    } else {
      ans = X - (X / D + 1) * D;
    }
  }

  cout << abs(ans) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll X;
  scanf("%lld", &X);
  ll K;
  scanf("%lld", &K);
  ll D;
  scanf("%lld", &D);
  solve(X, K, D);
  return 0;
}


Measured memory_bytes: 3704
class Expression
  def initialize(x)
    @terms = [Term.new(x)]
    @eval = x
  end

  attr_reader :eval

  def mult(x)
    diff = @terms[-1].mult(x)
    @eval += diff
  end

  def add(x)
    @terms << Term.new(x)
    @eval += x
  end

  def shrinkable?
    @terms.size > 1 || @terms[0].shrinkable?
  end

  def shrink
    diff = @terms[0].shrink
    @eval += diff
    @terms.shift if @terms[0].empty?
  end

  def count
    if @terms.size == 1
      @terms[0].count
    else
      @terms[0].count_l * @terms[-1].count_r
    end
  end
end

class Term
  def initialize(x)
    @a = [[x, 1]]
    @eval = x
  end

  attr_reader :eval

  def mult(x)
    old = @eval
    if x == 1
      @a[-1][1] += 1
    else
      @a << [x, 1]
      @eval *= x
    end
    @eval - old
  end

  def shrinkable?
    @a.size > 1 || (@a[0][0] > 1 && @a[0][1] > 1)
  end

  def shrink
    old = @eval
    @eval /= @a[0][0]
    if @a[0][0] > 1 && @a[0][1] > 1
      @a[0][0] = 1
      @a[0][1] -= 1
    else
      @a.shift
    end
    @eval = 0 if empty?
    @eval - old
  end

  def count
    if @a.size == 1
      n = @a[0][1]
      if @a[0][0] == 1
        n * (n + 1) / 2
      else
        n
      end
    else
      count_l * count_r
    end
  end

  def count_l
    @a[0][0] == 1 ? @a[0][1] : 1
  end

  def count_r
    @a[-1][1]
  end

  def empty?
    @a.empty?
  end
end

def calc_noparen_exp(n, a)
  k = 0

  i = 0
  exp = Expression.new(a[i])

  check_mult1 = proc do
    while a[i + 1] == ?* && a[i + 2] == 1
      exp.mult(1)
      i += 2
    end
  end

  expand = proc do
    if a[i + 1] == ?+
      exp.add(a[i + 2])
    else
      exp.mult(a[i + 2])
    end
    i += 2
    check_mult1[]
  end

  check_mult1[]

  loop do
    expand[] while exp.eval < n && i < a.size - 1

    k += exp.count if exp.eval == n

    if exp.shrinkable?
      exp.shrink
    elsif i < a.size - 1
      expand[]
    else
      break
    end
  end

  k
end

def truncated_value(n, a)
  x = r = a[0]
  a[1..-1].each_slice(2) do |op, y|
    if op == ?+
      r = y
      x += r
    else
      old = r
      r *= y
      x += r - old
    end
    break if x > n
  end
  x > n ? n + 1 : x
end

loop do
  n = gets.to_i
  break if n == 0
  s = gets.chomp
  stack = []
  answer = 0
  s.each_char do |c|
    if c == ?)
      a = []
      a.unshift stack.pop until a[0] == ?(
      a.shift
      answer += calc_noparen_exp(n, a)
      stack << truncated_value(n, a)
    elsif c == ?( || c == ?+ || c == ?*
      stack << c
    else
      stack << c.to_i
    end
  end
  answer += calc_noparen_exp(n, stack)
  p answer
end


Measured memory_bytes: 296084
#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a > b) {
        for(int i=0; i<a; i++){
            cout << b;
        }
        cout << endl;
    }
    else{
        for(int i=0; i<b; i++){
            cout << a ;
        }
        cout << endl;
    }
    return 0;
}

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

int main()
{
	int a, b, c,coun=0;
	cin >> a >> b >> c;
	for (size_t i = a; i <= b; i++)
	{
		if (c%i == 0) {
			coun++;
		}
	}cout << coun<<endl;
    return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  
  string board[50];
  for(int i=0;i<N;i++){
    cin >> board[i];
  }
  
  vector<int> dx={0,0,1,-1};
  vector<int> dy={1,-1,0,0};
  
  bool can=true;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(board[i][j]=='#'){
        int cnt=0;
        for(int k=0;k<4;k++){
          int x=i+dx[k];
          int y=j+dy[k];
          if(x<0||x>=N||y<0||y>=M){
            continue;
          }
          if(board[x][y]=='#'){
            break;
          }
          if(k==3){
            can=false;
          }
        }
      }
        
      if(!can){
        break;
      }
    }
    if(!can){
      break;
    }
  }

  if(can){
      cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
}

      

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int dp[100001];
int a[100001];
int fn(int n)
{ 
  if(n<=0)
    return 0;
  
  if(dp[n]!=-1)
    return dp[n];
   if(n>=2)
   dp[n]=min(fn(n-1)+abs(a[n-1]-a[n]),fn(n-2)+abs(a[n-2]-a[n]));

  else if(n>=1)
      dp[n]=fn(n-1)+abs(a[n-1]-a[n]);
  return dp[n];
}
 
int main()
{
  int n;cin>>n;
  for(int i=0;i<n;i++)
    dp[i]=-1;
  
 
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  cout<<fn(n-1);
  
}

Measured memory_bytes: 2560
S = list(map(str, input().split()))
count = len(S)
stack = []
for i in range(count):
    if S[i] == "+":
        b = stack.pop()
        a = stack.pop()
        stack.append(a + b)
    elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
    elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(S[i]))

print(stack[0])


Measured memory_bytes: 5604
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    print((a-1)*(b-1))
    return

#B
def B():
    def est(n):
        res = 0
        for i in range(1, int(n ** 0.5) + 1):
            if not n % i:
                res += 2
        res -= float.is_integer(n ** 0.5)
        return res == 8
    n = II()
    ans = 0
    for i in range(1, n + 1, 2):
        ans += est(i)
    print(ans)
    return

#C
def C():
    s = S()
    k = II()
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return
    print(s[k-1])
    return

# D
# 解説AC
# 始点と終点を2次元座標に落とし込むことで解ける
# 難しい
def D():
    n, m, q = LI()
    c = [[0] * (n+1) for i in range(n+1)]
    for _ in range(m):
        l, r = LI()
        c[r][l] += 1
    for y in range(1, n + 1):
        cy = c[y]
        for x in range(1, n + 1):
            cy[x] += cy[x - 1]
    for x in range(1, n + 1):
        for y in range(1, n + 1):
            c[y][x] += c[y - 1][x]
    for _ in range(q):
        p, q = LI()
        ans = c[q][q] - c[q][p - 1] - c[p - 1][q] + c[p - 1][p - 1]
        print(ans)
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 57308
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int> > c(10, vector<int>(10, 0));

void warshall_floyd() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      for (int k = 0; k < 10; ++k) {
        c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
      }
    }
  }
}

int main() {
  int h, w; cin >> h >> w;
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> c[i][j];
    }
  }
  vector<vector<int> > a(h, vector<int>(w, 0));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> a[i][j];
    }
  }
  warshall_floyd();
  int ans = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (a[i][j] != -1) {
        ans += c[a[i][j]][1];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template
void chmin(int &a,int b){
  a=min(a,b);
}
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;///res%=MOD;
    n*=n;//n%=MOD;
    k>>=1;
  }
  return res;
}
//main
signed main(){
  int N,M;cin>>N>>M;
  int T=pw(2,N);

  std::vector<int> a(M),key(M,0);

  for(int i=0;i<M;i++){
    int b;cin>>a[i]>>b;
    while(b--){
      int k;cin>>k;k--;
      key[i]|=(1<<k);
    }
  }

  std::vector<int> open(10000,INF);
  open[0]=0;

  for(int i=0;i<M;i++)
    for(int j=0;j<T;j++)
      chmin(open[j|key[i]],open[j]+a[i]);

  if(open[T-1]>=INF)fin(-1);
  fin(open[T-1]);
}


Measured memory_bytes: 384
a, b = map(int, input().split())
gcd = 0

x = max(a, b)
y = min(a, b)
if x % y == 0:
    gcd = y
else:
    while x % y != 0:
        z = x % y
        x = y
        y = z
    gcd = z

ans = a * b / gcd

print(int(ans))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

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

	if (n == m) {
		bool flag = 1;
		for (int i = 0; i < n; i++)
			if (a[i] != b[i])
				flag = 0;
		if (flag) {
			cout << "Yes" << endl;
			return 0;
		}

	}

	//左上座標
	for (int i = 0; i < n - m; i++) {
		for (int j = 0; j < n - m; j++) {
			bool flag = 1;
			for (int k = 0; k < m; k++) {
				for (int l = 0; l < m; l++) {
					if (a[k + i][l + j] != b[k][l])
						flag = 0;
				}
			}
			if (flag) {
				cout << "Yes" << endl;
				return 0;
			}

		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    while(N > 0){
        N /= K;
        ans++;
    }
    PRINT(ans);
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int ll_length(ll a) { return to_string(a).length(); }

int main() {
  ll n;
  cin >> n;
  int ans = INT_MAX;

  FOR(i, 1, sqrt(n) + 1) {
    if (n % i != 0) continue;
    ll a = n / i;
    ans = min(ans, max(ll_length(a), ll_length(i)));
  }

  cout << ans << endl;
}

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

const ll INF = (ll)1e18;
struct LazySegmentTree {
    int n;
    vector<ll> node, lazy;
    vector<bool> lazyFlag;

    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1;
        while (n < sz)
            n *= 2;
        node.resize(2 * n - 1);
        lazy.resize(2 * n - 1, INF);
        lazyFlag.resize(2 * n - 1, false);

        for (int i = 0; i < sz; i++)
            node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; i--)
            node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
    }

    void lazyEvaluate(int k, int l, int r) {
        if (lazyFlag[k]) {
            node[k] = min(node[k], lazy[k]);
            if (r - l > 1) {
                lazy[k * 2 + 1] = min(lazy[k * 2 + 1], lazy[k]);
                lazy[k * 2 + 2] = min(lazy[k * 2 + 2], lazy[k]);
                lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
            }
            lazyFlag[k] = false;
        }
    }

    void update(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = n;
        lazyEvaluate(k, l, r);
        if (b <= l || r <= a)
            return;
        if (a <= l && r <= b) {
            lazy[k] = x;
            lazyFlag[k] = true;
            lazyEvaluate(k, l, r);
        } else {
            update(a, b, x, 2 * k + 1, l, (l + r) / 2);
            update(a, b, x, 2 * k + 2, (l + r) / 2, r);
            node[k] = min(node[2 * k + 1], node[2 * k + 2]);
        }
    }

    ll find(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = n;
        lazyEvaluate(k, l, r);
        if (b <= l || r <= a)
            return 1e18; // INF
        if (a <= l && r <= b)
            return node[k];
        ll vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

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

    int n, m;
    cin >> n >> m;
    vector<tuple<ll, ll, ll>> lrc(m);
    rep(i, 0, m) cin >> get<0>(lrc[i]) >> get<1>(lrc[i]) >> get<2>(lrc[i]);
    sort(lrc.begin(), lrc.end());

    vector<ll> z(n + 1, 1e16);
    z[0] = z[1] = 0;
    LazySegmentTree seg(z);

    rep(i, 0, m) {
        int l = get<0>(lrc[i]), r = get<1>(lrc[i]);
        ll x = get<2>(lrc[i]);
        x += seg.find(l, l + 1);

        seg.update(l + 1, r + 1, x);
    }
    ll ans = seg.find(n, n + 1);
    if (ans < 1e16)
        cout << ans << endl;
    else
        cout << -1 << endl;
    // rep(i, 1, n + 1) cout << seg.find(i, i + 1) << endl;
    return 0;
}

Measured memory_bytes: 8192
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

vector<int> enum_div(int n) {
  vector<int> ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i != (n / i) && i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  return ret;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int res = 0;
  if(n>=105){
    for(int i=105; i<n+1; i+=2){
      if(enum_div(i).size() == 8) res++;
    }
  }
	
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll sx;
  ll sy;
  ll tx;
  ll ty;
  cin >>sx>>sy>>tx>>ty;
  ll a=tx-sx;
  ll b=ty-sy;
  sx=0;
  sy=0;
  tx=a;
  ty=b;
  
  
  
  
  repl(i,0,tx) {
    cout<<'R';
  }
  repl(i,0,ty) {
    cout<<'U';
  }
  repl(i,0,tx) {
    cout<<'L';
  }
  repl(i,0,ty) {
    cout<<'D';
  }
  
  cout<<'L';
  
  repl(i,0,ty+1) {
    cout<<'U';
  }
  repl(i,0,tx+1) {
    cout<<'R';
  }
  cout<<'D';
  
  
  cout<<'R';
  repl(i,0,ty+1) {
    cout<<'D';
  }
  rep(i,tx+1) {
    cout<<'L';
  }
  cout<<'U';




cout<<endl;
}
  
  
  
  

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	double a, b, h, m; cin >> a >> b >> h >> m;
	double time_t = h / (double)12 * 360 + m / (double) 60 / 12 * 360;
	double min_t = m / (double) 60 * 360;
	double t = abs(time_t - min_t);
	if(t > 180) t = 360 - t;


	double ans = a * a + b * b - 2 * a * b * cos(M_PI * (t / (double)180));
	cout <<  sqrt(ans) << endl;
	return 0;
}


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

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

  string answer = "";
  if ( a < 0 ) {
    if ( b < 0 ) {
      int count = b - a + 1;
      if ( count % 2 == 0 ) {
        answer = "Positive";
      }
      else {
        answer = "Negative";
      }
    }
    else {
      answer = "Zero";
    }
  }
  else if ( a == 0 ) {
    answer = "Zero";
  }
  else {
    answer = "Positive";
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n;
  int t[n];
  for(int i=0;i<n;i++){
    cin >> t[i];
  }
  cin >> m;
  int p[m],x[m];
  for(int i=0;i<m;i++){
    cin >> p[i] >> x[i];
  }
  for(int i=0;i<m;i++){
    int ans=0;
    for(int j=0;j<n;j++){
      if(j+1!=p[i]){
        ans+=t[j];
      }else{
        ans+=x[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	const int P=1e9+7;
	const int inv2=P-P/2;
	int n;
	cin>>n;
	int sum=0,sq=0;
	int ans=0;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		ans=(ans+1ll*sum*a)%P;
		sum=(sum+a)%P;
	}
	cout<<ans;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
#include<map>
#include<vector>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int maxn=100010,MOD=int(1e9)+7;
int N,K,deg[maxn],fac[maxn],inv[maxn],invfac[maxn];
int p(int n,int m){
	if(n<m||n<0||m<0)return 0;
	return 1LL*fac[n]*invfac[n-m]%MOD;
}
int main(){
	//freopen("in","r",stdin);
	inv[0]=inv[1]=1;
	for(int i=2;i<maxn;i++)
		inv[i]=1LL*(MOD-MOD/i)*inv[MOD%i]%MOD;
	fac[0]=invfac[0]=1;
	for(int i=1;i<maxn;i++)
		fac[i]=1LL*fac[i-1]*i%MOD,invfac[i]=1LL*invfac[i-1]*inv[i]%MOD;
	N=read(),K=read();
	for(int i=1;i<N;i++)
		deg[read()]++,deg[read()]++;
	int ans=1LL*K*p(K-1,deg[1])%MOD;
	for(int i=2;i<=N;i++)
		ans=1LL*ans*p(K-2,deg[i]-1)%MOD;
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 1792
package main

import "fmt"

func main() {

	var a, b int
	fmt.Scan(&a, &b)

	if a+b >= a-b {
		if a+b >= a*b {
			fmt.Println(a + b)
		} else if a+b < a*b {
			fmt.Println(a * b)
		}
	} else if a+b < a-b {
		if a-b >= a*b {
			fmt.Println(a - b)
		} else if a-b < a*b {
			fmt.Println(a * b)
		}

	}
}


Measured memory_bytes: 512
#include <iostream>
    #include <cstdio>
    using namespace std;
    const int maxn = 100000 + 5;
      struct node{
      char my_name[10];
      int my_time;
    };

    int n,q;
    int head,tail;
    int q_time = 0;
    node que[maxn];

    void push_back(node& k){
      que[tail++] = k;
      tail %= (n+5);
    }

    node pop_front(){
    node k = que[head++];
    head %= (n+5);
    return k;
    }

    int main(){
    scanf("%d%d",&n,&q);
    head = 0;
    tail = 0;
    for(int i = 1;i <= n; i++){
    node Q;
    scanf("%s%d",Q.my_name,&Q.my_time);
    push_back(Q);
    }
    while(head != tail){
    node k = pop_front();
    if(k.my_time - q > 0){
    k.my_time -= q;
    push_back(k);
    q_time += q;
    }
    else{
    q_time += k.my_time;
    printf("%s %d\n",k.my_name,q_time);
    }
    }
    }

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

int main()
{
	long long n, k;
	cin >> n >> k;

	long long a = n / k;

	long long ret = a*a*a;
	if (k % 2 == 0) {
		long long b = k / 2;
		if (a * k + b <= n) {
			++a;
		}
		ret += a * a * a;
	}

	cout << ret << endl;


	return 0;
}

Measured memory_bytes: 256
n = int(input())
x = []
y = []
h = []
for i in range(n):
    xi,yi,hi = map(int, input().split())
    x.append(xi)
    y.append(yi)
    h.append(hi)


cxyl = []
for i in range(101):
    for j in range(101):
        cxyl.append((i,j))
cxy = set(cxyl)
hd = {}
hzero = set([])
for i in range(n):
    for c in list(cxy):
        H = abs(x[i]-c[0]) + abs(y[i]-c[1]) + h[i]
        if h[i] == 0:
            hzero.add((x[i],y[i]))
            if 1 > H:
                cxy.remove(c)
                continue
        else:
            if c in hd:
                if hd[c] != H:
                    cxy.remove(c)
                    continue
            else:
                hd[c] = H

for xy in list(hzero):
    xi = xy[0]
    yi = xy[1]
    for c in list(cxy):
        H = abs(xi-c[0]) + abs(yi-c[1])
        if hd[c] - H > 0:
            cxy.remove(c)

ret = cxy.pop()
print(str(ret[0]) + ' ' + str(ret[1]) + ' ' + str(hd[ret]))


Measured memory_bytes: 5224
def Grid_Compression(h , w , ahl):

    ans = []
    hcount = []
    wcount = []

    for n in range(w):
        flag = True
        for m in range(h):
            if ahl[m][n] == "#":
                flag = False
        if flag == False:
            wcount.append(n)

    for n in range(h):
        flag = True
        for m in range(w):
            if ahl[n][m] == "#":
                flag = False
        if flag == False:
            hcount.append(n)

    for nh in hcount:
        ansli = []
        for nw in wcount:
            ansli.append(ahl[nh][nw])
        ans.append(ansli)

    return ans

def main():
    h , w = map(int , input().split())
    ahl = [list(str(input())) for i in range(h)]
    ans = Grid_Compression(h , w , ahl)
    for i in ans:
        pr = ""
        for w in i:
            pr += w
        print(pr)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 110;
int A[maxn];

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);
    int N;
    while (cin >> N) {
        for (int i = 0; i < N; i++) {
            cin >> A[i];
        }
        sort(A,A+N); reverse(A,A+N);
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (i % 2)
                ans -= A[i];
            else
                ans += A[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N , Y = map(int,input().split())
k = 0
for i in range(N+1):
  x = i
  for j in range(N - i + 1):
    y = j
    if (Y - x * 10000 - y*5000)/1000 == N - x - y >=0 :
      print(str(x) +' '+str(y)+' '+str(N-x-y))
      k = 1
      break
  if k == 1:
    break
if k== 0:
  print('-1 -1 -1')

Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;
int n;
string s;
int ans=0;
void f(int ind=0,string cur=""){
    if(ind==3){
        int j=0;
        fori(i,sz(s)){
            if(s[i] == cur[j]){
                j++;
            }
        }
        if(j==3) ans++;
        return;
    }
    fori(i,10){
        f(ind+1,cur+char('0'+i));
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    cin >> n >> s;
    f();
    cout << ans << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MAX = 20000;

int main()
{
	vector<int> able(MAX + 1), is(MAX + 1, 1);
	for (int i = 0; i < 150; i++) {
		for (int j = 0; j < 150; j++) {
			int d = i * i + j * j;
			if (d <= MAX) {
				able[d] = 1;
			}
		}
	}
	for (int i = 2; i <= MAX; i++) {
		if (able[i] && is[i]) {
			for (int j = 2; i * j <= MAX; j++) {
				if (able[j]) {
					is[i * j] = 0;
				}
			}
		}
	}
	int q, m, n;
	cin >> q;
	while (q--) {
		cin >> m >> n;
		cout << (is[m * m + n * n] ? 'P' : 'C') << endl;
	}
	return 0;
}

Measured memory_bytes: 3228
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for i in range(q):
	b, e, t = map(int, input().split())
	s = t+e-b
	if t > b:
		a = a[:b] + a[t:s] + a[e:t] + a[b:e] + a[s:]
	else:
		a = a[:t] + a[b:e] + a[s:b] + a[t:s] + a[e:]
print(*a)



Measured memory_bytes: 5812
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    ll n;
    cin>>n;
    int x=sqrt(n);
    pair<ll,ll>anspair=make_pair(0,0);
    for(int i=1; i<=x; ++i){
        ll  j=n/i;
        if(n%i==0){
            anspair=make_pair(i,j);
        }
    }
    ll ans=0;
    ans+=(ll)(anspair.first+anspair.second-2);
    cout<<ans<<endl;
}


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

double norm(ll x1, ll x2, ll y1, ll y2){
  return pow(pow(x1-x2,2) + pow(y1-y2, 2),0.5);
}

long long kaijou(int x){
  ll ideal = 1;
  rep(i, x){
    ideal *= x-i;
  }
  return ideal;
}

double sum(vector<double> vec){
  return accumulate(vec.begin(), vec.end(), 0);
}

int main() {
  double ideal = 0.0;
  ll N;
  cin >> N;
  vector<vector<ll> > vec(N, vector<ll>(2));
  rep(i, N) cin >> vec[i][0] >> vec[i][1];
  rep(i, N-1){
    for (int j =i+1; j < N; j++){
      ideal += norm(vec[i][0], vec[j][0], vec[i][1], vec[j][1]);
    }
  }
  ideal *= 2.0;
  double M;
  M = N;
  ideal /= M;
  cout << fixed << setprecision(15) << ideal << endl;
}

Measured memory_bytes: 4164
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, S);
    ll l = S.size();
    while (l >= 5)
    {
        string a = S.substr(l - 5, 5);
        bool ok = false;
        if (a == "erase" or a == "dream")
        {
            l -= 5;
            ok = true;
        }
        if (l >= 6)
        {
            string b = S.substr(l - 6, 6);
            if (b == "eraser")
            {
                l -= 6;
                ok = true;
            }
        }
        if (l >= 7)
        {
            string c = S.substr(l - 7, 7);
            if (c == "dreamer")
            {
                l -= 7;
                ok = true;
            }
        }
        if (not ok)
        {
            OUT("NO");
            return 0;
        }
    }
    YES(l == 0, "YES", "NO");
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 59; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll n,w;
cin >> n>>w;
vector<vector<ll>> v(4);
ll w1,v1;
cin >> w1 >> v1 ;
v[0].push_back(v1);
rep(i, n-1){
    ll ww,vv;
    cin >> ww >> vv ;
    v[ww-w1].push_back(vv);
}
rep(i,4){
    sort(v[i].rbegin(),v[i].rend());
}
vector<vector<ll>> vvv(4);
rep(i,4)vvv[i].push_back(0);
rep(i,4){
    rep(j,v[i].size()){
        vvv[i].push_back(vvv[i][j]+v[i][j]);
    }
}
rep(i,vvv[0].size())rep(j,vvv[1].size())rep(k,vvv[2].size())rep(l,vvv[3].size()){
    if(i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3)>w)continue;
    ans=max(ans,vvv[0][i]+vvv[1][j]+vvv[2][k]+vvv[3][l]);
}

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


Measured memory_bytes: 256
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int MAXN = 2e5 + 1;
const int mod = 1e9 + 7;

int f[MAXN];

int powmod(int a, int p) {
    if (p == 0) return 1;
    if (p == 1) return a;
    int k = powmod(a, p / 2);
    if (p & 1) return (((k * k) % mod) * a) % mod;
    return (k * k) % mod;
}

int inv(int k) {
    return powmod(k, mod - 2);
}

int C(int n, int k) {
    int ans = f[n];
    ans *= inv(f[n - k]);
    ans %= mod;
    ans *= inv(f[k]);
    ans %= mod;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    f[0] = 1;
    for (int i = 1; i < MAXN; i++) {
        f[i] = (f[i - 1] * i) % mod;
    }
    int n, m, k;
    cin >> n >> m >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            ans += ((j * (j + 1) / 2 + (m - j) * (m - j - 1) / 2) * n) % mod;
            ans %= mod;
            ans += ((i * (i + 1) / 2 + (n - i) * (n - i - 1) / 2) * m) % mod;
            ans %= mod;
        }
    }
    ans *= C(n * m - 2, k - 2);
    ans %= mod;
    ans *= inv(2);
    ans %= mod;
    cout << ans;
}
/*

*/


Measured memory_bytes: 1792
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    int N;cin>>N;
    N %= 100;
    N %= 10;
    if(N==3){
        cout << "bon" << endl;
    }else if(N==1||N==6||N==8||N==0){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int n,k; cin>>n>>k;
    if(n%k==0)cout<<0<<endl;
    else cout<<1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    string S;
    cin >> S;
    if (S[S.length()-1] == 's') {
        S += "es";
    }
    else {
        S += "s";
    }
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3132
/**
     **author : _KMS_
     **created : 17-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =1e6+100,MOD=2e9;
typedef long long ll;
ll mx=1e16;
int main() 
{ 
      
ios::sync_with_stdio(false);
cin.tie(0);
ll n;
cin>>n;
for(int i=0;i<5;i++)
{
      ll a;
      cin>>a;
      mx=min(a,mx);
}
ll res=4+(n+mx-1)/mx;
cout<<res<<"\n";
 
	return 0; 
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll //9223372036854775807
#define pi acos(-1.0)
#define ms(a,b) memset(a,b,sizeof(a))
#define nl "\n"
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
//ll qpow(ll x, ll y){ll s=1;while(y){if(y&1)s=s*x%mod;x=x*x%mod;y>>=1;}return s;}
ll qpow(ll a, ll b){ll s=1;while(b>0){if(b%2==1)s=s*a;a=a*a;b=b>>1;}return s;}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
ll inve(ll x){return x==1?1:(mod-mod/x)*inve(mod%x)%mod;}

int n;
string s[3];

int judge(int x)
{
    if(s[0][x]!=s[1][x] && s[0][x]!=s[2][x] && s[2][x]!=s[1][x]) return 2;
    if(s[0][x]!=s[1][x] || s[0][x]!=s[2][x] || s[2][x]!=s[1][x]) return 1;
    return 0;
}

int main()
{

    cin>>n;
    for(int i=0;i<3;i++) cin>>s[i];
    int num = 0;
    for(int i=0;i<n;i++)
    {
        num += judge(i);
    }

    cout<<num<<nl;

    return 0;
}



Measured memory_bytes: 256
void main() {
	auto S = rs.to!(dchar[]);
	auto T = rs.to!(dchar[]);
	auto sbt = redBlackTree!dchar;
	auto tbt = redBlackTree!dchar;
	ulong[] sarr, tarr;
	dchar[] ssarr, tsarr;
	foreach(i; S) {
		auto k = sbt.insert(i);
		if(k != 0) ssarr ~= i;
		sarr ~= (k == 0 ? ssarr.indexOf(i)+1 : k - 1);
	}
	foreach(i; T) {
		auto k = tbt.insert(i);
		if(k != 0) tsarr ~= i;
		tarr ~= (k == 0 ? tsarr.indexOf(i)+1 : k - 1);
	}
	debug writeln(sarr);
	debug writeln(tarr);
	debug writeln(ssarr);
	debug writeln(tsarr);
	if(sarr == tarr) writeln("Yes");
	else writeln("No");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

namespace Task {

const int MAXN = 200000;
int a[MAXN + 1];

inline void solve() {
    std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);
    register int n;
    std::cin >> n;
    for (register int i = 1; i <= n; i++) std::cin >> a[i];
    register int cnt4 = 0, cnt2 = 0, cnt = 0;
    for (register int i = 1; i <= n; i++) {
        if (a[i] % 4 == 0) {
            cnt4++;
        } else if (a[i] % 2 == 0) {
            cnt2++;
        } else {
            cnt++;
        }
    }
    if (cnt2 == 0 && cnt <= cnt4 + 1) {
        std::cout << "Yes";
    } else if (cnt <= cnt4) {
        std::cout << "Yes";
    } else {
        std::cout << "No";
    }
}
}

int main() {
    Task::solve();
    return 0;
}

Measured memory_bytes: 640
n = int(input())
H = [int(h) for h in input().split()]

result = []
count = 0
if(n==1):
  print(0)
  exit()

for i in range(n-1):
  if (H[i]>=H[i+1]):
    count+=1
    if(i == n-2):
      result.append(count)
  else:
    result.append(count)
    count=0
    
print(max(result))

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h1,s1,h2,s2;
    cin>>h1>>s1>>h2>>s2;
    int a1=0,a2=0;
    while(h2>0)
    {
        h2=h2-s1;
        a2++;
    }
    while(h1>0)
    {
        h1=h1-s2;
        a1++;
    }
    if(a1<a2)
        cout<<"No\n";
    else
        cout<<"Yes\n";
    return 0;
}


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

using namespace std;

int main(){
  int m, d; cin >> m >> d;
  
  int count = 0;
  for(int i = 4; i <= m; i++){
    for(int j = 2; j <= d; j++){
      int t = j;
      int d1 = t % 10;
      int d10 = t / 10;
      if(d1 >= 2 && d10 >= 2 && d1 * d10 == i){
        count++;
      }
    }
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256