akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

map<long long, long long> prime_divisors(long long n) {
    map<long long, long long> res;
    for (long long i = 2; i * i <= n; ++i) {
        long long cnt = 0;
        while (n % i == 0) {
            n /= i;
            ++cnt;
        }
        if (cnt) res[i] = cnt;
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    long long N;  cin >> N;
    long long ans = 0;
    // DUMP(prime_divisors(N));
    for (auto e : prime_divisors(N)) {
        long long x = 1;
        while (true) {
            if (x * (x + 1) > 2 * e.second) break;
            ++x;
        }
        ans += x - 1;
    }
    cout << ans << endl;
}


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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int N = (int)2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;

int n, k, a[N];
ll pre[N], suf[N], sum, ans;
int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++){
		pre[i] = pre[i - 1];
		if(a[i] > 0)
			pre[i] += a[i];
	}
	for(int i = n; i >= 1; i--){
		suf[i] = suf[i + 1];
		if(a[i] > 0)
			suf[i] += a[i];
	}
	for(int i = 1, j = 1; i + k - 1 <= n; i++){
		while(j <= i + k - 1)
			sum += a[j], j++;	
		ans = max(ans, pre[i - 1] + suf[i + k] + max(0ll, sum));
		sum -= a[i];
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
using namespace std;
int main(void){
	string s;
	cin >> s;
	string r="";
	for(auto a=s.begin();a!=s.end();a++){
		if(r=="")if(*a=='B')continue;
		if(*a=='B')r.pop_back();
		else if(*a=='0')r+='0';
		else if(*a=='1')r+='1';
	}
	cout << r << endl;
	return 0;
}

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

typedef long long ll;
ll n;
int main()
{
	ll i, j, t;
	cin >> n;
	for (i = 1; i <= 3500; i++) {
		for (j = 1; j <= 3500; j++) {
			t = 4 * i * j - i * n - j * n;
			if (t > 0 && n * i * j % t == 0 && n * i * j / t > 0) {
				printf("%lld %lld %lld", i, j, n * i * j / t);
				return 0;
			}
		}
	}
    return 0;
}

Measured memory_bytes: 256
tanka=[]
tanka=[int(x) for x in input().split()]
i=0
fiv=0
sev=0

#5の数を数える
while i < 3:
	if tanka[i]==5:
		fiv += 1
	elif tanka[i]==7:
		sev += 1
	i+=1

if fiv==2 and sev==1:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(ll)>
using namespace std;
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const ll mod = 1000000007;
const ll inf = mod*mod;
const ll d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);

int main(){
    double a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    vector<double> W,S;
    //作れる水を列挙しておく
    for(int i=0;i<50;i++){
        for(int j=0;j<50;j++){
            double w = 100*a*i+200*b*j;
            if(w<=f)W.push_back(w);
        }
    }

    for(int i=0;i<50;i++){
        for(int j=0;j<50;j++){
            double s=c*i+d*j;
            if(s<=f)S.push_back(s);
        }
    }
    double res1=0;
    double res2=0;
    double max_C=0;
    for(auto w:W){
        for(auto s:S){
            double sum = w+s;
            if(0.0<=w+s&&w+s<=f&&s/(w+s)<=e/(e+100)){
                if(s/(sum)>=max_C){
                    max_C=s/(sum);
                    res1=sum;
                    res2=s;
                }
            }
        }
    }
    cout<<res1<<' '<<res2<<endl;
}

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

using namespace std;

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


int main()
{
  int N;
  cin >> N;
  
  int sum_digit;
  int min = 1000000;
  
  
  for (int i = 1; i < N; i++) {
      sum_digit = findSumOfDigits(i) + findSumOfDigits(N-i);
      if(sum_digit < min) {
        min = sum_digit;
    }
  }
  cout << min << endl;
}

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

const int INF = 1e+9;

int main()
{
  int n, m, r;
  cin >> n >> m >> r;

  int rr[8];
  for(int i = 0; i < r; i++) cin >> rr[i];

  int dist[201][201];
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      dist[i][j] = INF;
    }
  }

  for(int i = 0; i < m; i++){
    int a, b, c;
    cin >> a >> b >> c;
    dist[a][b] = c;
    dist[b][a] = c;
  }

  for(int k = 1; k <= n; k++){
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        if(dist[i][j] > dist[i][k] + dist[k][j]){
          dist[i][j] = dist[i][k] + dist[k][j];
        }
      }
    }
  }

  int ans = INF;
  int v[8] = {0, 1, 2, 3, 4, 5, 6, 7};
  do{
    int d = 0;
    for(int i = 0; i < r-1; i++){
      d += dist[rr[v[i]]][rr[v[i+1]]];
    }
    ans = min(ans, d);
  }while(next_permutation(v, v+r));

  cout << ans << endl;

  return 0;
}

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

int N, K;

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

    int A[N];
    rep(i, N) {
        cin >> A[i];
    }

    // 左側 i 個
    // 右側 N - i - 1 個
    double ans = ceil((double) (N - 1) / (K - 1));
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 1000000000
void up(ll &x,ll y,ll m){
	x=(x+y+m)%m;
}
ll n,p,m,dp[10][1<<19],ans=1LL;
int main(void){
    cin>>n>>p>>m;
    for(int i=0;i<n;i++)ans=ans*p%m;
	for(int i=0;i<p;i++)dp[i][0]=1LL;
	for(int i=0;i<1<<(p*2-1);i++){
		for(int j=0;j<p;j++){
			for(int k=0;k<p;k++){
				int x=j-k+p-1;
				if(i>>x&1)continue;
				up(dp[k][i|(1<<x)],dp[j][i],m);
			}
			int s=0;
			for(int k=0;k<p*2-1;k++)if(i>>k&1)s++;
			if(s==n-1)up(ans,-dp[j][i],m);
		}
	}
	cout<<ans<<endl;
}



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

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define sort_f(x)  sort(x.begin(),x.end());
#define sort_r(x)  sort(x.rbegin(),x.rend());

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 200003

long  divisors(long x) {
    long limit = x;
    long numberOfDivisors = 0;

    if (x == 1) return 1;

    for (long i = 1; i < limit; ++i) {
        if (x % i == 0) {
            limit = x / i;
            if (limit != i) {
                numberOfDivisors++;
            }
            numberOfDivisors++;
        }
        if(numberOfDivisors>=4)
        {
            break;
        }
    }

    return numberOfDivisors;
}
 bool isPrime(long n)
{
   
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (long i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
#define max_a 100001
bool visit[max_a]={false};
vector<long> a[max_a];
long sum=0;
long cost[max_a];
void dfs(long node)
{
    visit[node]=true;
    
    for(int i=0;i<(int)a[node].size();i++)
    {
        if(visit[a[node][i]]==false)
        {
            sum+=cost[a[node][i]];
            dfs(a[node][i]);
            
        }
    }
    
}
void SieveOfEratosthenes(int n)
{
   
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
 
    for (int p=2; p*p<=n; p++)
    {
        
        if (prime[p] == true)
        {
           
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
 
   
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    char c1,c2;
    cin>>c1>>c2;
    if(c1>c2)
    {
      cout<<'>';
    }
    else if(c1<c2)
    {
      cout<<'<';
    }
    else
    {
      cout<<'=';
    }
    
    
    return 0;
}



Measured memory_bytes: 2560
#include<iostream>
#include<string>
using namespace std;
int N_MAX = 50;
int main()
{
  int n,m,i,j,k,l;
  bool f;
  string a[N_MAX],b[N_MAX];
  cin >> n >> m;
  for(i=0;i<n;i++)
    cin >> a[i];
  for(i=0;i<m;i++)
    cin >> b[i];
  for(i=0;i<n-m+1;i++)
    for(j=0;j<n-m+1;j++){
      f=1;
      for(k=0;k<m;k++){
        for(l=0;l<m;l++)
          if(a[k+i][l+j]!=b[k][l]){
            f=0;
            break;
          }
        if(f==0) break;
      }
      if(f==1){
        cout << "Yes" << endl;
        return 0;
      }
    }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Main {
  private static PrintWriter pw;

  public static void main(String[] args) {
    pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    long num = (long) Math.pow(10, 18);

    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long k = sc.nextLong();

    if (num < Math.abs(a - b)) {
      pw.println("Unfair");
      exitImmediately();
    }

    if (k % 2 == 0) {
      pw.println(a - b);
    } else {
      pw.println(b - a);
    }

    exitImmediately();
  }

  private static void exitImmediately() {
    pw.close();
    System.exit(0);
  }
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

ll s[333333];
ll t[333333];

int main() {
   int n;
   cin >> n;
   vec<ll> a(3*n);
   rep (i, 3*n) {
      cin >> a[i];
   }

   pq<ll, vec<ll>, greater<ll>> Q;
   ll sum = 0;
   rep (i, 3*n) {
      Q.push(a[i]);
      sum += a[i];
      if (Q.size() > n) {
         sum -= Q.top();
         Q.pop();
      }
      s[i] = sum;
   }

   pq<ll> P;
   sum = 0;
   for (int i = 3*n-1; i >= 0; i--) {
      P.push(a[i]);
      sum += a[i];
      if (P.size() > n) {
         sum -= P.top();
         P.pop();
      }
      t[i] = sum;
   }

   ll ans = -1e18;
   for (int i = n-1; i < 2*n; i++) {
      ans = max(ans, s[i] - t[i+1]);
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 9332
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
signed main() {
    int n;
    cin >> n;
    int sum = 0, sumsq = 0;
    for(int i=0;i<n;i++)
    {
        int x;
        cin >> x;
        sum = (sum + x)%mod;
        sumsq = (sumsq + x*x)%mod;
    }
    sum = (sum*sum)%mod;
    sum = (sum - sumsq)%mod;
    sum = sum*500000004%mod;
    sum = (sum+mod)%mod;
    cout << sum;
}

Measured memory_bytes: 3628
# -*- coding:utf-8 -*-

class Restaurant():
    def __init__(self, i, name, point):
        self.i = i
        self.name = name
        self.point = point

def solve():
    N = int(input())
    restaurants = []
    for i in range(N):
        s, p = input().split()
        r = Restaurant(i, s, int(p))
        restaurants.append(r)
    
    sorted_restaurants = sorted(restaurants, key=lambda r: r.point, reverse=True)
    sorted_restaurants = sorted(sorted_restaurants, key=lambda r: r.name)

    for i in range(N):
        print(sorted_restaurants[i].i + 1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
n = int(input())
chrs = "abcdefghijklmnopqrstuvwxyz"
ans = ""
while n > 0:
    rest = n%26
    if rest%26 == 0:
        rest = 26
    ans += chrs[rest-1]
    n -= rest
    n //= 26
print(ans[::-1])

Measured memory_bytes: 9172
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define f(i, q) for(int i = 0; i < q; i++)  

typedef long long ll;

#define MAX 200001

// 昇順にソート
int asc_comp(const void* a, const void* b){
    ll x = *(ll*)a;
    ll y = *(ll*)b;
    return x - y;
}
// 降順にソート
int dec_comp(const void* a, const void* b){
    ll x = *(ll*)a;
    ll y = *(ll*)b;
    return y - x;
}

int main() {
    // qsort(in, a, sizeof(ll), dec_comp);
    char inp[MAX], oup[MAX];
    scanf("%s %s", inp, oup);
    ll at = 0, sum = 0;
    while(inp[at] != '\0') {
        if (inp[at] != oup[at]) {
            sum++;
        }
        at++;
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 2104
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int dh[4] = { 1,0,-1,0 };
int dw[4] = { 0,1,0,-1 };
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	while (1) {
		int H, W; scanf("%d %d", &W, &H);
		if (H == 0 && W == 0) break;
		vector<string> vs(H); for (ll i = 0; i < H; i++) cin >> vs[i];
		int sh, sw;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (vs[i][j] == '@') {
					sh = i;
					sw = j;
				}
			}
		}
		queue<pair<int, int>> q;
		q.emplace(sh, sw);
		vs[sh][sw] = '#';
		int res = 1;
		while (!q.empty()) {
			int h, w; tie(h, w) = q.front();
			q.pop();

			for (int i = 0; i < 4; i++) {
				int nh = h + dh[i];
				int nw = w + dw[i];
				if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
				if (vs[nh][nw] == '#') continue;
				res++;
				vs[nh][nw] = '#';
				q.emplace(nh, nw);
			}
		}
		printf("%d\n", res);
	}
	return 0;
}


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

#define ll long long
#define matrix vector< vector<int> >

using namespace std;

const int mod = 1e9 + 7;
matrix I;

int add(int a, int b) {

    a += b;
    if(a >= mod)
        a -= mod;
    return a;
}

int mul(int a, int b) {

    return (ll)a * b % mod;
}

matrix product(matrix a, matrix b) {

    int n = a.size();
    matrix c = matrix(n, vector<int>(n));
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            for(int k = 0; k < n; k++)
                c[i][j] = add(c[i][j], mul(a[i][k], b[k][j]));
    return c;
}

matrix mod_pow(matrix a, ll n) {

    if(n == 0)
        return I;
    
    matrix temp = mod_pow(a, n / 2);
    temp = product(temp, temp);

    if(n & 1)
        temp = product(temp, a);
    return temp;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    ll k;
    cin >> n >> k;

    matrix dp(n, vector<int>(n));
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> dp[i][j];

    I = matrix(n, vector<int>(n));
    for(int i = 0; i < n; i++)
        I[i][i] = 1;
    dp = mod_pow(dp, k);

    int ans = 0;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            ans = add(ans, dp[i][j]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4232
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let (n, w): (usize, usize) = read();
    let wv: Vec<(usize, i32)> = readn(n);

    let mw = n * 3;
    let mut dp: Vec<Vec<Vec<i32>>> = vec![vec![vec![-1; mw+1]; n+1]; n+1];
    dp[0][0][0] = 0;

    let basew = wv[0].0;
    for i in 0..n {
        let wi = wv[i].0 - basew;
        for j in 0..n {
            for k in 0..mw+1 {
                let base = dp[i][j][k];
                if base == -1 {
                    continue
                }
                dp[i+1][j][k] = max(dp[i+1][j][k], base);

                let tj = j+1;
                let tk = k+wi;
                dp[i+1][tj][tk] = max(dp[i+1][tj][tk], base + wv[i].1);
            }
        }
    }

    let mut ans = 0;
    for j in 0..n+1 {
        for k in 0..mw+1 {
            let weight = j * basew + k;
            if weight <= w {
                ans = max(ans, dp[n][j][k]);
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 16636
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100005;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n+1,0);
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)a[i]+=a[i-1];
    vector<int> v;
    for(int i=0;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            v.push_back(a[j]-a[i]);
        }
    }
    //1e6個の数列が与えられるのでこの中からk個選んでsubsetをつくりそのANDを最大化する
    //上から貪欲にそのbitを立てられるか調べる
    int res=0;
    for(int b=60;b>=0;b--){
        vector<int> vv;
        int now=(1ll<<b);
        int cnt=0;
        for(auto it:v){
            if(it&now){
                vv.push_back(it);
                cnt++;
            }
        }
        if(cnt>=k){
            //cout<<b<<endl;
            res+=now;
            v=vv;
        }
    }
    cout<<res<<endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int n; cin >> n;
    vector<double> a(n); rep(i,n) cin >> a[i];

    double p = 1;
    rep(i,n) p * a[i];
    double q = 0;
    rep(i,n) q += (p / a[i]);
    cout << p / q << '\n'; 
}


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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int a, b, ab, x, y;
  cin >> a >> b >> ab >> x >> y;


  if(a + b < ab * 2) {
    if(a > ab*2 && b > ab*2) {
      cout << ab * 2 * (x + y) << endl;
    } else if (a > ab*2) {
      cout << ab*2*x + b*y << endl;
    } else if (b > ab*2) {
      cout << a*x + ab*2*y << endl;
    } else {
      cout << a*x + b*y << endl;
    }
  } else {
    if(a > ab*2 && b > ab*2) {
      cout << ab*2 * max(x, y) << endl;
    } else if (a > ab*2) {
      cout << ab*2 * x + b * max((int)0, y-x) << endl;
    } else if (b > ab*2) {
      cout << ab*2 * y + a * max((int)0, x-y) << endl;
    } else {
      int z = min(x, y);
      x -= z;
      y -= z;
      cout << x*a + y*b + z*ab*2 << endl;
    }
  }
}


Measured memory_bytes: 256
H,N = map(int,input().split())
MAXH = H+10000
DP = [float("inf")]*MAXH
DP[0] = 0
for i in range(N):
    a,b = map(int,input().split())
    for j in range(MAXH):
        if j+a>MAXH-1:break
        DP[j+a] = min(DP[j+a],DP[j]+b)
print(min(DP[H:]))

Measured memory_bytes: 69084
#include <stdio.h>
#include <string.h>

int main(void){
  char s[100 + 1];
  scanf("%s", s);
  
  int n = strlen(s); // 文字列の長さを得る s
  
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      // 奇数文字目
      if (s[i] == 'L') {
        puts("No");
        return 0;
      }
    }else {
      // 偶数文字目
      if (s[i] == 'R') {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main() {
	int A, B, C, K, a=0,max=0,min=0,i;
	scanf("%d %d %d %d", &A, &B, &C, &K);
	max = A;
	if (max < B) {
		min = max;
		max = B;
	}
	else {
		min = B;
	}
	if (max < C) {
		min += max;
		max = C;
	}
	else {
		min += C;
	}
	for (i = 0; i < K; i++) {
		max = max * 2;
	}
	printf("%d", max + min);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1{
    class Program{
        static void Main(string[] args){
            String[] input = Console.ReadLine().Split(' ');
            String[] input2 = Console.ReadLine().Split(' ');
            String input3 = Console.ReadLine().Split(' ')[0];
            int h = int.Parse(input2[0]);
            int n = int.Parse(input2[1]);
            if (input[0] == input3)
            {
                h -= 1;
            }
            else
            {
                n -= 1;
            }
               


            Console.WriteLine(h + " " + n);
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=1e9+7;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n,k;cin>>n>>k;
    v a(n);in(a,n);
    f(i,n)a[i]--;
    vector<bool>vst(n);

    int p=0;
    queue<int>que;
    while(!vst[p])
    {
        que.push(p);
        vst[p]=true;
        p=a[p];
    }

    while(!que.empty() && que.front()!=p)
    {
        if(k==0)
        {
            cout<<que.front()+1;
            return 0;
        }
        k--;
        que.pop();
    }
    int len=sz(que);
    k%=len;
    while(!que.empty())
    {
        if(k==0)
        {
            cout<<que.front()+1;
            return 0;
        }
        k--;
        que.pop();
    }

    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int A[N+100],B[N+100],C[N+100];
  for(int i=1;i<N+1;i++){
    cin>>A[i];
  }
  for(int i=1;i<N+1;i++){
    cin>>B[i];
  }  
  for(int i=1;i<N;i++){
    cin>>C[i];
  }
  
  int total=0;
  for(int i=1;i<N+1;i++){
    total=total+B[i];
  } 
  
  for(int i=1;i<N+1;i++){
    if(A[i+1]-A[i]==1){
      total=total+C[A[i]];
    }
  }
  
  cout<<total<<endl;


  return 0;
  }


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

using namespace std;
long long pluspref[1000000];
long long minuspref[1000000];
long long n, k;
long long niz[1000000];
int main()
{
    cin >>n >>k;
    pluspref[0] = 0;
    minuspref[0] = 0;
    for (int i = 1; i <= n; ++i){
        cin >>niz[i];
        if (niz[i] > 0){
            pluspref[i] = pluspref[i-1] + niz[i];
            minuspref[i] = minuspref[i-1];
        }else{
            minuspref[i] = minuspref[i-1] + niz[i];
            pluspref[i] = pluspref[i-1];
        }
    }

    long long sol = -1000000009;
    for (int i = 0; i <= n-k; ++i){
        long long score = 0;
        score += pluspref[i]-pluspref[0];
        score += pluspref[n]-pluspref[i+k];
        long long midsc = (pluspref[i + k]-pluspref[i])+(minuspref[i + k]-minuspref[i]);
        ///cout <<i <<" " <<i+k <<" " <<score <<" " <<pluspref[i-1]-pluspref[0] <<" " <<pluspref[n]-pluspref[i+k-1] <<midsc <<endl;
        if (midsc>0)score+=midsc;
        if (score>sol)sol = score;
    }
    cout <<sol;
return 0;
}
/*
10 5
  5 -4 -5 -8  -4   7   2   -4  0  7
0 5  5  5  5   5   12  14  14  14 21
0 0 -4 -9 -17 -21 -21 -21 -25 -25 -25
*/


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int Sum(int wa, int now, int count, int zero, int x, int y){
    wa+=now*zero;
    if(zero==1){
        count++;
    }
    
    if(now == 10 || count>x){
        return 0;
    }else if(wa==y&&count==x){
        return 1;
    }else{
        return Sum(wa, now+1, count, 1, x, y)+Sum(wa, now+1, count, 0, x, y);
    }
    
}

int main() {
    
    int x,y;
    while(cin>>x>>y){
        if(x==0&&y==0){
            break;
        }
        int ans = Sum(0, 0, 0, 1, x, y)+Sum(0, 0, 0, 0, x, y);
        cout<<ans<<endl;
    }
    
    return 0;
}

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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  
  string s1="";
  rep(i,n){
    if(s[i]!='x') s1=s1+s[i];
  }
  string s2=s1;
  reverse(s2.begin(),s2.end());
  if(s1!=s2){
    puts("-1");
    return 0;
  }
  
  int left=0,right=n-1;
  int ans=0;
  while(left<right){
    if(s[left]==s[right]){
      left++; right--;
    }else{
      ans++;
      if(s[left]=='x') left++;
      else right--;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 696
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){
	int n;
	cin>>n;
	vi v(n),c(n);
	rep(i,n) cin>>v[i];
	rep(i,n)cin>>c[i];

	int ans=-INF;
	rep(bit,1<<n){
		int x=0,y=0;
		rep(i,n)if(bit&(1<<i)){
			x+=v[i];
			y+=c[i];

		}
		chmax(ans,x-y);

	}
	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b == 15) {
    cout << "+" << endl;
  } else
  if (a * b == 15) {
    cout << "*" << endl;
  } else {
    cout << "x" << endl;
  }
}


Measured memory_bytes: 764
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;

#define ll long long

void solve()
{
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll k = K;

    k -= A;
    if (k <= 0)
    {
        cout << K << endl;
        return;
    }

    k -= B;
    if (k <= 0)
    {
        cout << A << endl;
        return;
    }

    cout << A - k << endl;

    return;
}

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


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

#define int long long int
int32_t main()
{
    
   int n;
   cin>>n;
   int ans=0;

   ans+=1000*(n/500);
   n=n%500;
   ans+=5*(n/5);
   cout<<ans;

    return 0;

}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n := r.nextInt()
	r.Scan(true)

	fmt.Fprintln(stdout, pow(n, 3, 0))
}


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

int main() {
    ll a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    ll ans = 1e18;
    for (int i = 0; i <= max(x,y); i++) {
        ll aa = max(0LL, x - i);
        ll bb = max(0LL, y - i);
        ans = min(ans, aa * a + bb * b + c * i * 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
x, y = [int(_) for _ in input().split()]
c1 = [1,3,5,7,8,10,12]
c2 = [4,6,9,11]
c3 = [2]
cnt = 0
for t in [c1, c2, c3]:
    if (x in t) and (y in t):
        cnt = 1
if cnt == 1:
    print("Yes")
else:       
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  string s;
  cin >> s;
  if(s[0] == s[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

int n;
int w[10];
int counts[11];
int numDiff;

void printWord() {
    fo(i, n) printf("%c", 'a'+w[i]);
    printf("\n");
}

int max() {
    int ans = w[0];
    fo(i, n) ans = max(ans, w[i]);
    return ans;
}

int increment() {
    if (w[n-1] != n-1) {
        counts[w[n-1]]--; 
        if (!counts[w[n-1]]) numDiff--;
        w[n-1]++;
        if (!counts[w[n-1]]) numDiff++;
        counts[w[n-1]]++;
    }
    else {
        int notLast = n-1;
        while (w[notLast] == n-1) {
            w[notLast] = 0;
            notLast--;
        }
        counts[n-1] -= n-notLast-1;
        if (!counts[n-1]) numDiff--;
        counts[0] += n-notLast-1;
        counts[w[notLast]]--;
        if (!counts[w[notLast]]) numDiff--;
        w[notLast]++;
        if (!counts[w[notLast]]) numDiff++;
        counts[w[notLast]]++;
    }
}

bool orderingRight() {
    int cur = 0;
    fo(i, n) {
        if (w[i] > cur) return false;
        else if (w[i] == cur) cur++;
    }
    return true;
}

bool good() {
    return max() < numDiff && orderingRight();
}

void solve() {
    cin >> n;
    fo(i, n) w[i] = 0;
    fo(i, n) counts[i] = 0;
    counts[0] = n;
    numDiff = 1;
    while (w[n-1] != n-1) {
        printWord();
        // manipulate
        increment();
        while (!good()) increment();
    }
    printWord();
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M; cin >> N >> M;
    if (M % 2 != 0) {
        cout << -1 << endl;
        return 0;
    }
    vector<map<int, int>> G(N);
    vector<int> number(N, -1);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b; a--, b--;
        G[a][b] = G[b][a] = 0;
    }
    vector<int> I;
    int t = 0;
    function<void(int)> recur = [&](int node) {
        number[node] = t++;
        for (auto &p : G[node]) {
            if (number[p.first] == -1) recur(p.first);
        }
        I.push_back(node);
    };
    recur(0);
    for (int node : I) {
        int plus = 0;
        int zero = 0;
        for (auto &p : G[node]) {
            if (p.second == +1) plus++;
            else if (p.second == 0 && number[p.first] > number[node]) {
                p.second = +1;
                G[p.first][node] = -1;
                plus++;
            } else if (p.second == 0) zero++;
        }
        if ((plus + zero) % 2 == 1) zero--;
        for (auto &p : G[node]) {
            if (p.second == 0 && zero) {
                p.second = +1;
                G[p.first][node] = -1;
                zero--;
            }
        }
    }
    for (int node = 0; node < N; node++) {
        for (auto &p : G[node]) {
            if (p.second == +1) {
                cout << node+1 << ' ' << p.first+1 << '\n';
            }
            if (p.second == 0) {
                abort();
            }
        }
    }
    return 0;
}


Measured memory_bytes: 22652
//package atcoder;
 
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		
		double h = 360/12*H+0.5*M;
		double m = 6*M;
	
			double kaku = h-m;
			if(kaku>180) {
				kaku = 360-kaku;
			}
			mat(A,B,Math.abs(kaku));
		
		
		
		}
	
	public static void mat(double A,double B,double shita){
		//System.out.println(shita);
		double kakudo = Math.toRadians(shita);
		//System.out.println(kakudo);
		double ans = Math.pow(A, 2)+Math.pow(B, 2)-2*A*B*Math.cos(kakudo);
		double Ans = Math.sqrt(ans);
		System.out.println(Ans);
	}
}


Measured memory_bytes: 35740
#include<iostream>
using namespace std;
int main()
{
	int a,b,k;
	cin>>a>>b>>k;
	if(a+k-1<b-k+1)
	{
		for(int i=a;i<=a+k-1;i++) cout<<i<<endl;
		for(int i=b-k+1;i<=b;i++) cout<<i<<endl;
	}
	if(a+k-1==b-k+1) 
	{
		for(int i=a;i<=b;i++) cout<<i<<endl;
	}
	if(a+k-1>b-k+1)
	{
		for(int i=a;i<b-k+1;i++) cout<<i<<endl;
		for(int i=max(b-k+1,a);i<=b;i++) cout<<i<<endl;
	}
	return 0;
}

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

int main(){
  int N;
  ll A,B;
  cin >> N >> A >> B;
  ll C=A-B,L=0;
  vector<ll> H(N,0);
  for(int i=0;i<N;i++){
    cin >> H[i];
    L = max(L,H[i]);
  }
  int U=0,M;
  L=L/B+1;
  while(true){
    bool ok=true;
    M=(U+L)/2;
    ll K=M;// I can use magic up to K times
    for(int i=0;i<N;i++){
      if(H[i]-M*B>0){
        ll h=H[i]-M*B;
        if(h%C==0){
          K -= h/C;
        }else{
          K -= (h/C+1);
        }
      }
      if(K<0){
        ok = false;
        break;
      }
    }
    if(L-U<=1){
      if(ok){
        cout << U << endl;
        return 0;
      }else{
        cout << L << endl;
        return 0;
      }
    }else{
      if(ok){
        L=M;
      }else{
        U=M;
      }
    }
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

int main(){
    using namespace std;

    int n,maxi=1,mini=1000000000;
    cin >> n;
    vector<int> a;
    a.resize(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        maxi = max(maxi,a[i]);
        mini = min(mini,a[i]);
    }
    cout << maxi - mini << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ary=a.copy()
ary=sorted(list(set(ary)))
from bisect import bisect_left
aa=[bisect_left(ary,x) for x in a]
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length()

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

def chk(x):
    c=[1 if ai<=x else -1 for ai in aa]
    cc=[0]
    tmp=0
    mi,ma=0,0
    for xx in c:
        tmp+=xx
        cc.append(tmp)
        mi=min(mi,tmp)
        ma=max(ma,tmp)
    # cc[r+1]-cc[l]>0となるl,rの組の数(l<=r)
    # cc[r+1]>cc[l]
    bit=Bit(ma-mi+1)
    ret=0
    for xx in cc:
        xx-=mi
        xx+=1
        bit.add(xx,1)
        ret+=bit.sum(xx-1)
    return ret>(((n+1)*n)//2)//2

l,r=0,n
while r-l>1:
    x=(l+r)//2
    if chk(x):
        l,r=l,x
    else:
        l,r=x,r
print(ary[l] if chk(l) else ary[r])
#print(l,chk(l),r)


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

int main() {
  int num,kon;
  cin >> num >> kon;
  vector<long int> health(num);
  for (size_t i = 0; i < num; i++) {
    cin >> health.at(i);
  }
  sort(health.begin(),health.end());

  long int sum = 0;
  if (num - kon > 0) {
    for (size_t i = 0; i < num - kon; i++) {
      sum += health.at(i);
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(a-b)%c<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int n,m;
const int N=100005;
vector<int>graph[N];
int deg[100005];
int dp[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        deg[b]++;
        graph[a].push_back(b);
    }
    queue<int>q;
    for(int i=1;i<=n;i++){
        if(deg[i]==0)q.push(i);
    }
    while(!q.empty()){
        int tete=q.front();
        q.pop();
        for(int i=0;i<graph[tete].size();i++){
            int qq=graph[tete][i];
            deg[qq]--;
            dp[qq]=max(dp[qq],dp[tete]+1);
            if(deg[qq]==0)q.push(qq);
        }
    }
    int res=0;
    for(int i=1;i<=n;i++){
        res=max(res,dp[i]);
    }
    cout<<res<<endl;

    return 0;
    }


Measured memory_bytes: 6528
//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define IO(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
const int inf = 0x3f3f3f3f;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b) cout<<c;
  if(a==c) cout<<b;
  if(b==c) cout<<a;


 return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.function.Predicate;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int h = scan.nextInt();

		System.out.println((a + b) * h / 2);

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27052
import sys

n=int(input())

d=[]
for i in range(n):
        a=list(map(int,input().split()))
        d.extend(a)

c=0
for j in range(0,len(d)-1,2):
        if d[j]==d[j+1]:
                c+=1
                if c==3:
                        print('Yes')
                        sys.exit()
        else:
                c=0
                
print('No')


Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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() {
  string s;
  cin>>s;
  if(s=="ABC") cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3592