akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	int q=0;
	while(1){
		int a=n+q,b=n-q;
		string s=to_string(a),t=to_string(b);
		string rs=s,rt=t;
		reverse(all(s));
		reverse(all(t));
		if(t==rt){
			cout<<t<<endl;
			return 0;
		}
		if(s==rs){
			cout<<s<<endl;
			return 0;
		}
		q++;
	}
}

Measured memory_bytes: 3204
n,k=map(int,input().split())
p_lis = []
for x in range(1,n+1):
    if k>x:
        i=1
        while x*2<k:
            x*=2
            i+=1
        p_lis.append(((1/2)**i)*(1/n))
    else:
        p_lis.append(1/n)
print(sum(p_lis))


Measured memory_bytes: 6296
#include<stdio.h>

int main(void){
    long long  i,j,x;

    scanf("%lld",&x);

    i = x % 11;

    j = x / 11;
    j *= 2;
    if(i > 0 && i <= 6)
        j++;
    else if(i >= 7)
        j+=2;
    printf("%lld\n",j);
    return 0;
}

Measured memory_bytes: 128
N, M = gets.split.map(&:to_i)
arr = Array.new(N,0)
ac = 0
wa = 0
sumi = Array.new(N,0)
M.times do |i|
	tmp = gets.split.map(&:to_s)
	if tmp[1] == "WA"
		arr[tmp[0].to_i-1] += 1
	else
		if sumi[tmp[0].to_i-1] == 0
			ac += 1
			wa += arr[tmp[0].to_i-1]
			sumi[tmp[0].to_i-1] = 1
		end
	end
end

puts "#{ac} #{wa}"

Measured memory_bytes: 15900
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        a:i64,b:i64,
        mut p:[i64;n],
    }
    p.sort();
    let mut first = 0;
    let mut second = 0;
    let mut third = 0;
    for &x in p.iter() {
        if x <= a {
            first += 1;
        } else if x <= b {
            second += 1;
        } else {
            third += 1;
        }
    }
    println!("{}", min(first, min(second, third)));
}


Measured memory_bytes: 2168
n = int(input())
ba = [0 for _ in range(n)]
for i in range(n):
    ba[i] = list(map(int, input().split()))[::-1]
ba_sort = sorted(ba)
t = 0
for i in range(n):
    t += ba_sort[i][1]
    if t > ba_sort[i][0]:
        print('No')
        exit(0)
print("Yes")

Measured memory_bytes: 39916
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	angle := math.Abs(30*h + 0.5*m - 6*m)
	d := a*a + b*b - 2*a*b*math.Cos(angle*math.Pi/180)
	d = math.Sqrt(d)

	fmt.Println(d)
}


Measured memory_bytes: 1820
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 505

#define mod 998244353

ll gcd(ll a, ll b)
{
	return (b == 0 ? a : gcd(b, a % b));
}

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	map<ll, ll> mi;
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		mi[a[i]]++;
	}
	// cout << mi.size() << "\n";
	int f = 0;
	if(mi[0] == n)
	{
		cout << "Yes\n";
		return 0;
	}

	if(n % 3 != 0)
	{
		cout << "No\n";
		return 0;
	}

	// if(mi.size() == 2)
	// {
	// 	ll k1 = mi.begin()->ff, l1 = mi.begin()->ss,
	// 	k2 = mi.rbegin()->ff, l2 = mi.rbegin()->ss;
	// 	if(l2 == 2 * l1 && l1 == 0)
	// 		f = 1;
	// 	else if(l1 == 2 * l2 && l2 == 0)
	// 		f = 1;
	// }
	// else if(mi.size() == 3)
	// {
	// vector<int> b;
	// for(auto e : mi)
	// {
	// 	for (int i = 0; i < e.ss / (n / 3); ++i)
	// 	{
	// 		b.pb(e.ff);
	// 	}
	// }
	// if(b.size() == 3 && (b[0] ^ b[1] == b[2]))
	// // 	f = 1;
	// // // }

	// // if(f)
	// 	cout << "Yes\n";
	// else
	// 	cout << "No\n";
	  vector<int> all;
		for (auto& p : mi) {
		for (int i = 0; i < p.second / (n / 3); i++) {
		  all.push_back(p.first);
		}
		}
		if (all.size() == 3 && (all[0] ^ all[1] ^ all[2]) == 0) {
		cout << "Yes" << '\n';
		} else {
		cout << "No" << '\n';
		}
	return 0;
}

Measured memory_bytes: 5760
a = [list(map(int,input().split())) for i in range(3)]
c = [[0,0,0] for _ in range(3)]
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for i in b:
  for j in range(3):
    for k in range(3):
      if a[j][k] == i:
        c[j][k] = 1
if sum(c[0]) == 3 or sum(c[1])==3 or sum(c[2])==3:
  print("Yes")
else:
  for i in range(3):
    s = c[0][i]+c[1][i]+c[2][i]
    if s == 3:
      print("Yes")
      quit()
  if c[0][0]+c[1][1]+c[2][2]==3 or c[2][0]+c[1][1]+c[0][2]==3:
    print("Yes")
    quit()
  print("No")

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

int main(){
 int a, b, c;
 cin >> a >> b;
 c = a - b;

 if (c < 0) {
 cout << "a < b" << endl;
 } else if (c == 0){
 cout << "a == b" << endl;
 } else if (c > 0){
 cout << "a > b" << endl;
 } else {
 cout << "error" << endl;
 }
}


 


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int H,W;
    while(true){
        cin>>H>>W;
        if(H==0 &&W==0){
            break;
        }
    for(int j=0;j<W;j++){
        cout<<"#";
    }
    cout<<endl;
    for(int i=1;i<H-1;i++){
        cout<<"#";
        for(int j=1;j<W-1;j++){
            cout<<".";
        }
        cout<<"#"<<endl;
    }
    for(int j=0;j<W;j++){
        cout<<"#";
    }
        cout<<endl<<endl;
    }
}



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

using namespace std;

typedef long long ll;

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

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

string solve(const int N, const string S) {
    int count = 0;
    int required_left = 0;
    int required_right = 0;

    for (int i = 0; i < N; i++) {
        if (S[i] == '(') {
            count++;
        } else {
            if (count > 0) {
                count--;
            } else {
                required_left++;
            }
        }
    }

    required_right = count;

    string res = "";
    for (int i = 0; i < required_left; i++) {
        res += "(";
    }
    res += S;
    for (int i = 0; i < required_right; i++) {
        res += ")";
    }

    return res;
}

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

    string S;
    cin >> S;

    cout << solve(N, S) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define start int t;cin>>t;while(t--)

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    double x;
    cin>>x;
    
    double amt =100;
    ll i;
    int years = 1;
    for(i=1;;i++)
    {   
        double newa = amt*(1.01);
        amt =floor(newa);
        if(newa>=x) break;
    }
    
    std::cout << i << std::endl;
    
    
    
	return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define TM_T template <class T>
using namespace std;
typedef long long ll;
TM_T T inp(){T it;cin >> it;return it;}

ll N,M;
vector<tuple<ll,ll>> ed;
vector<vector<ll>> up;
vector<ll> dp;

int input(){
  cin >> N >> M;
  REP(i,M) {
   ll a = inp<ll>()-1;
   ll b = inp<ll>()-1;
   ed.push_back( tuple<ll,ll>(a,b) ); 
  }
}

ll dfs(ll i){
  if ( dp[i] != -1 ){
    return dp[i];
  }
  if ( up[i].size() == 0 ){
    dp[i] = 0;
    return dp[i];
  }
  ll ma = 0;
  REP(j,up[i].size()) ma = max( ma, dfs(up[i][j]) );
  dp[i] = ma + 1;
  return dp[i];
}

int main()
{
  input();
  
  REP(i,N) up.push_back(vector<ll>());
  REP(i,M) up[get<1>(ed[i])].push_back(get<0>(ed[i]));
  REP(i,N) dp.push_back(-1);
  
  REP(i,N) dfs(i);
  
  ll ma = 0;
  REP(i,N) ma = max(ma,dp[i]);
  
  cout << ma << endl;
  
}

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

using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	int ans=0;
	vector<int> p(n);
	for(int &i:p){
		scanf("%d",&i);
	}
	for(int i=1;i<n-1;i++){
		int mx=max(p[i-1],max(p[i],p[i+1]));
		int mn=min(p[i-1],min(p[i],p[i+1]));
		if(p[i]==mx || p[i]==mn){
			continue;
		}
		ans++;
	}
	printf("%d\n",ans);		
	return 0;
}

Measured memory_bytes: 256
A=list(input())
B=[]
a=A[0]
cnt1=0
cnt2=0
for i in range(4):
    if(a==A[i]):
        cnt1+=1
    else:
        B.append(A[i])

if(cnt1==2):
    b=B[0]
    for i in range(2):
        if(b==B[i]):
            cnt2+=1
    if(cnt2==2):
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
#[allow(unused_imports)]
    use std::cmp::{max, min, Ordering};
    #[allow(unused_imports)]
    use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
    #[allow(unused_imports)]
    use std::iter::FromIterator;
    // input macro
    // https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
    macro_rules! input {
        (source = $s:expr, $($r:tt)*) => {
            let mut iter = $s.split_whitespace();
            let mut next = || { iter.next().unwrap() };
            input_inner!{next, $($r)*}
        };
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
     
    macro_rules! input_inner {
        ($next:expr) => {};
        ($next:expr, ) => {};
     
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
     
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
     
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
     
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
     
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
     
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
     
    fn main() {
        input!{
            n: usize,
            k: i64,
            ab: [(usize, i64); n],
        }
        let mut v = vec![0; 100010];
        for (a, b) in ab {
            v[a] += b;
        }
        let mut count = 0;
        //let ans:usize;
        for i in (0..100010) {
            count += v[i];
            if count >= k {
                println!("{}", i);
                break;
            }
        }
    }

Measured memory_bytes: 6396
from collections import deque
 
R, C = map(int, input().split())
sy, sx = 1, 1
gy, gx = R, C
F = [ input() for _ in range(R) ]
count = 0
for i in F:
  count += i.count(".")
dist = [ [-1]*(C+1) for _ in range(R+1) ]
dist[sy][sx] = 0
q = deque([[sy, sx]])
dy = [1, 0, -1, 0]
dx = [0, 1, 0, -1]
while len(q) != 0:
  h, w = q.popleft()
  for i in range(4):
    nh, nw = h+dy[i], w+dx[i]
    if nh>R or nh<=0 or nw>C or nw<=0:
      continue
    if F[nh-1][nw-1] == "#":
      continue
    if dist[nh][nw] != -1:
      continue
    dist[nh][nw] = dist[h][w] + 1
    if nh==gy and nw==gx:
      print(count - dist[nh][nw] - 1)
      exit()
    q.append([nh, nw])
print(-1)

Measured memory_bytes: 3316
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{
  ll n, t, a;
  cin >> n >> t >> a;
  ll h[n];
  for (ll i = 0; i < n; i++)
  {
    cin >> h[i];
  }
  ll mn = 1000000000;
  ll num;
  for (ll i = 0; i < n; i++)
  {
    ll m = abs(1000 * a - (t * 1000 - h[i] * 6));
    if (mn > m)
    {
      num = i + 1;
      mn = m;
    }
  }
  cout << num << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define Rep(i,a,b) for(register int i=(a),i##end=(b);i<=i##end;++i)
#define Repe(i,a,b) for(register int i=(a),i##end=(b);i>=i##end;--i)
#define For(i,a,b) for(i=(a),i<=(b);++i)
#define Forward(i,a,b) for(i=(a),i>=(b);--i)
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
template<typename T>inline void read(T &x)
{
	T f=1;x=0;char c;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=x*10+(c^48);
	x*=f;
}
using namespace std;
const int MAXN=111;
static int n;
inline long long Sqrt(long long x)
{
	static long long l,r,mid;l=1,r=min(x,1000000000ll);
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(mid*mid>x)r=mid-1;
		else l=mid+1;
	}
	return r;
}
inline void work()
{
	read(n);
	static long long u,v,p,ans;
	Rep(i,1,n)
	{
		read(u);read(v);
		p=(long long)Sqrt(u*v);
		ans=2ll*p-1;
		if(p*p==u*v&&(u^v))--ans;
		if(p*(p+1)>=u*v)--ans;
		printf("%lld\n",ans);
	}
}
int main()
{
	work();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 100000000000000000ll
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() {
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll n;
    cin>>n;
    ll t = n%10;

    if((t==2) || (t==4) || (t==5) || (t==7) || (t==9)){
        cout<<"hon";
    }
    else if((t==0) || (t==1) || (t==6) || (t==8)){
        cout<<"pon";
    }
    else{
        cout<<"bon";
    }

    return 0;
}


Measured memory_bytes: 3648
# 入力
# スペース区切りの整数の入力(定数)
a, b = map(int, input().split())

# 計算と出力
if (a == 1)  or  (b == 1) :
    if (a == 1) and ( b == 1) :
        print("Draw")
    elif (a == 1) and ( b != 1):
        print("Alice")
    else :
        print("Bob")
elif a  > b:
    print("Alice")
elif a < b:
    print("Bob")  
else :
    print("Draw")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int 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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

const ll maxl = (ll)1e18;

int main() {
    int n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) if (a[i]==0) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, n) {
        if (ans>maxl/a[i]) {
            cout << -1 << endl;
            return 0;
        }
        debug(a[i], ans);
        ans *= a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    new Main().solve();
  }

  public void solve() {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if (n == 1) {
      System.out.println("Hello World");
      return;
    }

    int a = sc.nextInt();
    int b = sc.nextInt();
    System.out.println(a + b);
  }
}


Measured memory_bytes: 25172
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        tmp = []
        for k in a[i:i+m]:
            tmp.append(k[j:j+m])
        if tmp == b:
            print('Yes')
            exit()
print('No')

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

def selection_sort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            count += 1
    return a, count

def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count)

if __name__ == '__main__':
    main()

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


int main(){
  int N;
  cin >> N;
  vector<double> V(N);
  for(auto& v : V){
    cin >> v;
  }
  sort(V.begin(), V.end());

  for(int ii=1; ii<N; ii++){
    V[ii] = (V[ii-1] + V[ii]) / 2;
  }

  cout << fixed << setprecision(5) << V[N-1] << endl;

  return 0;
}


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

int main() {
  int N;
  cin>>N;
  if((N/1000==N%1000/100)&&(N%1000/100==N%100/10)||
     (N%1000/100==N%100/10)&&(N%100/10==N%10))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

LL ex(LL x, LL y) { return (y == 0 ? 1 : x * ex(x, y - 1)); }
LL digit(LL x, LL y, LL b = 10) { return x / ex(b, y) % b; }

int n, a[3], l[8], INF = 1e6;

int main() {
	cin >> n;
	inc(i, 3) { cin >> a[i]; }
	inc(i, n) { cin >> l[i]; }
	
	int ans = INF;
	inc(i, ex(4, n)) {
		vector<pair<int, int>> v(4);
		int s = 0;
		inc(j, n) {
			int d = digit(i, j, 4);
			v[d].FI += l[j];
			v[d].SE++;
		}
		inc(k, 3) { s += (v[k].SE == 0 ? INF : abs(a[k] - v[k].FI) + (v[k].SE - 1) * 10); }
		setmin(ans, s);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    long double a, b, c; cin >> a >> b >> c;
    //if (sqrt((long double)a)+sqrt((long double)b) < sqrt((long double)c)) {
    if (a + b + 2*sqrt(a*b) < c){
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int cnt = 0;
    rep(a, A + 1) {
        rep(b, B + 1) {
            rep(c, C + 1) {
                if (500 * a + 100 * b + 50 * c == X) {
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
from collections import deque

N, M, K = 3, 4, 240
ARR = [60, 90, 120]
BRR = [80, 150, 80, 150]
#
# N, M, K = 3, 4, 730
# ARR = [60, 90, 120]
# BRR = [80, 150, 80, 150]

N, M, K = 5, 4, 1
ARR = [1000000000, 1000000000, 1000000000, 1000000000, 1000000000]
BRR = [1000000000, 1000000000, 1000000000, 1000000000]

N, M, K = 7, 4, 14
ARR = [1, 6, 1, 1, 1, 7, 2]
BRR = [5, 1, 5, 6, 7]


N,M,K = map(int,input().split())
ARR = list(map(int,input().split()))
BRR = list(map(int,input().split()))


def calculate(n, m, k, arr, brr):
    q = deque()

    result = []
    total = 0

    for i in range(n):
        if (total + arr[i]) > k:
            break
        total += arr[i]
        q.append(arr[i])

    result.append(len(q))

    remain = k - total

    q2 = deque(brr)
    sss = 0

    while (len(q2) > 0) and ((sss + q2[0]) <= remain):
        v = q2.popleft()
        sss += v

    result.append(len(q) + (m - len(q2)))

    while len(q) > 0:
        right = q.pop()
        remain += right

        while (len(q2) > 0) and ((sss + q2[0]) <= remain):
            v = q2.popleft()
            sss += v

        result.append(len(q) + (m - len(q2)))

    print(max(result))


calculate(N, M, K, ARR, BRR)


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

main()
{
  int n,d,x; cin >> n >> d >> x;

  vvi p(d,vi(n));
  rep(i,d) rep(j,n) cin >> p[i][j];

  rep(i,d-1){
    vi inc; // 増えている種類
    rep(j,n) if(p[i+1][j] > p[i][j]) inc.pb(j);

    vvi dp(sz(inc)+1, vi(x+1));
    rep(j, sz(inc)) rep(k, x+1){
      if(k < p[i][inc[j]]) dp[j+1][k] = dp[j][k];
      else dp[j + 1][k] = max(dp[j][k], dp[j + 1][k - p[i][inc[j]]] + (p[i+1][inc[j]] - p[i][inc[j]]));
    }
    x += dp[sz(inc)][x];
    //cout << x << endl;
  }
  cout << x << endl;
}


Measured memory_bytes: 4312
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

int main() {
  string _S, T;
  cin >> _S >> T;

  int N = _S.size();
  int M = T.size();

  vector<string> canditates;

  for (int i = 0; i <= N - M; ++i) {
    if (_S[i] == '?' || _S[i] == T[0]) {
      string S = _S;
      int j = 0;
      for (j; j < M && i + j < N; ++j) {
        if (S[i + j] == '?') {
          S[i + j] = T[j];
        } else if (S[i + j] != T[j]) {
          break;
        }
      }
      if (j == M) {
        for (int k = 0; k < N; ++k) {
          if (S[k] == '?') {
            S[k] = 'a';
          }
        }
        canditates.push_back(S);
        continue;
      }
    }
  }
  if (canditates.empty()) {
    printf("UNRESTORABLE\n");
    return 0;
  }

  sort(canditates.begin(), canditates.end());
  printf("%s\n", canditates[0].c_str());
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String abcd = scan.next();
		scan.close();

		String[] array = abcd.split("");
		int a = Integer.valueOf(array[0]);
		int b = Integer.valueOf(array[1]);
		int c = Integer.valueOf(array[2]);
		int d = Integer.valueOf(array[3]);

		int[] symbol = {-1, 1};
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < 2; j++) {
				for(int k = 0; k < 2; k++) {
					if(a + b * symbol[i] + c * symbol[j] + d * symbol[k] == 7) {
						System.out.print(a);
						System.out.print(i == 0?"-":"+");
						System.out.print(b);
						System.out.print(j==0?"-":"+");
						System.out.print(c);
						System.out.print(k==0?"-":"+");
						System.out.print(d);
						System.out.println("=7");
						return;
					}
				}
			}
		}
	}
}


Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    String s = new Scanner(System.in).nextLine();
    if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
        System.out.println("Yes");
    } else System.out.println("No");
  }
}

Measured memory_bytes: 21716
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
    ll n,nums[5],m=1e15;
    cin >> n;
    for(int i=0;i<5;i++){
            cin >> nums[i];
            m = min(m,nums[i]);
    }
    ll ans;
    if(n%m==0)  ans=n/m;
    else    ans=n/m+1;
    cout << ans+4;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e16;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;

const ll MAX_V = 1e5;

struct edge { ll to, cost; };
typedef pair<ll, ll> P;
vector<edge> GA[MAX_V];
vector<edge> GB[MAX_V];
ll dA[MAX_V];
ll dB[MAX_V];

void dijkstra(ll start, ll V, vector<edge> G[], ll d[]){
	priority_queue<P, vector<P>, greater<P>>que;
	fill(d, d + V, INF);
	d[start] = 0;
	que.push(P(0, start));

	while (!que.empty()){
		P p = que.top(); que.pop();
		ll v = p.second;
		if (d[v] < p.first) continue;
		for (ll i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

bool comp_p(const pll& l, const pll& r){
	return l.second < r.second;
}

int main(){
	ll N, K;
	cin >> N >> K;
	vll X(N);
	ll left = 0;
	for (auto &x : X) {
		cin >> x;
		if (x < 0)left++;
	}
	ll right = N - left;
	vll R(N);
	vll L(N);
	ll ans = INF;
	ll i, j;
	ll d;
	for (i = 1; i <= min(K, left); i++){
		if (right < K - i) continue;
		if (i < K){
			d = abs(X[left - i]) * 2 + abs(X[left + K - i - 1]);
		}
		else{
			d = abs(X[left - K]);
		}
		ans = min(ans, d);
	}
	for (i = 1; i <= min(K, right); i++){
		if (left < K - i) continue;
		if (i < K){
			d = abs(X[left + i - 1]) * 2 + abs(X[left - (K - i)]);
		}
		else{
			d = abs(X[left + K - 1]);
		}
		ans = min(ans, d);
	}

	cout << ans << endl;


}

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

int *A, *B, n, m;

int compare() {
	int i = 0;
	while (i < n && i < m) {
		if (A[i] < B[i])
			return 1;
		if (A[i] > B[i])
			return 0;
		i++;
	}
	if (m > n) 
		return 1;
	else 
		return 0;
}

int main(void) {
	int i;
	cin >> n;
	A = new int[n];
	for (i = 0; i < n; i++) {
		cin >> A[i];
	}
	cin >> m;
	B = new int[m];
	for (i = 0; i < m; i++) {
		cin >> B[i];
	}
	cout << compare() << endl;
}


Measured memory_bytes: 3124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine(Function(n));
            Console.Read();
        }
        static double Function(int x)
        {
            return Math.Pow(x,3);
        }
       
    }
}


Measured memory_bytes: 9412
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	if (abs(a-b)>1e18)printf("Unfair");
	else if(!(k&1))	printf("%d",a-b);
	else printf("%d",b-a);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vec<ll> A(N);
    ll ans  = 1;
    bool flag = true;
    rep(i, N) {
        ll A;
        cin >> A;
        if (A == 0) {
            cout << 0 << endl;
            return 0;
        }

        if (ans > (ll)1e18/A){
            flag = false;
        } else {
            ans*=A;
        }
    }
    cout << (flag ? (ll)ans : -1) << endl;
}


Measured memory_bytes: 4040
#include <iostream>
#include <algorithm> // std::sort
using namespace std;

const int max_n = 100; // ?

int main(){
	int n;
	cin >> n;
	int l[2 * max_n], // ?
		s[101] = {};
	for (int i = 0; i < 2 * n; i++){
		cin >> l[i];
		s[ l[i] ]++;
	}
	
	sort(l, l+2*n);
	
	int ans = 0;
	for (int i = 0; i < 2 * n; i+=2){
		//cout << l[i] << endl;
		ans += l[i];
	}
	
	cout << ans << endl;
	/*for (int i = 1; i <= 100; i++){
		
	}*/
	
	
	
}


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

int main() {
  int N,L;
  cin >> N >> L;
  vector<string> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  for (int i = 0; i < N; i++) {
    cout << a.at(i);
  }
}


Measured memory_bytes: 256
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(l[k - 1])

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

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

using namespace std;

int main(){
  ll m,ds=0,s=0;
  cin>>m;
  
  ll result=0;
  rep(i,m){
    ll d,c;
    cin>>d>>c;
    ds+=d*c;
    s+=c;
  }
  cout<<(ds-1)/9 + s-1;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	double a, b, x;
	cin >> a >> b >> x;

	double taka = x / (a * a);
	double dxdy;
	if (taka <= b / 2.0)
	{
		dxdy = atan2(b, 2.0*a*taka/b);
		cout << setprecision(8) << 180.0 * dxdy / (3.14159265358979323846) << endl;
	}
	else
	{
		dxdy = atan2((b - taka) * 2.0, a);
		cout << setprecision(8) << 180.0 * dxdy / (3.14159265358979323846) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/*input
4 4
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll INF64=4e15;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const ll maxn=6*1e4+5;
const ll maxlg=__lg(maxn)+2;
int a[maxn];
int main(){
    int n;
    cin>>n;
    REP(i,n) cin>>a[i];
    int ans=0;
    REP(i,n){
        for(int j=i+1;j<n;j++){
            ans+=a[i]*a[j];
        }
    }
    cout<<ans;
}


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

const int INF = 1001001001;

int c[10][1005];

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int ans = INF;
  rep(div,1<<(h-1)) {
    int g = 0;
    vector<int> id(h);
    rep(i,h) {
      id[i] = g;
      if (div>>i&1) ++g;
    }
    ++g;
    rep(i,g)rep(j,w) c[i][j] = 0;
    rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j]-'0');

    int num = g-1;
    vector<int> now(g);
    auto add = [&](int j) {
      rep(i,g) now[i] += c[i][j];
      rep(i,g) if (now[i] > k) return false;
      return true;
    };
    rep(j,w) {
      if (!add(j)) {
        num++;
        now = vector<int>(g);
        if (!add(j)) {
          num = INF;
          break;
        }
      }
    }
    ans = min(ans, num);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	ll mv=x/d;
	mv=min(k,mv);
	k-=mv;
	x-=mv*d;
	
	if(k%2==1){
		if(abs(x-d)<abs(x+d))x=x-d;
		else x=x+d;
	}

	cout<<abs(x)<<'\n';
	

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int n,k;
int dp[100000];
vector<int> a;

int recur(int i){
    if(dp[i] != -1){
        return dp[i];
    }else if(i == n-1){
        return 0;
    }
    dp[i] = (abs(a[i] - a[i+1]) + recur(i+1));
    for(int j = 2; j <= k; j++){
        if(i + j <= n-1){
            dp[i] = min(dp[i], (abs(a[i] - a[i+j]) + recur(i+j)));
        }
    }
    return dp[i];
}


int main(){
    cin>>n>>k;
    memset(dp,-1,sizeof dp);
    for(int i = 0; i < n; i++){
        int b;
        cin>>b;
        a.push_back(b);
    }
    cout<<recur(0);
}


Measured memory_bytes: 7416
// Problem : B - Buffet
// Contest : AtCoder Beginner Contest 140
// URL : https://atcoder.jp/contests/abc140/tasks/abc140_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcount(x)
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
cin>>n;
vi a(n),b(n),c(n-1);
cin>>a>>b>>c;
int total=b[a[0]-1];
for(int i=1;i<n;i++){
total+=(b[a[i]-1]);
if(a[i]==a[i-1]+1)
total+=c[a[i-1]-1];
}
cout<<total;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f(a, b) for (ll i = a; i <= b; i++)
#define test  ll t;cin >> t;for(ll index=1; index<=t; index++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//#define N 100005
#define N 300005
const int INF = 1000000001;
const int MOD = 998244353 ; //1e9+7;

 
void solve()
{
    ld n, x ,t;
    cin >> n >> x >> t;
    ll ans = (ceil(n/x))*t ;
    cout << ans << "\n";
}

int main()
{
    fast;
    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //test{
        //cout << "Case #" << index << ": " ;
        solve();
   // }
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
   

    ll n;
    cin >> n;
    cout << 180*(n-2) << endl;

}

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

int main()
{
  int N; cin >> N;
  string is_can="No";

  for(int i=1; i < 10; i++) {
    for(int j=1; j < 10; j++){
      if(i*j == N) {
        is_can="Yes";
        goto END;
      }
    }
  }
  END:
  cout << is_can << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)


int main() {
	ll n, x, s[114514] = {},ans = 0;
	cin >> n >> x;
	REPO(i, n) {
		cin >> s[i];
		if (s[i - 1] + s[i] > x) {
			ans += s[i - 1] + s[i] - x;
			s[i] = x - s[i - 1];
		}
	}
	cout << ans << endl;
}	


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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    int ans = 0;
    while (a[1] < a[2]) {
        ++a[0];
        ++a[1];
        ++ans;
    }
    cout << ans + (a[1] - a[0]) / 2 + ((a[1] - a[0]) % 2 ? 2 : 0);
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) + [True] for _ in range(m)]
ab2 = sorted(ab, key=lambda x: x[1])
ab.sort()
count = 0
j = 0
for i in range(m):
    if not (ab2[i][2]):
        continue
    while j < m:
        if ab2[i][1] <= ab[j][0]:
            count += 1
            break
        else:
            ab[j][2] = False
        j += 1
print(count + 1)

Measured memory_bytes: 23916
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define ll              long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define Mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define vpii            vector<pair<int,int> >
#define all(x)          x.begin(),x.end()
#define gcd(m,n)        __gcd(m,n)
#define matrixprint(arr,a,b,c,d) for(int i=a;i<=c;i++){for(int j=b;j<=d;j++){cout<<arr[i][j]<<" ";}cout<<"\n";}
#define show(arr,x,y)   for(int i=x;i<=y;i++){cout<<arr[i]<<" ";}cout<<"\n"
#define sz               size()
#define inc(i,x,y)      for(int i=x;i<=y;i++)
#define dec(i,x,y)      for(int i=x;i>=y;i--)



#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define deb(...)
#endif

void fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
}

//////////////////////////////code//////////////////////////////

int32_t main()
{
  fast();

  string s;
  cin>>s;
  if(s=="ABC")
    cout<<"ARC";
  else
    cout<<"ABC";


}


Measured memory_bytes: 3612
N,Ma,Mb=map(int,input().split())
a,b,c=map(list,zip(*[list(map(int,input().split())) for i in range(N)]))
ma,mb=sum(a),sum(b)
MAX=5000
dp=[[[MAX]*(mb+1) for i in range(ma+1)] for j in range(N+1)]
dp[0][0][0]=0
for i in range(N):
    for j in range(ma):
        for k in range(mb):
            dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k])
            if j+a[i]<=ma and k+b[i]<=mb:
                dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i])
ans=MAX
x=1
while x*Ma<=ma and x*Mb<=mb:
    ans=min(ans,dp[N][x*Ma][x*Mb])
    x+=1
print(ans if ans<MAX else -1)

Measured memory_bytes: 63580
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

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

    int maxlen = 0;
    for (auto i = 0; i < s.length(); ++i) {
        for (auto j = i + 1; j <= s.length(); ++j) {
            auto t = s.substr(i, j - i);
            auto pos = t.find_first_not_of("ACGT");
            if (pos < t.length())
                continue;
            maxlen = max(maxlen, j - i);
        }
    }
    

    cout << maxlen << endl;
    return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n;
	cin >> n;
	int c1 = 0, c2 = 0, c4 = 0;
	FOR(i, n) {
		ll a;
		cin >> a;
		if (a % 4 == 0)c4++;
		else if (a % 2 == 0)c2++;
		else c1++;
	}
	if (c2)c1++; 
	if (c1 <= c4 + 1)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256