akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T, X;
    cin >> T >> X;
    cout << fixed << setprecision(8) << (T * 1.0 / X) << endl;
    return 0;
};


Measured memory_bytes: 256
fun main() {
    var (a, b, c) = readLine()!!.split(" ").map { it.toInt() }
    var k = readLine()!!.toInt()
    while (a >= b) {
        if (k >= 1) {
            b *= 2
            k--
        } else {
            break
        }
    }

    while (b >= c) {
        if (k >= 1) {
            c *= 2
            k--
        } else {
            break
        }
    }

    if (b in (a + 1) until c) {
        println("Yes")
    } else {
        println("No")
    }

}

Measured memory_bytes: 36324
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	map<long long,int>mm;
	map<long long,int>::iterator it;
	long long sum = 0;
	long long ret = 0;
	mm.insert(make_pair(0,1));
	while(n--){
		long long a;
		cin>>a;
		sum+=a;
		long long mod = sum%m;
		it = mm.find(mod);
		if(it==mm.end()) mm.insert(make_pair(mod,1));
		else{
			ret+=it->second;
			it->second+=1;
		}
	}
	cout<<ret;
}

Measured memory_bytes: 7364
<?php

$input = explode(' ', rtrim(fgets(STDIN)));

$sx = (int) $input[0];
$sy = (int) $input[1];
$tx = (int) $input[2];
$ty = (int) $input[3];

// 1回目：往路
for ($index = $sx; $index < $tx; $index++) {
    echo 'R';
}

for ($index = $sy; $index < $ty; $index++) {
    echo 'U';
}

// 1回目：復路
for ($index = $tx; $index > $sx; $index--) {
    echo 'L';
}

for ($index = $ty; $index > $sy; $index--) {
    echo 'D';
}

// 2回目：往路
echo 'D';

for ($index = $sx; $index < $tx + 1; $index++) {
    echo 'R';
}

for ($index = $sy - 1; $index < $ty; $index++) {
    echo 'U';
}

echo 'L';

// 2回目：復路
echo 'U';

for ($index = $tx; $index > $sx - 1; $index--) {
    echo 'L';
}

for ($index = $ty + 1; $index > $sy; $index--) {
    echo 'D';
}

echo 'R';

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;

int main(){
 int a,b,c,x,y;
 cin>>a>>b>>c>>x>>y;
 int ans =INF;
 int simple =a*x+b*y;
 int x_cnt = x*2*c;
 if(y>x)x_cnt+=min(c*(y-x)*2,b*(y-x));
 ans = min(simple,x_cnt);
 int y_cnt = y*2*c;
 if(x>y)y_cnt+=min(c*(x-y)*2,a*(x-y));
 ans=min(ans,y_cnt);
 cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}

string S;


ll dfs(ll a,ll b,ll d){
if(d==S.size()){
 return a+b;
}

ll m=dfs(a+b,S[d]-'0',d+1);//上から順番に再起関数が動いてるため同時進行ではない
 
ll n;
  if(b>0){
n=dfs(a,b*10+S[d]-'0',d+1);
  }

  return m+n;
  //dfs(0,0,0)が終末点まで到達した時のdfsを出力してるわけではない
  //これで出力されるのはdfs(0,0,0)の数字
  //ゆえにll mに進んだ時の合計値とll nに進んだ時の合計値を足したものが答えになる
  //また最初のifの停止要件は下のll m、nが停止するための条件だと考えて良いかも
}

  
int main(){

  
 cin>>S;
  
  
  
  cout<<dfs(0,0,0)<<endl;
 
}

Measured memory_bytes: 256
/*raghav0307 - Raghav Gupta*/

#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long ll;

int main(){
	fast_io();
	int n, k;
	cin >> n >> k;
	string s;	cin >> s;
	for(int i = 0; i < n; i++){
		if(i != k-1){
			cout << s[i];
		}
		else{
			char c = s[i] - 'A' + 'a';
			cout << c;
		}
	}
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int n; char s[23333];
typedef pair<ll,ll> pll;
map<pll,int> sb;
int main()
{
	ll ans=0;
	scanf("%d%s",&n,s);
	for(int i=0;i<(1<<n);++i)
	{
		ll a=0,b=0;
		for(int j=0;j<n;++j)
			if(i&(1<<j)) a=a*233+s[j];
		for(int j=n-1;~j;--j)
			if(i&(1<<j));else b=b*233+s[j];
		++sb[mp(a,b)];
	}
	for(int i=0;i<(1<<n);++i)
	{
		ll a=0,b=0;
		for(int j=0;j<n;++j)
			if(i&(1<<j)) a=a*233+s[j+n];
		for(int j=n-1;~j;--j)
			if(i&(1<<j));else b=b*233+s[j+n];
		ans+=sb[mp(b,a)];
	}
	cout<<ans<<"\n";
}


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

const ll maxn=1e5+5, inf=0x3f3f3f3f3f3f3f3f;
ll n, a[maxn][3], dp[maxn][3];

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

    cin>>n;
    rep(i,0,n) rep(j,0,3) cin>>a[i][j];
    rep(j,0,3) dp[0][j] = a[0][j];
    rep(i,1,n) {
        rep(j,0,3) {
            rep(k,0,3) if(j!=k) dp[i][j]=max(dp[i][j], dp[i-1][k]+a[i][j]);
        }
    }
    cout<<*max_element(dp[n-1], dp[n-1]+3)<<"\n";
}


Measured memory_bytes: 4992
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    int n,d=1;
    while(cin>>n&&n!=0)
    {
        int **p,i,k=1,j;
        p=new int*[n];
        for(i=0;i<n;i++)
        {
            p[i]=new int[n];
        }
        for(i=0;i<=(2*n-2);i++)
        {
            if(i<=(n-1))
            {
                if(i%2==0)
                {
                    for(j=i;j>=0;j--)
                    {
                        p[j][i-j]=k++;
                    }
                }
                else
                {
                    for(j=i;j>=0;j--)
                    {
                        p[i-j][j]=k++;
                    }
                }
            }
            else
            {
                if(i%2==0)
                {
                    for(j=n-1;i-j<=(n-1);j--)
                    {
                        p[j][i-j]=k++;
                    }
                }
                else
                {
                    for(j=n-1;i-j<=(n-1);j--)
                    {
                        p[i-j][j]=k++;
                    }
                }
            }
        }
        cout<<"Case "<<d++<<':'<<endl;

        for(i=0;i<n;i++)
        {
            for(j=0;j<n;j++)
            {
                cout<<setw(3)<<p[i][j];
            }
            cout<<endl;
        }
    }
}

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

    class Program
    {
        static void Main(string[] args)
        {
            string[] strInputArray;
            List<int> inputList = new List<int>();
            string output = "";
            do
            {
                strInputArray = Console.ReadLine().Split(' ');
                if (!strInputArray[0].Equals("0") && !strInputArray[1].Equals("0"))
                {
                    inputList.Add(int.Parse(strInputArray[0]));
                    inputList.Add(int.Parse(strInputArray[1]));
                }
            } while (!strInputArray[0].Equals("0") && !strInputArray[1].Equals("0"));

            for (int i = 1; i <= (inputList.Count / 2); i++)
            {
                for (int h = 1; h <= inputList[(i * 2) - 2]; h++)
                {
                    output = "";

                    if (h == 1 || h == inputList[(i * 2) - 2])
                    {
                        for (int w = 1; w <= inputList[(i * 2) - 1]; w++)
                        {
                            output = output + '#';
                        }
                    }
                    else
                    {
                        for (int w = 1; w <= inputList[(i * 2) - 1]; w++)
                        {
                            if (w == 1 || w == inputList[(i * 2) - 1])
                            {
                                output = output + '#';
                            }
                            else
                            {
                                output = output + '.';
                            }
                        }
                    }
                    Console.WriteLine(output);
                }
                Console.WriteLine();
            }

            Console.ReadLine();
        }
    }


Measured memory_bytes: 17992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b)
{
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

/* a と b の最小公倍数を求める */
long long LCM(long long a, long long b)
{
    long long g = GCD(a, b);
    return a / g * b;
}

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

signed main()
{
    int X;
    cin >> X;
    int ans = 0;
    while (X >= 500)
    {
        X = X - 500;
        ans += 1000;
    }
    while (X >= 5)
    {
        X = X - 5;
        ans += 5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl;

#define INF 2000000000

bool isprime(int p) {
    double sqp = sqrt(p);
    for (int i = 2; i <= sqp + 1; i++) {
        if (p%i == 0)return false;
    }
    return true;
}

int main() {
    int N;
    cin >> N;
    for (int i = 11; i <= 55555; i += 5) {
        if (isprime(i) == true) {
            if (i != 11)cout << ' ';
            cout << i;
            N--;
        }
        if (N == 0) {
            cout << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------


int main() {
    LLI N,A,B;
    cin >> N >> A >> B;

    LLI ans = 1e18;
    if (!((B-A) & 1)) ans = min(ans,(B-A)/2);
    else {
        ans = min(ans,A+(B-A-1)/2);
        ans = min(ans,N-B+1+(B-A-1)/2);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1.0);
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	long double a,b;
	ll c;
	cin>>a>>b;
	b*=1000;
	c=(a*b)/1000;
	///ll x=15*5/3;
	//c/=100;
	cout<<c<<endl;
	///cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 3724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.stream.Stream;

public class Main {
    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static PrintWriter pw = new PrintWriter(System.out);
    public static void main(String[] args) throws IOException {
        int[] input1 = arrayOfInt();
        int N = input1[0];
        int T = input1[1];

        int cost = 1001;
        for(int i = 0;i < N;i++){
            int[] input = arrayOfInt();
            int c = input[0];
            int t = input[1];
            if(t <= T){
                if(c <= cost){
                    cost = c;
                }
            }
        }
        if(cost == 1001){
            println("TLE");
        }else {
            println(cost);
        }
        // 解答ここから
//        int N = nextInt();
//        int[] X = arrayOfInt();
//        int[] x = X.clone();
//        Arrays.sort(x);
//        // 中央値の境界を取る
//        int floor = N/2 - 1;
//        int border = x[floor];
//
//        int a = x[floor + 1];
//        int b = x[floor];
//        for(int i = 0;i < N;i++){
//            if(X[i] <= border){
//                println(a);
//            }else{
//                println(b);
//            }
//        }

        //解答ここまで
        pw.flush();
        return;
    }
    // 入力受け取り
    static String next() throws IOException {return br.readLine();}
    static int nextInt() throws IOException{return getInt(br.readLine());}
    static long nextLong() throws IOException{return getLong(br.readLine());}
    static String[] arrayOfString() throws IOException{return br.readLine().split(" ");}
    static int[] arrayOfInt() throws IOException{return toIntArray(arrayOfString());}
    // 変換
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {return Integer.parseInt(val);}
    static int[] toIntArray(String[] array) {return Stream.of(array.clone()).mapToInt(Integer::parseInt).toArray();}
    static String joinToString(String[] array) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0;i < array.length;i++) sb.append(array[i]);
        return sb.toString();
    }

    // 出力
    static void println(Object val){pw.println(val);}
}


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

using namespace std;

int main(void) {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if((A+B) > (C+D)) {
        cout << "Left\n";
    } else if((A+B) < (C+D)) {
        cout << "Right\n";
    } else {
        cout << "Balanced\n";
    }
}

Measured memory_bytes: 384
#include <iostream>


int main (){
    
    int A, B, C, K;
    std::cin >> A >> B >> C >> K;

    if (K <= A){
        std::cout << K << std::endl;
    }
    else if (K <= A + B){
        std::cout << A << std::endl;
    }
    else{
        std::cout << A - (K - A - B) << std::endl;
    }


}


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

using namespace std;

#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i);

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

    int n, a[3 * 100001];
    cin >> n;
    for (size_t i = 0; i < n * 3; ++i) {
        cin >> a[i];
    }
    sort(a, a + n * 3, greater<int>());

    llong ans = 0;
    for (size_t i = 0; i < n; ++i) {
        ans += a[2 * i + 1];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(__,v.size()){rep(_,v[__].size())cout<<" "<<v[__][_];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int gcd(int a,int b){
	if(!b)return a;
	return gcd(b,a%b);
}
signed main(){
	int n;
	cin>>n;
	int MOD=998244353;
	vi in(n);
	rep(i,n)cin>>in[i];
	sort(all(in));
	int out=1;
	rep(i,n)(out*=gcd(in[i],i))%=MOD;
	cout<<out<<endl;
}


















Measured memory_bytes: 1024
N = int(input())
M = int(input())
*A, = map(int, input().split())
sc = [0]*N
for i in range(M):
    *B, = map(int, input().split())
    for j in range(N):
        if A[i] == B[j]:
            sc[j] += 1
        else:
            sc[A[i]-1] += 1
*_,=map(print, sc)

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 200007;

int n,loc[_],nex[_]={0};

int main()
{
	n=ty();
	for(int i=1;i<=n;i++)loc[ty()]=i;

	lint ans=0;
	for(int i=n;i>=1;i--)
	{
		int x=loc[i],l=nex[x-1],r=nex[x+1];
		if(!l)l=x;
		if(!r)r=x;
		ans+=1ll*i*(x-l+1)*(r-x+1),nex[l]=r,nex[r]=l;
	}
	
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>

int main() {
  int H, W, Ch, Cw, Dh, Dw;
  std::cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
  std::vector<std::string> S(H + 4, std::string(W + 4, '#'));
  for (int i = 2; i < H + 2; ++i) {
    std::cin >> S[i];
    S[i] = "##" + S[i] + "##";
  }
  const std::vector<std::tuple<int, int>> adjacent = {
    {-1, 0}, {1, 0}, {0, -1}, {0, 1},
  };
  std::vector<std::vector<int>> distances(H + 4, std::vector<int>(W + 4, -1));
  std::priority_queue<std::tuple<int, int, int>> queue;
  queue.emplace(0, Ch + 1, Cw + 1);
  while (!queue.empty()) {
    const auto [d, y, x] = queue.top();
    const auto dist = -d;
    queue.pop();
    if (distances[y][x] >= 0 && distances[y][x] < dist) continue;
    distances[y][x] = dist;
    for (const auto [dx, dy] : adjacent) {
      const auto y1 = y + dy;
      const auto x1 = x + dx;
      if (S[y1][x1] == '.' && distances[y1][x1] < 0) {
        distances[y1][x1] = dist;
        queue.emplace(-dist, y1, x1);
      }
    }
    for (int dy = -2; dy <= 2; ++dy) {
      for (int dx = -2; dx <= 2; ++dx) {
        const auto y1 = y + dy;
        const auto x1 = x + dx;
        if (S[y1][x1] == '.' && distances[y1][x1] < 0) {
          queue.emplace(-dist - 1, y1, x1);
        }
      }
    }
  }
  std::cout << distances[Dh + 1][Dw + 1] << std::endl;
  return 0;
}


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

template <typename t>
void mi(t& a, const t& b) { a = min(a, b); }

template <typename t>
void ma(t& a, const t& b) { a = max(a, b); }

constexpr int g1 = 1000 * 1000 * 1000, si = 1024 * 1024, si_log = 10 + 10, mod = static_cast<int>(1e9) + 7;
constexpr long double eps = 1.0e-9;
int n, ar[si], br[si];
char car[si];
vector<int> gr[si];

int64_t sol()
{
  auto r = 0 * numeric_limits<int64_t>::max();

  for (int i = 1; i <= n; ++i)
  {
  }

  return r;
}

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

  while (1 == scanf("%12345s", car))
  {
    n = (int)strlen(car);
    int s = 0, cnt = 1, c = car[0];
    for (int i = 1; i < n; ++i)
    {
      if (c == car[i])
      {
        if (3 <= ++cnt)
          s = 1;
      }
      else
      {
        cnt = 1;
        c = car[i];
      }
    }
    //auto s = 
//    sol();
    puts(s ? "Yes" : "No");
    //cout << s << '\n';
#ifndef _DEBUG
    break;
#else
    for (int i = 0; i <= n + 2; i++)
    {
      gr[i].clear();
    }
    memset(car, 0, sizeof car);
    memset(ar, 0, sizeof ar);
    memset(br, 0, sizeof br);
#endif
  }
  return 0;
}


Measured memory_bytes: 26880
N=int(input())
a=True 
while a:  
  for i in range(1,10):
    for j in range(1,10):
      if N==i*j:
          print("Yes")
          break
    if N==i*j:
      break
  if N==i*j:
    break
  print("No")
  a=False

Measured memory_bytes: 2940
p=1;
n=gets.to_i;
n.times{|i|p*=i+1}
d=[0]*1e5;
d[1]=1;
(2..n).map{|i|
	c=0;
	(p/=i;c+=1)while p%i<1;
	(1..75).map{|k|c.times{|j|d[(76-k).*j+2]+=d[76-k]}}
}
p d[75]

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

int main() {
    int A, B, C;
    std::cin >> A;
    std::cin >> B;
    C = A - 2*B;
    if(C < 0)
    {
        std::cout << 0 << std::endl;
    }
    else
    {
        std::cout << C << std::endl;
    }
}

Measured memory_bytes: 256
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef std::vector<int> VI;
typedef std::pair<int,int> PI;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

int n=97;

void print(char c,int i,int j,int k)
{
    printf("%c %d %d %d\n",c,i,j,k);
}

void a(int i) {print('+',i,i,i+1);}

void f(int x,int i,int j)
{
    for(int q=0;q<30;q++)
    {
        a(j+q-1);
        print('+',j+q,n,j+q);
        for(int s=j+q;s<j+29;s++)
            a(s);
        print('<',j+29,x,i+q);
        a(j+q-1);
        print('+',j+q,i+q,j+q);
    }
}

int main()
{
    puts("3933");
    print('+',0,1,n);
    print('<',2,n,n);
    print('+',0,n,3);
    print('+',1,n,4);
    f(3,5,36); f(4,36,67);
    for(int i=0;i<59;i++)
    {
        print('+',2,2,2);
        for(int j=0;j<=i;j++)
            if(i-30<j && j<30)
            {
                print('+',5+i-j,36+j,98);
                print('<',n,98,99);
                print('+',2,99,2);
            }
    }

    return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>

int main(void){
  int N,i,tmp,sum=0;
  int p[10];
  
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&p[i]);
    if(p[i]<p[i-1]){
      tmp=p[i];
      p[i]=p[i-1];
      p[i-1]=tmp;
    }
  }
  
  p[N-1]=p[N-1]/2;
  
  for(i=0;i<N;i++){
    sum+=p[i];
  }
  
  printf("%d",sum);
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define LL long long 
#define LD long double
const int X[4]={0,0,1,-1};
const int Y[4]={1,-1,0,0};
char p[25][25];
int n,m,vis[25][25],ans,dis[25][25];
void spfa(int nowx,int nowy)
{
	queue<int>qx,qy;
	memset(dis,0x3f,sizeof(dis));
	qx.push(nowx);qy.push(nowy);
	dis[nowx][nowy]=0;
	while(!qx.empty())
	{
		int x=qx.front(),y=qy.front();
		qx.pop();qy.pop();
		for(int t=0;t<4;t++)
		{
			int nx=X[t]+x,ny=Y[t]+y;
			if(nx<1||nx>n||ny<1||ny>m||dis[nx][ny]!=0x3f3f3f3f)continue;
			if(p[nx][ny]=='.')
			{
				dis[nx][ny]=dis[x][y]+1;
				ans=max(dis[nx][ny],ans);
				qx.push(nx);
				qy.push(ny);
			}
		}	
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		cin>>(p[i]+1);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(p[i][j]=='#')continue;
			spfa(i,j);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main()
{
    IO;

    ll N; cin >> N;
    vl a(N);
    rep(i, N) cin >> a[i];

    ll ans = 0;

    rep(i, N) {
        if (a[i] % 2 == 0) {
            while (1) {
                ++ans;
                a[i] /= 2;
                if (a[i] % 2 != 0) break;
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3300
N = int(input())
L = list(map(int, input().split()))
L.sort()
count = 0
for i in range(N):
    a = L[i]
    k = i+2
    for j in range(i+1,N):
        b = L[j]
        while k < N and a+b > L[k]:
            k += 1
        count += k - 1 - j
print(count)






Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

ll n, m, k;
vector<ll> a, b;

bool cond(ll x){
	ll t = 0;
	int i = 0;
	for(; i < min(x, n); i++){
		t += a[i];
	}
	i--;
	int j = 0;
	if(x > n){
		for(; j < x - n; j++){
			t += b[j];
		}
	}

	if(t <= k) return true;
	while(i >= 0 && j < m){
		t -= a[i];
		i--;
		t += b[j];
		j++;
		if(t <= k) return true;
	}

	return false;
}

// condを満たす最大のxを求める(upper_bound)
// 全てのxが条件を満たさない場合は-1を返す(-1はとりえない値)
ll upper_bound_cond(){
	int lb = -1, ub = n + m + 1;

	while(ub - lb > 1){
		int mid = (lb + ub) / 2;

		bool ok = cond(mid);
		// cout << mid << "," << ok << endl;
		if(ok) lb = mid;   // Answer is in [mid, ub)
		else ub = mid;            // Answer is in [lb, mid)
	}

	// now lb + 1 = ub
	return lb;
}

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

	cin >> n >> m >> k;
	a.resize(n);
	b.resize(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];

	cout << upper_bound_cond() << endl;
}


Measured memory_bytes: 6364
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()
u=input().rstrip()
ans=""
for i in range(len(u)):
    if u[i]=="B":
        if ans!="":
            x=ans
            ans=""
            for j in range(len(x)-1):
                ans+=x[j]
    else:
        ans+=u[i]
    #print(ans)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b,c,e=1,w,q;
  cin>>a>>b;
  c=max(a,b);
  for(int i=1;i<=c;i++){
    q=a;
    w=b;
    q=q-i;
    w=w-i;
    if(q<0){
      q=0-q;
    }
    if(w<0){
      w=0-w;
    }
    if(q==w){
      cout<<i<<"\n";
      e=0;
      break;
    }
  }
  if(e==1){
    cout<<"IMPOSSIBLE\n";
  }
  return(0);
}


Measured memory_bytes: 256
import sys
from collections import Counter

sys.setrecursionlimit(2502)


def paint(field, i, j, b, f, moves={(-1, 0), (1, 0), (0, 1), (0, -1)}):
    fij = field[i][j]
    if fij & f:
        return
    if fij & 4 and not fij & b:
        return
    field[i][j] |= b | f
    for di, dj in moves:
        ni = i + di
        nj = j + dj
        if nj < 0 or w <= nj or ni < 0 or h <= ni:
            continue
        paint(field, ni, nj, b, f)


buf = []
chardict = {'.': 0, 'W': 5, 'B': 6}
while True:
    w, h = map(int, input().split())
    if w == 0:
        break
    field = [[chardict[c] for c in input()] for _ in range(h)]
    for i in range(h):
        for j in range(w):
            fij = field[i][j]
            if fij & 4 and not fij & 24:
                paint(field, i, j, fij & 3, (fij & 3) << 3)
    result = Counter(b & 7 for row in field for b in row)
    print(result[2], result[1])

Measured memory_bytes: 10804
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    string a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    rep(i,n){
        int s[30] = {};
        s[a[i]-'a']++;
        s[b[i]-'a']++;
            s[c[i]-'a']++;
        int mx = 0;
        rep(i,30){
            mx = max(mx,s[i]);
        }
        ans += 3-mx;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll factorial(ll n, ll mod){
  if(n==0) return 0;
  ll ret = 1;
  for(ll i=1;i<=n;i++){
    ret = (ret * i) % mod;
  }
  return ret;
}
int main()
{
  ll X, Y;
  ll res=0;
  cin >> X >> Y;

  ll n=0 ,m=0;
  for(ll i=0;i<=X/2;i++){
    ll j = X - 2*i;
    if( Y == (2*j + i) ) {
      n = i; m = j;
      break;
    }
  }
  if(n+m==0) res = 0;
  else if(n==0 || m ==0) res = 1;
  else {
    res = factorial(n+m, MOD);
    res = (res * modinv(factorial(n, MOD), MOD)) % MOD;
    res = (res * modinv(factorial(m, MOD), MOD)) % MOD;
  }
  cout << res << endl;
}


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

int main(){

    int A,B,H,M;
    cin >> A >> B >> H >> M;

    long double M_rad = (M_PI / 30) * M;
    long double H_rad = (M_PI / 6) * H + M_rad / 12;
    long double theta = abs(M_rad - H_rad);

    long double res = (A*A) + (B*B) - (2*A*B*cos(theta));
    res = sqrt(res);

    cout << fixed << setprecision(20) << res;
    return 0;
}

Measured memory_bytes: 4084
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split(" ").map(Number);
var sum=0;
var m=[1,5,10,50,100,500];
Arr.forEach(function(v,i){
sum+=m[i]*v;
});

console.log(sum>=1000?1:0);

Measured memory_bytes: 7384
import java.awt.Robot;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ======================================================================
    public void solve() {
    	String S = ns();
    	String T = ns();
    	int A = ni();
    	int B = ni();
    	String U = ns();
    	if(U.equals(S))			out.println((A-1) + " " + B);
    	else if(U.equals(T))	out.println(A + " " + (B-1));
    	else					out.println(A + " " + B);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}

//INSERT ABOVE HERE
signed main(){
  Int a,b,k;
  cin>>a>>b>>k;
  for(Int i=0;i<k;i++){
    if(~i&1){
      if(a&1) a--;
      a/=2;
      b+=a;
    }else{
      if(b&1) b--;
      b/=2;
      a+=b;
    }
  }
  cout<<a<<" "<<b<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pii pair<ll,ll>
#define pll pair<long long, long long >
#define ll long long
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define maxn 100000
#define mod 1000000007
#define endl '\n'
#define trace(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;

ll dir8[2][8] = {{1,-1,0,0,1,-1,1,-1},{0,0,1,-1,1,-1,-1,1}};
ll dir4[2][4] = {{1,-1,0,0},{0,0,1,-1}};
ll m,n,row,col;
ll g[17][17];
ll cost[(1<<17)];
ll dp[(1<<17)];
vector <ll> v;
void solve()
{
  cin >> n;
  for(ll w=0;w<n;w++)
  {
    for(ll q=0;q<n;q++)cin >> g[w][q];
  }
  for(ll i=0;i<(1<<n);i++)
  {
    v.clear();
    for(ll w=0;w<n;w++)
    {
      if(i & (1<<w))v.pb(w);
    }
    for(ll w=0;w<(ll)v.size()-1;w++)
    {
      for(ll q=w+1;q<(ll)v.size();q++)
      {
        cost[i] += g[v[w]][v[q]];
      }
    }
  }
  ll finCost= 0;
  ll cs = 0;
  for(ll i=0;i<(1<<n);i++)
  {
    for(ll q=i;q>0;q = (q-1)&i)
    {
      dp[i] = max(dp[i], dp[i^q] + cost[q]);
    }
  }
  cout << dp[(1<<n)-1] << endl;

}
void test()
{
  ll t;
  //scanf("%d",&t);
  t= 1;
  for(ll test=1;test<=t;test++)
  {
    solve();
  }
}
int main()
{
  test();
  return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	if(a!=b)
		ans++;
	if(b!=c)
		ans++;
	if(a!=c)
		ans++;
	if(a==b&&b==c)
	{
		ans=1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import numpy as np

NAB=np.array(input().split(" "),dtype=np.int64)

N=NAB[0]
A=NAB[1]
B=NAB[2]

div=int(N//(A+B))
mod=N%(A+B)

blue=0
if(mod<=A):
    blue=mod
else:
    blue=A

print(A*div+blue)

Measured memory_bytes: 21392
#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
typedef long long ll;
ll n, m, x,sum = 0, ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMint() {
    fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k) {
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll PER(int n, int k) {
    return (fac[n] * finv[n - k]) % MOD;
}
int main(void) {
    COMint();cin >> n >> m;
    rep(i, n + 1) {
        x = (PER(m - i, n - i) * PER(m - i, n - i)) % MOD;
        sum = (COM(n, i) * PER(m, i)) % MOD;
        sum = (sum * x) % MOD;
        if (i % 2 == 0) ans += sum,ans %= MOD;
        else ans = (ans - sum + MOD) % MOD;
    }cout << ans << endl;
}

Measured memory_bytes: 15588
#include <bits/stdc++.h> 
    #include<ext/pb_ds/assoc_container.hpp> 
    #include<ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
     int mn=1e9+7;
    int cnt=0;
    vector<pair<int ,int >> v1,v2;  
    signed main() {
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("INPUT.txt", "r", stdin);
    // for writing output to output.txt
    freopen("OUTPUT.txt", "w", stdout);
    #endif
 
    // -------------------------------------Code starts here--------------------------------------------------------------------- 

   int r;
   cin>>r;
   long double a=2*3.1415926535*r;
   cout<<a<<endl;
}

Measured memory_bytes: 3804
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[210000];
int c[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a*2-1;i++){scanf("%d",b+i);b[i]--;}
	int left=-1;
	int right=a*2-1;
	while(left+1<right){
		int M=(left+right)/2;
		for(int i=0;i<a*2-1;i++){
			if(b[i]<=M)c[i]=1;
			else c[i]=0;
		}
	//	printf("%d: ",M);
	//	for(int i=0;i<a*2-1;i++)printf("%d ",c[i]);
		int res=0;
		if(c[a-1]==c[a-2]||c[a-1]==c[a]){
			res=c[a-1];
		}else{
			int ld=0;
			int lc=-1;
			for(int i=a-1;i>0;i--){
				if(c[i]==c[i-1]){
					lc=c[i];
					break;
				}
				ld++;
			}
			if(lc==-1)ld=99999999;
			int rd=0;
			int rc=-1;
			for(int i=a-1;i<a*2-2;i++){
				if(c[i]==c[i+1]){
					rc=c[i];
					break;
				}
				rd++;
			}
			if(rc==-1)rd=99999999;
			if(~lc&&ld<rd)res=lc;
			else if(~rc&&rd<ld)res=rc;
			else if(lc+rc==-2){
				res=c[a-1]^((1+a)%2);
			}else res=rc;
		}
	//	printf(": %d\n",res);
		if(res==0)left=M;
		else right=M;
	}
	printf("%d\n",right+1);
}

Measured memory_bytes: 1664
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>

using namespace std;

class arcC {
public:
    void solve(istream& in, ostream& out) {
        int N, M;
        in >> N >> M;
        vector<vector<int>> g(N);
        for (int i = 0; i < M; ++i) {
            int a, b;
            in >> a >> b;
            g[a - 1].push_back(b - 1);
            g[b - 1].push_back(a - 1);
        }
        
        vector<int> v(N, 0);
        for (int u : g[0]) {
            ++v[u];
        }
        for (int u : g[N-1]) {
            ++v[u];
        }
        for (int x : v) {
            if (x == 2) {
                out << "POSSIBLE\n";
                return;
            }
        }
        out << "IMPOSSIBLE\n";
    }
};


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

	arcC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 12784
import sys

#+++++
		
def main():
	x,y = map(int, input().split())
	g1=[1,3,5,7,8,10,12]
	g2=[4,6,9,11]
	g3=[2]
	gll=[g1,g2,g3]
	for g in gll:
		if x in g and y in g:
			return 'Yes'
	return 'No'
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064
#include<stdio.h>

int partition(int [], int, int);

int main(){
  int A[100000], i, q, n;

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);

  q = partition(A, 0, n - 1);

  for(i = 0; i < n; i++){
    if(i != 0)             printf(" ");
    if(i == q)    printf("[");
    printf("%d", A[i]);
    if(i == q)    printf("]");
  }
  printf("\n");

  return 0;
}

int partition(int A[], int p, int r){
  int x, i, j, temp;

  x = A[r];
  i = p - 1;

  for(j = p; j < r; j++){
    if(A[j] <= x){
      i = i + 1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  temp = A[i + 1];
  A[i + 1] = A[r];
  A[r] = temp;

  return i + 1;
}

Measured memory_bytes: 996
def main():
    n = int(input())
    rob = []
    for i in range(n):
        rob.append(list(map(int, input().split())))

    x = []
    for i in range(n):
        x.append([rob[i][0] - rob[i][1], rob[i][0] + rob[i][1]])

    x = sorted(x, key=lambda y:y[1])

    x_now = x[0][0]
    count = 0
    j = 0

    while j < n:
        for i in range(j, n):
            if x_now <= x[i][0]:
                x_now = x[i][1]
                count += 1
                j = i
                break
            else:
                j += 1

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 43560
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n , k;
	cin>>n>>k;
	int arr[n+1] , t[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	t[1]=0;
	for(int i=2;i<=n;i++)
	{
		t[i]=INT_MAX;
		for(int j=i-1;j>=max(1 , i-k);j--)
	       t[i]=min(t[i] , abs(arr[i]-arr[j]) + t[j]);
    } 
	cout<<t[n]<<endl;
}

Measured memory_bytes: 1024
#include <iostream>


using namespace std;

int main()
{
  string x;
  cin>>x;
   string Sunny,Cloudy,Rainy;
   if(x== "Sunny" )
   {
       cout<<"Cloudy"<<endl;
   }
    else if(x== "Cloudy" )
    {
        cout<<"Rainy"<<endl;
    }
   else if(x== "Rainy" ){
        cout<<"Sunny"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3568
n=int(input())
l=[int(i) for i in input().split()]
l1=[]
c=0
l1.append(l[0])
for i in range(1,n):
  l1.append(min(l1[i-1],l[i]))
for i in range(n):
  if(l[i]==l1[i]):
    c+=1
print(c)

Measured memory_bytes: 25768