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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout << fixed << setprecision(5);
    int               n;
    char              str[10], com[13];
    map<string, bool> T;
    cin >> n;
    rep(i, n) {
        cin >> com >> str;
        if (com[0] == 'i')
            T[string(str)] = true;
        else {
            if (T[string(str)])
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 47448
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

string s;
ll ans, res;

int main(){

cin>>s;

for(int i=0; i<s.size(); i++){
    ans += (s[i] - '0');
}

res = (s[0] - '0') - 1;
res += 9 * (s.size() - 1);

cout<<max(res, ans);

return 0;

}















Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(a, max(b, c)) * 10 + (a + b + c) - max(a, max(b, c)) << endl;
    return 0;
}

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

int main() {
    int x,y;
    cin >> x >> y;
    bool ans = true;
    if(y%2==1) ans = false;
    if(y<2*x) ans =false;
    if(y>4*x) ans = false;
    if(ans){cout << "Yes" << endl;}
    else{cout << "No" <<endl;}
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int a[n+1];
	for(int i=1;i<=n;i++)
	a[i]=10101010;
	for(int i=1;i<=m;i++)
	{
		int c,b;
		cin>>c>>b;
		a[c]=min(a[c],b);
	}
	int x=10101010,s=0;
	for(int i=1;i<=n;i++)
	{
		if(x==i) x=10101010,s++;
		x=min(x,a[i]);
	}
	cout<<s;
 } 

Measured memory_bytes: 4032
n, q = gets.split.map(&:to_i)

tree = Array.new(n) { [] }
(n - 1).times do
  a, b = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  tree[a] << b
  tree[b] << a
end
cnt = Array.new(n, 0)
q.times do 
  pi, xi = gets.split.map(&:to_i)
  pi -= 1
  cnt[pi] += xi
end

que = []
que << [0, 0] # node_id, cnt
ans = []
visited = []
while !que.empty?
  node, c = que.shift
  ans[node] = c + cnt[node]
  visited[node] = true
  if !tree[node].empty?
    tree[node].each do |child_node|
      que << [child_node, c + cnt[node]] if !visited[child_node]
    end
  end
end
puts ans * ' '

__END__
3 3
1 3
2 3
1 1
2 1
3 1


Measured memory_bytes: 37756
n=int(input())
al=list(map(int,input().split()))

import fractions
ans=0
left=[0]
for i in range(1,n):
    ans=fractions.gcd(ans,al[i-1])
    left.append(ans)
#print(left)
right=[0 for i in range(n+1)]
for i in range(1,n+1):
    right[n-i]=fractions.gcd(right[n-i+1],al[n-i])
#print(right)

ans=0

for i in range(n):
    ans=max(ans,(fractions.gcd(left[i],right[i+1])))
print(ans)



Measured memory_bytes: 14076
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string str = Console.ReadLine();
		int ct = 0;
		for(var i=0;i<N-2;i++){
			if(str.Substring(i,3)=="ABC"){
				ct++;
			}
		}
		Console.WriteLine(ct);
	}
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define float long double
#define ss second
#define ff first
typedef vector<int> vi;
#define pb push_back



class graph{
    public:
    int V,E;
    map<int,list<int>> adj;
    int *dp;
    void init(int v,int e){
        V = v;
        E = e;
        dp = new int[V+1];
        for(int i = 1 ;i <= V ; i++){
            dp[i] = -1;
        }
        for(int i = 0 ; i< E ; i++){
            int a,b;
            cin >> a >> b;
            adj[a].push_back(b);
        }
    }

    void solve(){
        for(int i = 1 ; i<=V;i++) solvePerNode(i);
        int ans = INT_MIN;

        for(int i = 1 ; i <=V ; i++) ans = max(ans,dp[i]);
        cout << ans;
    }

    void solvePerNode(int node){
        if(dp[node]!=-1) return ;
        dp[node] = 0;
        for(auto y : adj[node]){
            if(dp[y]==-1) solvePerNode(y);
            dp[node] = max(dp[node],1 + dp[y]);
        }
    }



};



int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string a,b;
	int n,m;
	cin >> n >> m;
	graph g;
	g.init(n,m);
	g.solve();
}


Measured memory_bytes: 13440
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)
 
using namespace std;
 
int main(int argc, char *argv[]) {
 
	string s; cin >> s;
 
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if(s[i] == '+') {
			ans++;	
		}else {
			ans--;	
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans;
int a[200105],b[200105];
map<int,int>cnt;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cnt[a[i]]++;
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		b[i]=1;
		while(b[i]<=a[i])b[i]*=2;
		b[i]-=a[i];
	}
	for(int i=n;i>=1;i--){
		if(cnt[a[i]]){
			cnt[a[i]]--;
		    if(cnt[b[i]])cnt[b[i]]--,ans++;	
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int A, B;
	string op;
	cin >> A >> op >> B;
	if (op == "+")
	{
		cout << A + B << endl;
	}
	else
	{
		cout << A - B << endl;
	}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) //
#endif
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
const int maxn = 200000;
int h[maxn];
int dp[maxn];
int n, k;
const int inf = 2000000000;
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> k;
	for(int i = 0;i < n;++i)cin >> h[i];
	fill(dp+1, dp+n, inf);
	for(int i = 0;i < n;++i)for(int j = 1;j <= k;++j)dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
	cout << dp[n-1] << '\n';
}

Measured memory_bytes: 1024
#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 n;cin>>n;
    string s;cin>>s;
    int ans=0;
    rep(i,n-2){
        if(s[i]=='A'){
            if(s[i+1]=='B'){
                if(s[i+2]=='C'){
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vi nums;
    int t = 1, cnt1 = 0;
    rep(i, n) {
        if (s[i]==(char)(t+'0')) ++cnt1;
        else {
            nums.pb(cnt1);
            t = 1 - t;
            cnt1 = 1;
        }
    }
    if (cnt1 != 0) nums.pb(cnt1);
    int left = 0, right = 0, len = 2 * k + 1;
    int ans = 0, cnt = 0;
    for (int i=0; i<(int)nums.size(); i+=2) {
        int n_left = i, n_right = min(i+len, (int)nums.size());
        while (left < n_left) {
            cnt -= nums[left];
            ++left;
        }
        while (right < n_right) {
            cnt += nums[right];
            ++right;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int unsigned long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define P pair<int,int>
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;

int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
int lcm(int u,int v){
    int r = gcd(u,v);
    r = (u / r)*v;
    return r;
}

signed main(){
    int n;
    cin >> n;
    vec(t,n);
    int ans=1;
    REP(i,n){
        cin >> t[i];
        ans=lcm(ans,t[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
using namespace std;
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) ((x)&1)
#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define all(x) (x).begin(),(x).end()
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define per(i,a,b) for (int i=(a); i>=(b); --i)
#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define ____ puts("\n_______________\n\n")
#define debug(x) ____; cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) ____; cout<<#x<<":\n"; rep(i,0,n) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define debug_arr2(x,n,m) ____; cout<<#x<<":\n"; rep(i,0,n) rep(j,0,m) cout<<#x<<"["<<(i)<<"]["<<(j)<<"]= "<<x[i][j]<<((j==m)?"\n\n":"    ")
#define debug_set(x) ____; cout<<#x<<": \n"; rep_it(it,x) cout<<(*it)<<" "; cout<<endl
#define debug_map(x) ____; cout<<#x<<": \n"; rep_it(it,x) debug_pair(*it)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int oo = /*2 * 1000 * 1000 * 1000*/0x3f3f3f3f;
const ll ooo=9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N=100105;
const double PI=acos(-1.0);
const double eps=1e-6;
int o(int x) { return x%_p; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

char st[N];
int ans=oo,p[N],tot=0,s[N],ss[N],n;

void work(char st[]) {
	ans=0;
	st[0]=(st[1]=='1' ? '0' : '1');
	rep(i,1,n) {
		if (st[i]!=st[i-1]) {
			++tot;
			p[tot]=1;
		} else p[tot]++;
	}
	s[0]=0; rep(i,1,tot) s[i]=s[i-1]+p[i];
	ss[tot+1]=0; per(i,tot,1) ss[i]=ss[i+1]+p[i];
	rep(i,1,tot) ans=max(ans,min(s[i],ss[i]));
}

int main() {
    //file_put();
    
    scanf("%s",st+1);
    n=strlen(st+1);
    if (st[n]=='1') rep(i,1,n) if (st[i]=='1') st[i]='0'; else st[i]='1';
    work(st);
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 896
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
a, b = ri_()
print(ceil((a + b) / 2))

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

int main(){
    int t[32] = {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};
    int k;
    cin >> k;
    cout << t[k-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;
 
 
 
int main()
{
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	if(H%h==0 && W%w ==0) cout << "No" << endl;
	else
	{
		cout << "Yes" << endl;
		reps(i, H) reps(j, W)
		{
			int t=max(H/h, W/w)+1;
			if(i%h!=0 || j%w!=0) cout << t;
			else cout << (-(h*w-1)*t-1);
			if(j!=W) cout << ' ';
			else cout << endl;
		}
	}
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

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

  ll ans = 1000;
  rep(i, N-1){
    if(A[i] < A[i+1]) ans += (ans/A[i]) * (A[i+1]-A[i]);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3588
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int[] num = new int[N];
    long sum = 0;
    String[] S = sc.nextLine().split(" ");
    
    for(int i = 0; i < N; i++){
      num[i] = Integer.parseInt(S[i]);
      sum += num[i];
    }
    
    long a = 0;
    long b = sum;
    long ans = 10000000000l;
    for(int i = 0; i < N-1; i++){
      a += num[i];
      b -= num[i];
      long c = Math.abs(a - b);
      if(c < ans){
        ans = c;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 56856
use std::process;
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}
fn main() {
     let s = get!(String);
     let mut ans = 0;
        for i in 0..(s.len()/2) {
            if s.chars().nth(i).unwrap() != s.chars().nth(s.len()-i-1).unwrap() {
                ans += 1;
            }
        }
        println!("{}", ans );
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, m; scanf("%d%d", &n, &m);
	std::vector<std::vector<int>> g(n);
	for(int i = 0; i < m; i++) {
		int a, b; scanf("%d%d", &a, &b);
		
		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}
	int q; scanf("%d", &q);
	std::vector<int> v(q), d(q), c(q);
	for(int i = 0; i < q; i++) scanf("%d%d%d", &v[i], &d[i], &c[i]);
	
	std::vector<int> ans(n, 0), used(n, -1);
	while(q--) {
		int V = v[q] - 1, D = d[q], C = c[q];
		
		std::queue<std::pair<int, int>> qu; qu.push({V, D});
		while(!qu.empty()) {
			auto p = qu.front(); qu.pop();
			
			if(p.second <= used[p.first]) continue; used[p.first] = p.second;
			if(!ans[p.first]) ans[p.first] = C;
			if(!p.second) continue;
			for(auto e: g[p.first]) {
				qu.push({e, p.second - 1});
			}
		}
	}
	
	for(auto v: ans) printf("%d\n", v);
	return 0;
}


Measured memory_bytes: 8952
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
using vint = vector<int>;
using vvint = vector<vint>;
using vchar = vector<int>;
using vvchar = vector<vchar>;
constexpr double pi = 3.1415926535897932384626433832795028L;

int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
int sigma(int n){
    int sum=0;
    for (int i=1; i<=(n); i++){
        sum+=i;
    }
    return sum;
}
int sigma_2(int n) {
  if (n == 0) {
    return 0;
  }
  return n + sigma_2(n - 1);
}
int sum_range(int a, int b) {
  if (a == b) {
    return a;
  }
  return sum_range(a, b - 1) + b;
}
int distance(int yo,int xo,int yi,int xi){
    return (yo-yi)*(yo-yi)+(xo-xi)*(xo-xi);
}

int array_sum_from_i(vint &data, int i) {
  if (i == data.size()) {
    return 0;
  }
  int s = array_sum_from_i(data, i + 1);
  return data[i] + s;
}
int array_sum(vint &data) {
  return array_sum_from_i(data, 0);
}
bool has_divisor(int N, int i) {
  if (i == N) {
    return false;
  }
  if (N % i == 0) {
    return true;
  }
  return has_divisor(N, i + 1);
}

bool is_prime(int N) {
  if (N == 1) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else {
    return !has_divisor(N, 2);
  }
}
bool is_even(int);
bool is_odd(int);

bool is_even(int n) {
  if (n == 0) {
    return true;
  }
  return is_odd(n - 1);
}

bool is_odd(int n) {
  if (n == 0) {
    return false;
  }
  return is_even(n - 1);
}








signed main() {
    int A,B;
    cin >> A >> B;
    rep(i,1500){
        if(i/10==B){
            if(i*2/25==A){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int mo=1000000007;
const int N=605;
int n,k,S[N];
int x[N],y[N],f[N];
int g[N][N],h[N][N];
int main(){
	scanf("%d%d",&n,&k);
	n*=2;
	For(i,1,n) S[i]=1;
	For(i,1,k) scanf("%d%d",&x[i],&y[i]);
	For(i,1,n) S[x[i]]=S[y[i]]=0;
	For(i,1,n) S[i]+=S[i-1];
	f[0]=1;
	for (int i=2;i<=n;i+=2)
		f[i]=1ll*f[i-2]*(i-1)%mo;
	For(i,1,n) For(j,i+1,n){
		bool fl=0;
		For(p,1,k) fl|=(i<=x[p]&&x[p]<=j)^(i<=y[p]&&y[p]<=j);
		if (fl) continue;
		int sum=S[j]-S[i-1];
		g[i][j]=h[i][j]=f[sum];
	}
	For(i,1,n) For(j,i+1,n) For(k,j+1,n)
		g[i][k]=(g[i][k]+mo-1ll*g[i][j]*h[j+1][k]%mo)%mo;
	int ans=f[n-2*k];
	For(i,1,n-1) For(j,i+1,n-1){
		int res=n-2*k-(S[j]-S[i-1]);
		ans=(ans+1ll*f[res]*g[i][j])%mo;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 3072
n,i,j,u,v=1,a[2][3];long dp[25000005];solve(){for(i=n;~i;--i)dp[i]=i;for(i=1;i<=n;++i)for(j=0;j<3;++j)a[v][j]>a[u][j]&&i>=a[u][j]&&(dp[i]=fmax(dp[i],dp[i-a[u][j]]+a[v][j]));}main(){for(scanf("%d",&n);i<2;i++)for(j=0;j<3;j++)scanf("%d",a[i]+j);solve(),n=dp[n],u=1,v=0,solve();printf("%lld\n",dp[n]);}

Measured memory_bytes: 195456
x, y, n = map(int, input().split())
input = [list(map(int, input().split())) for _ in range(n)] 
xmax = x
xmin = 0
ymax = y
ymin = 0
for i in input:
    type = i[2]
    if type == 1 and (i[0] > xmin):
        xmin = i[0]
    elif type == 2 and (i[0] < xmax):
        xmax = i[0]
    elif type == 3 and (i[1] > ymin):
        ymin = i[1]
    elif type == 4 and (i[1] < ymax):
        ymax = i[1]
if (xmax > xmin) and (ymax > ymin):
    print((xmax - xmin)*(ymax - ymin))
else:
    print(0)

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  int res=0;
  res += count(s.begin(), s.end(), '+');
  res -= count(s.begin(), s.end(), '-');
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,n;
  cin >> h>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
    for(int i=0;i<n;i++){
        h=h-a[i];
    if(h<=0){
        cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

using namespace std;

int solve_digit(int n){
	int res = 0;
	while(n){
		n /= 10;
		res++;
	}
	return res;
}

int main(){
	int N, M; cin >> N >> M;
	vector< pair< pair<int, int>, int > > v(M);
	for(int i = 0; i < M; ++i){
		cin >> v[i].first.first >> v[i].first.second;
		v[i].second = i;
	}
	sort(v.begin(), v.end());
	int now = v[0].first.first;
	int count = 1;
	for(int i = 0; i < M; ++i){
		if(now == v[i].first.first){
			v[i].first.second = count;
			count++;
		}else{
			now = v[i].first.first;
			count = 1;
			i--;
		}
	}
	for(int i = 0; i < M; ++i) swap(v[i].first.first, v[i].second);
	sort(v.begin(), v.end());
	for(int i = 0; i < M; ++i){
		for(int j = 0; j < 6 - solve_digit(v[i].second); ++j) cout << 0;
		cout << v[i].second;
		for(int j = 0; j < 6 - solve_digit(v[i].first.second); ++j) cout << 0;
		cout << v[i].first.second << endl;		
	}
}

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

int main() {
    // input
    int K, S;
    cin >> K >> S;

    // solve
    int ans = 0;
    for (int i = 0; i <= K; ++i) {
        for (int j = 0; j <= K; ++j) {
            int z = S - i - j;
            if (z >= 0 && z <= K) ans++;
        }
    }

    // output
    cout << ans << endl;

    return 0;
}


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

using std::cout;    using std::cin;
using std::endl;    using std::string;
using std::min;

int main() {
	
	int n, k;
	string s;
	cin >> n >> k >> s;
	
	string::size_type count = 0;
	
	for (int i = 0; i != s.size() - 1; ++i) {
		
		if (s[i] == s[i + 1])
			++count;
	}
	
	count += k * 2;
	count = min(count, s.size() - 1);
	
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 3716
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int[] x = new int[N];
		for(int i = 0;i < N;++i)
			x[i] = sc.nextInt();
		int[] y = new int[M];
		for(int i = 0;i < M;++i)
			y[i] = sc.nextInt();
		sc.close();
		
		Arrays.sort(x);
		Arrays.sort(y);
		boolean isWar = true;
		if(X < y[0] && x[N-1] < Y && x[N-1] < y[0])
			isWar = false;
		if(isWar)
			System.out.println("War");
		else
			System.out.println("No War");
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int MSB(int x){
	int ans;
	for(ans = 0; (1ll << ans) <= x; ans++);
	return ans - 1;
}

map<tuple<int, int>, int> dp;
map<tuple<int, int, int>, int> dp_sub;

int solve_sub(int L, int R, int k){
//	printf("solve_sub(%lld, %lld, %lld)\n", L, R, k);
	auto v = dp_sub.find(tuple<int, int, int>(L, R, k));
	if(v != dp_sub.end()){
		return v->second;
	}
	if(k == -1){
		return 1;
	}
	int a = MSB(L), b = MSB(R);
	int ans = 0;
	if((1ll << k) <= R){
		if(a == k){
			ans = MOD(ans + solve_sub(L - (1ll << k), R - (1ll << k), k - 1));
		}
		else{
			ans = MOD(ans + solve_sub(0, R - (1ll << k), k - 1));
		}
	}
	if(L < (1ll << k) && (1ll << k) <= R){
		ans = MOD(ans + solve_sub(L, R - (1ll << k), k - 1));
	}
	if(L < (1ll << k)){
		if(b == k){
			ans = MOD(ans + solve_sub(L, (1ll << k) - 1, k - 1));
		}
		else{
			ans = MOD(ans + solve_sub(L, R, k - 1));
		}
	}
//	printf("solve_sub(%lld, %lld, %lld) = %lld\n", L, R, k, ans);
	dp_sub[tuple<int, int, int>(L, R, k)] = ans;
	return ans;
}

int solve(int L, int R){
//	printf("solve(%lld, %lld)\n", L, R);
	auto v = dp.find(tuple<int, int>(L, R));
	if(v != dp.end()){
		return v->second;
	}
	int ans;
	if(L == R){
		ans = 1;
	}
	else{
		int a = MSB(L), b = MSB(R);
		if(a == b){
			ans = solve(L - (1ll << a), R - (1ll << b));
		}
		else{
			ans = MOD(solve(0, R - (1ll << b)) + solve_sub(L, R - (1ll << b), b - 1) + solve(L, (1ll << b) - 1));
		}
	}
//	printf("solve(%lld, %lld) = %lld\n", L, R, ans);
	dp[tuple<int, int>(L, R)] = ans;
	return ans;
}

signed main(){
	int L, R, i;
	scanf("%lld%lld", &L, &R);
	int ans = 0;
	for(i = 0; ; i++){
//		printf("i = %lld\n", i);
		int lO_O = (1ll << i);
		if(2 * lO_O <= L){
			continue;
		}
		else if(lO_O > R){
			break;
		}
		else if(lO_O <= L && L < 2 * lO_O){
			if(2 * lO_O <= R){
				ans = MOD(ans + solve(L - lO_O, lO_O - 1));
			}
			else{
				ans = MOD(ans + solve(L - lO_O, R - lO_O));
			}
		}
		else{
			if(2 * lO_O <= R){
				ans = MOD(ans + solve(0, lO_O - 1));
			}
			else{
				ans = MOD(ans + solve(0, R - lO_O));
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll nl, nm;

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

  string s;
  cin >> s;

  string s1 = "dream";
  string s2 = "dreamer";
  string s3 = "erase";
  string s4 = "eraser";
  
  bool s1_f=false, s2_f=false, s3_f=false, s4_f=false;
  int i = s.size()-1;      
  while(s.size() > 0){
    s1_f=false, s2_f=false, s3_f=false, s4_f=false;
    REP(j, s1.size()){
      if(s1[s1.size()-1-j] != s[i-j]) s1_f = true;
      if(s3[s3.size()-1-j] != s[i-j]) s3_f = true;      
    }
    REP(j, s2.size()) if(s2[s2.size()-1-j] != s[i-j]) s2_f = true;
    REP(j, s4.size()) if(s4[s4.size()-1-j] != s[i-j]) s4_f = true;      
    
    if(s1_f && s2_f && s3_f && s4_f){cout << "NO" << endl; return 0;}
    if(!s1_f) s.erase(s.size()-s1.size(),s.size());
    if(!s2_f) s.erase(s.size()-s2.size(),s.size());
    if(!s3_f) s.erase(s.size()-s3.size(),s.size());
    if(!s4_f) s.erase(s.size()-s4.size(),s.size());
    i = s.size()-1;
  }
  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std ;

int n , m , k , x ;
vector < int > p ;
vector < vector < int > > a(11) ;
vector < bool > l ;
int ans ;
void fun( int h ){
	if( h == n + 1  ){
		int cnt = 0 ;
		for( int i = 1 ; i <= m ; i++  ){
			int c = 0 ;
			for( int j = 0 ; j < a[i].size() ; j++ ){
				if( l[a[i][j]] ) c++ ;
			}
			if( c % 2 == p[i] ) cnt++ ;
		}
		if( cnt == m ) ans++ ;
	}
	else{
		l[h] = false ;
		fun(h+1);
		l[h] = true ;
		fun(h+1);
	}
}

int main(){

	cin >> n >> m ;
	l.resize(n+1);
	p.resize(m+1);
	for( int i = 1 ; i <= n ; i++ ){
		l[i] = false ;
	}
	for( int i = 1 ; i <= m ; i++ ){
		cin >> k ;
		for( int j = 0 ; j < k ; j++ ){
			cin >>  x ;
			a[i].emplace_back(x);
		}
	}
	for( int i = 1 ; i <= m ; i++ ){
		cin >> p[i] ; 
	
	}	
	fun(1);
	cout << ans << endl ;

	return 0 ;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

long long modpow(long long x,long long n) {
    long long result = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            result = (result * x) % mod;
        }
        x = (x * x) % mod;
        n >>= 1;
    }
 
    return result;
}
#define N 3*1000000
long long x[N+1],y[N+1];

void make_fact_table(int n){
    int i;
    x[0]=y[0]=1;
    for(i=1;i<=n;i++){
        x[i]=(long long)(x[i-1]*i)%mod;
        y[i]=modpow(x[i],mod-2);
    }
}

long long mod_nCr(int n, int r){
    return x[n]*y[n-r]%mod*y[r]%mod;
}

int main(void){
    long long n=llin(),a=llin(),b=llin(),k=llin(),i,ans=0;
    mod=998244353;
    make_fact_table(n);
    rep(i,n+1){
        if(k-i*a<0)continue;
        if((k-i*a)%b==0){
            long long x=i,y=(k-i*a)/b;
            ans=(ans+mod_nCr(n,x)*mod_nCr(n,y)%mod)%mod;
        }
    }
    llprint(ans);
    return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
int main(){
 	int a, b, c, tmp;
  cin >> a >> b >> c;
  tmp = a;
  a = b;
  b = tmp;
  tmp = a;
  a = c;
  c = tmp;
  cout << a << " " << b << " " << c << endl;  
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


class Combinations:
    def __init__(self, max_num, mod):
        self.mod = mod
        self.factorials = [1]
        for i in range(1, max_num + 1):
            self.factorials.append((self.factorials[-1] * i) % mod)
        self.invs = [pow(self.factorials[-1], mod - 2, mod)]
        for i in reversed(range(1, max_num + 1)):
            self.invs.append(self.invs[-1] * i % mod)
        self.invs = self.invs[::-1]

    def __call__(self, n, k):
        if n < 0 or k < 0 or k > n:
            return 0
        return self.factorials[n] * self.invs[k] * self.invs[n - k] % self.mod


MOD = 10**9 + 7

x, y = ril()
a = (2 * x - y) // 3
b = a - x + y
if 3 * a != 2 * x - y:
    print(0)
    exit()

combinations = Combinations(10**6, MOD)
print(combinations(a + b, a))

Measured memory_bytes: 90036
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e9+7;

int main() {
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i, 60) {
    ll x = 0;
    rep(j, n) if(a[j]>>i&1) x++;
    ll now = x * (n-x) % mod;
    rep(j, i) now = now*2%mod;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <fstream>

#include <queue>

using namespace std;

int main(){
    
    int a,b,c;
    cin >> a >> b >> c;
    int maximum = max(a,max(b,c));
    int minimum = min(a,min(b,c));
    cout << minimum << " " << maximum << endl;
}


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

int main(void){
    int h,w; cin >> h >> w;
    vector<string>grid;
    string kabe(w+2,'#');
    grid.push_back(kabe);
    for(int i=0;i<h;i++){
        string s; cin >> s;
        string line = '#'+s+'#';
        grid.push_back(line);
    }
    grid.push_back(kabe);
    // for(int i=0;i<grid.size();i++){
    //     for(int j=0;j<grid[i].length();j++){
    //         cout << grid[i][j];
    //     }
    //     cout << endl;
    // }
    // cout << endl;

    vector<vector<ll>> r(h+2,vector<ll>(w+2,0)),l(h+2,vector<ll>(w+2,0)),u(h+2,vector<ll>(w+2,0)),d(h+2,vector<ll>(w+2,0));

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(grid[i][j]=='.' && grid[i][j-1]!='#') l[i][j] = l[i][j-1] + 1;
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=w;1<=j;j--){
            if(grid[i][j]=='.' && grid[i][j+1]!='#') r[i][j] = r[i][j+1] + 1;
        }
    }

    for(int j=1;j<=w;j++){
        for(int i=1;i<=h;i++){
            if(grid[i][j]=='.' && grid[i-1][j]!='#') u[i][j] = u[i-1][j] + 1;
        }
    }
    for(int j=1;j<=w;j++){
        for(int i=h;1<=i;i--){
            if(grid[i][j]=='.' && grid[i+1][j]!='#') d[i][j] = d[i+1][j] + 1;
        }
    }

    // for(int i=0;i<r.size();i++){
    //     for(int j=0;j<l[i].size();j++){
    //         cout << u[i][j];
    //     }
    //     cout << endl;
    // }
    // cout << endl;


    ll ans = 0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            ll tmp = r[i][j]+l[i][j]+u[i][j]+d[i][j] + 1;
            if(ans < tmp) ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
 int n;
 int k;
 long int sum=0;
 int i;

 cin>>n;
 cin>>k;
 
 long long int H[n];

 for(i=0;i<n;i++){
     cin>>H[i];
 }

 sort(H,H+n);

 for(i=0;i<n-k;i++){
     sum+=H[i];
 }
 
 cout<<sum;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int n=5;
	vector<int>Time={a,b,c,d,e};
	vector<int>nextTime(n);
	int BestTime=1e9;
	rep(i,n)nextTime[i]=(Time[i]%10==0?Time[i]:Time[i]-Time[i]%10+10);
	rep(i,n){
		int SumTime=0;
		rep(j,n)SumTime+=(i==j?Time[j]:nextTime[j]);
		BestTime=min(BestTime,SumTime);
	}
	cout<<BestTime<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
using namespace std;
const int spl = 1048576;
const double pi = acos(-1.0);
class point3d {
public:
	double x, y, z;
	point3d() : x(0), y(0), z(0) {};
	point3d(double x_, double y_, double z_) : x(x_), y(y_), z(z_) {};
	point3d& operator+=(const point3d& p) { x += p.x; y += p.y; z += p.z; return *this; }
	point3d& operator-=(const point3d& p) { x -= p.x; y -= p.y; z -= p.z; return *this; }
	point3d& operator*=(const double v) { x *= v; y *= v, z *= v; return *this; }
	point3d operator+(const point3d& p) const { return point3d(*this) += p; }
	point3d operator-(const point3d& p) const { return point3d(*this) -= p; }
	point3d operator*(const double v) const { return point3d(*this) *= v; }
	double abs() const { return sqrt(x * x + y * y + z * z); }
	double dot(point3d& p) const { return x * p.x + y * p.y + z * p.z; }
	point3d cross(point3d& p) const { return point3d(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x); }
};
void input(point3d *v) {
	cin >> (*v).x >> (*v).y >> (*v).z;
}
int main() {
	point3d c1, vx1, vy1, c2, vx2, vy2;
	input(&c1); input(&vx1); input(&vy1); input(&c2); input(&vx2); input(&vy2);
	point3d vz2 = vx2.cross(vy2);
	bool flag = false;
	int cnt = 0;
	double pre = -1.0;
	for (int i = 0; i <= spl; ++i) {
		double ang = i * 2 * pi / spl;
		point3d p = c1 + vx1 * cos(ang) + vy1 * sin(ang);
		point3d d = p - c2;
		double t = d.dot(vz2);
		if (i >= 1 && d.abs() <= 1.0 && pre * t <= 0.0) {
			++cnt;
		}
		pre = t;
	}
	cout << (cnt == 1 ? "YES\n" : "NO\n");
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  for (int i = 0; i <= 20000; i++) {
    if (i * 8 / 100 == a && i / 10 == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int INF=(int)1e9;
const int MOD=(int)1e9+7;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  int N;
  int a[200005],b[200005];
  cin>>N;
  for(int t=1;t<=N;t++)cin>>a[t];
  for(int t=1;t<=N;t++)b[t]=a[t]-t;

  sort(b+1,b+N+1);


  if(N%2==1){
    int x=N/2+1;
    lint sum=0;
    for(int t=1;t<=N;t++){
      sum+=abs(b[t]-b[x]);
    }
    cout<<sum<<endl;
  }else{
    int x=N/2,y=N/2+1;
    lint sum1=0,sum2=0;
    for(int t=1;t<=N;t++){
      sum1+=abs(b[t]-b[x]);
      sum2+=abs(b[t]-b[y]);
    }
    lint ans=min(sum1,sum2);
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<queue>
#define re register
#define ll long long 
#define maxn 10010000
#define mod 6662333 
#define inf 2147483647
#define mem(p) memset(&p,0,sizeof(p))
using namespace std;
inline int read()
{ 
    int x=0,f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} 
    while(isdigit(c)){x=x*10+c-48;c=getchar();}
    return x*f;
}
inline void put(ll x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) put(x/10);
     putchar(x%10+'0');
}
char a[maxn],b[maxn];
int sum;
int main()
{
    cin>>a;
    sum=strlen(a);//求字符数组a的长度 
    sum-=1;
    for(int i=0;a[i]!='\0';i++)
	{
        if(a[i]=='b') b[sum]='d';
        if(a[i]=='d') b[sum]='b';
        if(a[i]=='p') b[sum]='q';
        if(a[i]=='q') b[sum]='p';
        sum--;
    }
    if(strcmp(a,b)==false) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
long long n,i,j,a[1<<18],b,c,d;
int main(){
  cin>>n;
  for(i=1;i<=n;i++){cin>>a[i];b+=a[i];}
  c=b;
  for(i=1;i<=n;i++){
    d+=a[i];
    c=min(c,abs(d-(b-d)));
  }
  cout<<c;
}

Measured memory_bytes: 5120
#include <stdio.h>

int main (int ac, char** av) {
  double s = 0.0, t = 0.0;
  char buf[1024] = {0};
  while ((fgets(buf, 1024, stdin))  != NULL) {
    sscanf(buf, "%lf", &s);
    s /= 9.8;
    printf("%d\n", ((int)((4.9 * s*s) / 5 + 1) + 1));
  }
  return 0;
}

Measured memory_bytes: 636
#include "bits/stdc++.h" 
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rerep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
int main(){
    ll n;
    bool flag=false;
    cin>>n;
    if(n%10==7)flag=true;
    n/=10;
    if(n%10==7)flag=true;
    n/=10;
    if(n%10==7)flag=true;
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main() {
  int n;
  std::cin >> n;
  std::vector<int> h(n);
  for (auto &i : h) {
    std::cin >> i;
  }

  uint64_t count = 0;

  while (true) {
    const auto first = std::find_if(h.begin(), h.end(),
      [](const auto i){return i != 0;});
    const auto end = std::find(first, h.end(), 0);
    if (first == h.end()) {
      break;
    }
    const auto min_val = *std::min_element(first, end);
    count += min_val;

    for (auto itr = first; itr != end; itr++) {
      *itr -= min_val;
    }
  }
  std::cout << count << std::endl;
  return 0;
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

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

int main(){
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    if (a==b+c||a+b==c||a+c==b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

const int MAX_N = 101010;
const int INF = 1145141919;
int N, K;
int h[MAX_N];
int cost[MAX_N];

int main(){

    cin >> N >> K;
    for(int i = 0; i < N; i++)cin >> h[i];
    for(int i = 1; i < MAX_N; i++)cost[i] = INF;
    for(int i = 0; i < N; i++){
        for(int k = 1; k <= K; k++){
            cost[i + k] = min(cost[i + k], cost[i] + abs(h[i] - h[i + k]));
        }
    }
    cout << cost[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

int main() {
	int n;
	cin >> n;
	vector<int> v(n*3);
	rep(i, n * 3)
		cin >> v[i];
	SORT(v);
	reverse(all(v));
	ll result = 0;
	rep(i, n)
		result += v[2 * i + 1];

	cout << result << endl;


}


Measured memory_bytes: 1408
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v) for (auto i : v)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
#define fi first
#define se second
#define setp(x) setprecision(x)
#define mset(m, v) memset(m, v, sizeof(m))
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

//static const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//#define int ll

int main() { 
        string s, t;
        cin >> s >> t;
        if (s.size() > t.size()) {
                D("GREATER");
                return 0;
        } else if (s.size() < t.size()) {
                D("LESS");
                return 0;
        } else {
                int sp = 0, tp = 0;
                while (sp < s.size() && tp < t.size()) {
                        if (s[sp] < t[tp]) {
                                D("LESS");
                                return 0;
                        } else if (s[sp] > t[tp]) {
                                D("GREATER");
                                return 0;
                        } else {
                                sp ++;
                                tp ++;
                        }
                }
                D("EQUAL");
        }
        return 0;
}



Measured memory_bytes: 256