akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define mod 1000000007
int n,a,b,k,h,m,c;
string s;

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

if((a%2)==0)
{
    for(ll i=0;i<a/2;i++)
    {
        if(s[(a/2)+i]!=s[i])
        {
            cout<<"No";
            return 0;
        }
    }

cout<<"Yes";
return 0;
}
cout<<"No";

    return 0;

    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const int mod = 1e5;
const int MAX = 1e7;

int main() {
    double r; cin >> r;
    double ans = 2 * r * 3.1415926535897;
    printf("%.10f\n",ans);
}

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
	int n;
	cin>>n;
	int nn=n*n;
	int p[250000];
	rep(i, nn){
		cin>>p[i]; p[i]--;
	}

	bool sit[250000];
	rep(i, nn) sit[i]=true;
	int d[250000];
	rep(i, n) rep(j, n){
		d[i*n+j]=min(min(i, n-1-i), min(j, n-1-j));
	}

	unordered_map<int, bool> rem;
	int dx[]={0, 0, -1, 1};
	int dy[]={-1, 1, 0, 0};

	int ans=0;
	rep(k, nn){
		int xy=p[k];
		int x=xy/n, y=xy%n;
		ans+=d[xy];

		sit[xy]=false;
		rem[xy]=true;
		while(!rem.empty()){
			auto it=rem.begin();
			int tx=it->first/n, ty=it->first%n;
			rem.erase(it);

			int nd=(sit[tx*n+ty])?(d[tx*n+ty]+1):d[tx*n+ty];
			rep(i, 4){
				int nx=tx+dx[i], ny=ty+dy[i];
				if(nx>=0 && nx<n && ny>=0 && ny<n){
					if(nd<d[nx*n+ny]){
						d[nx*n+ny]=nd;
						rem[nx*n+ny]=true;
					}
				}
			}
		}


	}

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


Measured memory_bytes: 10216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b, c, d; cin >> a >> b >> c >> d;
    int ans = min(a, b) + min(c, d);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n; cin >> n;
    int res = 0;
    vector<int> v;
    int tot = 0;
    REP(i, n) {
        int tmp; cin >> tmp;
        v.push_back(tmp);
        tot += tmp;
    }

    if (tot % 10 != 0) {
        cout << tot << endl;
    } else {
        sort(ALL(v));
        REP(i, n) {
            if (v[i] % 10 != 0) {
                cout << tot - v[i] << endl;
                return 0;
            }
        }
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}
use input::*;

fn main() {
    let mut a = input_vector::<usize>();
    a.sort();
    if a[0] == 5 && a[1] == 5 && a[2] == 7 {
        p("YES");
    } else {
        p("NO");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  string s;cin>>s;
  ll i=0;
  ll x=s.length();
  //Aの数を保存しながら進めていく
  ll tmp=0,ans=0;
  bool a=false;
  while(i<=x){
    if(a and s[i]=='B' and s[i+1]=='C'){
      ans+=tmp;
      i+=2;
    }
    else if(s[i]=='A'){
      tmp++;
      a=true;
      i++;
    }
    else{
      a=false;
      tmp=0;
      i++;
    }

  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i

minf = [(a-1)%10, (b-1)%10, (c-1)%10, (d-1)%10, (e-1)%10].min

puts 10*(((a-1)/10+1)+((b-1)/10+1)+((c-1)/10+1)+((d-1)/10+1)+((e-1)/10+1))+minf-9

Measured memory_bytes: 1788
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int n;
char s[100000 + 5];
int main() {
	cin >> n;
	scanf("%s", s + 1);
	int ans = 0; 
	for (int i = 1; i <= n; ++i) {
		if (s[i] != s[i - 1]) ++ans;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 384
def gcd(n, m):
  while m:
    n, m = m, n%m
  return n

def isprime(n):
  if n == 1:
    return False
  for i in range(2, int(n**0.5) + 1):
    if (n % i == 0):
      return False
  return True

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  a, b = na()
  gcd_ = gcd(a, b)
  ans = 1
  for d in divi(gcd_):
    if isprime(d):
      ans += 1
  print(ans)

main()

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

int main(){
    int n;
    ll sum=0;
    cin >> n;
    vector <ll> a(n+1);
    vector <ll> b(n);
    rep(i,n+1) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n){
        sum+=min(a[i],b[i]);
        b[i]=b[i]-min(a[i],b[i]);
        sum+=min(a[i+1],b[i]);
        a[i+1]=a[i+1]-min(a[i+1],b[i]);
    }

    cout << sum << endl;
    return 0;

}

Measured memory_bytes: 1792
#include <iostream>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)
using namespace std;
int main(){
        int N, M;
        int a[50],b[50];
        int bac[50+1] =  {};
        cin >> N >> M;
        rep(i,M){
                cin >> a[i] >> b[i];
                bac[a[i]]++; bac[b[i]]++;
        }
        REP(i,1,N+1){
                cout << bac[i] << endl;
        }
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n,m,k;
	cin>>n>>m>>k;

	for (int i = 0; i <= n; i++){
		for (int j = 0; j <= m; j++){
			if(i*(m-j)+j*(n-i)==k){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}

	cout<<"No"<<endl;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n, m, x;
    cin >> n >> m >> x;
    vector<ll> C(n);
    vector<vector<ll>> v(n, vector<ll>(m));
    REP(i, n){
        cin >> C[i];
        REP(j, m) cin >> v[i][j];
    }

    ll res = 100000000;
    for(ll i=0; i<(1<<n); i++){
        vector<ll> skill(m, 0);
        ll cost = 0;
        for(ll j=0; j<n; j++){
            if(i & (1<<j)){
                cost += C[j];
                REP(k, m) skill[k] += v[j][k]; 
            }
        }

        bool flag = true;
        REP(k, m){
            if(skill[k] < x) flag = false;
        }
        if(flag){
            res = min(res, cost);
        }
    }
    if(res == 100000000) cout << -1 << endl;
    else cout << res << endl;
}

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

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
  ll N;
  cin >> N;
  for(ll h = 1; h <= 3500; h++) {
    for(ll w = h; w <= 3500; w++) {
      ll a = 4 * h * w - N * w - N  * h;
      ll b = N * h * w;
      if (a > 0 && (b % a) == 0) {
        cout << h << ' ' << w << ' ' << b / a << endl;
        return 0;
      }
    }
  }
}

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

typedef long long ll;
ll n,p[300005];

int main() {
    scanf("%lld", &n); n*=2;
    for (int i=0; i<n; i++) scanf("%lld", &p[i]);
    //calc i=[0, 2n) i*pi/(2n-1)
    double x=0;
    sort(p, p+n);
    for (int i=0; i<n; i++) x += 1.0*p[i]/(n-1.)*i;
    printf("%.12lf\n", x);
    return 0;
}


Measured memory_bytes: 1792
#include "iostream"
#include "vector"
#include "algorithm"

using namespace std;

int sumdigit(int n)
{
  int check = 0;
  for (int i = 0; i < 6; i++)
  {
    check += (n % 10);
    n /= 10;
  }
  return check;
}


int main()
{
  int n, a, b;
  cin >> n >> a >> b;
  int ans[10010];
  ans[0] = 0;
  for (int i = 1; i < n + 1; i++)
  {
    if (a <= sumdigit(i) && sumdigit(i) <= b)
    {
      ans[i] = ans[i - 1] + i;
    }
    else
    {
      ans[i] = ans[i - 1];
    }
  }

  cout << ans[n] << "\n";
}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#pragma G++ optimize(3)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		int li,ri;
		cin>>li>>ri;
		int people=ri-li+1;
		sum+=people;
	}
	cout<<sum<<endl;
	return 0;
}


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

int main(){
    long N;
    cin >> N;
    deque<long> A(N);
    for(auto& i : A)cin >> i;
    
    N >>= 1;
    
    deque<long> B(A);
    
    nth_element(begin(A), begin(A) + N - 1, end(A));
    nth_element(begin(A) + N - 1, begin(A) + N, end(A));
    
    for(const auto i : B)cout << (i >= A[N] ? A[N - 1] : A[N]) << endl;
    
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N;
    cin >> N;
    ll Vi, Ci;
    vector<ll> V;
    ll res = 0;
    for(int i=0;i<N;i++){
        cin >> Vi;
        V.push_back(Vi);
    }
    for(int i=0;i<N;i++){
        cin >> Ci;
        res += max((ll)0, V[i]-Ci);
    }
    cout<<res<<endl;

    return 0;
}

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

using namespace std;

#define int long long

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    long double kek = -(a + b - c + 0.0);
    if (kek < 0) {
        cout << "No";
        return;
    }
    //cout << kek <<  ' ' << sqrt(a * b) << endl;
    if (4 * a * b < kek * kek) cout << "Yes";
    else cout << "No";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--) 
  
long long fact(long long a, long long b){
    int r= max(a, b);
    int v= min(a, b);
    int l=1;
    // if(v==0)
    for(int i=r+1; i<=a+b; i++){
        l*=i;
    }
    for(int i=v; i>=2; i--){
        l/=i;
    }
    return l;
}

int gcd(int a, int b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
}

int powr(int a) { 
    int var=1;
    for(int i=0; i<a; i++){
        var*=2;
    }
    return var;
}

signed main(){    
    fast;
    int x, n;
    cin >> x >> n;
    int a[n];
    rep(i,0,n){
        cin >> a[i];
        a[i]-=x;
    }
    sort(a, a+n);
    int c=-1;
    for(int i=0; i<n; i++){
        if(a[i]==0)
           c=i;     
    }
    if(c<0){
        cout << x;
        return 0;
    }
    int r=0, l=0, j=c;
    while(c<n && a[c]==r){
        r++;
        c++;
    }
    while(j>=0 && a[j]==l){
        l--;
        j--;
    }
    if(abs(l)>abs(r)){
        cout << r+x;
    }
    else{
        cout << x+l;
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    map<char, char> mp;
    mp['A'] = 'T';
    mp['C'] = 'G';
    mp['T'] = 'A';
    mp['G'] = 'C';
    char c;
    cin >> c;
    cout << mp[c] << endl;
    return 0;
}


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

 
int main() {

    int64_t a,b;
    cin>>a>>b;

    if(a<=0 && b>=0)
        cout<<"Zero"<<endl;
    else if(a>0 && b>0)
        cout<<"Positive"<<endl;
    else {
        if( (b-a+1)%2==0)
            cout<<"Positive"<<endl;
        else
            cout<<"Negative"<<endl;
    }

 	return 0;
}

Measured memory_bytes: 3588
print("NYOE S"[input()in["AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR","KIHBARA","KIHABRA","KIHABAR","AKIHBRA","AKIHBAR","AKIHABR","KIHBRA","KIHBAR","KIHABR","AKIHBR","KIHBR"]::2])

Measured memory_bytes: 2940
#include <iostream>
#include <map>
#include <string>
using namespace std;

int main(){
  string s;
  cin>>s;
  map<char, int> mp;
  for(auto i : s){
    mp[i]++;
  }
  
  bool ok=true;
  for(auto e : mp){
    if (e.second != 2)
      ok=false;
  }
  cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
# coding: utf-8
from collections import defaultdict


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


def read():
    N = II()
    A = ILI()
    return N, A


def solve(N, A):
    count = defaultdict(int)
    for a in A:
        count[a] += 1
    l_len = [(key, value) for key, value in count.items() if value >= 2]
    l_len.sort(key= lambda x: -x[0])
    if len(l_len) <= 1:
        ans = 0
    else:
        if l_len[0][1] >= 4:
            ans = l_len[0][0] ** 2
        else:
            ans = l_len[0][0] * l_len[1][0]
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


Measured memory_bytes: 18592
#include <iostream>
#include <algorithm>
using namespace std;
int arr[100005];
int main()
{
	int n,ans;
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	scanf("%d",&arr[i]);
	sort(arr,arr+n);
	long long sum=0;
	for (int i=0;i<n;i++)
	{
		if (arr[i]>2*sum)
		ans=1;
		else
		ans++;
		sum+=arr[i];
	}
	printf("%d",ans);
}

Measured memory_bytes: 640
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   int N;                                                         
   int k;;                                                        
                                                                  
   scanf("%d",&N);                                                
   k = N % 10;                                                    
                                                                  
   if( k == 3){                                                   
      printf("bon");                                              
   } else if( k == 0 || k == 1 || k == 6 || k == 8){              
      printf("pon");                                              
   } else {                                                       
      printf("hon");                                              
   }                                                              
}                                                                 
      

Measured memory_bytes: 1716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    rep(i, 0, n) cin >> a[i];
    int ans = 0;
    if ((n - 1) % (k - 1) == 0) ans = (n - 1) / (k - 1);
    else ans = (n - 1) / (k - 1) + 1;

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


Measured memory_bytes: 640
#include<stdio.h>
 
int main(){
  int n,a,b;
  scanf("%d",&n);
  
  for(a=1; a<=9; a++){
    for(b=1; b<=9; b++){
  	if(n==a*b){
  	 puts("Yes");
      return 0;
    }
    }
  }
  puts("No");
  return 0;
}

Measured memory_bytes: 128
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
#include <pthread.h>
#include <omp.h>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a, a + n);
  int sum = 0;
  for (int i = 0; i < k;i++)
    sum += a[i];
  cout << sum << endl;
}


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

using namespace std;

#define mid ((l + r) >> 1)
#define lson (p << 1)
#define rson (p << 1 | 1)

const int N = 2e5 + 10;

int n, K;
int a[N];
long long d[N];
int tr[N * 4];

void add(int p, int l, int r, int x) {
  if (l == r) {
    tr[p]++;
    return;
  }
  if (x <= mid)
    add(lson, l, mid, x);
  else
    add(rson, mid + 1, r, x);
  tr[p] = tr[lson] + tr[rson];
}

int query(int p, int l, int r, int ll, int rr) {
  if (ll <= l && rr >= r) {
    return tr[p];
  }
  int ret = 0;
  if (ll <= mid) ret += query(lson, l, mid, ll, rr);
  if (rr >= mid + 1) ret += query(rson, mid + 1, r, ll, rr);
  return ret;
}

int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  vector <long long> v;
  for (int i = 1; i <= n; ++i) {
    d[i] = d[i - 1] + a[i] - K;
  }
  for (int i = 0; i <= n; ++i) {
    v.push_back(d[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 0; i <= n; ++i) {
    d[i] = lower_bound(v.begin(), v.end(), d[i]) - v.begin();
  }
  add(1, 0, n, d[0]);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += query(1, 0, n, 0, d[i]);
    add(1, 0, n, d[i]);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 7408
N, M = gets.split.map(&:to_i)
counter = Array.new(N, 1)
red_exists = Array.new(N, false)
red_exists[0] = true

M.times do
  x, y = gets.split.map { |x| x.to_i - 1 }

  counter[x] -= 1
  counter[y] += 1

  if red_exists[x]
    red_exists[y] = true
  end

  if counter[x].zero?
    red_exists[x] = false
  end
end

ans = 0

N.times do |i|
  next unless red_exists[i]

  ans += 1
end

puts ans


Measured memory_bytes: 3324
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	struct max_t
	{
		template<class T>T operator()(T&& lhs, T&& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>T operator()(T&& lhs, T&& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}
}

void Main()
{
	int S, W;
	std::cin >> S >> W;
	std::cout << (S <= W ? "unsafe" : "safe") << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3572
n, k = map(int, input().split())
mod = 10**9+7
A = {}
ans = 0
for i in range(k, 0, -1):
    A[i] = pow(k//i, n, mod)
    for j in range(2*i, k+1, i):
        A[i] -= A[j]
    ans = (ans + A[i] * i) % mod
print(ans)


Measured memory_bytes: 20688
#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  int a[1000000],b[1000000],i;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    b[a[i]-1]=i+1; 
  }
 for(i=0;i<n;i++){
  printf("%d ",b[i]);
 }
  return 0;
}

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

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

    vector<int> T(N + 1);
    vector<int> X(N + 1);
    vector<int> Y(N + 1);

    T.at(0) = 0;
    X.at(0) = 0;
    Y.at(0) = 0;

    for (int i = 1; i <= N; i++){
        cin >> T.at(i) >> X.at(i) >> Y.at(i);
    }

    bool A = false;
    for (int i = 1; i <= N; i++){
        if (T.at(i) % 2 == (X.at(i) + Y.at(i)) % 2 && T.at(i) - T.at(i-1) >= abs(X.at(i) - X.at(i -1)) + abs(Y.at(i) - Y.at(i -1))){
            A = true;
            continue;
        } else {
            A = false;
            break;
        }
    }
    
    if(A) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 1408
from bisect import bisect_left
from collections import defaultdict
n, m = map(int, input().split())
m = [tuple(map(int, input().split())) for _ in range(m)]

d = defaultdict(list)
for p, y in sorted(m):
    d[p] += [y]


for p, y in m:
    i = bisect_left(d[p], y)
    print('{:06}{:06}'.format(p, i+1))

Measured memory_bytes: 36312
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

map<pair<ll, ll>, int> mm;
ll ans = 0;

ll mod1 = 1000000087;
ll mod2 = 1000000021;
ll mul1 = 999999893;
ll mul2 = 999999929;

vector<int> G[SIZE];

pair<ll, ll> dfs(int now, int back = -1) {
  ll hash1 = 0, hash2 = 0;

  for (int to : G[now]) {
    if (to == back) continue;

    auto p = dfs(to, now);

    hash1 += p.first;
    hash2 += p.second;
  }

  hash1 = ((hash1 % mod1 * mul1) + 1) % mod1;
  hash2 = ((hash2 % mod2 * mul2) + 1) % mod2;

  pair<ll, ll> hash = {hash1, hash2};

  ans += mm[hash];
  mm[hash]++;

  return hash;
}

int main(){
  int N;

  scanf("%d", &N);

  for (int i=0; i+1<N; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs(0);

  printf("%lld\n", ans);

  return 0;
}



Measured memory_bytes: 28164
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << '\n'
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int w;
    cin >> w;
    int n = s.size();
    string ans = "";
    for (int i=0; i<n; i+=w) {
        ans += s[i];
    }
    
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int f[100]={};
	for(int i=0;i<n;i++){
		for(int j=9;j>=0;j--){
			int tmp;
			cin >> tmp;
			f[i]+=(tmp<<j);
		}
	}
	int p[100][11];
	for(int i=0;i<n;i++){
		for(int j=0;j<=10;j++){
			cin >> p[i][j];
		}
	}
	int ans=-1e9;
	for(int i=1;i<(1<<10);i++){
		int point=0;
		for(int j=0;j<n;j++){
			int tmp=f[j]&i;
			int c=0;
			while(tmp>0){
				if(1&tmp) c++;
				tmp=tmp>>1;
			}
			point+=p[j][c];
		}
		ans=max(ans,point);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  
int main() {
  ll h,w,n;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	inl(n);
	inl(k);
	FOR(i,0,31){
		ll x = 1;
		ll x1 = i;
		while(x1--){
			x *= k;
		}
		if(x>n){out(i);return 0;}
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n;
	int dp[101] = {0};
	
	dp[4] = 1;
	dp[7] = 1;
	for (int i = 8; i <= 100; i++) {
		if (dp[i - 4]) dp[i] = 1;
		if (dp[i - 7]) dp[i] = 1;
	}
	
	scanf("%d", &n);
	printf(dp[n] ? "Yes\n" : "No\n");
	
	return 0;
}

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

const long long INF = 1LL << 60;

int main() {
    // Debug::set_INF(INF);
    int N, M, L;  cin >> N >> M >> L;
    vector<vector<long long>> dist(N, vector<long long>(N, INF));
    for (int i = 0; i < M; ++i) {
        int a, b, c;  cin >> a >> b >> c;
        --a;  --b;
        dist[a][b] = c;
        dist[b][a] = c;
    }
    for (int i = 0; i < N; ++i) dist[i][i] = 0LL;

    // Warshall Floyd for dist
    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                if (dist[i][j] > dist[i][k] + dist[k][j]) {
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }
        }
    }

    vector<vector<long long>> dist2(N, vector<long long>(N, INF));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (dist[i][j] <= L) dist2[i][j] = 1;
        }
    }
    for (int i = 0; i < N; ++i) dist[i][i] = 0;

    // Warshall Floyd for dist2
    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                if (dist2[i][j] > dist2[i][k] + dist2[k][j]) {
                    dist2[i][j] = dist2[i][k] + dist2[k][j];
                }
            }
        }
    }

    int Q;  cin >> Q;
    for (int i = 0; i < Q; ++i) {
        int s, t;  cin >> s >> t;  --s;  --t;
        cout << (dist2[s][t] == INF ? -1 : dist2[s][t] - 1) << endl;
    }
}


Measured memory_bytes: 1920
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	initialBufSize = 10000
	maxBufSize     = 100000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

func scanIntNums() (nums []int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	nums = make([]int, len(numString))
	var err error

	for i := 0; i < len(nums); i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}

func main() {
	inputs := scanIntNums()
	N := inputs[0]
	K := inputs[1]
	dist := scanIntNums()

	tmp := 1
	loopMap := make(map[int]int, N)
	for i := 0; i < N; i++ {
		loopMap[i] = -1
	}
	path := make([]int, 0, N)
	path = append(path, 1)

	var offset int
	loopSize := 1
	for i := 0; i <= K; i++ {
		if loopMap[tmp-1] != -1 {
			loopSize = i - loopMap[tmp-1]
			offset = loopMap[tmp-1]
			path = path[:len(path)-1]
			break
		}
		loopMap[tmp-1] = i
		path = append(path, dist[tmp-1])
		tmp = dist[tmp-1]
	}
	loop := path[offset:len(path)]
	//fmt.Println("loopMap", loopMap)
	//fmt.Println("loopSize:", loopSize)
	//fmt.Println("offset:", offset)
	//fmt.Println("path:", path)
	//fmt.Println("loop:", loop)

	var step int
	if K < len(path) {
		step = K
		fmt.Println(path[step])
	} else {
		step = ((K - len(path)) % loopSize)
		fmt.Println(loop[step])
	}

	//fmt.Println("step:", step)

}


Measured memory_bytes: 18380
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;

ll nCr(ll n, ll r) {
	if (r > n) { return 0; }
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
ll sumdigit(ll n) {
	ll dig = 0, sum = 0;
	while (n) {
		dig = n % 10;
		sum = sum + dig;
		n = n / 10;
	}
	return sum;
}



int main() {
	int a, c;
	char b;
	std::cin >> a >> b >> c;
	if (b == '+') {
		std::cout << a + c << std::endl;
	}
	else {
		std::cout << a - c << std::endl;
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        a--;
        ans.at(a) = i + 1;
    }
    for (int i = 0; i < n; i++) {
        cout << ans.at(i) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))
D = [0 for i in range(N)]
D[1] = abs(A[0] - A[1])
for i in range(2, N):
  D[i] = min(D[i-2] + abs(A[i] - A[i-2]), D[i-1] + abs(A[i] - A[i-1]))
print(D[-1])

Measured memory_bytes: 90268
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max(a, d), max(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

int n;
double a[51];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("A.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    for(int i=1; i<n; i++)
    {
        a[i] = (a[i]+a[i-1])/2;
    }
    cout << fixed << setprecision(6) << a[n-1];
}



Measured memory_bytes: 256
def checkWays(n,x)
  count = 0
  catch(:stop) do
    n.downto(1) do |n1|
      (n1-1).downto(1) do |n2|
        n3 = x - n1 - n2
        count += 1 if (n3 < n2) && (n3 > 0)
        throw :stop if (n3 > n1)
        break if (n3 > n2)
      end
    end
  end
  puts count
end

while ((n,x = gets.split(" ").map(&:to_i)).inject(:+) != 0) do
  checkWays(n,x)
end

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
string s,v;
int main(){
	cin>>s>>v;
	int t=s.size(),a=0;
	for(int i=0;i<t;i++){
	if(s[i]!=v[i]) a++;
 	}
	cout<<a<<endl;
} 

Measured memory_bytes: 3888
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                a[j][k] = 0

for i in range(3):
    if sum(a[i]) == 0:
        print("Yes")
        exit()
for i in range(3):
    if sum([a[0][i], a[1][i], a[2][i]]) == 0:
        print("Yes")
        exit()
if sum([a[0][0], a[1][1], a[2][2]]) == 0 or sum([a[0][2], a[1][1], a[2][0]]) == 0:
    print("Yes")
    exit()
print("No")

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

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    
    string A;
    cin >> A;
        
    if ( A == "P" || A == "W" || A == "G" ) {
     
      if ( i == N-1 ) {
      cout << "Three" << endl;
        break;
      }
    }
    else {
      cout << "Four" << endl;
        break;
    }
  }  
}

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

signed main(){
  int A, B;
  cin >> A >> B;
  
  for( int i = 1; i <= 100000; i++ ){
    int C = i*0.08;
    int D = i*0.10;
    if( A == C && B == D ){
      cout << i << endl;
      return 0;
    }
   
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
from itertools import accumulate

#素数リスト
n = 100000
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=set(primes)

numli = [0]*n
for i in range(n):
  if i in primes:
    if (i+1)//2 in primes:
      numli[i] = 1

numli = list(accumulate(numli))

Q = int(input())
for _ in range(Q):
  r,l = map(int,input().split())
  print(numli[l] - numli[r-1])

Measured memory_bytes: 14440
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, a, b;
  cin >> n >> a >> b;

  int ans = 0;
  rep(i, 1, n + 1) {
    int t = i, sum_val = 0;
    while (t) {
      sum_val += t % 10;
      t /= 10;
    }
    if (sum_val >= a && sum_val <= b)
      ans += i;
  }
  cout << ans << endl;
}


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

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll a, b, n;
  cin >> a >> b >> n;
  set <ll> s;
  rep(i, n) {
    if (a+i <= b) s.insert(a+i);
    if (a <= b-i) s.insert(b-i);
  }
  for (auto value : s) {
    cout << value << endl;
  }
}

Measured memory_bytes: 256
// Problem : D - Div Game
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;
typedef pair <LL, int> PLI;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

vector <PLI> v;

int main()
{
	//File("");
    LL n = gl();
    for (LL i = 2; i * i <= n; i+=1)
    	if (n % i == 0)
    	{
    		int s = 0;
    		while (n % i == 0) n /= i, ++s;
    		v.push_back(make_pair(i, s));
    	}
    if (n != 1) v.push_back(make_pair(n, 1));
    LL ans = 0;
    for (auto x : v)
    {
    	int fir = x.first, sec = x.second;
    	LL now = 0, nsum = 0;
    	for (LL k = 1; k <= 1000000; k+=1)
    	{
    		nsum += k;
    		if (nsum > sec) {now = k - 1; break;}
    	}
    	ans += now;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

string S;
ll res;
int p, BIT[1 << 18];
set<int>st[26];

int sum(int t) {
	++t;
	int a = 0;
	while (t) {
		a += BIT[t];
		t -= t&-t;
	}
	return a;
}

void add(int t) {
	++t;
	while (t <= S.size()) {
		++BIT[t];
		t += t&-t;
	}
}

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); ++i) {
		st[S[i] - 'a'].insert(i);
	}
	for (int i = 0; i < 26; ++i) {
		p += st[i].size() & 1;
	}
	if (p >= 2) {
		cout << -1 << endl;
		return 0;
	}
	p = -1;
	for (int i = 0; i < S.size(); ++i) {
		if (st[S[i] - 'a'].size() >= 2) {
			st[S[i] - 'a'].erase(st[S[i] - 'a'].begin());
			auto it = st[S[i] - 'a'].end();
			--it;
			int t = *it;
			st[S[i] - 'a'].erase(it);
			res += S.size() - 1 - (t - sum(t)) - (i - sum(i) - (p != -1));
			add(t);
		}
		else if (st[S[i] - 'a'].size() == 1) {
			p = i;
			st[S[i] - 'a'].clear();
		}
	}
	if (p != -1) {
		res += S.size() / 2 - (p-sum(p));
	}
	cout << res << endl;
}

Measured memory_bytes: 10244
h,n=map(int,input().split())
a=[[int(i) for i in input().split()]for i in range(n)]
inf=10**9
dp=[inf]*(h+1) #0-9
dp[0]=0
mini=inf
for i in range(h+1):
    if dp[i]==inf:
        continue
    for ata,mp in a:
        if i+ata>=h:
            tmp=dp[i]+mp
            mini=min(mini,tmp)
            continue
        dp[i+ata]=min(dp[i+ata],dp[i]+mp)
print(mini)

Measured memory_bytes: 42844
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin >> n;
	while(n--){
		string a, b;
		bool cu = false;
		cin >> a >> b;
		int al = a.length(), bl = b.length(), ans[101] = {0};
		for(int i = 0; i < min(al, bl); i++){
			ans[i] = a[al-i-1] + b[bl-i-1] - 48 * 2;
			if(cu) ans[i]++;
			if(ans[i] >= 10){
				ans[i] %= 10;
				cu = true;
			}else cu = false;
		}
		for(int i = min(al, bl); i < max(al, bl); i++){
			if(al > bl) ans[i] = a[al-i-1] - 48 + cu;
			else ans[i] = b[bl-i-1] - 48 + cu;
			if(ans[i] >= 10){
				ans[i] %= 10;
				cu = true;
			}else cu = false;
		}
		if(cu) ans[max(al, bl)] = 1;
		if(max(al, bl)+cu > 80) cout << "overflow";
		else for(int i = (cu? max(al, bl):max(al, bl)-1); i >= 0; i--) cout << ans[i];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll N;
    ll A, B;
    ll ans = 0;

    cin >> N >> A >> B;

    ans += A * (N / (A + B));
    if(N % (A + B) <= A){
        ans += N % (A + B);
    }else{
        ans += A;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int k,ans;
int gcd(int a,int b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}
signed main()
{
	scanf("%d",&k);
	for (int a=1;a<=k;a++)
	{
		for (int b=1;b<=k;b++)
		{
			for (int c=1;c<=k;c++)
			{
				ans+=gcd(a,gcd(b,c));
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vstr=vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define _GLIBCXX_DEBUG
int main()
{
    int n;
    cin>>n;
    bool can=false;
    for(int i=1;i<10;i++){
        if(n%i==0){
            if(n/i<=9){
                can=true;
                break;
            }
        }
    }
    if(can)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
	long long ans = 1, K, A, B;
	cin >> K >> A >> B;
	if (B - A <= 2) cout << K + 1;
	else {
		ans = A;
		K -= (A - 1);
		cout << ans + (B - A) * (K / 2) + K % 2;
	}
}

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

int main(void) {
  int a, b, c;
  int k;
  cin >> a >> b >> c >> k;
  if (b < c) swap(b, c);
  if (a < b) swap(a, b);

  cout << a * (1 << k) + b + c << endl;
  return 0;
}

Measured memory_bytes: 256