akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(long long X, long long Y)
{

  for (int i = 0; i <= 100; i++)
    for (int j = 0; j <= 100; j++)
    {
      if (i + j == X && 2 * i + 4 * j == Y)
      {
        cout << YES << endl;
        return;
      }
    }
  cout << NO << endl;
}

int main()
{
  cout << setprecision(10);
  long long X;
  scanf("%lld", &X);
  long long Y;
  scanf("%lld", &Y);
  solve(X, Y);
  return 0;
}


Measured memory_bytes: 3704
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <deque>
# include <iomanip>
# include <queue>
# include <sstream>
# include <unordered_set>
# include <unordered_map>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define MP make_pair
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define STRING(x) string x;cin>>x;
# define STR(x) STRING(x);
# define DOUBLE(x) double x;cin>>x;
# define DBL(x) DOUBLE(x); 
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl
# define INIT(a) memset(a,-1,sizeof a)
# define CLR(a) memset(a,0,sizeof a)
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
//const int M = 1000000007;
template<class T> void debug(T a) { for ( auto i : a )cout << i << endl; }

int w;
vi a { 1 };
bool check(vi& ans)
{
	int v = 0;
	FOR(i, ans.size())
	{
		v += a[i] * ans[i];
	}
	return w == v;
}

void next(vi& ans)
{
	ans[0]++;
	FOR(i, ans.size())
	{
		if ( ans[i] == 2 )
		{
			ans[i] = -1;
			if ( i == ans.size() - 1 )
			{
				ans.push_back(-1);
			}
			else
			{
				ans[i + 1]++;
			}
		}
	}
}

int main()
{
	FORI(i, 1, 15)a.emplace_back(a.back() * 3);

	cin >> w;
	vi ans = { -1 };
	while ( !check(ans) )
	{
		next(ans);
	}
	reverse(ALL(ans));
	string c = "-0+";
	FOR(i, ans.size())
	{
		cout << c[ans[i] + 1];
	}
	cout << endl;
}

Measured memory_bytes: 3184
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

int main(){
  itn n,t; cin >> n >> t;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int mn=inf;
  int diffmx=0;
  int ans=0;
  rep(i,n){
    chmin(mn,a[i]);
    chmax(diffmx,a[i]-mn);
  }
  set<int> st;
  rep(i,n){
    st.insert(a[i]);
    if(st.count(a[i]-diffmx)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 8264
n = gets.to_i
a = gets.split.map(&:to_i)

a_max = a.max
 a_min = a.min

puts 2 * n - 1
idx = 0
if a_min.abs <= a_max
  idx = a.index(a_max)
  for i in 1..n do
    puts "#{idx + 1} #{i}"
  end
  for i in 1..(n - 1) do
    puts "#{i} #{i + 1}"
  end
else
  idx = a.index(a_min)
  for i in 1..n do
    puts "#{idx + 1} #{i}"
  end
  for i in 1..(n - 1) do
    puts "#{n - i + 1} #{n - i}"
  end
end


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n;
  string s;
  cin >> n >> s;
  int x = 0;
  int ans = 0;
  for(auto c : s) {
    if(c == 'I') ++x;
    else --x;
    chmax(ans, x);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std;
string s,s1,t;
main()
{
    int l;
    while(cin>>s>>t)
    {
        l=s.size();
        s1=s;
        while(s!=t)
        {
            s.insert(0,1,s[l-1]);
            s.erase(l,1);
            if(s==s1) break;
        }
        s==t ? puts("Yes") : puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
io = STDIN
n=io.gets.chomp.to_i
s=[]
n.times do
  s<<io.gets.chomp.to_i
end
if ss=s.sort.find{|i|i%10!=0}
  sum=s.inject(:+)
  if sum%10==0
    puts sum-ss
  else
    puts sum
  end
else
  puts 0
end


Measured memory_bytes: 1788
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  char b;
  cin >> b;
  if (b == 'A') cout << 'T' << endl;
  if (b == 'T') cout << 'A' << endl;
  if (b == 'C') cout << 'G' << endl;
  if (b == 'G') cout << 'C' << endl;
  return 0;
}


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

vector<long> wa;
vector<long> ans;
int main(void){
  long n,q,l,r;
  string s;
  cin >> n >> q;
  cin >> s;

  wa = vector<long>(n+1);
  ans = vector<long>(q);
  for(long i=0;i<s.length();i++){
    if(s[i] == 'C'){
      if(s[i > 0 ? i-1:0] == 'A'){
        wa[i+1] = wa[i]+1;
      }else{
        wa[i+1] = wa[i];
      }
    }else{
      wa[i+1] = wa[i];
    }
  }
  for(long i=0;i<q;i++){
    cin >> l >> r;
    ans[i] = wa[r] - wa[l];
  }
  for(long i=0;i<q;i++){
    cout << ans[i] << endl;
  }
  return 0;

}


Measured memory_bytes: 2560
from math import ceil


def main(N, A, B, C, D, E):
    loads = [A, B, C, D, E]
    min_val = min(loads)
    min_index = loads.index(min_val)

    res = min_index + ceil(N / min_val) + (5 - (min_index + 1))

    return res


if __name__ == "__main__":
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    print(main(N, A, B, C, D, E))


Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main(){

  double ax,ay,bx,by,cx,cy,dx,dy;
  while(cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy){
    if(ay>dy||by<cy||bx<cx||dx<ax)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;

  }

}
//ax <= dx && ay <= dy && cx <= bx && cy <= by

Measured memory_bytes: 1220
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }

//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p%i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

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

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N, K;
	cin >> N >> K;
	if (N%K == 0) {
		O(0);
	}
	else {
		O(1);
	}

	return 0;
}

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    token = lines[0].split()
    n = int(token[0])

    return (n, )


def solve(n, ):

        
    return int(((180 - (360 / n)) / 2 ) * 2 * n) 




def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
import math
a,b,c,d=map(int,input().split())
x=b-b//c-b//d+b//(c*d//math.gcd(c,d))
y=(a-1)-(a-1)//c-(a-1)//d+(a-1)//(c*d//math.gcd(c,d))
print(x-y)

Measured memory_bytes: 9088
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,m;
	cin>>n>>m;
	int sum=0;
	int temp;
	for(int i=0;i<m;i++){
		cin>>temp;
		sum += temp;
	}
	if(n<sum) cout<<-1<<endl;
	else cout<<n-sum<<endl;
	return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
 using namespace std;
  int main(){
      int n;
      cin >> n;
      vector <string> s(n);
      int ac=0,wa=0,tle=0,re=0;
      for(int i=0;i<n;i++){
        cin >> s.at(i);
        if(s.at(i)=="AC"){
            ac++;
        }
        else if(s.at(i)=="WA"){
            wa++;
        }
        else if(s.at(i)=="TLE"){
            tle++;
        }
        else{
            re++;
        }
      }
      cout << "AC" << " " << "x"  << " " << ac << endl;
      cout << "WA" << " " << "x" << " " << wa << endl;
      
      cout << "TLE" << " " << "x" << " " << tle << endl;
    
    
      cout << "RE" << " " << "x" << " " << re << endl;
  }

Measured memory_bytes: 6424
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <cmath>
#include <cassert>

#include <queue>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, MOD = 1e9 + 7;

int N, a[405];
ll ps[305], dp[405][405];

ll go(int l, int r) {
    if (l > r) return LLONG_MAX / 4;
    if (~dp[l][r]) return dp[l][r];
    if (l == r) return dp[l][r] = 0;
    ll ret = LLONG_MAX / 4;
    for (int m = l; m < r; m++) {
        ret = min(ret, go(l, m) + go(m + 1, r));
    }
    return dp[l][r] = ret + ps[r] - ps[l - 1];
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> a[i], ps[i] = ps[i - 1] + a[i];
    memset(dp, -1, sizeof(dp));
    cout << go(1, N) << '\n';
    return 0;
}


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


using namespace std;


using ll = long long;


int main() {
    ll N;
    cin >> N;
    vector<ll> sticks(N);
    for (ll i = 0; i < N; i++) {
        cin >> sticks[i];
    }

    ll ans = 0;
    sort(sticks.begin(), sticks.end());
    for (ll i = 0; i < N; i++) {
        for (ll j = i + 1; j < N; j++) {
            ll a = sticks[i], b = sticks[j];
            ll c_gt, c_lt;
            c_gt = max(b - a, b - a);
            c_lt = a + b;

            auto r = lower_bound(sticks.begin() + j + 1, sticks.end(), c_lt);
            auto l = upper_bound(sticks.begin() + j + 1, sticks.end(), c_gt);
            ll tmp = r - l;
            ans += tmp;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<functional>
#include<bits/stdc++.h> 
using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int a,b,c;
    cin>>a>>b>>c;
    (a+b+c>=22)?cout<<"bust\n":cout<<"win\n"<<endl;
    
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d.at(i);
  }
  int sum=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i!=j){
        sum+=d.at(i)*d.at(j);
      }
    }
  }
  cout << sum/2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b;
	char op;

	while(1) {
		scanf("%d %c %d", &a, &op, &b);
		
		if(op == '?') break;

		switch (op) {
			case '+':
				printf("%d\n", a + b);
				break;
			case '-':
				printf("%d\n", a - b);
				break;
			case '*':
				printf("%d\n", a * b);
				break;
			default:
				printf("%d\n", a / b);
				break;
		}
	}

	return 0;
}



Measured memory_bytes: 2036
N = int(input())
S = [1 if i == "." else 0 for i in input()]
# 黒は#,白が.
# 黒は0,白は1
# 黒の右に白は許されない
# ある場所を境に左は全部白、右は全部黒にするから、それの逆の個数を数える
# ある境より右にある白の数
rw = sum(S)
# ある境より左にある黒の数
lb = 0
min_temp = rw+lb
for idx,s in enumerate(S):
    # 黒の場合
    if s==0:
        # rw pass
        lb += 1
    # 白の場合
    elif s==1:
        rw -= 1
    # 小さい方を残す
    min_temp = min([min_temp,rw+lb])
    if min_temp == 0:break
print(min_temp)

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var str = "";
			double x = 0, y = 0, angle = 0;
			while ((str = Console.ReadLine()) != null)
			{
				var xy = str.Split(',').Select(i => int.Parse(i)).ToArray();
				if (xy[0] == 0 && xy[1] == 0)
					break;
				x += (double)xy[0] * Math.Sin(angle * (Math.PI / 180));
				y += (double)xy[0] * Math.Cos(angle * (Math.PI / 180));
				angle += (double)xy[1];
			}
			Console.WriteLine((int)x);
			Console.WriteLine((int)y);
		}
	}
}

Measured memory_bytes: 5920
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B; cin >> N >> A >> B;
	vector<int> h(N); rep(i, 0, N) { cin >> h[i]; }
	auto f = [&](int k) {
		vector<int>v(h);
		int c(0);
		rep(i, 0, N) {
			v[i] -= B*k;
			if (v[i] > 0) {
				c += (v[i] + (A - B - 1)) / (A - B);
			}
			if (c > k)return false;
		}
		return true;
	};
	int l(0), r(1e9);
	while (r - l > 1) {
		dump(l, r);
		int mid = (l + r) / 2;
		if (f(mid))r = mid;
		else l = mid;
	}
	dump(l, r);
	cout << r << endl;
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (b % a)
    cout << b - a << endl;
  else
    cout << a + b << endl;

  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0;
  cin >> n;
  while (n > 0) n -= 1000;
  ans = n * -1;
  cout << ans << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<bool> alpha(26);
    rep(i, n) {
        alpha[s[i] - 'a'] = true;
    }
    string ans = "None";
    rep(i, 26) {
        if (alpha[i] == false) {
            ans = 'a' + i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3744
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
 

public class Main{
          
    static int n=0;
     
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{ String line;
             while((line=br.readLine())!=null){if(line.isEmpty())break;
             String spl[] = line.split(" ");
             int a= Integer.parseInt(spl[0]);
             if(a==0)break;
             n=a;//static
             int mahozin[][] = new int[a][a];
             int xy[] ={ a/2, a/2+1 }; int nCounter=1;
             while(true){
                 //System.out.println(xy[0]+" "+xy[1]+" "+nCounter);
                 if(nCounter>=a*a+1)break;
                 if(mahozin[xy[1]][xy[0]]==0){
                     mahozin[xy[1]][xy[0]]=nCounter;
                     nCounter++; xy=migisita(xy);
                }else{//umatteru
                     xy=hidarisita(xy);
                 }
             }
             for(int y=0;y<a;y++){
                 for(int x=0;x<a;x++) System.out.print(_4keta(mahozin[y][x]));
                 System.out.println("");
             }
             } br.close();
         }catch(Exception e){e.printStackTrace();}         
     }  
    static String _4keta(int n){
        if(n/10==0) return "   "+n;
        if(n/100==0) return "  "+n;
        if(n/1000==0) return " "+n;
        return n+"";
    }
     static int[] migisita(int[] inV){
         int nowX = inV[0], nowY=inV[1];
         int nexX = (nowX==n-1)? 0 : nowX+1;
         int nexY = (nowY==n-1)? 0 : nowY+1;
         return new int[]{nexX, nexY};         
     }
     static int[] hidarisita(int[] inV){
         int nowX = inV[0], nowY=inV[1];
         int nexX = (nowX==0)? n-1 : nowX-1;
         int nexY = (nowY==n-1)? 0 : nowY+1;
         return new int[]{nexX, nexY};         
     }
     
}
 

Measured memory_bytes: 17044
#include <iostream>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)

int main() {
	ll X; cin >> X;

	rep(i, 1, 100000) {
		if (X <= i * (i + 1) / 2) {
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int coun,b;
    coun=0;
    string a;
    cin>>a;
    if(a[0]=='o')
    {
        coun++;
    }
    if(a[1]=='o')
    {
        coun++;
    }
    if(a[2]=='o')
    {
        coun++;
    }
    b=(100*coun)+700;
    cout<<b;


    return 0;
}


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

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
 
int main(){
   string S,T; cin >> S >> T;
   ll count(0);
   rep(i,S.size()){
      if(S[i]!=T[i]){
         count++;
      }
   }
   cout << count << endl;
}

Measured memory_bytes: 3912
#include<stdio.h>
int main(void)
{
	int A=0,B=0,a,b;

	for (int i = 1; i <= 4; i++)
	{
		scanf("%d", &a);
		A = A + a;
	}

	for (int i = 1; i <= 4; i++)
	{
		scanf("%d", &b);
		B = B + b;
	}

	if (A > B)
	{
		printf("%d\n", A);
	}

	else if (A < B)
	{
		printf("%d\n", B);
	}
	else
	{
		printf("%d\n", A);
	}

	return 0;
}

Measured memory_bytes: 1796
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    
    int a,b,c;
    
    cin >> a >> b >> c;
    
    if (a >= b && a >= c){
    
    cout << 10*a+b+c << endl;
    
    }else if(b >= a && b >= c ){
    
    cout << 10*b+c+a << endl;
    
    }else if(c >= a && c >= b ){
    
    cout << 10*c+b+a << endl;
    
    }
    
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_reverse(i, n) for (int i = (n)-1; (i) >= 0; --(i))
using namespace std;

int main() {
    // input
    int n; scanf("%d", &n);
    vector<int> a(n); repeat (i, n) scanf("%d", &a[i]);
    // solve
    int sum_a = 0;
    vector<bool> cnt(30);
    for (int a_i : a) {
        sum_a ^= a_i;
        cnt[__builtin_ctz(a_i)] = true;
    }
    int result = 0;
    repeat_reverse (i, 30) {
        if (sum_a & (1 << i)) {
            if (not cnt[i]) {
                result = -1;
                break;
            } else {
                result += 1;
                sum_a ^= (1 << (i + 1)) - 1;
            }
        }
    }
    // output
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 640
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
    
MAX1 = max(A)
MAX2 = -1
index = A.index(MAX1)
for i in range(N):
    if i != index:
        MAX2 = max(MAX2,A[i])
        
if MAX1 == MAX2:
    for i in range(N):
        print(MAX1)
else:
    for i in range(N):
        if i == index:
            print(MAX2)
        else:
            print(MAX1)
            
    

Measured memory_bytes: 68824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
vector <int> c,d;
int main(){
	int n;
	scanf("%d",&n);
	vector<int> a(n),b(n);
	for (int i=0;i<n;i++)a[i]=read();
	for (int i=0;i<n;i++)b[i]=read();
	ll ans=0,x=1;
	for (int k=0;k<=28;k++){
		c=a; d=b;
		 ll y=x*2;
		for (int i=0;i<n;i++){
			c[i]=c[i]%y;
			d[i]=d[i]%y;
		}
		sort(d.begin(),d.end());
		int m1=0;
		for (int i=0;i<n;i++){
			int l1,r1,l2,r2;
			l1=lower_bound(d.begin(),d.end(),x-c[i])-d.begin();
			r1=lower_bound(d.begin(),d.end(),2*x-c[i])-d.begin()-1;
			l2=lower_bound(d.begin(),d.end(),3*x-c[i])-d.begin();
			r2=lower_bound(d.begin(),d.end(),4*x-c[i])-d.begin()-1;
			m1+=(r1-l1+1+r2-l2+1);
		}
		if (m1&1) ans+=x;
		x*=2;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;  

int main(){
  int N;
  int A[100] = {1};
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  int max = A[0];
  int min = A[0];
  for (int i = 1; i < N; i++)
  {
    if (A[i] > max)
    {
      max = A[i];
    }
    
    if (A[i] < min)
    {
      min = A[i];
    }
  }

  cout << max - min << endl;
  

}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;
const int MOD = 1e9 + 7;

int main() {
    long long n;
    cin >> n;
    vector<long long> dp(n + 1, 0);
    vector<long long> dp1(n + 1, 0), dp2(n + 1, 0);
    vector<long long> dp1_accum(n + 1, 0), dp2_accum(n + 1, 0);
    dp1[0] = 1, dp2[0] = 1, dp1_accum[0] = 1, dp2_accum[0] = 1;
    dp1[1] = 1, dp2[1] = n - 1, dp1_accum[1] = 1, dp2_accum[1] = n - 1;
    IFOR(i, 2, n) {
        dp1[i] = (dp1[i - 1] + dp2[i - 1]) % MOD;
        dp1_accum[i] = (dp1_accum[i - 1] + dp1[i]) % MOD;


        // i-n-1 ~ i-3までの和
        // n-1: 2-nを選んだ時は1通りしか無いため
        long long res = (n - 1)*(n - 1) % MOD;
        long long lb = i - n - 1, ub = i - 3;
        if (ub <= 0) {
            res = (res + (n-1)) % MOD;
        }
        else {
            res = (res - lb+1 + dp2_accum[ub] + dp1_accum[ub]) % MOD;
        }
        dp2[i] = res;


        dp2_accum[i] = (dp2_accum[i - 1] + dp2[i]) % MOD;
    }
    cout << (dp1[n] + dp2[n]) % MOD << endl;

    return 0;
}

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

using namespace std;

using int64 = long long;

// Verified: AOJ-DSL2A, AOJ-DSL2B
template <typename T>
class SegmentTree {
 private:
  function<T(T, T)> merge;
  T empty_value;
  vector<T> nodes;
  int num_nodes;

  // Returns the fold of overwrap between [node_l, node_r) and [l, r).
  // nodes[node_index] needs to correspond to [node_l, node_r).
  T GetRangeInternal(int node_index, int node_l, int node_r, int l, int r) {
    if (node_r <= l || r <= node_l) return empty_value;
    if (l <= node_l && node_r <= r) return nodes[node_index];
    int node_m = (node_l + node_r) / 2;
    return merge(
        GetRangeInternal(2 * node_index, node_l, node_m, l, r),
        GetRangeInternal(2 * node_index + 1, node_m, node_r, l, r));
  }

 public:
  // Arguments:
  // in_merge: The function to merge two values. It should be a monoid.
  // in_empty_value: The identity of the monoid.
  // xs: The initial values.
  SegmentTree(
      function<T(T, T)> in_merge, T in_empty_value, const vector<T>& xs) :
          merge(in_merge), empty_value(in_empty_value) {
    int n = xs.size();
    num_nodes = 1;
    while (num_nodes < n) num_nodes *= 2;
    num_nodes *= 2;
    nodes = vector<T>(num_nodes, empty_value);
    for (int i = 0; i < xs.size(); ++i) {
      nodes[num_nodes / 2 + i] = xs[i];
    }
    for (int i = num_nodes / 2 - 1; i >= 1; i--) {
      nodes[i] = merge(nodes[2 * i], nodes[2 * i + 1]);
    }
  }

  // Updates the i-th element to x.
  void Update(int i, T x) {
    nodes[num_nodes / 2 + i] = x;
    for (int cur = (num_nodes / 2 + i) / 2; cur > 0; cur /= 2) {
      nodes[cur] = merge(nodes[2 * cur], nodes[2 * cur + 1]);
    }
  }

  // Returns the fold of the range [l, r) by the merge function.
  T GetRange(int l, int r) {
    return GetRangeInternal(1, 0, num_nodes / 2, l, r);
  }

  T Get(int i) {
    return nodes[num_nodes / 2 + i];
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<int> xs(n, 0);

  auto sum_function =
      function<int(int, int)>([] (int x, int y) { return x + y; });
  SegmentTree<int> tree(sum_function, 0, xs);
  for (int i = 0; i < q; i++) {
    int c, v1, v2;
    cin >> c >> v1 >> v2;
    if (c == 0) {
      v1--;
      tree.Update(v1, tree.Get(v1) + v2);
    } else {
      v1--;
      v2--;
      cout << tree.GetRange(v1, v2 + 1) << endl;
    }
  }
}


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

int main() {
    int n,t;
    cin>>n>>t;
    vector<int> a;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        if(y<=t) a.push_back(x);
    }
    sort(a.begin(),a.end());
    if(a.size())
    {
        cout<<a[0];
    }
    else
    {
        cout<<"TLE";
    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;

struct Dize{
    int sf1;
    int sf2;
    int sf3;
    int sf4;
    int sf5;
    int sf6;
};

void change(char ch,Dize& dz){
    int tmp=0;
    switch (ch) {
        case 'N':
            tmp=dz.sf1;
            dz.sf1=dz.sf2;
            dz.sf2=dz.sf6;
            dz.sf6=dz.sf5;
            dz.sf5=tmp;
            tmp=0;
            break;
        case 'E':
            tmp=dz.sf1;
            dz.sf1=dz.sf4;
            dz.sf4=dz.sf6;
            dz.sf6=dz.sf3;
            dz.sf3=tmp;
            tmp=0;
            break;
        case 'S':
            tmp=dz.sf1;
            dz.sf1=dz.sf5;
            dz.sf5=dz.sf6;
            dz.sf6=dz.sf2;
            dz.sf2=tmp;
            break;
        case 'W':
            tmp=dz.sf1;
            dz.sf1=dz.sf3;
            dz.sf3=dz.sf6;
            dz.sf6=dz.sf4;
            dz.sf4=tmp;
            break;
        default:
            break;
    }
}

int main(){
    
    Dize dz;
 
    
    cin>>dz.sf1>>dz.sf2>>dz.sf3>>dz.sf4>>dz.sf5>>dz.sf6;
    
    string str;
    cin>>str;
    
    for(int i=0;i!=str.size();++i){
        change(str[i],dz);
        
    }
    std::cout<<dz.sf1<<endl;
    
}



Measured memory_bytes: 3156
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  N = readline() |> parseInt
  W = readline() |> split |> parseArray

  minimum(1:N) do i
    abs(sum(W[1:i]) - sum(W[i+1:end]))
  end |> println
end

main()


Measured memory_bytes: 168744
#include <iostream>

int main() {
    int n;
    char moji[90];
    bool shingi = true;
    std::cin >> n;
    std::cin >> moji;
    if (n % 2 == 0) {
        for (int i = 0; i < n / 2; i++) {
            if(moji[i] != moji[i + n / 2]) {
                shingi = false;
                break;
            }
        }
    }
    else shingi = false;
    if (shingi)
        std::cout << "Yes";
    else
        std::cout << "No";
    
    return 0;    
}

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

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
// constexpr ll mod = 1e9 + 7;

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

    long double l = 2*sqrt(a*b);

    if(4*a*b < (c-a-b)*(c-a-b) && (c-a-b)>0 ) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
        return 0;
    }


    return 0;
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    int n;
    cin >> n;

    map<string, int> cnt;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        ++cnt[s];
    }

    for (string s : {"AC", "WA", "TLE", "RE"}) {
        cout << s << " x " << cnt[s] << newl;
    }

    return 0;
}

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

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

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

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

    static std::string divide[] = {
        "dream",
        "dreamer",
        "erase",
        "eraser"
    };

    std::reverse(s.begin(), s.end());

    for (auto& d : divide) {
        std::reverse(d.begin(), d.end());
    }

    bool result = true;

    for (int i = 0; i < s.size();) {
        bool can_divide = false;
        for (int n = 0; n < 4; n++) {
            const auto d = divide[n];
            if (s.substr(i, d.size()) == d) {
                can_divide = true;
                i += d.size();
            }
        }
        if (!can_divide) {
            result = false;
            break;
        }
    }

    if (result) {
        std::cout << "YES" << std::endl;
    }
    else {
        std::cout << "NO" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 760
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int main()
{
  ll n, k;
  cin >> n >> k;
  
  vector<ll> vec(n);
  for (ll i = 0; i < n; i++) {
    cin >> vec[i];
  }
  
  ll len = 0;
  for (ll i = 1; i <= k; i*=2) {
    len++;
  }
  
  ll x = 0;
  for (ll i = len - 1; i >= 0; i--) {
    ll one = 0, zero = 0;
    for (ll j = 0; j < n; j++) {
      if ((vec[j] >> i) & 1) {
        one++;
      } else {
        zero++;
      }
    }
    if (zero > one && (x | (1LL << i)) <= k) {
      x |= (1LL << i);
    }
  }
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ans += vec[i] ^ x;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int a[100005];

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

    int n, k;
    cin >> n >> k;

    int sum = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (a[i] >= k) {
            sum++;
        }
    }
    cout << sum;
    return 0;
}



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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(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)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF   = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)

bool isok(int x, int A, int B)
{
    return int(floor(double(x) * 0.08)) == A and (int(floor(double(x) * 0.10)) == B);
}

void solve()
{
    int A, B;
    cin >> A >> B;
    REP1 (i, 10000)
    {
        if (isok(i, A, B))
        {
            cout << i << endl;
            return;
        }
    }
    cout << -1 << endl;
    return;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n>>s;
    int l=0,r=0;
    for(int i=1;i<n;i++){
        if(s[i]=='W') r++;
    }
    int ans=n-r-1;
    for(int i=1;i<n;i++){
        if(s[i-1]=='E')  l++;
        if(s[i]=='W') r--;
        ans=min(ans,n-l-r-1);
    }
    cout<<ans<<endl;
} 

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

ll a,b;

ll gcd(ll x,ll y){return y ? gcd(y,x%y) : x;}

vector<pair<ll, int>> factorize(ll n){
    vector<pair<ll,int>> res;
    for(ll i=2;i*i<=n;i++){
        if(n%i) continue;
        res.push_back(make_pair(i,0));
        while(n%i==0){
            n/=i;
            res.back().second++;
        }
    }
    if(n!=1)res.push_back(make_pair(n,1));
    return res;
}
int main(void){
    cin>>a>>b;
    if(a>b){
        ll x = a;
        a=b;
        b=x;
    }
    ll g = gcd(a,b);
    auto f = factorize(g);
    cout<<f.size()+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
    tree_order_statistics_node_update> ost;

const int N=2000;
const int R=2000001;
int a[N];
bitset<R> x, y;

int main() {
    int i, s, n;
    scanf("%d", &n);
    for(s=i=0; i<n; i++) {
        scanf("%d", &a[i]);
        s+=a[i];
    }
    x|=1;
    for(i=0; i<n; i++) {
        y=x<<a[i];
        x|=y;
    }
    for(i=s/2; !x.test(i); i--);
    printf("%d\n", s-i);
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b,aa=0,bb=0,x,y;
    cin>>a>>b;
    char n[101][101]={0};
    for(int i=1;i<=a;i++)
        for(int j=1;j<=b;j++)
            cin>>n[i][j];
    for(int i=1;i<=a;i++)
    {
        for(int j=1;j<=b;j++) 
        {
            int s=0;
            if(n[i][j]=='#') cout<<'#';
            else 
            {
               if(n[i+1][j-1]=='#') s++;
               if(n[i+1][j]=='#') s++;
               if(n[i+1][j+1]=='#') s++;
               if(n[i][j-1]=='#') s++;
               if(n[i][j+1]=='#') s++;
               if(n[i-1][j-1]=='#') s++;
               if(n[i-1][j]=='#') s++;
               if(n[i-1][j+1]=='#') s++;
               cout<<s;
           }
        }
         cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(stdR.readLine());
        System.out.println(3* N * N);
    }
}


Measured memory_bytes: 21332
#include <math.h>
#include <stdio.h>

int main() {
  int MOD = 1000000000 + 7;
  int n;
  scanf("%ld", &n);
  long b[60] = {0};
  for (int i = 0; i < n; i++) {
    unsigned long a;
    scanf("%lu", &a);
    for (int j = 0; a > 0; j++) {
      b[j] += a % 2;
      a /= 2;
    }
  }

  unsigned long sum = 0;
  for (int j = 0; j < 60; j++) {
    unsigned long c = (long)pow((double)2, (double)j);
    c %= MOD;
    sum += ((b[j] * ((n - b[j])) % MOD) * c) % MOD;
    sum %= MOD;
  }

  printf("%d\n", (int)sum);
  return 0;
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    
    if((b - a) == (c - b)) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int s, w;
    cin >> s >> w;

    if (s <= w) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}


Measured memory_bytes: 3632
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split())) for _ in range(q)]
ans,now=0,0
def chk(x):
    global ans
    if len(x)>=n+1:
        now=0
        for a,b,c,d in abcd:
            if x[b-1]-x[a-1]==c:
                now+=d
        ans=max(ans,now)
        return
    for i in range(x[-1],m+1):
        chk(x+[i])
chk([1])
print(ans)

Measured memory_bytes: 9136
import heapq

a = []
a = input().split()
N = int(a[0])
M = int(a[1])
A = input().split()
A = [int(n) for n in A]

for i in range(N) :
  A[i] = -A[i]

heapq.heapify(A)

for i in range(M) :
  c = heapq.heappop(A)
  heapq.heappush(A, (c+1) // 2)

print(-sum(A))

Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define ll long long
using namespace std; 
const int N=100;
int a[N],b[N],c[N],d[N];
int A[N],n,m,q,ans=0;
void dfs(int id,int num)
{
	if(id==n+1)
	{
		int sum=0;
		for(int i=1;i<=q;i++)
		{
			if(A[b[i]]-A[a[i]]==c[i])
				sum+=d[i];
		}
		ans=max(ans,sum);
		return;
	}
	for(int i=num;i<=m;i++)
	{
		A[id]=i;
		dfs(id+1,i);
	}
}
int main()
{
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++)
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs(1,1);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3736
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  vector<ll> A(3);
  for(int i=0;i<3;++i) cin>>A[i];
  sort(A.begin(), A.end());
  int K;
  cin>>K;
  for(int i=0;i<K;++i) {
    A[2] *= 2;
  }
  cout<<A[0]+A[1]+A[2]<<endl;
}



Measured memory_bytes: 3584
#include <stdio.h>

int main() {
  int a,b;
  scanf("%d", &a);
  scanf("%d", &b);

  if(a + b == 15) {
    printf("+\n");
  } else if(a * b == 15) {
    printf("*\n");
  } else {
    printf("x\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
string s;
cin>>s;
s[3]='8';
ol(s);
return 0;
}



Measured memory_bytes: 256