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

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

int H, W;

const int MAX = 400;

int a[MAX][MAX];
int visited[MAX][MAX];

int dfs(int x, int y) {
	visited[x][y] = 1;
	int res = 0;
	for (int i = 0; i < 6; i++) {
		int tx = x + dx[i], ty = y + dy[i];
		if (0 <= tx && tx < H + 200 && 0 <= ty && ty < W + 200) {
			if (a[tx][ty]) {
				res++;
			}
			else if (!visited[tx][ty]) {
				res += dfs(tx, ty);
			}
		}
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int H, W;
	cin >> W >> H;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i + 1][j + 1 + i / 2];
		}
	}
	cout << dfs(0, 0) << endl;
	return 0;
}



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


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

    int p = K;

    for (int i = 0; i < N - 1; i++)
    {
        p = p * (K - 1);
    }

    cout << p;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

int n,k; cin >> n >> k;
if(n%k == 0) cout << 0 << endl;
else cout << 1 << endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    if(S=="hi"||S=="hihi"||S=="hihihi"||S=="hihihihi"||S=="hihihihihi")cout << "Yes" <<endl;
    else{
        cout << "No" <<endl;
    }
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a.sort()

l = 0
r = n - 1

def hantei(c):
    a1 = a[:c] + a[c+1:]
    tmp = a[c]
    flag = True
    for i in a1:
        if tmp * 2 >= i:
            tmp += i
        else:
            flag = False
            break
    return flag


while r - l > 1:
    c = int((l + r)//2)
    if hantei(c):
        r = c
    else:
        l = c

if hantei(l):
    print(n - l)
else:
    print(n - l - 1)


Measured memory_bytes: 20604
#include <stdio.h>
using namespace std;
int main(void){
   int a,i,j,H,W;
  
   while(1){
     scanf("%d %d",&H,&W);
   if(H==0&&W==0)break;
for ( int i = 0; i < H; i++ ){
  // if(){
    //  for(int j=0;j<W;j++)
  //    printf("#");
  // printf("\n");
  // }else{
   
   
   
   
    for ( int j = 0 ; j < W; j++ ){
       a=i+j;
        if(a%2==0){
            printf("#");
        } else {
            printf(".");
        }
    }
    printf("\n");
}
 printf("\n");
       
   }


    
}

    



Measured memory_bytes: 2608
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin>>n>>s;
    char last = '!';
    int cnt=0;
    for(int i=0;i<n;i++){
        if(last==s[i])
            continue;
        last=s[i];
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 512
a = input()
l =list(map(int, input().split()))
t = 0
for i,j in zip(l,l[1:]):
    if i-j==1:t+=1
    elif i-j>1:t+=2
    elif j-i>0:t=0
    if t>1:
        print("No")
        exit(0)
print("Yes")

Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
bool pal(string t){
	string p = t;
	reverse(p.begin(), p.end());
	return p == t;
}
int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    if(pal(s) && pal(s.substr(0, (n - 1) / 2)) && pal(s.substr((n + 3) / 2 - 1, n - ((n + 3) / 2 - 1))))cout << "Yes"; else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>

const long INF = (1l << 30);
const long LINF = (1l << 60);


void solve(long n){
	for(long b = 50000; b > 0; b--){
		if((2*n - b*(b-1)) % (2*b) == 0 && (2*n - b*(b-1)) / (2*b) > 0){
			long a = (2*n - b*(b-1)) / (2*b);
			printf("%ld %ld\n", a, b);
			return;
		}
	}
}

int main(){
	while(1){
		long b;
		scanf("%ld", &b);
		if(b == 0){
			return 0;
		}else{
			solve(b);
		}
	}
}



Measured memory_bytes: 3156
#include <iostream>
using namespace std;
long long gcd( long long a, long long b )
{
  long long t;
  if( a < b ){ t = a; a = b; b = t; }
  while( ( t = a % b ) != 0 ){ a = b; b = t; }
  return b;
}
long long lcm( long long a, long long b )
{
  return a * b / gcd(a,b);
}
int main( void )
{
  long long a,b;
  while( 1 ){
    cin >> a >> b;
    if( cin.eof() ) break;
    cout << gcd( a, b ) << ' ' << lcm( a, b ) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
a,b = map(int, input().split())
b+=1
x = list(map(int, input().split()))
dp = [0]+[10**10]*(a-1)
dp = [0]+[float("inf")]*(a-1)
dp[1] = abs(x[1]-x[0])
for i,h in enumerate(x):
    for j in range(i+1,min(i+b,a)):
        dp[j] = min(dp[j],dp[i]+abs(h-x[j]))
#print(dp)
print(dp[a-1])

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int K, N, ans=0;

	cin >> K >> N;

	if( K % 2 == 0 ){
		cout << K/2 << " ";
		rep(i,N-1) cout << K << " ";
		cout << endl;
	}else{
		vector<int> ans;
		rep(i,N) ans.push_back( (K+1)/2 );
		rep(i,N/2){
			if( ans.back() == 1 ) ans.pop_back();
			else{
				ans.back() -= 1;
				while(ans.size() < N) ans.push_back(K);
			}
		}
		for(auto t: ans) cout << t << " "; cout << endl;
	}

	return 0;
}

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

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

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

    int count = 0;
    for (int i = 0; i < n; i++){
        if (i + 1 != data.at(i)){
            count++;
        }
    }

    if (count < 3){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int main(){
    string s;
    cin >> s;
    cout << s.substr(0,sz(s) - 8) << endl;
    return 0;
}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll A,B,C;
ll ans;
int main() {
    cin>>A>>B>>C;
    ans += 2*min(B,C);
    ll mnBC= min(B,C);
    C-=mnBC;
    B-=mnBC;
    ans+=B;
    ans += min(A,C);
    C-=min(A,C);
    ans+=(C>0);
    p(ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

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

    int r = 0;
    for (int i = 0; i < n - 2; i++) {
        int q[3];
        for (int j = 0; j < 3; j++) {
            q[j] = p[i + j];
        }
        sort(q, q + 3);
        if (p[i + 1] == q[1]) r++;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (auto& x : p) cin >> x;
  
  int ans = 0;
  set<int> se;
  for (auto& x : p) {
    auto it = se.lower_bound(-x);
    if (it == se.end()) ans++;
    se.insert(-x);
  }
  cout << ans << endl;
}

Measured memory_bytes: 10368
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Break Number
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  int k = 1;
  while ((k << 1) <= n) k <<= 1;
  printf("%d\n", k);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking 
#define fi first
#define se second
#define BG begin
#define ED end

#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2

#define INF (1ll<<60)
using namespace std;
/*
int n,a[200005];
int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d",&a[i]),a[i]-=i;
	sort(a+1,a+n+1);
	ll ans=0; int md=(1+n)/2;
	For(i,1,n) ans+=abs(a[i]-a[md]);
	printf("%lld\n",ans);
}
*/
const int N=265000;
int a[N],mx[N][2],ans[N],n;
int main(){
	scanf("%d",&n); a[(1<<n)]=-1e9;
	For(i,0,(1<<n)-1) scanf("%d",&a[i]);
	For(i,0,(1<<n)-1) mx[i][0]=i,mx[i][1]=(1<<n);
	For(i,0,n-1) For(j,0,(1<<n)-1)
		if (j&(1<<i)){
			int k=j-(1<<i);
			if (a[mx[j][0]]<a[mx[k][0]])
				mx[j][1]=mx[j][0],mx[j][0]=mx[k][0];
			else if (a[mx[j][1]]<a[mx[k][0]])
				mx[j][1]=mx[k][0];
			if (a[mx[j][1]]<a[mx[k][1]])
				mx[j][1]=mx[k][1];
		}
	For(i,1,(1<<n)-1) ans[i]=a[mx[i][0]]+a[mx[i][1]];
	For(i,1,(1<<n)-1) printf("%d\n",ans[i]=max(ans[i],ans[i-1]));
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
int main() {
   string s;
  string t;
  cin >>s;
   
  for (int i = 0;i < 19;i++){
	if (i == 5){
      t = t + ' ';
    }else if(i == 13){
      t = t + ' ';
    }else{
    	t = t + s.at(i);
  }
  }
  
  cout << t << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		//????????£?????????????????§????????????????????????
				//????????\???
				Scanner sc = new Scanner(System.in);

				//int???????????? ??????
			     int S = sc.nextInt();
			     int  h = S / 3600;

			     //int???????????? ???

			      int m = S   / 60 % 60 ;
			     //int????????? ?§?

			      int s = S  % 60;
			     //????????????????§??????¨???
			     System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 26156
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
	var N = parseInt(input[0][0], 10);
	var T = parseInt(input[0][1], 10);
	var arr_AB = [];
	for (var i = 0; i < N; i++){
		arr_AB.push(input[i + 1].map(e => parseInt(e, 10)));
	}
	arr_AB.sort((a,b) => a[1] - b[1]);
	var dp = [];
	var Ai, Bi;
	dp.push(Array.from({length: T + 1}, () => 0));
	for (var i = 0; i < N; i++){
		dp.push([]);
		Ai = arr_AB[i][0];
		Bi = arr_AB[i][1];
		for (var j = 0; j < T + 1; j++){
			// console.log(i, j, dp);
			if (Ai <= j){
				if (dp[i][j] >= dp[i][j - Ai] + Bi){
					dp[i + 1][j] = dp[i][j];
				} else {
					dp[i + 1][j] = dp[i][j - Ai] + Bi;
				}

			} else {
				dp[i + 1][j] = dp[i][j];
			}
			// dp[i + 1][j][1] = Math.max(dp[i][j][1], dp[i][j][0] + Bi);
		}	
	}

	var lastOrder1;
	lastOrder1 = dp[N - 1][T - 1] + arr_AB[N - 1][1];
	
	var currentOrderList = [];
	var tmp = N;
	var j = T -1;
	whole_loop:
	while (j > 0){
		while (true){
			if (tmp === 0) break whole_loop;
			if (dp[tmp][j] === dp[tmp - 1][j]) tmp--;
			else {
				currentOrderList.push(tmp - 1);
				j -= arr_AB[tmp - 1][0];
				tmp--;
				continue whole_loop;
			}
		}	
	}
	for (var x of currentOrderList){
		arr_AB.splice(x, 1);
	}
	var lastOrder2 = 0;
	if (arr_AB.length > 0) lastOrder2 = dp[N][T - 1] + arr_AB[arr_AB.length - 1][1];
	console.log(Math.max(dp[N][T], lastOrder1, lastOrder2));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 167232
#include <iostream>
using namespace std;
int main () {
  int X;
  cin >> X;
  if (X < 100) {
    cout << 0;
    return 0;
  }

  bool dp[X+1]; 
  dp[X] = 0;
  dp[0] = 1;
  for (int i = 0; i < 100; ++i) {
    dp[i] = 0;
  }
  dp[100] = 1;
  dp[101] = 1;
  dp[102] = 1;
  dp[103] = 1;
  dp[104] = 1;
  dp[105] = 1;

  for (int i = 106; i < X+1; ++i) {
    if( 
     dp[i - 100] ||
     dp[i - 101] ||
     dp[i - 102] ||
     dp[i - 103] ||
     dp[i - 104] ||
     dp[i - 105]
     ) { 
      dp[i] = 1;
    } else {
      dp[i] = 0;
    }   
  }
  cout << dp[X];
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
using ll=long long;
typedef pair<int,int> P;
string s;



int main(){
    ll n,k;cin>>n>>k;
    ll x,y;
    x=n%k;
    y=k-x;
    cout<<min(x,y)<<endl;
}    

Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    int a, b; std::cin >> a >> b;
    std::vector<std::string> dict(2);
    for(int i=0; i<b; i++)
    {
        dict[0] += std::to_string(a);
    }
    for(int i=0; i<a; i++)
    {
        dict[1] += std::to_string(b);
    }
    if(dict[0]<dict[1]) std::cout << dict[0] << std::endl;
    else std::cout << dict[1] << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[5],i,p;
    for(i=0; i<5; i++)
        cin>>a[i];
    for(i=0; i<5; i++)
    {
        if(a[i]==0)
        {
            p=i+1;
        }
    }
    cout<<p;
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

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

int main() {
    int a, b;
    char op;
    cin >> a >> op >> b;
    cout << (op == '+' ? a + b : a - b) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
typedef long long ll;
#define INF 20000000
#define rep(i,n) for(ll i=0;i<n;++i)
#define REP(i,k,n) for(ll i=k;i<n;++i)
ll n;
std::vector<ll> h;

int main(){
    std::cin >> n;
    h=std::vector<ll>(n);
    rep(i,n){
        std::cin >> h[i];
    }
    std::vector<ll> dp(100001,INF);
    dp[0]=0;
    dp[1]=std::abs(h[1]-h[0]);
    
    for(ll i=2;i<n;++i){
        dp[i]=std::min(std::abs(h[i]-h[i-1])+dp[i-1],std::abs(h[i]-h[i-2])+dp[i-2]);
    }
    std::cout << dp[n-1] << std::endl;
    return 0;
}


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

int main()
{
	int m1,m2,d1,d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;
	
	if (m1%2 != 0)
	{
		if (m1+1 == m2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
	else
	{
		if (m1+1 == m2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
A = [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]

K = input()
print A[K - 1]


Measured memory_bytes: 2568
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var k = NextInt;
        var x = NextInt;
        for (int i = x - k + 1; i < x + k; i++)
        {
            Console.WriteLine(i);
        }
    }


    static readonly TextReader In = Console.In;
    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = In.Read();
            int rev = 1;
            while (45 > next || next > 57) next = In.Read();
            if (next == 45) { next = In.Read(); rev = -1; }
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = In.Read();
            }
            return res * rev;
        }
    }
}


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


const int MAX_N = 200000 * 2; // 要素数
int par[MAX_N]; // 親の番号
int rank_[MAX_N]; // 各要素の木のrank

// n要素で初期化
void init(int n){
	rep(i,n) par[i] = i;
}

// xの親
int root(int x){
	if(par[x] == x) return x;
	else return par[x] = root(par[x]); // 経路圧縮
}

// xとyが同じ集合に属するかどうか
bool same(int x, int y){
	return root(x) == root(y);
}

// xとyの属する集合を併合
void unite(int x, int y){
	int rx = root(x);
	int ry = root(y);
	if(rx == ry) return;
	par[rx] = ry;
}

int main(){
	
	int n,k,l;
	cin >> n >> k >> l;
	
	
	// x, x+n を道路で連結組、線路で連結組として処理
	init(n*2);
	
	rep(i,k){
		// 道路で連結
		int p,q;
		cin >> p >> q;
		--p; --q;
		unite(p,q);
	}
	rep(i,l){
		// 線路で連結
		int r,s;
		cin >> r >> s;
		--r; --s;
		unite(r+n,s+n);
	}
	
	map<pair<int,int>,int> mp;
	
	rep(i,n) mp[make_pair(root(i), root(i+n)-n)]++;
	rep(i,n) cout << mp[make_pair(root(i), root(i+n)-n)] << endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  int A = nextInt();
  int B = nextInt();

  int count[3] = {0};
  REP(_, N) {
    int P = nextInt();
    if (P <= A) { count[0]++; }
    else if (P <= B) count[1]++;
    else count[2]++;
  }
  int ans = *min_element(count, count + 3);
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat May  2 21:32:03 JST 2020
 **/

signed main() {
    Int n, a, b;
    std::cin >> n >> a >> b;
    a--;
    std::cout << (a / n != b / n ? "OK" : "NG") << std::endl;
}


Measured memory_bytes: 3612
#!/user/bin/env python3

n = int(input())
t = [-1 for _ in range(n)]
x = [-1 for _ in range(n)]
y = [-1 for _ in range(n)]
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())

dt = [-1 for _ in range(n)]
dx = [-1 for _ in range(n)]
dy = [-1 for _ in range(n)]
for i in range(n):
    if i == 0:
        dt[0] = t[0]
        dx[0] = x[0]
        dy[0] = y[0]
    else:
        dt[i] = t[i] - t[i-1]
        dx[i] = x[i] - x[i-1]
        dy[i] = y[i] - y[i-1]

ok = True
for i in range(n):
    tr = dt[i]%2
    pr = (dx[i]+dy[i])%2
    if (tr == pr) and (dt[i] >= abs(dx[i])+abs(dy[i])):
        pass
    else:
        ok = False
#        import pdb; pdb.set_trace()
        break

if ok:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 21612
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005
/* The judge is never wrong! Your code is buggy ??
   Look for:
 * * an easier and alternate approach
 * * if concept is corret and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
 */
 
 
 
 
int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
 //cc
        int r;
        cin >> r;
        double x=6.28318530717958623200;
        double ans=x*r;
        cout << fixed << setprecision(12) << ans << '\n';
 
}

Measured memory_bytes: 3796
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    vec l(m),r(m);
    rep(i,m){
        cin>>l[i]>>r[i];
    }
    int lll=l[0];
    int rrr=r[0];
    rep(i,m){
        chmax(lll,l[i]);
        chmin(rrr,r[i]);
    }
    if(rrr-lll<0){
        cout<<0<<endl;
    }
    else{
        cout<<rrr-lll+1<<endl;
    }
    
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
    string S;
    cin >> S;
    // RとLの境目に人が集まる
    // ...RL...から偶数距離と奇数距離でRとLのどちらのマスに止まるかが決まる
    // 左から見て行ってRの数を数え上げてからLを見つけたらカウントの半分を代入する
    int len = S.length();
    int cnt = 0;
    vector<int> ans(len);
    rep(i,len){
        if(S[i]=='R'){
            cnt++;
        }else if(S[i-1]=='R'&&S[i]=='L'){
            ans[i] += cnt/2;
            ans[i-1] += (cnt+1)/2; // cntが奇数個ならi-1のほうが1多い
            cnt = 0;
        }
    }
    for(int i=len-1;i>=0;i--){
        if(S[i]=='L'){
            cnt++;
        }else if(S[i+1]=='L'&&S[i]=='R'){
            ans[i] += cnt/2;
            ans[i+1] += (cnt+1)/2; // cntが奇数個ならi-1のほうが1多い
            cnt = 0;
        }
    }

    rep(i,len-1){
        cout << ans[i] << " ";
    }
    cout << ans[len-1] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
string s;

int main() {
	cin >> s;
	int n = s.size();

	for (int i = 0; i < n; i++) {
		if (s[i] == 'P') {
			cout << 'P';
		}
		else {
			cout << "D";
		}
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 3752
x, y = map(int, input().split())
if(x==y): print("Yes")
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if((x in a and y in a) or (x in b and y in b)): print("Yes")
else: print("No")

Measured memory_bytes: 3316
#include<stdio.h>

int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,h,e,f;
  int o[86401];
  
  while(scanf("%d",&n),n){
    for(i=0;i<86401;i++)o[i]=0;
    p=0;
    for(i=0;i<n;i++){
      scanf("%d:%d:%d %d:%d:%d"
     ,&a,&b,&c,&d,&e,&f);
      o[a*3600+b*60+c]++;
      o[d*3600+e*60+f]--;
    }
    for(i=m=0;i<86401;i++){
      p+=o[i];
      if(m<p)m=p;
    }
    printf("%d\n",m);
  }
  return 0;}

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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int tmp = -1;
    rep(i,n){
        if(tmp <= h[i]-1) tmp = h[i]-1;
        else if(tmp == h[i]) tmp = h[i];
        else {
            printf("No");
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 1 ; i < n ; i++){
        int cnt = 0;
        for(char c = 'a' ; c <= 'z' ; c++){
            bool x = false, y = false;
            for(int j = 0 ; j < i ; j++){
                if(s[j] == c){
                    x = true;
                }
            }
            for(int j = i ; j < n ; j++){
                if(s[j] == c){
                    y = true;
                }
            }
            if(x && y){
                cnt++;
            }
        }
        if(ans < cnt){
            ans = cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int D, G;
  cin >> D >> G;
  int p[D], c[D];
  int P = 0;
  //cout << P << endl;;
  rep(i,D) {
    cin >> p[i] >> c[i];
    P += p[i];
  }
  int c_min = P;
  rep(bit,(1 << D)){
    int score = 0;
    int c_tmp = 0;
    //cout << bit << endl;
    rep(i,D) {
      if(bit & (1 << D-i-1)) {
        score += p[i]*100*(i+1) + c[i];
        c_tmp += p[i];
      }
    }
    if (score < G){
      int digit = -1;
      int j = 0;
      while(j<D) {
        
        if (!((bit & (1 << j)))) {
          digit = D-j-1;
          break;
        }
        j++;
      }
      if (digit != -1) {
        int j= 0;
        while(j<p[digit]) {
          j++;
          score += 100*(digit+1);
          c_tmp ++;
          if (score>=G) {
            break;
          }
        }
      }
      if ((score>=G)&&(c_tmp<c_min)) {
        c_min = c_tmp;
      }
    }
    else {
      if ((score>=G)&&(c_tmp<c_min)) {
        c_min = c_tmp;
      }  
    }
    

  }
  cout << c_min << endl;
}

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


def dsMakeSet(ds, x):
    ds[x] = x


def dsFind(ds, x):
    if ds[x] == x:
        return x

    x0 = x
    while ds[x] != x:
        x = ds[x]

    ds[x0] = x
    return x


def dsUnion(ds, x, y):
    xRoot = dsFind(ds, x)
    yRoot = dsFind(ds, y)
    
    if xRoot != yRoot:
        ds[yRoot] = xRoot
        return True

    return False



def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]

    ds = {}
    for i in range(H):
        s0 = S[i-1] if i > 0 else None
        s1 = S[i]

        for j in range(W):
            dsMakeSet(ds, (i, j))

            if j > 0 and s1[j-1] != s1[j]:
                dsUnion(ds, (i, j-1), (i, j))
                
            if i > 0 and s0[j] != s1[j]:
                dsUnion(ds, (i-1, j), (i, j))
            
    bCnt = {}
    wCnt = {}

    for x in ds:
        y = dsFind(ds, x)
        
        if not y in bCnt:
            bCnt[y] = 0
            wCnt[y] = 0

        if S[x[0]][x[1]] == '#':
            bCnt[y] += 1
        else:
            wCnt[y] += 1

    s = sum(bCnt[x]*wCnt[x] for x in bCnt)
    print(s)
                

    


if __name__ == '__main__':
    main()


Measured memory_bytes: 35792
#include <iostream>
#include <set>
#include <vector>

int main()
{
    int n;
    std::cin >> n;

    std::vector<int> p(n);
    std::vector<int> idx(n);

    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
        p[i]--;
        idx[p[i]] = i;
    }

    long long ans = 0;

    std::set<int> s;

    for (int i = n - 1; i >= 0; i--) {
        int id = idx[i];
        s.insert(id);

        std::vector<int> l(2, -1);
        auto center = s.find(id);
        for (int j = 0; j < 2; j++) {
            if (center == s.begin()) {
                break;
            }
            center--;
            l[j] = *center;
        }

        std::vector<int> r(2, n);
        center = s.find(id);
        for (int j = 0; j < 2; j++) {
            center++;
            if (center == s.end()) {
                break;
            }
            r[j] = *center;
        }

        std::vector<int> ls(2), rs(2);
        ls[0] = id - l[0];
        ls[1] = l[0] - l[1];
        rs[0] = r[0] - id;
        rs[1] = r[1] - r[0];

        long long range = (long long)(ls[0] * rs[1]) + (long long)(ls[1] * rs[0]);
        ans += range * (i + 1);
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

#define INF 1e+9




int main(){

ios::sync_with_stdio(false);
cin.tie(0);

long long int n,m;
cin>>n>>m;

long long int a[m];
long long int sumi=0;

for(long long int i=0;i<m;i++){
cin>>a[i];
sumi+=a[i];
}

long long int t=n-sumi;

if(t<0){
cout<<-1<<endl;
}else{
cout<<t<<endl;
}

}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    string A,B,C;
    cin >> A >> B >> C;
    char tmp = 'a';
    char ans;
    while (true){
        if (tmp=='a'){
            if (A.size() == 0){
                ans = 'A';
                break;
            }
                tmp = A[0];
                A.erase(A.begin());
            
        }else if (tmp=='b'){
            if (B.size() == 0){
                ans = 'B';
                break;
            }
                tmp = B[0];
                B.erase(B.begin());
            
        }else{
            if (C.size() == 0){
                ans = 'C';
                break;
            }
                tmp = C[0];
                C.erase(C.begin());
            
        }
    }
    cout << ans << endl;



    
}

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

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

    vector<int> As;
    int total = 0;
    for (int i = 0; i < N; ++i) {
        int A; cin >> A;
        As.push_back(A);
        total += A;
    }

    int ok = 0;
    for (int i = 0; i < N; ++i) {
        if ((4*M)*As[i] >= total) {
            ++ok;
        }
    }
    if (ok >= M) {
        puts("Yes");
    } else {
        puts("No");
    }
}


Measured memory_bytes: 256
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
memo = [0]*n
 
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    if memo[a] < h[b]:
        memo[a] = h[b]
    if memo[b] < h[a]:
        memo[b] = h[a]

for i in range(n):
    if memo[i] < h[i]:
        ans += 1

print(ans)

Measured memory_bytes: 19976
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ab = readInts()
    if ab[0] < ab[1] * 2 {
        print("0")
    } else {
        print(ab[0] - ab[1] * 2)
    }
}

main()


Measured memory_bytes: 8252
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let h: u64 = sc.cin();
    let n: usize = sc.cin();
    let hs: Vec<u64> = sc.vec(n);
    if h <= hs.iter().sum::<u64>() {
        put!("Yes");
    } else {
        put!("No");
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 11508
#include <cstdio>

#define min 1000
#define mid 5000
#define max 10000

bool midToMin(int N, int money[], int count)
{
	int tmpMin=money[2], tmpMid=money[1];

	for(int i=0; i<money[1]; i++){
		tmpMid -= 1;
		tmpMin += 5;
		count += 4;
		if(count == N){
			money[1] = tmpMid; 
			money[2] = tmpMin;
			return true;
		}
	}
	return false; 
}


void maxToMid(int N, int money[], int count, bool *flag)
{
	int num = money[0];
	if(midToMin(N, money, count)) return;
	for(int i=0; i<num; i++){
		money[0] -= 1;
		money[1] += 2;
		count +=1;
		if(count == N) return;
		if(midToMin(N, money, count)) return;
	}
	*flag = false;
	return;
}



int main()
{
	int N, Y, ans, tmp, money[3], count;
	bool flag = true;
	scanf("%d", &N);
	scanf("%d", &Y);
	tmp = Y;
	money[0] = tmp/max;
	tmp = tmp%max;
	money[1] = tmp/mid;
	tmp = tmp%mid;
	money[2] = tmp/min;
	count = money[0] + money[1] + money[2];
	if(count != N){
		maxToMid(N, money, count, &flag);
	}
	if(flag){
		printf("%d %d %d\n", money[0], money[1], money[2]);
	}
	else{
		printf("-1 -1 -1\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n, a[210000], b, res, k;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++) {
        cin >> k;
        a[i] = k - i - 1;
    }
    sort(a, a + n);
    b = a[n / 2];
    for (ll i = 0; i < n; i++) {
        res += abs(a[i] - b);
    }
    cout << res << endl;
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    if (2 * b >= a) cout << 0 << endl;
    else cout << a - 2 * b << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int solve(int s, int t)
{
    int ans = 0;
    while(s != t){
        int j = -1;
        for(int i=0; i<32; ++i){
            if(s & (1 << i)){
                if(s + (1 << i) <= t){
                    s += 1 << i;
                    j = -1;
                }
                break;
            }
            if(t & (1 << i))
                j = i;
        }
        if(j != -1)
            s += 1 << j;
        ++ ans;
    }
    return ans;
}

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

    while(--n >= 0){
        int s, t;
        cin >> s >> t;

        int ans;
        if(t < 0)
            ans = solve(-t, -s);
        else if(s < 0)
            ans = solve(0, -s) + solve(0, t);
        else
            ans = solve(s, t);
        cout << ans << endl;
    }

    return 0;
}

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

int main()
{
    int n, a[101];
    for( int i = 0; i < 101; i++ )
        a[i] = 0;

    cin >> n;

    int s[n][3], p[n];
    for( int i = 0; i < n; i++ )
    {
        p[i] = 0;
        for( int j = 0; j < 3; j++ )
            cin >> s[i][j];
    }

    for( int i = 0; i < 3; i++ )
    {
        for( int j = 0; j < n; j++ )
            a[s[j][i]]++;
        for( int j = 0; j < n; j++ )
            if( a[s[j][i]] == 1 )
                p[j] += s[j][i];
        for( int j = 0; j < 101; j++ )
            a[j] = 0;
    }

    for( int i = 0; i < n; i++ )
        cout << p[i] << endl;
    return 0;
}


Measured memory_bytes: 3084
# 重複順列　19C10
from itertools import combinations_with_replacement as cw

n,m,q = map(int, input().split())
a_candidates = cw([i+1 for i in range(m)],n)
fs = [list(map(int, input().split())) for i in range(q)]

def calc(fs,As):
    cnt = 0
    for a,b,c,d in fs:
        a -= 1
        b -= 1
        if As[b]-As[a] == c: cnt += d
    return cnt

ans = 0
for As in list(a_candidates):
    ans = max(ans, calc(fs,As))

print(ans)

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

int main() {
	int n;
	cin >> n;
	if (n % 111 == 0) {
		cout << n << endl;
		return 0;
	}
	if (111-n % 111 <n%111) {
		for (int i = 0; i < 3; i++) {
			cout << to_string(n)[0]-'0';
		}
		cout << endl;
	}
	else {
		for (int i = 0; i < 3; i++) {
			cout << to_string(n)[0]-'0'+1;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
#include<regex>
using namespace std;

int main(void){
 char s[50];
 cin>>s;
 regex Regex("^A[a-z][a-z]*C[a-z]*[a-z]$");

 if(regex_search(s,Regex))std::cout<<"AC"<<std::endl;
 else std::cout<<"WA"<<std::endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    vector<vector<P>> d(n+1);
    for(int i = 0; i < n; i++)
    {
        int u, v, w;
        cin >> u >> v >> w;
        d[u].push_back(P(v, w));
        d[v].push_back(P(u, w));
    }

    queue<P> que;
    que.push(P(1, 1));
    vector<int> color(n+1);
    color[1] = 1;
    // -1:white 1:black
    while(!que.empty())
    {
        P p = que.front();
        que.pop();

        for(int i = 0; i < d[p.first].size(); i++)
        {
            P nx = d[p.first][i];
            if(color[nx.first] == 0)
            {
                if(nx.second % 2 == 0)
                {
                    color[nx.first] = p.second;
                }
                else
                {
                    color[nx.first] = -p.second;
                }
                que.push(P(nx.first, color[nx.first]));
            }
        }
    }
    for(int i = 1; i <= n; i++)
    {
        if(color[i] == -1)
        {
            cout << 0 << endl;
        }
        else
        {
            cout << 1 << endl;
        }
    }
}


Measured memory_bytes: 6784
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    int c = 0;
    rep(i, s.size())
    {
        if (s[i] == 'o')
            c++;
    }
    cout << (c + 15 - s.size() >= 8 ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
#include <string>
#include <iterator>
#include <vector>
 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e6 + 5;


int largest(int a, int b){
	return (a<b)?b:a;
}


int main() {
	int n = 0;
	cin >> n;
	int ans = 0, res = 0;
	for(int i = 1; i <= n; ++i){
		int k = i;
		int cnt = 0;
		while(k != 1){
			if(k % 2 == 0){
				k = k / 2;
				++cnt;
				continue;
			}
			break;
		}
		if(res <= cnt){
			res = cnt;
			ans = i;
		}
	}
	cout << ans << endl;

    return 0;
} 

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n, i = 1;
	string a,b;
	cin >> n >> a >> b;
	bool is_prev_t = a[0] == b[0] ? true : false;
	LL ans = is_prev_t ? 3 : (i++, 6);
	for (; i < n; i++) {
		if (a[i] == b[i] and is_prev_t) ans = (ans * 2) % MOD;
		else if (a[i] == b[i] and !is_prev_t) is_prev_t = true;
		else if (a[i] != b[i] and is_prev_t) {
			ans = (ans * 2) % MOD;
			is_prev_t = false;
			i++;
		}
		else {
			ans = (ans * 3) % MOD;
			i++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256