akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
ll dp[405][405],a[405];
ll sum(ll x,ll y)
{
	ll d=0;
	repi(i,x,y)
	d+=a[i];
	return d;
}
ll f(ll st,ll ed)
{
	if(st>ed)
	return 1000000000000000;
	if(st==ed)
	return dp[st][ed]=0;
	if(dp[st][ed]!=-1)
	return dp[st][ed];
	ll ans=1000000000000000,b;
	repi(i,st,ed-1)
	{
		ans=min(ans,f(st,i)+f(i+1,ed)+sum(st,ed));
	}
	return dp[st][ed]=ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	cout<<setprecision(12)<<fixed;
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,k,l,m,first,last,n;
    	cin>>n;
    	vec v;
    	rep(i,0,n)
    	cin>>a[i];
		repi(i,0,n)
		repi(j,0,n)
		dp[i][j]=-1;
    	cout<<f(0,n-1);
	}
	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


int get_time(int a, int b) {
	if(a>b)swap(a,b);
	if(a+20<b)return b;
	else {
		return (a+b+20)/2;
	}
}

int main() {
	int N;cin>>N;
	vector<pair<int,int>>coors(N);
	vector<pair<int,int>>real_coors(N);
	for (int i = 0; i < N; ++i) {
		int x,y;cin>>x>>y;
		x+=1e8+1000;
		y+=1e8+1000;
		x*=2;
		y*=2;
		coors[i]=make_pair(x-y,x+y);
		real_coors[i]=make_pair(x,y);
	}
	int u=1e9;
	int d=-1e9;
	int l=1e9;
	int r=-1e9;
	for (auto co : coors) {
		u=min(u,co.second);
		d=max(d,co.second);
		l=min(l,co.first);
		r=max(r,co.first);
	}

	int c_x=(l+r)/2;
	int c_y=(d+u)/2;

	int real_c_x=(c_x+c_y)/2;
	int real_c_y=(c_y-c_x)/2;

	{
		int real_c_l=(real_c_x)/20*20-20;
		int real_c_u=(real_c_y)/20*20-20;
		int real_c_d=(real_c_u)+20;

		
		int ans=1e9;
		for(int dx=0;dx<=60;++dx){
			for (int dy = 0; dy <= 60; ++dy) {
				if (dx%20==0||dy%20==0) {

					int nx=real_c_l+dx;
					int ny=real_c_u+dy;
					int nans=0;
					bool flag=(dx%20==0&&dy%20==0);
					for (auto rc : real_coors) {

						int x_cost;
						if (ny!=rc.second&&!flag&&rc.first/20 == nx / 20) {
							int a=rc.first%20;
							int b=nx%20;
							x_cost=min(a+b,40-a-b);
						}
						else {
							x_cost=abs(rc.first-nx);
						}
						int y_cost;
						if (nx!=rc.first&&!flag&&rc.second / 20 ==ny / 20) {
							int a = ny % 20;
							int b = rc.second % 20;
							y_cost = min(a + b, 40 - a - b);
						}
						else {
							y_cost = abs(rc.second - ny);
						}
						nans=max(nans,x_cost+y_cost);
					}
					ans=min(ans,nans);
				}
			}
		}
		cout<<setprecision(10)<<fixed<<double(ans)/2<<endl;
	}


	return 0;
}


Measured memory_bytes: 3420
//こういう問題もdpで前から決めてけばいいのか画期的だ
//dpみたいな問題好きだなあ

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define INF 1000000000

int main(){
  int n,m;cin >> n >> m;
  vector<int> dp(n+1,INF);dp[0]=0;
  vector<int> c(m,0);for(int i=0;i<m;i++){cin >> c[i];}
  //何枚使ったか(最低)を記録
  for(int i=0;i<m;i++){
    for(int j=0;j<n+1;j++){
      if(dp[j]!=INF && j+c[i]<n+1){
        dp[j+c[i]]=min(dp[j+c[i]],dp[j]+1);
      }
    }
  }
  cout << dp[n] << endl;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    vector<ll> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    ll ans = -1e18;
    for (int i = 0; i < n; i++) {
        vector<ll> a(1, c[i]);
        int j = i;
        while (p[j] != i) {
            a.emplace_back(c[p[j]]);
            j = p[j];
        }
        ll all = accumulate(a.begin(), a.end(), 0LL);
        all = max(all, 0LL);
        ll sub = 0;
        for (int l = 0; l < a.size(); l++) {
            if (l >= k) {
                break;
            }
            sub += a[l];
            ans = max(ans, sub + all * max(0LL, ((k - l - 1) / (ll)a.size())));
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int i,s;
string a;
int main(){
	cin>>a;
	for(i=1;i<a.size();i++){
		if(a[i-1]!=a[i]){
			s++;
		}
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n, k; cin >> n >> k; std::vector<long> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	
	long ans = 1e18;
	for(int i = 0; i < (1 << n); i++){
		if(__builtin_popcount(i) < k) continue;
		
		long cost = 0, ma = 0, c = 0;
		for(int j = 0; j < n; j++){
			if((i >> j) & 1){
				if(a[j] <= ma){
					cost += ma - a[j] + 1;
					ma = ma + 1;
				}
			}
			
			ma = std::max<long>(ma, a[j]);
		}
		
		ans = std::min(ans, cost);
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a, b;
    cin >> a >> b;
    cout << (b-1+a-1-1)/(a-1) << endl;
    return 0;
}

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

using namespace std;

int a[20], b[20];
int dp[1 << 19][20];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	memset(dp, 255, sizeof(dp));
	
	for (int i = 0; i < n; i++) dp[1 << i][i] = 0;
	for (int mask = 1; mask < (1 << n); mask++) {
		int c = 0;
		for (int i = 0; i < n; i++) {
			if (mask >> i & 1) c++;
		}
		for (int i = 0; i < n; i++) {
			if (!(mask >> i & 1) || dp[mask][i] == -1) continue;
			int w = (i % 2 == c % 2 ? b[i] : a[i]);
			int cost = c;
			for (int j = 0; j < n; j++) {
				if (mask >> j & 1) cost--;
				else { 
					int v = (j % 2 == c % 2 ? a[j] : b[j]);
					if (w <= v) {
						int val = dp[mask][i] + cost;
						if (dp[mask | 1 << j][j] == -1 || dp[mask | 1 << j][j] > val) {
							dp[mask | 1 << j][j] = val;
						}
					}
				}
			}
		}
	}
	
	int res = -1;
	for (int i = 0; i < n; i++) {
		if (dp[(1 << n) - 1][i] != -1) {
			if (res == -1 || res > dp[(1 << n) - 1][i]) {
				res = dp[(1 << n) - 1][i];
			}
		}
	}
	
	cout << res << '\n';
}


Measured memory_bytes: 41216
#include<iostream>
#include<string>
#include<vector>
using namespace std;

void arrange(vector<int>& S){
    int i = S.size() - 1;
    while (i > 1 && S[i] > S[i/2]) {
        swap(S[i], S[i/2]);
        i = i / 2;
    }
}

void heapify(vector<int>& A, int i){
    int largest = i;
    int l = i * 2;
    if (l < A.size() && A[l] > A[i]) largest = l;
    int r = l + 1;
    if (r < A.size() && A[r] > A[largest]) largest = r;
    if (largest != i) {
        swap(A[i], A[largest]);
        heapify(A, largest);
    }
}

void extract(vector<int>& S){
    cout << S[1] << endl;
    swap(S[1], S.back());
    S.pop_back();
    heapify(S, 1);
}

int main(){
    vector<int> S(1);
    string command;
    do {
        cin >> command;
        if (command == "insert") {
            int num;
            cin >> num;
            S.push_back(num);
            arrange(S);
            continue;
        }
        if (command == "extract") {
            extract(S);
            continue;
        }
    } while (command != "end");
    return 0;
}

Measured memory_bytes: 7080
#include<iostream>

#define MOD (long(1e9) + 7)

using namespace std;

int main(){
    int N;
    cin >> N;
    
    long dp[N+1][64];
    for(int i=0; i<N+1; i++){
        for(int j=0; j<64; j++){
            dp[i][j] = 0;
        }
    }
    for(int i=0; i<4; i++){
        dp[1][i] = 1;
    }
    
    for(int i=1; i<N; i++){
        for(int j=0; j<64; j++){
            bool c;
            c = ((j%4 == 1) & (j/4%4 == 2)) | ((j%4 == 2) & (j/4/4%4 == 1)) | ((j/4%4 == 2) & (j/4/4%4 == 1)) | ((j%4 == 2) & (j/4%4 == 1));
            if(c){
                for(int k=0; k<3; k++){
                    dp[i+1][j*4%64 + k] += dp[i][j];
                    dp[i+1][j*4%64 + k] %= MOD;
                }
            }
            else if(j%4 == 3 && j/4%4 == 1){
                for(int k=0; k<4; k++){
                    if(k==2) continue;
                    else {
                        dp[i+1][j*4%64 + k] += dp[i][j];
                        dp[i+1][j*4%64 + k] %= MOD;
                    }
                }
            }
            else{
                for(int k=0; k<4; k++){
                    dp[i+1][j*4%64 + k] += dp[i][j];
                    dp[i+1][j*4%64 + k] %= MOD;
                }
            }
        }
    }
    long ans = 0;
    for(int i=0; i<64; i++){
        ans += dp[N][i];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
 int Dik;
 cin >> Dik;
 if(Dik==25){
   cout << "Christmas";
 }else if(Dik==24){
 cout << "Christmas Eve";  
 }else if(Dik==23){
 cout << "Christmas Eve Eve";  
 }else if(Dik==22){
 cout << "Christmas Eve Eve Eve";  
 }
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

using Graph = vvint;

void dfs(Graph &g, vint &dist, int v, int x)
{
    for (auto nv : g[v])
    {
        if (dist[nv] != -1)
            continue;
        dist[nv] = dist[v] + 1;
        dfs(g, dist, nv, x);
    }
}

void Main()
{
    int n = in();
    Graph g(n);
    rep(i, n - 1)
    {
        int a = in(), b = in();
        --a;
        --b;
        g[a].pb(b);
        g[b].pb(a);
    }

    vint dist1(n, -1);
    dist1[0] = 0;
    dfs(g, dist1, 0, n - 1);
    vint dist2(n, -1);
    dist2[n - 1] = 0;
    dfs(g, dist2, n - 1, 0);

    int fen = 0, sun = 0;
    rep(i, n)
    {
        if (dist1[i] <= dist2[i])
            ++fen;
        else
            ++sun;
    }

    if (fen > sun)
        puts("Fennec");
    else
        puts("Snuke");
}

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: 12800
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  double n,k;
  cin >>n >>k;
  double sum=0;
  
  for(int i=1; i<=n; i++){
  	double a=k/i;
    double temp=1;
    while(a>1){
      a/=2;
      temp/=2;
    }
    sum+=temp/n;
  }
  printf("%.10lf\n", sum);
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
	        public final class Main {
	    	static void solve(int[] arr, int n) {
	    	}
	        public static void main(String args[]) throws IOException {
	        	FastReader sc = new FastReader();
	        	int n = sc.nextInt();
	        	long[] arr = sc.readLongArray(n);
	        	long total = 0;
	        	long max = 0;
	        	for(int i = 1;i < n;i++) {
	        		if(arr[i] < arr[i-1]) {
	        			max = arr[i-1];
	        			total += max - arr[i];
	        			arr[i] = max;
	        		}
	        		else  {
	        			max = 0;
	        		}
 	        	}
	        	pn(total);
	       }
	       static void p(Object p){System.out.print(p);}
	       static void pn(){System.out.println();}
	       static void pn(Object o){System.out.println(o);}
	       
	       static class FastReader {
	       static BufferedReader br;
	       StringTokenizer st;
	       public FastReader() {
	       br = new BufferedReader(new InputStreamReader(System.in));
	       }
	            
	       String next(){
	       while (st == null || !st.hasMoreElements()) {
	            try{
	                st = new StringTokenizer(br.readLine());
	            }
	            catch (IOException  e) {
	                e.printStackTrace();
	            }}
	            return st.nextToken();
	            }
	            
	            int nextInt(){ 
	                return Integer.parseInt(next());
	            }
	            
	            long nextLong(){ 
	                return Long.parseLong(next());
	            }
	            
	            static int max(int[] a){
	            int max = Integer.MIN_VALUE;
	            for(int i : a) max = Math.max(max, i);
	            return max;
	            }
	            
	            public int[] readIntArray(int n) {
	            int[] arr = new int[n];
	            for(int i=0; i<n; ++i) arr[i]=nextInt();
	            return arr;
	            }
	            
	            public long[] readLongArray(int n){
	            long[] arr = new long[n];
	            for(int i=0; i<n; ++i) arr[i]=nextLong();
	            return arr;
	            }
	            
	            public int[][] readIntArray(int m, int n){
	            int[][] arr = new int[m][n];
	            for(int i = 0;i<m;i++) 
	            for(int j = 0;j<n;j++) arr[i][j] = nextInt();
	            return arr;
	            }
	            
	            public String[] readStringArray(int n) {
	            String[] arr = new String[n];
	            for(int i=0; i<n; ++i) arr[i]= nextLine();
	            return arr;
	            }
	            
	            double nextDouble() {return Double.parseDouble(next());}
	            
	            String nextLine() {
	            String str = "";
	            try{str = br.readLine();}
	            catch (IOException e) {e.printStackTrace();}
	            return str;}}
	        }


Measured memory_bytes: 55100
#include<stdio.h>

int main() {
    int i, a, b, n, m = 0;
    scanf("%d%d%d", &n, &a, &b);
    for (i = a; i <= b; i++) {
        if (i % n == 0){
            m++;

    }
}
if(m==0) {
    printf("NG\n");
}
else{
    printf("OK\n");
}

    return 0;


}

Measured memory_bytes: 1644
#include<iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); ++i)

using namespace std;

int main(){
  string S;
  ll N, K, l, sum, tmp, ans=0;
  cin >> S;
  vector<int> X(N), Y(N), C(N, -1);

  N = S.size();

  rep(i, (1<<(N-1))){
    sum = 0;
    tmp = 0;
    rep(j, N){
      tmp += S[j] - '0';
      if(i&1<<j && j != N-1) {
        tmp *= 10;
      }else{
        sum += tmp;
        tmp = 0;
      }
    }
    ans += sum;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int n, k, q;
int a[2005];
int b[2005];

bool good(int x, int y) {
	int l = 0;
	int ans = 0;
	while(l < n) {
		int r = l;
		int cnt = 0;
		while(r < n && a[r] >= x) {
			cnt += (a[r] <= y);
			++r;
		}
		ans += max(0, min(r - l - k + 1, cnt));
		l = r + 1;
	}
	return ans >= q;
}

int main(int argc, char const *argv[])
{
	scanf("%d %d %d", &n, &k, &q);
	for(int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		b[i] = a[i]; 
	}
	sort(b, b + n);
	int ans = b[n - 1] - b[0];
	for(int i = 0; i < n; i++) {
		int l = i, r = n - 1;
		while(l < r) {
			int m = (l + r) >> 1;
			if(good(b[i], b[m])) {
				r = m;
			} else {
				l = m + 1;
			}
		}
		if(good(b[i], b[l])) {
			ans = min(ans, b[l] - b[i]);
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  string s;
  int c = 1;
  bool rf = true;
  cin >> s;
  int n = s.size();
  s += 'X';
  vector<int>data(n,0);
  for(int i = 0;i < n;i++){
    if(s[i] == s[i+1]) c++;
    else{
      if(rf){
        if(c%2 == 0){
          data[i] += c/2;
          data[i+1] += c/2;
        }
        else{
          data[i] += c/2+1;
          data[i+1] += c/2;
        }
        rf = false;
        c = 1;
      }
      else{
        if(c%2 == 0){
          data[i-c+1] += c/2;
          data[i-c] += c/2;
        }
        else{
          data[i-c+1] += c/2+1;
          data[i-c] += c/2;
        }
        rf = true;
        c = 1;
      }
    }
  }
  for(int i = 0;i < n;i++){
    cout << data[i];
    if(i != n-1) cout << " ";
    else cout << "" << endl;
  }
}


Measured memory_bytes: 1152
function Main(input) {
    const lines = input.split("\n");
    const [S, T] = lines.shift().split(' ');
    let [a, b] = lines.shift().split(' ').map(v => +v);
    const U = lines[0];

    if (U == S) a -= 1;
    else b -= 1;
    
    console.log(a, b);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

pair<int, int> max_v(map<int, int> mp)
{
	return *max_element(mp.begin(), mp.end(), [](pair<int, int> l, pair<int, int> r)
	{
		return l.second < r.second;
	});
}

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

	vector<int> list[2];
	
	int flip = 0;
	for (int i = 0; i < N; i++)
	{
		int v;
		cin >> v;

		list[flip].push_back(v);

		flip ^= 1;
	}

	sort(list[0].begin(), list[0].end());
	sort(list[1].begin(), list[1].end());

	map<int, int> cnt_mp[2];
	for (int i = 0; i < 2; i++)
	{
		int count = 1;
		int x = list[i][0];

		for (int k = 1; k < list[i].size(); k++)
		{
			if (x == list[i][k])
			{
				count++;
			}
			else
			{
				cnt_mp[i][x] = count;

				x = list[i][k];
				count = 1;
			}
		}

		cnt_mp[i][x] = count;
	}
	
	auto O = max_v(cnt_mp[0]);
	auto E = max_v(cnt_mp[1]);

	if (O.first != E.first)
	{
		cout << N - O.second - E.second << endl;
	}
	else
	{
		cnt_mp[0][O.first] = 0;
		auto O2 = max_v(cnt_mp[0]);

		cnt_mp[1][E.first] = 0;
		auto E2 = max_v(cnt_mp[1]);

		cout << min(N - O.second - E2.second, N - O2.second - E.second) << endl;
	}

	return 0;
}

Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  
  int n,k;
  cin >> n >> k;
  cout << n - k +1 << endl;
  
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    int dp[n][3]={0};
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
                dp[i][j]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
            else if(j==1)
                 dp[i][j]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
            else
                 dp[i][j]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
        }
    }
    int ans=0;
    ans=max(ans,dp[n-1][0]);
    ans=max(ans,dp[n-1][1]);
    ans=max(ans,dp[n-1][2]);
    cout<<ans;
    return 0;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if(A == 7 && B == 5 && C == 5) cout << "YES" << endl;
  else if(A == 5 && B == 7 && C == 5) cout << "YES" << endl;
  else if(A == 5 && B == 5 && C == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main() {
	int x,y;
  	cin >> x >> y;
  
  	vector<int> vec(13);
  	vec = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  
  	if(vec.at(x) == vec.at(y)) {
    	cout << "Yes" << endl;
    }else {
    	cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/*
解説AC
ある数Kが割れたらその数を答えに足すという性質から、
n以下の割る数の倍数の和を用いると答えが出る。
計算量を削るには視点を変えることが必要
割る数の倍数がXになるということは思いつかなかった……
n以下の数で倍数全列挙でf(x)が求まる。
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

int main(){
    ll n,ans=0;
    cin>>n;
    REP(i,1,n+1){
        ll x=n/i;
        ans+=(x*(x+1)*i)/2;
    }
    cout<<ans<<endl;
    return 0;
}

//a=97,z=122

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

long long f (long long x) {
	long long ok = 1, ng = 1'000'000'000;
	while (abs(ok - ng) > 1) {
		long long mid = (ok + ng) / 2;
		if (mid * mid < x) ok = mid;
		else ng = mid;
	}
	return ok;
}

long long solve (long long a, long long b) {
	if (a == 1 and b == 1) return 0LL;
	if (a < b) swap(a, b);
	long long k = f(a * b), ans = 2 * k;
	assert((k + 1) * (k + 1) >= a * b);

	ans -= (k * (k + 1) >= a * b);
	if (a - 1 > 0) ans -= ((a - 1) * (b + 1) >= a * b);
	if (b - 1 > 0) ans -= ((a + 1) * (b - 1) >= a * b);

	return ans;
}

int main() {
	int q;
	cin >> q;
	while (q--) {
		long long a, b;
		cin >> a >> b;
		cout << solve(a, b) << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
typedef long long llong;
int n,k;
llong T[MAX];
int check(llong P){
	int i= 0;
	for(int j = 0;j < k; j++){
		llong s = 0;
		while(s + T[i] <= P){
			s += T[i];
			i++;
			if(i == n){
				return n;
			}
		}
	}
	return i;
}
int solve(){
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(right - left > 1){
		mid = (left + right) / 2;
		int v = check(mid);
		if(v >= n){
			right = mid;
		}
		else{
			left = mid;
		}
	}
		return right;
	
}
int main (void){
	scanf("%d %d",&n,&k);
	for(int i = 0; i < n;i++){
		scanf("%d",&T[i]);
	}
	llong ans = solve();
	printf("%d\n",ans);
}



Measured memory_bytes: 2580
#貰うDP
import itertools
N, MOD = int(input()), 10**9+7

memo = [{'AGC':0, 'ACG':0, 'GAC':0} for i in range(N + 4)]
C = list('ACGT')
for c in itertools.product(C, C, C):
    c = ''.join(c)
    if c in memo[3]:
        continue
    else:
        memo[3][c] = 1

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i>= 1:
            t[i-1], t[i] = t[i], t[i-1]
            if ''.join(t).count('AGC') == 1:
                return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    ret = 0
    for c in 'ACGT':
        if ok(c + last3):
            ret = (ret + dfs(cur - 1, c + last3[:-1])) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(N + 3, 'TTT'))

Measured memory_bytes: 3920
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
D = list(map(int,readline().split()))

c = [0]*13
c[0] = 1
for d in D:
    c[d] += 1

if c[0] >= 2 or c[12] >= 2:
    print(0)
    exit()
for i in range(1,12):
    if c[i] >= 3:
        print(0)
        exit()

bitsearchlist = []
notbitsearch = [False]*24
notbitsearch[0] = True
if c[12]:
    notbitsearch[12] = True


for i in range(1,12):
    if c[i] == 1:
        bitsearchlist.append(i)
    elif c[i] == 2:
        notbitsearch[i] = True
        notbitsearch[24-i] = True

def count(List):
    anss = INF
    ret = INF
    for b in notbitsearch:
        if b:
            anss = min(anss,ret)
            ret = 0
        else:
            ret += 1
    anss = min(anss,ret)
    anss += 1
    return anss



L = len(bitsearchlist)

if L == 0:
    print(count(notbitsearch))
    exit()

ans = 0
for i in range(2**L):
    for j in range(L):
        if ((i >> j) & 1):
            notbitsearch[bitsearchlist[j]] = True
        else:
            notbitsearch[24-bitsearchlist[j]] = True
    ans = max(ans,count(notbitsearch))
    for j in range(L):
        if ((i >> j) & 1):
            notbitsearch[bitsearchlist[j]] = False
        else:
            notbitsearch[24-bitsearchlist[j]] = False

print(ans)


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

int h;

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> h;

    int ans = 0, monsters = 1;
    while(h > 0) {
        ans += monsters;
        monsters *= 2;
        h /= 2;
    }

    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int n, x;
int a[N];

int32_t main()
{
	IOS;
	cin>>n>>x;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n-1;i++)
	{
		if(a[i]+a[i+1]>=x)
		{
			cout<<"Possible"<<endl;
			for(int j=n-1;j>=i+1;j--)
				cout<<j<<endl;
			for(int j=1;j<=i;j++)
				cout<<j<<endl;
			return 0;
		}
	}
	cout<<"Impossible";
	return 0;
}


Measured memory_bytes: 1664
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
Int printX(Int r, Int D, Int X, int count){
    if(count == 10){
        return 0;
    }
    Int nextX = r*X - D;
    cout<< nextX <<endl;
    printX(r,D,nextX,count+1);

}

int myPow(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    return x * myPow(x, p-1);
}

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

    Int ans =0;

    int tmp = N;
    REP(i,1,N+1){
        ans++;
        tmp=tmp-(2*D+1);
        if(tmp<=0){
            break;
        }
    }

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


Measured memory_bytes: 256
#063 C Bugged
#動的計画法(DP)で解く
import sys
n = int(sys.stdin.readline())
S = [int(sys.stdin.readline()) for _ in range(n)]
#print(S)

dp =[[0 for _ in range(sum(S)+1)] for _ in range(n)]
dp[0][0]=1
dp[0][S[0]]=1
for i in range(1, n):
    for j in range(sum(S)+1):
        if dp[i-1][j]==1:
            dp[i][j] = 1
            dp[i][j+S[i]] = 1
    dp[i][S[i]]=1

L=[]   
for i, p in enumerate(dp[n-1]):
    if p!=0:
        L.append(i)
L.sort(reverse=True)

for l in L:
    if l%10 !=0:
        print(l)
        break
else:
    print(0)

Measured memory_bytes: 11252
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FL          freopen("in", "r", stdin),freopen("out", "w", stdout);
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
int dx[] = {1, 0}, dy[] = {0, 1};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
char v[1010][1010];
ll dp[1010][1010];
int n, m;
ll f(int i, int j){
    if(i == n - 1 && j == m - 1)return 1;
    ll &ans = dp[i][j];
    if(ans != -1)return ans;
    ans = 0;
    fore(k, 0, 2){
        int iii = i + dx[k];
        int jjj = j + dy[k];
        if(iii < n && jjj < m && v[iii][jjj] == '.')
            ans = (ans % mod + f(iii, jjj) % mod) % mod;
    }
    return ans;
}
int main(){
    //FL;
    FIN;
    cin >> n >> m;
    fore(i, 0, n){
        fore(j, 0, m){
            cin >> v[i][j];
        }
    }
    cls(dp, -1);
    cout << f(0, 0) << '\n';
    EjecuteTime;
    return 0;
}       

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<bool>> path(10, vector<bool>(10, false));
  rep(i, M){
    int a, b;
    cin >> a >> b;
    path.at(a).at(b) = true;
    path.at(b).at(a) = true;
  }
  
  vector<int> p(10);
  rep(i, N) p.at(i) = i + 1;
  int ans = 0;
  
  do{
    bool flag = true;
    rep(i, N-1){
      int a, b;
      a = p.at(i);
      b = p.at(i+1);
      if((i == 0 && a != 1) || !path.at(a).at(b)){
        flag = false;
        break;
      }
    }
    if(flag) ans++;
  } while (next_permutation(p.begin(), p.end()));
  
  cout << ans << endl;
}

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

int main(){
	ll k, a, b;
	ll ef;
	ll ans;
	cin >> k >> a >> b;
	ef = b - a;
	if(2 >= ef || k <= a-1){
		cout << 1+k << endl;
		return 0;
	}
	
	k -= a-1;
	ans = a;
	ans += ef*(k/2);
	if(k % 2 == 1) ans++;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
import math
def main():
    k = int(input())
    
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            s = math.gcd(i,j)
            for t in range(1,k+1):
                ans+=math.gcd(s,t)
    
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 67740
#include <iostream>
#include <cstring>
#include <cstdio>
#define MOD 1000000007
using namespace std; 
typedef long long ll; 
int lst[100005], to[200005], pre[200005], tot; 
int dfn[100005], low[100005], st[200005], col[100005], tp, t;
int ecnt[200005], vcnt[200005], bcc; 
ll fact[200005], inv[200005]; 
inline void add_edge(int u, int v)
{
	to[tot] = v; 
	pre[tot] = lst[u]; 
	lst[u] = tot++; 
}
inline ll quick_pow(ll a, int n)
{
	ll res = 1; 
	while (n)
	{
		if (n & 1)
			res = res * a % MOD; 
		a = a * a % MOD; 
		n >>= 1; 
	}
	return res; 
}
inline int gcd(int x, int y)
{
	while (y)
	{
		int r = x % y; 
		x = y; 
		y = r; 
	}
	return x; 
}
void tarjan(int u, int fae = -1)
{
	dfn[u] = low[u] = t++; 
	for (int i = lst[u]; ~i; i = pre[i])
	{
		if (-1 == dfn[to[i]])
		{
			st[tp++] = i; 
			tarjan(to[i], i ^ 1); 
			low[u] = min(low[u], low[to[i]]); 
			if (low[to[i]] >= dfn[u])
			{
				bcc++; 
				do
				{
					int x = st[--tp]; 
					ecnt[bcc]++; 
					if (col[to[x]] != bcc)
					{
						col[to[x]] = bcc; 
						vcnt[bcc]++; 
					}
					if (col[to[x ^ 1]] != bcc)
					{
						col[to[x ^ 1]] = bcc; 
						vcnt[bcc]++; 
					}
				}
				while (st[tp] != i); 
			}
		}
		else if (i != fae && dfn[to[i]] < dfn[u])
		{
			st[tp++] = i; 
			low[u] = min(low[u], dfn[to[i]]); 
		}
	}
}
int main()
{
	// freopen("ARC062-F.in", "r", stdin); 
	memset(lst, -1, sizeof(lst)); 
	fact[0] = inv[0] = 1;
	for (int i = 1; i < 505; i++)
	{
		fact[i] = fact[i - 1] * i % MOD; 
		inv[i] = quick_pow(fact[i], MOD - 2); 
	}
	int n, m, k; 
	scanf("%d%d%d", &n, &m, &k); 
	for (int i = 0; i < m; i++)
	{
		int u, v; 
		scanf("%d%d", &u, &v); 
		add_edge(--u, --v); 
		add_edge(v, u); 
	}
	memset(dfn, -1, sizeof(dfn)); 
	for (int i = 0; i < n; i++)
	{
		if (-1 == dfn[i])
			tarjan(i); 
	}
	ll ans = 1; 
	for (int i = 1; i <= bcc; i++)
	{
		if (ecnt[i] == 1)
			ans = ans * k % MOD; 
		else if (ecnt[i] == vcnt[i])
		{
			ll sum = 0; 
			for (int j = 1; j <= ecnt[i]; j++)
				sum = (sum + quick_pow(k, gcd(j, ecnt[i]))) % MOD; 
			ans = ans * sum % MOD * quick_pow(ecnt[i], MOD - 2) % MOD; 
		}
		else
			ans = ans * fact[ecnt[i] + k - 1] % MOD * inv[k - 1] % MOD * inv[ecnt[i]] % MOD; 
	}
	printf("%lld\n", ans);
	return 0; 
}


Measured memory_bytes: 6784
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
P = list(map(lambda x: int(x)-1, input().split()))
uf = UnionFind(N)
for _ in range(M):
    x, y = map(lambda x: int(x)-1, input().split())
    uf.union(x, y)
ans = 0
for i in range(N):
    if uf.same(P[i], i):
        ans += 1
print(ans)

Measured memory_bytes: 20232
n, y = map(int, input().split())

end = 0

stdz = y // 10000

o1 = -1
o2 = -1
o3 = -1

if stdz <= n:
    for i in reversed(range(stdz + 1)):
        for j in reversed(range(n - i + 1)):
            if 10000*i+5000*j+1000*(n - i - j) == y:
                o1 = i
                o2 = j
                o3 = n - i - j
                end = 1
            if end == 1:
                break
        if end == 1:
            break


print(o1, o2, o3)

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

int main(){
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double pi = 3.141592653589793238;
    double c,d,e;
    c=30*h+m/2.0;
    d=6*m;
    e=c-d;
    double ans=a*a+b*b-2*a*b*cos(e/180.0*pi);
    cout << fixed << setprecision(10);
    cout << sqrt(ans) << endl;
}


Measured memory_bytes: 4212
x = int(input())
nums = [i for i in range(6, 0, -1)]

if x % 11 == 0:
    ans = (x // 11) * 2
else:
    if x % 11 <= 6:
        ans = (x // 11) * 2 + 1
    else:
        ans = (x // 11 + 1) * 2
print(ans)


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

vector<pll> ba(200010); // b a

int main(){

    ll n;
    cin >> n;
    ba.resize(n);
    ll s = 0;
    ll blm = 0;
    rep(i, n){
        cin >> ba[i].second >> ba[i].first;
        s += ba[i].second;
        blm = max(blm, ba[i].first);
    }
    if(s > blm){
        No();
        return 0;
    }

    sort(ba.begin(), ba.end());
    ll now = 0;
    for(int i = 0; i < n; ++i){
        ll a = ba[i].second, b = ba[i].first;
        if(now+a > b) {
            No();
            return 0;
        }
        now += a;
    }

    Yes();
    return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll a; ll b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>

int main(){
  char ring[101], p[101], line[505];
  scanf("%s", ring);
  scanf("%s", p);

  int ring_length, p_length;
  ring_length = strlen(ring);
  p_length = strlen(p);

  for(int i = 0; i < 5; i++){
    strcpy((line+i*(ring_length)),ring);
  }

  if(strstr(line, p) != NULL){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  };

  return 0;
}

Measured memory_bytes: 964
N, M, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]

import sys
sys.setrecursionlimit(1000000)

class uftree:
    def __init__(self, N):
        self.parent = list(range(N))
    def unite(self, a, b):
        ar = self.root(a)
        br = self.root(b)
        if ar != br: self.parent[max(ar, br)] = min(ar, br)
        return
    def root(self, a):
        p = self.parent[a]
        if a == p:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]


tree = uftree(N)
for i, (Ai, Bi) in enumerate(AB):
    tree.unite(Ai - 1, Bi - 1)
# print("#", tree.parent)

root = [tree.root(i) for i in range(N)]
# print("#", root)

cnt = {}
for i in range(N):
    cnt[str(root[i])] = cnt.setdefault(str(root[i]), 0) + 1
# print("#", cnt)

ans = [cnt[str(root[i])] - 1 for i in range(N)]

for i, (Ai, Bi) in enumerate(AB):
    if tree.root(Ai - 1) == tree.root(Bi - 1):
        ans[Ai - 1] -= 1
        ans[Bi - 1] -= 1
for i, (Ci, Di) in enumerate(CD):
    if tree.root(Ci - 1) == tree.root(Di - 1):
        ans[Ci - 1] -= 1
        ans[Di - 1] -= 1

print(' '.join(map(str, ans)))

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

#define endl '\n'
#define pb push_back
#define mod 1000000007
typedef int integer;
#define int long long
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 0
#endif
using namespace std;

template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << ": " << arg1 << endl;
}

template<typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int powmod(int a, int b) {
    int res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1)res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

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

const integer NN = (int) 5e5 + 2;
int ar[NN];
int b[NN];
int n, m, k;
string s;



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

    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        cin >> ar[i];
        if (i % 2 == 1 && ar[i] % 2 == 1) ans++;
    }
    cout << ans;


}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    string a;cin>>a;
    bool e=0,w=0,n=0,s=0;
    REP(i,a.size()){
        if(a[i]=='E')e=true;
        if(a[i]=='W')w=true;
        if(a[i]=='N')n=true;
        if(a[i]=='S')s=true;
    }
    bool f=true;
    if(e^w)f=false;
    if(n^s)f=false;
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  cout << string(S.length(), 'x') << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int main(void){
    int N,M;
    cin >> N >> M;
    int H[N];
    bool f[N];
    rep(i,N){
        cin >> H[i];
        f[i] = true;
    }
    rep(i,M){
        int a,b;
        cin >> a >> b;
        if(H[a-1] >= H[b-1]){
            f[b-1]=false;
        }
        if(H[a-1] <=H[b-1]){
            f[a-1]=false;
        }
    }
    int ans=0;
    rep(i,N){
        if(f[i])ans++;
    }
    cout  << ans <<endl;
    return 0;
}


Measured memory_bytes: 4116
#![allow(unused_imports, non_snake_case)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};

fn power(a:u64, b:u64, modulo:u64) -> u64 {
    let mut res = 1;
    let mut b = b;
    let mut a = a;
    while b > 0 {
        if b & 1 > 0 {
            res = res * a % modulo;
        }
        b >>= 1;
        a = a * a % modulo
    }
    res
}

const MOD: u64 = 1_000_000_007;

#[fastout]
fn main() {
    input!{
        N: u64
    }
    let mut ans = power(10, N, MOD);
    ans = ans + MOD * 2 - power(9, N,MOD) * 2;
    ans += power(8, N, MOD);
    println!("{}", ans % MOD);
}


Measured memory_bytes: 2128