akhauriyash/Code-Regression huggingface dataset:
from math import ceil

d, g = [int(x) for x in input().split()]

c_list = []
ans = 0
for i in range(d):
    p, c = [int(x) for x in input().split()]
    c_list.append((100 * (i + 1) * p + c, p))
    ans += p
c_list = list(reversed(c_list))

for i in range(2 ** d):
    s = 0
    temp_ans = 0
    flag = True
    for j in range(d):
        temp = (i >> j) & 1
        if temp == 1:
            s += c_list[j][0]
            temp_ans += c_list[j][1]
            if s >= g:
                break
        elif flag:
            k = j
            flag = False
    else:
        temp_s = (d - k) * 100
        temp = ceil((g - s) / temp_s)
        if  temp < c_list[k][1]:
            s += temp_s * temp
            temp_ans += temp
    if s >= g and temp_ans < ans:
        ans = temp_ans
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next(),ans="1";
		long n=sc.nextLong();
		for(int i=0;i<n;i++) {
			if(!s.substring(i, i+1).equals("1")) {
				ans=s.substring(i,i+1);
				break;
			}
		}
		System.out.println(ans);
	}
}


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

int N,L;
string arr[100];
int main(){
  cin >> N >> L;
  for (int i=0;i<N;i++){
    cin >> arr[i];
  }
  sort(arr,arr+N);
  string s;
  for (int i=0;i<N;i++){
    s += arr[i];
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    long int a,b,c[1024]={0},i,j;
	
	scanf("%ld\n",&a);
	do{
	    i=0;
        if(a>=0&&a<=3){
            printf("%ld\n",a);
        }
	    else if (a!=-1){
            b=a;
		    do{
                a=b%4;
                b/=4;
			    c[i++]=a;
			//printf("%d",a);
		    }while(b>3);
		if(b!=0)
		    c[i]=b;
		for(j=i;j>=0;j--){
			printf("%ld",c[j]);
		}
		printf("\n");
	}
	else{
		break;
	}
	scanf("%ld\n",&a);
	}while(1);
	return 0;
}

Measured memory_bytes: 1044
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()

c = Counter(S)
if len(c) == 2:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 68684
#include<stdio.h>
#include<math.h>
int main()
{
	int n,i;
	int a[1000],b[1000],c[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	for(i=0;i<n;i++){
		if((c[i]*c[i])==(a[i]*a[i]+b[i]*b[i])||(a[i]*a[i])==(b[i]*b[i]+c[i]*c[i])||(b[i]*b[i])==(a[i]*a[i]+c[i]*c[i])){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2488
from math import gcd

K = int(input())

sum_ = 0

for i in range(1, K + 1):
    for j in range(1, K + 1):
        g1 = gcd(i, j)
        for k in range(1, K + 1):
            sum_ += gcd(g1, k)

print(sum_)



Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<ll, ll>;
template<class T> inline bool chmax(T& a, T b) {if (a < b){a = b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b) {if (a > b){a = b;return 1;}return 0;}
const long long LLINF = 1LL << 60;
using namespace std;

ll dp[1010101];

int main()
{
    int N;
    cin >> N;
    fill(dp, dp+N+1, LLINF);
    dp[1] = dp[6] = dp[9] = 1;

    {
        ll b = 6;
        for (;b<=N;b*=6) dp[b] = 1;
    }
    {
        ll b = 9;
        for (;b<=N;b*=9) dp[b] = 1;
    }

    for (int i=1; i<=N; ++i)
    {
        dp[i+1] = min(dp[i+1], dp[i] + 1);

        ll b = 6;
        for (;i+b<=N;)
        {
            dp[i+b] = min(dp[i+b], dp[i] + 1);
            b *= 6;
        }

        b = 9;
        for (;i+b<=N;)
        {
            dp[i+b] = min(dp[i+b], dp[i] + 1);
            b *= 9;
        }
    }
    cout << dp[N] << endl;
}


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

int N,M;
int data[1001];
int data2[1002001];

int main(){
	int i,j;
	int d2cor,mcor = 0;
	int max[1000] = {0};
	while(1){
		d2cor = 1;
		max[mcor] = 0;
		cin >> N >> M;
		if(N == 0 && M == 0)
			break;
		for(i = 1;i <= N;i++){
			cin >> data[i];
		}
		for(i = 0;i <= N;i++){
			for(j = i;j <= N;j++){
				data2[d2cor] = data[i]+data[j];
				d2cor++;
			}
		}
		sort(data2,data2+d2cor);
		//探索(O(NN)*O(log(NN))
		int start,last,medi;
		for(i = 0;i < d2cor;i++){
			if(data2[i] > M)
				break;
			start = 0;
			last = d2cor-1;
			while(data2[start] < data2[last]){
				medi = (start+last)/2;
				//下
				if(data2[i]+data2[medi] > M){
					last = medi-1;
				}
				//同じか上(無限ループしないように工夫.medi要素を除く工夫をする)
				else{
					//一つ上がオーバーなら、そのひとつ前に確定
					if(data2[i]+data2[medi+1] > M){
						start = medi;
						break;
					}
					//オーバーしてなければこれ以上が最大
					start = medi+1;
				}
			}
			if(max[mcor] < data2[i]+data2[start])
				max[mcor] = data2[i]+data2[start];
		}
		mcor++;
	}
	for(i = 0;i < mcor;i++){
		cout << max[i] << endl;
	}
	return 0;
}

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

#define int long long

const int mod=1000000007,N=100005;

bool in[N];
int vis[N],a[N],du[N],len[N],num[N],f[N];

signed main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	ios::sync_with_stdio(false);
	int n,ans=1;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
	//	cin>>a[i];
		scanf("%lld",&a[i]);
		du[a[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			int p=i;
			while(!vis[p])
			{
				vis[p]=i;
				p=a[p];
			}
			if(vis[p]==i)
			{
				while(!in[p])
				{
					in[p]=true;
					p=a[p];
				}
			}
		}
	}
//	return 0;
	for(int i=1;i<=n;i++)
	{
		//	cout<<"W "<<i<<" "<<p<<endl;
		if(du[i]==0)
		{
			int p=i,res=0;
			while(!in[p])
			{
				++res;
				p=a[p];
			//	if(res>100000) break;
			}
			//cout<<"N "<<p<<" "<<in[11]<<endl;
			len[p]=res;
		}
	}
//	return 0;
	for(int i=1;i<=n;i++)
	{
		if((in[i]&&du[i]>2)||(in[i]==false&&du[i]>1))
		{
			cout<<0;
			return 0;
		}
	}
//	return 0;
	for(int i=1;i<=n;i++)
	{
		if(in[i])
		{
			int p=i,res=0,pos=0,sum;
			while(in[p])
			{
				++res;
				if(len[p])
				{
					if(!pos) 
					{
						pos=p;
						sum=res;
					}
					else 
					{
				//		cout<<"P "<<p<<" "<<len[p]<<" "<<res<<endl;
						if(res>len[p]) ans=ans*2%mod;
						else if(res<len[p]) ans=0;
					}
					res=0;
				}
				in[p]=false;
				p=a[p];
			}
			if(pos)
			{
				res+=sum;
			//	cout<<"Q "<<pos<<" "<<len[pos]<<" "<<res<<endl;
				if(res>len[pos]) ans=ans*2%mod;
				else if(res<len[pos]) ans=0;
			}
			else num[res]++;
		}
	}
//	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
	{
		if(num[i])
		{
			f[0]=1;
			for(int j=1;j<=num[i];j++)
			{
				if(i%2==1&&i!=1) f[j]=f[j-1]*2%mod;
				else f[j]=f[j-1];
				if(j-2>=0) f[j]=(f[j]+(j-1)*i%mod*f[j-2]%mod)%mod;
			}
		//	cout<<i<<" "<<f[num[i]]<<endl;
			ans=ans*f[num[i]]%mod;
		}
	}
	cout<<ans;
	return 0;
}


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

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

const int MAX { 200010 };
const int oo { 1000000007 };

int solve(int, const vector<int>& xs)
{
    int ans = oo;

    for (int P = 1; P <= 100; ++P)
    {
        int sum = 0;

        for (auto x : xs)
            sum += (x - P)*(x - P);

        ans = min(sum, ans);
    }
 
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll cnt = 0;
  for(int i = 1; i < n; i++){
    if(a[i] < a[i - 1]){
      cnt += a[i - 1] - a[i];
      a[i] = a[i - 1];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 4744
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>


using namespace std;

int main(int argc, char *argv[]){

  int N;
  cin >> N;
  vector<int> D(N);
  for(int i = 0; i < N; i++){
    cin >> D[i];
  }
  int M;
  cin >> M;
  vector<int> T(M);


  // sort し効率良く探す。
  sort(D.begin(), D.end());
  for(int i = 0; i < M; i++){
    cin >> T[i];
  }
  sort(T.begin(), T.end());
  int dcounter = 0;
  int tcounter = 0;
  while(dcounter < N && tcounter < M){
    if(D[dcounter] == T[tcounter]){
      dcounter++;
      tcounter++;
    }else{
      dcounter++;
    }
    if((N-dcounter) < (M-tcounter))
      goto NO;
  }

  cout << "YES" << endl;
  return 0;

  NO:
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimze("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll inf=1e18, N=100005;
ll dp[105][100005];
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (1LL*x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	if(base==0)return 0;
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base); 
		expo>>=1;
	}
	return ans;
}
void solve(){
	rep(i,0,105)
		rep(j,0,100005)dp[i][j]=inf;
	dp[0][0]=0;
	ll n, k, ans=inf;
	cin>>n>>k;
	vector<ll> a(n+1), b(n+1);
	rep(i,1,n+1){
		cin>>a[i]>>b[i];
		rep(j,0,100005){
			dp[i][j]=min(dp[i][j],dp[i-1][j]);
			if(j>=b[i]){
				dp[i][j]=min(dp[i-1][j-b[i]]+a[i],dp[i][j]);
			}
		}
	}
	rep(j,0,100005)
		if(dp[n][j]<=k)ans=j;
	cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 82432
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DRemainderReminder solver = new DRemainderReminder();
        solver.solve(1, in, out);
        out.close();
    }

    static class DRemainderReminder {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            long res = 0;
            for (int i = k + 1; i <= n; i++) {
                res += (n + 1) / i * (i - k) + Math.max((n + 1) % i - k, 0);
                if (k == 0) {
                    res--;
                }
            }

            out.println(res);
        }

    }
}



Measured memory_bytes: 22612
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: str, T: str):
    ret = ''
    for i in range(N):
        ret += S[i] + T[i]
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(N, S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)



int main() {

	int n;
	cin >> n;
	if (n <= 999) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ABD" << endl;
	}


	return 0;
}



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

int main(){
	const int INF=1000000000;
	int n,c;
	int dp[2][5000+2][2];
	for(int i=0;i<2;i++)for(int j=0;j<5002;j++){dp[i][j][0]=INF; dp[i][j][1]=INF;}
	dp[1][1][0]=0;
	dp[1][0][1]=0;
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		int s=i%2,t=1-s;
		scanf("%d",&c);
		int m=min(i,n/2);
		for(int j=0;j<=m;j++){
			if(j==0)dp[s][j][0]=INF;
			else dp[s][j][0]=min(dp[t][j-1][0],dp[t][j-1][1]+c);
			dp[s][j][1]=min(dp[t][j][0]+c,dp[t][j][1]);
		}
	}
	printf("%d\n",min(dp[0][n/2][0],dp[0][n/2][1]));
}

Measured memory_bytes: 1252
/*

                                  In the name of Allah, Most Gracious, Most Merciful


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

//*** constant value ***
const long double PI = 3.141592653589793238;
const double EPS = 1e-6 ;
//*** constant value ***

//****** define ********
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define dd double
#define vll vector<ll>
#define vs vector<string>
#define fn(i,n) for(ll i = 0; i<n; i++)
#define f(i,a,b) for(i=a;i<b;i++)
#define f1(i,a,b) for(i=b-1;i>=a;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define vpl vector<pll>
#define pb push_back
#define mk make_pair
#define x first
#define y second
#define tt cout<<"Came here"<<endl;
//****** define ********

int main()
{
    IOS;
    ll n,d,ans = 0,x1,y1;
    cin>>n>>d;
    fn(i,n)
    {
        cin>>x1>>y1;
        if(pow(d,2.0) >= (pow(x1,2.0)+pow(y1,2.0)))
            ans++;
    }

    cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 3616
import java.util.Arrays;
import java.util.Scanner;

//Selecting Teams Advanced to Regional
public class Main{

	class R implements Comparable<R>{
		int i,u,a,p;
		public R(int i, int u, int a, int p) {
			this.i = i;
			this.u = u;
			this.a = a;
			this.p = p;
		}
		public int compareTo(R o) {
			return a!=o.a?o.a-a:p!=o.p?p-o.p:i-o.i;
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			R[] r = new R[n];
			for(int i=0;i<n;i++)r[i]=new R(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
			int[] u = new int[1001];
			Arrays.sort(r);
			int s = 0;
			for(R t:r){
				if(s<10&&u[t.u]<3 || s<20&&u[t.u]<2 || s<26&&u[t.u]==0){
					u[t.u]++;
					System.out.println(t.i);
					s++;
				}
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
package main

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

const mod = 1000000007
const facNum = 300001

func main() {
	sc := newScanner(os.Stdin)
	X, Y := sc.i(), sc.i()
	for i := 0; i < X+1; i++ {
		if Y == i*2+(X-i)*4 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


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

int main(){
int n;
  cin >> n;
  vector<long long int> vec(87);
  vec.at(0)=2;
  vec.at(1)=1;
  for(int i=2; i<87; i++){
    vec.at(i) = vec.at(i-1) + vec.at(i-2);
  }
  cout << vec.at(n) << endl;

	return 0;
}


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

int main()
{
    int s, a, b;
    cin >> s;
    a = s / 100;
    b = s % 100;
    if (a >= 1 && a <= 12 && b >= 1 && b <= 12)
        cout << "AMBIGUOUS" << endl;
    else if (a >= 1 && a <= 12)
        cout << "MMYY" << endl;
    else if (b >= 1 && b <= 12)
        cout << "YYMM" << endl;
    else
        cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int num, A, B, C, D;
    char op1, op2, op3, op4;

    cin >> num;

    A = num/1000;
    B = (num-A*1000)/100;
    C = (num-A*1000-B*100)/10;
    D = num-A*1000-B*100-C*10;

    if(A+B+C+D==7){
        op1='+'; op2='+'; op3='+';
    }
    if(A+B+C-D==7){
        op1='+'; op2='+'; op3='-';
    }
    if(A+B-C+D==7){
        op1='+'; op2='-'; op3='+';
    }
    if(A+B-C-D==7){
        op1='+'; op2='-'; op3='-';
    }
    if(A-B+C+D==7){
        op1='-'; op2='+'; op3='+';
    }
    if(A-B+C-D==7){
        op1='-'; op2='+'; op3='-';
    }
    if(A-B-C+D==7){
        op1='-'; op2='-'; op3='+';
    }
    if(A-B-C-D==7){
        op1='-'; op2='-'; op3='-';
    }

    cout << A << op1 << B << op2 << C << op3 << D << '=' << 7 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,tc=0,c=0;
    cin>>n>>d;
    int ar[n][d];
    for(int i=1;i<n;i++) tc+=i;
    for(int i=0;i<n;i++)
        for(int j=0;j<d;j++) cin>>ar[i][j];
    for(int i=0;i<n;i++)
    {

        for(int j=i+1;j<n;j++)
        {
            int sum=0;
            double dis;
            int dist;
            for(int k=0;k<d;k++)
            {
                sum+=pow((ar[i][k]-ar[j][k]),2);

            }
            dis=sqrt(sum);
            dist=sqrt(sum);
            //cout<<i<<" "<<dis<<" "<<dist<<endl;
            if(dis==dist) c++;
        }
    }
    cout<<c<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include<ctype.h>
#include <string.h>

int main(void){

   int c,i;

   char T[1000],W[10];

   char E[20] = "end_of_text";
   char en[20] = "END_OF_TEXT";

   c=0;

   scanf("%s",W);
   while(1){

       scanf("%s",T);
       if(strcmp(T,en)==0){

           break;

       }
       for(i=0;i<1001;i++){
       T[i] = tolower(T[i]);
       }
       if(strcmp(T,W)==0){

           c++;

       }
       

   }

   printf("%d\n",c);

   return 0;

}


Measured memory_bytes: 2036
use proconio::input;
use proconio::marker::Usize1;
use proconio::fastout;

#[allow(non_snake_case)]
#[fastout]
fn main() {

    input! {
        N: usize,
    }

    let mut n_children = vec![0usize; N];

    for _ in 0..N - 1 {
        input! {
            A: Usize1,
        }
        n_children[A] += 1;
    }

    for i in 0..N {
        println!("{}", n_children[i]); 
    }
}


Measured memory_bytes: 4768
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define cin(a) scanf("%d",&a)
#define pii pair<int,int>
#define ll long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
ll n,m,k,t;

ll ksm(ll a,ll b)
{
    ll res = 1;
    while (b)
    {
        if(b&1) res = (res*a)%M;
        a = (a*a)%M;
        b /= 2;
    }
    return res%M;
}

ll a[maxn];
ll sum[maxn];
ll xs[maxn];

void init(ll c)
{
    ll temp = c-2;
    xs[temp] = 1;
    for(int i = temp+1; i <= n; i++) 
    {
        xs[i] = ((xs[i-1]*i)%M*ksm(i-temp,M-2))%M;
    }
}

int main()
{
    cin>>n>>k;
    init(k);
    for(int i = 1; i <= n; i++) 
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i = 1; i <= n; i++) 
    {
        sum[i] = sum[i-1]+a[i];
    }
    ll ans = 0;
    ll cs = k-2;
    while(k <= n)
    {   
        ans = (ans + ((sum[n]-sum[k-1]-sum[n-k+1])%M)*xs[cs])%M;
        cs++;
        k++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3200
<?php

$sc = new Scanner();
$out = new out();

for($i = 0; $i < 3; $i++) {
    $c[$i][0] = $sc->nextInt();
    $c[$i][1] = $sc->nextInt();
    $c[$i][2] = $sc->nextInt();
}

$da = $c[0][0] - $c[0][1];
$da2 = $c[0][1] - $c[0][2];

$db = $c[0][0] - $c[1][0];
$db2 = $c[1][0] - $c[2][0];

for($i = 0; $i < 3; $i++) {
    if ($c[$i][0] - $c[$i][1] !== $da || $c[$i][1] - $c[$i][2] !== $da2 || $c[0][$i] - $c[1][$i] !== $db || $c[1][$i] - $c[2][$i] !== $db2) {
        $out->println('No');exit;
    }
}
$out->println('Yes');


class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}

Measured memory_bytes: 4728
#!usr/bin/env python3

import sys


class Die:
    def __init__(self, pips):
        self.pips = pips

    def move_die(self, direction):
        tmp = int()
        if direction == 'N':
            tmp = self.pips[0]
            self.pips[0] = self.pips[1]
            self.pips[1] = self.pips[5]
            self.pips[5] = self.pips[4]
            self.pips[4] = tmp
        elif direction == 'S':
            tmp = self.pips[0]
            self.pips[0] = self.pips[4]
            self.pips[4] = self.pips[5]
            self.pips[5] = self.pips[1]
            self.pips[1] = tmp
        elif direction == 'E':
            tmp = self.pips[0]
            self.pips[0] = self.pips[3]
            self.pips[3] = self.pips[5]
            self.pips[5] = self.pips[2]
            self.pips[2] = tmp
        elif direction == 'W':
            tmp = self.pips[0]
            self.pips[0] = self.pips[2]
            self.pips[2] = self.pips[5]
            self.pips[5] = self.pips[3]
            self.pips[3] = tmp

    def get_upside(self):
        return self.pips[0]


def init_die():
    pips = [int(pip) for pip in sys.stdin.readline().strip('\n').split()]
    die = Die(pips)
    return die


def roll_die(die):
    directions = list(sys.stdin.readline().strip('\n'))

    for direction in directions:
        die.move_die(direction)

    return die


def main():
    die = init_die()
    die = roll_die(die)
    print(die.get_upside())


if __name__ == '__main__':
    main()

Measured memory_bytes: 7744
def solve(ls1, ls2):
    s = sum(ls1)
    m = {}
    for a in ls1:
        if not a in m:
            m[a] = 0
        m[a] += 1

    result = []
    for b, c in ls2:
        if not b in m:
            result.append(s)
            continue
        if not c in m:
            m[c] = 0
        s += (c - b) * m[b]
        m[c] += m[b]
        m[b] = 0
        result.append(s)
    return result


def main(istr, ostr):
    (n,) = list(map(int, istr.readline().strip().split()))
    ls1 = list(map(int, istr.readline().strip().split()))
    (q,) = list(map(int, istr.readline().strip().split()))
    ls2 = [0] * q
    for i in range(q):
        ls2[i] = list(map(int, istr.readline().strip().split()))
    result = solve(ls1, ls2)
    print(*result, sep="\n", file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)


Measured memory_bytes: 38348
a,l=map(int, input().split())
b,m=map(int, input().split())
c,n=map(int, input().split())
d,o=map(int, input().split())
if a == 1 and b == 2 and c == 3 and d == 4 :
    print(l*6000)
    print(m*4000)
    print(n*3000)
    print(o*2000)
elif a == 1 and b == 2 and c == 4 and d == 3 :
    print(l*6000)
    print(m*4000)
    print(n*2000)
    print(o*3000)
elif a == 1 and b == 3 and c == 2 and d == 4 :
    print(l*6000)
    print(m*3000)
    print(n*4000)
    print(o*2000)
elif a == 1 and b == 3 and c == 4 and d == 2 :
    print(l*6000)
    print(m*3000)
    print(n*2000)
    print(o*4000)
elif a == 1 and b == 4 and c == 3 and d == 2 :
    print(l*6000)
    print(m*2000)
    print(n*3000)
    print(o*4000)
elif a == 1 and b == 4 and c == 2 and d == 3 :
    print(l*6000)
    print(m*2000)
    print(n*4000)
    print(o*3000)
elif a == 2 and b == 1 and c == 3 and d == 4 :
    print(l*4000)
    print(m*6000)
    print(n*3000)
    print(o*2000)
elif a == 2 and b == 1 and c == 4 and d == 3 :
    print(l*4000)
    print(m*6000)
    print(n*2000)
    print(o*3000)    
elif a == 2 and b == 3 and c == 1 and d == 4 :
    print(l*4000)
    print(m*3000)
    print(n*6000)
    print(o*2000)
elif a == 2 and b == 3 and c == 4 and d == 1 :
    print(l*4000)
    print(m*3000)
    print(n*2000)
    print(o*6000)
elif a == 2 and b == 4 and c == 1 and d == 3 :
    print(l*4000)
    print(m*2000)
    print(n*6000)
    print(o*3000)
elif a == 2 and b == 4 and c == 3 and d == 1 :
    print(l*4000)
    print(m*2000)
    print(n*3000)
    print(o*6000)
elif a == 3 and b == 1 and c == 2 and d == 4 :
    print(l*3000)
    print(m*6000)
    print(n*4000)
    print(o*2000)
elif a == 3 and b == 1 and c == 4 and d == 2 :
    print(l*3000)
    print(m*6000)
    print(n*2000)
    print(o*4000)
elif a == 3 and b == 2 and c == 1 and d == 4 :
    print(l*3000)
    print(m*4000)
    print(n*6000)
    print(o*2000)
elif a == 3 and b == 2 and c == 4 and d == 1 :
    print(l*3000)
    print(m*4000)
    print(n*2000)
    print(o*6000)
elif a == 3 and b == 4 and c == 1 and d == 2 :
    print(l*3000)
    print(m*2000)
    print(n*6000)
    print(o*4000)
elif a == 3 and b == 4 and c == 2 and d == 1 :
    print(l*3000)
    print(m*2000)
    print(n*4000)
    print(o*6000) 
    print(o*4000)
elif a == 4 and b == 1 and c == 2 and d == 3 :
    print(l*2000)
    print(m*6000)
    print(n*4000)
    print(o*3000)
elif a == 4 and b == 1 and c == 3 and d == 2 :
    print(l*2000)
    print(m*6000)
    print(n*3000)
    print(o*4000)
elif a == 4 and b == 2 and c == 1 and d == 3 :
    print(l*2000)
    print(m*4000)
    print(n*6000)
    print(o*3000)
elif a == 4 and b == 2 and c == 3 and d == 1 :
    print(l*2000)
    print(m*4000)
    print(n*3000)
    print(o*6000)    
elif a == 4 and b == 3 and c == 1 and d == 2 :
    print(l*2000)
    print(m*3000)
    print(n*6000)   
    print(o*4000)
elif a == 4 and b == 3 and c == 2 and d == 1 :
    print(l*2000)
    print(m*3000)
    print(n*4000)   
    print(o*6000)
else :
    pass


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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; ++i)
#define rep(i, n) for(lint i = 0 ; i < n ; ++i)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    lint N, W;
    cin >> N >> W;
    vector< vector<lint> > vec(4);
    lint w0, v;
    cin >> w0 >> v;
    vec[0].push_back(v);
    REP(i, 1, N){
        lint w;
        cin >> w >> v;
        vec[w - w0].push_back(v);
    }
    rep(i, 4){
        sort(vec[i].rbegin(), vec[i].rend());
    }
    vector< vector<lint> > sum(4);
    rep(i, 4){
        sum[i].resize(vec[i].size() + 1);
        sum[i][0] = 0;
        REP(j, 1, sum[i].size()){
            sum[i][j] = sum[i][j - 1] + vec[i][j - 1];
        }
    }
    lint ans = 0;
    rep(i, sum[0].size()){
        rep(j, sum[1].size()){
            rep(k, sum[2].size()){
                rep(l, sum[3].size()){
                    if(w0 * i + (w0 + 1) * j + (w0 + 2) * k + (w0 + 3) * l > W){
                        break;
                    }
                    ans = max(ans, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;

    // cout << 3 * N << endl;

    vector<long> A(3 * N);

    for (int i = 0; i < (3 * N); i++)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    long result = 0;
    for (int i = 1; i <= N; i++)
    {
        result+= A[2*i-1];
    }
    cout << result << endl;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(){
    int n;cin>>n;
    int nw = 100000;
    for(int i = 0; n > i; i++){
        int z = (nw/100*105);
        int t = z/1000*1000;
        if(z%1000){
            t += 1000;
        }
        nw = t;
    }
    cout << nw << endl;
}


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

using namespace std;

int main(void)
{
	
	int n;
	int a[31];
	a[0]=1;
	a[1]=1;
	a[2]=2;
	for (int i=3; i<=30; i++){
		a[i]=a[i-1]+a[i-2]+a[i-3];
	}
	
	while (cin>>n&&n){
		cout<<(a[n]+3649)/3650<<endl;
	}
}


Measured memory_bytes: 3116
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

h,w = iim()
l = []
for i in range(h):
    s = list(input())
    if '#' in s:
        l.append(s)

h = len(l)
for j in range(w)[::-1]:
    flag = True
    for k in range(h):
        if l[k][j] == '#':
            flag = False
    if flag:
        for n in range(h):
            l[n].pop(j)

for m in range(h):
    print(''.join(l[m]))


Measured memory_bytes: 3188
h, w, k = map(int, input().split())
c = []
w_count = []
h_count = [0 for _ in range(w)]
n = 0
for _ in range(h):
    tmp = list(input())
    for i in range(w):
        if tmp[i] == "#":
            h_count[i] += 1
    tc = tmp.count("#")
    n += tc
    w_count.append(tc)
    c.append(tmp)
# print(w_count, h_count)

ans = 0
for w_bin in range(2 ** w):
    for h_bin in range(2 ** h):
        w_bin_st = bin(w_bin)[2:].zfill(w)
        h_bin_st = bin(h_bin)[2:].zfill(h)
        # print(w_bin_st, h_bin_st)
        num = 0
        i_list = []
        j_list = []
        for i, wb in enumerate(list(w_bin_st)):
            if wb == "1":
                i_list.append(i)
                num += h_count[i]
        for j, hb in enumerate(list(h_bin_st)):
            if hb == "1":
                j_list.append(j)
                num += w_count[j]
        if n-num <= k:
            for il in i_list:
                for jl in j_list:
                    if c[jl][il] == "#":
                        num -= 1
            if n-num == k:
                # print(i_list, j_list)
                ans += 1

print(ans)

Measured memory_bytes: 9116
class Dice:
    def __init__(self,t,f,r,l,b,u):
        self.t = t
        self.f = f
        self.r = r
        self.l = l
        self.b = b
        self.u = u
        self.a=[[t,f,r,l,b,u]]
        self.direction={'S':(4,0,2,3,5,1),'N':(1,5,2,3,0,4),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3),'Y':(0,3,1,4,2,5)}
    def roll(self,d,n):
        self.a[n]=[self.a[n][i] for i in self.direction[d]]
n=int(input())
for i in range(n):
    if i==0:
        t, f, r, l, b, u = map(int, input().split())
        dice = Dice(t, f, r, l, b, u)
    else:
        a = list(map(int, input().split()))
        dice.a.append(a)
s='SSSWEEE'
w='YYYY'
ans='Yes'
for u in range(n-1):
    for t in range(u+1,n):
        for j in s:
            for r in w:
                if dice.a[t]==dice.a[u]:
                    ans='No'
                    break
                dice.roll(r,t)
            else:
                dice.roll(j,t)
                continue
            break
        else:
            continue
        break
    else:
        continue
    break
print(ans)




Measured memory_bytes: 5612
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int[] ans = new int[4];
        int n = crI();
        for (int i =  0; i < n ; i++)
        {
            string s = crS();
            if (s.Equals("AC")) ans[0]++;
            else if (s.Equals("WA")) ans[1]++;
            else if (s.Equals("TLE")) ans[2]++;
            else if (s.Equals("RE")) ans[3]++;
        }
        Console.WriteLine("AC x " + ans[0]);
        Console.WriteLine("WA x " + ans[1]);
        Console.WriteLine("TLE x " + ans[2]);
        Console.WriteLine("RE x " + ans[3]);
    }

   
  



        //入力受け取り用
    static string crS() { return Console.ReadLine(); }
    static int crI() { return int.Parse(Console.ReadLine()); }
    static int[] arrInt(){return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();}
    static long[] arrLong(){ return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray(); }
    static string[] arrStr(){return Console.ReadLine().Split(' ').ToArray();}
    static List<int[]> mapInt(int h)
    {
        List<int[]> mapInt = new List<int[]>();
        for (int i = 0; i < h; i++)
        {
            mapInt.Add(arrInt());
        }
        return mapInt;
    }
}

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

int main(){
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if((x - r >= 0 && x + r <= w) && (y - r >= 0 && y + r <= h)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}





Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
     int w,a,b;
    cin >>w>>a>>b;
    if(a<b){
      if(b>a+w){
  cout<<b-(a+w)<<endl;
      }else{
        cout<<0<<endl;
      }
    }else{
      if(a>b+w){
        cout<<a-(b+w)<<endl;
      }else{
        cout<<0<<endl;
      }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<ll> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    sort(all(vec));
    bool ans = true;
    if (N % 3 != 0){
        rep(i,N){
            if (vec[i] != 0) ans = false;
        }
    }
    else{
        ll small;
        ll middle;
        ll large;
        small = vec[0];
        middle = vec[N / 3];
        large = vec[(N / 3) * 2];
        rep(i,N / 3){
            if (vec[i] != small) ans = false;
            if (vec[(N / 3) + i] != middle) ans = false;
            if (vec[(N / 3) * 2 + i] != large) ans = false;
        }
        if ((small ^ middle) != large) ans = false;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1024
n=int(input())
s=set()
s.add('a')
l='abcdefghijkl'
for i in range(n-1):
  s1=set()
  for t in s:
    for j in range(12):
      if l[j] in t:
        u=t+l[j]
        s1.add(u)
      else:
        u=t+l[j]
        s1.add(u)
        break
  s=s1
m=list(s)
m.sort()
for i in m:
  print(i)

Measured memory_bytes: 17592
n=int(input())
n_list=list(map(int,input().split()))
count=0

def check(list):
    for i in range(n):
        if(n_list[i]%2!=0):
            return False
    return True

    

while(check(n_list)):
    n_list=[k/2 for k in n_list]
    count+=1
print(count)  

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

int main(){
  int A,B,H,M; cin >> A >> B >> H >> M;
  double phH,phM;
  phH=30.0*H+0.5*M;
  phM=6.0*M;
  double phd=abs(phH-phM);
  cout << setprecision(15) << sqrt(A*A+B*B-2.0*A*B*cos(phd/180.0*3.1415926535)) << endl;
}

Measured memory_bytes: 4160
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(N) for (int i = 0; i < N; i++)

int main() {
	int N, M;
	int a, b;
	int count = 0;
	cin >> N >> M;
	vector<vector<int>> graph_metrix(N, vector<int>(N));
	vector<int> front_path;
	vector<int> added_path;
	list<vector<int>> paths;
	paths.push_back({0});
	for (int i = 0; i < M; i++){
		cin >> a >> b;
		graph_metrix[a-1][b-1] = 1;
		graph_metrix[b-1][a-1] = 1;
	}
	while (paths.size() != 0){
		front_path = paths.front();
		/*
		for (int x: front_path){
			cout << to_string(x) << " ";
		}
		cout << endl;
		*/
		for (int i = 0; i < N; i++){
			if (graph_metrix[front_path.back()][i] == 1){
				if (find(front_path.begin(), front_path.end(), i) == front_path.end()){
					added_path = front_path;
					added_path.push_back(i);
					paths.push_back(added_path);
					if (added_path.size() == N) count++;
				}
			}
		}
		paths.pop_front();
	}
	cout << count << endl;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
using namespace std;
int main()
{
    ll i,j,k,n,t;
    vector<ll>v;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>k;
        v.push_back(k);
    }
    sort(v.begin(),v.end());
    ull p=1;
    ll f=0;
    for(i=0;i<n;i++)
    {
        if(v[i]==0)
        {
            cout<<0<<endl;
            return 0;
        }
        if(1000000000000000000/p<v[i])
        {

            f=1;
            break;
        }
        else
        {
            p*=v[i];
        }
    }
    if(f==1)
    {
        cout<<"-1"<<endl;
    }
    else
        cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 4320
array = gets.chomp.split(" ")
a =array[0].to_i
b =array[1].to_i
c =array[2].to_i
if a <= c  then
  x = 0
else x = 1
end

if c <= b  then
 y = 0

else y = 1
end

if x +y == 0 then
  puts("Yes")

else puts("No")

end

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<bitset>
using namespace std;

typedef bitset<12> B;
int m[51][51], dp[1 << 12][50][50][4];
int H, W, K;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};


int filter(int v, int x)
{
  return (v << x) ? -1 : 1; 
}

int dfs(int bit, int x, int y, int k)
{
  if(dp[bit][x][y][k] != 0)
    return dp[bit][x][y][k];
  int cnt = max(0, m[y][x]);
  int res = -100000000;
  if(x == W - 1 && y == H - 1)
    res = 0;
  B bb(bit);
  int xx = x, yy = y;
  for(int j = 0; j < 6; j++)
  {
    int d = (int)bitset<2>((bb >> (j * 2)).to_ulong()).to_ulong();
    xx -= dx[d]; yy -= dy[d];
    if(xx == x && yy == y)
      cnt = 0;
  }
  for(int i = 0; i < 4; i++)
  {
    int tx = x + dx[i], ty = y + dy[i];
    if(!(tx >= 0 && tx < W && ty >= 0 && ty < H))
      continue;
    if(m[ty][tx] == -1)
      continue;
    int dk = (dx[i] < 0 || dy[i] < 0) ? 1 : 0;
    if(k + dk > K)
      continue;

    B nb((bb << 2).to_ulong());
    nb |= bitset<12>(i);
    res = max(res, dfs(int(nb.to_ulong()), tx, ty, k + dk) + cnt);
  }
  return dp[bit][x][y][k] = res;
}

int main()
{
  cin >> H >> W >> K;
  for(int y = 0; y < H; y++)
  {
    for(int x = 0; x < W; x++)
    {
      char a;
      cin >> a;
      switch(a)
      {
        case '.':
          m[y][x] = 0;
          break;
        case '#':
          m[y][x] = -1;
          break;
        default:
          m[y][x] = a - '0';
          break;
      }
    }
  }
  cout << dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 160920
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cassert>
using namespace std;

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

	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int x = max(a, max(b, c));
	int y = x << k;
	y += a + b + c - x;
	cout << y << endl;
}


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

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

vector<int> adj[910];
int cost[910];

inline void add_edge(int s, int t) {
  adj[s].push_back(t);
  adj[t].push_back(s);
}

int main() {
  int w, h;
  while (scanf("%d%d", &w, &h), w|h) {
    REP(i, w*h) { adj[i].clear(); }
    memset(cost, 0, sizeof(cost));

    REP(y, 2*h-1) {
      REP(x, w+y%2-1) {
        int d; scanf("%d", &d);
        if (d == 0) {
          if (y%2 == 0) {
            add_edge((y/2)*w+x, (y/2)*w+x+1);
          } else {
            add_edge((y/2)*w+x, (y/2+1)*w+x);
          }
        }
      }
    }

    queue<int> Q;
    cost[0] = 1;
    Q.push(0);
    while (!Q.empty()) {
      int v = Q.front(); Q.pop();
      if (v == w*h-1) { break; }
      FOREACH(it, adj[v]) {
        int u = *it;
        if (cost[u] == 0) {
          cost[u] = cost[v]+1;
          Q.push(u);
        }
      }
    }

    printf("%d\n", cost[w*h-1]);
  }
}

Measured memory_bytes: 0
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 190;
int n, m;
char c[maxn][maxn];

bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

int dp[maxn][maxn][maxn];
int ndp[maxn][maxn][maxn];

void solve() {
  for (int i = 0; i < m; i++) {
    c[n][i] = ' ';
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      dp[i][j][j] = inf;
    }
  }
  for (int l = 0; l < m; l++) {
    for (int r = l + 1; r <= m; r++) {
      dp[n][l][r] = 0;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int l = 0; l < m; l++) {
      bool bad = false;
      for (int r = l + 1; r <= m; r++) {
        if (r - l >= 2 && c[i][r - 2] != c[i][r - 1]) {
          bad = true;
        }
        auto &cur = dp[i][l][r];
        if (bad) {
          cur = 0;
          continue;
        }
        cur = 1 + (c[i + 1][l] == c[i][l] ? dp[i + 1][l][r] : 0);
      }
    }
  }
  int res = 0;
  while (dp[0][0][m] < n) {
    for (int i = 0; i <= n; i++) {
      for (int l = 0; l < m; l++) {
        for (int r = l + 1; r <= m; r++) {
          ndp[i][l][r] = 0;
        }
      }
      for (int j = 0; j <= m; j++) {
        ndp[i][j][j] = inf;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int l = 0; l < m; l++) {
        int pos = l;
        for (int r = l + 1; r <= m; r++) {
          while (pos < r && dp[i][l][pos + 1] > dp[i][pos + 1][r]) {
            pos++;
          }
          auto &cur = ndp[i][l][r];
          cur = max(cur, min(dp[i][l][pos], dp[i][pos][r]));
          if (pos + 1 < r) {
            cur = max(cur, min(dp[i][l][pos + 1], dp[i][pos + 1][r]));
          }
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int l = 0; l < m; l++) {
        for (int r = l + 1; r <= m; r++) {
          auto &cur = ndp[i][l][r];
          int len = dp[i][l][r];
          cur = max(cur, len + dp[i + len][l][r]);
        }
      }
    }
    swap(dp, ndp);
    res++;
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 53888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PRINT(s) cout << s << endl;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR((i), 0, (n))

int main() {
    int x, y;
    cin >> x >> y;
    int bird = 2;
    int turtle = 4;
    REP(birdCount, x + 1) {
        if ((bird * birdCount + (x - birdCount) * turtle) == y) {
            PRINT("Yes");
            return 0;
        }
    }
    PRINT("No");
            return 0;

}


Measured memory_bytes: 3636