akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

ans = 0

for i in range(n):
    for j in range(1, 33):
        if a[i]%2 ==0 and a[i]>=2:
            a[i] /=2
            ans += 1

print(ans)

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1001001001;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
struct UnionFind {
  vector<int> p;
  vector<int> r;
  UnionFind(int n) {
    p.resize(n,-1);
    r.resize(n,1);
  }
  int find(int x) {
    if (p[x] == -1) return x;
    else return p[x] = find(p[x]);
  }
  void unite(int x,int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    p[x] = y;
    r[y] += r[x];
  }
  int size(int x) {return r[x];}
};

int main() {
int n,m;
cin >> n >> m;
UnionFind uf(n);

rep(i,m) {
  int a,b;
  cin >> a >> b;
  a--;
  b--;
  uf.unite(a,b);
  
}
int maxi = 0;

rep (i,n) maxi = max(maxi,uf.size(i));
cout << maxi << endl;
    
return 0;
}


Measured memory_bytes: 4816
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
int g[101];
int main() {
	int N;
	cin >> N;
	int S = N * (N + 1) / 2;
	int p;
	for (int i = 2; i <= S; i++) {
		if (S%i == 0) {
			p = i;
			break;
		}
	}
	memset(g, -1, sizeof(g));
	rep(i, S / p) {
		int sum = 0;
		for (int j = N; j >= 1; j--) {
			if (g[j] != -1 || sum + j > S / p) continue;
			sum += j;
			g[j] = i;
		}
	}
	vector<P> edge;
	for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			if (g[i] != g[j]) {
				edge.emplace_back(i, j);
			}
		}
	}
	cout << edge.size() << endl;
	rep(i, edge.size()) cout << edge[i].first << " " << edge[i].second << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  int ret = 0;
  for(int i = 0;i < 2;i++){
    int p = 0;
    for(int j = 0;j < 4;j++){
      int t;
      cin >> t;
      p += t;
    }
    ret = max(ret,p);
  }
  cout << ret << endl;
}

Measured memory_bytes: 1160
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
    	new A().doIt();
    }
    class A{
    	void doIt(){
    		int n = sc.nextInt();
    		int array[] = new int [n*2];
    		for(int i = 0;i < n*2;i++){
    			array[i] = sc.nextInt();
    		}
    		Arrays.sort(array);
    		int sum = 0;
    		for(int i = 0;i < n*2;i += 2){
    			sum = sum + array[i];
    		}
    		System.out.println(sum);
    	}
    }
}

Measured memory_bytes: 10004
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m,a,b;
int d[1001];

int main(void){
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(int i=0;i<n;i++){
		scanf("%d",&d[i]);
	}
	int l=0;
	while(l<n){
		if(d[l]>=a)l++;
		else break;
	}
	if(n-l<m){
		while(l>0){
			if(d[l-1]<=b)l--;
			else break;
		}
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
#define elif else if
using namespace std;
const int MOD = 1e9 + 7, INF = 1e17;
using vi = vector <int>;
using vvi = vector <vi>;

signed main(){
	int n;
	cin >> n;

	int a, b, macs = -1, ans;
	rep(i, n){
		cin >> a >> b;
		if(macs < a){
			macs = a;
			ans = a + b;
		}
	}
	cout << ans << endl;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <math.h>
using namespace std;

#define L 12
#define M 1046527
#define NIL "Z"

char hash_table[M][L + 1];

int h_1(int num){
    return (num * 2 + 1) % (M - 2);
}

int h_2(int num){
    return (num * 3 + 1) % (M - 4);
}

int H_k(int num, int k){
   return (h_1(num) + h_2(num) * k) % M;
}

int char_to_num(char c){
    if(c == 'A'){
        return 1;
    }else if(c == 'C'){
        return 2;
    }else if(c == 'G'){
        return 3;
    }else{
        return 4;
    }
}

int str_to_num(char* str){
    int index = 0;
    int value = 0;

    while(str[index]){
        value += char_to_num(str[index]) * pow(4, index);
        index++;
    }

    return value;
}

void insert_(char* str){
    int hash_num = str_to_num(str);
    int k = 1;
    while(strcmp(hash_table[H_k(hash_num, k)], NIL)){
        k++;
    }
    strcpy(hash_table[H_k(hash_num, k)], str);
}

void find_(char* str){
    int hash_num = str_to_num(str);
    int k = 1;
    while(strcmp(hash_table[H_k(hash_num, k)], NIL)){
        if(!strcmp(hash_table[H_k(hash_num, k)], str)){
            printf("yes\n");
            return;
        }
        k++;
    }
    printf("no\n");
    return;
}

void init(){
    for(int i = 0; i < M; i++){
        strcpy(hash_table[i], NIL);
    }
}


int main(void){
    init();

    int n;
    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        char buf1[100];
        char buf2[100];
        scanf("%s %s", buf1, buf2);
        if(!strcmp(buf1, "insert")){
            insert_(buf2);
        }else if (!strcmp(buf1, "find")){
            find_(buf2);
        }
    }
}



Measured memory_bytes: 16588
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N;
LL A[100001];
int main(){
	cin>>N;
	LL sum=0;
	REP(i,N){
		cin>>A[i];
		if(i!=0){
			sum+=abs(A[i]-A[i-1]);
	//		cout<<"a"<<sum<<endl;
		}else{
			sum+=abs(A[0]);
		}
	}
	sum+=abs(A[N-1]);
	//cout<<sum<<endl;
	REP(i,N){
		if(i==0){
			cout<<sum-abs(A[1]-A[0])-abs(A[0])+abs(A[1])<<endl;
		}else if(i==N-1){
			cout<<sum-abs(A[N-1]-A[N-2])+abs(A[N-2])-abs(A[N-1])<<endl;
		}else{
			cout<<sum-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1])<<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b;
if(a>=1&&a<=13&&b>=1&&b<=13)
{
	if(a==1) a=14;
	if(b==1) b=14;
	if(a>b)
	{
		cout<<"Alice"<<endl;
	}
		if(a==b) 
		{
		cout<<"Draw"<<endl;
		}
	if(b>a)
	cout<<"Bob"<<endl;
	}
	return 0;
}

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

const int MAX = 2010000;
const int mod = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    COMinit();
    ll a,b,c,d;
    cin >> a>>b>>c>>d;
    ll ans = 0;
    for(ll n=a;n<=c;n++){
        ll ret = d+1;
        ret *= COM(d+n+1,n);
        ret %= mod;
        ret += mod - (b*COM(b+n,n))%mod;
        ret %= mod;
        ret *= inv[n+1];
        ret %= mod;
        ans += ret;
        ans %= mod;
    }
    cout << ans << endl;

}

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





int main(){
    int N,tmp;
    vector<int> A;
    cin >> N;
    rep(i,N){
        cin >> tmp;
        A.push_back(tmp);
    }
    sort(A.begin(),A.end());

    rep(i,N){
        if (A[i]==A[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
    
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e5 + 10;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;

void solve() {
    ll b=0;
    string a;
    cin>>a;
    for (int i = 0; i < a.size(); ++i) {
        b+=a[i]-'0';
    }
    cout<<(b%9==0?"Yes":"No")<<endl;
}

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


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int dp[2][N],a[N];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
	}
	dp[0][1] = dp[1][1] = 1;
	for(int i = 2; i <= n; i++){
		dp[1][i] = dp[0][i] = min(dp[0][i - 1] + 1, dp[1][i - 1] + 1);
		if(a[i] >= a[i - 1]) dp[0][i] = min(dp[0][i], dp[0][i - 1]);
		if(a[i] <= a[i - 1]) dp[1][i] = min(dp[1][i], dp[1][i - 1]);
	}
	printf("%d\n", min(dp[0][n], dp[1][n]));
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int i,n,flg[31];
	for(i=1;i<=30;i++) flg[i]=1;
	for(i=0;i<28;i++){
		cin>>n;
		flg[n]=0;
	}
	for(i=1;i<=30;i++){
		if(flg[i]!=0) cout<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 3092
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
        String s, s1;
        while((s=br.readLine())!=null)
        {
            int[] a = new int[4], b = new int[4];
            int hit=0, blow=0;
            for(int i=0; i<4; i++) a[i] = Integer.parseInt(s.split(" ")[i]);
            s1=br.readLine();
            for(int i=0; i<4; i++) b[i] = Integer.parseInt(s1.split(" ")[i]);
             
            for(int i=0; i<4; i++){
                for(int j=0; j<4; j++){
                    if(a[i] == b[j] && i==j) hit++;
                    else if(a[i] == b[j])   blow++;
                }
            }
            System.out.println(hit + " " + blow);
        }
    }
}

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

int main()
{
	int S, h, m, s, rem;

	cin >> S;
	h = S / 3600;
	rem = S % 3600;
	m = rem / 60;
	s = rem % 60;


	cout << h << ':' << m << ':' << s << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];
ll dp[81];
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int a = 0;
    int b = 0;
    rep(i, 0, n)if(s[i] == 'R') a++;
    int ans = max(a,b);
    rep(i, 0, n){
        if(s[i] == 'R')a--;
        else b++;
        int now = max(a, b);
        ans = min(ans, now);
    }
    cout << ans << endl;
    return 0;
}


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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

#define space cout << endl;
#define test_data(data) cout << data << endl;
#define test_comp(var1, var2) cout << var1 << " " << var2 << endl;

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int64_t S; // input
  int ans;   // output

  int i, j, k, l;    // subscript
  int count;
  int comp; // comparison

  int bit;
  int64_t tmp;
  int64_t sum;


  /* Input, Array_Proclamation */
  cin >> S;


  /* Initialize */
  ans = 0;
  count = 0;
  sum = 0;



  /* Calculation */
  vector<int> digit;
  while( S > 0 )
  {
    digit.push_back( S%10 );
    S /= 10;
  }
  reverse( all(digit) );

  // vector<int> sum(1<<op.size(), 0);
  for(bit = 0; bit < ( 1 << digit.size() -1 ); bit++)
  {

    // cout << endl;
    // test_data(bit);
    vector<char> op;
    for(i=0; i<digit.size()-1; i++)
    {
      (bit & (1<<i))? op.push_back('+'): op.push_back(' ');
    }
    // test_comp(op.at(0), op.at(1));

    tmp = digit.at(0);
    for(i=0; i<op.size(); i++)
    {
      if(op.at(i) == '+')
      {
        sum += tmp;
        tmp = digit.at(i+1);
        // cout << "plus";
        // test_data(sum);
      }
      else
      {
        tmp = tmp*10 + digit.at(i+1);
        // cout << "space";
        // cout << tmp << endl;
      }
    }
    sum += tmp;
    // test_data(sum);
    // cout << "***\n";

  }
  
  // test_data(digit.size());
  // test_comp(op.size(), op.at(0).size());

  // tmp = digit.at(0);
  // for(bit = 0; bit < ( 1 << op.size() ); bit++)
  // {

  //   for(i=0; i<op.size(); i++)
  //   {
  //     cout << "bbb\n";
  //     if(op.at(bit).at(i) == '+')
  //     {
  //       sum.at(i) += tmp;
  //       tmp = digit.at(i+1);
  //     }
  //     else
  //     {
  //       tmp = digit.at(i)*10 + digit.at(i+1);
  //     }
  //   }
  //   cout << "ccc\n";
  //   sum.at(i) += tmp;

  // }

  // for(i=0; i<sum.size(); i++)
  // {
  //   ans += sum.at(i);
  // }


  /* Output */
  // space;
  cout << sum << endl;


  return 0;

}


/* entity */
//  - none -




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  cin>>a>>b;
  if(a == min(a,b)){
  for(int i=1;;i++){
    if((a*i)%b==0){
      c = a*i;
      break;
    }
  }
    cout<<c<<endl;
  }
  else{
    for(int i=1;;i++){
    if((b*i)%a==0){
      c = b*i;
      break;
    }
  }
    cout<<c<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, L, Q;
const ll MAX_N = 100000;
ll x[MAX_N];
const ll MAX_Q = 100000;
ll a[MAX_Q], b[MAX_Q];

ll dp[20][MAX_N];

void query(int l, int r) {
  int crt = l;
  int s = 0;
  while(1) {
    for(int i = 1; i < 20; i++) {
      if(dp[i][crt] >= r) {
        if(i == 1) {
          s += 1;
          cout << s << endl;
          return;
        } else {
          s += int(pow(2, i - 2));
          crt = dp[i - 1][crt];
          break;
        }
      }
    }
  }
}

int main(){
  cin >> N;
  REP(i, N) cin >> x[i];
  cin >> L;
  cin >> Q;
  REP(i, Q) cin >> a[i] >> b[i];

  
  int dest = 0;
  REP(j, N) {
    while(dest != N && x[j] + L >= x[dest]) {
      dest++;
    }
    dp[1][j] = dest - 1;
  }
  for(int i = 2; i < 20; i++) {
    REP(j, N) {
      dp[i][j] = dp[i - 1][dp[i - 1][j]];
    }
  }

  // for(int i = 1; i < 4; i++) {
  //   REP(j, N) cout << dp[i][j] << ", ";
  //     cout << endl;
  // }
  

  REP(i, Q) {
    int l = a[i], r = b[i];
    if(a[i] > b[i]) swap(l, r);
    query(l - 1, r - 1);
  }

  return 0;
}


Measured memory_bytes: 18048
#include <cstdio>
int main() {
	double n, m;
	scanf("%lf", &n);
	int u = n;
	m = (u % 2 == 0) ? 0.5 : (((n / 2.0) + 0.5) / n);
	printf("%.10lf\n", m);
	return 0;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    string s , t , st;

    int a , b;


    cin >> s >> t;

    cin >> a >> b;

    cin >> st;

    if(st==s)
    {
            cout << a-1 << " " << b << endl;
    }
    else if(st==t)
    {
        cout << a << " " << b-1 << endl;
    }
    else
    {
        cout << a << " " << b << endl;
    }





    return 0;
}



Measured memory_bytes: 256
n = int(input())
w = [input() for i in range(n)]
ans = "Yes"
if len(w) != len(list(set(w))):
  ans = "No"
else:
  for a in range(1,n):
    if w[a-1][-1] != w[a][0]:
      ans = "No"
      break
print(ans)

Measured memory_bytes: 3060
use std::io::*;
use std::cmp;

fn read<T: std::str::FromStr>() -> T {
    let stdin = stdin();
    let mut buf = String::new();
	stdin.lock().read_line(&mut buf);
	buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().trim().split_whitespace()
        .map(|w| w.parse().ok().unwrap()).collect()
}

fn read_vec_char() -> Vec<char> {
    read::<String>().chars().collect()
}

fn read_mat<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_mat_char(n: usize) -> Vec<Vec<char>> {
    (0..n).map(|_| read_vec_char()).collect()
}

fn main() {
    let t = read::<usize>();
    for i in 0..t {
        let v = read_vec::<i64>();
        let (mut a,b,c,d) = (v[0],v[1],v[2],v[3]);
        if a < b || d < b || a % b > c {
            println!("No");
        } else if b <= c+1 {
            println!("Yes");
        } else {
            let k = cmp::max(a+b-c-1,0) / b;
            a -= k * b;
            let e = d % b;
            if e == 0 {
                println!("Yes");
            } else if e < b-c {
                println!("No");
            } else {
                let mut g = b;
                let mut r = d;
                while r % g > 0 {
                    let t = g;
                    g = r % g;
                    r = t;
                }
                let x = if (c-a) % g == 0 { (c-a)/g + 1 } else { (c+g-a-1)/g };
                if x <= (b-a-1) / g {
                    println!("No");
                } else {
                    println!("Yes");
                }
            }
        }
    }
}


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

/*  using namespace  */
using namespace std;

/*  local var  */

/*  define  */
#define loop(i,j) for(int i = 0; i < j; i++)

/*  typedef  */
typedef long long ll;

/*  function  */
//None

/*  main program  */
int main()
{	
	ll N,B;
	cin>>N>>B;
	if(N<=5) cout<<0<<endl;
	else if(N>=6&&N<=12) cout<<B/2<<endl;
	else cout<<B<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace	std;
int main(){

  int n,a[200],r=0;
  cin>>n;
  for(int i=0;i<2*n;i++) cin>>a[i];
  sort(a,a+n*2);
  for(int i=0;i<n;i++) r+=a[i*2];
  cout<<r<<endl;
  return 0;

}















Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> key;

void solve() {
  int n;
  vector<int> v;
  cin >> n;
  for(int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  ll cand = 0;
  {
    sort(v.begin(), v.end());
    map<int, int> dp;
    for(int i = 1; i < n; i++) {
      int j = i-1;
      if(i%2) dp[i]++; else dp[i]--;
      if(j%2) dp[j]++; else dp[j]--;
    }
    vector<int> scale;
    for(int i = 0; i < n; i++) scale.push_back(dp[i]);
    sort(scale.begin(), scale.end());
    ll ret = 0;
    for(int i = 0; i < n; i++) ret += scale[i] * v[i];
    cand = max(cand, ret);
  }
  {
    sort(v.begin(), v.end());
    map<int, int> dp;
    for(int i = 1; i < n; i++) {
      int j = i-1;
      if(i%2==0) dp[i]++; else dp[i]--;
      if(j%2==0) dp[j]++; else dp[j]--;
    }
    vector<int> scale;
    for(int i = 0; i < n; i++) scale.push_back(dp[i]);
    sort(scale.begin(), scale.end());
    ll ret = 0;
    for(int i = 0; i < n; i++) ret += scale[i] * v[i];
    cand = max(cand, ret);
  }
  cout << cand << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << " ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,k; cin >> n >> k;
  vi x(n); rep(i,n) cin >> x[i];
  ll sum = 0;
  rep(i,k-1) sum += x[i+1]-x[i];
  ll ans = INF;
  rep(i,n-k+1){
    chmin(ans,sum+min(abs(x[i]),abs(x[i+k-1])));
    sum -= x[i+1]-x[i];
    sum += x[i+k]-x[i+k-1];
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
typedef long long ll;

#define pll pair<ll,ll>
#define ff first
#define snd second
#define pb push_back
#define vll vector<ll>
#define vpll vector<pll>
#define endl "\n"
#define MOD 1000000007
using namespace std;

ll const N = 1e5+1;


void solve()
{
   ll n,k;
   cin>>n>>k;
   ll a[n+1];
   for(int i=1;i<=n;i++)
   cin>>a[i];
   
   vll v;
   map<ll,int>m;
   int town = 1;
   int i=0;
   while(k>0)
   {
        if(m.find(town)!=m.end())
        {
             //cout<<k<<" ";        
             ll cycle_length = v.size() - m[town];
             k%=cycle_length;
             
                cout<<v[m[town]+k];
                return;
        }
        else
        {
               // cout<<town<<" "<<k<<endl;
                v.pb(town);
                k--;
                
                m[town] = i;
                town = a[town];
                i++;
        }
   }
   
   cout<<town;
}
 
int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
	    int t=1;
	    //cin>>t;
	    while(t--)
	    {
	            solve();
	    }
	    return 0;
}

Measured memory_bytes: 15900
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N, K = MI()
A = LMI()

d = dict()
seen = set()
i = 0
cur = 0
while True:
    if i > 0:
        cur = A[cur] - 1
    if cur in seen:
        break
    d[i] = cur
    seen.add(cur)
    i += 1

def get_loop_size(start):
    c = start
    size = 0
    while size == 0 or c != start:
        c = A[c] - 1
        size += 1
    return size

for k, v in d.items():
    if v == cur:
        start = k
        break
loop_size = get_loop_size(d[start])
if K < start:
    print(d[K] + 1)
else:
    idx = start + (K - start) % loop_size
    print(d[idx] + 1)

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

int main() {
    string s; cin >> s;
    int n = s.length();

    for (int i = 0; i < n - 1; i++) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 1 + 1 << endl;
            return 0;
        }
    }

    for (int i = 0; i < n - 2; i++) {
        if (s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 2 + 1 << endl;
            return 0;
        }
    }

    cout << "-1 -1" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 2e5+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

vector<int> adj[N];

void solve(){
    int n; cin>>n;
    int ans = 0;
    For(i, 1, n+1){
        ans += (i*(n-i+1));
    }
    For(i, 0, n-1){
        int u, v; cin>>u>>v;
        if(u > v){
            swap(u, v);
        }
        int x = (u)*(n-v+1);
        ans -= x;
    }
    cout<<ans;

}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



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

typedef unsigned long long ULL;

int main()
{
	ULL N, M, L;
	cin >> N >> M >> L;
	
	vector<vector<ULL>> matrix(N, vector<ULL>(M));
	for(auto it = matrix.begin(); it != matrix.end(); it++)
	{
		for(auto itx = it->begin(); itx != it->end(); itx++)
		{
			cin >> *itx;
		}
	}
	
	vector<vector<ULL>> matrix_B(M, vector<ULL>(L));
	for(auto it = matrix_B.begin(); it != matrix_B.end(); it++)
	{
		for(auto itx = it->begin(); itx != it->end(); itx++)
		{
			cin >> *itx;
		}
	}
	
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < L; j++)
		{
			ULL ans = 0;
			
			for(int k = 0; k < M; k++)
			{
				ans += matrix[i][k] * matrix_B[k][j];
			}
			
			cout << ans;
			if(j + 1 != L)cout << " ";
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = n; i >= 0; i--)
#define For(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
template <class T = int> T in(){T x; cin >> x; return (x);}

int main(void){
    vector<int> menu;
    rep(i, 5){
        int x = in();
        menu.push_back(x);
    }
    
    vector<int> rest;
    int sum = 0;
    rep(i, 5){
        int x = 10 - menu[i] % 10;
        if(x < 10){
        rest.push_back(x);
        sum += x;
        }
    }
    if(rest.size() != 0){
    sum -= *max_element(ALL(rest));
    }
    
    rep(i, 5){
       sum +=  menu[i];
    }
    
    cout << sum;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (w, h, x, y) = listOfDouble()
    val d = w * h / 2
    val s = if (w == x + x && h == y + y) 1 else 0
    println("${d} ${s}")
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfDouble() = listOfString().map { it.toDouble() }

Measured memory_bytes: 37868
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define int long long
//#define int __int128
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122

/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")

#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")

#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

const int N = 3005, MOD = 998244353;

int n, m, A, B;

int dp[N][N][2];

main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> A >> B;
    dp[n][m][1] = 1;
    for (int i = n; i <= A; i++)
        for (int j = m; j <= B; j++){
            if (i + j == n+m)
                continue;
            dp[i][j][0] = (dp[i-1][j][0] + dp[i-1][j][1]) * j % MOD;
            dp[i][j][1] = (dp[i][j-1][0] + dp[i][j-1][1] * i) % MOD;
        }
    cout << (dp[A][B][0] + dp[A][B][1]) % MOD << endl;
}


Measured memory_bytes: 144480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;
/*
ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		else a=a*a%MOD;
		b>>=1;
	}
	return res;
}
*/
int n;
ll a[maxn];
ll b[maxn];

int main()
{
	IOS;
	cin>>n;
	REP(i,n) cin>>a[i];

	ll sum=0;
	REP(i,n) sum+=a[i];

	ll meow=INF64;
	for(int i=0;i<=n;i++){
		REP(j,n) b[j]=(a[j]+i)%(n+1);
		REP(j,n) if(b[j]==n) b[j]-=n+1;
		
		ll step=sum;
		REP(j,n) step-=b[j];

		REP(i,n){
			if(b[i]>a[i]+step) b[i]-=n+1;
		}
		step=sum;
		REP(j,n) step-=b[j]; 
		meow=min(meow,step);
	}
	cout<<meow;
	return 0;
}


Measured memory_bytes: 2304
import math
n = int(input())
x = list(map(int, input().split()))
mu_floor = math.floor(sum(x)/len(x))
mu_ceil = math.ceil(sum(x)/len(x))
x_floor = list(map(lambda i:(i-mu_floor)**2, x))
x_ceil = list(map(lambda i:(i-mu_ceil)**2, x))
ans = min(sum(x_floor),sum(x_ceil))
print(ans)

Measured memory_bytes: 9144
# ALDS1_2_A: Bubble Sort
#N = 5
#A = [int(x) for x in "5 3 2 4 1".split()]

N = int(input())
A = list(map(int, input().split())) 


def bubbleSort(A, N):
    flag = True
    i = 0
    while(flag):
        flag = False
        for j in reversed(range(1, N)):
            if A[j] < A[j-1]:                
                A[j], A[j-1] = A[j-1], A[j]
                flag = True
                i += 1
                #print(A)
    print(" ".join(map(str, A)))
    print(i)
    
bubbleSort(A, N)


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;

vector<int> prime(1001000,1);


int main() {
	int n, m;
	prime[0] = 0;
	prime[1] = 0;

	for (int i = 2; i < 1000010; i++) {
		if (prime[i]) {
			for (int j = i + i; j < 1000100; j += i) {
				prime[j] = 0;
			}
		}
	}
	while (cin >> m >> n) {
		if (m == 0) break;
		int k = 1, t = (int)sqrt(m)+1;
		bool r = 1, u = 0, l = 0, d = 0;
		int i = t / 2, j = (t-1) / 2;
		vector<vector<int>> a(1010, vector<int>(1010));
		int x, y;
		for (int num = 1; num <= m; num++) {
			a[i][j] = num;
			if (num == n)x = i, y = j;
			if (r) {
				if (num == k * k + 1) {
					r = false;
					u = true;
					i--;
				}
				else j++;
			}
			else if (u) {
				if (num == k * k + k + 1) {
					k++;
					u = false;
					l = true;
					j--;
				}
				else i--;
			}
			else if (l) {
				if (num == k * k + 1) {
					l = false;
					d = true;
					i++;
				}
				else j--;
			}
			else if (d) {
				if (num == k * k + k + 1) {
					d = false;
					r = true;
					k++;
					j++;
				}
				else i++;
			}
		}
		/*for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				cout << a[i][j] << " ";
			}
			cout << endl;
		}*/

		
		vector<vector<ll>> dp(1010, vector<ll>(1010));
		for (int i = 0; i < 1010; i++)for (int j = 0; j < 1010; j++) dp[i][j] = -1e9;
		dp[x][y] = 0;


		

		for (int i = 0; i < 1010; i++) {
			for (int j = 0; j < 1010; j++) {
				if (i) {
					if (j && j + 1 < t) {
						dp[i][j] = max(max(dp[i][j],dp[i - 1][j - 1]), max(dp[i - 1][j], dp[i - 1][j + 1]));
					}
					else if (j) {
						dp[i][j] = max(dp[i][j],max(dp[i - 1][j - 1], dp[i - 1][j]));

					}
					else if (j + 1 < t) {
						dp[i][j] = max(dp[i][j],max(dp[i - 1][j], dp[i-1][j + 1]));
					}
				}
				if (prime[a[i][j]]) dp[i][j]++;
			}
		}
		ll ans = 0;
		ll mx = 0;
		for (int i = 0; i < 1010;i++) {
			for (int j = 0; j < 1010; j++) {
				//cout << dp[i][j] << " ";
				if (prime[a[i][j]] && ans < dp[i][j]) {
					ans = dp[i][j];
					mx = a[i][j];
				}
				else if (prime[a[i][j]] && ans == dp[i][j]) {
					mx = max(mx, (ll)a[i][j]);
				}
			}
			//cout << endl;
		}
		if (ans == 0) mx = 0;

		cout << ans << " " << mx << endl;

	}
}


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

int main(){
	string s;
	cin >> s;
	s += 'R';
	int gatherPoint,byePointS=0,byePointE;
	int roomNumL = 0;
	int output;
	for (int i = 1;i < s.size();i++) {
		roomNumL++;
		if (s.at(i-1)=='R' && s.at(i)=='L') {
			gatherPoint = i;
		}else if (s.at(i - 1) == 'L' && s.at(i) == 'R') {
			byePointE = i;
			for (int j = 0;j < gatherPoint - byePointS-1;j++) {
				cout << 0<<' ';
			}
			cout << ((gatherPoint - byePointS) + 1) / 2 + (byePointE - gatherPoint) / 2<<' ';
			cout << (gatherPoint - byePointS) / 2 + ((byePointE - gatherPoint)+1) / 2<<' ';
			for (int j = 0;j < byePointE - gatherPoint - 1;j++) {
				cout << 0<<' ';
			}
			byePointS = i;
		}
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 640
K, N = map(int,input().split())
A = input().split()
for i in range(N):
    A[i] = int(A[i])
max = 0
for i in range(N-1):
    diff = abs(A[i] - A[i+1])
    if diff >= max:
        max = diff

if abs(K - A[N-1] + A[0]) >= max:
    max = abs(K - A[N-1] + A[0])

print(K - max)

Measured memory_bytes: 19140
n = gets.chomp.to_i
nums = gets.chomp.split.map(&:to_i)
freq = Array.new(100001){0}
nums.each do |a|
    freq[a] += 1
end
count = []
n.times do |i|
    count << freq[nums[i] - 1] + freq[nums[i]] + freq[nums[i] + 1]
end
puts count.max


Measured memory_bytes: 10372
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a[] = {0, 1867, 1911, 1925, 1988};
    string s = " MTSH";
    int p, q;
    cin >> p >> q;
    if(p){
        cout << a[p]+q << "\n";
    }else {
        for (int i = 4; i >= 1; --i) {
            if(a[i] < q) {
                cout << s[i] << q-a[i] << "\n";
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3220
#include<map>
#include<algorithm>
using namespace std;
#define SIZE 100002
#define QUERY 10001
int shop[SIZE];

int Bsearch(int n,int target){
  int l=0,r=n-1;
  int mid;
  while(l < r){
    mid = (r+l)/2;
    if ( shop[mid]> target){
      r=mid;
    }else if ( shop[mid]<target){
      l=mid;
    }else return 0;
    if ( l+1== r )break;
  }
  int ret1 = max(shop[mid],target)-min(shop[mid],target);
  int ret2 = max(shop[(mid+1)%n],target)-min(shop[(mid+1)%n],target);
  int ret3 = max(shop[(mid+n-1)%n],target)-min(shop[(mid+n-1)%n],target);  
  //cout << shop[mid] << " " << target << endl;
  return min(ret1,min(ret2,ret3));
}

int solve(int n,map<int,int> &M){
  map<int,int>::iterator itr = M.begin();
  int ret =0;
  while(itr != M.end()){
    ret+= Bsearch(n,(*itr).first) * (*itr).second;
    itr++;
  }
  return ret;
}

main(){
  int d,n,m;
  while(cin>>d>>n>>m && d){
    shop[0]=0;
    for(int i=1;i<n;i++){
      int tmp;
      cin>>tmp;
      shop[i]=tmp;
    }
    shop[n++]=d;
    sort(shop,shop+n);
    map<int,int> M;
    for(int i=0;i<m;i++){
      int tmp;
      cin>>tmp;
      M[tmp]++;
    }
    cout <<solve(n,M)<<endl;
    
  }
  return false;
}

Measured memory_bytes: 1616
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
typedef int ll;
/*ll gcd(ll a,ll b){
    return (b == 0)?a:gcd(b, a % b);
}*/

ll  gcd(ll a, ll b){
    ll t;
    while(b>0){
        t = a % b;
        a = b;b = t;
    }
    return a;
}
ll lcm(ll a, ll b){
    return a / gcd(a,b) * b;
}
int main()
{
	ll a,b;
	while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
a, b, c, d = map(int, input().split())

if c % b == 0:
    taka = c // b
else:
    taka = c // b + 1

if a % d == 0:
    aoki = a // d
else:
    aoki = a // d + 1

if taka <= aoki:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
#include <bits/stdc++.h>
//#define mp make_pair
using namespace std;
typedef pair<int, int> pii;

int N;
int arr[300006];
long long sum1, sum2, ans;
priority_queue<int> q2;
priority_queue<int, vector<int>, greater<int> > q1;
long long L[300006], R[300006];

int main() {
	cin>> N;
	for(int i = 0; i < 3*N; i++) {
		cin>> arr[i];
		if(i < N) {
			q1.push(arr[i]);
			sum1 += arr[i];
		}
		else if(2*N <= i) {
			q2.push(arr[i]);
			sum2 += arr[i];
		}
	}
	L[N -1] = sum1;
	for(int k = N; k < 2*N; k++) {
		q1.push(arr[k]);
		sum1 += arr[k] - q1.top();
		L[k] = sum1;
		q1.pop();
	}
	R[2*N] = sum2;
	for(int k = 2*N - 1; k >= N; k--) {
		q2.push(arr[k]);
		sum2 += arr[k] - q2.top();
		R[k] = sum2;
		q2.pop();
	}
	ans = -1e15;
	for(int k = N - 1; k < 2*N; k++)
		ans = max(ans, L[k] - R[k+1]);
	cout<< ans << endl;
	return 0;
}

Measured memory_bytes: 5240
#include<iostream>
#include<algorithm>
using namespace std;
int a[100005];
int main()
{
	int i,n,sum,k,x;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	sum=a[k-1]-a[0];
	for(i=k;i<n;i++)
	{
		x=a[i]-a[i-k+1];
		if(x<sum)
			sum=x;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 640
/*
    Problem 91
    https://atcoder.jp/contests/abc144/tasks/abc144_d
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double y = 2 * x / (a * b * b);
    double z = (a * a * a) / (2 * (a * a * b - x));
    if (a * a * b / 2 >= x)
        cout << fixed << setprecision(9) << 90 - atan(y) * 180 / pi << '\n';
    else
        cout << fixed << setprecision(9) << 90 - atan(z) * 180 / pi << '\n';
}


Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

    int ans = 0;
    for (int i = 0; i < N; i++) {
        vector<bool> appear1(26, false), appear2(26, false);
        for (int j = 0; j < i; j++) {
            appear1[S[j] - 'a'] = true;
        }
        for (int j = i; j < N; j++) {
            appear2[S[j] - 'a'] = true;
        }

        int curr = 0;
        for (int j = 0; j < 26; j++) {
            if (appear1[j] && appear2[j]) {
                curr++;
            }
        }

        ans = max(ans, curr);
    }

    cout << ans << endl;
}


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

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

  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = j+1; k < n; k++) {
        ll a = v.at(i);
        ll b = v.at(j);
        ll c = v.at(k);
        // 3本の棒の長さは異なること
        if (a == b || a == c || b == c) { continue; }
        if ((a+b>c) && (b+c>a) && (c+a>b)) {
          ans++;
        }
      }
    }
  }

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


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll mod = 1'000'000'007;
constexpr int max_n = 200'000 + 5;

int n, k;
vector<ll> as(max_n);

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin >> n >> k;
    for (size_t i = 0; i < n; i++)
    {
        cin >> as[i];
    }
    for (size_t i = 0; i < n - k; i++)
    {
        if (as[i] < as[i + k]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    

    return 0;
}


Measured memory_bytes: 4688
#include<cstdio>

int main(){
	int x, y, i;
	for(i=1; ;i++){
		scanf("%d %d",&x, &y);
		if (x==0&&y==0) break;
		else{
			if(x<y){
				printf("%d %d\n",x, y);
			}else{
				printf("%d %d\n",y, x );
			}
		}
	}

	return 0;
}


Measured memory_bytes: 2688
#include <vector>
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;
const int N = 200000;

int n;
int ans[N];
vector <int> a[N];
priority_queue< pair<int,int> > q;

int main(void)
{
	scanf("%d", &n);
	for (int i=1;i<n;++i)
	{
		int x, y; scanf("%d %d", &x, &y);
		a[x].push_back(y);
		a[y].push_back(x);
	}
	memset(ans,-1,sizeof ans);
	int m; scanf("%d", &m);
	for (int i=1;i<=m;++i)
	{
		int x, v; scanf("%d %d", &x, &v);
		ans[x] = v; q.push(make_pair(-v,x));
	}
	while (q.size())
	{
		int x = q.top().second;
		int v = -q.top().first;
		q.pop();
		for (int i=0;i<a[x].size();++i)
		{
			int y = a[x][i];
			if (ans[y] >= 0 and abs(ans[x]-ans[y]) ^ 1) {
				puts("No");
				return 0;
			}
			else if (ans[y] < 0) {
				ans[y] = v + 1;
				q.push(make_pair(-ans[y],y));
			}
		}
	}
	puts("Yes"); 
	for (int i=1;i<=n;++i)
		printf("%d\n", ans[i]);
	return 0;
} 

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

ll n, T;
vector<ll> a0;
ll presum[200200];
vector< pair<ll, ll> > a;
ll dp[200200][33];
bool cmp(pair<ll, ll> i, pair<ll, ll> j){
	return j.first * (i.second + 1LL) < i.first * (j.second + 1LL);
}

int main(){
	scanf("%lld%lld", &n, &T);
	rep(i, n){
		ll x, y;
		scanf("%lld%lld", &x, &y);
		if(x == 0) a0.push_back(y);
		else a.push_back(make_pair(x, y));
	}
	sort(a0.begin(), a0.end());
	sort(a.begin(), a.end(), cmp);
	rep(i, a0.size()){
		presum[i] = 1 + a0[i] + (i ? presum[i-1] : 0);
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0] = 0;
	rep(i, a.size()){
		rep(j, 31){
			if(dp[i][j] > T) continue;
			if(dp[i][j] < dp[i+1][j]) dp[i+1][j] = dp[i][j];
			ll now_t = dp[i][j] + 1 + a[i].first * (dp[i][j] + 1) + a[i].second;
			if(now_t > T) continue;
			if(now_t < dp[i+1][j+1]) dp[i+1][j+1] = now_t;
		}
	}
	ll ans = 0;
	ll fdsa = a.size();
	rep(i, 31){
		if(dp[fdsa][i] > T) continue;
		ll val = T - dp[fdsa][i];
		ll l = 0, r = a0.size()-1;
		while(l <= r){
			ll mid = (l+r) >> 1;
			if(presum[mid] <= val) l = mid+1;
			else r = mid-1;
		}
		if(i + r + 1 > ans) ans = i+r+1;
	}
	cout << ans << endl; 
	return 0;
}

Measured memory_bytes: 56044
#include<stdio.h>
#include<malloc.h>

void swap(int *VerticalLine, int a, int b)
{
	int temp;

	temp = VerticalLine[a];
	VerticalLine[a] = VerticalLine[b];
	VerticalLine[b] = temp;
	
	return;
}

int main(void)
{
	int *VerticalLine;
	int *a, *b;
	int w, n;
	int i;
	
	scanf("%d", &w);
	scanf("%d", &n);
	
	VerticalLine = (int *)malloc(sizeof(int) * w);
	for(i = 0; i < w; ++i)
	{
		VerticalLine[i] = (i + 1);
	}
	a = (int *)malloc(sizeof(int) * n);
	b = (int *)malloc(sizeof(int) * n);
	
	for(i = 0; i < n; ++i)
	{
		scanf("%d,%d", &a[i], &b[i]);
	}
	
	for(i = 0; i < n; ++i)
	{
		swap(VerticalLine, (a[i] - 1), (b[i] - 1));
	}
	
	for(i = 0; i < w; ++i)
	{
		printf("%d\n", VerticalLine[i]);
	}
	
	free(VerticalLine);
	free(a);
	free(b);
	return 0;
}

Measured memory_bytes: 1024