akhauriyash/Code-Regression huggingface dataset:
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
#pragma endregion

int main()
{
  init_main();

  int n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i, n) cin >> h[i];
  sort(all(h));
  ll Min = LINF;
  for (int l = 0, r = k - 1; r < n; l++, r++)
  {
    chmin(Min, h[r] - h[l]);
  }
  cout << Min << endl;
  return 0;
}


Measured memory_bytes: 1024
import numpy as np

n, x = map(int, input().split())
a = np.array(list(map(int, input().split())), dtype=np.int32)

rec = np.zeros((n, n), dtype=np.int32)
for i in range(n):
    a_tmp = np.roll(np.flipud(a), i)
    np.minimum.accumulate(a_tmp, out=rec[i])

ans = float("inf")
for j in range(n):
    second = rec[:, j].sum() + j * x
    ans = min(ans, second)

print(ans)


Measured memory_bytes: 29768
# ABC073
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
b = {}
for i in a:
    if i in b.keys():
        b[i] += 1
    else:
        b[i] = 1

count = 0
for i in b.values():
    if i%2==1:
        count += 1
print(count)

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

int main()
{
	int n,m,l;
	int A[100][100];
	int B[100][100];
	long long C[100][100] = {};
	
	cin >> n >> m >>l;
	
	//??????A
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >> A[i][j];
		}
	}
	//??????B
	for(int i=0; i<m; i++){
		for(int j=0; j<l; j++){
			cin >> B[i][j];
		}
	}
	//??????C???????´?
	for(int i=0; i<n; i++){
		for(int j=0; j<l; j++){
			for (int k=0; k<m; k++){
				C[i][j] += A[i][k] * B[k][j];
			}
			//????????§?????????
			cout << C[i][j];
			if(j != l-1) cout << " ";
		}
		cout << endl;
	}
	return 0;
}	

Measured memory_bytes: 1320
fun main()
{
  val n = readLine()!!.toInt()
  val ct = Array<Long>(n+1){ 1L }
  for (i in 2..n) {
    var x = i
    while (x <= n) {
      ct[x]++
      x += i
    }
  }
  var ans = 0L
  for (i in 1..n) {
    ans += ct[i] * i
  }
  println(ans)
}

Measured memory_bytes: 92116
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
//304479165
public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        String S = in.next();
        switch (S) {
            case "SSS":
                out.println(0);
                break;
            case "SSR": case "SRS": case "RSS": case "RSR":
                out.println(1);
                break;
            case "SRR": case "RRS":
                out.println(2);
                break;
            case "RRR":
                out.println(3);
                break;
        }

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}


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


using namespace std;

int main(int argc, char** argv) {
    using P =  std::pair<int64_t, int64_t>;

    std::priority_queue<P> que;

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

    for (int i=0; i<n; ++i) {
        int64_t a;
        cin >> a;
        que.push(std::make_pair(a, 1));
    }

    for (int i=0; i<m; ++i) {
        int64_t b, c;
        cin >> b >> c;
        que.push(std::make_pair(c, b));
    }
    int64_t ans{0}, cnt = n;
    while (cnt>0) {
        P p = que.top(); que.pop();
        if (cnt < p.second) {
            ans += cnt * p.first;
            break;
        } else {
            ans += p.second * p.first;
            cnt -= p.second;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        // N,Kの読み取り
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int K = scan.nextInt();

        int result = N / 2 + N % 2;

        if (result >= K) {
            System.out.print("YES");
        } else {
            System.out.print("NO");
        }
    }

}


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n; cin >> n;
  ll ans, sum = 0, mn = INFL, cnt = 0;
  bool zero = false;
  vi a(n);
  rep(i, n) {
    cin >> a[i];
    if (a[i] <= 0) cnt++;
    if (a[i] == 0) zero = true;
    sum += abs(a[i]);
    mn = min(mn, abs(a[i]));
  }
  // cout << sum << ", " << mn << endl;
  if (zero || (cnt&1)==0) {
    ans = sum;
  } else {
    ans = sum - 2*mn;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>

using namespace std;

int main(void) {
    string s, t;
    cin >> s >> t;
    int flag = 0;
    if(s.length()+1 == t.length()) {
        for(int i = 0; i < s.length(); i++) {
            if(s[i] != t[i]) {
                flag = 1;
            }
        }
    }




    cout << (flag ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
/*
#define _CRT_SECURE_NO_WARNIGS
#pragma warning(disable:4996)
*/
using namespace std;
typedef long long I;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

int mo[10];

int f(int a){
	int l(0);
	while (a){
		a /= 10;
		l++;
	}

	return l;
}

int main()
{
	int a, b;
	while (scanf("%d %d",&a,&b)+1){
		cout << f(a+b) << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

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

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

using namespace std;

#define int long long

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

    int n;
    cin >> n;

    vector<double> v(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }

    std::sort(v.begin(), v.end());

    double val = v[0];

    for (int i = 0; i < n; ++i)
    {
        val = (val + v[i]) / 2;
    }

    cout << val << endl;
}


Measured memory_bytes: 256
def B():
    n = int(input())
    a = list(map(int, input().split()))
    res = 1
    for el in sorted(a):
        res *= el
        if res > pow(10,18):
            res = -1
            break
    if res > pow(10,18):
        res = -1
    print(res)
B()

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

int main()
{
    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++)
        cin >> s[i];

    int ans[h][w];
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            ans[i][j] = 0;

    for (int i = 0; i < w; i++)
    {
        if (s[0][i] == '#')
            break;
        ans[0][i] = 1;
    }

    for (int i = 0; i < h; i++)
    {
        if (s[i][0] == '#')
            break;
        ans[i][0] = 1;
    }

    for (int i = 1; i < h; i++)
        for (int j = 1; j < w; j++)
            if (s[i][j] == '#')
                ans[i][j] = 0;
            else
                ans[i][j] = (ans[i][j - 1] + ans[i - 1][j]) % (1000000000+7);

    cout << ans[h - 1][w - 1];
    return 0;
}


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

int main(int argc, char const *argv[])
{
  int a, b;
  cin >> a >> b;
  if(a == 1)
    a = 14;
  if(b == 1)
    b = 14;

  if(a == b)
    cout << "Draw" << flush;
  else
    cout << (a > b ? "Alice" : "Bob") << flush;
  return 0;
}


Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b;
	scanf("%d%d", &a, &b);
	if(a + b > 9)printf("error\n");
	else printf("%d\n", a + b);
	
	Please AC;
}


Measured memory_bytes: 256
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-06-01 15:06:06
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

#if __cplusplus >= 201703L
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void tuple_out(std::basic_ostream<Ch, Tr>& os, const Tuple& tp, std::index_sequence<Is...>) {
  ((os << (Is ? ", " : "(") << std::get<Is>(tp)), ...) << ")";
}

template <class Ch, class Tr, class... Args>
auto& operator<<(std::basic_ostream<Ch, Tr>& os, const std::tuple<Args...>& tp) {
  tuple_out(os, tp, std::index_sequence_for<Args...>{});
  return os;
}
#endif

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class Compare>
std::ostream& operator<<(std::ostream& os, const std::set<T, Compare>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U, class Compare>
std::ostream& operator<<(std::ostream& os, const std::map<T, U, Compare>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

template<class _Tp>
std::map<_Tp, int> prime_fact(_Tp n){
  std::map<_Tp, int> result;
  for (_Tp i = 2; i * i <= n; ++i){
    if (n % i != 0) continue;
    int cnt = 0;
    while (n % i == 0){
      n /= i; ++cnt;
    }
    result[i] = cnt;
  }
  if (n != 1) result[n] = 1;
  return result;
}


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

  int64 n; cin >> n;
  map<int64, int> mp = prime_fact(n);

  int64 ans = 0;

  auto cnt = [](int num) -> int {
    int ret = 1;
    while ((ret + 1) * (ret + 2) / 2 <= num) ++ret;
    return ret;
  };

  for (auto e : mp) {
    ans += cnt(e.second);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int x,y;cin >> x >> y;
    int a = y - 2 * x, b = 4 * x - y;
    if(a % 2 || b % 2 || a < 0 || b < 0) puts("No");
    else puts("Yes");
    return 0;
}



Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////
long double a, b, x;
bool f1(long double a, long double b, long double ra) {
	long double sum = a * b*b / (tan(ra*M_PI / 180.0) * 2);
	if (sum > x)return true;
	else return false;
}//こぼれないならtrue
bool f2(long double a, long double b, long double ra) {
	long double sum = a * a*b - a * a*a*tan(ra*M_PI / 180.0) / 2;
	if (sum > x) {
		return true;
	}
	else {
		return false;
	}
}
int main() {
	cin >> a >> b >> x;
	long double l, r;
	if (a*b*a/2 > x) {
		l = 0;
		r = 90.0;
		for (int i = 0; i<100000; ++i) {
			long double mid = (r + l) / 2.0;
			if (f1(a, b, mid)) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
	}
	else {
		l = 0.0;
		r = 90.0;
		for (int i = 0; i<100000; ++i) {
			long double mid = (r + l) / 2.0;
			if (f2(a, b, mid)) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
	}

	cout << fixed << setprecision(12) << r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
  long long int a,b,c[110],d[110],e,f,g[110],h[110];
  cin >>a>>b;
   e =0,f=0;
  for(int i=0;i<a;i++)
    cin >> c[i];
  
  for(int i=0;i<a;i++){
    
   d[i] = c[i]%2;
   
  if( d[i] ==0){
    e ++;
  }
  else{
    f++;
  }
  }
  g[0] =1,h[0]=1;
  for(int i=0;i<e;i++){
    g[i+1] =2*g[i];
  }
  for(int i=0;i<f-1;i++){
    h[i+1] =2*h[i];
  }
 
  if(b ==1&&f==0){
    cout <<"0" <<endl;
    
   
  }
  else if(b==0&&f==0){
    cout << g[e] << endl;
  }
  else{
    cout << h[f-1]*g[e] << endl;
  }
}
 
  
  
  
  
  


Measured memory_bytes: 256
#![allow(non_snake_case)]

fn main() {
    let mut inbuf = String::new();
    std::io::stdin().read_line(&mut inbuf).unwrap();
    let S = inbuf.trim_right().to_owned();

    let date: Vec<&str> = S.split('/').collect();
    let year: i32 = date[0].parse().unwrap();
    let month: i32 = date[1].parse().unwrap();
    let day: i32 = date[2].parse().unwrap();

    let mut ans = "Heisei";
    if year > 2019 || year == 2019 && month >= 5 {
        ans = "TBD"
    }

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


Measured memory_bytes: 4352
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[10010][10010];
bool r,ra,rb,rc;
string s,sa,sb,sc[100];
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;

int main(){
    cin>>a>>b>>x>>y;
    
    z=abs(a-x);
    c=abs(b-y);
    for(int i=0;i<c;i++)C (b-y<0 ? 'U':'D');
    for(int i=0;i<z;i++)C (a-x<0 ? 'R':'L');
    
    for(int i=0;i<c;i++)C (b-y>0 ? 'U':'D');
    for(int i=0;i<z;i++)C (a-x>0 ? 'R':'L');
    
    C (a-x>0 ? 'R':'L');
    for(int i=0;i<=c;i++)C (b-y<0 ? 'U':'D');
    for(int i=0;i<=z;i++)C (a-x<0 ? 'R':'L');
    C (b-y>0 ? 'U':'D');
    C (a-x<0 ? 'R':'L');
    for(int i=0;i<=c;i++)C (b-y>0 ? 'U':'D');
    for(int i=0;i<=z;i++)C (a-x>0 ? 'R':'L');
    C (b-y<0 ? 'U':'D');
    
    
}

Measured memory_bytes: 256
import numpy as np

H, W, K = input().split(' ')
H = int(H)
W = int(W)
K = int(K)
c = [list(str(input())) for i in range(H)]
cnp = np.array(c)

countAll = np.count_nonzero(cnp == '#')
countH = []
countW = []
for i in range(H):
    countH.append(np.count_nonzero(cnp[i] == '#'))
for i in range(W):
    countW.append(np.count_nonzero(cnp[:, i] == '#'))

ans = 0
for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        tmp = countAll
        tmp2 = []
        choiceH = format(i, '0' + str(H) + 'b')
        for m in range(len(choiceH)):
            if int(choiceH[m]):
                tmp -= countH[m]
                tmp2.append(m)
        choiceW = format(j, '0' + str(W) + 'b')
        for n in range(len(choiceW)):
            if int(choiceW[n]):
                tmp -= countW[n]
                for o in range(len(tmp2)):
                    if cnp[tmp2[o], n] == '#':
                        tmp += 1
        if tmp == K:
            ans += 1

print(ans)

Measured memory_bytes: 27024
#include<iostream>

using namespace std;

#define MAX 100000

int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }

int main() {
  int H;
  int A[MAX + 1];

  cin >> H;
  for (int i = 1; i <= H; i++) {
    cin >> A[i];
  }

  for (int i = 1; i <= H; i++) {
    cout << "node " << i << ": key = " << A[i] << ", ";
    if (parent(i) >= 1) {
      cout << "parent key = " << A[parent(i)] << ", ";
    }
    if (left(i) <= H) {
      cout << "left key = " << A[left(i)] << ", ";
    }
    if (right(i) <= H) {
      cout << "right key = " << A[right(i)] << ", ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int n,m,rm,lm;
  cin >> n >> m;
  vi l(m);
  vi r(m);
  rep(i,0,m){
    cin >> l[i] >> r[i];
  }
  lm=0;
  rm=n;
  rep(i,0,m){
    lm= max(l[i],lm);
    rm= min(r[i],rm);
  }
  cout << max(0,rm-lm+1);
  
  return 0;
}


Measured memory_bytes: 1024
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int h,w;
  cin >> h >> w;
  char g[h][w] = {'-'};
  bool r[h] = {false};
  bool c[w] = {false};
  
  string buf;
  rep(i,h)
  {
    cin >> buf;
    rep(j,w)
      g[i][j] = buf[j];
  }

  rep(i,h)
  rep(j,w)
  {
    if(g[i][j] == '#')
    {
      r[i] = true;
      c[j] = true;
    }
  }

  rep(i,h)
  {
    if(r[i])
    {
      rep(j,w)
        if(c[j])
          cout << g[i][j];
      cout << endl;
    }
  }
  
  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
use std::process;
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 $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")
    };
}
fn main() {
    input!{
        n: i64, 
        v: [i64; n],
    }   
    let mut ans : Vec<i64> = Vec::new();

    if v.len() ==  2 {
        println!("{}", (v[0] - v[1]).abs());
        process::exit(0);
    }

    for i in 0..v.len() {
        for j in (i+1)..v.len() {
            ans.push(v[i]-v[j]);
    }
    }

    ans.sort();

    println!("{}" , if ans.first().unwrap().abs() > ans.last().unwrap().abs() { ans.first().unwrap().abs()}else {ans.last().unwrap().abs()});

    

    


}


Measured memory_bytes: 4352
import static java.util.Arrays.deepToString;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		while (sc.hasNext()) {
			double x = sc.nextDouble();
			if (x < 0) break;
			x *= 16;
			if (x - (int)x > 1e-6) {
				System.out.println("NA");
			} else if (x > (1 << 12)) {
				System.out.println("NA");
			} else {
				int y = (int)x;
				for (int i = 11; i > 3; i--) {
					System.out.print(y >> i & 1);
				}
				System.out.print(".");
				for (int i = 3; i >= 0; i--) {
					System.out.print(y >> i & 1);
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 27884
#include <iostream>
#include <algorithm>
using namespace std;
int N, T, S, A[3009], B[3009], dp[3009];
int main() {
	cin >> N >> T >> S;
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
	for (int i = 0; i < N; i++) {
		for (int j = T; j >= B[i]; j--) {
			if (j - B[i] < S && S < j) continue;
			dp[j] = max(dp[j], dp[j - B[i]] + A[i]);
		}
	}
	cout << *max_element(dp, dp + T + 1) << endl;
	return 0;
}

Measured memory_bytes: 3068
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)
//reverse 回文
//if(isupper('A'))->大なら真


//グローバル変数宣言
ll p=0,q=0,r=0;

int main()
{
  string s;
  cin>>s;
  for (int i = 0; i < s.size(); i++)
  {
    if (s[i]=='A')
    {
      p=i;
      break;
    }
  }
  
  for (int i = s.size(); i > 0; i--)
  {
    if (s[i]=='Z')
    {
      q=i;
      break;
    }
  }
  //print(q)
  r=s.size();
  print(q-p+1)
  
}

Measured memory_bytes: 3736
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  cout << a*b/2;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

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


vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)((x).size())
#define pb push_back
#define T first
#define P second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
//#define debug(x) cerr << #x << " : " << (x) << " "
const double PI = 3.14159265358979323846;
const double eps = (1e-10);
int isGreater(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}

const int MOD = 1000000007;
int add(int x, int y)
{
    x += y;
    while(x >= MOD)
        x -= MOD;
    while(x < 0)
        x += MOD;
    return x;
}

int mult(int x, int y)
{
    return (1LL * x * y) % MOD;
}


int n, k;

int power(int base, int exp)
{
    int ret = 1;
    for (; exp; exp >>= 1, base = mult(base, base))
        if (exp&1)
            ret = mult(ret, base);

    return ret;
}


const int MAX_N = 1e5 + 5;
int ans[MAX_N];
int count(int g)
{
    int c = k/g; // c c c
    int ret = power(c, n);
    for (int i = 2 * g; i <= k; i += g)
        ret = add(ret, -ans[i]);
    ans[g] = ret;
    return ret;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
//    freopen("AC.txt", "w", stdout);
#endif
    cin >> n >> k;
    int out = 0;
    for (int g = k; g >= 1; --g)
    {
//        debug(g, count(g));
        out = add(out, mult(count(g), g));
    }
    cout << out;

    return 0;
}

Measured memory_bytes: 3976
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
int main(void) {
  int n;
  string s;
  cin >> n >> s;
  if(n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  n >>= 1;
  string t0 = s.substr(0, n), t1 = s.substr(n, n);
  if(t0 == t1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
#include <list>
using namespace std;
#include <stdio.h>
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>



int main()
{
	int a,b,c;
	std::string S;
	cin >> a >> b >> c;

	if (a != b && b != c && c != a) {
		printf("No");
		return 0;
	}



	if (a == b) {
		if (b == c) {
			printf("No");
			return 0;
		}
	}

	if (b == c) {
		printf("Yes");
	}
	if (a == c) {
		printf("Yes");
	}
	if (a == b) {
		printf("Yes");
	}
	return 0;


	printf("No");


	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int count = 0,ans = 0;
    string s;
    cin >> s;

    for(int i = 0;i < s.size();i++)
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
            count++;
        else{
            ans = max(ans,count);
            count = 0;
        }
    
    cout << max(ans,count) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
 
 
int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(b/a,c)<<endl;
	return 0;
}

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

#ifdef LOCAL 
string to_string(char a) { return string(1,a); }
string to_string(bool a) { return a ? "1" : "0"; }
string to_string(const char* a) { return (string)a; }
string to_string(string a) { return a; }
string to_string(vector<bool> v) {
	string s = "["; for(unsigned i=0;i<v.size();i++){ s += ((i>0)?" ":"");
    s += char('0'+v[i]); } 	s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) {
	bool b = 1; string s = "["; for (const auto& x: v) {
		if (!b) {s += ", ";} b = 0; s += to_string(x); } s += "]"; return s; }
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void dbgf() { cerr << endl; }
template<class H, class... T> void dbgf(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	dbgf(t...); }
#define dbg(...) cerr << #__VA_ARGS__ << " = ", dbgf(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
#define boolout(x) cout<<(x?"YES":"NO")<<endl;
typedef long long ll;

vector<vector<int>> g;
int mod = 1e9+7;

ll mul(ll a, ll b){
    return (ll) a*b%mod;
}

pair<ll, ll> dfs(ll v, ll p){
    ll w = 1, b = 1;
    for (ll to : g[v]) {
        if (to!=p) {
            pair<ll, ll> temp = dfs(to, v);
            w = mul(w, (temp.first + temp.second)%mod);
            b = mul(b, temp.first);
        }
    }
    pair<ll, ll> res = {w, b};
    //dbg(v, res);
    return res;
}

void solve()
{
    int n;
    cin >> n;
    g = vector<vector<int>>(n);
    for (int i = 0; i < n-1; ++i) {
        int t1, t2;
        cin >> t1 >> t2;
        t1--;t2--;
        g[t1].push_back(t2);
        g[t2].push_back(t1);
    }

    pair<ll, ll> res = dfs(0, -1);
    ll ans = (res.first + res.second) % mod;

    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t; // read t. cin knows that t is an int, so it reads it as such.
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 11264
#include<iostream>
using namespace std;
int main(){
	int H, W;
	while (1){
		cin >> H>>W;
		if (H == 0 & W == 0)break;
		for (int i = 0; i < H; i++){
			for (int k = 0; k < W; k++){
			 	if (i == 0 || k == 0 || i==H-1 || k==W-1){
					cout << "#";
				}
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}
	

	

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cu continue
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>
#define dbg(n) cout<<n<<' ';

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


    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll dp[n][n];
    memset(dp,0,sizeof dp);
    ll pre[n];
    memset(pre,0,sizeof pre);
    pre[0]=a[0];
    for(ll i=1;i<n;i++)
        pre[i]=pre[i-1]+a[i];
    for(ll k=2;k<=n;k++)
    {
        for(ll i=0;i<n-k+1;i++)
        {
            ll j=i+k-1;
            dp[i][j]=inf;
            for(ll l=i;l<j;l++)
            {
                if(i>0)
                {
                    dp[i][j]=min(dp[i][j],dp[i][l]+dp[l+1][j]+pre[j]-pre[i-1]);
                }
                else
                    dp[i][j]=min(dp[i][j],dp[i][l]+dp[l+1][j]+pre[j]);
            }
        }
    }
    // for(ll i=0;i<n;i++)
    // {
    //     for(ll j=0;j<n;j++)
    //         cout<<dp[i][j]<<' ';
    //     cout<<endl;
    // }
    cout<<dp[0][n-1]<<'\n';
}       


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<bitset>
#include<iomanip>
#include<cctype>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
const int inf = 1001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

//ワーシャルフロイト法のテンプレ.graphに最短経路が格納される.inf + const = inf に気を付ければ大丈夫
//graphは隣接行列
void WF(vector<vector<int>> &graph){
	int n = graph.size();
	for (int k = 0; k < n; k++){
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
			}
		}
	}
}

int main(){
	int n; cin >> n;
	vector<vector<int>> a(n,vector<int>(n,0));
	rep(i,n) rep(j,n) cin >> a[i][j];
	vector<vector<int>> b(a);
	WF(b);
	rep(i,n){
		rep(j,n){
			if (a[i][j] != b[i][j]){
				cout << -1 << endl;
				return 0;
			}
		}
	}
	rep(i,n){
		rep(j,n){
			rep(k,n){
				if (i == j) continue;
				if (i == k || j == k) continue;
				if (a[i][j] == a[i][k] + a[k][j]) b[i][j] = 0;
			}
		}
	}
	long long int ans = 0;
	rep(i,n){
		rep(j,n){
			ans += b[i][j];
		}
	}
	cout << ans / 2 << endl;
	


    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long int n, m, d[200000], t[200000], cnt = 0;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> d[i];
	cin >> m;
	for (int i = 0; i < m; i++) cin >> t[i];
	if (n < m) {
		cout << "NO" << endl;
		return 0;
	}
	sort(d, d + n); sort(t, t + m);
	for (int i = 0; i < m; i++) {
		for (int j = cnt; j < n; j++) {
			if (t[i] == d[j]) {
				t[i] = 0;
				d[j] = 0;
				cnt = j + 1;
				if (i == m - 1) {
					cout << "YES" << endl;
					return 0;
				}
				break;
			}
		}
		if (t[i]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using   namespace      std;
typedef long long      LL;
typedef vector<int>    VI;
typedef pair<int,int>  PII;

int main(){

	int n;
	cin>> n;
	int cnt = 0;
	for(int i = 1; i<= n; i++){
		cnt++;
		if(i == 9){
			i = 99;
		}
		else if(i == 999){
			i = 9999;
		}
		else if(i == 99999){
			i = 999999;
		}
		else if(i == 9999999){
			i = 99999999;
		}
	}

	cout<< cnt<< endl;

	return 0;
}

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

x,y,z,k = map(int,input().split())
lisa = sorted(map(int,input().split()))
lisb = sorted(map(int,input().split()))
lisc = sorted(map(int,input().split()))

ab = sorted(a+b for a in lisa for b in lisb)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in lisc)[:-k-1:-1]

print(*abc, sep="\n")





Measured memory_bytes: 160456
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define maxN 200005



int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
	ll n, sum = 0;
	cin >> n;
	vector<ll> v(n);
	for (ll i = 0; i < n; i++) {
		cin >> v[i];
		sum += v[i];
		sum = sum % mod;
	}
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		sum -= v[i];
		if (sum < 0) {
			sum += mod;
		}
		ans += (v[i] * sum);
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4724
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
T = LI()
M = INT()

ans = sum(T)

for i in range(M):
    tmp = ans
    P, X = MI()
    tmp = tmp - T[P - 1] + X
    print(tmp)

Measured memory_bytes: 62836
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int r, g;
    cin >> r >> g;
    cout << 2*g -r << endl;
    return 0;
}


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

 int main() {
   int d, n;
   cin >> d >> n;
   int res;
   if (n == 100) {
     res = 101;
   }else{
     res = n;
   }

   if (d != 0) {
     for (int i = 1; i <= d; i++) {
       res *= 100;
     }
   }

   cout << res << '\n';
 }


Measured memory_bytes: 256
a = int(input())
b = [int(s) for s in input().split()]

c = []

for d in b:
    if (d % 2 == 0):
        c.append(d)

ans = []
for d in c:
    if ((d % 3) == 0) or ((d % 5) == 0):
        ans.append(d)

ans = 'APPROVED' if len(c) == len(ans) else 'DENIED'

print(ans)

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	inn(n, r);
	out(n < 10 ? r + (100 * (10 - n)) : r);

	return 0;
}


Measured memory_bytes: 256
nmq=list(map(int, input().split()))
N=nmq[0]
M=nmq[1]
Q=nmq[2]
ablist=[]
for i in range(Q):
    tp=tuple(map(int, input().split()))
    ablist.append(tp)
sumlist=[]
alist=[i for i in range(1,M+1)]
import itertools
case=list(itertools.combinations_with_replacement(alist,N))
for nowcase in case:
    sumd=0
    for i in range(Q):
        if nowcase[ablist[i][1]-1]-nowcase[ablist[i][0]-1]==ablist[i][2]:
            sumd+=ablist[i][3]
    sumlist.append(sumd)
print(max(sumlist))


Measured memory_bytes: 25180