akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int k,n;
  cin >> n >> k;
  vector<double> p(n);
  vector<double> e(n), sum(n+1);
  rep(i, n) {
    cin >> p[i];
    e[i] = p[i] * (p[i]+1) / 2;
    e[i] = e[i] / p[i];
    sum[i+1] = sum[i] + e[i];
    //cout << e[i] << " " << sum[i+1] << endl;
  }
  cout << setprecision(15) << fixed;
  double ans = 0.0;
  for (int i = 0; i <= n-k; ++i) {
    chmax(ans, sum[i+k]-sum[i]);
  }
  cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A.at(i);
  sort(A.begin(),A.end());
  int count=1;
  for(int i=0;i<N-1;i++){
    if(A.at(i+1)==A.at(i)) continue;
    else count++;
  }
  cout << count << endl;
}


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

using namespace std;

int main(){
        string s[100];
        for(int i=0;i<100;i++){
                if(i<50){
                        for(int j=0;j<100;j++){
                                s[i]+='.';
                        }
                }
                else{
                        for(int j=0;j<100;j++){
                                s[i]+='#';
                        }
                }
        }
        int a, b, aa=1, bb=1;
        cin>>a>>b;
        int x=1, y=0;
        while(bb<b){
                s[y][x]='#';
                x+=2;
                if(x==99){
                        x=1;
                        y+=2;
                }
                bb++;
        }
        x=0;
        y=99;
        while(aa<a){
                s[y][x]='.';
                x+=2;
                if(x==98){
                        x=0;
                        y-=2;
                }
                aa++;
        }
        cout<<100<<" "<<100<<endl;
        for(int i=0;i<100;i++){
                cout<<s[i]<<endl;
        }
        return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<string> s(n);
    REP(i,n)cin >> s[i];
    int32 ans = 0;
    REP(d,n){
        bool good = true;
        REP(i,n){
            REP(j,n){
                if(i == j)break;
                // cout << d << " " << i << " " << j << endl;
                if(s[(i+d)%n][j] != s[(j+d)%n][i]){
                    // cout << s[(i+d)%n][j] << " " << s[(j+d)%n][i] << endl;
                    good = false;
                    break;
                }
            }
            if(!good)break;
        }
        if(good)ans += n;
        // cout << d << " " << ans << endl;
    }
    ANS(ans);
    return 0;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


int main() {
  string s,t;cin >> s >> t;
  cout << t+s;
}

Measured memory_bytes: 256
/*input
10 39
7 2
7 1
5 6
5 8
9 10
2 8
8 7
3 10
10 1
8 10
2 3
7 4
3 9
4 10
3 4
6 1
6 7
9 5
9 7
6 9
9 4
4 6
7 5
8 3
2 5
9 2
10 7
8 6
8 9
7 3
5 3
4 5
6 3
2 10
5 10
4 2
6 2
8 4
10 6
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX 1010
#define INF 0x3f3f3f3f

int n , m , p[MAX][MAX] , use[MAX] , v1 = 0 , v2 = 0;
vector<int> v[MAX];
void DFS(int now , int col){
    // cout << now << endl;
    if(col == 1) v1 ++;
    if(col == 2) v2 ++;
    use[now] = col;
    for(auto to : v[now]){
        if(use[to] == 0) DFS(to , 3 - col);
        else if(use[to] == col){
            cout << -1 << endl;
            exit(0);
        }
    }
}
int dp[MAX];
int32_t main(){
    IOS;
    cin >> n >> m;
    REP(i , 1 , m + 1){
        int a , b;
        cin >> a >> b;
        p[a][b] = p[b][a] = 1;
    }
    REP(i , 1 , n + 1) REP(j , i + 1 , n + 1) if(p[i][j] == 0) v[i].pb(j) , v[j].pb(i);
    int base = 0 , ans = INF;
    dp[0] = 1;
    REP(i , 1 , n + 1) if(use[i] == 0){
        v1 = 0 , v2 = 0;
        DFS(i , 1);
        int sml = min(v1 , v2) , big = max(v1 , v2);
        base += sml;
        RREP(j , n , 0) if(dp[j] == 1) dp[j + big - sml] = 1;
    }
    REP(i , 0 , n + 1){
        if(dp[i] == 0) continue;
        int aa = base + i , bb = n - aa;
        int val = aa * (aa - 1) / 2 + bb * (bb - 1) / 2;
        ans = min(ans , val);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
using namespace std;
string output(int n,char A){
    string ans="";
    for (int i = 0; i < n; i++) {
        ans+=A;
    }
    return ans;
}
int main(void){
    // Your code here!
    int sx,sy,tx,ty;
    std::cin >> sx >>sy >>tx >>ty;
    int x=tx-sx,y=ty-sy;
    string ans="";
    ans+=output(y,'U');
    ans+=output(x,'R');
    
    ans+=output(y,'D');
    ans+=output(x,'L');
    
    ans+=output(1,'L');
    ans+=output(y+1,'U');
    ans+=output(x+1,'R');
    ans+=output(1,'D');
    
    ans+=output(1,'R');
    ans+=output(y+1,'D');
    ans+=output(x+1,'L');
    ans+=output(1,'U');
    
    std::cout << ans << std::endl;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class  Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		
      if(a < 9 && b <9 ){
 		System.out.println("Yay!");}
      else{
      	System.out.println(":(");
      }
		sc.close();
    }
}

Measured memory_bytes: 23252
from bisect import*
a,b,q=map(int,input().split())
s=[-10**18]+[int(input()) for _ in range(a)]+[10**18]
t=[-10**18]+[int(input()) for _ in range(b)]+[10**18]
for _ in range(q):
  i=int(input())
  si=bisect_left(s,i)
  ti=bisect_left(t,i)
  print(min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1]))

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

#define ll                                 long long
#define mp                                 make_pair
#define pb                                 push_back
#define pii                              pair<long long,long long>
#define vi                                 vector<long long>
#define setbits(x)                          __builtin_popcountll(x)
#define zrobits(x)                          __builtin_ctzll(x)
#define mod                              1000000007
#define inf                               1e18
#define make_array(array_name,array_size,type)   type array_name[array_size];
#define print_array(array_name,array_size)        for(int i=0;i<n;i++){cout<<array_name[i]<<" ";}cout<<endl;
#define input_array(array_name,array_size)       for(int i=0;i<n;i++){cin>>array_name[i];}

long long binexpo(long long a, long long b)
{
   long long res = 1;
   while (b > 0)
   {
      if (b & 1)
         res = res * a;
      a = a * a;
      b >>= 1;
   }
   return res;
}

void initialize()
{
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cout.tie(nullptr);
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
}
int main()
{
   initialize();

   ll n, a, b;
   cin >> n >> a >> b;
   string str;
   cin >> str;
   ll curr = 0, rank = 0;
   for (int i = 0; i < n; i++)
   {
      if (str[i] == 'c')
         cout << "No" << endl;
      else if (str[i] == 'a')
      {
         if (curr < (a + b))
         {
            cout << "Yes" << endl;
            curr++;
         }
         else
         {
            cout << "No" << endl;
         }
      }
      else
      {
         if (str[i] == 'b')
         {
            if (curr < (a + b) && rank < b) {
               cout << "Yes" << endl;
               curr++; rank++;
            }
            else
               cout << "No" << endl;
         }
      }
   }

   return 0;
}

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

long long n, k;

long double solve();

int main() {
  cout << fixed << setprecision(12);
  cin >> n >> k;

  cout << solve() << endl;
  return 0;
}

long double solve() {
  long double ans = 0;
  for(int i = 1; i <= n; ++i) {
    long long now = i, cnt = 0;
    while(now <= k - 1) {
      ++cnt;
      now *= 2;
    }
    ans += 1.0 / (1LL << cnt);
  }
  return ans / n;
}

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

int main(){
    
    for(int h, w; cin >> h >> w, h;){
        int mp[10][10];
        for(int y = 0; y < h; y++){
            for(int x = 0; x < w; x++){
                cin >> mp[y][x];
            }
        }
        int ans = 0;
        for(int y1 = 0; y1 < h; y1++){
            for(int x1 = 0; x1 < w; x1++){
                for(int y2 = y1 + 2; y2 < h; y2++){
                    for(int x2 = x1 + 2; x2 < w; x2++){
                        int mn = 9;
                        for(int x = x1; x <= x2; x++){
                            mn = min(mn, mp[y1][x]);
                            mn = min(mn, mp[y2][x]);
                        }
                        for(int y = y1; y <= y2; y++){
                            mn = min(mn, mp[y][x1]);
                            mn = min(mn, mp[y][x2]);
                        }
                        int cnt[10] = {};
                        for(int y = y1 + 1; y < y2; y++){
                            for(int x = x1 + 1; x < x2; x++){
                                cnt[mp[y][x]]++;
                            }
                        }
                        int tmp = 0;
                        for(int i = 0; i <= 9; i++){
                            if(cnt[i]){
                                if(mn <= i)tmp -= 1000000;
                                else tmp += cnt[i] * (mn - i);
                            }
                        }
                        ans = max(ans, tmp);
                    }
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n, k, sum = 0;
  cin >> n >> k;
  int l[n];
  rep(i, n) cin >> l[i];
  sort(l, l + n, greater<int>());
  rep(i, k) { sum += l[i]; }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i =0;i<n;i++)
		cin>>a[i];
	int count = 1;
	int min = a[0];
	for(int i =1;i<n;i++)
	{
		if(a[i]<min)
		{
			count++;
			min=a[i];
		}
	}
	cout<<count<<'\n';
}


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

int main(void){
    int n,k;
    cin >> n >> k;

    double pro = 0;
    for(int i=1;i<=n;i++){
        int deg = 0;
        int tmp = i;
        while(tmp<k){
            tmp*=2;
            deg++;
        }
        double proinv = n*pow(2,deg);
        pro += 1.0/proinv;
    }
    printf("%.15f\n", pro);
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

vector<string> directions = {"NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW","N"};
vector<double> degrees;
vector<double> velocity = {0.0, 0.25, 1.55, 3.35, 5.45, 7.95, 10.75, 13.85, 17.15,
						   20.75, 24.45, 28.45, 32.65, 12001./60.};

void solve()
{	
	int n,a,b; cin >> n >> a >> b;
	string s; cin >> s;
	int tot = 0, b_n = 0;
	vector<string> ans;
	rep(i,sz(s))
	{
		if(s[i] == 'a')
		{
			if(tot < a + b)	{ans.push_back("Yes");tot++;}
			else ans.push_back("No");
		}
		else if (s[i] == 'b')
		{
			if(tot < a + b && b_n < b) {ans.push_back("Yes");tot++;}
			else ans.push_back("No");
			b_n++;
		}
		else ans.push_back("No");
	}
	rep(i,sz(s))cout << ans[i] << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

vector<long long> vec;
unordered_map<long long, int> st;
int n;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (auto i = 0, x = 0; i < n; i++) {
		cin >> x;
		vec.push_back(x);
	}
	for (auto i = 1; i < n; i++)
		vec[i] += vec[i-1];
	st[0]++;
	long long ans = 0;
	for (auto i : vec) {
		ans += st[i];
		st[i]++;
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;

#define        optimize           ios::sync_with_stdio(0); cin.tie(0);
#define PI    acos(-1.0)
#define pb push_back
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define RESET(a, b) memset(a, b, sizeof(a))
#define pii pair <int, int>
#define pll pair <ll, ll>
#define gcd(a, b) __gcd(a, b)

#define        MX        100005

int dp[MX];
int ara[MX];

int main()
{
    optimize
    int n, k;
    cin>>n>>k;

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

    dp[1] = 0;
    for(int i = 2; i <= n; i++){
        for(int j = 1; j <= k && i-j > 0; j++){

            if(j == 1) dp[i] = dp[i-j] + abs(ara[i]-ara[i-j]);
            else dp[i] = min(dp[i], dp[i-j] + abs(ara[i]-ara[i-j]));

        }
    }

    cout<<dp[n]<<endl;
}


Measured memory_bytes: 4424
// Problem : D - Lunlun Number
// Contest : AtCoder - AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#define lli long long int
#define pb push_back
#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define rep(i,a,n) for(i=a;i<n;i++)
#define all(v) (v.begin(),v.end())
#define ppb pop_back
#define vsz v.size()
#define pi 3.141592653589793238
using namespace std;
int main()
{
	cio;
	lli t,k,n=0,i;
	cin>>k;
	vector<lli>v;
	rep(i,1,10) v.pb(i);
	while(v.size()<k){
		t=v[n];
		if(t%10==0){
			v.pb(t*10);
			v.pb(t*10+1);
		}
		else if(t%10==9){
			v.pb(t*10+8);
			v.pb(t*10+9);
		}
		else{
			v.pb(t*10+t%10-1);
			v.pb(t*10+t%10);
			v.pb(t*10+t%10+1);
		}
		n++;
	}
	cout<<v[k-1];
	
	return 0;
}

Measured memory_bytes: 4280
#
# abc072 b
#
import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    s = input()

    ans = ""
    for i in range(len(s)):
        if (i+1) % 2 == 1:
            ans += s[i]
    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """atcoder"""
        output = """acdr"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """aaaa"""
        output = """aa"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """z"""
        output = """z"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """fukuokayamaguchi"""
        output = """fkoaaauh"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()
    resolve()


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

int each_digits_sum(int n){
  int sum = 0;

  while(n>0){
    sum += n%10;
    n /= 10;
  }

  return sum;
}

int main() {
  int n,a,b,tempN,total=0;

  cin >> n >> a >> b;

  Rep(i,n){
    tempN = each_digits_sum(i);
    if(a <= tempN && tempN <= b)
      total += i;
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(){
	
	int x1,y1,x2,y2,x3,y3,x4,y4;
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	x3=x2-(y2-y1);
	y3=y2+(x2-x1);
	x4=x1+(y1-y2);
	y4=y1+(x2-x1);
	printf("%d %d %d %d\n",x3,y3,x4,y4);
	return 0;
}

Measured memory_bytes: 384
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;

int main(){
	int n;
  	string s;
  	cin >> n >> s;
  	if(n>=3200){
      cout <<s << endl;
    }else{
      cout << "red" <<endl;
    }
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;
use std::f64::consts::PI;

fn main() {
    input! {
        a: f64, b: f64,
        h: f64, m: f64,
    }
    let rad = 2.0 * (PI * (h * 60.0 + m) / 60.0 / 12.0 - PI * m / 60.0);
    // println!("{}", 360.0 * rad / 2.0 / PI);
    let l1 = b - a * rad.cos();
    let l2 = a * rad.sin();
    println!("{}", (l1 * l1 + l2 * l2).sqrt());
}


Measured memory_bytes: 2916
n = int(input())
if n % 4 == 0 or n % 7 == 0:
    print("Yes")
else:
    flag = True
    while flag:
        if n > 7:
            n -= 7
        else:
            if n % 4 == 0:
                print("Yes")
                flag = False
            else:
                print("No")
                flag = False
        if n % 4 == 0 or n % 7 == 0:
            print("Yes")
            flag = False


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
#define lglg long long
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define ROF(i, b, a) for (int i=(b); i>(a); --i)
#define CASET int _T; cin >> _T; REP(caset, 0, _T)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define vpii vector<pii>
#define vt3i vector<t3i>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)

long long INF = 1LL<<60;
long long MOD = 998244353;

template <typename A, typename B> istream &operator>>(istream &is, pair<A, B> &pr) {is >> pr.first >> pr.second; return is;}
template <typename A> istream &operator>>(istream &is, vector<A> &v) {for (auto &x : v) is >> x; return is;}
ostream &operator<<(ostream &os, char &c) {os << (char)c; return os;}
ostream &operator<<(ostream &os, const char s[]) {os << (string)s; return os;}
ostream &operator<<(ostream &os, string &s) {for (char &c : s) os << (char)c; return os;}
template <typename A, typename B> ostream &operator<<(ostream &os, pair<A, B> &pr) {os << '(' << pr.first << ", " << pr.second << ')'; return os;}
ostream &operator<<(ostream &os, vb &v) {
    bool first = true;
    os << '[';
    for (const bool &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
template <class C> ostream &operator<<(ostream &os, C &v) {
    bool first = true;
    os << '[';
    for (auto &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
string bin_string(int x) {
    const int d = 32;
    string res(d, ' ');
    FOR(i, 0, d) res[d-1-i] = '0'+(x>>i & 1LL);
    return res;
}
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    int n;
    cin >> n;
    set<int> a;
    FOR(i, 0, n) {
        int x;
        cin >> x;
        a.insert(x);
    }
    if (a.size() == n) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 9600
num = input()

def yymmChecker(num):
    mm = int(num[2:])
    if int(mm) >=1 and int(mm) <= 12:
        return True
    else :
        return False
    
def mmyyChecker(num):
    mm = int(num[:2])
    if int(mm) >=1 and int(mm) <= 12:
        return True
    else :
        return False

yymm_flag = yymmChecker(num)
mmyy_flag = mmyyChecker(num)

if yymm_flag and mmyy_flag:
    print('AMBIGUOUS')
elif yymm_flag and not mmyy_flag:
    print('YYMM')
elif not yymm_flag and mmyy_flag:
    print('MMYY')
else :
    print('NA')


Measured memory_bytes: 3064
//file_name:ABC72_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    string s;
    cin >> s;

    rep(i,s.size()){
        if(i%2==0){
            cout << s[i];
        }
    }
    cout << endl;

    return 0;
}



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

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=1000000007;

const int N=60;
vector<int> adj[N];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    fastio;
    ll n;cin>>n;
    ll a[n],b[n];
    rep(i,0,n-1)cin>>b[i];
    a[0]=b[0];
    rep(i,1,n-1)
    a[i]=min(b[i],b[i-1]);
    a[n-1]=b[n-2];

    ll ans=0;
    rep(i,0,n)ans+=a[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define popb(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  int a[3]={};
  
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  cout<<a[0]+a[1]<<endl;

}


Measured memory_bytes: 256
a,b,M=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())
xyc=[list(map(int,input().split()))for _ in range(M)]

ans=min(A)+min(B)
for x,y,c in xyc:
    ans=min(ans,A[x-1]+B[y-1]-c)
print(ans)

Measured memory_bytes: 38832
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());


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

    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int cnt = 0;
    while ((1 << cnt) * b <= a) {
        cnt++;
    }
    b *= (1 << cnt);
    k -= cnt;
    cnt = 0;
    while ((1 << cnt) * c <= b) {
        cnt++;
    }
    k -= cnt;
    if (k >= 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 3552
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

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

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pair<string,int> > res(n+1);
	vector<int> rank(n+1);
	reps(i,n){
		cin >> res[i].first >> res[i].second;
	}
	reps(i,n){
		int cnt = 1;
		reps(j,n){
			if(i == j) continue;
			if(res[i].first > res[j].first){
				++cnt;
			}
			if(res[i].first == res[j].first && res[i].second < res[j].second){
				++cnt;
			}
		}
		rank[cnt] = i;
	}
	reps(i,n){
		cout << rank[i] << '\n';
	}
	return 0;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
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 (b<a) {a=b; return 1;} return 0;}
const int INF = INT_MAX;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

bool dp[100010];

void solve(int N, int K, vi a){
    int a_min = MIN(a);

    memset(dp, false, sizeof(dp));
    reps(i, K) {
        if (i < a_min) continue;
        rep(j, N) {
            if (i-a[j] >= 0 && !dp[i-a[j]]) {
                dp[i] = true;
                continue;
            }
        }
    }
    if (dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;
}

int main(){
    int N;
    scanf("%d",&N);
    int K;
    scanf("%d",&K);
    vi a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&a[i]);
    }
    solve(N, K, std::move(a));
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> tableA(N),tableB(N),tableC(N);
  int sum =0;
  
  for(int i=0;i<N;i++)
     cin >> tableA.at(i);
  for(int i=0;i<N;i++){
     cin >> tableB.at(i);
  	 sum += tableB.at(i);
  }
  for(int i=0;i<N;i++)
     cin >> tableC.at(i);
  
  for(int i=0;i<N;i++){
    int x = tableA.at(i);
  	if(i>0 && x==tableA.at(i-1)+1)
      sum += tableC.at(tableA.at(i-1)-1);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define mod(p) ((p)%1000000007)
using namespace std;
const int INF=1e17+5;
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn],ans,sum;
vector<int>t[maxn],g[maxn];
int root;
int zu[maxn];
int get(int x)
{
    if(zu[x]==root)return m-g[zu[x]].size();
    if(x==root)return m;
    return m-g[zu[x]].size()-1;
}
void dfs(int x,int from)
{
    ans=mod(ans*get(x));
    for(auto i:t[x])
    {
        if(i==from)continue;
        zu[i]=x;
        g[x].push_back(i);
        dfs(i,x);
    }
}
int32_t main()
{
    IOS;
    ans=1;
    cin>>n>>m;
    fu(i,1,n-1)
    {
        int x,y;
        cin>>x>>y;
        t[x].push_back(y);
        t[y].push_back(x);
        root=x;
    }
    zu[root]=0;
    dfs(root,0);

    cout<<ans;
    return 0;
}


Measured memory_bytes: 17280
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  int N;
  cin >> N;
  vector <P> D(N);
  rep(i,N) cin >> D[i].first >> D[i].second;
  bool ans = false;
  rep(i,N-2){
    if (D[i].first == D[i].second && D[i+1].first == D[i+1].second && D[i+2].first == D[i+2].second){
      ans = true;
    }
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
/*
** dfs 遍历图
*/

# include <cstdio>
# include <cstring>
# include <stack>
using namespace std;

const int MAX = 100 + 2;

int g[MAX][MAX], d[MAX], f[MAX], c[MAX], n, t;

void init() {
    memset(g, 0, sizeof(g));
    memset(d, 0, sizeof(d));
    // memset(f, 0, sizeof(f));
    memset(c, 0, sizeof(c));
    scanf("%d", &n);
    int u, v, k;
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", &u, &k);
        while (k--) {
            scanf("%d", &v);
            g[u][v] = 1;
        }
    }

    t = 0;
}

void dfs(int u) {
    t++;
    stack<int> s;
    s.push(u);
    int node;
    d[u] = t;
    c[u] = 1;

    while(!s.empty()) {
        t++;
        node = s.top();
        int p = 1;
        for (; p <= n; p++) {
            if (g[node][p] != 0 && c[p] == 0) {
                s.push(p);
                d[p] = t;
                c[p] = 1;
                break;
            }
        }
        if (p > n) {
            f[node] = t;
            s.pop();
        }
    }
}

void solve() {
    init();
    for (int i = 1; i <= n; i++) {
        if (c[i] == 0) {
            dfs(i);
        }
    }
    for (int i = 1; i <= n; i++) {
        printf("%d %d %d\n", i, d[i], f[i]);
    }
}

int main() {
    // freopen("infile", "r", stdin);
    // freopen("outfile", "w", stdout);
    solve();
    return 0;
}



Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

i64 N;
vector<i64> a;
int main(){
  cin >> N;
  a.resize(N);
  i64 sum = 0;
  rep(i,0,N - 1){
    cin >> a[i];
    sum += a[i];
  }

  if(sum % (N * (N + 1) / 2) != 0){
    cout << "NO" << endl;
    return 0;
  }

  i64 need = sum / (N * (N + 1) / 2);

  rep(i,0,N - 1){
    int j = (i + 1) % N;
    i64 d = a[j] - a[i] - need;
    if(0 < d || d % N != 0){
      cout << "NO" << endl;
      return 0;
    }
  }

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


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

#define vi vector<int>
#define vvi vector<vi>

const int INF = 1e9 + 5;

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

    long long n,k;
    cin >> n >> k;
    vi cities(n+1, 0);
    for(int i = 1; i <= n; i++){
        cin >> cities[i];
    }
    vi visited(n+1, 0);
    visited[1] = 1;
    int loop = 1;
    int start = -1;
    int city = cities[1];

    if(k > n){
        while(visited[city] != 1){
            loop++;
            visited[city] = 1;
            city = cities[city];
        }
        if(visited[city] == 1){
            start = city;
        }
        int loop2 = 1;
        city = cities[start];
        while(city != start){
            city = cities[city];
            // cout << city << "\n";
            loop2++;
        }
        k = k - (loop - loop2);
        int steps = k % loop2;
    
        if(steps > 0){
            city = cities[start];
        }else{
            city = start;
        }
        while(steps > 1){
            city = cities[city];
            steps--;
        }
        cout << city;
    }else{
        while(k > 1){
            city = cities[city];
            k--;
        }
        cout << city;
    }

    
   


    return 0;
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    map<int,int>m;
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    for(int i=0;i<n;i++)
    {
        int temp=a[i];
        m[a[i]]--;
        if(!m[a[i]])
            m.erase(a[i]);
        cout<<m.rbegin()->first<<"\n";
        m[a[i]]++;
    }
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >>N>>K;
  vector<int> num(N);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    num.at(a-1)++;
  }
  sort(num.begin(),num.end());
  int non=0;
  for(int i=0;i<N;i++){
    if(num.at(i)==0) non++;
    else break;
  }
  int need=N-non-K;
  int ans=0;
  for(int i=non;i<non+need;i++){
    ans+=num.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    readLine()!!.toInt()
    val xs = readLine()!!.split(' ').map(String::toInt)
    var counter = 0
    for (x in xs) {
        var a = x
        while (a % 2 == 0) {
            a /= 2
            counter++
        }
    }
    println(counter)
}

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

typedef long long ll;

const int INF = 1e9;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N+5);
    for (int i = 0; i < N; i++) cin >> h[i];
    vector<int> dp(N+5,INF);
    dp[0] = 0;
    for (int i=0;i<N;i++){
        for (int k=1;k<=K;k++){
            if (i+k <= N) {
                dp[i+k] = min(dp[i+k],dp[i] + abs(h[i+k]-h[i]));
            }
        }
    }
    int ans = dp[N-1];

    cout << ans << "\n";
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int e1 = Integer.parseInt(scanner.next());
        int e2 = Integer.parseInt(scanner.next());
        int e3 = Integer.parseInt(scanner.next());
        int e4 = Integer.parseInt(scanner.next());

        if (e1 == e2) {
            if (e3 == e4) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        } else if (e1 == e3) {
            if (e2 == e4) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        } else if (e1 == e4) {
            if (e2 == e3) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        } else {
            System.out.println("no");
        }
    }
}



Measured memory_bytes: 26120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll n,a,b,c,d,e;
ll mn = 1e16;
int main(){
    cin >> n >> a >> b >> c >> d >> e;
    ll num;
    mn = min(mn,min(a,min(b,min(c,min(d,e)))));
    if(n % mn == 0) num = (n/mn);
    else num = (n/mn) + 1;
    cout << num + 4 << endl;
}



Measured memory_bytes: 256
INF = 10 ** 10
v, e = map(int, input().split())
adj = [[INF] * v for _ in range(v)]
for _ in range(e):
    s, t, d = map(int, input().split())
    adj[s][t] = d

mem = {}
end = 2 ** v - 1
def minCost(state, pos):
    if (state, pos) in mem:
        return mem[(state, pos)]

    if state == end:
        return adj[pos][0]

    mask = 1
    ret = INF
    for to in range(v):
        if mask & state:
            mask <<= 1
            continue

        ret = min(ret, adj[pos][to] + minCost(state | mask, to))
        mask <<= 1

    mem[(state, pos)] = ret
    return ret

result = minCost(1, 0)
if result >= INF:
    print(-1)
else:
    print(result)


Measured memory_bytes: 25176
#include<iostream>
#include<tuple>
#include<algorithm>
#include<queue>
#include<functional>
#include<map>
#include<vector>

using namespace std;
typedef tuple<int, int, int> Ti3;
typedef pair<int, int> P;

struct Edge {
	P to;
	int cost;
	Edge(P a, int b) { to = a, cost = b; }
};

map<P, vector<Edge>> E;
map<P, int> dis;

const int geta = 114514;//全部下駄はかせる

int N, M;

void djk(int s) {
	priority_queue<Ti3, vector<Ti3>, greater<Ti3>> pq;
	pq.push(Ti3(geta, s, -1));
	dis[P(s, -1)] = geta;

	while (pq.size()) {
		auto now = pq.top(); pq.pop();
		int pos = get<1>(now);
		int totalcost = get<0>(now);
		int bline = get<2>(now);
		if (dis[P(pos, bline)] < totalcost)continue;

		for (int i = 0; i < E[P(pos, bline)].size(); i++) {
			P nxt = E[P(pos, bline)][i].to;
			int cost = E[P(pos, bline)][i].cost;
			
			if (dis[nxt] == 0 || (dis[nxt] > totalcost + cost)) {
			
				dis[nxt] = totalcost + cost;
				pq.push(Ti3(dis[nxt], nxt.first, nxt.second));
			}

		}
	}

}

int main() {
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		E[P(a, -1)].push_back(Edge(P(a, c), +1));
		E[P(a, c)].push_back(Edge(P(a, -1), 0));
		E[P(b, -1)].push_back(Edge(P(b, c), +1));
		E[P(b, c)].push_back(Edge(P(b, -1), 0));
		E[P(a, c)].push_back(Edge(P(b, c), 0));
		E[P(b, c)].push_back(Edge(P(a, c), 0));
	}

	djk(0);

	if (dis[P(N - 1, -1)] == 0)cout << -1 << endl;
	else cout << dis[P(N - 1, -1)] - geta << endl;

	return 0;
}

Measured memory_bytes: 92080
#include<bits/stdc++.h>
using namespace std;
const int mod=1000003;
int add(int a,int b){
    a+=b; return a>=mod?a-mod:mod;
}
int sub(int a,int b){
    a-=b; return a<0?a+mod:a;
}
int mul(int a,int b){
    return (int)((1ll*a*b)%mod);
}
int power(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
            res=mul(res,a);
        }
        a=mul(a,a);
        b>>=1;
    }
    return res;
}
int t,n,x,y,d,pre[mod+5];

int main(){
    scanf("%d",&t);
    pre[1]=1;
    for(int i=2;i<mod;i++){
        pre[i]=mul(pre[i-1],i);
    }
    int s;
    while(t--){
        scanf("%d%d%d",&x,&d,&n);
        if(d==0){
            printf("%d\n",power(x,n));
            continue;
        }
        int ans=1;
        ans=mul(ans,power(d,n));
        s=mul(x,power(d,mod-2));
        if(s+(n-1)>=mod){
            printf("0\n");
            continue;
        }
        if(s==1){
            printf("%d\n",mul(ans,pre[s+n-1]));
            continue;
        }
        printf("%d\n",mul(ans,mul(pre[s+n-1],power(pre[s-1],mod-2))));
        //product from x(x+d)...(x+(n-1)*d)
        //d^n (x/d)(x/d+1)....(x/d+(n-1))
    }

}


Measured memory_bytes: 4736
#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>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(void){
  int n;

  while(cin >> n && n){
    string str;
    cin >> str;
    int a,b;
    vector<pair<int,int> > encrypt;

    for(int i=0;i<n;i++){
      cin >> a >> b;
      encrypt.PB(MP(a-1,b-1));
    }

    for(int i=n-1;i>=0;i--){
      int diff = encrypt[i].second - encrypt[i].first;
      int x,y;

      x = str[encrypt[i].first];
      y = str[encrypt[i].second];


      x += diff;
      y += diff;
      
      while(!('a' <= x && x <= 'z')){
	x -= 'z' - 'a' + 1;
      }
      while(!('a' <= y && y <= 'z')){
	y -= 'z' - 'a' + 1;
      }
      str[encrypt[i].first] = x;
      str[encrypt[i].second] = y;

      swap(str[encrypt[i].first],str[encrypt[i].second]);
    }
    cout << str << endl;
  }
}

Measured memory_bytes: 0
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import random


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
MEIJI = [[0] * W for i in range(H)]

for i in range(H):
    a = input()
    for j in range(len(a)):
        if a[j] == "#":
            MEIJI[i][j] = 1


def findStart():
    for x in range(H):
        for y in range(W):
            if MEIJI[x][y] == 0:
                return x, y

    return False


def bfs(H, W, sx, sy):
    if MEIJI[sx][sy] == 1:
        return 0, 0, 0, -1
    d = [[-1] * W for i in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque([])
    q.append((sx, sy))
    d[sx][sy] = 0

    mx = -1
    gx, gy = -1, -1
    while(len(q) != 0):
        x, y = q.popleft()

        for i in range(4):
            nx, ny = x + dx[i], y + dy[i]

            if (0 <= nx and nx <= (H-1) and 0 <= ny and ny <= (W-1) and MEIJI[nx][ny] == 0 and d[nx][ny] == -1):
                q.append((nx, ny))
                l = d[x][y] + 1
                d[nx][ny] = l

                if l > mx:
                    gx, gy = nx, ny
                    mx = l
    return d, gx, gy, mx


mx = 0
for x in range(H):
    for y in range(W):
        _, _, _, l = bfs(H, W, x, y)
        if l > mx:
            mx = l

print(mx)
exit()

sx, sy = findStart()
_, x, y, _ = bfs(H, W, sx, sy)
_, _, _, l = bfs(H, W, x, y)

if l < 0:
    l = 0

print(l)


Measured memory_bytes: 13224