akhauriyash/Code-Regression huggingface dataset:
/**************************************************************
 Problem: 3224
 User: suda1230705082
 Language: C++
 Result: Runtime_Error
 ****************************************************************/

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
#include<deque>
#include<vector>
#include<set>
//#include<bits/stdc++.h>
//#include<tr1/unordered_map>
using namespace std;
long long MODA = 100000909770901ll;
long long MODB = 100000002135407ll;
const int MAXN = 200050;

inline void print(char pt) {
	printf("%c\n", pt);
}
inline void print(int pt) {
	printf("%d\n", pt);
}
inline void print(long long pt) {
	printf("%I64d\n", pt);
}
inline void print(double pt) {
	printf("%.20f\n", pt);
}
inline void print(char pt[]) {
	printf("%s\n", pt);
}
inline void print() {
	printf("\n");
}

inline void scan(int &pt) {
	scanf("%d", &pt);
}
inline void scan(char &pt) {
	scanf("%c", &pt);
}
inline void scan(long long &pt) {
	scanf("%I64d", &pt);
}
inline void scan(double &pt) {
	scanf("%lf", &pt);
}
inline void scan(char pt[]) {
	scanf("%s", pt);
}

struct str {
	char val[108];
	str() {
		memset(val, 0, sizeof(val));
	}
	friend int operator<(str a, str b) {
		return strcmp(a.val, b.val) < 0;
	}
};

//int gcd(int x, int y) {
//    return y ? gcd(y, x % y) : x;
//}
//int lcm(int x, int y) {
//    return x * (y / gcd(x, y));
//}
long long gcd(long long x, long long y) {
	return y ? gcd(y, x % y) : x;
}
long long lcm(long long x, long long y) {
	return x * (y / gcd(x, y));
}

int bits[50];
void getbits() {
	for (int i = 0; i < 30; i++) {
		bits[i] = 1 << i;
	}
}

long long Q_pow(long long x, long long y) {
	long long res = 1;
	while (y) {
		if (y % 2 == 1) {
			res *= x;
			res %= MODA;
		}
		x = x * x;
		x %= MODA;
//        if(x<=1e-5){
//            return 0;
//        }
		y /= 2;
	}
	return res;
}

struct pii {
	int x;
	int y;
	int i;
	friend int operator<(pii a, pii b) {
		if (a.x != b.x)
			return a.x < b.x;
		return a.y < b.y;
	}
};

int T;
int n, m;
char stra[100010];

int main() {
	scan(stra);
	int lena = strlen(stra);
	for (int i = 0; i < lena - 1; i++) {
		if (stra[i] == stra[i + 1]) {
			printf("%d %d\n", i + 1, i + 1 + 1);
			return 0;
		}
	}
	for (int i = 0; i < lena - 2; i++) {
		if (stra[i] == stra[i + 2]) {
			printf("%d %d\n", i + 1, i + 2 + 1);
			return 0;
		}
	}
	print("-1 -1");
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <fstream>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl

int a[100010];

int main() {
    long long  couS, M;
    cin >> couS >> M;
    long long couC = M / 2;
    long long ans;

    if (couS > couC) {
        ans = couC;
    }
    else if (couS == couC) {
        ans = couS;
    }
    else if (couS < couC) {
        ans = couS + ((couC - couS) / 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 

int  A(int x){
    if(x>=0)return x;
    else return -x;
}

ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N)*(y%N) % N;
		k /= 2;
	}
	return res;
}

unsigned long long popCount64bitB(unsigned long long x) 
{ 
    x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) 
      +  (x & 0x5555555555555555UL); 
    x = ((x & 0xccccccccccccccccUL) >> 2) 
      +  (x & 0x3333333333333333UL); 
    x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) 
      +  (x & 0x0f0f0f0f0f0f0f0fUL); 
    x = ((x & 0xff00ff00ff00ff00UL) >> 8) 
      +  (x & 0x00ff00ff00ff00ffUL); 
    x = ((x & 0xffff0000ffff0000UL) >> 16) 
      +  (x & 0x0000ffff0000ffffUL); 
    x = ((x & 0xffffffff00000000UL) >> 32) 
      +  (x & 0x00000000ffffffffUL); 
    return x; 
} 

bool g[13][13];

int main(void){
    int a,b,h;
    cin>>a>>b>>h;
    cout<<(a+b)*h/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int a, b, q; cin>>a>>b>>q;
    vector<ll> s, t;
    s.emplace_back(-INF);
    t.emplace_back(-INF);
    for(int i=0; i<a; i++){
        ll S; cin>>S;
        s.emplace_back(S);
    }
    for(int i=0; i<b; i++){
        ll T; cin>>T;
        t.emplace_back(T);
    }
    s.emplace_back(INF);
    t.emplace_back(INF);

    while(q--){
        ll x; cin>>x;

        int sidx = lower_bound(all(s), x) - s.begin();
        int tidx = lower_bound(all(t), x) - t.begin();

        ll ans = INF;
        for(int i=sidx-1; i<=sidx; i++){
            for(int j=tidx-1; j<=tidx; j++){
                chmin(ans, min(abs(x - s[i]) + abs(s[i] - t[j]), abs(x - t[j]) + abs(t[j] - s[i])));
            }
        }

        cout << ans << endl;
    }

    return 0;
}

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


using namespace std;


void white_cells()
{
  int H, W, h, w;
  cin >> H >> W >> h >> w;

  cout << (H * W) - (h * W) - (H * w) + (h * w) << "\n";
}


void double_helix()
{
  char b;
  cin >> b;

  if (b == 'A') cout << "T\n";
  else if (b == 'T') cout << "A\n";
  else if (b == 'C') cout << "G\n";
  else  cout << "C\n";

}


void five_antennas()
{
  vector<int> a(5);
  for (int i = 0; i < 5; ++i) cin >> a[i];
  int k;
  cin >> k;

  if (a[4] - a[0] > k)
  {
    cout << ":(\n";
    return;
  }
  cout << "Yay!\n";

}

void buttons()
{
  int a, b;
  cin >> a >> b;

  int v_max = 0;
  for (int i = 0; i < 2; ++i) {
    if (a > b) {
      v_max += a;
      --a;
    }
    else
    {
      v_max += b;
      --b;
    }
  }
  cout << v_max << "\n";
}


void biscuit_generator()
{
  int a, b, t;
  cin >> a >> b >> t;

  cout << t / a * b << "\n";
}


void changing_a_character()
{
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  s[k - 1] += 32;
  cout << s <<"\n";
}


void ferris_wheel()
{
  int a, b;
  cin >> a >> b;

  if (a >= 13) cout << b << "\n";
  else if(a >= 6) cout << b / 2 << "\n";
  else cout << 0 << "\n";
}


void apple_pie()
{
  int a, p;
  cin >> a >> p;

  p += 3 * a;

  cout << p / 2 << "\n";
}


void airplane()
{
  vector<int> a(3);
  for (int i = 0; i < 3; ++i) cin >> a[i];

  sort(a.begin(), a.end());

  cout << a[0] + a[1] << "\n";
}


void rounding()
{
  int x, a;
  cin >> x >> a;

  if (x < a) cout << 0 << "\n";
  else cout << 10 << "\n";
}




void can_you_solve_this()
{
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for (int i = 0; i < m; ++i) cin >> b[i];
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j];

  int cnt = 0;
  for (int i = 0; i < n; ++i)
  {
    int point = 0;
    for (int j = 0; j < m; ++j) point += a[i][j] * b[j];

    if (point > -c) ++cnt;
  }
  cout << cnt << "\n";
} 


void ATCoder()
{
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    int cnt = 0;
    while (i < s.size() && (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'))
    {
      ++cnt;
      ++i;
    }
    ans = max(ans, cnt);
  }
  cout << ans << "\n";
}



int main()
{
  //white_cells();
  //double_helix();
  //five_antennas();
  //buttons();
  //biscuit_generator();
  //changing_a_character();
  //ferris_wheel();
  //apple_pie();
  //airplane();
  //rounding();


  //can_you_solve_this();
  ATCoder();
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
const int N=1e5+10;
const int mo=1e9+7;
int n,cnt[26];
char s[N];
ll ksm(ll x,ll y){
	ll ret=1;for(;y;y>>=1){
		if(y&1)ret=ret*x%mo;
		x=x*x%mo;
	}
	return ret;
}
int main(){
	cin>>n;scanf("%s",s+1);
	ll ans=0;
	for(int i=1;i<=n;i++){
		ll w=1;
		for(int z=0;z<26;z++)if(z!=s[i]-'a')w=w*(1+cnt[z])%mo;
		ans=(ans+w)%mo;
		cnt[s[i]-'a']++;
	}
	cout<<ans<<endl;
}

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

int A[100][100];
int B[100][100];

bool dp[100][100][20000]; //ここ怪しくないか ０点は6400点へと補正

int main(){
  
  int h,w; 
  
  scanf("%d %d", &h, &w);
  
  for(int i = 0; i < 80; i++){
    for(int j = 0; j < 80; j++){
      for(int k = 0; k < 12800; k++){
        dp[i][j][k] = false;
      }
    }

  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){ 
     scanf("%d", &A[i][j]);}
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      scanf("%d", &B[i][j]);
    }
  }
  
  dp[0][0][A[0][0]-B[0][0]+6400] = true;
  dp[0][0][-A[0][0]+B[0][0]+6400] = true;
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      for(int k = 0; k < 12800; k++){
      
      if(i && dp[i-1][j][k]){ //上からおりれるとき
        dp[i][j][k+A[i][j]-B[i][j]] = true;
        dp[i][j][k+B[i][j]-A[i][j]] = true;
      }
      
      if(j && dp[i][j-1][k] ){ //したから降りれる時
        
        dp[i][j][k+A[i][j]-B[i][j]] = true;
        dp[i][j][k+B[i][j]-A[i][j]] = true;
       
      }
      
           }
    }
  }
           
  
  //dp遷移終了
  
  int ans = 2e9;
  
  for(int i = 0; i < 20000; i++){
    if( dp[h-1][w-1][i] ){ 
      
      ans = min(ans, abs(i-6400));
    }
  }
  
  printf("%d\n", ans);
  
  
  
  return 0;
} 
  

Measured memory_bytes: 157312
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

// https://qiita.com/nomikura/items/a4c5be6c72ce854d7ce4

const int maxV = 12345;
vector<int> graph[maxV];
int ende;
int dm;
int center = -1;
bool besucht[maxV];

void treeDFS(int from, int current, int dist, int &maxDist, int &maxVertex) {
    if (dist > maxDist) {
        maxDist = dist;
        maxVertex = current;
    }
    for (auto to : graph[current]) {
        if (to == from) continue;
        treeDFS(current, to, dist + 1, maxDist, maxVertex);
    }
}

void getTreeDiameter() {
    int start = 0, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
    start = end, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
    ende = end, dm = maxDist;
	// printf("start: %d, end: %d, diameter: %d\n", start, end, maxDist);
}

void findCenter( int node, int dist ) {
	// cout << node << ", " << dist << endl;
	besucht[node] = true;
	if( dist >= (dm-dm%2)/2 ){
		center = node;
		return;
	}
	for( auto to : graph[node] ){
		if( center != -1 ) return; 
		if( besucht[to] ) continue;
		findCenter( to, dist+1 );
	}
}

int res[maxV];
bool visited[maxV];

int main(){
	int n; cin >> n;
	for( int i = 0; i < n-1; ++i ){
		int a, b; cin >> a >> b; --a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	vector<ll> c(n);
	for( auto &k : c ) cin >> k;
	if( n == 1 ){
		cout << 0 << endl;
		return 0;
	}
	cout << accumulate( c.begin(), c.end(), 0ll ) - *max_element( c.begin(), c.end() ) << endl;
	sort( c.begin(), c.end(), greater<ll>() );
	getTreeDiameter();
	findCenter( ende, 0 );
	// cout << dm << " " << center << endl;
	queue<int> q;
	q.push(center);

	int pnt = 0;
	while( !q.empty() ){
		int e = q.front(); q.pop();
		res[e] = c[pnt];
		visited[e] = true;
		for( auto to : graph[e] ){
			if( !visited[to] ) q.push(to);
		}
		++pnt;
	}
	for( int i = 0; i < n; ++i ){
		cout << res[i];
		if( i != n-1 ) cout << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1792
def main():
    import heapq
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    heap = []
    for i in range(n):
        heapq.heappush(heap,-1*a[i])
    for i in range(m):
        a = int(heapq.heappop(heap)/2)
        heapq.heappush(heap,a)
    print(-1*sum(heap))



if __name__ == "__main__":
    main()

Measured memory_bytes: 14180
// AOJ 2565: Broken Audio Signal
// 2017.10.13 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int a[1002];
char x[1002];

int main()
{
	int n, i, f, c, min, max;
	char buf[15];

	while (scanf("%d", &n) && n > 0) {
		c = 0, f = 0;
		for (i = 0; i < n; i++) {
			scanf("%s", buf);
			if (*buf == 'x') {
				a[i] = 0, x[i] = 1, c |= 1;
				if (i > 0 && x[i-1]) c |= 2;
			} else a[i] = atoi(buf), x[i] = 0;
		}
		if (c <= 1) {
			f = 1, max = 1000000005, min = -1000000005;
			for (i = 0; c <= 1 && i < n; i++) {
				if (x[i]) {
					if (i > 0   && !x[i-1] && a[i-1] < max) max = a[i-1];
					if (i < n-1 && !x[i+1] && a[i+1] < max) max = a[i+1];
				} else {
					if (i > 0   && !x[i-1] && a[i-1] <= a[i]) f = 0;
					if (i < n-1 && !x[i+1] && a[i+1] <= a[i]) f = 0;
				}
				if (++i == n) break;
				if (x[i]) {
					if (           !x[i-1] && a[i-1] > min) min = a[i-1];
					if (i < n-1 && !x[i+1] && a[i+1] > min) min = a[i+1];
				} else {
					if (           !x[i-1] && a[i-1] >= a[i]) f = 0;
					if (i < n-1 && !x[i+1] && a[i+1] >= a[i]) f = 0;
				}
			}
		}

		if (c == 1 && f && max - min == 2) printf("%d\n", min+1);
		else {
			if (c == 1 && f) f = (max - min > 2);
			puts(f ? "ambiguous" : "none");
		}
	}
	return 0;
}

Measured memory_bytes: 1672
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int H, W;
	int N;
	cin >> H >> W >> N;
	int a[N];
	rep(i, 0, N) cin >> a[i];

	int rsl[H][W];

	int y = 0, x = 0;
	bool flag = true;
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < a[i]; j++) {
			rsl[y][x] = (i + 1);
			if(flag) x++;
			else x--;
			if(x == W) {
				x = W - 1;
				y++;
				flag = false;
			} else if(x == -1) {
				x = 0;
				y++;
				flag = true;
			}
		}
	}
	rep(i, 0, H) {
		rep(j, 0, W - 1) {
			cout << rsl[i][j] << " ";
		}
		cout << rsl[i][W - 1] << endl;
	}

}


Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>
using namespace std;

const int INF = 1<<28;

struct edge_t {
    int to, cost;
    edge_t(int to, int cost) : to(to), cost(cost) {}
};
struct state_t {
    int v;
    int min_cost;
    state_t(int v, int min_cost) : v(v), min_cost(min_cost) {}
    bool operator<(const state_t &o) const {
        return (min_cost > o.min_cost);
    }
};
typedef vector<edge_t> vertex_t;
struct graph_t {
    vector<vertex_t> g;

    graph_t(int vertex_count) {
        g.resize(vertex_count);
    }
    graph_t(vector<vertex_t> g) : g(g) {}

    void dijkstra(int s, vector<int> &min_cost) {
        min_cost.resize(g.size());
        priority_queue<state_t> q;
        
        fill(min_cost.begin(), min_cost.end(), INF);

        min_cost[s] = 0;
        q.push(state_t(s, 0));

        while (!q.empty()) {
            state_t p = q.top(); q.pop();
            int v = p.v;
            if (min_cost[v] < p.min_cost) continue;
            for (int i = 0; i < g[v].size(); i++) {
                edge_t e = g[v][i];
                if (min_cost[e.to] > min_cost[v] + e.cost)  {
                    min_cost[e.to] = min_cost[v] + e.cost;
                    q.push(state_t(e.to, min_cost[e.to]));
                }
            }
        }
    }
};

#define MAX_V 101

int main() {
    int n, k;
    while (cin >> n >> k) {
//        cout << n << ' ' << k << endl;
        graph_t graph(n+1);
        if (n == 0 && k == 0) break;
        for (int i = 0; i < k; i++) {
            int op;
            cin >> op;
            if (op == 0) {
                vector<int> min_cost;
                int a, b;
                cin >> a >> b;
                graph.dijkstra(a, min_cost);
                if (min_cost[b] == INF) {
                    cout << -1 << endl;
                } else {
                    cout << min_cost[b] << endl;
                }
            } else {
                int c, d, e;
                cin >> c >> d >> e;
                graph.g[c].push_back(edge_t(d, e));
                graph.g[d].push_back(edge_t(c, e));
            }
        }
    }
    return 0;
}

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

int main() {
    double n;
    cin >> n;
    long ans = round(n/2);
    cout << (int)ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;
int x[200010], y[200010];


int32_t main(){
INIT
cin>>n;
int mn=10e17, mx=0;
int i1=0, i2=0;
vector<int> a, b;

for(int i=1; i<=n; i++){
    cin>>x[i]>>y[i];
    int s=(x[i]+y[i]), dif=x[i]-y[i];
    x[i]=s; y[i]=dif;
}
sort(x+1, x+1+n); sort(y+1, y+1+n);
cout<<max(x[n]-x[1], y[n]-y[1]);

return 0;
}





Measured memory_bytes: 6772
#include<stdio.h>
#include<stdlib.h>

int main(void){
	int N,k,i,x,ans=0;
	scanf("%d %d",&N,&k);
	ans = (N-1)/(k-1);
	if( (N-1)%(k-1)>0){
		ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){

    int n;
    cin >> n;

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

    int cnt=0;
    int ind=1;
    int flg = 0;
    for(int i=1; i<=n; i++){
        ind = A[ind];
        cnt++;
        if(ind == 2){
            flg = 1;
            break;
        }
    }    

    if(flg == 1){
        cout << cnt << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 N, M;
  cin >> N >> M;
  vector<i64> a(M), b(M);
  for (i64 i = 0; i < M; i++)
    cin >> a[i] >> b[i];
  map<i64, i64> m;
  for (i64 i = 0; i < M; i++)
  {
    m[a[i]]++;
    m[b[i]]++;
  }
  for (pair<i64, i64> i : m)
    if (i.second % 2 == 1)
    {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 7168
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextInt()) {
			int in = sc.nextInt();
			System.out.println(numOfArea(in));
		}
		sc.close();
	}
	
	private static int numOfArea(int n) {
		return 1 + n * (n + 1) / 2;
	}
	
}

Measured memory_bytes: 25792
n = int(input())
S = input()

letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

newS = ''
for i, s in enumerate(S):
    letterIdx = (letters.index(s) + n)
    if letterIdx > 26-1:
        letterIdx -= 26
    newS = newS.__add__(letters[letterIdx])

print(newS)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FOREACH(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define SIZE(v) ((int)(v).size())
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define llint long long
#define pii pair<int, int>
#define UNVISITED -1


template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
 
template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

const int MAX = 1001000;
int A[MAX];
int bs[MAX];

int main() {
	int N; scanf("%d", &N);
	REP(i, N) {
		scanf("%d", A + i);
		bs[A[i]]++;
	}
	bool q = true;
	for(int i = 2; i < MAX; i++) {
		int cnt = 0;
		for(int j = i; j < MAX; j += i) {
			cnt += bs[j];
		}
		if(cnt > 1) {
			q = false;
			break;
		}
	}
	if(q) printf("pairwise coprime\n");
	else {
		int v = A[0];
		REP(i, N) v = __gcd(v, A[i]);
		if(v == 1) printf("setwise coprime\n");
		else printf("not coprime\n");
	}
}

Measured memory_bytes: 11500
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vi a(n);
    ll sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }
    double ave = 1.0*sum/n;
    double optD = 100.0;
    ll optIdx = 0;

    rep(i, n){
        double diff = abs(a[i] - ave);
        if(optD > diff){
            optD = diff;
            optIdx = i;
        }
    }
    cout << optIdx << endl;
}

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

int main(){
    string s,l="abcdefghijklnmopqrstuvwxyz";
    int count = 0;
    cin >> s;
    if(s[0] == 'A') count++;
    for(int i=2;i<s.size()-1;i++){
        if(s[i] == 'C'){
            count++;
        }
    }
    bool flag = false;
    for(int i=1;i<s.size();i++){
        if(s[i] != 'A' && s[i] != 'C'){
            for(int j=0;j<l.size();j++){
                if(s[i] == l[j]) break;
                if(j == l.size()-1) flag = true;
            }
        }
    }
    if(!(flag)) count++;
    if(count == 3){
        cout << "AC" << endl;
        return 0;
    }else{
        cout << "WA" << endl;
    }
}

Measured memory_bytes: 256
import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+2):
  l=(i-1)*i//2
  r=(2*n-i+1)*i//2
  ans+=r-l+1
  if ans>=mod:
    ans%=mod
print(ans)

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

int main() {

  int A;
  cin >> A;

  int B;
  cin >> B;

  int C;
  cin >> C;

  if( A - B >= C){
      cout << 0 << endl;
  }

  else{
      cout << C - A + B << endl;
  }
}

Measured memory_bytes: 256
s = input()[::-1]

res = 0
cnt = {0: 1}
now = 0
p = 1
for i in range(len(s)):
    now = (now + int(s[i]) * p) % 2019
    res += cnt.get(now, 0)
    p = (p * 10) % 2019
    cnt[now] = cnt.get(now, 0) + 1

print(res)


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

using namespace std;

#define ll long long 
#define Coming ios_base :: sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"

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


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<int> > g(200010);
int p;
int odd, even;
int one, two, three;
int vis[200010];
int ans[200010];
void dfs(int x, int parity, int fa)
{
    vis[x] = parity;
    if(parity) odd++;
    else even++;
    for(int i = 0; i < g[x].size(); i++) {
        if(g[x][i] != fa) {
            dfs(g[x][i], parity^1, x);
        }
    }
}
int main()
{
    int i, j, k;
    int n, t, m;
    cin >> n;
    one = (n+2)/3, two = (n+1)/3, three = n/3;
    for(i = 1; i < n; i++) {
        int uu, vv;
        scanf("%d%d", &uu, &vv);
        g[uu].push_back(vv);
        g[vv].push_back(uu);
    }
    dfs(1, 0, 0);
    int verse = odd > even;
    if(min(odd, even) <= n/3) {
        for(i = 1; i <= n; i++) {
            if(vis[i]^verse) {
                ans[i] = three*3; three--;
            }
            else {
                if(one) ans[i] = 3*(one-1)+1, one--;
                else if(two) ans[i] = 3*(two-1)+2, two--;
                else ans[i] = three*3, three--;
            }
        }
    }
    else {
        for(i = 1; i <= n; i++) {
            if(vis[i]^verse) {
                    if(one) ans[i] = 3*(one-1)+1, one--;
                    else
                    ans[i] = three*3, three--;
                }
            else {
                if(two) ans[i] = 3*(two-1)+2, two--;
                else if(three)ans[i] = three*3, three--;
                else ans[i] = 3*(one-1)+1, one--;
            }
        }
    }
    for(i = 0; i < n; i++) {
        if(i) printf(" ");
        printf("%d" ,ans[i+1]);
    }
    puts("");
    return 0;
}


Measured memory_bytes: 19072
#include<iostream>
#include<iomanip>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const long long INF = 1LL << 60;
typedef pair<int, int> P;

ll N, M;



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

    priority_queue<double> que;
    for (int i = 0; i < N; i++) que.push(A[i]);
    for (int i = 0; i < M; i++) {
        double a = que.top(); que.pop();
        que.push(a/2.0);
    }
    ll res = 0;
    for (int i = 0; i < N; i++) {
        res += floor(que.top());
        que.pop();
    }
    cout << res << endl;

}


Measured memory_bytes: 2296
#include<stdio.h>
int main(){

    // 変数の宣言・読み込み
    int n,ans=0;
  	long a,b;
    scanf("%d", &n);

    for(a=1;a<n;a++){
      for(b=a;a*b<n;b++){
        if(a==b){
          ans++;
        }else{
          ans=ans+2;
          }
      }
    }

    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int powmod(int x, int y, int mod)
{
    int res = 1;
    x %= mod;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}

void solve()
{
}

int main()
{
    // freopen("filename.in","r",stdin);
    // freopen("filename.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    string s;
    cin>>s;
    if(s=="RRR")
        cout<<3<<"\n";
    else if(s=="RRS" || s=="SRR")
        cout<<2<<"\n";
    else if(s=="SRS" || s=="SSR" || s=="RSS" || s=="RSR")
        cout<<1<<"\n";
    else
        cout<<0<<"\n";

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

class Triangle {
public:
  ll x0, x1, x2;
  ll y0, y1, y2;
  ll s;

  Triangle(ll _x0, ll _y0, ll _x1, ll _y1, ll _x2, ll _y2, ll _s) {
    x0 = _x0; x1 = _x1; x2 = _x2;
    y0 = _y0; y1 = _y1; y2 = _y2;
    s = _s;
  }

  ll area2() {
    return abs((x0-x2)*(y1-y2) - (x1-x2)*(y0-y2));
  }

  ll diff() {
    return y2*y2 - s;
  }

  void out() {
    printf("%ld %ld %ld %ld %ld %ld\n", x0, y0, x1, y1, x2, y2);
  }
};

ll bs(ll s) {
  ll ng = 0, ok = 1e9;
  while (ok - ng > 1) {
    ll mid = (ok + ng) / 2;
    if (mid*mid - s >= 0) {
      ok = mid;
    } else {
      ng = mid;
    }
    // cout << ng << ", " << mid << ", " << ok << endl;
  }
  return ok;
}

int main() {
  ll s; cin >> s;
  Triangle t(0,0,1,0,0,1, s);
  t.x1 = t.y2 = bs(s);
  if (t.diff() == 0)  {
    t.out();
    return 0;
  }
  t.y1 = 1; t.x2 = 1;
  ll n = t.x1, d = t.diff() - 1;
  if (d >= n) {
    t.x1--;
    d %= n;
  }
  t.y1 += d;
  t.out();
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1; i<=n; i+=2){
        int cnt = 0;
        for(int j=1; j<=i; j++){
            if(i%j == 0) cnt++;
        }
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**************************************
 * Au: Hany01
 * Prob: agc003d
 * Date: Oct 20th, 2018
 * Email: hany01@foxmail.com
**************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
#define Rep(i, j) for (register int i = 0, i##_end_ = j; i < i##_end_; ++ i)
#define For(i, j ,k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define SZ(a) ((int)(a.size()))
#define ALL(a) a.begin(), a.end()
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define X first
#define Y second
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define y1 wozenmezhemecaia 
#ifdef hany01
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline T read() {
    register char c_; register T _, __;
    for (_ = 0, __ = 1, c_ = getchar(); !isdigit(c_); c_ = getchar()) if (c_ == '-')  __ = -1;
    for ( ; isdigit(c_); c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


const int maxn = 2520;

int tot, pr[maxn >> 1];
map<LL, int> mp, vis;


inline void sieve(int n) {
	static int np[maxn];
	For(i, 2, n) {
		if (!np[i]) pr[++ tot] = i;
		for (int j = 1; j <= tot && pr[j] * i <= n; ++ j) {
			np[pr[j] * i] = 1;
			if (i % pr[j] == 0) break;
		}
	}
}

inline LL simplify(LL x) {
	For(i, 1, tot) {
		int cnt = 0;
		while (x % pr[i] == 0) x /= pr[i], ++ cnt;
		Rep(j, cnt %= 3) x *= pr[i];
	}
	return x;
}

inline LL complement(LL x) {
	LL ans = 1;
	For(i, 1, tot) {
		int cnt = 0;
		while (x % pr[i] == 0) x /= pr[i], ++ cnt;
		Rep(j, (3 - cnt % 3) % 3) ans *= pr[i];
	}
	LL qt = (LL)sqrt(x);
	return (qt * qt == x) ? ans * qt : ans * x * x;
}

int main()
{
#ifdef hany01
    File("agc003d");
#endif

	sieve(2333);
	For(i, 1, read<int>()) ++ mp[simplify(read<LL>())];

	int ans = 0;
	for (map<LL, int>::iterator it = mp.begin(); it != mp.end(); ++ it) {
		if (vis[it -> X]) continue;
		LL t = complement(it -> X);
		if (t == it -> X) ++ ans;
		else ans += max(mp[t], it -> Y), vis[t] = 1;
	}
	printf("%d\n", ans);

    return 0;
}

//Analysis:
//我们将每个数都变成最简形式，也就是将所有质因子的指数mod 3（至于实现，只需要筛出10^(10/3)内的质数即可）
//这样一个数就对应了一个唯一的数与之冲突，而且酱紫的数是成对的，对它们取max即可

Measured memory_bytes: 25216
if __name__ == '__main__':

	S = input()
	K = int(input())

	leng = len(S)
	ans = 0

	#１文字である場合
	if K == 1:
		ans = 0
	#全部同じ文字である場合
	elif S.count(S[0]) == leng:
		ans = int(leng*K/2)
	else:
		#隣り合った文字はＮ文字で置き換える文字はＭ文字か計算する
		start = ""
		cnt = 0
		rep = 0
		for x,y in enumerate(S):
			if x == 0:
				start = y
			else:
				if start == y:
					cnt += 1
				else:
					#同じ文字あり
					if cnt > 0:
						cnt += 1	#最初を追加
						rep += int(cnt/2)
						cnt = 0	#初期化

					start = y
		#後処理
		if cnt > 0:
			cnt += 1	#最初を追加
			rep += int(cnt/2)

		#先頭と末尾が同じ文字である場合
		if S[0] == S[leng-1]:

			#先頭文字での置き換え文字数
			cnt1 = 1
			smoji = S[0]
			for x in range(1,leng):
				if S[0] == S[x]:
					cnt1 += 1
					smoji += S[0]
				else:
					break
			moto1 = int(cnt1/2)


			#末尾文字での置き換え文字数
			cnt2 = 1
			#文字列反転
			S = S[::-1]
			smoji += S[0]
			for x in range(1,leng):
				if S[0] == S[x]:
					cnt2 += 1
					smoji += S[0]
				else:
					break
			moto2 = int(cnt2/2)

			#先頭と末尾を合わせたものを置き換えた文字数
			slen = len(smoji)
			moto3 = int(slen/2)

			kekka = (moto1 + moto2) - moto3
			kekka = kekka * (K -1)

			ans = rep * K - kekka
		else:
			ans = rep * K

	print(ans)


Measured memory_bytes: 3064
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

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

const ull mod = 1e9+7;

ll k;
vector<ll> as;

struct BSearch {
	ll solveLower(ll left, ll right) {
		while (right - left > 1) {
			ll middle = left + right;
			middle /= 2;
			ll r = middle;
			rep(i, k) {
				r = r / as[i] * as[i];
			}
			if (r >= 2) {
				right = middle;
			}
			else {
				left = middle;
			}
		}
		return right;
	}
	ll solveUpper(ll left, ll right) {
		while (right - left > 1) {
			ll middle = left + right;
			middle /= 2;
			ll r = middle;
			rep(i, k) {
				r = r / as[i] * as[i];
			}
			if (r > 2) {
				right = middle;
			}
			else {
				left = middle;
			}
		}
		return left;
	}
};

int main(void)
{
	cin >> k;
	as.resize(k);
	rep(i, k) cin >> as[i];
	BSearch b;
	auto down = b.solveLower(0, 1e15);
	auto up = b.solveUpper(0, 1e15);
	if (down > up) {
		cout << -1 << endl;
	}
	else {
		cout << down << " " << up << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if ((a < b) && (b < c))
    {
        printf("Yes");
    }else{
        printf("No");
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 2068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll MOD = 1e9+7;
ll A[101000];ll n,k;ll B[110][101000];
int main(){
      cin>>n>>k;ll a;
      for(ll j=0;j<=k;j++){
            B[0][j] = 0;
      }
      B[0][0] = 1;
      A[0] = 0;
      for(ll i=1;i<=n;i++){
            cin>>a;
            for(ll j=0;j<=k;j++){
                  A[j+1] = (A[j]+B[i-1][j])%MOD;
            }
            for(ll j=0;j<=k;j++){
                  B[i][j] = (A[j+1]-A[max(0LL,j-a)]+MOD)%MOD;
            }
      }
      cout<<B[n][k]<<endl;
      return 0;
}


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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define str string
#define s_vec(data,name,vertical,horizontal) vector<vector<(data)>> (name)((vertical),vector<(data)>((horizontal)));




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

    vector<ll> x(n);

    for(int i=0;i<n;i++){
        cin>>x.at(i);
    }

    x.push_back(X);

    sort(x.begin(),x.end());

    vector<ll> div(n);

    for(int i=0;i<n;i++){
            div.at(i) = abs(x.at(i+1)-x.at(i));
    }


    sort(div.begin(),div.end());
    ll min = div.at(0);

    ll ans;
    int t1,t2;
    for(ll i=1;i*i<=min;i++){
        if(min%i==0){
            t1=0;t2=0;
            for(int j=0;j<n;j++){
                if(div.at(j)%i!=0){
                    t1 = 1;
                }
                if(div.at(j)%(min/i)!=0){
                    t2 = 1;
                }
            }
            if(t2==0){
                if(ans<(min/i)){
                    ans = (min/i);
                }
            }else{
                if(t1==0){
                    if(ans<i){
                        ans = i;
                    }
                }
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		long B = sc.nextLong();
		long N = sc.nextLong();

		if (N < B) {
			System.out.println(A*N/B);
		} else { // N >= B
			System.out.println(A*(B-1)/B);
		}
	}
}

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

#define debug(x) cerr<<#x<<'='<<x<<'\n'

int main(void) {
	int a, b;
	cin>>a>>b;
	cout<<a+2*(b-a);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());

    if(A[n/2] == A[n/2-1]){
        cout << 0 << endl;
    }else{
        cout <<A[n/2] - A[n/2 -1] <<endl;
    }




}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderPre
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int count = 0;

            for (int i = 1; i <= N; i++)
            {
                var keta = Math.Floor(Math.Log10(i) + 1);
                if (keta % 2 == 1)
                    count++;

            }

            Console.WriteLine(count);
            

            
        }

    }
}



Measured memory_bytes: 11092
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
}

Measured memory_bytes: 23636
#include <iostream>
void merge(int n, int* s, int left, int mid, int right, long* count)
{
    int start = left;
    int size = right - left;
    int startM = mid;
    int* mergeArray = (int*)malloc(size * sizeof(int));
    int i = 0;
    while (size > i) {
	if (mid == right || (left != startM && s[left] < s[mid])) {
	    mergeArray[i] = s[left];
	    left++;
	    i++;
	} else {
	    mergeArray[i] = s[mid];
	    mid++;
	    i++;
	    *count += mid - (start + i);
	}
    }
    for (int i = 0; i < size; i++) {
	s[start + i] = mergeArray[i];
    }
}
void mergeSort(int n, int* s, int left, int right, long* count)
{
    if (left + 1 < right) {
	int mid = (right + left) / 2;
	mergeSort(n, s, left, mid, count);
	mergeSort(n, s, mid, right, count);
	merge(n, s, left, mid, right, count);
    }
}
long countInversions(int* a, int n)
{
    long* count = (long*)malloc(sizeof(long));
    *count = 0;
    mergeSort(n, a, 0, n, count);
    return *count;
}
int main()
{
    int n;
    std::cin >> n;
    int* a = (int*)malloc(n * sizeof(int));
    for (int i = 0; i < n; i++) {
	std::cin >> a[i];
    }
    long inversion = countInversions(a, n);
    std::cout << inversion << std::endl;
    return 0;
}

Measured memory_bytes: 21348
import java.io.*;
import java.util.*;

public class Main {
  static ArrayList<ArrayList<Integer>> g;
  static int[] count;
  	public static void bfs(int u, boolean[] visi)
    {
      LinkedList<Integer> q = new LinkedList<Integer>();
      
      q.add(u);
      visi[u]=true;
      
      while(!q.isEmpty())
      {
        int tmp=q.remove();
        
        for(int num: g.get(tmp))
          	if(!visi[num])
            {
              q.add(num);
              count[num]+=count[tmp];
              visi[num]=true;
            }
      }
    }
    public static void main(String[] args) throws Exception {
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        OutputStream outputStream = System.out;
    	PrintWriter out = new PrintWriter(outputStream);

        int i, n, m, c, k, j;

      StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());
      	m = Integer.parseInt(st.nextToken());
     
      g = new ArrayList<ArrayList<Integer>>();
      
      for(i=0;i<=n;i++)
        g.add(new ArrayList<Integer>());
      count = new int[n+1];
		for(i=0;i<n-1;i++)
        {
         st = new StringTokenizer(br.readLine());
          int u =Integer.parseInt(st.nextToken());
          int v =Integer.parseInt(st.nextToken());
          g.get(u).add(v);
          g.get(v).add(u);
        }
      
      for(i=0;i<m;i++)
        {
         st = new StringTokenizer(br.readLine());
          int x =Integer.parseInt(st.nextToken());
          int y =Integer.parseInt(st.nextToken());
          count[x]+=y;
      }
      boolean[] visi = new boolean[n+1];
      bfs(1,visi);
      
      
      
      for(int go=1;go<count.length;go++)
        out.print(count[go]+" ");
      
	out.flush();
	out.close();
	
	}
}

Measured memory_bytes: 118284
import java.util.Scanner;

public class Main {

	static int[][] a;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int N =cin.nextInt();
		int count=1;
		while(N--!=0){
			a = new int[10][10];
			for(int i = 1; i <= 8;i++){
				String str = cin.next();
				for(int j = 1; j <= 8;j++){
					a[i][j]=str.charAt(j-1)-'0'+1;
				}
			}
			int x = cin.nextInt();
			int y = cin.nextInt();
			bomb(y, x);
			System.out.println("Data "+(count++)+":");
			for(int i = 1;i<=8;i++){
				for(int j = 1;j<=8;j++){
					System.out.print(a[i][j]-1);
				}
				System.out.println();
			}
		}
	}
	static void bomb(int x, int y){
		a[x][y]=1;
		for(int i = 1; i <= 3;i++){
			if(a[x+i][y]==2){
				bomb(x+i,y);
			}
			else if(a[x+i][y]==0){
				break;
			}
		}
		for(int i = 1; i <= 3;i++){
			if(a[x-i][y]==2){
				bomb(x-i,y);
			}
			else if(a[x-i][y]==0){
				break;
			}
		}
		for(int i = 1; i <= 3;i++){
			if(a[x][y+i]==2){
				bomb(x,y+i);
			}
			else if(a[x][y+i]==0){
				break;
			}
		}
		for(int i = 1; i <= 3;i++){
			if(a[x][y-i]==2){
				bomb(x,y-i);
			}
			else if(a[x][y-i]==0){
				break;
			}
		}
	}
}

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

int n, s;

int Comb(int N, int start, int s)
{
	int ret = 0;

	if (s < 0)
		return 0;

	if (N == n)
		if (start == s)
			return 1;
		else
			return 0;

	for (int i = start + 1; i <= 9; ++i)
		ret += Comb(N + 1, i, s - start);
	return ret;
}

int main(){

	vector<int> RET;
	while (cin >> n >> s && (n != 0 || s != 0))
	{
		int ret = 0;
		for (int i = 0; i <= 9; ++i)
			ret += Comb(1, i, s);
		RET.push_back(ret);
	}
	for (int i = 0; i < RET.size(); i++) {
		cout << RET[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
# 組み合わせの総数 p=10**9+7 で割ったあまりを求める 
"""n<10**9 ,r<10**7  ,p は素数"""
def comb(n,r):
    if n-r < r:
        r=n-r
    p=1
    q=1
    for i in range(r):
        p *=n-i #=n(n-1)・・(n-r+1)
        p %= mod
        q *=i+1 #=1・2・・r =r!
        q %=mod
    return p*pow(q,mod-2,mod)


# 初期入力
N,a,b = (int(x) for x in input().split())
mod =10**9 +7

#N種類の花1本以上の組み合わせ全て(0本選ぶは×なので-1)
all = pow(2,N,mod)-1

#嫌いな本数の組み合わせ
comb_a =comb(N,a)
comb_b =comb(N,b)

ans =(all -comb_a -comb_b)% mod
print(ans)

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

using namespace std;

#define int long long
int mod = 1e9 + 7;
int f[4005], rev[4005];

int st(int x, int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) {
        int c = st(x, y / 2);
        return c * c % mod;
    }
    return x * st(x, y - 1) % mod;
}

int get(int n, int k) {
    return f[n + k - 1] * rev[n - 1] % mod * rev[k] % mod;
}

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    f[0] = 1, rev[0] = 1;
    for (int i = 1; i <= 4000; ++i) f[i] = f[i - 1] * i % mod, rev[i] = st(f[i], mod - 2);
    for (int i = 1; i <= k; ++i) {
        int cnt = get(i, k - i);
        int cur = n - k - (i - 1);
        if (cur >= 0) {
            cout << cnt * get(i + 1, cur) % mod << '\n';
        }
        else cout << 0 << '\n';
    }
    return 0;
}



Measured memory_bytes: 384
#include <iostream>

using namespace std;

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

    if((abs(a-b)<=d&&abs(b-c)<=d)||abs(a-c)<=d)
    {
        cout <<"Yes"<<endl;
    }
    else
    {
        cout <<"No"<<endl;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
        ifstream in("input.txt");
        ofstream out("output.txt");
        #define cin in
        #define cout out
#endif
int const MAXN=110000;
int n, m;
vector<int> g[MAXN];
int best[MAXN];
bool vis[MAXN];
int dfs(int node){
	vis[node]=true;
	if(g[node].empty()) return 0;
	int res=0;
	for(auto x:g[node]){
		if(!vis[x]) res=max(res,dfs(x));
		else res=max(res,best[x]);
	}
	return best[node]=res+1;
}
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int from, to;
		cin>>from>>to;
		g[from].push_back(to);
	}
	int res=0;
	for(int i=1;i<=n;i++)
		if(!vis[i])
			res=max(res,dfs(i));
	cout<<res;
} 

Measured memory_bytes: 8448
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n,m = [int(i) for i in read().split()]


def popcount(i): # i < 2^32
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24

N = 2**n
M = 2**m
a = []
for k in range(N):
    a.append([popcount(x&k)&1 for x in range(M)])

#print(a)
for i in range(N-1,0,-1):
    for j in range(M-1,0,-1):
        a[i][j] ^= a[i-1][j]^a[i][j-1]^a[i-1][j-1]

for i in range(1,N):
    x = map(str,a[i][1:])
    print("".join(x))







Measured memory_bytes: 52956