akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

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

    string s;
    cin >> s;

    FOR(i, 1, s.size()) {
        if (s[i - 1] == s[i]) {
            print(i, i + 1);
            return 0;
        }
    }
    if (2 < s.size()) {
        FOR(i, 1, s.size() - 1) {
            if (s[i - 1] == s[i + 1]) {
                print(i, i + 2);
                return 0;
            }
        }
    }
    print(-1, -1);

    return 0;
}

Measured memory_bytes: 512
N=int(input())
S=list(input())
x=count=0
search_word=["A","B","C"]
 
for x in range(N-2):
  if S[x]==search_word[0] and S[x+1]==search_word[1] and S[x+2]==search_word[2]:
    count+=1
  x+=1
 
print(count)

Measured memory_bytes: 3060
#include <stdio.h>
int gcd(int a,int b) 
{ 
	if(a==0) return b; 
	else 	return gcd(b % a,a);  
} 
int main()
{
	int a,b,r;
	scanf("%d%d",&a,&b);
	if(a<b)
	{
		int t=b;
		b=a;
		a=t;
	}
	printf("%d\n",gcd(a,b));	
	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}
 
 
pair<ll, ll> ps[4];
 
int main2() {
  ll Q, H, S, D; cin >> Q >> H >> S >> D;
  ll N; cin >> N;  
  N *= 4;
  ps[0] = make_pair(1, Q);
  ps[1] = make_pair(2, H);
  ps[2] = make_pair(4, S);
  ps[3] = make_pair(8, D);
  sort(ps, ps + 4, [](const pair<ll, ll>& a, const pair<ll, ll>& b) -> bool {
    return a.second * b.first < b.second * a.first;
  });
  ll ans = 0;
  REP(i, 4) {
    ll buy = N / ps[i].first;
    ans += buy * ps[i].second;
    N -= buy * ps[i].first;
  }
  cout << ans << endl;
  return 0;
}
 
int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[10][55][3010] = {0};
int main()
{
    int N,M,S;
    while(scanf("%d%d%d",&N,&M,&S),N + M + S)
    {
        for(int i = 1; i < N * N + 1; i++)
        {
            for(int j = 1; j < S + 1; j++)
            {
                dp[0][i][j] = 0;
            }
        }
        for(int i = 1; i < M + 1; i++)
        {
            for(int j = 1; j < N * N + 1; j++)
            {
                for(int k = 1; k < S + 1; k++)
                {
                    dp[1][j][k] = 0;
                    if(j == 1)
                    {
                        dp[1][j][k] = dp[0][j][k];
                        if(i == k)dp[1][j][k]++;
                    }
                    else
                    {
                        dp[1][j][k] = dp[0][j][k];
                        if(k > i)dp[1][j][k] = (dp[1][j][k] + dp[0][j - 1][k - i]) % 100000;
                    }
                }
            }
            for(int j = 1; j < N * N + 1; j++)
            {
                for(int k = 1; k < S + 1; k++)
                {
                    dp[0][j][k] = dp[1][j][k];
                    dp[1][j][k] = 0;
                }
            }
        }
        printf("%d\n",dp[0][N * N][S]);
    }
    return 0;
}

Measured memory_bytes: 4316
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    map<int,int> DM;
    rep(i,N) {
        int d; cin >> d;
        DM[d]++;
    }

    int M; cin >> M;
    vector<int> T(M);
    rep(i,M) {
        cin >> T.at(i);
        if (DM[T[i]] > 0) DM[T[i]]--;
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 13060
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<math.h>
#include<set>
#include<iomanip>
#include<stdio.h>
#include<deque>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#define M 1000000007
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N,i;
	cin>>N;
	double A[N],o=0;
	for(i=0;i<N;i++)
	{
		cin>>A[i];
		o+=(1/A[i]);
	}
	o=1/o;
	cout<<o<<endl;
}

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

namespace abc144
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc144B();
        }

        public static void solve_abc144C()
        {
        }

        public static void solve_abc144B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    if (i * j == n)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }
            Console.WriteLine("No");
        }

        public static void solve_abc144A()
        {
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            int a = ab[0];
            int b = ab[1];

            Console.WriteLine(a < 10 && b < 10 ? a * b : -1);
        }

        /*
            BinarySearchIterativeLeft
         */
        public static int binarySearchIterativeLeft(long[] haystack, long needle)
        {
            int left = -1;
            int right = haystack.Length;
            while (left < right - 1)
            {
                int middle = left + (right - left) / 2;
 
                if (haystack[middle] < needle)
                {
                    left = middle;
                }
                else
                {
                    right = middle;
                }
            }
 
            return right;
        }
        
        public static int binSearch(int[] haystack, int needle)
        {
            int l = -1;
            int r = haystack.Length;
            while(l < r - 1)
            {
                int mid = (r + l) / 2;
                if (haystack[mid] <= needle)
                {
                    l = mid;
                }
                else 
                {
                    r = mid;
                }
            }
 
            return r;
        }                        
    }
}


Measured memory_bytes: 13268
from collections import deque
import sys

if __name__ == '__main__':
    s = list(input())
    que = deque(s)

    ans = 0
    while len(que) != 0:
        if que[0] == que[-1]:
            if len(que) == 1:
                que.pop()
            else:
                que.popleft()
                que.pop()
        elif que[0] != "x" and que[-1] != "x":
            print(-1)
            sys.exit()
        else:
            if que[0] == "x":
                que.append("x")
                ans += 1
            elif que[-1] == "x":
                que.appendleft("x")
                ans += 1

    print(ans)


Measured memory_bytes: 5028
s = input()
n = len(s)
dna = ["A", "C", "G", "T"]
ans = 0
counter = 0
for i in range(n):
  if s[i] in dna:
    counter += 1
  else:
    ans = max(ans, counter)
    counter = 0
ans = max(ans, counter)

print(ans)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int gcd(int a, int b){
    if(a%b == 0) return b;
    return gcd(b, a%b);
}
int main(void){
    int a, b, g;
    cin >> a >> b;
    g = gcd(a, b);
    cout << (long long)a*b/g << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	an := NextIntArray()

	numbers := map[int]int{}
	for _, v := range an {
		numbers[v]++
		numbers[v+1]++
		numbers[v-1]++
	}

	max := 0
	for _, v := range numbers {
		if max < v {
			max = v
		}
	}

	fmt.Println(max)
}

// reader

var size = 100000
var rdr = bufio.NewReaderSize(os.Stdin, size)

func ReadLine() string {
	buf := make([]byte, 0, size)
	for {
		line, isPrefix, err := rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func NextArray() []string {
	s := ReadLine()
	return strings.Split(s, " ")
}

func NextIntArray() []int {
	a := NextArray()
	na := make([]int, 0)

	for _, v := range a {
		if n, e := strconv.Atoi(v); e == nil {
			na = append(na, n)
		}
	}

	return na
}


Measured memory_bytes: 9600
<?php
list($a,$b) = explode(" ",trim(fgets(STDIN)));
$n = max($a,$b);
$m = min($a,$b);
if($n - $m > 1){
echo 0;
}else{
$z = 1;
if($n == $m){
++$z;
}
$r = pow(10,9) + 7;
$p = $n;
while($n > 1){
--$n;
$p = ($p * $n) % $r;
}
while($m > 1){
$p = ($p * $m) % $r;
--$m;
}
echo ($z * $p) % $r;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int N, D, X;
  cin >> N >> D >> X;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int ans = X;
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < N; j++) {
      dump(ans, i, j, a[j]);
      if (i == 0) {
        ans += 1;
      } else {
        if (i % a[j] == 0)
          ans += 1;
      }
      dump(ans, i, j, a[j]);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	sum := 0
	for d := 1; d <= n; d++ {
		maxK := n / d
		sum += d * maxK * (maxK + 1) / 2
	}

	fmt.Printf("%d\n", sum)

}


Measured memory_bytes: 1864
N = int(input())
a = [0]
a += list(map(int, input().split(' ')))
b = [0 for _ in range(N + 10)]
for i in range(N, 0, -1):
  res = 0
  for j in range(N // i * i, i, -i):
    res = res ^ b[j]
  b[i] = res ^ a[i]
print(sum(b))
for i in range(1, N + 1):
  if b[i]:
    print(i)

Measured memory_bytes: 7252
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double eps = 1e-10;
  
int main() {
  int N,K;
  cin >> N >> K;
  vi x(N);
  rep(i,N) {
    cin >> x[i];
  }
  int ans = 0;
  rep(i,N) {
    ans += min(x[i],K-x[i]);
  }
  cout << ans*2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using std::swap;

// priceをキーに降順でソート
//sort(fruits.begin(), fruits.end(),
//     [](const fruit& x, const fruit& y) { return x.price > y.price;});

int main() {
    int N, A, B;
    std:cin >> N >> A >> B;
    std::cout << min(N*A, B) << std::endl;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from heapq import heappush, heappop

N, M = map(int, input().split())
d = defaultdict(list)

for _ in range(N):
    a, b = map(int, input().split())
    d[a].append(b)

h = []
res = 0
for a in range(1, M + 1):
    for b in d[a]:
        heappush(h, -b)
    if len(h) > 0:
        c = heappop(h)
        res -= c

print(res)


Measured memory_bytes: 27880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[4],ans,n,w,ch;
vector<vector<ll>>b(4);
void dep(ll now,ll wei,ll val){
	//cout << wei<<" "<< val<<" "<<now<<endl;

	if(now==4){
						if(wei<=w){
			ans=max(ans,val);
		}
		return ;

	}
	for(int i=0;i<=b[now].size();i++){
		if(i==0){
			dep(now+1,wei,val);
			continue;
		}
		dep(now+1,wei+i*a[now],val+b[now][i-1]);
	}
	return;
}
int main() {
	cin>>n>>w;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		for(int j=0;j<4;j++){
			if(a[j]==x){
				b[j].push_back(y);
				break;
			}
			if(a[j]==0){
				a[j]=x;
				ch=j;
				b[j].push_back(y);
				break;
			}
		}
	}	
	for(int i=0;i<4;i++){
		sort(b[i].begin(),b[i].end());
		reverse(b[i].begin(),b[i].end());
	}
	for(int j=0;j<4;j++){
		for(int i=1;i<b[j].size();i++){
			b[j][i]=b[j][i]+b[j][i-1];
		}
	}
	dep(0,0,0);
	cout <<ans;
	return 0;
}

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

ll K, A, B;

int main() {
    cin >> K >> A >> B;

    if (B-2 >= A) {
        ll ans = A;
        if ((K-A+1)%2 == 0) ans += (B-A) * (K-A+1)/2;
        else ans += (B-A) * ((K-A+1)/2) + 1;
        cout << ans << endl;
    }
    else {
        cout << K+1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
#include<stack>
#include<queue>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define rep2(N1,N2) for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)for(ll k=0;k<N3;k++)
#define For(i,N) for(ll i=0;i<N;i++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for (ll i = 0; i < x; i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k" << endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

ll keta(ll a) {
	ll i = 1;
	while (1) {
		if (a < pow((ll)10, i))
			return i;
		i++;
	}
}
vector<ll> v;
ll n, m;
//m進数全探索
ll inc(ll a = n - 1) {
	if (a == 0 && v[0] == m) {
		v[0] = -1;
		return v[0];
	}
	if (v[a] == m) {
		v[a] = 0;
		inc(a - 1);
		return v[a];
	}
	else {
		++v[a];
		return v[a];
	}
}

ll mod = 1e9+7;

ll modkai(ll a) {
	ll ret = 1;
	rep(a) {
		ret *= (i + 1);
		ret %= mod;
	}
	return ret;
}

ll modpowl(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = modpowl((a*a) % mod, b / 2);
			c = c % mod;

			return c;
		}
		else {
			ll c = (modpowl((a*a) % mod, b / 2) % mod)*a;
			c = c % mod;

			return c;
		}
	}
}
const int MAX = 510000;
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;
}

ll llpow(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = llpow((a*a), b / 2);
			c = c;

			return c;
		}
		else {
			ll c = (llpow((a*a), b / 2))*a;
			c = c;

			return c;
		}
	}
}
std::vector<ll> Eratosthenes(ll N)
{
	std::vector<bool> is_prime(N + 1);
	for (ll i = 0; i <= N; i++)
	{
		is_prime[i] = true;
	}
	std::vector<ll> P;
	for (ll i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (ll j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

int main() {
	cout.precision(20);
	ll A, B;
	cin >> A >> B;
	cout << A * B;
}

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[111111];
int prevNum[111111];

int main(){
	
	ll n,a,b;cin >> n >> a >> b;
	if(a > b)swap(a,b);
	
	vector<ll> v;
	v.PB(-LLINF);
	v.PB(-LLINF);
	REP(i,n){
		ll s;cin >> s;
		v.PB(s);
	}
	v.PB(2*LLINF);
	
	REP(i,v.size()-2){
		if(abs(v[i] - v[i+2]) < a){
			cout << 0 << endl;
			return 0;
		}
	}
		
	int L = v.size() - 1;
	for(int R = v.size() - 1;R >= 0; R--) {
		L = min(L, R);
		while(L > 0 && abs(v[L] - v[L-1]) >= a)L--;
		prevNum[R] = L;
	}
	
	int R = 0;
	dp[1] = 1;
	for(int i = 2;i < v.size();i++){
		while(abs(v[R+1] - v[i]) >= b)R++;
		bool flag = true;
		if(prevNum[i-1] > R + 1)flag = false;
		if(flag)dp[i] = (dp[R] - dp[max(1, prevNum[i-1]-1)-1] + MOD) % MOD;
		//cout << dp[i] << endl;
		if(i != v.size() - 1){
			dp[i] += dp[i-1];
			dp[i] %= MOD;
		}
	}
	
	cout << dp[v.size()-1] << endl;
		
	return 0;
}


Measured memory_bytes: 2292
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	llint a,b,c;cin>>a>>b>>c;
	if(a%2==0||b%2==0||c%2==0){cout<<0<<endl;}
	else{cout<<min(a*b,min(a*c,b*c))<<endl;}
	RE;
}


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

int main(){

	int n,k=0;

	cin>>n;

	int c,d;
	
	k++;
	while(1){
		c=0;
		for(int j=1;j<=k;j++){
			if(k%j==0){c++;}
		}
		if(n==c){break;}
		k++;
	}
			cout<<k<<endl;

	
}	


Measured memory_bytes: 3084
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int cur = 0;
  while (1) {
    if (cur == 0) {
      c -= b;
      if (c <= 0) {
        cout << "Yes" << endl;
        return 0;
      }
    } else {
      a -= d;
      if (a <= 0) {
        cout << "No" << endl;
        return 0;
      }
    }
    cur ^= 1;
  }

  return 0;
}

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

int main()
{
   int H, W;
   cin >> H >> W;
   vector<char> vec((H+2)*(W+2));
   vec = vector<char>((H+2)*(W+2),'#');

   for (int i=1;i<=H;i++)
   {
      for (int j=1;j<=W;j++)
      {
         cin >> vec.at((W+2)*i+j);
      }
   }

   for (int i = 0; i < H+2; i++)
   {
      for (int j = 0; j < W+2; j++)
      {
         cout << vec.at((W+2)*i+j);
      }
      cout << endl;
   }
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll h, w, k;
    cin >> h >> w >> k;

    string c[h];
    rep(i, h)cin >> c[i];

    ll ans = 0;

    rep(i, (1<<h)){
        rep(j, (1<<w)){
            ll cnt = 0;
            rep(h_i, h)rep(w_i, w){
                if((1<<h_i) & i || (1<<w_i) & j)continue;
                if(c[h_i][w_i] == '#')cnt++;
            }
            if(cnt == k)ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=1;
	for(int i=0;i<n-1;++i)
	{
		if(s[i]==s[i+1])
			continue;
		else
			cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>
  
int main()
{
 int a,b;
 char a1 = 'a',b1 = 'b';
 
  
 scanf("%d %d",&a,&b);
   
 if( a == b )
 {
   printf("%c == %c\n",a1,b1);
 }
  
if( a < b )
 {
   printf("%c < %c\n",a1,b1);
 }
  
if( a > b )
 {
   printf("%c > %c\n",a1,b1);
 }
return 0;
}

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

const int mod = 1e9+7;
typedef long long int ll;
class Mint{
    public:
        ll x;
        Mint(const ll a){
            x = a;
        }
        void operator = (ll const &b){
            x = b;
        }
        void operator = (Mint const &b){
            x = b.x;
        }
        void operator += (Mint const &b){
            x = (x + b.x)%mod;
        }
        Mint operator+(const Mint &a){
            return (x + a.x)%mod;
        }
        Mint operator-(const Mint &a){
            return (x - a.x + mod)%mod;
        }
        Mint operator*(const Mint &a){
            return (x * a.x)%mod;
        }
        Mint operator/(const Mint &a){
            return (x * modInverse(a.x))%mod;
        }
        ll gcdExtended(ll a, ll b, ll *x, ll *y) { 
            if (a == 0) { 
                *x = 0, *y = 1; 
                return b; 
            } 
            ll x1, y1;  
            ll gcd = gcdExtended(b%a, a, &x1, &y1); 
            *x = y1 - (b/a) * x1; 
            *y = x1; 
            return gcd; 
        }
        ll modInverse(ll a) { 
            ll x, y; 
            gcdExtended(a, mod, &x, &y); 
            ll res = (x%mod + mod) % mod; 
            return res; 
        } 
        Mint operator ^(ll b){
          Mint res = 1;
          long long int a = x;
          while(b>0){
            if(b&1)
              res.x = res.x * a % mod;
            a = a * a % mod;
            b = b/2;
          }
          return res;
        }
};
ostream& operator <<(ostream& os, const Mint a){
    return os << a.x;
}
int main(){
  int n;
  cin >> n;
  Mint ans = (Mint)10^n;
  ans = ans - ((Mint)9^n) * 2 + ((Mint)8^n);
  cout << ans;
  return 0;
}
  

Measured memory_bytes: 3604
#!/mnt/c/Users/moiki/bash/env/bin/python
# FROM :  https://atcoder.jp/contests/dp/submissions/4127921

import numpy as np
N,W = list(map(int, input().split()))

wvlist = sorted( [ [int(x) for x in input().split()] for _ in range(N)] ) 

dp = [0] * (W+1)
cnt = 0
for w,v in wvlist:
    cnt = cnt+w
    for i in range(min(cnt, W), w-1, -1):
        if dp[i] < dp[i-w]+v:
            dp[i] = dp[i-w] + v

print(max(dp))



Measured memory_bytes: 21180
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

ll N;

int main() {

	scanf("%lld", &N);

	map<ll, ll> pc;

	ll n = N;
	for (ll i = 2; i * i <= n; ++i) {
		if (!(n % i)) {
			pc[i]++;
			n = n / i;
			i = 1;
		}
	}
	pc[n]++;

	vector<pair<ll, ll>> p;
	for (auto pp : pc) p.push_back(pp);

	vector<ll> v(p.size() + 1, 0);

	ll ans = 0;

	while (!v[p.size()]) {
		ll a = 1;
		rep(ppp, p.size()) {
			rep(i, v[ppp]) a *= p[ppp].first;
		}

		ll m = N / a - 1;
		if (a < m) {
			ans += m;
		}

		v[0]++;
		rep(i, p.size()) {
			if (v[i] > p[i].second) {
				v[i] = 0;
				v[i + 1]++;
			}
		}
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
if n == 1:
  print('Yes')
else:
  flg = True
  for i in range(1, n):
    if h[-(i+1)] > h[-i]:
      if h[-(i+1)]-1 == h[-i]:
        h[-(i+1)] -= 1
      else:
        flg = False
        break
  if flg:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 14396
using System;

namespace ITP_1_2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);
            if (a < b && b < c) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}



Measured memory_bytes: 8844
#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;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    vec A(N); cin >> A;
    vec B(N); cin >> B;
    vec C(N); cin >> C;

    int ans = 0;
    REP(i, N) ans += B[i];
    REP(i, N - 1){
        if(A[i + 1] == A[i] + 1) ans += C[A[i] - 1];
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 3223372036854775807;


signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    double L;cin >> L;
    L /= 3;
    L *= L * L;
    cout << setprecision(20);
    cout << L << endl;
}

Measured memory_bytes: 256
import sys
h,w=map(int,input().split())
A=[chr(i) for i in range(ord('A'), ord('Z')+1)]
s=[]
for i in range(h):
    s.append(list(map(str,input().split())))
for i in range(h):
    for j in range(w):
        if s[i][j]=='snuke':
            a=A[j]
            b=str(i+1)
            print(a+b)
            sys.exit()

Measured memory_bytes: 3064
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        long sum = 0;

        PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());

        for (int i = 0; i < N; i++) {
            pq.add(sc.nextInt());
        }

        for (int i = 0; i < M; i++) {
            int top = pq.poll();
            pq.add(top / 2);
        }

        for (int i = 0; i < N; i++) {
            sum += pq.poll();
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 60136
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>

using namespace std;


int N, M;
vector<int> A,B,C;




int main()
{

	long long ans = 0;

	cin >> N;
	cin >> M;

	A = vector<int>(N);
	B = vector<int>(M);
	C = vector<int>(M);
	auto comp = [](pair<int, int> l, pair<int, int> r) {
		return l.second < r.second;
	};
	priority_queue<pair<int, int>, vector<pair<int, int>>, decltype(comp)> que(comp);

	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		que.push(make_pair(1,A.at(i)));
	}

	for (int i = 0; i < M; i++) {
		cin >> B.at(i);
		cin >> C.at(i);
		que.push(make_pair(B.at(i), C.at(i)));
	}

	int n = N;
	while (n > 0) {
		pair<int, int> tgt = que.top();
		que.pop();

		int c = min(n,tgt.first);

		ans += c * (long long)tgt.second;
		n -= c;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3572
# input
k, n = map(int, input().split())
house = [int(i) for i in input().split()]
house.append(k+house[0])
dist = []
cand = []

# main
for i in range(n):
  dist.append(house[i+1]-house[i])
  
for i in range(n):
  cand.append(k-dist[i])

# output
print(min(cand))
  

Measured memory_bytes: 26420
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}

string in;
int tot[55][55];

int main()
{
	ios_base::sync_with_stdio(false);
	ll n;
	cin >> n;
	string ans = "";
	for (int a = 0; a<n; a++)
	{
		cin >> in;
		int len = in.length();
		for (int b = 0; b<len; b++)
			tot[a][in[b] - 'a']++;
	}
	for (int a = 0; a<26; a++)
	{
		int maxi;
		for (int b = 0; b<n; b++)
		{
			if (b == 0) maxi = tot[b][a];
			maxi = min(maxi, tot[b][a]);
		}
		for (int b = 0; b<maxi; b++) ans += (a + 'a');
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
  string num;
  int n, ans;

  while (true)
  {
    ans = 0;

    cin >> num;

    if (num == "0")
      break;

    for (int i = 0; i < num.size(); i++)
    {
      n = num[i] - '0';
      ans += n;
    }

    cout << ans << endl;
  }
}


Measured memory_bytes: 3172
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repp(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define repd(i, n) for(ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

const ll M = 1e9 + 7;

struct UnionFind {
    vector<ll> r;

    UnionFind(ll n) {
        r = vector<ll>(n, -1);
    }

    ll root(ll x) {
        if(r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return;
    }

    ll size(ll x) {
        return -r[root(x)];
    }

    ll root_num() {
        ll num = 0;
        for(ll x : r) if(x < 0) num++;
        return num;
    }
};

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

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

    UnionFind UF(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a -= 1; b -= 1;
        UF.unite(a, b);
    }

    cout << UF.root_num() - 1 << endl;
}

Measured memory_bytes: 3992
import numpy as np

N, K = map(int, input().split())
places = np.array(list(map(int, input().split())))
dp_table = np.zeros(N+1, dtype=np.int)

for i in range(1, N):
    start = max(0, i-K)
    dp_table[i] = min(dp_table[start:i] + np.abs(places[i]-places[start:i]))

print(dp_table[N-1])


Measured memory_bytes: 22796
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main(){

	int x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>x1>>y1>>x2>>y2;
	x3=x2+(y1-y2);
	y3=y2+(x2-x1);
	x4=x3-(x2-x1);
	y4=y3+(y1-y2);
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;

	return 0;
}

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

using P = pair<int, int>;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, K;
	cin >> n >> K;
	int max_num = (n - 1) * (n - 2) / 2;
	if(K > max_num){
		cout << -1 << endl;
		return 0;
	}
	vector<P> v;
	for(int i = 1; i < n; i++){
		for(int j = 1; j < i; j++){
			v.emplace_back(j+1, i+1);
		}
	}
	vector<P> ans;
	for(int i = 1; i < n; i++){
		ans.emplace_back(1, i+1);
	}
	for(int i = 0; i < max_num - K; i++){
		ans.push_back(v[i]);
	}
	cout << ans.size() << endl;
	for(P& p : ans){
		cout << p.first << " " << p.second << endl;
	}
	return 0;
}

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

using namespace std;

#define int long long
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back

int mod=1e9+7;

int32_t main() {
    faster;

    int n,k;
    cin>>n>>k;

    int h[n];
    for(int i=0;i<n;i++) cin>>h[i];

    int dp[n];

    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);

    for(int i=2;i<n;i++){
        dp[i]=mod;
        for(int j=i-1;j>=i-k&&j>=0;j--){
//            if(j==-1) dp[i]=min(h[i],dp[i]);

                dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
            }
        
    }

    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int per,pro,lk[309][309],num[309],nmax=0,now,ans;
bool st[309];
void opr(){
	st[now]=true;nmax=0;
	for(int i=1;i<=pro;i++)	num[i]=0;
	for(int i=1;i<=per;i++)
		for(int j=1;j<=pro;j++)
			if(!st[lk[i][j]]){num[lk[i][j]]++;break;}
	for(int i=1;i<=pro;i++)
		if(num[i]>nmax){nmax=num[i];now=i;}
	ans=min(ans,nmax);
}
int main(){
	scanf("%d%d",&per,&pro);ans=per;
	for(int i=1;i<=per;i++)
		for(int j=1;j<=pro;j++)	scanf("%d",&lk[i][j]);
	for(int i=1;i<=per;i++)	num[lk[i][1]]++;
	for(int i=1;i<=pro;i++)
		if(num[i]>nmax)	{nmax=num[i];now=i;}
	ans=min(ans,nmax);
	for(int i=1;i<pro;i++)	opr();
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        s: [usize; N],
    }

    let sum: usize = s.iter().sum();
    s.sort();

    if sum % 10 != 0 { 
        println!("{}", sum);
        return
    }
    for ss in s.iter() {
        if ss % 10 != 0 {
            println!("{}", sum - ss);
            return
        }
    }
    println!("0");

}


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

int main(){
  
  int W,a,b;
  cin >> W >> a >> b;
  if(a+W < b || b+W <a){
    int disA =abs(b-(a+W));
    int disB =abs(a-(b+W));
    cout << min (disA,disB) << endl;
  }
  else cout<< 0 << endl;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    long[] Numbers;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        long[] A = new long[N+1];
        {
            long xor = 0;
            for(int i=0;i<N;i++){
                A[i] = int.Parse(str[i]);
                xor ^= A[i];
            }
            A[N] = xor;
        }
        str = Console.ReadLine().Split(' ');
        long[] B = new long[N+1];
        {
            long xor = 0;
            for(int i=0;i<N;i++){
                B[i] = int.Parse(str[i]);
                xor ^= B[i];
            }
            B[N] = xor;
        }
        {
            long[] C = new long[N+1];
            long[] D = new long[N+1];
            for(int i=0;i<=N;i++){
                C[i] = A[i];
                D[i] = B[i];
            }
            Array.Sort(C);
            Array.Sort(D);
            bool b = true;
            for(int i=0;i<N;i++){
                b &= C[i] == D[i];
            }
            if(!b){
                sb.Append("-1\n");
                return;
            }
            List<long> numbers = new List<long>();
            for(int i=0;i<=N;i++){
                if(i == 0 || C[i] != C[i-1]){
                    numbers.Add(C[i]);
                }
            }
            Numbers = numbers.ToArray();
        }
        int S = Numbers.Length;
        UnionFind U = new UnionFind(S);
        int count = 0;
        for(int i=0;i<=N;i++){
            if(A[i] != B[i]){
                count++;
                U.Union(ToIndex(A[i]),ToIndex(B[i]));
            }
        }
        int[] UC = new int[S];
        for(int i=0;i<S;i++){
            UC[U.Get(i)]++;
            if(UC[U.Get(i)] == 2){
                count++;
            }
        }
        if(A[N] != B[N]){
            count -= 2;
        }
        else if(UC[U.Get(ToIndex(A[N]))] >= 2){
            count--;
        }
        sb.Append(count+"\n");
    }
    int ToIndex(long X){
        int bf = 0;
        int bl = Numbers.Length-1;
        while(bf != bl){
            int bc = (bf+bl)/2;
            if(X <= Numbers[bc]){
                bl = bc;
            }
            else{
                bf = bc+1;
            }
        }
        return bf;
    }
}
class UnionFind{
    int[] par;
    public UnionFind(int n){
        par = new int[n];
        for(int i=0;i<n;i++){
            par[i] = i;
        }
    }
    public void Union(int x,int y){
        par[Get(x)] = Get(y); 
    }
    public bool Same(int x,int y){
        return Get(x) == Get(y);
    }
    public int Get(int x){
        if(x != par[x]){
            par[x] = Get(par[x]);
        }
        return par[x];
    }
}

Measured memory_bytes: 36316