akhauriyash/Code-Regression huggingface dataset:
<?php

list($H,$W,$N) = explode(" ",trim(fgets(STDIN)));

$ans = array(1 => 0,
             2 => 0,
             3 => 0,
             4 => 0,
             5 => 0,
             6 => 0,
             7 => 0,
             8 => 0,
             9 => 0
             );

$count = ($H - 2) * ($W - 2);

if($N > 0){
    for($i = 1;$i <= $N;$i++){
        list($a,$b) = explode(" ",trim(fgets(STDIN)));
        for($j = -1;$j <= 1;$j++){
            if($a + $j > 1 && $a + $j < $H){
                for($k = -1;$k <= 1;$k++){
                    if($b + $k > 1 && $b + $k < $W){
                        if(isset($map[$a + $j][$b + $k])){
                            $map[$a + $j][$b + $k] ++;
                        }else{
                            $map[$a + $j][$b + $k] = 1;
                        }
                    }
                }
            }
        }
    }
    
    foreach($map as $val){
        foreach($val as $val2){
            $ans[$val2] ++;
            $count --;
        }
    }
}

echo $count . PHP_EOL;
echo implode(PHP_EOL,$ans);

?>

Measured memory_bytes: 219768
#include <iostream>
#include<string>
#include <set>

using namespace std;

int main() {
    int n;
    string s;
    set<string> gifts;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> s;
        gifts.insert(s);
    }
    
    cout << gifts.size() << endl;
    
    return 0;
}

Measured memory_bytes: 19180
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using V = vector<int>;
using S = string;
using C = char;

const double pi = 3.1415926535;

void Main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (int(i * 1.08) == n) {
			cout << i << endl;
			return;
		}
	}
	cout << ":(" << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}

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

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

const int INF = 1e9;
const int mod = 1e9+7;

ll sum[55],pat[55];

ll rec(ll n,ll x)
{
    if(x == sum[n]) return pat[n];
    ll ans = 0;
    x--;
    if(x > 0){
        ll y = min(x,sum[n-1]);
        ans += rec(n-1,y);
        x -= y;
    }
    if(x > 0){
        x--;
        ans++;
    }
    if(x > 0){
        ll y = min(x,sum[n-1]);
        ans += rec(n-1,y);
        x -= y;
    }
    
    return ans;
}

int main()
{
    ll n,x;
    cin >> n >> x;
    sum[0] = pat[0] = 1;
    for(int i = 1; i <= n; i++){
        sum[i] = sum[i-1] * 2 + 3;
        pat[i] = pat[i-1] * 2 + 1;
    }
    cout << rec(n,x) << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin, stdout
from heapq import heappush, heappop
from itertools import repeat
def main():
    n, m, s, t = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 4 * m))
    la = [None] * (n + 1)
    xt = [None] * (4 * m)
    j = 0
    for i in xrange(m):
        x, y = dat[j], dat[j+1]
        xt[j] = la[y]
        la[y] = j
        j += 1
        xt[j] = la[x]
        la[x] = j
        j += 3
    dd = [[10 ** 15] * (n + 1), [10 ** 15] * (n + 1)]
    for i in xrange(2):
        d = dd[i]
        x = t if i else s
        d[x] = 0
        q = []
        heappush(q, (0, x))
        while q:
            co, x = heappop(q)
            y = la[x]
            if d[x] != co:
                continue
            while y is not None:
                z = dat[y]
                yy = y / 4 * 4 + 2
                c = dat[yy+i]
                if d[z] > co + c:
                    d[z] = co + c
                    heappush(q, (d[z], z))
                y = xt[y]
    ans = [0] * n
    z = 10 ** 15
    ans[n-1] = z - dd[0][n] - dd[1][n]
    for i in xrange(n - 2, -1, -1):
        ans[i] = x = z - dd[0][i+1] - dd[1][i+1]
        if ans[i+1] > x:
            ans[i] = ans[i+1]
    stdout.write(''.join('%d\n' % x for x in ans))
main()


Measured memory_bytes: 41580
#include <cstdio>
#include <algorithm>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

typedef long long ll;

const int N_MAX = 2000;
const ll INF = 1e16;

int N;
ll x;
ll a[N_MAX];
ll b[N_MAX];

void solve() {
  ll ans = 0;
  REP(i, N) {
    b[i] = a[i];
    ans += b[i];
  }
  FOR(j, 1, N - 1) {
    ll tmp = 0;
    REP(i, N) {
      b[i] = min(b[i], a[(i + N - j) % N]);
      tmp += b[i];
    }
    tmp += x * j;
    ans = min(ans, tmp);
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d%d", &N, &x);
  REP(i, N) scanf("%lld", a + i);
}

int main() {
  input();
  solve();
  return 0;
}


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

typedef long long ll;

int main() {
int N;   cin >> N;
vector<int> H(N + 1);
    for (int i = 0; i < N; i++) {
    cin >> H[i];
}
H[N] = 0;

ll ans = 0;
for (int h = 0; h <= 100; h++) {
    for (int i = 0; i < N; i++) {
        if (H[i] >= h && H[i + 1] < h) {
            ans++;
        }
    }
}

cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
int a, n;
int dfs(double x, double sum, int num, int limit, int step)
{
    if(abs(x - sum) <= EPS) return 1;
    if(limit == 0 || step == 0) return 0;
    int res = 0;
    for(int i = num; i <= limit; i++)
    {
        res += dfs(x, sum + 1.0 / i, i, limit / i, step - 1);
    }
    return res;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p, q;
    while(cin >> p >> q >> a >> n, p | q | a | n)
    {
        cout << dfs((double)p / q, 0.0, 1, a, n) << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
using namespace std;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;

int n,k,c;
string s;
vector<int> L,R;

int main() {
    ios::sync_with_stdio(false);
    cin>>n>>k>>c>>s;

    for(int i=0;i<s.size();++i){
        if(s[i]=='o') L.pb(i),i+=c;
        if(L.size()==k) break;
    }
    for(int i=s.size()-1;i>=0;--i){
        if(s[i]=='o') R.pb(i),i-=c;
        if(R.size()==k) break;
    }

    for(int i=0;i<k;++i){
        if(L[i]==R[k-i-1])
            printf("%d\n",L[i]+1);
    }

    return 0;
}

Measured memory_bytes: 3468
n=int(input())
l=input().split()
a={"-1":0}
for i in range(0,len(l),2):
    if l[i] in a:
        a[l[i]]+=1
    else:
        a[l[i]]=1
b={"-1":0}  
for i in range(1,len(l),2):
    if l[i] in b:
        b[l[i]]+=1
    else:
        b[l[i]]=1
a = sorted(a.items(), key=lambda x:-x[1])
b = sorted(b.items(), key=lambda x:-x[1])
if a[0][0]==b[0][0]:
    m=max(a[0][1]+b[1][1],a[1][1]+b[0][1])
else:
    m=a[0][1]+b[0][1]
print(n-m)

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

int main(){
  int N,R;
  cin >> N >> R;
  int rate;
  
  if(N >=10) {
    rate = R;
  }else{
    rate = R + 100*(10-N);
  }
  
  cout << rate << endl;
  
  return 0;
}

  

Measured memory_bytes: 256
N, M, X = map(int, input().split())

C = []
A = []

for i in range(N):
    s = list(map(int, input().split()))
    
    C.append(s[0])
    A.append(s[1:])
    
import numpy as np

can = np.array(A).T

for i in range(M):
    if np.sum(can[i]) < X:
        print(-1)
        exit()

min = 100000000000
for i in range(2**N):
    switch = []
    for j in range(N):
        if ((i >> j) & 1):
            switch.append(j)
    #print("switch", switch)
    
    count = 0
    SUM = []
    for j in switch:
        SUM.append(A[j])
    
    can = np.array(SUM).T
    
    #print(can)

    flag = True
    for j in range(M):
        try:
            if np.sum(can[j]) < X:
                flag = False
                break
        except:
            flag = False
            break
        
    if flag:
        for j in switch:
            count += C[j]
        
        if count < min:
            min = count
        #print(count)
            
print(min)

Measured memory_bytes: 27276
a, op, b = gets.split
a = a.to_i
b = b.to_i
while op != '?'
    if op == '+'
        puts a+b
    elsif op == '-'
        puts a-b
    elsif op == '*'
        puts a*b
    else
        puts a/b
    end
    a, op, b = gets.split
    a = a.to_i
    b = b.to_i
end

Measured memory_bytes: 8688
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
	
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int n;
	static int t[10100];
	scanf("%d", &n);
	rep (i, n - 1)
		scanf("%d", t + i);
	int m = n / 2;

	static int dp1[5100][10100], dp2[5100][10100];
	const int INF = 1e9;
	rep (i, m + 1)
		rep (j, n + 1)
			dp1[i][j] = dp2[i][j] = INF;

	dp1[1][0] = 0;
	fill(dp2[1] + 1, dp2[1] + n, t[0]);
	for (int i = 2; i <= m; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			dp1[i][j] = min(dp1[i - 1][j - 1], dp2[i - 1][j] + t[j - 1]);
			dp2[i][j] = min(dp2[i][j - 1], dp1[i][j - 1] + t[j - 1]);
		}
	}

	printf("%d\n", dp2[m][n]);


	//	for (int i = 0; i < n; ++i)
	//	printf("%10d ", i);
	//puts("");
	//puts("");
	//for (int i = 0; i < n; ++i)
	//	printf("%10d ", t[i]);
	//puts("");
	//puts("");

	//for (int i = 1; i <= m; ++i)
	//{
	//	rep (j, n + 1)
	//		printf("%10d ", dp1[i][j]);
	//	puts("");
	//}
	//puts("");

	//for (int i = 1; i <= m; ++i)
	//{
	//	rep (j, n + 1)
	//		printf("%10d ", dp2[i][j]);
	//	puts("");
	//}
}

Measured memory_bytes: 0
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
K=gets.to_i
kind={}
S.each do|s|
    kind[s]=1
end
if kind.size==1
    puts N*K/2
    exit
end
cnt=1
ans=0
flag=false
add=0
(N-1).times do|i|
  if S[i]==S[i+1]
      cnt+=1
  else
      unless flag
          add=cnt
          flag=true
          ans+=cnt/2
      else
        ans+=cnt/2*K
      end
      cnt=1
  end
end
if S[N-1]!=S[0]
  ans+=cnt/2*K+add/2*(K-1)
else
    ans+=(cnt+add)/2*(K-1)+cnt/2
end
puts ans

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N,M;
  	cin >> N;
  	string check;
  	vector<string> vec1(N);
  	for(int i = 0; i< vec1.size(); i++){
    	cin >> vec1.at(i);
    }
	cin >> M;
    vector<string> vec2(M);
  	for(int i = 0; i< vec2.size(); i++){
    	cin >> vec2.at(i);
    }
    int max = 0;
  	for(int i = 0; i < vec1.size(); i++){
        int count = 0;
    	check = vec1.at(i);
      	for(int j = 0; j < vec1.size(); j++){
        	if(check == vec1.at(j)){
            	count++;
            }
        }
      	for(int k = 0; k < vec2.size(); k++){
        	if(check == vec2.at(k)){
            	count--;
            }
        }
        if(max < count){
        	max = count;
        }
    }
    	cout << max << endl;
}


Measured memory_bytes: 256
solve :: [Int] -> Int
solve (a:b:as)
  | a == b = solve (b:as)
  | a <= b = f (<=) (b:as)
  | otherwise = f (>=) (b:as)
  where
    f r (a:b:as)
      | r a b = f r (b:as)
      | otherwise = 1 + solve (b:as)
    f _ [_] = 1
solve [_] = 1

main = getLine >> getLine >>= print.solve.map read.words

Measured memory_bytes: 36220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

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

		int X = sc.nextInt();
		int ans = 0;

		if (X >= 400 && X <= 599) {
			ans = 8;
		}
		else if (X >= 600 && X <= 799) {
			ans = 7;
		}
		else if (X >= 800 && X <= 999) {
			ans = 6;
		}
		else if (X >= 1000 && X <= 1199) {
			ans = 5;

		}
		else if (X >= 1200 && X <= 1399) {
			ans = 4;

		}
		else if (X >= 1400 && X <= 1599) {
			ans = 3;

		}
		else if (X >= 1600 && X <= 1799) {
			ans = 2;

		}
		else if (X >= 1800 && X <= 1999) {
			ans = 1;

		}
		System.out.println(ans);
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W;
string S[51];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(y,H) cin>>S[y];
	
	FOR(y,H) FOR(x,W) if(S[y][x]=='#') {
		int ok=0;
		if(y&&S[y-1][x]=='#') ok=1;
		if(y<H-1&&S[y+1][x]=='#') ok=1;
		if(x&&S[y][x-1]=='#') ok=1;
		if(x<W-1&&S[y][x+1]=='#') ok=1;
		if(ok==0) return _P("No\n");
	}
	_P("Yes\n");
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static  ll INF = 1e9;
using namespace std;

signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	int ans=c-a+b;
	if(ans<0)ans=0;
	cout<<ans<<endl;
	return 0;
}


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

int main()
{
	int w, h, a, b;
	while ( 1 )
	{
		cin >> h >> w ;
		h , w <= 300 ;
		a = 1 ;
		if ( w == 0 && h == 0 ) break; 
	while (a <= h )
	{
		b = 1 ;
		for (b = 1; b <= w; b++)
		{
			cout << "#" ;
		}
		a += 1;
		cout << endl;
	}
	cout << endl;
}
}

Measured memory_bytes: 1156
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

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

// value
vi W;

void solve() {

	int N;
	cin >> N;
	W.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> W[i];
	}

	vi L(N, 0);
	L[0] = W[0];
	for (int i = 1; i < N; i++) {
		L[i] = L[i - 1] + W[i];
	}
	vi R(N, 0);
	R[N - 1] = W[N - 1];
	for (int i = N - 2; i >= 0; i--) {
		R[i] = R[i + 1] + W[i];
	}
	int ans = INF;
	for (int i = 0; i < N - 1; i++) {
		ans = min(ans, abs(R[i + 1] - L[i]));
	}

	cout << ans << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;
  class Main{
    public static void main(String args[]){
    Scanner scan = new Scanner(System.in);

       int n = scan.nextInt();

       long z =0;
       int y =-1000001;
       int x = 1000001;

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

         int a = scan.nextInt();

         z+=a;

         x=Math.min(a,x);

         y=Math.max(a,y);

         }

            System.out.println(x+" "+y+" "+z);

  }
}


Measured memory_bytes: 42060
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int K = scan.nextInt();

        int ans = 0;
        while(N >= K) {
            N /= K;
            ans++;
        }

        if(N != 0)
            ans++;

        os.println(ans);
    }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();
        
    vector<string> s(3); cin >> s;
    string alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    FOR(i, 0, 3)cout << alp[s[i][0] - 'a'];
    cout << "\n";
}


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


int main(){
    int i, j, W, H;
    while(1){
        cin >> H >> W;
        if (W==0 && H==0) break;
        for (j = 1; j < H+1; j++){
            for (i = 1; i < W+1; i++){
                if (i % 2 == j % 2){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    } 
    return 0;
}


Measured memory_bytes: 3116
#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int num[10];
long  fact[10],dp[10][331];//??????331??\?????????????????¨????????????dp[10][1000]??¨?????§???????????????

int main(){
	for(int i = 0; i < 10; i++){
		num[i] = i;
	}

	do{
		int t = 0;
		for(int i = 0; i < 10; i++){
			t += num[i]*(i+1);
			dp[i][t]++;
		}
	}while(next_permutation(num,num+10));

	fact[0] = 1;
	for(int i = 1; i < 10; i++){
		fact[i] = fact[i-1]*i;
	}

	int n,s;
	while(cin>>n>>s){
		if(n > 10 || s > 330){
			cout<<0<<endl;
			continue;
		}
		if(n == 0){
			if(s == 0) cout<<1<<endl;
			else cout<<0<<endl;
			continue;
		}
		cout<<dp[n-1][s]/fact[10-n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
int main(){
    ll n;
    cin>>n;
    ll num[10001]={0},ans=1;
    rep(i,n){
        ll a=i+1;
        for(int j=2;j<=sqrt(a);j++){
            if(a%j==0){
                while(a%j==0) a/=j,num[j]++;
            }
        }
        num[a]++;
    }
    rep(i,n-1) if(num[i+2]) ans=ans*(num[i+2]+1)%mod;
    cout<<ans;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <vector>
#include <tuple>

using namespace std;

int main() {
	int K, A, B;
	scanf("%d%d%d", &K, &A, &B);
	int k1 = min(A-1, K);
	long long C = k1 + 1;
	K -= k1;
	if(K&1) {
		++C;
		--K;
	}
	if(2<=B-A) {
		C += (long long)(B-A) * (K>>1);
	}
	else {
		C += K;
	}
	printf("%lld\n", C);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    if((b-a)%2==0){
        printf("%lld\n",(b-a)/2);
    }
    else{
        if(n-b>a-1){
            printf("%lld\n",a+(b-a==1?0:(b-a)/2));
        }
        else{
            printf("%lld\n",n-b+1+(b-a==1?0:(b-a)/2));
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define endl '\n'
ll dp[105][100005];
pair<ll,ll> arr[105];
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n,w,su=0;
	cin>>n>>w;
	for(ll i=1;i<=n;i++)
	{
		ll a,b;
		cin>>a>>b;
		su+=b;
		arr[i]=mp(a,b);
	}
	for(ll i=1;i<=su;i++)
		dp[0][i]=inf;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=su;j++)
		{
			if(j>=arr[i].ss)
			{
				dp[i][j]=min(dp[i-1][j-arr[i].ss]+arr[i].ff,dp[i-1][j]);
			}
			else
				dp[i][j]=dp[i-1][j];
		}
	}
	ll ans=0;
	for(ll i=1;i<=su;i++)
	{
		if(dp[n][i]<=w)
			ans=i;
		else
			continue;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 80128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int N, d, x;
double D[200010];

void solve(){
	scanf("%d%d%d", &N, &d, &x);
	D[1] = 1;
	for(int i=2;i<=N;i++){
		D[i] = D[i-1] + 1.0 / i;
	}
	double d2 = d + (N - 0.5) * x, ans = 0;
	for(int i=1;i<=N;i++){
		ans += d2 * 0.5 * (D[i] + D[N+1-i]);
	}
	printf("%.12f\n", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

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


void solve(long long X, long long A, long long B){
    cout << (X-A)%B << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(X, A, B);
    return 0;
}


Measured memory_bytes: 256
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = 0

if N > K:
    for i in range(0, K):
        ans += X
    for i in range(K, N):
        ans += Y
elif N <= K:
    for i in range(0, N):
        ans += X

print(ans)

Measured memory_bytes: 9196
n,m,l=map(int, input().split())
a=[list(map(int, input().split())) for i in range(n)]
b=[list(map(int, input().split())) for i in range(m)]
c=[[0]*l for i in range(n)]
for i in range(n):
    for j in range(l):
        c[i][j]+=sum([a[i][k]*b[k][j] for k in range(m)])
for i in c:print(*i)


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

int main(){
  string NITI;
  cin >> NITI;
  string YEAR=NITI.substr(0,4);
  string MONTH=NITI.substr(5,2);
  string K=YEAR+MONTH;
  int nihihi=stoi(K);
  if(nihihi>=201905) cout << "TBD" << endl;
  else cout << "Heisei" << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
  
public class Main{
    public static void main(String[] args) throws IOException {
        int xLine = 0;
        int yLine = 0;
        Boolean flg = true;
        
        BufferedReader br =
        		new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb =
        		new StringBuilder();
        
        
        while(flg){
            String str[] = br.readLine().split(" ");
            yLine = Integer.parseInt(str[0]);
            xLine = Integer.parseInt(str[1]);

            if(xLine==0 && yLine==0) {
        		flg = false;

        	}
        	else {

        		for(int i=0; i<yLine; i++){
        			for(int j=0; j<xLine; j++){
                    	if((j%2==0 && i%2==1) || (i%2==0 && j%2==1)){
                    		sb.append(".");
                    		}
                    	else {
                    		sb.append("#");
                    		}
                    }
                    sb.append("\n");
                }
                sb.append("\n");
            }
        	
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 25488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RREP(i,n) for (int i=n-1;i>=0;i--)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=4e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll add(ll a,ll b){
    ll ret = a+b;
    if (ret >= MOD) ret -= MOD;
    return ret;
}
ll mul(ll a,ll b){
    return a*b%MOD;
}
ll fpow(ll a,ll b){
    ll ret = 1;
    while (b) {
        if (b&1) ret = mul(ret,a);
        a = mul(a,a);
        b >>= 1;
    }
    return ret;
}
ll fac[MAXn],inv[MAXn];
ll H(ll a,ll b){
    ll ret = mul(fac[a+b-1],inv[b]);
    ret = mul(ret,inv[a-1]);
    return ret;
}
int main(){
    IOS();
    ll n,k;
    cin >> n >> k;
    fac[0] = 1, inv[0] = 1;
    REP1 (i,MAXn-1) {
        fac[i] = mul(fac[i-1],i);
        inv[i] = fpow(fac[i],MOD-2);
    }
    ll ans = 0;
    REP (i,min(n,k+1)) {
        ll cur = H(n-i,n-(n-i));
        cur = mul(cur,H(n-i+1,i));
        ans = add(ans,cur);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
main(){
  int N,M,g=1;
  cin>>N>>M;
  for(int i=1;i*i<=M;++i){
    if(M%i==0){
      if(N<=M/i)g=max(i,g);
      if(N<=i)g=max(M/i,g);
    }
  }
  cout<<g<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    bool can = false;
    int cntn = 0,cntw = 0,cnts = 0,cnte = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'N') cntn++;
        if(s[i] == 'W') cntw++;
        if(s[i] == 'S') cnts++;
        if(s[i] == 'E') cnte++;
    }
    if(cntn > 0 && cntw > 0 && cnts > 0 && cnte > 0){
        can = true;
    }else if(cntn > 0 && cnts > 0){
        if(cntw == 0 && cnte == 0){
            can = true;
        }
    }else if(cntw > 0 && cnte > 0){
        if(cntn == 0 && cnts == 0){
            can = true;
        }
    }
    if(can){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> A(a), B(b);
  for(int i = 0; i < a; i++){
    cin >> A[i];
  }
  for(int i = 0; i < b; i++){
    cin >> B[i];
  }
  vector<int> x(m), y(m), c(m);
  for(int i = 0; i < m; i++){
    cin >> x[i] >> y[i] >> c[i];
    x[i]--;
    y[i]--;
  }
  ll mini = 1001001001;
  for(int i = 0; i < m; i++){
    mini = min(mini, (ll)A[x[i]] + B[y[i]] - c[i]);
  }
  int minA = 1001001001, minB = 1001001001;

  for(int i = 0; i < a; i++){
    minA = min(minA, A[i]);
  }
  for(int i = 0; i < b; i++){
    minB = min(minB, B[i]);
  }
  mini = min(mini, (ll)minA + minB);
  cout << mini << "\n";
  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
	int n, i, j;
	ios::sync_with_stdio();
	string s;

	scanf("%d", &n); cin.get();
	for (i=0; i<n; i++) {
		getline(cin, s);
		
		for (j=0; j+6 < s.size(); j++) {
			if (s.substr(j, 7) == "Hoshino") s[j+6] = 'a';
		}
		
		cout << s << endl;
		
	}
	return 0;
}

Measured memory_bytes: 0
#!/usr/bin/ruby

N, K  = gets.chomp.split(" ").map(&:to_i)
H  = gets.chomp.split(" ").map(&:to_i)

H.sort!.reverse!

1.upto(K){|n|
  H.shift
}

puts H.inject(0){|sum,n| sum+n}


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

int main()
{
    string s;
    cin >> s;
    if(s[0] != 'A'){
        cout << "WA" << endl;
        return 0;
    }
    int count = 0;
    for(int i=2; i<s.size()-1; i++){
        if(s[i] == 'C') count++;
    }
    if(count != 1 || s[1] == 'C' || s[s.size()-1] == 'C'){
        cout << "WA" << endl;
        return 0;
    }
    for(int i=1; i<s.size(); i++){
        if(s[i] == 'C') continue;
        if(s[i] - 'a' >= 26 || s[i] -'a' < 0){
            cout << "WA" << endl;
            return 0;
        }
    }
    cout << "AC" << endl;
    return 0;
}


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

int main(){
    int N,M,X; cin >> N >> M >> X;
    int ans = 0;
    if(X < N/2){
        for(int i=0;i<M;i++){
            int m; cin >> m;
            if(m < X){
                ans++;
            }
        }
        cout << ans << endl;
    }else{
        for(int i=0;i<M;i++){
            int m; cin >> m;
            if(m > X){
                ans++;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define MAX 128
#define fst first
#define sec second
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define bit(n) (1LL << (n))
#define int long long
const double PI = 3.141593;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double EPS = 1e-9;
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 (b < a){a = b;return 1;}return 0;}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }     //最小公倍数
ll combination(ll n, ll r){if (r * 2 > n)r = n - r;ll dividend = 1;ll divisor = 1;for (ll i = 1; i <= r; ++i){dividend *= (n - i + 1);divisor *= i;}return dividend / divisor;}


signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int d, t, s;
  cin>>d>>t>>s;
  if(d<=s*t){
      cout<<"Yes"<<endl;
  }
  else{
      cout<<"No"<<endl;
  }
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  string p = to_string(n);
  rep(i,3){
    if(p[i] == '7'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<< endl;
}


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

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

    int ans = 0;
    for (int b = 1; b < 32; b++) {
        for (int p = 2; p < 10; p++) {
            int a = pow(b, p);
            if (a <= x) ans = max(ans, a);
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
from collections import deque

h, w = map(int, input().split())
field = []

for i in range(h):
    field.append(list(input()))

out = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            seen = [[0 for m in range(w)] for n in range(h)]
            seen[i][j] = 1
            q = deque([])
            q.append((i, j, 0))
            while q:
                (y, x, cnt) = q.popleft()
                # print(y,x)
                # print(seen)
                for ny, nx in (y, x + 1), (y, x - 1), (y + 1, x), (y - 1, x):
                    if ny < 0 or ny >= h or nx < 0 or nx >= w:
                        pass
                    elif field[ny][nx] == '.' and seen[ny][nx] == 0:
                        q.append((ny, nx, cnt + 1))
                        seen[ny][nx] = 1

            out = max(out, cnt)
print(out)


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

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

    if (a.at(a.length() - 1) == b.at(0)
        && b.at(b.length() - 1) == c.at(0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	k := getNextInt(scanner)
	a := getNextInt(scanner)
	b := getNextInt(scanner)
	for i := a; i < b+1; i++ {
		if i%k == 0 {
			fmt.Fprintln(writer, "OK")
			return
		}
	}
	fmt.Fprintln(writer, "NG")
}


Measured memory_bytes: 1800
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[10101], B[10101];
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
    ll cnt = 0;
    rep(i, 0, N) {
        if (A[i] < B[i]) {
            cnt += (B[i] - A[i]) / 2;
        } else {
            cnt -= A[i] - B[i];
        }
    }

    if (cnt < 0) return no;
    return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];
    cout << solve() << endl;
}


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

typedef long long LL;

LL n;
deque<int> ans;

int main() {
	cin >> n;
	++n;
	int cur = 0;
	for (int i = 40; i >= 0; --i) {
		if (n>>i > 1) {
			ans.push_back(++cur);
			if (n>>i&1) {
				ans.push_front(++cur);
			}
		}
	}
	cout << 2*cur << endl;
	for (deque<int>::iterator it = ans.begin(); it != ans.end(); ++it) {
		cout << *it << ' ';
	}
	for (int i = 1; i <= cur; ++i) {
		cout << i << " \n"[i == cur];
	}
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (B <= C || D <= A) {
    cout << 0 << endl;
  } else {
    cout << min(B, D) - max(A, C) << endl;
  }
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int mini = max(a, c);
  int maxi = min(b, d);
  
  if (maxi > mini) {
    cout << maxi - mini << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vvll vecror<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
 
 


void solve()
{
	ll n;
	cin>>n;
	string s=to_string(n);
	for(ll i=0;i<s.sz;i++)
	{
		if(s[i]=='7')
		{
			cout<<"Yes";
			return;
		}
	}
	cout<<"No";
 	return;
}

int main()
{
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


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

int main()
{
   int a, b;
    scanf("%d %d", &a, &b);
    
    if (a+b >= 10)
    {
        printf("error");
    }
    
    else 
    {
        printf("%d", a+b);
    }
   return 0;
}

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

int n;

double alchemist(vector<int> &v) {
    sort(v.begin(), v.end());
    double ans = v[0];
    for (int i = 1; i < n; i++) {
        ans = (ans + v[i]) / 2.0;
    }

    return ans;
}

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

    printf("%.10lf\n", alchemist(v));
    
    return 0;
}

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

string S, T;
int s_char[26], t_char[26];

int main () {

    cin >> S >> T;

    for (int i = 0; i < S.size(); i++) {
        s_char[S[i] - 'a']++;
    }
    for (int i = 0; i < T.size(); i++) {
        t_char[T[i] - 'a']++;
    }

    sort(s_char, s_char + 26);
    sort(t_char, t_char + 26);

    bool ans = true;

    for (int i = 0; i < 26; i++) {
        if (s_char[i] != t_char[i]) {
            ans = false;
            break;
        }
    }
    cout << ((ans)? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 776
/**
 *   Author: Praveen Ojha
 *   Created: 25 March 2019
 *   Time: 18:56:58
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long double ld;
typedef pair<int,int> pii;
int n;
double ph;
double dp[3005][3005]; // dp[i][j] stores probabability of getting exactly j heads upto index i.
double a[3005];

int32_t main(){__
	cin>>n;
	//vector <double> dp(n+1);
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	dp[0][0]=1;
	for(int coins=1;coins<=n;coins++){
		double p_heads=a[coins],p_tails=1-a[coins];
		for(int num_heads=0;num_heads<=coins;num_heads++){
			dp[coins][num_heads]=dp[coins-1][num_heads-1]*p_heads+dp[coins-1][num_heads]*p_tails;
		}
	}
	double ans=0;
	for(int heads=n/2+1;heads<=n;heads++){
		ans+=dp[n][heads];
	}
	cout<<setprecision(12)<<ans<<"\n";
return 0;
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    int l[60];
    for (int i = 0; i < N; i++){
        cin >> l[i];
    }

    sort(l, l+N, greater<int>());

    int length = 0;
    for (int i = 0; i < K; i++){
        length += l[i];
    }

    cout << length << endl;
    return 0;
}

Measured memory_bytes: 256
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    int n, m;
    cin>>n>>m;
    string ans = string(n, '*');
    while(m--){
        int fst, snd;
        cin>>fst>>snd;
        if(ans[fst-1] == '*')
            ans[fst-1] = snd+'0';
        else if(ans[fst-1] == (snd + '0'))
            continue;
        else{
            // cout<<ans;
            cout<<-1;
            return ;
        }
    }
    if(ans[0] == '*')
        ans[0] = ((n==1)? '0':'1');
    for(int i = 0; i < n; i++)
        if(ans[i] == '*')
            ans[i] = '0';
    if(ans[0] == '0' && n != 1)
        cout<<"-1";
    else
        cout<<ans;
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

bool d[11][11];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m;cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int u, v;
		cin>>u>>v;
		u--; v--;
		d[u][v]=1;
		d[v][u]=1;
	}
	vi perm(n);
	for(int i =0;i<n;i++)
	{
		perm[i]=i;
	}
	int ans = 0;

	do
	{
		bool pos=1;
		for(int i = 0; i < n - 1; i++)
		{
			if(!d[perm[i]][perm[i+1]])
			{
				pos=0;
				break;
			}
		}
		if(pos) ans++;
	}while(next_permutation(perm.begin()+1,perm.end()));
	cout<<ans<<'\n';
}


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

const int MAX_E=1e6+10;

int e,ans;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> e,e){
        ans=MAX_E;
        for (int z=0;z*z*z<=e;++z)
            for (int y=0;y*y+z*z*z<=e;++y)
                ans=min(ans,(e-y*y-z*z*z)+y+z);
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,x; cin>>n>>x;
	vector<int> v(n);
	for(auto &i:v) cin>>i;
	int now=0,cnt=1;
	for(auto &i:v)
	{
		now+=i;
		if(now<=x) cnt++;
	}
	cout<<cnt<<"\n";
	return 0;
}















Measured memory_bytes: 256