akhauriyash/Code-Regression huggingface dataset:
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 200020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

using Point = complex<double>;
void solve() {
	int N; cin >> N;
	vector<Point>v(N);
	REP(i, N) {
		double x, y; cin >> x >> y;
		v[i] = { x,y };
	}
	int perm[10];
	double sum = 0;
	REP(i, N)perm[i] = i;
	do {
		REP(i, N - 1) {
			sum += abs(v[perm[i]] - v[perm[i + 1]]);
		}
	} while (next_permutation(perm, perm + N));;
	FOR(i, 1, N + 1)sum /= i;
	cout << setprecision(10) << sum << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// int q; cin >> q;
	// while (q--)
	solve();
}


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

#define nl "\n"

using namespace std;

int main() {
    int a, b;

    cin>>a>>b;
    if((a==8 && b == 7) || (a == 7 && b == 8)) {
        cout<<":("<<nl;
    }
    else if(a>8 || b>8) {
        cout<<":("<<nl;
    }
    else {
        cout<<"Yay!"<<nl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
  private static String solve(int n) {
    for (int i = 0; true; i++) {
      int j = (i * 108) / 100;
      if (j == n) {
        return "" + i;
      }
      if (j > n) {
        return ":(";
      }
    }
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    out.println(solve(n));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21460
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;


double a[10005];
double at[10005];
double H[10005];
int main(){
	int N, T, A;
	scanf("%d\n%d %d", &N, &T, &A);
	for(int i = 0; i < N; i++){
		scanf("%lf ", &H[i]);		
	}
	for(int j = 0; j < N; j++){
		at[j] = abs(T - H[j] * 0.006 - A);
		a[j] = at[j];
	}
	sort(a, a+N);
	for(int i = 0; i < N; i++){
		if(at[i] == a[0])
		{
			printf("%d\n", i + 1);
		}
	}
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	long long n;
	long long min;
	long long count = 1;
	std::cin >> n;
	std::cin >> min;
	for (long long i = 1; i < n; i++)
	{
		long long tem;
		std::cin >> tem;
		if (tem < min)
		{
			count++;
			min = tem;
		}
	}
	std::cout << count;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	static boolean predictWinner(int ar[], int k)
	{
		if(k==0)
			return false;
		System.out.println(k);
		boolean temp=true;
		for(int i=0;i<ar.length;i++)
		{
			if(k>=ar[i])
				temp = temp && predictWinner(ar, k-ar[i]);
		}
		return (!temp);
	}

	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int k=scan.nextInt();

		int ar[]=new int[n];
		for(int i=0;i<n;i++)
			ar[i]=scan.nextInt();

		boolean dp[]=new boolean[k+1];
		for(int i=1;i<=k;i++)
		{
			boolean temp=false;
			for(int j=0;j<n;j++)
			{
				if(i>=ar[j])
					temp = temp || (!dp[i-ar[j]]);
			}
			dp[i]=temp;
		}

		if(dp[k])
			System.out.println("First");
		else
			System.out.println("Second");

	}
}

Measured memory_bytes: 23892
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  char s;
  cin>>s;
  cout << (char)(s + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
// A - Connection and Disconnection
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll f(const string &S){//文字列の操作回数を求める
	ll c = 0;
	for(int i=1; i < S.size(); ++i)
		if(S[i-1] == S[i]){ c++; i++; }
	return c;
}

int main(){
	string S; cin>>S;
	ll K; cin>>K;

	ll s1 = f(S);//K=1 のときの操作回数
	ll s2 = f(S+S);//K=2 のときの操作回数
	ll s3 = f(S+S+S);//K=3 のときの操作回数

	ll d1 = s2 - s1;//K=2 と K=1 の操作回数の差分
	ll d2 = s3 - s2;//K=3 と K=2 の操作回数の差分
	ll d = d1 + d2;

	ll ans = 0;
	//ここからは等差数列の問題
	if(d1 == d2) ans = s1 + d1 * (K-1);
	else
		if(K % 2) ans = s1 + d * ((K+2-1)/2-1);//(k/2):roundup
		else ans = s2 + d * (K/2-1);
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int i,h,h1,h2,h3;
	h1=h2=h3=0;
	for (i=0;i<10;i++){
		scanf("%d",&h);
		if (h>h1){
			h3=h2;h2=h1;h1=h;
		}else if (h>h2){
			h3=h2;h2=h;
		}else if (h>h3){
			h3=h;
		}
	}
	printf("%d\n%d\n%d\n",h1,h2,h3);
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	n <<= 1;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	for(int i = 0; i < n; i += 2) ans += a[i];
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n,m,i,j,a,b;
  cin >> n >> m;
  dsu d(n);
  
  for(i=0; i<m; i++){
    cin >> a >> b;
    a--; b--;
    d.merge(a,b);
  }
  
  vector<vector<int>> k=d.groups();
  cout << k.size()-1 << endl;
} 

Measured memory_bytes: 9024
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	ll N;
	cin >> N;
	vector<ll> A(N + 1);
	repn(i, N) cin >> A[i];

	sort(++A.begin(), A.end(),greater<ll>());
	
	ll b = 1;

	repn(i, N) if (N-1 - (((i-1)/2) * 2) != A[i]) { b = 0; }

	repn(i, N / 2) {
		b *= 2;
		b %= MOD;
	}

	cout << b;

	system("PAUSE");
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c, x; cin >> a >> b >> c >> x;
  int ans = 0;
  for(int i = 0; i <= a; i++) for(int j = 0; j <= b; j++) for(int k = 0; k <= c; k++){
    if(i*500 + j*100 + k*50 == x) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int N;
    int n_1, n_2, n_3, n_4;
    cin >> N;
    n_1 = N % 10;
    N = N / 10;
    n_2 = N % 10;
    N = N / 10;
    n_3 = N % 10;
    n_4 = N / 10;
    // cout << n_1 << endl;
    if (n_2 == n_3)
    {
        if (n_1 == n_2)
        {
            cout << "Yes" << endl;
        }
        else if (n_3 == n_4)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void no(){
  cout << -1 << endl;
  exit(0);
}

//vectorのn番目にxを挿入
void ope(vector<ll>& a, ll n, ll x){
  auto it = a.begin() + n;
  //REP(i, n) it++;
  a.insert(it, x);
}

int main() {
  ll n; cin >> n;
  vector<ll> b(n);
  REP(i, n){
    cin >> b[i];
    if(b[i] > i+1) no();
  }

  vector<ll> ans;
  ans.push_back(b[0]);
  FOR(i, 1, n){
    //ans[j]にb[i]を挿入すると仮定
    REP(j, i+1) if(b[i]-1<=j){
      vector<ll> tmp;
      REP(k, i+1) {
        if(k==j) ope(tmp,b[i]-1,b[i]);
        if(k<i)ope(tmp, ans[k]-1, ans[k]);
      }
      bool f = true;
      REP(k, i+1){
        if(b[k] != tmp[k]) f = false; 
      }
      if(f){
        ope(ans, j, b[i]);
        break;
      }
    }
  }

  FOREACH(x,ans){
    cout << x << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
A = LI()

"""

1 2 3 4

1*2, 1*3 1*4
2*3 2*4
3*4
1 6 3 5
1*6 1*3 1*5 = 1 * (6 + 3 + 5)
3*5 
10 ** 5 * 
"""
ans = 0
s = sum(A) % mod
for a in A:
    s -= a
    s %= mod
    ans += a * s % mod
    ans %= mod

print(ans)

    






Measured memory_bytes: 34864
import java.util.Scanner;
class Main{
 public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
  while(true){
   int h = scan.nextInt();
   int w = scan.nextInt();
   if(h == 0 && w == 0){
    break;
   }
   for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
     System.out.print("#");
    }System.out.println();
   }System.out.println();
  }
 }
}

Measured memory_bytes: 26792
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  "math/big"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
  input := nextLine()
  N, _ := strconv.Atoi(strings.Fields(input)[0])
  bigNum1 := big.NewInt(int64(N))
  bigNum2 := big.NewInt(int64(N-1))
  bigNum3 := big.NewInt(2)
  bigNum1.Mul(bigNum1, bigNum2)
  bigNum1.Div(bigNum1, bigNum3)
  fmt.Println(bigNum1)
}

func nextLine() string {
  sc.Scan()
  return sc.Text()
}

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

int main()
{
    for(int j=0;j<20;j++){
    int n,sum=0;
    cin >> n;
    if(n==0){
        break;
    }
    vector<int> score(n);
    for(int i=0;i<n;i++){
        cin >> score.at(i);
    }
    sort(score.begin(),score.end());
    for(int i=1;i<n-1;i++){
        sum+=score.at(i);
    }
    cout << sum/(n-2) << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 1e5;
int k, x;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> k >> x;
  cout << ((500*k >= x) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

bool isLeap(int y);
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/


string getConversion1(string inp)
{
	string ret = "";
	map<char, string> tbl;
	
	tbl['A'] = "00000";
	tbl['B'] = "00001";
	tbl['C'] = "00010";
	tbl['D'] = "00011";
	tbl['E'] = "00100";
	tbl['F'] = "00101";
	tbl['G'] = "00110";
	tbl['H'] = "00111";
	tbl['I'] = "01000";
	tbl['J'] = "01001";
	tbl['K'] = "01010";
	tbl['L'] = "01011";
	tbl['M'] = "01100";
	tbl['N'] = "01101";
	tbl['O'] = "01110";
	tbl['P'] = "01111";
	tbl['Q'] = "10000";
	tbl['R'] = "10001";
	tbl['S'] = "10010";
	tbl['T'] = "10011";
	tbl['U'] = "10100";
	tbl['V'] = "10101";
	tbl['W'] = "10110";
	tbl['X'] = "10111";
	tbl['Y'] = "11000";
	tbl['Z'] = "11001";
	tbl[' '] = "11010";
	tbl['.'] = "11011";
	tbl[','] = "11100";
	tbl['-'] = "11101";
	tbl['\''] = "11110";
	tbl['?'] = "11111";
	
	rep(i, inp.length())
	{
		ret += tbl[inp[i]];
	}
	
	return ret;
}

string getConversion2(string inp)
{
	string ret = "", key = "";
	map<string, char> tbl;
	
	tbl["101"] = ' ';
	tbl["000000"] = '\'';
	tbl["000011"] = ',';
	tbl["10010001"] = '-';
	tbl["010001"] = '.';
	tbl["000001"] = '?';
	tbl["100101"] = 'A';
	tbl["10011010"] = 'B';
	tbl["0101"] = 'C';
	tbl["0001"] = 'D';
	tbl["110"] = 'E';
	tbl["01001"] = 'F';
	tbl["10011011"] = 'G';
	tbl["010000"] = 'H';
	tbl["0111"] = 'I';
	tbl["10011000"] = 'J';
	tbl["0110"] = 'K';
	tbl["00100"] = 'L';
	tbl["10011001"] = 'M';
	tbl["10011110"] = 'N';
	tbl["00101"] = 'O';
	tbl["111"] = 'P';
	tbl["10011111"] = 'Q';
	tbl["1000"] = 'R';
	tbl["00110"] = 'S';
	tbl["00111"] = 'T';
	tbl["10011100"] = 'U';
	tbl["10011101"] = 'V';
	tbl["000010"] = 'W';
	tbl["10010010"] = 'X';
	tbl["10010011"] = 'Y';
	tbl["10010000"] = 'Z';
	
	rep(i, inp.length())
	{
		key += inp[i];
		if (tbl.find(key) != tbl.end())
		{
			ret += tbl[key];
			key = "";
		}
	}
	
	return ret;
}


int main()
{
	string inp, conv, ans;
	
	while (getline(cin, inp))
	{
		conv = getConversion1(inp);
		
		//cout << conv << endl;
		
		ans = getConversion2(conv);
		
		cout << ans << endl;
	}
	
	return 0;
}


bool isLeap(int y)
{
	return y % 400 == 0
						? true : y % 100 == 0
						? false : y % 4 == 0
						? true : false;
}

ll gcd(ll a, ll b)
{
	return (b > 0) ? gcd(b, a % b) : a;
}

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

void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}

Measured memory_bytes: 1220
#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<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef 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
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
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;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//わからん
//カードに対して、「下限の値」をとりあえず求めることができればうれしい
//じつは枝刈り全探索で行けたりして?

vector<llint>a;
llint kai=0;
vector<pair<llint,llint>> memo[20][20];
vector<pair<llint,llint>> solve(int L,int R){
	
	vector<pair<llint,llint>> ans;
	if(L+1==R){ans.pub(mp(a[L],a[R]));return ans;}
	if(memo[L][R].size()!=0){return memo[L][R];}
	for(int i=L+1;i<R;i++){
		auto hret=solve(L,i);
		auto mret=solve(i,R);
		for(auto it:hret){
			for(auto jt:mret){
				ans.pub(mp(it.fir+it.sec+jt.fir-a[i],it.sec+jt.fir+jt.sec-a[i]));
			}
		}
		//kai+=hret.size()*mret.size();
	}
	SO(ans);
	vector<pair<llint,llint>> ret;
	for(auto it:ans){
		if(ret.size()==0||ret.back().sec>it.sec){ret.pub(it);}
	}
	//cerr<<"L="<<L<<"R="<<R<<endl;
	//for(auto it:ret){cerr<<it.fir<<" "<<it.sec<<endl;}
	
	//kai+=ret.size();
	memo[L][R]=ret;
	return ret;
}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	//いけるわけないじゃん
	int n,i,j;cin>>n;
		
	a.res(n);
	for(i=0;i<n;i++){cin>>a[i];}
	auto ret=solve(0,n-1);
	llint ans=big;
	for(auto it:ret){mineq(ans,it.fir+it.sec);}
	//cerr<<"kai="<<kai<<endl;
	cout<<ans<<endl;
	return 0;
}
/*
17
3 1 4 41 5 69 23 6 5 3 33 24 1 15 9 2 8
*/

Measured memory_bytes: 748
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    int x=a+b;
    if(x%2)x++;

    cout<<x/2;

    
    

    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	n := getInt()
	a := getInt()
	b := getInt()

	fmt.Println(min(b, n*a))
}

func min(ns ...int) int {
	min := ns[0]
	for i := 1; i < len(ns); i++ {
		if min > ns[i] {
			min = ns[i]
		}
	}
	return min
}

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

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
//
// Created by kuroneko on 2019-07-06.
//

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

typedef long long ll;
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    string s; cin >> s;

    vector<int> switch_b;
    switch_b.push_back(0);
    char prev = s[0];
    for (int i = 1; i < N; i++) {
        if (s[i] != prev) {
            switch_b.push_back(i);
            prev = s[i];
        }
    }

    int res = 0;
    for (int i = 0; i < switch_b.size(); i++) {
        int left = switch_b[i];
        int right;
        if (s[left] == '0') {
            int next = 2 * K;
            if (i + next >= switch_b.size()) right = s.size();
            else right = switch_b[i+next];
            res = max(res, right - left);
        } else if (s[left] == '1') {
            int next = 2*K + 1;
            if (i + next >= switch_b.size()) right = s.size();
            else right = switch_b[i+next];
            res = max(res, right - left);
        }
    }


    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1020
s=input()

list = list(s)
cnt=0
if list[0] == 'R' and list[1] == 'R' and list[2]=='R':
    print(3)
elif list[0]=='R' and list[1] == 'R'and list[2]!='R':
    print(2)
elif list[0]=='R' and list[1] != 'R'and list[2]!='R':
    print(1)
elif list[0]=='R' and list[1] != 'R'and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]=='R':
    print(2)
elif list[0]!='R' and list[1] != 'R' and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]!='R':
    print(1)
else:
    print(0)

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

 int main(){

 string s;
  cin>>s;

  if(s[0] == s[1] && s[1] == s[2] && s[2] == s[0])
    cout<<s<<endl;
  else{

    int n = s[0]-'0';
    int integer = (s[2]-'0') + (s[1]-'0')*10+ (s[0]-'0')*100;


    int before = n*100+n*10+n;

     n += 1;
    int after = (n)*100+(n)*10+(n);

    if(integer > before)
        cout<<after<<endl;
    else
        cout<<before<<endl;

  }

 return 0;
 }

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

long long a[10000];

int main(){
	int n;
	while(cin >> n && n){
		int ans[10000] = {};
		vector<int> g;
		for(int i = 1 ; i < n ; i++){
			int calc = i * i % n;
			g.push_back(calc);
		}
		sort(g.begin(),g.end());
		g.erase(unique(g.begin(),g.end()),g.end());
		for(int i = 0 ; i < g.size() ; i++)
			for(int j = 0 ; j < g.size() ; j++){
				if( i != j ){
					int x = g[i] - g[j];
					if( x < 0 ) x += n;
					if( x > n/2 ) x = n - x;
					ans[x]++;
				}
			}
		for(int i = 1 ; i <= n / 2 ; i++)
			cout << ans[i] << endl;
	}
}

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

long long n;
vector<long long> x;

long long solve();

int main() {
  cin >> n;
  x.resize(n);
  for(int i = 0; i < n; ++i) cin >> x[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long res = 1e18;
  for(int i = -100; i <= 100; ++i) {
    long long sum = 0;
    for(int j = 0; j < n; ++j)
      sum += (i - x[j]) * (i - x[j]);
    res = min(res, sum);
  }
  return res;
}

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

int main(){
    int N;
    int d[110];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> d[i];
    }

    sort(d, d+N);
    int ans=1;
    for(int i=1; i<N;i++){
        if(d[i-1]!=d[i]){
            ans++;
        }
    }

    cout << ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include<cstdio>
int main(){
  long long int h,n=1; cin>>h;
  while(true){
    if(h==1)break;
    h/=2;
    n++;
  }
  long long int ans=pow(2,n)-1;
  //cout<<n<<endl;
  cout<<ans;
}









Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func main() {
	// scan starts
	var N int
	fmt.Scan(&N)

	nums := make([]int, N)
	for i := 0; i < N; i++ {
		var num int
		fmt.Scan(&num)
		nums[i] = num
	}
	// scan ends

	// find biggest by sorting
	sort.Ints(nums)
	others, biggest := nums[:N-1], nums[N-1]

	// sum up others
	othersSum := 0
	for _, num := range others {
		othersSum += num
	}

	// result
	if biggest < othersSum {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int x = x2 - x1, y = y2 - y1;
	cout << x2 - y << " " << y2 + x << " ";
	cout << x1 - y << " " << y1 + x << endl;
}


Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			int n = Integer.parseInt(br.readLine());

			if(n == 0){
				break;
			}

			int input[] = new int[n];

			String[] tmpArray = br.readLine().split(" ");
			for(int i = 0; i < n; i++){
				input[i] = Integer.parseInt(tmpArray[i]);
			}

			int ansS = 0, ansA = 0, ansC = 0;
			double result = Double.MAX_VALUE;
			//全探索
			for(int s = 0; s <= 15; s++){
				for(int a = 0; a <= 15; a++){
					for(int c = 0; c <= 15; c++){
						double tmpEntropy = calcEntropy(generateOutput(input, s, a, c));

//						if(s == 8){
//							System.out.println("s a c"+ s+" "+ a+" " + c + " entropy "+tmpEntropy);
//						}
						if(tmpEntropy < result){
							result = tmpEntropy;
							ansS = s; ansA = a; ansC = c;
						}
					}
				}
			}

			System.out.println(ansS + " "+ ansA +" "+ ansC);
		}
	}

	static int[] generateOutput(int[] input, int s, int a, int c){

		int n = input.length;

		int[] r = new int[n + 1];
		r[0] = s;
		for(int i = 1; i <= n; i++){
			r[i] = (a*r[i - 1] + c) % 256;
		}

		int[] out = new int[n];

		for(int i = 0; i < n; i++){
			out[i] = (input[i] + r[i + 1]) % 256;
		}

		return out;
	}

	static double calcEntropy(int[] array){
		int[] count = new int[256];
		int n = array.length;

		for(int i = 0; i < n; i++){
			count[array[i]]++;
		}

		double result = 0;

		for(int i = 0; i < count.length; i++){
			if(count[i] != 0){
//				System.out.println(i+" appears "+count[i]+" times");
				result += (double)count[i]/n * Math.log((double)count[i]/n)/Math.log(2);
			}
		}

		//System.out.println("entropy "+(-result));
		return -result;
	}

}



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

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k;
  int a, b;
  cin >> k >> a >> b;
  int cur = ( (a / k) + ( (a % k) != 0 ) ) * k;
  if (cur >= a && cur <= b) cout << "OK" << '\n';
  else cout << "NG" << '\n';
  return 0;
}


Measured memory_bytes: 3624
H, W = [int(i) for i in input().split()]
N = int(input())
a = [int(i) for i in input().split()]
c = [[0 for j in range(W)] for i in range(H)]
w = 0
h = 0
for i in range(N):
    for j in range(a[i]):
        c[h][w] = i+1
        if h%2 == 0:
            if w < W - 1:
                w += 1
            else:
                h += 1
        else:
            if w > 0:
                w -= 1
            else:
                h += 1
for i in range(H):
    print(*c[i])

Measured memory_bytes: 3916
import sys

input = sys.stdin.readline

n = int(input())

b_list = list(map(int, input().split()))
result_list = []
while len(b_list) > 0:
    flag = False
    for i,b in enumerate(reversed(b_list)):
        if len(b_list)-i == b:
            result_list.append(b)
            b_list.pop(len(b_list)-i -1)
            flag = True
            break
    if not flag:
        print(-1)
        exit(0)

for b in reversed(result_list):
    print(b)
    

Measured memory_bytes: 9036
#include <bits/stdc++.h>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define yes(i) cout<<(i?"yes":"no")<<endl
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	long long cnt=0;
	long long ab=0;
	long long mi=1e9+7;
	bool f=false;
	for(int i=0;i<n;i++){
		if(a[i]<0){
			cnt++;
		}
		if(a[i]==0LL){
			f=true;
		}
		mi=min(mi,abs(a[i]));
		ab+=abs(a[i]);
	}
	if(f||cnt%2==0){
		cout<<ab<<endl;
	}else{
		cout<<ab-mi-mi<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a[105][105];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		char ch[105];
		scanf("%s",ch);
		for(int j=0;j<m;j++)
			if(ch[j]=='#')a[i][j+1]=1;else a[i][j+1]=0;
	}
	bool flag=true;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]==1)
				if(a[i-1][j]==0&&a[i+1][j]==0&&a[i][j-1]==0&&a[i][j+1]==0)
					flag=false;
	if(flag)puts("Yes");else puts("No");
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
   int P, J, p[10], j[10];
   scanf("%d %d %d %d %d", &p[1], &p[2], &p[3], &j[1], &j[2]);
   if ( p[1] <= p[2] && p[1] <= p[3]) P = p[1];
   else if ( p[2] <= p[1] && p[2] <= p[3]) P = p[2];
   else P = p[3];
   if ( j[1] <= j[2]) J = j[1];
   else J = j[2];
   printf("%d\n", P + J - 50);
   return 0;
}

Measured memory_bytes: 1812
using System;
using System.Collections.Generic;
using System.Collections;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;

//namespace _1_A
//{
class Program
{
    static void Main(string[] args)
    {
        int min = 1000001;
        int max = (-1000001);
        long sum = 0;
        string n = Console.ReadLine();
        int[] a = new int[int.Parse(n)];
        string inp = Console.ReadLine();
        string[] oup = inp.Split(' ');

        for (int i = 0; i < int.Parse(n); i++)
            a[i] = int.Parse(oup[i]);

        for (int i = 0; i < int.Parse(n); i++) {
            if (min > a[i])
                min = a[i];
            if (max < a[i])
                max = a[i];
            sum += a[i];
        }

        Console.WriteLine(min + " " + max + " " + sum);
        
        //Console.Read();
    }
}
//}

Measured memory_bytes: 9968
#include<stdio.h>
int main(void)
{
  int a,b,max;
  scanf("%d %d",&a,&b);
  max=a+b;
  if(max<a-b)
    max=a-b;
  if(max<a*b)
    max=a*b;
  
  printf("%d",max);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];




    void solve()
    {
        int i,j=0,r=200,p,q,k=0,ans=0,d,h,flag=0,n,m=0,a,b,id,c,h1,h2,a1,b1;
         string s1,s2;
         cin>>s1>>s2;
         n=s1.size();
         m=s2.size();
        // if(n<m) {swap(s1,s2); }
         vector < vector < int > > dp(n+1,vector < int > (m+1,0) );
         rep(i,1,n+1)

           {
               rep(j,1,m+1)
                  {
                      if(s1[i-1]==s2[j-1]) dp[i][j]=1+dp[i-1][j-1];
                      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                  }
           }

          id=dp[n][m];
         string s="";

            id=0;
          i=n; j=m;
          while(i>0 and j>0)
          {

              if(s1[i-1]==s2[j-1]) s+=s1[i-1],i--,j--;
              else if(dp[i-1][j]>dp[i][j-1])
                i--;
              else j--;
          }
reverse(all(s));
  cout<<s;


    }



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

       /*

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct data{
	int bit;
	int cost;
	int v;
	data(){}
	data(int vv,int bb,int cc){
		v=vv;
		cost=cc;
		bit=bb;
	}
	bool operator<(const data &dat)const{
		return cost>dat.cost;
	}
};

int n,x,y;
int dp[1<<14][14];
int dp2[14][1001];
int dp3[1<<14][1001];
int dp4[1<<14][1001];
int tmp[1001][1001];
int tmp2[1001];
int tmp3[15][1001];
int dist[14][14];
int a[14][301],b[14][301],c[14][301];

void dijk(){
	priority_queue<data> que;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			dp[i][j]=100000;
		}
	}
	dp[1][0]=0;
	que.push(data(0,1,0));
	while(que.size()){
		data d=que.top();
		que.pop();
		if(dp[d.bit][d.v]<d.cost)continue;
		for(int nec=0;nec<n;nec++){
			int nbit=d.bit|(1<<nec);
			int ncost=d.cost+dist[d.v][nec];
			if(ncost<dp[nbit][nec]){
				dp[nbit][nec]=ncost;
				que.push(data(nec,nbit,ncost));
			}
		}
	}
}

int main(void){
	scanf("%d%d%d",&n,&x,&y);
	for(int i=0;i<n;i++){
		int k;
		scanf("%d",&k);
		for(int j=0;j<k;j++){
			scanf("%d%d%d",&a[i][j],&b[i][j],&c[i][j]);
		}
		memset(tmp,0,sizeof(tmp));
		for(int j=0;j<k;j++){
			memset(tmp3,0,sizeof(tmp3));
			for(int cs=0;cs<=y;cs++){
				tmp3[0][cs]=tmp[j][cs];
			}
			int cnt2=0;
			for(int ncs=0;ncs<=10;ncs++){
				int cs=min(c[i][j],(int)(1<<ncs));
				c[i][j]-=cs;
				cnt2++;
				for(int l=0;l<=y;l++){
					tmp3[cnt2][l]=max(tmp3[cnt2][l],tmp3[cnt2-1][l]);
					if(l+cs*a[i][j]>y)continue;
					tmp3[cnt2][l+cs*a[i][j]]=max(tmp3[cnt2][l+cs*a[i][j]],tmp3[cnt2-1][l]+b[i][j]*cs);
				}
			}
			for(int l=0;l<=y;l++){
				tmp[j+1][l]=tmp3[cnt2][l];
			}
			
		}
		for(int j=0;j<=y;j++){
			dp2[i][j]=tmp[k][j];
		}
		for(int j=1;j<=y;j++){
			dp2[i][j]=max(dp2[i][j],dp2[i][j-1]);
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			scanf("%d",&dist[i][j]);
		}
	}
	dijk();
	for(int i=0;i<n/2;i++){
		for(int j=0;j<(1<<i);j++){
			for(int k=0;k<=y;k++){
				for(int l=k;l<=y;l++){
					dp3[j|(1<<i)][l]=max(dp3[j|(1<<i)][l],dp3[j][k]+dp2[i][l-k]);
				}
			}
		}
	}
	for(int i=0;i<(n+1)/2;i++){
		for(int j=0;j<(1<<i);j++){
			for(int k=0;k<=y;k++){
				for(int l=k;l<=y;l++){
					dp4[j|(1<<i)][l]=max(dp4[j|(1<<i)][l],dp4[j][k]+dp2[n/2+i][l-k]);
				}
			}
		}
	}
	for(int i=0;i<(1<<(n/2));i++){
		for(int j=1;j<=y;j++){
			dp3[i][j]=max(dp3[i][j],dp3[i][j-1]);
		}
	}
	for(int i=0;i<(1<<((n+1)/2));i++){
		for(int j=1;j<=y;j++){
			dp4[i][j]=max(dp4[i][j],dp4[i][j-1]);
		}
	}
	int res=0;
	for(int i=0;i<(1<<n);i++){
		int yosan=0;
		int bit1=0;
		int bit2=0;
		for(int bit=n-1;bit>=0;bit--){
			bit1*=2;
			if(bit>=n/2)bit2*=2;
			if(i>>bit & 1){
				if(bit<n/2){
					bit1++;
				}else{
					bit2++;
				}
			}
		}
		for(int j=0;j<n;j++){
			yosan=max(yosan,x-dp[i][j]-dist[j][0]);
		}
		yosan=min(y,yosan);
		for(int j=0;j<=yosan;j++){
			res=max(res,dp3[bit1][j]+dp4[bit2][yosan-j]);
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 9068
#include<stdio.h> //B[A[i]]
int main(){
    int N,tmp;
    int A[21];
    int B[21];
    int C[21];
    int ac[21];
    int value = 0;
    
    scanf("%d",&N);
    for(int i = 1 ; i <= N ; i++){
        scanf("%d",&A[i]);
    }
    for(int i = 1 ; i <= N ; i++){
        scanf("%d",&B[i]);
    }
    for(int i = 1 ; i <= N-1 ; i++){
        scanf("%d",&C[i]);
    }
    tmp = A[0];
    for(int i = 1 ; i <= N ; i++){ //実際に食べた順番
        value += B[A[i]];
//        printf("value is %d\n",value);
        if(i > 1 && A[i]-tmp == 1){
            value += C[tmp];
//            printf("value plus ! c[%d] = %d\n",i,C[tmp]);
        }
        tmp = A[i];
    }
    printf("%d\n",value);
    
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

constexpr ll LL_MOD = 1000000009;
constexpr int I_MOD = 1000000007;
constexpr double EPS = numeric_limits<double>::epsilon();
constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> void scan(vector<T> &v);
void scan(vector<string> &v, bool isWord = true);
boost::dynamic_bitset<> scan(char trueValue = 'o');

class Node {
public:
  int cur;
  set<int> s;

  Node(int p) noexcept : cur(p), s({p}) {}

  bool in(const int next) const { return s.find(next) != end(s); }
  void add(const int next) {
    cur = next;
    s.insert(next);
  }
};

int main(int argc, char *argv[]) {
	// INFILE();
  int n, m;
  cin >> n >> m;

  bool adjList[8][8] = {};
  for (int i = 0; i < m; i++) {
    int from, to;
    cin >> from >> to;
    adjList[from - 1][to - 1] = true;
    adjList[to - 1][from - 1] = true;
  }

  queue<Node> q;
  q.push(Node(1));

  int total = 0;
  while (!q.empty()) {
    Node next_p = q.front();
    q.pop();

    for (int i = 0; i < n; i++) {
      if (!adjList[next_p.cur - 1][i] || next_p.in(i + 1)) {
        continue;
      }

      Node new_node = next_p;
      new_node.add(i + 1);

      if (new_node.s.size() == n) {
        total++;
        continue;
      }
      q.push(new_node);
    }
  }

  cout << total << "\n";
  return 0;
}

template <class T> void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


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

using namespace std;

int main(void)
{
  string imp = "Impossible";
  string pos = "Possible";
  int N, L;
  cin >> N >> L;
  vector<int> a(N + 1, 0);
  for(int i = 1; i < N + 1; i++)
    cin >> a[i];
  vector<int> res(N - 1, 0);

  if(N == 1){
    cout << pos << endl;
    return 0;
  }

  int c = 0;
  for(int i = 1; i <= N - 1; i++){
    if(a[i] + a[i + 1] >= L){
      c = i;
      break;
    }
  }

  if(c == 0){
    cout << imp << endl;
    return 0;
  }

  cout << pos << endl;
  for(int i = 1; i < c; i++)
    cout << i << endl;
  for(int i = N - 1; i > c; i--)
    cout << i << endl;
  cout << c << endl;

  return 0;
}



Measured memory_bytes: 1664
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet

#define N 1000009

void run() {
	int k;
	in("%d", &k);
	int a[N] = { 7 % k };
	rep(i, k)a[i + 1] = (a[i] * 10 + 7) % k;
	rep(i, k)if (!a[i]) { printf("%d", i + 1); return; }
	printf("-1");
}

int main() {
	int times = 1;
//	in("%d", &times);
	while (times--) {
		run();
	}
}

Measured memory_bytes: 5640
#include <cstdio>
int a[40],b;
char S[40];
int main ()
{
	scanf ("%s",S);
	for (b=0;S[b];b++) a[S[b]-'a']++;
	for (b=0;b<26;b++) b=a[b]>1?27:b;
	printf ("%s\n",b==26?"yes":"no");
	return 0;
}


Measured memory_bytes: 128
def solve(s):
    n = len(s)
    dp = [[0,0] for i in range(n+1)]
    for i in range(n):
        for j in [1,2]:
            for k in [1,2]:
                if i+k <= n:
                    a = s[i-j:i]
                    b = s[i:i+k]
                    if a != b:
                        dp[i+k][k-1] = max(dp[i+k][k-1], dp[i][j-1] + 1)
    return max(dp[n])

s = input()
print(solve(s))

Measured memory_bytes: 36380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >>N;


if(N==1){
 cout <<1<<endl;
}
else if(N<4){
cout <<2<<endl;
}
else if(N<8){
cout <<4<<endl;
}else if(N<16){
cout <<2<<endl;
}else if(N<32){
cout <<16<<endl;
}else if(N<64){
cout <<32<<endl;
}
else if(N>=64){
cout <<64<<endl;
}
}

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

double a, b, x, t;

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

	if(a * a * b >= 2 * x)
		t = atan(a * b * b / (x * 2)) / acos(-1) * 180;
	else
		t = atan((a * a * b - x) * 2 / (a * a * a)) / acos(-1) * 180;

	cout << setprecision(15) << setiosflags(ios::fixed | ios::showpoint) << t << endl;

	return 0;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = c - a, y = d - b;;
	cout << c - y << " " <<  d + x << " " << 
		a - y << " " << b + x << '\n';	
	
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPLL(i, n) for(ll i = 0;i < (n);++i)

#define endl "\n"
#define pb push_back
#define MOD 1000000007LL
#define PI 3.1415926

typedef long long ll;

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T> inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	ll x; cin >> x;
	ll ans = (x / 11) * 2; x %= 11;
	if(x > 0 && x <= 6) ans += 1;
	if(x > 6) ans += 2;
	cout << ans << endl;

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  if ( (N-7) % 10 == 0 )
    cout << "Yes" << endl;
  
  else if ( (N/10 - 7) % 10 == 0 )
    cout << "Yes" << endl;
  
  else if ( (N/100 - 7) % 10 == 0 )
    cout << "Yes" << endl;
  
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3636