akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0, 0] for _ in range(42)]

for i in range(1, 42):
    if dp[i-1][1] == 1:
        dp[i][1] = 1

    ctr = 0
    for j in range(n):
        if (a[j]>>(41-i))&1 == 1:
            ctr += 1
    if ctr >= n-ctr:
        dp[i][0] = dp[i-1][0] + ctr*(2**(41-i))
        if (k >> (41-i))&1 == 1:
            dp[i][1] = 1
    else:
        if dp[i][1] == 1:
            dp[i][0] = dp[i-1][0]+(n-ctr)*(2**(41-i))
        else:
            if (k >> (41-i))&1 == 1:
                dp[i][0] = dp[i-1][0]+(n-ctr)*(2**(41-i))
            else:
                dp[i][0] = dp[i-1][0]+ctr*(2**(41-i))
print(dp[41][0])

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int N, M, K;
    int t, f[30];
    cin >> N >> M;
    REP(i, M) f[i] = 0;
    REP(i, N){
        cin >> K;
        REP(j, K){
            cin >> t;
            f[t - 1]++;
        }
    }
    int ans = 0;
    REP(i, M) ans += (f[i] == N);
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop
import sys
readline = sys.stdin.readline
ans = []
Q = int(readline())

QL = [10**10]
QR = [10**10]
R = 0

for i in range(Q):
    t, *A = map(int, input().split())
    if t == 1:
        a, b = A
        R += b
        if -QL[0] <= a <= QR[0]:
            heappush(QL, -a)
            heappush(QR, a)
        elif a <= -QL[0]:
            heappush(QL, -a)
            heappush(QL, -a)
            c = heappop(QL)
            R -= c + a
            heappush(QR, -c)
        elif QR[0] <= a:
            heappush(QR, a)
            heappush(QR, a)
            c = heappop(QR)
            R += a - c
            heappush(QL, -c)
    else:
        ans.append("%d %d\n" % (-QL[0], R))
sys.stdout.writelines(ans)

Measured memory_bytes: 21748
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>

using namespace std;

#define INT_MAX 2147483647

long gcd(long m, long n);
long lcm(long m, long n);

int main(void) {

	int ans = 0;
	int a, b;
	cin >> a >> b;
	ans = b - a;
	if (b%a == 0) ans = a + b;

	cout << ans << endl;
	return 0;

}

//std::string result = s.substr(2, 3);  // 2番目から3要素だけ抜き出した部分文字列を取得する

//最大公倍数
long gcd(long m, long n)
{
	long temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
long lcm(long m, long n)
{
	return m * n / gcd(m, n);
}


Measured memory_bytes: 256
def cnt_facts(n):
    a = 2
    lst = []
    while a**2 <= n:
        if n % a == 0:
            ex = 0
            while n % a == 0:
                ex += 1
                n //= a
            lst.append([a, ex])
        a += 1
    
    if n != 1: lst.append([n,1])
    
    return lst

n = int(input())
ans_d = {} #素因数分解を格納する辞書
for i in range(2,n+1): #n! の1,2,3...,n-1, nを順に素因数分解し、結果を統合
    l = cnt_facts(i)
    for i in l:
        k = i[0] #素数
        v = i[1] #指数
        if k not in ans_d:
            ans_d[k] = v
        else:
            ans_d[k] += v

#print(ans_d)
mod = 10**9 + 7
ans = 1
for v in ans_d.values():
    ans *= v + 1
print(ans%mod)

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

 
int main()
{
 int n;
 cin>>n;
 int i=0;
 //if(n==1){cout<<999<<endl;return 0;}
 while(i<n){i+=1000;}
 cout<<i-n<<endl; 
 return 0;
}

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

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

LL H,W;
char S[403][403] = {0};
int visited[403][403] = {0};
LL black = 0;
LL white = 0;
int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

void f(int i, int j, char pre){
    if(!(0<=i && i<H && 0<=j && j<W))return;
    if(visited[i][j])return;
    char now = S[i][j];
    if(now == pre)return;
    visited[i][j] = 1;
    if(now == '#')black++;
    if(now == '.')white++;
    f(i+1, j, now);
    f(i-1, j, now);
    f(i, j+1, now);
    f(i, j-1, now);
}

void f2(int i, int j){
    if(visited[i][j])return;
    visited[i][j] = 1;
    char now = S[i][j];
    if(now == '#')black++;
    if(now == '.')white++;
    //REP(k,4){
    //    int ni = i+dir[k][0];
    //    int nj = j+dir[k][1];
    //    if(!(0<=ni && ni<H && 0<=nj && nj<W))continue;
    //    if(now == S[ni][nj])continue;
    //    f2(ni, nj);
    //}
    if(i+1 < H && now != S[i+1][j]){
        f2(i+1,j);
    }
    if(i-1 >= 0 && now != S[i-1][j]){
        f2(i-1,j);
    }
    if(j+1 < W && now != S[i][j+1]){
        f2(i,j+1);
    }
    if(j-1 >= 0 && now != S[i][j-1]){
        f2(i,j-1);
    }
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>H>>W;
    REP(i,H)REP(j,W)cin>>S[i][j];
    LL ans = 0;
    REP(i,H)REP(j,W){
        black = 0;
        white = 0;
        //f(i, j, 'X');
        f2(i, j);
        ans += black * white;
    }
    PUTS(ans);
}

Measured memory_bytes: 13568
program shift
  implicit none
  integer(8), parameter :: modu = 998244353
  character(301) :: s
  integer :: k, n, a(302) = 0, m = 1, x = 0, h = 0, r, d, w, c, b, i, j
  integer(8) :: dp(0:300, 0:301) = 0
  read(*,*) s, k
  n = len_trim(s)
  s(n + 1:n + 1) = '0'
  do i = 1, n + 1
    if (s(i:i) == '0') then
      m = m + 1
      a(m) = x
    else
      x = x + 1
    end if
  end do
  k = min(k, x)
  dp(0, 0) = 1
  do i = 1, m - 1
    do j = h, 0, -1
      r = min(k - j, a(i + 1) - a(i))
      do d = 1, r
        w = j + d
        b = a(m) - a(i + 1) + d
        do c = 0, a(m) - a(i + 1)
          b = c + d
          dp(w, c) = dp(w, c) + dp(j, b)
          if (dp(w, c) > modu) dp(w, c) = dp(w, c) - modu
        end do
      end do
      do c = 1, a(m) - a(i + 1)
        dp(j, c) = dp(j, c) + dp(j, c - 1)
        if (dp(j, c) > modu) dp(j, c) = dp(j, c) - modu
      end do
    end do
    h = min(k, h + a(i + 1) - a(i))
  end do
  write(*,'(i0)') mod(sum(dp(0:h, 0)), modu)
end program shift

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



int main(){
	int n, m;
	cin >> n >> m;
	if(n==m) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        int N = Input();
        int K = Input();
        int X = Input();
        int Y = Input();
        int sum = 0;
        if (K > N) sum += N * X;
        else sum += K * X;
        sum += (N-K < 0)?0:(N-K)*Y;
        Console.WriteLine(sum);
    }
    static int Input()
    {
        return int.Parse(Console.ReadLine());
    }
}

Measured memory_bytes: 2776
#include <bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define ll long long
#define inf LLONG_MAX
using namespace std;
int n,ans,k,nums[200004];

signed main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)nums[i%k]++;
	for(int i=0;i<k;i++){
		int b=(k-i)%k;
		int c=(k-i)%k;
		if((b+c)%k)continue;
		ans+=nums[i]*nums[b]*nums[c];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

@mt
def slv(N, A):
    M = Mod(1000000007)
    ans = 1
    rem = Counter()
    c = 0
    for a in A:
        if a == 0:
            c +=1
        if rem[a-1] > 0:
            ans = M.mul(ans, rem[a-1])
            rem[a-1] -= 1
        elif a != 0 and rem[a-1] == 0:
            return 0
        rem[a] += 1

    if c > 3:
        return 0
    if c == 1:
        ans = M.mul(ans, 3)
    else:
        ans = M.mul(ans, 6)
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20724
n=int(input())
a=list(map(int,input().split()))

ans=[0]*8
count=0
for i in range(n):
    if 8<=a[i]//400:
        count+=1
    else:
        ans[a[i]//400]=1
#print(ans)
if sum(ans)==0:
    print(1,min(8,count))
else:
    print(sum(ans),sum(ans)+count)



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

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt(),c=s.nextInt();
        if(a+b>=c) System.out.println("Yes");
        else System.out.println("No");
    }


}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

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

int main(int argc , char* argv[]){
	int n; cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n-1);
	for(int i=0;i<n;++i) cin >> a[i];
	for(int i=0;i<n;++i) cin >> b[i];
	for(int i=0;i<n-1;++i) cin >> c[i];
	int ans=0;
	for(int i=0;i<n;++i){
		if(a[i]==(a[i-1]+1) && i>=1 ) { ans+=b[a[i]-1]+c[a[i-1]-1]; continue; }
		ans+=b[a[i]-1];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n, m= map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
ans = [0] * n
for i,ablist in enumerate(ab):
    mindist = 4 * (10**8)+1
    for j,cdlist in enumerate(cd):
        dist = abs(ablist[0]-cdlist[0])+abs(ablist[1]-cdlist[1])
        if dist < mindist:
            mindist = dist
            ans[i] = j+1
for i in range(n):
	print(ans[i])

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

int main() {
    int X, Y; cin >> X >> Y;
    bool exist_ans = false;
    for (int i = 0; i <= X; i++) {
        if (i * 2 + (X - i) * 4 == Y) {
            exist_ans = true;
        }
    }
    if (exist_ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3608
N,M = map(int,input().split())
F = [[] for _ in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    A -= 1
    B -= 1
    F[A].append(B)
    F[B].append(A)
a = [1 for _ in range(N)]
l = []
b = [0 for _ in range(N)]
for j in range(N):
    mem = 1
    a[j] = 0
    nex = F[j]
    while True:
        que = nex
        nex = []
        for k in que:
            if a[k] == 1:
                a[k] = 0
                mem += 1
                nex.extend(F[k])
        if nex == []:
            break
    l.append(mem)
print(max(l))

Measured memory_bytes: 47772
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> p;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define srep(i, from, to) for(int i = from; i < (int)(to); i++)
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
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;
}

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i, h) {
    cin >> a[i];
  }
  vector<bool> skiph(h);
  vector<bool> skipw(w);
  rep(i, h) {
    bool ok = true;
    rep(j, w) {
      if(a[i][j] == '#') ok = false;
    }
    skiph[i] = ok;
  }
  rep(i, w) {
    bool ok = true;
    rep(j, h) {
      if(a[j][i] == '#') ok = false;
    }
    skipw[i] = ok;
  }

  rep(i, h) {
    if(skiph[i]) continue;
    rep(j, w) {
      if(skipw[j]) continue;
      cout << a[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007



int main(){
	int t,n,s,f;
	int sum;
	while(cin>>t && t>0){
		sum=0;
		cin>>n;
		rep(i,n){
			cin>>s>>f;
			sum+=f-s;
		}
		//cout<<sum<<":"<<t<<endl;
		if(t<=sum)cout<<"OK"<<endl;
		else cout<<t-sum<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N;
vector<pii> V;

void input() {
  int x, y, z;
  cin >> N;
  V.resize(N);
  rep(i, 0, N - 1) { cin >> V[i].first >> V[i].second; };
}
void solve() {
  ;
  int ans = 0;
  for (auto x : V) {
    int l = x.first;
    int r = x.second;
    ans += (r - l + 1);
  };
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}

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


Xmin = X-K+1
Xmax = X+K-1

if Xmin < -1000000:
  Xmin = -1000000

if Xmax>1000000:
  Xmax=1000000
  
Xrange = list(range(Xmin,Xmax+1,1))

print(" ".join( repr(e) for e in Xrange ) )

Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include <string>
#include<algorithm>
using namespace std;

int main()
{
    int a,b,c;
    int sum =0;
    cin >> a >>b;
    
    if(a<=b)
    {
        printf("%d",a);
    }
    if(a>b)
    {
        printf("%d",a-1);
    }


    
    
    
}



Measured memory_bytes: 3188
//#define _USE_MATH_DEFINES
//#include <math.h>
#include <iostream>
//#include <iomanip>
//#include <bits/stdc++.h>

using namespace std;

int main() {
    
    int n,x;
    while (cin >> n >> x){
        int a = 0;
        if(n == 0 && x == 0) break;
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                if(i != j){
                    for(int k = 1; k <= n; k++){
                        if(j != k && i != k && i+j+k == x) a++;
                    }
                }
            }
        }
        cout << a/6 << endl;
    }
}


Measured memory_bytes: 3096
#include "bits/stdc++.h"

using namespace std;

void Main() {
    long long N, M;
    cin >> N >> M;

    if (N >= M / 2) {
        cout << (M / 2) << endl;
        return;
    }

    long long ans = N;
    M -= 2 * N;
    ans += M / 4;
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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


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

	int Y = 0;

	vector<int> S(N);
	vector<int> K(N);

	for (int i = 0; i < N; i++) {
		cin >> S.at(i) >> K.at(i);
	}

	for (int m = 0; m < N; m++) {
		Y += (K.at(m) - S.at(m) + 1);
	}

	cout << Y << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,K; cin>>N>>K;
	ll ans = 0;
	for(int i = K+1; i<=N; ++i){
		ans += (N+1)/i * (i-K);
		ans += max(0, (N+1)%i-K);
	}
	if(K == 0)ans -= N;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
   unsigned int a,b;
   cin>>a>>b;
   if(a<=5){
       cout<<0;
   }
   else if(a>=6 && a<=12){
       cout<<b/2;
   }
   else{
       cout<<b;
   }
   
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct Edge{
  int u, v;
  ll c;
  Edge(int u, int v, ll c) :
    u(u), v(v), c(c) {}
  bool operator < (const Edge& e) const {
    return c > e.c;
  }
};
typedef vector<Edge> Node;
typedef vector<Node> Graph;
void dijkstra(vector<ll>& dist, Graph& G, int s){
  int N = G.size();
  dist = vector<ll>(N, -1);
  priority_queue<Edge> que;
  que.push(Edge(-1, s, 0));
  dist[s] = 0;
  while(!que.empty()){
    Edge e = que.top(); que.pop();
    if(dist[e.v] < e.c) continue;
    REP(i, G[e.v].size()){
      Edge f = G[e.v][i];
      if(dist[f.v] == -1 || dist[f.v] > e.c + f.c){
        dist[f.v] = e.c + f.c;
        que.push(Edge(f.u, f.v, e.c + f.c));
      }
    }
  }
}

struct RangeTree{
  static const int ST_SIZE = (1<<17);
  vector<ll> dat[2 * ST_SIZE];
  void init(int k, int l, int r, vector<ll>& v){
    if(r - l == 1){
      dat[k].push_back(v[l]);
    }else{
      int lch = k * 2 + 1, rch = k * 2 + 2;
      init(lch, l, (l + r) / 2, v);
      init(rch, (l + r) / 2, r, v);

      dat[k].resize(r - l);
      merge(dat[lch].begin(), dat[lch].end(), dat[rch].begin(), dat[rch].end(), dat[k].begin());
    }
  }
  int query(int i, int j, ll x, int k, int l, int r){
    if(j <= l || r <= i) return 0;
    if(i <= l && r <= j){
      return upper_bound(dat[k].begin(), dat[k].end(), x) - dat[k].begin();
    }else{
      int lc = query(i, j, x, 2 * k + 1, l, (l + r) / 2);
      int rc = query(i, j, x, 2 * k + 2, (l + r) / 2, r);
      return lc + rc;
    }
  }
};



int main(){
  int N, M;
  while(cin>>N>>M && N){
    Graph G(N);
    REP(i, M){
      int a, b, c;
      cin>>a>>b>>c;
      G[a].push_back(Edge(a, b, c));
      G[b].push_back(Edge(b, a, c));
    }
    vector<ll> dist, rdist;
    dijkstra(dist, G, 0);
    dijkstra(rdist, G, N - 1);

    vector<pair<ll, ll> > ps(N);
    REP(i, N){
      ps[i] = make_pair(dist[i], -rdist[i]);
    }
    sort(ps.begin(), ps.end());
    REP(i, N) {
      dist[i] = ps[i].first;
      rdist[i] = ps[i].second;
    }
    RangeTree tree;
    tree.init(0, 0, N, rdist);

    int Q; cin>>Q;
    REP(i, Q){
      ll fs, fg;
      cin>>fs>>fg;
      int e = upper_bound(dist.begin(), dist.end(), fs) - dist.begin();
      int ans = tree.query(0, e, -fg, 0, 0, N);
      cout<<ans<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 35152
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten53 300005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;

//stack<char> stk;
//set<ll> sll;
//set<pair<ll,ll>> spll;
//map<string,ll> mp;
//map<ll,ll> mp;
//deque<ll> deq;
vector<ll> vll,v1,v2,v3;
ll num[ten52],num2[ten52];
//priority_queue<pair<ll,ll>> pq;          //decreasing

int main(void)
{
    ll m,n,i,j,k=0,a,b,c,d,ans=0;
    string s="";
    cin>>a>>b>>c>>d;
    m=max(a*c,max(a*d,max(b*c,b*d)));
    cout<<m;
    return 0;
}





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

int main(){
	int H,W,A,B;
	cin >> H >> W >> A >> B;
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if((i<B && j<A)||(i>=B && j>=A))cout << '1';
			else cout << '0';
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1280
import math
n = int(input())
k = n
l = []
for i in range(2, int(math.sqrt(n))+1):
    while k % i ==0:
        l.append(i)
        k = k // i
        if k == 1:
            break

if k != 1:
    l.append(k)
print("{}: ".format(n),end="")
print(*l)



Measured memory_bytes: 5664
#define REP(i,n) for (int i=0;i<(n);i++)
#include <iostream>
using namespace std;

int main(){
	int N;
	while(cin >> N && N > 0){
		int a[N];
		REP(i,N){
			cin >> a[i];
		}

		int maximum = a[0];
        REP(i,N){
            int sum = 0;
            for(int j = i; j < N; j++){
					sum += a[j];
                    maximum = max(sum,maximum);
            }
		}
		cout << maximum << endl;
	}
}

Measured memory_bytes: 1168
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x)) 
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  l--;
  int tmp= 1 << 30;
  reps(i, n){
    if(abs(tmp) > abs(i + l)){
      tmp = i + l;
    }
  }
  int ans = 0;
  reps(i, n)
    ans += i + l;

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



Measured memory_bytes: 256
#include <iostream>
#include <string>

int main() {
    std::string s;
    long long n;

    std::cin >> s >> n;

    for(int i = 0; i < s.size(); ++i) {
        if(s[i] != '1') {
            std::cout << s[i] << std::endl;

            return 0;
        }

        if(n == i + 1) {
            std::cout << 1 << std::endl;

            return 0;
        }
    }
}

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

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/


int main() {
    string rode;
    cin >> rode;
    int n = 0, s = 0;
    int w = 0, e = 0;

    rep(i, rode.size()) {
        switch (rode[i]) {
        case 'N':
            n++;
            break;
        case 'S':
            s++;
            break;
        case 'W':
            w++;
            break;
        case 'E':
            e++;
            break;
        }
    }
    if ((n == 0 && s != 0) || (n != 0 && s == 0)) {
        cout << "No" << endl;
        return 0;
    }
    if ((e == 0 && w != 0) || (e != 0 && w == 0)) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1005
#define inf 1e9
#define pb push_back
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

vector <int> p[maxn],w,tmp;
int n,nw[maxn],vis[maxn],pre[maxn],fl;

int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n-1;j++) {int x=read(); p[i].pb(x);}
		p[i].pb(inf);
	}
	int ans=0;
	for(int i=1;i<=n;i++) w.pb(i);
	while(1)
	{
		ans++; tmp.clear();
		//for(int i=1;i<=n;i++) vis[i]=0;
		for(int i=0;i<w.size();i++)
		{
			int x=w[i],u=p[x][nw[x]];
			if(u==inf||vis[x]||vis[u]) continue;
			if(p[u][nw[u]]==x)
			{
				nw[x]++; nw[u]++;
				vis[x]=1; vis[u]=1;
				tmp.pb(x); tmp.pb(u);
			}
		}
		
		for(int i=0;i<tmp.size();i++) vis[tmp[i]]=0;
		w=tmp; if(w.size()==0) break;
	}
	int f=0;
	for(int i=1;i<=n;i++) if(nw[i]!=n-1) f=1;
	if(f==1) puts("-1"); else cout<<ans-1<<endl;
	return 0;
}

Measured memory_bytes: 4352
n = int(input())
l = list(map(int, input().split()))
l.sort()

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                continue
            if l[i]+l[j] > l[k]:
                cnt+=1
print(cnt)

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

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	ll an = 0;
	f(b, k + 1, n + 1){
		int ln = b - k;
		an += n / b * (ll)ln;
		int lft = n % b;
		an += max(0, lft - k + 1);
	}
	if (k == 0)an -= n;
	printf("%lld\n", an);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
using namespace std;
int main(){
    int N;
    cin >> N;
    unsigned long long A[N];
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    unsigned long long count = 0;
    for(int i=1;i<N;i++){
        if(A[i]<A[i-1]){
            count = count + A[i-1]-A[i];
            A[i] = A[i-1];
        }
    }
    printf("%llu\n",count);
    return 0;
}

Measured memory_bytes: 5308
N = int(input())
if N==1:
    print(1)
else:
    L1 = 2
    L2 = 1
    L3 = L1+L2
    while N!=2:
        L1 = L2
        L2 = L3
        L3 = L1+L2
        N-=1
    print(L3)

Measured memory_bytes: 3060
n = int(input().strip())
if n == 1:
    print(1)
elif 2 <= n < 4:
    print(2)
elif 4 <= n < 8:
    print(4)
elif 8 <= n < 16:
    print(8)
elif 16 <= n < 32:
    print(16)
elif 32 <= n < 64:
    print(32)
elif 64 <= n <= 100:
    print(64)


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

vector<vector<int>> graph;
vector<int> ans;
vector<int> sum;
vector<bool> check;

void dfs(int x, int sumv) {
  ans[x] = sumv;
  check[x] = true;
  for (int i = 0; i < graph[x].size(); i ++) {
    if (!check[graph[x][i]]) dfs(graph[x][i], sumv + sum[graph[x][i]]);
  }
}

int main() {
  int n, q; cin >> n >> q;
  graph = vector<vector<int>>(n);
  rep(i, n - 1) {
    int a, b; cin >> a >> b;
    a --, b --;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  ans = vector<int>(n);
  sum = vector<int>(n);
  check = vector<bool>(n, false);
  rep(i, q) {
    int p, x; cin >> p >> x;
    p --;
    sum[p] += x;
  }
  dfs(0, sum[0]);

  rep(i, n) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
}

Measured memory_bytes: 24320
#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

int main(void)
{
    int64_t x, a, b;

    std::cin >> x >> a >> b;

    x -= a;

    while (x >= b) {
        x -= b;
    }

    std::cout << x << std::endl;

    return 0;
}

Measured memory_bytes: 256
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;

int main(void) {
   ll N;
   cin>>N;
   vector<ll> A(N+1);
   vector<ll> B(N);
   rep(i,0,N+1) cin>>A[i];
   rep(i,0,N) cin>>B[i];

   ll ans = 0;
   rep(i,0,N) {
      if (B[i]>A[i]) {
         ans += A[i];
         if (A[i+1] < B[i] - A[i]) {
            ans += A[i+1];
            A[i+1] = 0;
         } else {
            A[i+1] -= (B[i]-A[i]);
            ans += (B[i]-A[i]);
         }
      } else {
         ans += B[i];
      }
   }
   cout<<ans<<endl;




   return 0;
}

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


void solve(long long N, long long K, std::vector<long long> h){
    ll a=0;
    rep(i,N){
        (h[i]>=K) ? a++ : 1 ;
    }
    cout<<a<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::cout<<std::fixed<<std::setprecision(10);//誤差小数10桁まで
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[] a = new String[101];

		for (int i = 0; i < h; i++){
			a[i] = sc.next();
		}

		for (int i = 0; i < w+2; i++){
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < h; i++){
			System.out.println("#"+a[i]+"#");
		}

		for (int i = 0; i < w+2; i++){
			System.out.print("#");
		}
		System.out.println("");
		

	}
}

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

int main(){
	ll n, k;
    cin >> n >> k;
    vector<ll> ab(200000);
    for(ll i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        ab[a] += b;
    }

    ll num=0, ans=0;    
    for(ll i = 0; i < (ll)ab.size(); i++)
    {
        num += ab[i];
        if(num >= k){
            ans = i;
            break;
        }
    }
    
    
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll m,n;
int main()
{
  cin>>m>>n;
       ll mins=1e9;
 
      for(int i=m;i<=min(n,m+3000);i++)
      {
          for(int j=i+1;j<=min(n,m+3000);j++)
          {
             ll  sum=(ll)i*j%2019;
              mins=min(mins,sum);

          }

      }
      cout<<mins<<endl;
  
    return 0;
}


Measured memory_bytes: 256
import sys
def main():
    a = []
    for line in sys.stdin:
        hoge = int(line)
        if hoge != 0:
            a.append(hoge)
        else:
            break

    for x in range(len(a)):
        f = a[x] #factorial
        for y in range(1, a[x]):
            f *= y
        f = list(str(f))

        cnt = 0 #count
        for y in reversed(range(0, len(f))):
            if f[y] == "0":
                 cnt += 1
            else:
                break
        print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 8136
#include<stdio.h>
#include<iostream>
#include<vector>
#include <algorithm>
using namespace std;

int main(){ ; 
    string s;
    int n;
    int ans = 0;
    cin >> s ;
    n = s.size() ;
    for(int i = 0;i < n/2 ;i++){
        if (s[i] != s[n-i-1]){
            ans++;
        }
    }
    cout << ans << endl;

}   

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <set>
using namespace std;
int main(){
    int n;cin>>n;
    stack<int> A;
    set<int> B;
    for(int i = 0; n > i; i++){
        int z;cin>>z;
        if(z<0){
            if(A.size() && A.top()==abs(z)){
                A.pop();
                B.erase(abs(z));
            }else{
                cout << i+1 << endl;
                return 0;
            }
        }else{
            if(B.find(z)==B.end()){
                A.push(z);
								B.insert(z);
            }else{
                cout << i+1 << endl;
                return 0;
            }
        }
    }
    cout << "OK" << endl;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

using ll = long long;

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1){
            res = (res * a)%mod;
        }
        a = (a * a)%mod;
        b >>= 1;
    }
    return (res%mod);
}

signed main(){
	ll n;
    string s;
    cin >> n >> s;

    ll m = s.size();

    if(m > n){
        for(ll i=0;i<n;i++){
            cout << s[i];
        }
        cout << "...";
    }
    else{
        cout << s;
    }
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n,x,t;cin>>n>>x>>t;
    ll k=(n+x-1)/x;
    cout<<k*t<<endl;
    
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int n, k, cnt;
int a[200005];

int main()
{
    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; i++)
    {
        int t;
        scanf("%d", &t);
        a[t]++;
    }
    sort(a, a + n, greater<int>());
    for(int i = 0; i < k; i++)
    {
        cnt += a[i];
    }
    printf("%d", n - cnt);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main(){
bool all_same = true;
int A_count = 0;
int B_count = 0;
int ans = 0;
int n;
cin >> n;
for(int i = 0; i < n; i++){
     string s;
     cin >> s;
     for(int j = 0; j < (int)s.size()-1; j++){
           ans += s[j] == 'A' && s[j+1] == 'B';
     }
     bool B = false;
     bool A = false;
     if(s[0] == 'B'){
             B = true;
     }
     if(s[s.size()-1u] == 'A'){
            A = true;
     }
     A_count += A;
     B_count += B;
     if(A ^ B){
           all_same = false;
     }
}
ans += min(A_count, B_count) - (A_count && all_same);
cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<cmath>
#include    <iomanip>
using namespace std;

int main(void){
	double a,b,c,d,e,f,dod;
	cin>>a>>b>>c>>d;
	e=a-c;
	f=b-d;
	dod=pow(e,2)+pow(f,2);
	dod=sqrt(dod);
	cout<<setprecision(12)<<dod<<endl;
	return 0;
}



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

int main()
{
int i;
int N;
int T;
int A;
int H;
int iMin;
int iNum;
int iNew;

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

	cin >> N;
	cin >> T;
	cin >> A;

	T *= 1000;
	A *= 1000;

	iMin = 1000000000;
	iNum = 0;
	for( i = 1; i <= N; i++ )
	{
		cin >> H;

		iNew = abs( T - H * 6 - A );
		if( iMin > iNew )
		{
			iMin = iNew;
			iNum = i;
		}
	}

	cout << iNum << endl;

	return 0;
}





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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) (int)((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int k; cin >> k;
	string s = "1";
	int n = 1;
	while (--k) {
		int i = 0;
		while ((i < n && s[i] == '9') || (i < n-1 && s[i] > s[i+1]))
			i++;
		if (i == n) {
			s.push_back('0');
			n++;
		}
		s[i]++;

		for (i--; i >= 0; i--) s[i] = max('0', (char)(s[i+1] - 1));
	}
	reverse(all(s));
	cout << s << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define swap(type ,a ,b) {type t; t=a; a=b; b=t;}
#define forN(i,n) for(i=0;i<n;i++)
#define forR(i,s,n) for(i=s;i<n;i++)
#define ll long long
#define pb(t,d,n) {t p;int i;forN(i,n){cin>>p;d.push_back(p);}}

using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

bool cmp(pii &a, pii &b){
    return a.second > b.second;
}

int main(){
    int a,b;
    cin >> a >> b;
    if(a<10 && b<10) cout << a*b << endl;
    else cout << "-1\n";
}

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

int main() {
	int N;
	cin >> N;
  cout << (N+1)/2 << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

class UnionFind:
    def __init__(self, N): self.N, self.group_count, self.root, self.rank = N, N, [-1] * N, [0] * N
    def __repr__(self): return str(self.all_groups())

    def find(self, x):
        while self.root[x] >= 0: x = self.root[x]
        return x

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return
        if self.rank[x] > self.rank[y]: x, y = y, x
        self.root[y] += self.root[x]
        self.root[x] = y
        if self.rank[x] == self.rank[y]: self.rank[y] += 1
        self.group_count -= 1

    def same(self, x, y): return self.find(x) == self.find(y)
    def count(self, x): return -self.root[self.find(x)]
    def members(self, x): return [i for i in range(self.N) if self.same(x, i)]
    def roots(self): return [i for i, x in enumerate(self.root) if x < 0]
    def all_groups(self):
        d = defaultdict(lambda: [])
        for i in range(self.N): d[self.find(i)].append(i)
        return dict(d)


def main():
    N, Q = LI()
    TUV = LIR(Q)

    uf = UnionFind(N)

    for t, u, v in TUV:
        if t == 0:
            uf.union(u, v)
        else:
            print(int(uf.same(u, v)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 45048
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


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

  int a[n], b[n], c[n];
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  REP(i, n) cin >> c[i];

  sort(a, a+n);
  sort(c, c+n);
  LL ans =0;
  LL x, y;
  REP(i, n){
    x = (lower_bound(a, a+n, b[i]) - a);
    y = n - (upper_bound(c, c+n, b[i]) -c);
    ans += x*y;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1408
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma comment(linker, "/STACK:2000000")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'
using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  int cur = 0;

  int m, k;
  cin >> m >> k;

  if(m<=1){
      if(k==0){
          f(i,0,m+1)cout<<i<<' '<<i<< ' ';
      } else cout << -1 << '\n';
  } else if((1 << m) > k){
    int buffer = 1 + (k == 1);
    vector<int> v;  v.pb(k);
    f(i,0,1<<m)if(i!=k)v.pb(i);
    v.pb(k);
    for(int i = (1<<m)-1;i>=0;--i)if(i!=k)v.pb(i);
    for(auto x:v)cout<<x<<' ';
  } else {
    cout << -1 << '\n';
  }

  return 0;
}


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

int main()
{
    int n,i,j=0;
    cin>>n;
    int s[n+5]={0};
    string a;
    cin>>a;
    for(i=0;i<n;i++)
    {
        if(a[i]=='R')
        {
            s[i+1]=1;
            j++;
        }
    }
    int m=0;
    for(i=1;i<=n;i++)
    {
       if(s[i]==1&&i<=j)
            m++;
    }
    cout<<j-m<<endl;
    return 0;
}


Measured memory_bytes: 4452