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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    int x, t;
    cin >> x >> t;
    cout << max(0LL, x-t) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] a = new int[M];
		int[] b = new int[M];
		List<Integer> list = new ArrayList<Integer>();
		boolean possible = false;
		for(int i = 0; i < M; i++) {
			a[i] = scan.nextInt();
			b[i] = scan.nextInt();
			if(a[i] == 1) {
				list.add(b[i]);
			}
			if(b[i] == N) {
				list.add(a[i]);
			}
		}
		List<Integer> hashList = new ArrayList<Integer>(new LinkedHashSet<>(list));

		if(list.size() == hashList.size()) {
			possible = false;
		} else {
			possible = true;
		}
		System.out.println(possible ? "POSSIBLE" : "IMPOSSIBLE");
		scan.close();

	}

}


Measured memory_bytes: 109732
#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 100;
const int MOD = 1000000007;

void doc() {
    freopen("OB.inp","r",stdin);
    freopen("OB.out","w",stdout);
    ///cerr << "OK" << '\n';
}

void solve() {
    string s;
    cin >> s;
    int n = (int)s.length();
    int a[n + 1];
    a[0] = 0;
    long long sum = 0;
    vector<int> c;
    c.clear();
    if (s[0] == '<') c.push_back(0);
    for(int i = 1; i < n; i++){
        if (s[i] == '<' && s[i - 1] == '>') c.push_back(i);
    }
    if (s[n - 1] == '>') c.push_back(n);
    memset(a, 0, sizeof(a));

    for(int i = 0; i < (int)c.size(); i++){
        int k = c[i];
        a[k] = 0;
        int j = k - 1;
        while (j >= 0 && s[j] == '>'){
            a[j] = max(a[j], a[j + 1] + 1);
            j--;
        }

        j = k;
        while (j < n && s[j] == '<'){
            a[j + 1] = max(a[j + 1], a[j] + 1);
            j++;
        }
    }

//    for(int i = 0; i <= n; i++)
//        cout << a[i] << " ";
//    cout << '\n';

    for(int i = 0; i <= n; i++)
        sum += a[i];
    cout << sum;

}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
  //  doc();
    solve();
}


Measured memory_bytes: 3740
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            int[] data = cin.ReadIntArray(2);
            long n = data[0];
            int count = data[1];
            long[] hps = cin.ReadLongArray(n);
            Array.Sort(hps);
            Array.Reverse(hps);
            for(int i = 0;i < Math.Min(n, count); i++)
            {
                hps[i] = 0;
            }
            Console.WriteLine(hps.Sum());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 37376
import numpy as np
h,n=map(int,input().split())
ab=np.array([list(map(int,input().split())) for _ in range(n)])
dp=np.zeros(10**4+1,np.int64) #dp[i]:残り体力がiのとき、倒すまでの最小魔力
dp[0]=0
for a,b in ab:
      dp[1:a+1]=np.minimum(dp[1:a+1],b)
# a:減らせる体力
# b:魔力
for i in range(1,h+1):
  dp[i]=np.min(dp[i-ab[:,0]]+ab[:,1])
print(dp[h])


Measured memory_bytes: 14528
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static int buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]+'0');
}
inline void writeln(ll x){write(x); putchar('\n');}
inline void writesp(ll x){write(x); putchar(' ');}
int a[maxn],d[maxn];
int cur[maxn],ans[maxn];
int n,m;
ll k;
int mul(int* a,int* b,int n)
{
	static int t[maxn];
	for(int i=1;i<=n;i++)
		t[i]=a[b[i]];
	for(int i=1;i<=n;i++)
		a[i]=t[i];
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	int S=a[1];
	for(int i=1;i<n;i++)
		d[i]=a[i+1]-a[i];
	m=read(); k=read();
	for(int i=1;i<n;i++)
		cur[i]=ans[i]=i;
	for(int i=1;i<=m;i++){
		int x=read();
		std::swap(cur[x-1],cur[x]);
	}
	for(;k;k>>=1,mul(cur,cur,n-1))
		if(k&1)mul(ans,cur,n-1);
	ll X=a[1];
	for(int i=1;i<=n;i++){
		writeln(X);
		X+=d[ans[i]];
	}
	return 0;
}

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

#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define str string
#define vint vector<int>
#define vchar vector<char>
#define vool vector<bool>
#define pb() pushback
#define elif else if
#define all(x) x.begin(),x.end()

main(){
    int N,b,count=0,count2=0;
    double r,pai=3.141592653589;
    int C='A'-'a';
    char op;
    str S,T;
      cin>>N;
      vint a(N);
      rep(0,N){
        cin>>a.at(i);
        count+=a[i];
      }
      sort(all(a));
      cout<<a[0]<<" "<<a[N-1]<<" "<<count<<endl;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  string s;
  cin >> s;
  ll n = s.size();

  ll ans = 0;
  for (ll i = 1; i*2 < n; i++) {
    //cerr << i << " " << s.substr(0, i) << " " << s.substr(i, i) << endl;
    if (s.substr(0, i) == s.substr(i, i)) {
      cmax(ans, i*2);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

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

    return gcd(b % a, a);
}

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

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


    const ll sum = b - a + 1;

    const ll ac = (a - 1) / c;
    const ll bc = b / c;
    const ll cc = bc - ac;

    const ll ad = (a - 1) / d;
    const ll bd = b / d;
    const ll dd = bd - ad;

    const ll lcm_cd = lcm(min(c, d), max(c, d));

    const ll ax = (a - 1) / lcm_cd;
    const ll bx = b / lcm_cd;
    const ll xx = bx - ax;

    cout << (sum - cc - dd + xx) << endl;

    return 0;
}


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

using namespace std;
bool isPalindrome(string s){
    int l=0;
    int h=s.size()-1;
    while(h>l){

        if(s[l++]!=s[h--]){
            return false;
        }
    }
    return true;

}
int main(){
    string s;
    cin>>s;
    int n=s.size();
     string a=s.substr(0,n/2),b=s.substr(n/2+1,n-1);
     if(isPalindrome(s)&&isPalindrome(a)&&isPalindrome(b)){
        puts("Yes");
     }
     else puts("No");
    return 0;
}



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

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)
typedef pair<int, int> pii;

const int max_n = 10e5;
int INF = 10e8;

int df[max_n];
int ds[max_n];

int n;
vector<int> g[max_n];
vector<int> spath;

void dfs(int v, int (&d)[max_n]){
    REP(i, g[v].size()){
        if(d[g[v][i]]==INF){
            d[g[v][i]] = d[v] + 1;
            dfs(g[v][i], d);
        }
    }
}

int main(){
    cin >> n;

    REP(i, n) g[i].clear();
    REP(i, n-1){
        int a, b;
        cin >> a >> b;
        a = a-1;
        b = b-1;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    REP(i, n){
        df[i] = INF;
        ds[i] = INF;
    }

    df[0] = 0;
    dfs(0, df);
    ds[n-1] = 0;
    dfs(n-1, ds);

    int fe = 0;
    int su = 0;
    REP(i, n){
        if(df[i]<=ds[i]){
            fe += 1;
        } else {
            su += 1;
        }
    }

    if(fe>su){
        cout << "Fennec" << endl;
    } else {
        cout << "Snuke" << endl;
    }
}


Measured memory_bytes: 34688
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	if (s.length() + 1 == t.length() && s == t.substr(0, s.length()))
	{
		println("Yes");
	}
	else
	{
		println("No");
	}
}

Measured memory_bytes: 3600
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for _ in range(m):
  p,x=map(int,input().split())
  if t[p-1]<x:
    print(sum(t)+(x-t[p-1]))
  elif t[p-1]>x:
    print(sum(t)-(t[p-1]-x))
  else:
    print(sum(t))

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

int main() {
  int N;
  cin >> N;
  long ans = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      for (int k = 1; k <= N; k++) {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3632
n=int(input())
h=list(map(int,input().split()))
c=0
h[0]-=1
for i in range(n-1):
    now,next=h[i],h[i+1]
    if now>next:
        c=1
        break
    elif now<next:
        h[i+1]=next-1
print("Yes" if c==0 else "No")

Measured memory_bytes: 14396
sx,sy,tx,ty = map(int,input().split())
X = tx - sx
Y = ty - sy
print('R'*X + 'U'*Y + 'L'*X + 'D'*(Y+1) + 'R'*(X+1) + 'U'*(Y+1) + 'LU' + 'L'*(X+1) + 'D'*(Y+1) + 'R')


Measured memory_bytes: 9100
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    vector<ll> A(7);
    rep(i, 7) cin >> A[i];
    
    ll ret = 0;
    ret += A[1];
    ret += (A[0] / 2) * 2;
    ret += (A[3] / 2) * 2;
    ret += (A[4] / 2) * 2;
    if(A[0] % 2 == 1 && A[3] % 2 == 1 && A[4] % 2 == 1) ret += 3;
    ll two = 0;
    if(A[0] > 0 && A[3] > 0 && A[4] > 0) two += 3;
    two += A[1];
    two += (A[0] - 1) / 2 * 2;
    two += (A[3] - 1) / 2 * 2;
    two += (A[4] - 1) / 2 * 2;
    
    output(max(two, ret));
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (int argc, char const *argv[])
{
    intmax_t X, A;
    intmax_t ans = 0;

    scanf("%jd%jd", &X, &A);

    if (X < A) {
        puts("0");
    } else {
        puts("10");
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,W;cin>>n>>W;
  ll w[n],v[n];
  for(ll i=0;i<n;i++)cin>>w[i]>>v[i];
  ll dp[n+1][W+1];
  for(ll i=0;i<n+1;i++)for(ll j=0;j<W+1;j++)dp[i][j]=-1;
  dp[0][0]=0;
  ll ans=0;
  for(ll i=0;i<n;i++){
    for(ll j=0;j<=W;j++){
      if(dp[i][j]==-1)continue;
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
      ans=max(ans,dp[i+1][j]);
      if(j+w[i]<=W){
        dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
        ans=max(ans,dp[i+1][j+w[i]]);
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 79104
#include<stdio.h>
#define N 100

int main(){
  int i,n,a[N],k,j,ans;

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

  for( i = 0 ; i < n ; i++ ){
    for( j = n-1 ; j > i ; j-- ){
      if( a[j] < a[j-1] ){
        k = a[j];
        a[j] = a[j-1];
        a[j-1] = k;
        ans++;
      }
    }
  }

  for( i = 0 ; i < n-1 ; i++ ){
    printf("%d ",a[i]);
  }
  printf("%d\n%d\n",a[n-1],ans);

  return 0;
}



Measured memory_bytes: 2004
#pragma GCC optimize ("O3")
#include <vector>
#include <functional>
#include <deque>
#include <stdexcept>
#include <algorithm>


template<typename T, typename Container = ::std::deque<T>, typename Compare = ::std::greater<typename Container::value_type>>
class sliding_window {
    using value_compare = Compare;
    using value_type = T;
    using const_reference = const value_type &;

    value_compare comp;
    size_t length;
    Container val;

public:
    void push(const value_type &v) {
        while (!val.empty() && comp(val.back(), v))val.pop_back();
        val.push_back(v);
        ++length;
    }

    void pop(const value_type &v) {
        if (v == val.front())val.pop_front();
        --length;
    }

    explicit sliding_window(const Compare &_comp = Compare()) : length(0), comp(_comp), val({}) {}
    template<typename ForwardIterator>
    sliding_window(ForwardIterator begin, ForwardIterator end, const Compare &_comp = Compare()) : length(0), comp(_comp), val({}) {
        while(begin != end){
            push(*begin);
            ++begin;
        }
    }

    const size_t size() const {
        return length;
    }

    const_reference top() const {
        return val.front();
    }

};

#include <iostream>
#include <algorithm>
#include <random>

int main() {
    unsigned long long N, M, K;
    std::cin >> N >> M >> K;

    std::vector<unsigned long long> A(N), dp1(N), dp2(N);
    for (auto &i : A)std::cin >> i;

    std::copy(A.begin(), A.end(), dp1.begin());

    for (unsigned long long i = 1; i != K; ++i) {
        sliding_window<unsigned long long, std::deque<unsigned long long>, std::less<>> slidingWindow{};
        std::transform(A.begin(), A.end(), dp2.begin(), [&i](auto a) { return a * (i + 1); });

        for (unsigned long long j = 0; j != N; ++j) {
            if (j >= i)dp2[j] += slidingWindow.top();
            if (slidingWindow.size() == M)slidingWindow.pop(dp1[j - M]);
            slidingWindow.push(dp1[j]);
        }

        std::swap(dp1, dp2);
    }

    std::cout << *std::max_element(dp1.begin(), dp1.end()) << std::endl;

    return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,m,ans=0;
    cin>>n>>m;
    vector<pll> v(n);
    for(int i = 0; i < n; i++)
    {
        int a,b;
        cin>>a>>b;
        v[i]=make_pair(a,b);
    }
    sort(all(v));
    int bought=0;
    for(int i = 0; i < n; i++)
    {
        if(bought>=m) break;
        if(v[i].second>=(m-bought))   // koko de kaiowaru
        {
            ans+=v[i].first*(m-bought);
            break;
        }
        else
        {
            bought+=v[i].second;
            ans+=v[i].first*v[i].second;
        }
        
    }
    
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int n;
	cin >> n;
	int k = n / 15;
	cout << 800 * n - 200 * k << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

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

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  string a, b, c;
  cin >> a >> b >> c;
  cout << 'A' << b[0] << 'C' << endl;
  return 0;
}

Measured memory_bytes: 3604
# solution
import io
import math

nim, mike = map(int, input().split())
data = [['.'] * (mike+2)]
data += [['.'] + list(input()) + ['.'] for _ in range(nim)]
data += [['.'] * (mike+2)]

result = []
for i in range(1, nim + 1):
  strings = str()
  for j in range(1, mike + 1):
    counter = 0
    if data[i][j] == '.':
      for k in range(-1, 2, 1):
        for l in range(-1, 2, 1):
          if data[i+k][j+l] == '#':
            counter += 1
      strings += str(counter)
    else:
      strings += '#'
  result += [strings]
    
for i in result:
  print (i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define endl '\n'
#define N 1000001
#define mod 1e9+7
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll a[n],f[n];
	for(ll i=0;i<n;i++){
	    cin>>a[i];
	}
	f[0]=0;
	f[1]=abs(a[0]-a[1]);
	for(ll i=2;i<n;i++){
	    f[i]=min(f[i-1]+abs(a[i-1]-a[i]),f[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<f[n-1];
	return 0;
}


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

typedef long long ll;

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

  ll list[N + 1];
  list[0] = 2;
  list[1] = 1;

  for (int i = 2; i <= N; i++) {
    list[i] = list[i - 1] + list[i - 2];
  }

  cout << list[N] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define out(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;

    int mul = pow(2,m);
    int ans = ((n-m) * 100 + m * 1900) * mul;
    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

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

int main(){
// ここに処理を記述

	int N, Y;
	cin >> N >> Y;

	REP(i, Y/10000 + 1){
		int rest = Y - i*10000;
		REP(j, rest/5000 + 1){
			int k = (rest - j*5000)/1000;
			if(i+j+k == N){
				cout << i << " " << j << " " << k << "\n";
                return 0;
			}
		}
	}

    cout << "-1 -1 -1" << "\n";

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG

 // 深さ優先探索
vector<bool> seen;
int dfs(const Graph &G, ll v) {
    seen[v] = true; // v を訪問済にする
    int score = 0; 

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー

        // 負荷さ優先探索中の処理



        dfs(G, next_v); // 再帰的に探索, 毎回mat渡してええの？
    }
    return score;
} 

/*
//桁数の計算
ll keta(ll num){
  ll ans= 0 ;
  ll rem;

  for (ll i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }
  return ans;
}
*/


int main() {
    ll N, ans, cnt;
    cin >> N;
    
    vector<ll> a(N,0);
    cnt = 0;

    for(ll i=0; i<N; i++){
        cin >> a[i];
        ll tmp = a[i] % 2;
        if(tmp != 0){
            cnt++;
        }
    }

    //cout << "cnt:"<< cnt << endl;

    if(cnt % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
   char s1[55];
   scanf("%s",s1);
   int len=strlen(s1);
   for(int i=len-1;i>=0;i--){
   	  if(s1[i]=='F'){
   	  	for(int j=0;j<i;j++){
   	  		printf("%c",s1[j]);
		}
		break;
	  }
   }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (char c : s)
    {
        if (c == '1')
            cout << 9;
        else
            cout << 1;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#define M 100000
#define MAX 1000000001
#define MIN -100000000
#define mod 998244353 
#define ss second
#define ff first
#define ll long long int
#define pb push_back
#define ld double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

int main(){
	int n,x;
	cin>>x>>n;
	int fr[110] = {0},ans = x;
	for(int i=0;i<n;i++){
		int temp;
		cin>>temp;
		fr[temp]++;
	}
	for(int i=x;i<110;i++){
		if(fr[i] == 0){
			ans = i;
			break;
		}
	}
	for(int i=x;i>=0;i--){
		if(fr[i] == 0){
			if(x-i <= ans-x){
				ans = i;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3620
using System;

class _0056 {
    static readonly int N = 50000;
    public static void Main() {
        int c, n;
        bool[] e = new bool[N + 1];
        int[] p = new int[5133];
        e[0] = e[1] = false;
        for (int i = 2; i <= N; i++) e[i] = true;
        for (int i = 2; i < Math.Sqrt(N + 1); i++) if (e[i]) for (int j = 2; i * j <= N; j++) e[i * j] = false;
        c = 0;
        for (int i = 0; i <= N; i++) if (e[i]) p[c++] = i;
        while ((n = int.Parse(Console.ReadLine())) != 0) {
            c = 0;
            if (n % 2 == 0) for (int i = 0; p[i] <= n / 2; i++) if (e[n - p[i]]) c++; else { } else c = (e[n - 2]) ? 1 : 0;
            Console.WriteLine(c);
        }
    }
}

Measured memory_bytes: 9420
xp1,yp1,xp2,yp2 = map(int, input().split())
q = int(input())
r = (xp2-xp1,yp2-yp1)

def a(p1,p2):
    s = (p1-xp1,p2-yp1)
    d = r[0] * s[0] + r[1] * s[1]
    a = xp1 + r[0] * d / (r[0]**2 + r[1]**2)
    b = yp1 + r[1] * d / (r[0]**2 + r[1]**2)
    return str(a),str(b)

for i in range(q):
    x, y = map(int, input().split())
    print(' '.join(a(x, y)))

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
int arr[500], total, N, K, ans=1;
void test(int a) {
	if(a <= ans)
		return;
	int k = K;
	vector<int> v(arr, arr+N);
	sort(v.begin(), v.end(), [&](int x, int y){return x%a < y%a;});
	if(v[N-1]%a == 0) {
		ans = a;
		return;
	}
	for(int i=0, j=N-1; i<j;) {
		while(i < j && v[i] % a == 0)
			i++;
		while(i < j && v[j] % a == 0)
			j--;
		if(i >= j) break;
		int t = min(v[i]%a, a-(v[j]%a));
		v[i] -= t;
		v[j] += t;
		k -= t;
		if(k < 0)
			return;
	}
	ans = a;
}
int main() {
	ios::sync_with_stdio(0);cin.tie(0);
	cin >> N >> K;
	for(int i=0; i<N; i++) {
		cin >> arr[i];
		total += arr[i];
	}

	for(int i=1; i*i<=total; i++) {
		if(total % i)
			continue;
		test(i);
		test(total/i);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void makecopy(int *saikoro,int *copy){
  int i;
  for(i=1;i<=6;i++){
    copy[i]=saikoro[i];
  }
}


int main(){
  int *saikoro,*copy,i;
  saikoro=malloc(7*sizeof(int));
  copy=malloc(7*sizeof(int));
  for(i=1;i<=6;i++) scanf("%d",&saikoro[i]);
  makecopy(saikoro,copy);
  char order[100];
  scanf("%s",order);
  for(i=0;i<strlen(order);i++){
    if(order[i]=='S'){
      saikoro[2]=copy[1];
      saikoro[6]=copy[2];
      saikoro[5]=copy[6];
      saikoro[1]=copy[5];
      makecopy(saikoro,copy);
    }
    if(order[i]=='N'){
      saikoro[1]=copy[2];
      saikoro[2]=copy[6];
      saikoro[6]=copy[5];
      saikoro[5]=copy[1];
      makecopy(saikoro,copy);
    }
    if(order[i]=='W'){
      saikoro[4]=copy[1];
      saikoro[6]=copy[4];
      saikoro[3]=copy[6];
      saikoro[1]=copy[3];
      makecopy(saikoro,copy);
    }
    if(order[i]=='E'){
      saikoro[1]=copy[4];
      saikoro[4]=copy[6];
      saikoro[6]=copy[3];
      saikoro[3]=copy[1];
      makecopy(saikoro,copy);
    }
  }
  printf("%d\n",saikoro[1]);
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    string SS;
    ll count = 0;
    SS.push_back(S.front());
    rep2(i, 1, N) {
        if(S[i - 1] != S[i]) count++;
        if(count / 2 + 1 <= K && count % 2) {
            if(S[i] == 'L') SS.push_back('R');
            else SS.push_back('L');
        } else {
            SS.push_back(S[i]);
        }
    }
    ll ans = 0;
    rep2(i, 1, N) {
        if(SS[i - 1] == SS[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3696
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<map>
#include<cmath>
#include<cstring>
#define For(i,j,k)	for(ll i=j;i<=k;++i)
#define Dow(i,j,k)	for(ll i=k;i>=j;--i)
#define ll  long long
using namespace std;
inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(c<'0'||c>'9')	{c=getchar();}
	while(c>='0'&&c<='9')	t=t*10+c-48,c=getchar();
	return t*f;
}
ll x,y,ans;
int main()
{
	x=read();y=read();
	ll now=x;
	while(1)
	{
		ans++;
		now*=2;
		if(now>y)	break;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
using namespace std;

int main() {
	int a, b, c,ans=0; cin >> a >> b >> c;
	FOR(i,1, a) {
		int sum[5] = {};
		int tmp = i;
		REP(j, 5) {
			sum[j] = i % 10;
			i /= 10;
		}
		i = tmp;
		if ((sum[1] + sum[2] + sum[3] + sum[0]+sum[4] )<= c&&(sum[0] + sum[1] + sum[2] + sum[3]+sum[4]) >= b)
			ans += i;
	}

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

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

////////////
// ModInt //
////////////

// 四則演算の最も左に存在する値がModIntでなければキャストでバグる
// 例えばx = mint * 1000;やx = ModInt(1000) * mint;はいいがx = 1000 * mint;は駄目。
template<int64_t mod_ = 1'000'000'007>
class ModInt {
private:
	int64_t integer_;

public:
	constexpr ModInt(const int64_t initial_number = 0)
		: integer_(initial_number){}
	
	// 四則演算
	constexpr ModInt operator+(const ModInt& operand) const
	{
		ModInt ret{this->integer_ + operand.integer_};
		if (ret.integer_ >= mod_)
			ret.integer_ -= mod_;
		return ret;
	}
	constexpr ModInt operator-(const ModInt& operand) const
	{
		ModInt ret{this->integer_ - operand.integer_};
		if (ret.integer_ < 0)
			ret.integer_ += mod_;
		return ret;
	}
	constexpr ModInt operator*(const ModInt& operand) const
	{
		return {this->integer_ * operand.integer_ % mod_};
	}
	constexpr ModInt operator/(const ModInt& operand) const
	{
		return *this * (operand ^ (mod_ - 2));
	}

	// 累乗
	constexpr ModInt operator^(const int64_t operand) const
	{
		ModInt ret{1}, pow_ope{this->integer_};
		for (int64_t pow{operand}; pow > 0; pow >>= 1)
		{
			if (pow & 1) ret *= pow_ope;
			pow_ope *= pow_ope;
		}
		return ret;
	}

	// 代入
	constexpr ModInt& operator=(const ModInt& operand)
	{
		this->integer_ = operand.integer_;
		return *this;
	}
	constexpr ModInt& operator+=(const ModInt& operand)
	{
		*this = *this + operand;
		return *this;
	}
	constexpr ModInt& operator-=(const ModInt& operand)
	{
		*this = *this - operand;
		return *this;
	}
	constexpr ModInt& operator*=(const ModInt& operand)
	{
		*this = *this * operand;
		return *this;
	}
	constexpr ModInt& operator/=(const ModInt& operand)
	{
		*this = *this / operand;
		return *this;
	}

	// その他
	constexpr operator int64_t() { return integer_; }

	constexpr ModInt getOne() const
	{
		return ModInt(1ll);
	}
	constexpr ModInt getZero() const
	{
		return ModInt(0ll);
	}
};

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	using Mint = ModInt<>;
	using vi = std::vector<Mint>;
	using vvi = std::vector<vi>;
	using vvvi = std::vector<vvi>;
	// dp[day][visited][strong]
	vvvi dp(M + 1, vvi(N + 1, vi(N + 1)));
	dp[0][1][1] = Mint(1ll);
	for (int day{}; day < M; day++)
	{
		// new
		for (int visited{1}; visited <= N - 1; visited++)
			for (int strong{1}; strong <= visited; strong++)
				dp[day + 1][visited + 1][strong] += dp[day][visited][strong] * Mint(N - visited);
		// visited, not strong
		for (int visited{1}; visited <= N; visited++)
			for (int strong{1}; strong < visited; strong++)
				dp[day + 1][visited][strong] += dp[day][visited][strong] * Mint(visited - strong);
		// strong
		for (int visited{1}; visited <= N; visited++)
			for (int strong{1}; strong <= visited; strong++)
				dp[day + 1][visited][visited] += dp[day][visited][strong] * Mint(strong);
	}
	std::cout << dp.back().back().back() << std::endl;
	
	return 0;
}

Measured memory_bytes: 216832
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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 ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

    int n = s[s.size()-1] - '0';
    if(n == 3)  cout << "bon" << endl;
    else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define pb push_back
#define x first
#define y second
#define files(FileName) read(FileName); write(FileName)
#define read(FileName) freopen((FileName + ".in").c_str(), "r", stdin)
#define write(FileName) freopen((FileName + ".out").c_str(), "w", stdout)
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }

const string FILENAME = "input";
const int MAXN = 1e5 + 5;

int a, b;

int main() {
	ios::sync_with_stdio(false);
	srand(time(0));
	//read(FILENAME);
	cin >> a >> b;
	if (a <= 0 && 0 <= b) {
		cout << "Zero" << endl;
		return 0;
	}
	if (0 < a) {
		cout << "Positive" << endl;
		return 0;
	}
	if ((b - a) & 1) {
		cout << "Positive" << endl;
		return 0;
	} else {
		cout << "Negative" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
class Main
{
public static void main(String args[])
{
    Scanner obj=new Scanner(System.in);
    int n,x,t;double c=0;
    n=obj.nextInt();
    x=obj.nextInt();
    t=obj.nextInt();
  	double m=n;
    c=t*Math.ceil(m/x);
    System.out.println((int)c);
}
}

Measured memory_bytes: 27048
#pragma GCC optimize("03")
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vec;
typedef pair<ll,ll> pi;
typedef vector<vector<ll,ll> > matrix;
vector<ll> st;
vec adj[100100];
ll dp[100100],n,mx;
bool vis[100100];
void dfs(ll s,ll p)
{
	vis[s]=true;
	for(auto it=adj[s].begin();it != adj[s].end();it++)
	{
		if(*it == p)
			continue;
		if(!vis[*it])
			dfs(*it,s);
	}
	st.push_back(s);
}
void dfs1()
{
	for(ll i=0;i<st.size();i++)
	{
		for(auto it=adj[st[i]].begin();it != adj[st[i]].end();it++)
		{
			dp[*it]=max(dp[*it],dp[st[i]]+1);
			mx=max(mx,dp[*it]);
		}
	}

}
int main()
{
	ll n,m,x,y;
	cin>>n>>m;
	for(ll i=0;i<m;i++)
	{
		cin>>x>>y;
		adj[x].push_back(y);
	}
	for(ll i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			dfs(i,-1);

		}
	}
	reverse(st.begin(),st.end());
	mx=0;
	dfs1();
	cout<<mx<<endl;
	return 0;
}


Measured memory_bytes: 8692
N, Y = map(int, input().split())
nn = Y // 10000 if (Y // 10000) < N else N
mm = Y // 5000  if (Y // 5000)  < N else N
ll = Y // 1000  if (Y // 1000)  < N else N

#print(nn, mm, ll)
ans = "-1 -1 -1"
for i in range(nn+1):
  for j in range(mm+1):
    if i + j > N:
      break
    if (i * 10000 + j * 5000 + (N-i-j) * 1000) == Y:
          ans = str(i)+" "+str(j)+" "+str(N-i-j)
          break
print(ans)
  

Measured memory_bytes: 3188
N = int(input())

s = input().split()
s = [int(c) for c in s]

count = 0
t = 0

while t == 0:
    for i in range(N):
        if s[i] % 2 != 0:
            t = 1
            count -= 1
            break
        else:
            s[i] = int(s[i]/2)
    count += 1
    
print(count)
        


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int ans = 0;
	long long n, d;
	cin >> n >> d;
	for (int i = 1; i <= n; i++)
	{
		long long x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3756
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<climits>
#include<cstdlib>
#include<map>
#include<math.h>
#include<utility>
using namespace std;

int main(){
  int n;
  cin >> n;
  string s[101];
  for(int i=0; i<n; i++) cin >> s[i];

  map<string, int> m;
  int c=0;
  for(int i=0; i<n; i++){
    if(m.count(s[i]) == 0){
      m[s[i]] = 1;
      c++;
    }
  }
  if(c==3) cout << "Three" << endl;
  else cout << "Four" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, a, m;
  in2(n, m);
  vector<ll> c(m), d(m), e(n);
  rep(i, m){
    in(a);
    c[i] = a - 1;
    in(a);
    d[i] = a - 1;
  }
  rep(i, m){
    if(c[i] == 0)
      e[d[i]]++;
    if(d[i] == n - 1)
      e[c[i]]++;
  }
  a = 0;
  rep(i, n){
    if(e[i] == 2)
      a++;
  }
  if(a)
    out("POSSIBLE");
  else
    out("IMPOSSIBLE");
  memi;
}

Measured memory_bytes: 4992
#include <stdio.h>
int main(){
char str[3];
int a=0,b=0,c=0;
scanf("%s",str);
for(int i = 0;i < 3;i++){
if(str[i] == 'a')a++;
if(str[i] == 'b')b++;
if(str[i] == 'c')c++;
}
if(a==1&&b==1&&c==1){
printf("Yes");
}else{
printf("No");
}
return 0;
}

Measured memory_bytes: 128
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        
      String s[] = new String[N];//sの中でN回まわしていく
      for(int i=0; i<N; i++){
          s[i] =sc.next();//入力されるsが入る箱
      }
      Arrays.sort(s);//ソートを使い入力したNを並び替えていく
        int a =1;
        for(int j=0; j<N-1; j++){
            if(!s[j].equals(s[j+1])){//ソートで並び替えたことにより配列で順番ずつ文字列を比較することができる
                                     //apple[0]==apple[1],apple[1]==orange[2]
              a++;//異なった文字列はカウントしていく
            }
        }
        System.out.println(a);
      }
}
     
      

Measured memory_bytes: 70832
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
        string s;
        int N;
        cin >>s;
        int x = 0;
        for (int i = 0; i <4; i++) {
                if(s[i]=='+'){x++;}else{x--;}
        }
        cout << x << endl;

        return 0;
}


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

#define int long long

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	vector<int> c(n), d(n);
	for (int i = 0; i < n; i++) {
		if (i == 0) c[i] = a[i];
		else {
			if (a[i] > a[i -1]) c[i] = a[i];
		}
	}
	for (int i = n - 1; i >= 0; i--) {
		if (i == n - 1) d[i] = b[i];
		else {
			if (b[i] > b[i + 1]) d[i] = b[i];
		}
	}
	long long ans = 1;
	for (int i = 0; i < n; i++) {
		if (c[i] && d[i]) {
			if (c[i] != d[i]) ans = 0;
		}
		if (c[i]) {
			if (b[i] < c[i]) ans = 0;
		}
		if (d[i]) {
			if (a[i] < d[i]) ans = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if (c[i] || d[i]) continue;
		ans *= min(a[i], b[i]);
		ans %= 1000000007;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3456
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        t: chars,
    }
    puts!("{}\n", t.into_iter().map(|c| if c == '?' { 'D' } else { c })
          .collect::<String>());
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2408
n = int(input())
s = list(input())
d = [0]*n
p = [0]*n
for i in range(n):
    if i > 0:
        d[i] = d[i-1]
    if s[i] != '.':
        d[i] += 1
for i in range(n-1, -1, -1):
    if i < (n-1):
        p[i] = p[i+1]
    if s[i] != '#':
        p[i] += 1

d = [0]+d
p = p+[0]
ans = 2**32
for i in range(n+1):
    t = d[i]+p[i]
    if t < ans:
        ans = t
print(ans)


Measured memory_bytes: 15732
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
typedef long long int ll;
#define iceil(x,y) (x+y-1)/y

using namespace std;
typedef pair<int, int> P;

int main() {
	FAST;

	int h,w;
	cin >> h >> w;

	char s[h+2][w+2];
	rep(i,1,h+1) {
		rep(j,1,w+1) {
			cin >> s[i][j];
		}
	}

	rep(i,1,h+1) {
		rep(j,1,w+1) {
			if (s[i][j] == '#' && s[i-1][j] != '#' && s[i+1][j] !='#' && s[i][j-1] != '#' && s[i][j+1] != '#')  {
				cout << "No\n";
				return 0;
			}
		}
	}

	cout << "Yes\n";

	return 0;
}

Measured memory_bytes: 256
N,A,B,C,D=map(int,input().split())

if N%A==0:
    x=N//A
else:
    x=N//A+1

if N%C==0:
    y=N//C
else:
    y=N//C+1
    
a=x*B
b=y*D

if a==b:
    print(a)
    
else:
    print(min(a,b))



Measured memory_bytes: 5596