akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n;
  cin >> n;

  vector<int> l(n);
  REP(i,n) cin >> l[i];
  
  sort(l.begin(), l.end());

  mat a(n);

  int ans = 0;
  REP(i, n - 1){
    FOR(j, i + 1, n){
      auto itr = lower_bound(l.begin(), l.end(), l[i] + l[j]);
      int ng = distance(itr, l.end());
      ans += (n - 1 - j) - ng;
    }
  }

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


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(100000000)

def dfs(node,dist):
    for nx_node,e_dist in G[node]:
        if ans[nx_node]==-1:
            ans[nx_node]=(dist+e_dist)%2
            dfs(nx_node,dist+e_dist)

n=int(input())
G=[[] for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    G[u-1].append([v-1,w])
    G[v-1].append([u-1,w])
ans=[-1]*n
dfs(0,0)
print(*ans,sep='\n')



Measured memory_bytes: 87092
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  string s;
  cin >> s;
  if(s=="Sunny") {
    cout << "Cloudy" << endl;
  }
  else if(s=="Cloudy") {
    cout << "Rainy" << endl;
  }
  else {
    cout << "Sunny"<< endl;
  }


}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>

using namespace std;

struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};
vector<int> ans;
int main(){
    cin.tie(0);
    
    int A, B, K; cin >> A >> B >> K;
    for (int i = 1; i <= max(A, B); i++){
        if (A % i == 0 && B % i == 0){
            ans.push_back(i);
        }
    }
    cout << *(ans.end()-K)<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890
#define de(x) if(x==MODE && x!=0)

#define MODE 1

using namespace std;

int main()
{
    int i,j;
    LLI N;

    scanf("%lld", &N);
    LLI m = sqrt(N);
    for( i = m; i>0; i--)
    {
        if( N%i==0)
        {
            m = i;
            break;
        }
    }
    printf("%lld\n", (m-1)+(N/m-1));

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

const ll SIZE = 1e5+10;

ll s,w;

int main(){
    cin >> s >> w;
    if(s <= w)  cout << "unsafe\n";
    else
    {
        cout << "safe\n";
    }
    
}

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

int main() {
	int a, b;
	cin >> a >> b;
	int p;
	if(b==100) p=1000*a+b;
	else if(b<10) p=10*a+b;
	else p=100*a+b;
	bool sq=false;
	for(int i=1; i<=1001; ++i) if(i*i==p) sq=true;
	if(sq) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

ll  a[N];
ll  b[N];

void upd(int l,int r,int s,int c)   {   ++r;
    a[l] += s;  b[l] += c;
    a[r] -= s;  b[r] -= c;
}

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n;
    int m;  cin >> m;
    int l = 0;

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

        if (l)  {
            if (l <= x) {
                upd(l + 1,x,-1,x + 1);
                upd(x + 1,m, 0,x - l);
                upd(1,l,0,x - l);
            }
            else   {
                upd(l + 1,m,-1,x + m + 1);
                upd(x + 1,l, 0,x + m - l);
                upd(1,x,-1,x + 1);
            }   
        }
        l = x;
    }
    for(int i = 1 ; i <= m ; ++i)
        a[i] += a[i - 1],
        b[i] += b[i - 1];
    
    ll  ans = 1e18;

    for(int i = 1 ; i <= m ; ++i)
        if (ans > a[i] * i + b[i])
            ans = a[i] * i + b[i];

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
int main(){
	char a[201],b[200];
	int m,i,h,c,j;
	while(1){
		scanf("%s",a);
		c=strlen(a);
		if(a[0]=='-'){
			break;
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%d",&h);
			for(j=0;j<h;j++){
				b[j]=a[j];
			}
			for(j=h;j<c;j++){
				a[j-h]=a[j];
			}
			for(j=0;j<h;j++){
				a[c-h+j]=b[j];
			}
		}
		for(i=0;i<c;i++){
			printf("%c",a[i]);
		}
		printf("\n");
	}
}
			
	


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

string alf("abcdefghijklmnopqrstuvwxyz");

int diff(char s) {
	for (int i = 0; i < 26; ++i) {
		if (s == alf[i]) {
			return (26 - i) % 26;
		}
	}
}

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

	for (size_t i = 0; i < s.size(); ++i) {
		if (K >= diff(s[i])) {
			K -= diff(s[i]);
			s[i] = 'a';
		}
	}

	K %= 26;
	for (size_t i = 0; i < 26; ++i) {
		if (s[s.size() - 1] == alf[i]) {
			s[s.size() - 1] = alf[i + K];
			break;
		}
	}
	
	cout << s << endl;

	//system("pause");
}

Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <utility>
#include <limits>
using namespace std;
typedef pair<int, int> P;
const int MAX_H = 1000, MAX_W = 1000, MAX_N = 9;
int h, w, n;
char c[MAX_H][MAX_W];
int sx, sy;
int d[MAX_H][MAX_W];
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = numeric_limits<int>::max();
int gx[MAX_N], gy[MAX_N];

int bfs()
{
	queue<P> que;
	
	for(int i = 0; i != h; ++i){
		for(int j = 0; j != w; ++j){
			d[i][j] = INF;
		}
	}
	
	que.push(P(sx, sy));
	d[sx][sy] = 0;
	
	int count = 0;
	while(!que.empty()){		
		P p=que.front();
		que.pop();
		
		if(p.first == gx[count] && p.second == gy[count]){
			count++;
			
			while(!que.empty())
				que.pop();
			
			int score = d[p.first][p.second];
			for(int i = 0; i != h; ++i){
				for(int j = 0; j != w; ++j){
					d[i][j] = INF;
				}
			}
			d[p.first][p.second] = score;
		}
			
		if(count == n)
			break;
		
		for(int i = 0; i != 4; ++i){
			int nx = p.first + dx[i],
				ny = p.second + dy[i];
			
			if(0 <= nx && nx < h && 0 <= ny && ny < w &&
				c[nx][ny] != 'X' && d[nx][ny] == INF){
				que.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}
		}
		
	}
	
	return d[gx[n - 1]][gy[n - 1]];
	
}
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> h >> w >> n;
	for(int i = 0; i != h; ++i){
		for(int j = 0; j != w; ++j){
			char a;
			cin >> a;
			if(a == 'S')
				sx = i, sy = j;
			if('1' <= a && a <= '9')
				gx[a - '0' - 1] = i, gy[a - '0' - 1] = j;
			c[i][j] = a;
		}
	}
	
	cout << bfs() << endl;
	
	return 0;
}

Measured memory_bytes: 6096
l = [0 for _ in range(31)]
l[1] = 1
l[2] = 2
l[3] = 4

for i in range(4,31):
    l[i] = l[i-1] + l[i-2] + l[i-3]

while True:
    n = int(input())
    if n == 0:
        break
    else:
        t = l[n]
        if t % 10 == 0:
            d = t // 10
        else:
            d = t // 10 + 1
        if d % 365 == 0:
            print(d // 365)
        else:
            print(d // 365 + 1)


Measured memory_bytes: 5596
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	char c;
	cin >> c;
	c = c + ('b' - 'a');
	cout << c << endl;
    return 0;
}

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

int N;
long long W, weight[110], value[110]; 

long long dp[110][100100] = {0};

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

    for (int i = 0; i < N; ++i) {
        for (int sum_w = 0; sum_w <= W; ++sum_w) {

            if (sum_w - weight[i] >= 0) {
                chmax(dp[i+1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }

            chmax(dp[i+1][sum_w], dp[i][sum_w]);
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        int ans = 0;
        for (int i = 1; i <= N; i++) {
        	ans+= i;
        }

        System.out.println(ans);
    }
}

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

import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for k in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353

def dijkstra(N: int, nodes: list, src: int) -> list:
    """ ダイクストラ高速化版(頂点数, 隣接リスト(0-indexed), 始点) """
    from heapq import heappush, heappop

    # 頂点[ある始点からの最短距離]
    res = [INF] * N
    # スタート位置
    que = [src]
    res[src] = 0
    # キューが空になるまで
    while len(que) != 0:
        # 距離*N + 現在のノード
        cur = heappop(que)
        # 距離とノードに分ける
        dist = cur // N
        cur %= N
        # 出発ノードcurの到着ノードでループ
        for nxt, cost in nodes[cur]:
            # 今回の経路のが短い時
            if dist + cost < res[nxt]:
                res[nxt] = dist + cost
                # 距離*N+ノード番号 の形でキューに詰める
                heappush(que, (dist+cost)*N+nxt)
    # ノードsrcからの最短距離リストを返却
    return res

N, M = MAP()
nodes = [[] for i in range(N)]
# 1つ手前の頂点に戻るコスト0の辺を張る
for i in range(N-1):
    nodes[i+1].append((i, 0))

for i in range(M):
    l, r, c = MAP()
    l -= 1
    r -= 1
    # 一番遠くまで行く辺を張る
    nodes[l].append((r, c))

res = dijkstra(N, nodes, 0)

if res[N-1] != INF:
    print(res[N-1])
else:
    print(-1)


Measured memory_bytes: 68000
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int l, r, d;
  cin >> l >> r >> d;
  cout << (r / d) - ((l - 1) / d) << endl;
  return 0;
}

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

int main(){

    int K;
    string S;

    cin >> K;
    cin >> S; 

    int size;

    size = S.length();

    if (K >= size){
        cout << S << endl;
    }

    if (K < size){

        string subS = S.substr(0,K);
        cout << subS <<"..."<< endl;
    }

}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>

int main()
{
	long long n;

	std::cin >> n;

	std::vector<std::pair<int, int> > v(n);
	
	for (size_t i = 0; i < n; i++)
	{
		int a, b;

		std::cin >> a >> b;

		v[i] = { a, b };
	}

	std::sort(v.begin(), v.end());

	std::cout << v.back().first + v.back().second << std::endl;
	
	return 0;
}


Measured memory_bytes: 1152
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;

const int maxx=5e5+10;
int len,num[maxx],top,flag;
long long ans;
char s[maxx],zf;

int main(){
	scanf("%s",s+1); len=strlen(s+1);
	for(int i=1;i<=len;i++){
		if(s[i]==zf) num[top]++;
		else num[++top]++,zf=s[i];
	}
	if(s[1]=='<') flag=1;
	for(int i=1;i<=top;i++){
		if(flag){
			for(int j=0;j<num[i];j++) ans+=j;
		}
		else{
			ans+=max(num[i],num[i-1]);
			for(int j=1;j<num[i];j++) ans+=j; 
		}
		flag^=1;
	}
	if(s[len]=='<') ans+=num[top];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    long ans = 0;
    for(int i=0;i<n;i++){
        if(a[i] % 2 == 0){
            ans += a[i]/2;
        }else{
            ans += a[i]/2;
            if(i<n-1 && a[i+1] > 0){
                a[i+1]--;
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <map>
#include <string>

typedef long long ll;

using namespace std;

int main() {
    ll n,m;
    string s;
    
    cin >> n >> m;
    
    cout << n*m - (n+m-1) << endl;
    return 0;
}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
	public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			long K = inputArray[1];


			//答えの出力
			var kaisu = (N - 1) / (K - 1);
			var ans = (N - 1) % (K - 1)==0?kaisu:kaisu+1; 
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 28156
#include<iostream>
#include<cstdio>
using namespace std;
string s;
int main()
{
	cin >> s;
	if(s.size() & 1)
	{
		puts("No");
		return 0;
	}
	else for(int i = 0;i < s.size();i += 2)
		if(s[i] != 'h' || s[i + 1] != 'i')
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {//---------------------------------------------------------
  
  int x,n; cin>>x>>n;
  vector<int>a(n); rep(i,n){cin>>a.at(i);}
  sort(all(a));
  
  int ans=x;  int sa=1; int han=0;
rep(mugen,99999){
  
    han=ans;
   rep(j,n){if(a.at(j)==ans){ans=x-sa;}  }
    if(ans==han){break;}
  
    han=ans;
   rep(k,n){if(a.at(k)==ans){ans=x+sa;}  }
    if(ans==han){break;}
   sa++;
  } 
  
  cout<<ans<<endl;
  
  
  
  
return 0; }


Measured memory_bytes: 3628
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let mut A = read![[usize]];
    let mut B = read![[usize]];

    let mut n = 0;

    for i in 0..N {
        let k = min(A[i], B[i]);
        A[i] -= k;
        B[i] -= k;
        n += k;

        let k = min(A[i + 1], B[i]);
        A[i + 1] -= k;
        B[i] -= k;
        n += k;
    }

    println!("{}", n)
}


Measured memory_bytes: 9972
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
 
int main() {
    int listnum[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    std::cin >> k;
    std::cout << listnum[k-1] << std::endl;
 
 
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define re register
#define ll long long
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
#define mp make_pair
#define a first
#define b second
typedef pair<int,int> pii;
vector<pii>G;
int n,ans;
int main()
{
	n=gi();
	for(int i=1;i*2<=n;i++)
		if(n%2)G.push_back(mp(i,n-i));
		else G.push_back(mp(i,n-i+1));
	if(n%2)G.push_back(mp(n,0));
	for(int i=0;i<G.size();i++)
		for(int j=i+1;j<G.size();j++)
		{
			int x=G[i].a,y=G[i].b,A=G[j].a,B=G[j].b;
			if(x && A)ans++;
			if(x && B)ans++;
			if(y && A)ans++;
			if(y && B)ans++;
		}
	printf("%d\n",ans);
	for(int i=0;i<G.size();i++)
		for(int j=i+1; j<G.size();j++)
			if(i!=j)
			{
				int x=G[i].a,y=G[i].b,A=G[j].a,B=G[j].b;
				if(x && A)printf("%d %d\n",G[i].a,G[j].a);
				if(x && B)printf("%d %d\n",G[i].a,G[j].b);
				if(y && A)printf("%d %d\n",G[i].b,G[j].a);
				if(y && B)printf("%d %d\n",G[i].b,G[j].b);
			}
	return 0;
}


Measured memory_bytes: 256
'use strict'

function main(input) {
  input = input
    .trim()
    .split(' ')
    .map(Number)

  const N = input[0]
  const K = input[1]
  let ans = 0
  if (K % 2 === 1) {
    // odd
    for (let i = 1; i <= N; i++) {
      if (i % K === 0) ans++
    }
    ans = Math.pow(ans, 3)
  } else {
    // even
    let tmp1 = 0
    let tmp2 = 0
    for (let i = 1; i <= N; i++) {
      const remain = i % K
      if (remain === 0) tmp1++
      if (remain === K / 2) tmp2++
    }
    ans += Math.pow(tmp1, 3)
    ans += Math.pow(tmp2, 3)
  }

  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 8392
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp  make_pair
#define pb  push_back
void c_p_c(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void solve(){
    int x,n;
    cin>>n>>x;
    int c=0;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        double m=a*a+b*b;
        m=sqrt(m);
        if(m<=x){
            c++;
        }
    }
    cout<<c<<endl;
}
int32_t main(){
    c_p_c();
    int t;
    t=1;
    //cin>>t;
    while(t--){
       solve(); 
    }
	return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    ll N;
    cin >> N;
    ll ans = 1;
    while(ans*ans <= N) {
        ans++;
    }
    ans--;
    cout << ans*ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void){
  int c(0),max(0);
  string s;
  cin>>s;
  size_t strlength=s.length();
  for(int i(0);i<strlength;i++){
    if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
      c++;
      if(c>=max)max=c;
    }else c=0;
  }
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 7;
int main() {
	int t, a, b, cnt = 0;
	string s, c, sl, sr;
	cin >> s;
	scanf("%d", &t); 
	while(t--) {
		scanf("%d", &a);
		if(a == 1) cnt = 1 ^ cnt;
		else {
			scanf("%d", &b);
			cin >> c;
			if(b == 2) {
				if(cnt) sl += c; else sr += c;
			}
			else {
				if(cnt) sr += c; else sl += c;
			}
		}
		//cout << s << endl;
	}
	reverse(sl.begin(), sl.end());
	s = sl + s;
	s = s + sr;
	if(cnt) reverse(s.begin(), s.end());
	cout << s << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

void insertion_sort(vector<int>& A, int n, int g, int& cnt)
{
  for (int i = g; i < n; ++i) {
    int key = A[i];
    int j = i - g;
    while (j >= 0 && A[j] > key) {
      A[j + g] = A[j];
      j -= g;
      ++cnt;
    }
    A[j + g] = key;
  }
}

void shell_sort(vector<int>& A, int n, int& cnt)
{
  vector<int> G;
  int h = 1;
  G.push_back(h);
  int upper = n / 2;
  if (n >= 1000) { upper = n / 9; }
  else if (n >= 100) { upper = n / 7; }
  for (int i = 3 * h + 1; i < upper; i = 3 * i + 1) {
    G.push_back(i);
  }
  reverse(G.begin(), G.end());
  int m = G.size();
  fprintf(stdout, "%d\n", m);
  for (int i = 0; i < m; ++i) {
    if (i) { fprintf(stdout, " "); }
    fprintf(stdout, "%d", G[i]);
  }
  fprintf(stdout, "\n");
  for (int i = 0; i < m; ++i) {
    insertion_sort(A, n, G[i], cnt);
  }
}

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<int> A(n);
  for (int i = 0; i < n; ++i) {
    fscanf(stdin, "%d", &A[i]);
  }
  int cnt = 0;
  shell_sort(A, n, cnt);
  fprintf(stdout, "%d\n", cnt);
  for (int i = 0; i < n; ++i) {
    fprintf(stdout, "%d\n", A[i]);
  }
  return 0;
}

Measured memory_bytes: 4960
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int main(){
  int a,b;
  while(cin>>a>>b)cout<<abs(a-b)<<endl;
}

Measured memory_bytes: 1160
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n,k;
  cin >> k >> n;
  int a[2*n+1]={0};
  for(int i=1;i<=n;i++){
    cin >> a[i];
    a[n+i]=a[i];
  }
  int ans = 0;
  a[n+1]=a[1]+k;
  for(int i=1;i<=n;i++){
    ans = max(ans,abs(a[i+1]-a[i]));
  }
  cout << k-ans << endl;

return 0;
}
///....


Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, maxp,num, d1, d2, max = -10000;
	while (1) {
		cin >> n;
		if (n == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			cin >> num >> d1 >> d2;
			if (d1 + d2 > max) {
				max = d1 + d2;
				maxp = num;
			}
		}
		cout << maxp<<" "<<max<<endl;
		max = -10000;
	}

return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=2e9+7;

int main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0); 
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    
    
    
       
    
    return 0;
}
    

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

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());
    //for(int i = 0; i < n;i++)cout << "a[" << i <<"] = " <<a[i] << endl;
    int sum = 0;
    for(int i = 0; i < n;){
        int x = upper_bound(a.begin(),a.end(),a[i]) - a.begin();
        if (a[i] < x - i)
            sum += (x - i) - a[i];
        else if (x - i < a[i])
            sum += x - i;
        //cout << "a[" << i <<"] = " <<a[i] << ", " << x << endl;

        i = x;
    }
    cout << sum << endl;
}



Measured memory_bytes: 3788
from collections import deque,defaultdict
T = {"rg":"bb","gr":"bb",
     "rb":"gg","br":"gg",
     "gb":"rr","bg":"rr"}
def change(s):
    for i in xrange(len(s)-1):
        if s[i:i+2] in T:
            yield "".join((s[:i],T[s[i:i+2]],s[i+2:]))

def BFS(s):
    d = deque()
    d.append((s,0))
    visited = defaultdict(bool)
    A = map(lambda c:len(s)*c, ("r","g","b"))
    while len(d) > 0:
        s,n = d.popleft()
        if s in A:
            return n
        for ns in change(s):
            if not visited[ns]:
                d.append((ns,n+1))
                visited[ns] = True
    return "NA"

while True:
    s = raw_input()
    if s == "0":
        break
    print BFS(s)

Measured memory_bytes: 6636
#include <stdio.h>
#include <string.h>

int main(){
	int a = 0,b = 0,o = 0,ab = 0,num;
	char blood[3];
	while(scanf("%d,%s",&num,blood) != EOF){
		if(!strcmp(blood,"A")) a++;
		else if(!strcmp(blood,"B")) b++;
		else if(!strcmp(blood,"O")) o++;
		else if(!strcmp(blood,"AB")) ab++;
	}
	printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
	return 0;
}

Measured memory_bytes: 1024
//ysh_gpta
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;


#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define IN(i,l,r) (l<i&&i<r)   //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)


#define repf(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define repfe(i,L,R) for (int i = L; i <= R; i++)
#define repb(i,L,R) for (int i = L; i > R; i--)
#define repbe(i,L,R) for (int i = L; i >= R; i--)


typedef long long ll;
#define cerr if(false)cerr
#define vb vector<bool>
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define mkp make_pair
#define pb push_back
#define INF 1000000000000000
#define MOD 1000000007
#define ff first
#define ss second


#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


ll gcd( ll a, ll b ){if(b==0) return a; else return gcd( b, a%b );}
ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}


vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};


int main(){
    FastIO
    ll n;
    cin>>n;
    vvi v(n,vi(n));
    repf(i,0,n) repf(j,0,n) cin>>v[i][j];
    vi dp((1<<n),0);
    repf(mask,1,(1<<n)){
        repf(i,0,n){
            if(mask & (1<<i)){
                repf(j,i+1,n){
                    if(mask & (1<<j))
                    dp[mask] += v[i][j];
                }
            }
        }
    }

    repf(mask,1,(1<<n)){
        for(ll ss=mask; ss>0; ss=(ss-1)&mask){
            dp[mask] = max(dp[mask],dp[ss]+dp[ss ^ mask]);
        }
    }
    cout<<dp[(1<<n) - 1];
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a, b, c;
    cin>>a>>b;
    if(a>=13){
        c=b;
    }
    else if(a>=6){
        c=b/2;
    }
    else{
        c=0;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
using namespace std;

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

  string s;
  int k;
  cin >> s >> k;
  vector<string> str;

  rep(i, s.length()) {
    // j <= k
    for(int j = 1; i+j <= s.length() && j <= k; ++j) {
      str.push_back(s.substr(i, j));
    }
  }
  sort(all(str));
  str.erase(unique(all(str)), str.end());

  cout << str[k-1] << '\n';
  return 0;
}


Measured memory_bytes: 1660
import math

s = input().split()

A = int(s[0])
B = int(s[1])
H = int(s[2])
M = int(s[3])

mi = 6 * M
ho = 30 * H + 1/2 * M

kakudo = abs(mi - ho)

length = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))

print(length)

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

using namespace std;

template <class T> void mini(T &l, T r) {l = min(l, r);}
template <class T> void maxi(T &l, T r) {l = max(l, r);}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(bool a) {
  return a ? "T" : "F";
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
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 LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = long long;
using ld = long double;

const int N = 1e5 + 10;

int n;
int x[N], y[N], t[N];

void run() {
  cin >> n;
  x[0] = 0, y[0] = 0, t[0] = 0;
  bool ok = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> t[i] >> x[i] >> y[i];
    int tt = abs(y[i] - y[i - 1]) + abs(x[i] - x[i - 1]);
    if (t[i] - t[i - 1] >= tt && (t[i] - t[i - 1] - tt) % 2 == 0) {
    } else {
      ok = 0;
    }
  }
  puts(ok ? "Yes" : "No");
}

int main() {
  run();
  return 0;
}


Measured memory_bytes: 1408
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz size
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 2*1e5+1;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b;
    int pwur = qpow(b,e>>1);
    return pwur * pwur;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// Criba de Eratostenes ------------------------------------
const int pr=10000;
map<int,int>isp;
void criba(){
    for(int i=0;i<=pr;i++)isp[i]=i;
    isp[0]=isp[1]=-1;
    for(int i=2;i*i<=pr;i++){
        if(isp[i]==i){
        for(int j=i+i;j<=pr;j+=i)
            isp[j]=i;
        }
    }
}
/// My Code -------------------------------------------------


int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    ///freopen("a.in","r",stdin);
    ///freopen("a.out","w",stdout);
    ///criba();
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    if(x<y){
        swap(a,b);
        swap(x,y);
    }
    int ans1=0,ans2=a*x+b*y,ans3=2*x*c;
    ans1+=2*c*y;
    x-=y;
    ans1+=a*x;

    cout<<min({ans1,ans2,ans3})<<enl;

    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	int n;
	cin >> n;
	if (n % 2 == 0) { cout << (double)n / 2.0 / (double)n << endl; }
	else{ cout << (double)(n / 2 + 1)/ (double)n << endl; }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  int N, K;
  cin >> N >> K >> S;
  if (S.at(K - 1) == 'A') {
    S.at(K - 1) = 'a';
  }
  else if (S.at(K - 1) == 'B') {
    S.at(K - 1) = 'b';
  }
  else {
    S.at(K - 1) = 'c';
  }
  cout << S << endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N, Y;
	cin >> N >> Y;
	rep(i, N + 1) {
		rep(j, N - i + 1) {
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y) {
				cout << i << " " << j << " " << N - i - j << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}


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


int main(){

    int N, A[100002];
    cin >> N;
    for( int i = 1; i <= N; i++ ) cin >> A[i];
    

    int total = 0;

    for( int i = 0; i <= N; i++ ) total += abs( A[i+1] - A[i] );

    for( int i = 1; i <= N; i++ ){
        int ans;
        ans = total - abs( A[i] - A[i-1] ) - abs( A[i+1] - A[i] ) + abs( A[i+1] - A[i-1] );
        cout << ans << endl;
    }

    return 0;

}

Measured memory_bytes: 1664
/* vim:set foldmethod=marker: */
#include <bits/stdc++.h>
using namespace std;

//{{{
#define all(x) (x).begin(),(x).end()
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define RREP(i,a,b) for(int i=(int)(a); i>=b; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;

#define dump(x) (cerr << #x << "=" << x << endl)
template<class T> ostream& osContainer(ostream& os,T c) { os<<'[';for(decltype(c.begin()) it=c.begin();it!=c.end();it++)os<<*it<<',';os<<']';return os; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { return osContainer(os,v); }
template<class T> ostream& operator<<(ostream& os,const set<T>& s) { return osContainer(os,s); }
template<class T> ostream& operator<<(ostream& os,const multiset<T>& s) { return osContainer(os,s); }
template<class T,class S> ostream& operator<<(ostream& os,const map<T,S>& m) { return osContainer(os,m); }
template<class T,class S> ostream& operator<<(ostream& os,const multimap<T,S>& m) { return osContainer(os,m); }
template<class T1,class T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p){ os << '(' << p.first << ',' << p.second << ')'; return os; }

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


void solve()
{
    int n, m, a;

    while (cin >> n >> m >> a, n||m||a) {
        int s[101];
        vector<pair<int, int>> v[1001];
        rep(i, n+1) s[i] = i;
        rep(i, m) {
            int h, p, q;
            cin >> h >> p >> q;
            v[h].push_back(mp(p, q));
        }

        RREP(i, 1000, 1) {
            int ss[n+1];
            rep(j, n+1) ss[j] = j;

            for(auto x : v[i]) {
                ss[x.first] = x.second;
                ss[x.second] = x.first;
            }

            rep(j, n+1) s[j] = ss[s[j]];
        }

        cout << s[a] << endl;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(12);
    solve();
}

Measured memory_bytes: 3264
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main() {
  int a,b,ans=0,c;
  cin>>a>>b;
  rep(i,a){
    cin>>c;
    if(c>=b) ans++;
  }
  cout<<ans;
  return 0;
}


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

using ll = long long;
const ll INF = 1e18L + 5;

int main(int argc, char const *argv[]){
  cin.tie(0);
  cout.tie(0);

  int n,w;
  cin >> n >> w;

  vector<int>weight(n),value(n);

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

  int sum_values = 0;
  for(int i=0;i<n;i++){
    sum_values = sum_values + value[i];
  }

  vector<ll>dp(sum_values+1, INF);
  dp[0]=0;
  for(int i=0;i<n;i++){
    for(int j=sum_values-value[i];j>=0;j--){
      dp[j+value[i]] = min(dp[j+value[i]], dp[j]+weight[i]);
    }
  }

  ll res = 0;

  for(int i=0;i<=sum_values;i++){
    if(dp[i]<=w){
      res = max(res,(ll)i);
    }
  }

  cout << res;
  return 0;
}

Measured memory_bytes: 1024
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(*args):
    print(*args,file=sys.stderr)

def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
     
#input

                
def resolve():
    s=input()
    ans=0
    for char in range(1,len(s)):
        ans+=s[char]!=s[char-1]
    print(ans)
        #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()

"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """BBBWW"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """WWWWWW"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """WBWBWBWBWB"""
        output = """9"""
        self.assertIO(input, output)

if __name__=="__main__":resolve()

Measured memory_bytes: 84312
#include <iostream>
#include <utility>
#include <vector>

int main() {
    auto n = 0;
    auto max_weight = 0;

    std::cin >> n >> max_weight;

    using Weight = int;
    using Value = std::uint64_t;

    auto items = std::vector<std::pair<Weight, Value>>();
    for (auto i_ = 0; i_ < n; ++i_) {
        auto w = 0;
        auto v = 0;
        std::cin >> w >> v;
        items.emplace_back(w, v);
    }

    auto memo = std::vector<Value>(static_cast<std::size_t>(max_weight) + 1);

    auto max_value = Value(0);
    for (const auto& item : items) {
        const auto w = item.first;
        const auto v = item.second;

        for (auto i = max_weight - w; i >= 0; --i) {
            const auto sum_w = i + w;
            const auto sum_v = memo[i] + v;

            if (sum_v > memo[sum_w]) {
                memo[sum_w] = sum_v;

                if (sum_v > max_value) max_value = sum_v;
            }
        }
    }

    std::cout << max_value << std::endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define MOD 1000000007

using namespace std;



int main()
{
   FAST/**/
   
   ll cp = 0;
   multiset<ll> ms,ms1;
   ll cnt = 0;
   ll q;
   cin>>q;
   ll sum1 = 0;
   ll sum2 = 0;
   ll cons = 0;
   
   while(q--)
   {
       ll t;
       cin>>t;
       
       if(t == 1)
       {
           ll a,b;
           cin>>a>>b;
           cons+=b;
           
           cnt++;
           
           if(cnt == 1)
           {
               ms.insert(a);
               cp = a;
               sum1+=a;
               //cnt++;
               continue;
           }
           
           if(cnt%2 == 1)
           {
               if(a<=cp)
               {
                   ms.insert(a);
                   sum1+=a;
                   cp = *ms.rbegin();
               }
               
               else
               {
                   ll temp = *ms1.begin();
                   ms1.erase(ms1.begin());
                   sum2-=temp;
                   
                   ms.insert(min(temp,a));
                   ms1.insert(max(temp,a));
                   
                   sum1+=min(temp,a);
                   sum2+=max(temp,a);
                   
                   cp = *ms.rbegin();
               }
           }
           
           else
           {
               if(a<=cp)
               {
                   ms.erase(ms.find(cp));
                   sum1-=cp;
                   ms1.insert(cp);
                   sum2+=cp;
                   ms.insert(a);
                   sum1+=a;
                   cp = *ms.rbegin();
               }
               
               else
               {
                    ms1.insert(a);
                    sum2+=a;
               }
           }
           continue;
           
       }
       
       cout<<cp<<" ";
       ll temp = ms.size()*cp - ms1.size()*cp - sum1 + sum2 + cons;
       cout<<temp<<"\n";
   }
   
   return 0;
}

Measured memory_bytes: 9600
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,m,i,flg,a[1000],b[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	scanf("%d",&m);
	for(i=0;i<m;i++)	scanf("%d",&b[i]);
	i=0;
	while(1)	{
		if(i==n && i==m)	{
			flg=0;	break;
		}
		if(i==n || a[i]<b[i])	{
			flg=1;	break;
		}
		if(i==m || a[i]>b[i])	{
			flg=0;	break;
		}
		i++;
	}
	printf("%d\n",flg);
	return 0;
}


Measured memory_bytes: 2772