akhauriyash/Code-Regression huggingface dataset:
n,m = gets.split(' ').map(&:to_i)
nums = gets.split(' ').map(&:to_i)
target = nums.max(m)
target.each do |t|
  if t < nums.inject(:+) * 1/(4*m).to_f
    puts 'No'
    exit
  end
end
puts 'Yes'

Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

string a, b;
int main() {
    while (cin >> a >> b) {
        reverse(a.begin(), a.end());
        if (a == b) puts("YES");
        else puts("NO");
    }
}





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

int main(){
    int H,N,a=0;
    cin>>H>>N;
    int A[N];
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        a+=A[i];
    }
    if(a>=H){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 640
S = input()

count = 0
black = 0 
white = 0
for i in list(S):
  if count % 2 == 0:
    black += 1 if i != '0' else 0
    white += 1 if i != '1' else 0
  else: 
    black += 1 if i != '1' else 0
    white += 1 if i != '0' else 0
  count += 1

print(min(black, white))


Measured memory_bytes: 3956
#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    ll n;
    cin>>n;
    n%1000 == 0 ? cout<<0<<endl : cout<<(1000 - n%1000)<<endl;
    return 0;
}

Measured memory_bytes: 3628
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

def main():
    N = int(input())
    presuf = [[0] * 10 for _ in range(10)]
    for i in range(1,N + 1):
        pre = int(str(i)[0])
        suf = i%10
        presuf[pre][suf] += 1
    
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += presuf[i][j]*presuf[j][i]
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()

int main(){
  string s,t;
  cin>>s>>t;
  sort(all(s));
  sort(all(t));
  reverse(all(t));
  cout<<(s<t?"Yes":"No")<<endl;
}

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

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

    
    for(int i=1;i<n-1;i++){
        a.at(i)=min(b.at(i),b.at(i-1));
        ans+=a.at(i);
        
    }
    a.at(n-1)=b.at(n-2);
    ans+=a.at(n-1);
   
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.range;
import std.array;
import std.algorithm;
import std.typecons;

void main(){
    auto hw = readln().chomp().split().map!(to!int).array();
    string[] grids;
    foreach(i; 0..(hw[0])){
        grids ~= readln().chomp();
    }
    solve(grids).writeln();
}

string solve(string[] grids){
    bool result = true;
    
    foreach(int y; 0..cast(int) grids.length){
        foreach(int x; 0..cast(int) grids[y].length){
            if(!check(x, y, grids)){
                result = false;
                break;
            }
        }
        if(!result){
            break;
        }
    }
    
    if(result){
        return "Yes";
    }else{
        return "No";
    }
}

bool check(int x, int y, string[] grids){
    bool result;
    if(grids[y][x] == '#'){
        if(x - 1 >= 0){
            if(grids[y][x-1] == '#'){
                result = true;
            }
        }
        if(y - 1 >= 0){
            if(grids[y - 1][x] == '#'){
                result = true;
            }
        }
        if(x + 1 < grids[y].length){
            if(grids[y][x+1] == '#'){
                result = true;
            }
        }
        if(y + 1 < grids.length){
            if(grids[y+1][x] == '#'){
                result = true;
            }
        }
    }else{
        result = true;
    }
    
    return result;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;

int n;
ll ans, sum;

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int main() {
    ll x, y;
    read(n);
    while (n--) read(x), read(y), ans += y, sum += x * y;
    while (sum >= 10) ans += sum / 10, sum = sum / 10 + sum % 10;
    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 384
def judge(bit): #選び方をひとつ固定
  ok = True
  for i in range(n):
    if ((bit >> i) & 1) == 1: #正直者なら確かめる
      for j in range(len(li[i])):
        x = li[i][j][0]
        y = li[i][j][1]
        if y == 1 and ((bit >> (x-1)) & 1) == 0:
          ok = False
        if y == 0 and ((bit >> (x-1)) & 1) == 1:
          ok = False
  return ok
n = int(input())
li = []
ans = 0
for i in range(n):
  a = int(input())
  xy =  [list(map(int, input().split())) for _ in range(a)]
  li.append(xy)
for bit in range(1<<n):
  if judge(bit):
    cnt = 0
    for i in range(n):
      if ((bit >> i) & 1) == True:
        cnt += 1
    ans = max(ans,cnt)
print(ans)

Measured memory_bytes: 3064
a, b, c, d = map(int, input().split())

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        return gcd(y, x%y)

def muri(n):
    return n - n//c - n//d + n//(c*d//gcd(c, d))

print(muri(b)-muri(a-1))

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d){
        cout << "Left" << endl;
    }else if(a+b < c+d){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main() {

	int x, y;
	cin >> x >> y;

	int r = 0;
	int a = 1;

	if (y == 1) {
		cout << r << '\n';
		return 0;
	}
	if (y <= x) {
		r++;
	} else {
		while (a < y) {
			a += x - 1;
			r++;
		}
	}

	cout << r << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt");
    if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a, b; cin >> a >> b;
    rep(i, 3){
        ll now = i+1;
        if(now == a || now == b) continue;
        cout << now << endstr;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

const int MAX_N = 110;
const int MAX_V = 100100;

// 入力
int N;
long long W, weight[MAX_N], value[MAX_N]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[MAX_N][MAX_V];

int main() {
	cin >> N >> W;
	for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

	// 初期化
	for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;

	// 初期条件
	dp[0][0] = 0;

	// DPループ
	for (int i = 0; i < N; ++i) {
		for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {

			// i 番目の品物を選ぶ場合
			if (sum_v - value[i] >= 0) chmin(dp[i + 1][sum_v], dp[i][sum_v - value[i]] + weight[i]);

			// i 番目の品物を選ばない場合
			chmin(dp[i + 1][sum_v], dp[i][sum_v]);
		}
	}

	// 最適値の出力
	long long res = 0;
	for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
		if (dp[N][sum_v] <= W) res = sum_v;
	}
	cout << res << endl;
}

Measured memory_bytes: 86272
#include <stdio.h>
#define A 100

main(){
  int c,i,n,flag=1,count=0;
  int b[A];

  scanf("%d",&n);

  for(i=0;i<n;i++)scanf("%d",&b[i]);

  while(flag){
    flag=0;
    for(i=n-1;i>0;i--)
      if(b[i]<b[i-1]){
	c = b[i-1];
	b[i-1] = b[i];
	b[i] = c;
	count++;
	flag=1;
      }
  }

  for(i=0;i<n;i++){
    printf("%d",b[i]);
    if(i != n-1)printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 604
using System;
using System.IO;
using System.Collections.Generic;

namespace ABC086C_1
{
    public class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var ans = true;

            for (var i = 0; i < N; i++)
            {
                var t = ss.Next(int.Parse);
                var x = ss.Next(int.Parse);
                var y = ss.Next(int.Parse);
                ans &= t >= x + y && (t - x - y) % 2 == 0;
            }

            sw.WriteLine(ans ? "Yes" : "No");
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }

    public class StreamScanner
    {
        static readonly char[] Sep = {' '};
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }
    }
}


Measured memory_bytes: 15312
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

ll dfs(ll H, ll cnt) {
	if (H == 0) return 0;
	ll res = cnt + dfs(H / 2, cnt * 2);
	return res;
}

int main() {
	ll H;
	cin >> H;
	cout << dfs(H, 1) << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  // 今までの最小値の個数
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  int mi = 1e6;
  int ans = 0;  
  rep(i, N) {
    if (A[i] < mi) {
      mi = A[i];
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
ll mo=998244353;

ll combi(ll N_, ll C_) {
	const int NUM_=1400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll catalan_arrange(int X,int Y,int T) {
	return (combi(X+Y,Y)-combi(X+Y,Y-T)+mo)%mo;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	
	ll ret=0;
	for(int R=N;R<=K;R++) {
		int B=K-R;
		if(R==B) {
			ret+=catalan_arrange(R,B-1,(R-N+1));
		}
		if(R>B) {
			ret+=catalan_arrange(R,B,(R-N+1));
		}
	}
	
	cout<<ret%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=1<<31-1=2147483647
constexpr ll INF = (ll)1e18;//1<<63-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/


signed main() {
	ll N;
	cin>>N;
	vector<ll> a(N,0);
	rep(i,N)cin>>a[i];

	ll ans=0;
	ll sum=0;
	ll right = 0;     
	for (ll left = 0; left < N; ++left) {
	    while (right < N && (sum+a[right])==(sum^a[right])) {
			/* 実際に right を 1 進める */
			sum += a[right];
			++right;
		}

		/* break した状態で right は条件を満たす最大なので、何かする */
		ans+=right-left;

		/* left をインクリメントする準備 */
		if (right == left) ++right;
		else sum -= a[left];
	}


	p(ans);
	return 0;
}


Measured memory_bytes: 1792
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
A = int(input())
if N%500 <= A:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 4588
def gcd(a, b):
	k = 0
	while b != 0:
		r = a % b
		a, b = b, r
		k += 1
	return [a, k]

while True:
	x, y = list(map(int, input().split()))
	if x == 0: break
	if x < y: x, y = y, x
	ans = gcd(x, y)
	print(*ans)


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

int main(){
    int n;
    cin>>n;
    vector<long long> A(n);
    for(int i=0; i<n; ++i) cin>>A[i];
    long long current=1000;

    for(int i=1; i<n; ++i){

        long long stocks=0;

        if(A[i-1]<A[i]) stocks = current/A[i-1];
        current += (A[i]-A[i-1])*stocks;
        //cout<<current<<"\n";
    }
    cout<<current<<"\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll A,B;
  cin>>A>>B;
  if(B%A==0) {
cout<<A+B<<endl;
  }
  else {
cout<<B-A<<endl;
  }
}

Measured memory_bytes: 3612
#include<iostream>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string n;
    cin >> n;
    int m = 0;
    for(int i = 0; i < n.size(); i++){
        m += n[i]-'0';
    }
    if(m%9==0) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

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

typedef long long ll;

priority_queue<ll> PQL, PQR;
ll pbl, pbr;
ll Ans;
 
int main()
{
	int n;
	cin >> n;

	ll l, r, len;
	for (int i = 0;i < n;i++)
	{
		cin >> l >> r;
		len = r - l;

		pbr += len;
		PQL.push(r - pbl);
		PQR.push(pbr - r);
		while (true) {
			ll L = PQL.top() + pbl;
			ll R = -PQR.top() + pbr;
			if (L <= R)
			{
				break;
			}
			Ans += L - R;
			PQL.pop(), PQR.pop();
			PQL.push(R - pbl), PQR.push(pbr - L);
		}
		pbl -= len;
	}
	
	cout << Ans << endl;
	return 0;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin>>s;
int n = s.size();
bool ok=false;

reps(i,n,1){
    rep(j,n-i){
        string s1=s.substr(0,i);
        string s2=s.substr(i+j,n-i+j);
        if(s1+s2=="keyence"){
            ok=true;
        }
    }
}
if(ok){
    cout<<"YES"<<endl;
}
else{
    cout<<"NO"<<endl;
}
return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<ll> A(N), B(N);
        rep(i, N) cin >> A[i] >> B[i];
        vector<int> ia(N), ib(N);
        rep(i, N) {
            ia[i] = i;
            ib[i] = i;
        }

        sort(all(ia), [&] (int i, int j) {
                return A[i] + B[i] > A[j] + B[j];
                // return A[i] - B[i] > A[j] - B[j];
            });

        sort(all(ib), [&] (int i, int j) {
                return A[i] + B[i] > A[j] + B[j];
                //return B[i] - A[i] > B[j] - A[j];
            });
        // cerr << ia << endl;
        //cerr << ib << endl;

        vector<int> used(N, 0);
        ll suma = 0, sumb = 0;
        auto a = begin(ia), b = begin(ib);
        rep(i, N) {
            if(i % 2 == 0) {
                while(used[*a]) a++;
                suma += A[*a];
                used[*a] = true;
                a++;
            } else {
                while(used[*b]) b++;
                sumb += B[*b];
                used[*b] = true;
                b++;
            }
        }
        // cerr << suma << " " << sumb << endl;
        cout << suma - sumb << endl;
        return 0;
    }
};

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


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll =long long int;
constexpr ll mod = 1e12;
int main()
{
	int n; cin >> n;
	if (n % 10 == 2 || n % 10 == 4 || n % 10 == 7 || n % 10 == 9 || n % 10 == 5)puts("hon");
	else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)puts("pon");
	else puts("bon");
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(void){
    double x1,y1,x2,y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    double d=pow(x1-x2,2)+pow(y1-y2,2);
    cout << fixed << setprecision(5) << sqrt(d);
    cout << d <<endl;
}


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

typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define endl <<endl
#define INF 100000000000000

int main()
{
	string S;
	in S;
	if (S == "SUN")
	{
		out 7 endl;
	}
	else if (S == "MON")
	{
		out 6 endl;
	}
	else if (S == "TUE")
	{
		out 5 endl;
	}
	else if (S == "WED")
	{
		out 4 endl;
	}
	else if (S == "THU")
	{
		out 3 endl;
	}
	else if (S == "FRI")
	{
		out 2 endl;
	}
	else
	{
		out 1 endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  int n;cin >> n;
  vector<ll> v(5,0);
  for(int i=0;i<n;++i){
    string s,sub;cin >> s;
    sub = s.substr(0,1);
    if (sub == "M") {
      v[0] +=1;
    } else if(sub == "A") {
      v[1] +=1;
    } else if(sub == "R") {
      v[2] +=1;
    } else if(sub == "C") {
      v[3] +=1;
    }else if(sub == "H") {
      v[4] +=1;
    }
  }
  vector<vector<int>> comb{{0,1,2},{0,1,3},{0,1,4},{0,2,3},{0,2,4},{0,3,4},{1,2,3},{1,2,4},{1,3,4},{2,3,4}};
  ll cnt =0;
  for(int j=0; j<comb.size();++j){
    cnt += v[comb[j][0]]*v[comb[j][1]]*v[comb[j][2]];
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = a.copy()
count = 1
d = 1
while k >= d:
    count += 1
    d *= 2
else:
    count -= 1
    d //= 2
anst = 0
for i in range(count):
    level = 0
    for j in range(n):
        tmpb = b[j] // d
        if tmpb >= 1 and tmpb % 2 == 1:
            level += 1
        b[j] %= d
    if k >= anst + d and n > level * 2:
        anst += d
    d //= 2

ans = 0
for i in range(n):
    ans += a[i] ^ anst
print(ans)

Measured memory_bytes: 15144
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int p[] = new int[n];
        int q[] = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            q[p[i] - 1] = i + 1;
        }

        int max = 0;
        int cnt = 0;
        for (int i = 0; i < n - 1; i++) {
            cnt++;
            if (q[i] > q[i + 1]) {
                max = Math.max(max, cnt);
                cnt = 0;
            }
        }
        max = Math.max(max, cnt + 1);

        System.out.println(n - max);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 85796
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)
const int INF = 1001001001;

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	string ans = "No";
	//sをi回回転して得られる文字列nowがtに一致するか調べる
	rep(i, n) {
		//nowにsの末尾i文字を追加する
		string now = s.substr(n-i, i);
		//nowにsの頭n-i文字を追加する
		rep(j, n - i) now += s[j];
		//nowがtと一致しているか判定する
		if (now == t) {
			ans = "Yes";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(setq *n* (read))
(setq *ai* (mapcar #'parse-integer (split " " (read-line))))
(setq *bi* (mapcar #'parse-integer (split " " (read-line))))
(setq *ci* (make-array (1- *n*) :initial-contents (mapcar #'parse-integer (split " " (read-line)))))

(defun calc-bonus (ai)
  (if (equal (cadr ai) nil)
    0
    (+ (calc-bonus (cdr ai)) (if (= 1 (- (cadr ai) (car ai))) (aref *ci* (1- (car ai))) 0))))

(print (+ (reduce #'+ *bi*) (calc-bonus *ai*)))

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

int main(){
  double N;
  cin >> N;
  
  int ans = N * 100 / 108;
  while (ans <= N){
    if (ans * 108 / 100 == N){
      cout << ans << endl;
      exit(0);
    }
    ans++;
  }
  
  cout << ":(" << endl;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define maxn 10000
#define int long long
using namespace std;
template<class T>
inline void read(T &a){
    T s = 0, w = 1;
    char c = getchar();
    while(c < '0' || c > '9') {if(c == '-') w = -1; c = getchar();}
    while(c >= '0' && c <= '9'){s = (s << 1) + (s << 3) + (c ^ 48); c = getchar();}
    a = s*w;
}
int n;
int h,w;
int a[maxn], b[maxn], ans;
signed main(){
    read(n);  read(h); read(w);
    for (int i = 1; i <= n; i++){
        int x, y;
        read(x); read(y);
        if(x >= h && y >= w) ans++;
    }
    cout<<ans;
    return 0;
}

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

int main(){

    int n;
    cin>>n;

    vector<int> height(n,0);

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

    vector<int> dp(n,0);
    dp[0] = 0;
    dp[1] = abs(height[1]-height[0]);

    for(int i=2;i<n;i++){
        dp[i] = min(dp[i-1]+abs(height[i]-height[i-1]),dp[i-2]+abs(height[i]-height[i-2]));
    }

    cout<<dp[n-1]<<endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<int> c(8);
    int u = 0;
    int r;
    REP(i, n) {
        cin >> r;
        if (r >= 3200) u++;
        else c[r / 400]++;
    }
    int mn = 0;
    REP(i, 8) if (c[i] != 0) mn++;
    cout << max(1, mn) << " " << mn + u << EOL;
}


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

    if(A+B>24)
        cout<<(A+B)-24<<endl;

    else if(A+B<24)
        cout<<A+B<<endl;
        else if(A+B==24)
            cout<<0<<endl;




    return 0;

}



Measured memory_bytes: 256
#!/usr/bin/env python3
import numpy as np


# 参考書の組が理解度を充足しているか
def ok(X, A):
    pass


def solve(N, M, X, C, A):
    answer = float("inf")
    for ptn in range(1, 2 ** len(C)):
        buy = [ptn & 2 ** i == 2 ** i for i in range(len(C))]
        if (A[buy].sum(axis=0).min() >= X) and (
            C[buy].sum() < answer
        ):
            answer = C[buy].sum()

    if answer == float("inf"):
        return -1

    return answer


def main():
    N, M, X = map(int, input().split())
    C = [None for _ in range(N)]
    A = [None for _ in range(N)]
    for i in range(N):
        C[i], *A[i] = map(int, input().split())
    C = np.array(C, dtype=np.uint32)
    A = np.array(A, dtype=np.uint32)
    answer = solve(N, M, X, C, A)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27348
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef tuple<int, int, int> ti3;

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    printf((a % 2 == 1 && b % 2 == 1) ? "Yes\n" : "No\n");

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;


namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {

                string[] s = Console.ReadLine().Split(' ');

                int h = int.Parse(s[0]);
                int w = int.Parse(s[1]);
                if (w == 0 && h == 0)
                    break;

                int n;
                int x;
               

                for (n = 0; n < h; n++)
                {
                    for (x = 0; x < w; x++)
                    {
                        if (n == 0 || n == h-1 ||  x== 0 || x == w-1)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.Write("\n");
                }
                Console.Write("\n");

            }



        }
    }
}

Measured memory_bytes: 5296
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    ll x,y;
    in(x,y);
    ll ans=0;
    if(y==0){
        if(x>0){
            ans=x+1;
        }else{
            ans=-x;
        }
    }else if(abs(y)>=abs(x)){
        if(x>=0&&y>=0)ans=y-x;
        if(x<0&&y>=0)ans=y+x+1;
        if(x>=0&&y<0)ans=-y-x+1;
        if(x<0&&y<0)ans=-y+x+2;
        if(x==0&&y>0)ans=y;
        if(x==0&&y<0)ans=-y+1;
    }else{
        ans=abs(x)-abs(y);
        if(x>=0&&y>=0)ans+=2;
        if(x<0&&y>=0)ans+=1;
        if(x>=0&&y<0)ans+=1;
    }
    out(ans);
}

Measured memory_bytes: 3832
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,biggest=0;
    cin>>a>>b>>c;
    if (a > biggest)
    {
        biggest=a;
    }
    if (b > biggest)
       {
           biggest=b;
       }
    if (c > biggest)
       {
           biggest=c;
       }
    cout<<a+b+c-biggest;
    return 0;
}

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

int main()
{
	int n, m, l;
	long long A[100][100];
	long long B[100][100];
	long long C[100][100];

	cin >> n >> m >> l;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) cin >> A[i][j];
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) cin >> B[i][j];
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			C[i][j] = 0;
			for (int k = 0; k < m; k++) {
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			if (j) cout << " ";//j=0????????\?????????????????????
			cout << C[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3316
import java.util.*;
public class Main{
	public static void main(String[] args){
		long ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextLong();
		
		long[] all = new long[n+1];
		long n2 = 2;
		for(int i=0; i<=n; i++){
			n2 *= 2;
			all[i] = n2 - 3;
		}
		
		long[] patty = new long[n+1];
		long start = 0;
		for(int i=0; i<=n; i++){
			start = start*2+1;
			patty[i] = start;
		}
		
		long middle = 2;
		for(int i=0; i<n; i++){
			middle *= 2;
		}
		if(x >= middle-1){
			ans = patty[n] - getpnum(n, all[n] - x, all, patty);
		}
		else{
			ans = getpnum(n, x, all, patty);
		}
		
		System.out.println(ans);
	}
	
	static long getpnum(int n, long x, long[] all, long[] patty){
		int med = n;
		int m = 0;
		long ans = 0;
		while(med+all[m] <= x){
			ans = patty[m];
			med--;
			m++;
		}
		if(ans == 0){
			return 0;
		}
		long q = x - (med+1) - all[m-1];
		if(q > 0){
			ans++;
			ans += getpnum(m, q, all, patty);
		}
		
		return ans;
	}
}

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

int main() {
	int x, a;
	cin >> x >> a;
	
	if (x < a) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
found = False
total = 0
for x in range(N + 1):
    for y in range(N + 1 - x):
        total = 10000 * x + 5000 * y + 1000 * (N - x - y)
        if total == Y:
            found = True
            break
    else:
        continue
    break

if found:
    print('{} {} {}'.format(x, y, N-x-y))
else:
    print('-1 -1 -1')

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}




int main(){
  long N,K;
  cin>>N>>K;
  long h[N];
  for(int i=0;i<N;i++){
    cin>>h[i];
  }
  sort(h,h+N);
  long sum=8000000000;
  for(int i=0;i<N-K+1;i++){
    long tmp=h[i+K-1]-h[i];
    if(tmp<sum){
      sum=tmp;
    }


  }
  cout<<sum<<endl;






  

  



}


  
  


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    int H,W;
    cin >> H >> W;
    char a[H][W];
    rep(i,H){
        rep(j,W) cin >> a[i][j];
    }
    rep(i,H){
        bool white=true;
        rep(j,W) if(a[i][j] == '#') white=false;
        if(white){
            rep(j,W){
                for(int k=i;k<H-1;k++) a[k][j] = a[k+1][j];
            }
            i--;
            H--;
        }
    }
    rep(j,W){
        bool white=true;
        rep(i,H) if(a[i][j] == '#') white=false;
        if(white){
            rep(i,H){
                for(int k=j;k<W-1;k++) a[i][k] = a[i][k+1];
            }
            j--;
            W--;
        }
    }
    rep(i,H){
        rep(j,W) cout << a[i][j];
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),a.end()
using namespace std;

int main()
{
	string a, b,fu;
	double num,dnum;
	int inum;
	cin >> a >> b;
	fu = a + b;
	num = atoi(fu.c_str());
	num = sqrt(num);
	inum = num;
	dnum = inum;
	if (dnum == num)cout << "Yes" << endl;
	else cout << "No" << endl;
}



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

long long a[100100],sum[100100];
long long qs[100100],qs2[100100],sum2[100100];

main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1];
		if(a[i]>0)sum[i]+=a[i];
		qs[i]=a[i];
		qs[i]+=qs[i-1];
	}
	for(int i=n;i>=1;i--)
	{
		sum2[i]=sum2[i+1];
		if(a[i]>0)sum2[i]+=a[i];
		qs2[i]=a[i];
		qs2[i]+=qs2[i+1];
	}
	long long ans=0;
	for(int i=k;i<=n;i++)
	{
		//printf("[%lld %lld %lld %lld]\n",sum[i-k+1],qs[i],qs[i-k+1],sum2[i+1]);
		//printf("{%d %d %d %d}\n",i-k,i,i-k,i);
		ans=max(ans,sum[i-k]+max(qs[i]-qs[i-k],(long long)0)+sum2[i+1]);
	}
	//printf("\n");
	/*
	for(int i=1;i+k<=n;i++)
	{
		//printf("[%lld %lld %lld %d]\n",sum2[i+k-1],qs2[i+k-1],qs2[i],i);
		//printf("{%d %d %d %d}\n",i+k,i+k,i,i);
		ans=max(ans,sum2[i+k]-qs2[i+k]+qs2[i]);
	}*/
	printf("%lld",ans);
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define bg begin
namespace IO{
	cs int RLEN=1<<20|1;
	char ibuf[RLEN],*ib,*ob;
	inline char gc(){
		(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
		return (ib==ob)?EOF:*ib++;
	}
	inline int read(){
		char ch=gc();
		int res=0;bool f=1;
		while(!isdigit(ch))f^=ch=='-',ch=gc();
		while(isdigit(ch))res=(res*10)+(ch^48),ch=gc();
		return f?res:-res;
	}
	inline void readstring(char *s){
		char ch=gc();int top=0;
		while(isspace(ch))ch=gc();
		while(!isspace(ch)&&ch!=EOF)s[top++]=ch,ch=gc();
	}
}using IO::read;
using IO::readstring;
template<typename tp>inline void chemx(tp &a,tp b){(a<b)?(a=b):0;}
template<typename tp>inline void chemn(tp &a,tp b){(a>b)?(a=b):0;}
cs int N=21,M=(1<<N)|5;
int lg[M],f[N][M],tr[M][2];
int n,K,lim;
char str[M];
void writesp(int x){
	if(x>1)writesp(x>>1);
	else return;
	putchar('0'+(x&1));
}
int main(){
	#ifdef Stargazer
	freopen("lx.in","r",stdin);
	#endif
	n=read(),K=read(),lim=1<<n;
	for(int i=2;i<M;i++)lg[i]=lg[i>>1]+1;
	for(int i=0;i<=n;i++){
		readstring(str);
		for(int j=0;j<(1<<i);j++)f[i][(1<<i)^j]=(str[j]-'0');
	}
	for(int i=2;i<(lim<<1);i++){
		if((i>>(lg[i]-1))&1){
			tr[i][1]=i^(1<<lg[i]);
			tr[i][0]=tr[tr[i][1]][0];
		}else{
			tr[i][0]=i^(3<<(lg[i]-1));
			tr[i][1]=tr[tr[i][0]][1];
		}
	}
	for(int i=n;i;i--)
	for(int j=1<<i;j<(lim<<1);j++)if(f[i][j]){
		int p=j>>i,s=(j&((1<<i)-1))^(1<<i);
		if(tr[s][0])f[lg[tr[s][0]]][(((p<<1)+1)<<lg[tr[s][0]])^tr[s][0]]+=f[i][j];
		if(tr[s][1])f[lg[tr[s][1]]][(((p<<1)+0)<<lg[tr[s][1]])^tr[s][1]]+=f[i][j];
		f[0][p]+=f[i][j];
	}
	int mx=1;
	for(int i=2;i<(lim<<1);i++)if(f[0][i]>=K&&lg[i]>lg[mx])mx=i;
	writesp(mx);return 0;
}

Measured memory_bytes: 196864
#include<bits/stdc++.h>
using namespace std;
int main() {
  
  vector<string> Day ={"SAT","FRI","THU","WED","TUE","MON","SUN"};
  string S;
  cin>>S;
  
  for(int i=0;i<7;i++) {
    if(S==Day.at(i)) {
      cout<<i+1<<endl;
      break;
    }
  }
  return 0;
}


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

int main()
{

  int N;
  std::cin >> N;
  std::vector<int> A;
  std::vector<int> val;
  A.resize(N);
  val.resize(100);
  for(int i=0;i<N;++i)
  {
    std::cin >> A[i];
  }

  for(int q=0;q<100;++q)
  {
    int p = q + 1;
    for(int i=0;i<N;++i)
    {   
      val[q] += (A[i] - p) * (A[i] - p); 
    }   
  }

  std::vector<int>::iterator iter = std::min_element(val.begin(), val.end());
  size_t index = std::distance(val.begin(), iter);

  std::cout << val[index];
}

Measured memory_bytes: 256