akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 10007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 10
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0

using namespace std;

ll prefix[NCONS];

ll get(int left, int right)
{
    if(left - 1 < 0) return prefix[right];
    return prefix[right] - prefix[left - 1];
}

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    string str; cin >> str;
    vector<ll> vec;
    ll ret = 0;
    
    int acc1 = 0;
    int acc2 = 0;
    
    for(int i = 0; i < str.size(); i++)
    {
        if(str[i] == '1')
        {
            if(acc2 != 0)
                vec.push_back(acc2); acc2 = 0;
            acc1 += 1;
        }
        else
        {
            if(acc1 != 0)
                vec.push_back(acc1); acc1 = 0;
            acc2 -= 1;
        }
    }
    if(acc1 != 0) vec.push_back(acc1);
    if(acc2 != 0) vec.push_back(acc2);
    
    for(int i = 0; i < NCONS; i++)
    {
        if(i < vec.size())
            prefix[i] = abs(vec[i]);
        if(i != 0)
            prefix[i] += prefix[i-1];
    }
    
    
    for(int i = 0; i < vec.size(); i++)
    {
        int stride = 0;
        if(vec[i] > 0)
            stride = 2 * k;
        else
            stride = 2 * k - 1;
        stride = min(stride, (int)vec.size() - 1);
        
        auto temp = get(i, i + stride);
        
        ret = max(ret, temp);
        
    }
    
    
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 2884
A = [list(map(int, input().split())) for _ in range(3)]
C=[0]*9
e=0
N=int(input())
for i in range(N):
  b=int(input())
  for j in range(3):
    for k in range(3):
    	if(A[j][k]==b):
          C[j*3+k]=1
          break
for j in range(3):
    if(C[j*3]==1 and C[j*3+1]==1 and C[j*3+2]==1):
         e=1
         break
    if(C[j]==1 and C[j+3]==1 and C[j+6]==1):
         e=1
         break
if(C[0]==1 and C[4]==1 and C[8]==1):
     e=1
if(C[2]==1 and C[4]==1 and C[6]==1):
     e=1
if(e==0):
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    String n = sc.next();
    if(n.equals("100")){
      n = "101";
    }
    for(int i = 0;i<d;i++){
      n = n + "00";
    }
    System.out.println(n);
  }
}


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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    string ans = "APPROVED";
    int n;cin>>n;
    frepi(1,n,1)
    {
    	int x;cin>>x;
    	if(x%2==0)
    	{
    		if(x%3!=0 && x%5!=0)
    			ans="DENIED";
    	}
    }
    cout<<ans;
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

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

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int count = 0;

    for (int i = min(a, b); 1 <= i; i--)
    {
        if (a % i == 0 && b % i == 0)
        {
            count++;
        }
        if (count == k)
        {
            cout << i << endl;
            return 0;
        }
    }
}


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

using namespace std;
#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int modpow(int a, int p) {
	if (p == 0)return 1;
	if (p % 2 == 0) {
		int halfP = p / 2;
		int half = modpow(a, halfP);
		return half * half%mod;
	}
	else {
		return a * modpow(a, p-1) % mod;
	}
}

int modhiku(int val, int m) {
  int res = val % m;
  if (res < 0) res += m;
  return res;
}

signed main(void) {
	int n;
	cin >> n;
	int ret = modpow(10,n)+modpow(8,n);
	ret%=mod;
	int hiku = modpow(9,n)*2;
	hiku%=mod;
	print(modhiku(ret-hiku,mod));
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string a,b;
  int ans=0;
  cin>>a>>b;
  int x=a.size();
  for(int i=0;i<x;i++)
  {
    if(a[i]!=b[i])
      ans++;
  }
    cout<<ans<<endl;
}


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
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 X,A;
int main(){
	cin >> X >> A;
	if(X<A)cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}

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

int main()
{
    int H, W;
    cin >> H >> W;
    char S[20][20];
    int r[20][20][20][20];

    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            cin >> S[h][w];
        }
    }

    for(int hi=0; hi<H; hi++){
        for(int wi=0; wi<W; wi++){
            if(S[hi][wi] == '.'){
                for(int hj=0; hj<H; hj++){
                    for(int wj=0; wj<W; wj++){
                        r[hi][wi][hj][wj] = 10000;
                    }
                }
            }
        }
    }

    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            if(S[h][w] == '.'){
                r[h][w][h][w] = 0;
                if(h!=0 && S[h-1][w] == '.'){
                    r[h-1][w][h][w] = 1;
                }
                if(h!=H-1 && S[h+1][w] == '.'){
                    r[h+1][w][h][w] = 1;
                }
                if(w!=0 && S[h][w-1] == '.'){
                    r[h][w-1][h][w] = 1;
                }
                if(w!=W-1 && S[h][w+1] == '.'){
                    r[h][w+1][h][w] = 1;
                }
            }
        }
    }

    for(int hk=0; hk<H; hk++){
        for(int wk=0; wk<W; wk++){
            if(S[hk][wk] == '.'){
                for(int hi=0; hi<H; hi++){
                    for(int wi=0; wi<W; wi++){
                        if(S[hi][wi] == '.'){
                            for(int hj=0; hj<H; hj++){
                                for(int wj=0; wj<W; wj++){
                                    if(S[hj][wj] == '.'){
                                        r[hi][wi][hj][wj] = min(
                                                r[hi][wi][hj][wj],
                                                r[hi][wi][hk][wk] + r[hk][wk][hj][wj]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    int imax = 0;
    for(int hi=0; hi<H; hi++){
        for(int wi=0; wi<W; wi++){
            if(S[hi][wi] == '.'){
                for(int hj=0; hj<H; hj++){
                    for(int wj=0; wj<W; wj++){
                        if(S[hj][wj] == '.'){
                            if(imax < r[hi][wi][hj][wj]){
                                imax = r[hi][wi][hj][wj];
                            }
                        }
                    }
                }
            }
        }
    }

    cout << imax << endl;

	return 0;
}


Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>

using namespace std;

double sq(double x){return x*x;}

int t[100];

int main(){
	int x;
	while(cin>>x){
		t[x-1]++;
	}
	int m = *max_element(t,t+100);
	for (int i = 0; i < 100; i++)
	{
		if(m == t[i]) cout << i+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
int a, b;
int cnt[45];
int t[45];
signed main() {	
	cin >> a >> b;
	t[0] = 1;
	loop(i, 1, 45) { t[i] = t[i - 1] * 2; }
	rep(i, 44) {
		cnt[i] += ((b / t[i + 1]) * t[i]) + max(0ll, (b % t[i + 1]) - t[i] + 1);
	}
	a--;
	rep(i, 44) {
		cnt[i] -= ((a / t[i + 1]) * t[i]) + max(0ll, (a % t[i + 1]) - t[i] + 1);
	}
	int ans = 0;
	rep(i, 44) {
		if (cnt[i] % 2)ans += t[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FO(i,a,b) for(int i=1;i<=n;i++)
#define FE(i,a,b) for(int i=1;i<n;i++)
#define Edge(i,v,a) for(int i=head[a],v=to[i];i!=-1;i=nxt[i],v=to[i])
#define R(i) i=read()
using namespace std;
char s[1000];
int main() {
	scanf("%s",s);
	int t=strlen(s);
	if(t>=4) {
		if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
			cout<<"Yes";
		else cout<<"No";
	}
	else  {
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

n,x = map(int, input().split())
m = [int(input()) for _ in range(n)]


ans = n + (x - sum(m)) // min(m)
print(ans)


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

int main() {
	
	string a, b;
	cin >> a >> b;
	int n = a.size();
	for (int i=0; i<n+1; i++) {
		string s = "";
		s += b[n-1];
		for (int i=0; i<n-1; i++) s += b[i];
		if (a == s) {
			cout << "Yes" << endl;
			exit(0);
		}
		b = s;
	}
	cout << "No" << endl;
	
}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n, a, b;
  cin >> n >> a >> b;
  swap(a, b);
  if ((a - b) % 2 == 0) {
    cout << (a - b) / 2 << '\n';
  } else {
    auto f = [&] (ll x, ll y) {
      if (x > y) swap(x, y);
      ll dist = x - 1;
      ll ans = dist;
      x -= dist, y -= dist;
      ans++;
      y--;
      ans += (y - 1) / 2;
      return ans;
    };
    cout << min(f(a, b), f(n - a + 1, n - b + 1)) << '\n';
  }
}


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

int main() {
    int x;
    cin >> x;
    int happy = 0;
    int a, b = 0;
    a = x/500;
    b = (x-a*500)/5;
    happy = a*1000 + b*5;
    cout << happy << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>

using namespace std;

int sum_digit(int n){
  if( n == 0 ) return 0;
  else return n%10 + sum_digit(n/10);
}
int absolute(int a){
  if(a < 0) return -a;
  else return a;
}
int main()
{
  vector<int> p(5);
  for(int i = 0; i < 5; i++) cin >> p.at(i);
  int k; cin >> k;
  
  bool OK = true;
  for(int i = 0; i < 5; i++){
  	for(int j = i+1; j < 5; j++){
      if(abs(p.at(i)-p.at(j)) > k) OK = false;
    }
  }
  if(OK) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int i;
    char s[10];
    int ans=0;

    scanf("%s", &s);

    for(i=1; i<4; i++){
        if(s[i-1] == s[i]){
            ans = 1;
        }
    }

    if(ans == 0){
        printf("Good");
    }else{
        printf("Bad");
    }

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
 
int main(void){
    int n;
    int a[200000];
    int i;
    int fir_max=0;
    int sec_max=0;
    
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d",&a[i]);
    }
    
    for(i=0; i<n; i++){
        if(a[i]>fir_max){
            sec_max=fir_max;
            fir_max=a[i];
        }else if(a[i]>sec_max){
            sec_max=a[i];
        }
    }
    
    for(i=0; i<n; i++){
        if(a[i]!=fir_max){
            printf("%d",fir_max);
        }else{
            printf("%d",sec_max);
        }
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 2304
#include <iostream>

using namespace std;

int main() {

	int s;
	cin >> s;

	int count = 0;

	if (s / 100 == 1) {
		count++;
	}
	if (s / 10 == 11 || s / 10 == 1) {
		count++;
	}
	if (s % 2 == 1) {
		count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back 
#define mp make_pair
typedef long long ll;



int main(){
	int n,m; cin>>n>>m;
	if(n==m) cout<<"Yes";
	else cout<<"No";
			
	
	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)

mod4 = Array.new(3, 0)

arr.each do |a|
  cnt = 0
  while true
    break if cnt == 2
    if a.even? then
      cnt += 1
      a /= 2
    else
      break
    end
  end
  mod4[cnt] += 1
end

x = [mod4[2], mod4[0]].min
mod4[0] -= x
mod4[2] -= x
if mod4[0] > 1  then
  puts "No"
elsif mod4[0] == 1
  if mod4[1] == 0 then
    puts "Yes"
  else 
    puts "No"
  end 
else
  puts "Yes"
end

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

#define INF (1LL << 31 - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define fi first
#define se second

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int n, m, a, b;
vector<int> g[8];
bool used[8];

int dfs(int v, int cnt) {
    if (cnt == n) return 1;

    int ret = 0;
    used[v] = true;
    int si = g[v].size();
    for (int i = 0; i < si; ++i) {
        if (!used[g[v][i]]) {
            ret += dfs(g[v][i], cnt + 1);
        }
    }
    used[v] = false;
    return ret;
}

int main() {
    init();
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> a >> b, a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    cout << dfs(0, 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int n,k;
int a[200000];
bool can(int length){
	ll WorkCount=0;
	rep(i,n){
		WorkCount+=(a[i]+(length-1))/length-1;
	}
	if(WorkCount>k)return 0;
	else return 1;
}

int main(){
	cin>>n>>k;
	in(a,n);
	int left=0,right=1000000000;//2分探索(left<anser<=right)
	int middle;
	while(right-left!=1){
		middle=(left+right)/2;
		if(can(middle)){
			right=middle;
		}
		else{
			left=middle;
		}
	}
	cout <<right;
	return 0;
}

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

int main()
{
    int N, X;
    cin >> N >> X;
    int a = 0, cnt = 1;
    for(int i = 0; i < N; ++i) {
        int L;cin >> L;
        a += L;
        if(a <= X) ++cnt;
        else continue;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(int n, vector<pair<int,int>>& edges, int H, int A) {
        int rt = A;

        vector<vector<int>> graph(n);
        for (auto& e : edges) {
            int u = e.first, v = e.second;
            graph[u].push_back(v);
            graph[v].push_back(u);
        }

        vector<int> depth(n + 1, 0);
        vector<int> dp(n + 1, 0);
        vector<int> pars(n, -1);
        vector<int> ord;
        ord.push_back(rt);
        depth[rt] = 0;
        for (int i = 0; i < ord.size(); ++i) {
            int u = ord[i];
            for (auto v : graph[u]) {
                if (v == pars[u]) {
                    continue;
                }
                pars[v] = u;
                ord.push_back(v);
                depth[v] = depth[u] + 1;
            }
        }

        reverse(ord.begin(), ord.end());
        for (auto u : ord) {
            dp[u] = depth[u];
            for (auto v : graph[u]) {
                if (v == pars[u]) {
                    continue;
                }
                dp[u] = max(dp[u], dp[v]);
            }
        }

        int res = 0;
        int cur = H;
        while (cur != -1 && depth[H] - depth[cur] <= depth[cur]) {
            if (depth[H] - depth[cur] == depth[cur]) {
                res = max(res, depth[H] - depth[cur]);
            } else {
                res = max(res, dp[cur] - 1);
            }
            cur = pars[cur];
        }

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; 
    cin >> n;
    int u, v;
    cin >> u >> v;
    --u, --v;
    vector<pair<int,int>> edges;
    for (int i = 0; i + 1 < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        edges.emplace_back(u, v);
    }

    Solution sol;
    cout << sol.solve(n, edges, u, v) << "\n";

    return 0;
}

Measured memory_bytes: 8692
#include <stdio.h>

int main(void)
{
	int c1,c5,c10,c50,c100,c500,sum;
	scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
	sum=c1;
	sum=sum+c5*5;
	sum=sum+c10*10;
	sum=sum+c50*50;
	sum=sum+c100*100;
	sum=sum+c500*500;
	if(sum>=1000){
		printf("1\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2104
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    cout << 6 - a - b;
    
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define mod 998244353
const int N=200005;

vector <int> adj[N];

int main() {
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
  */
    cout<<fixed<<setprecision(9);


    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) {
    	cin>>a[i];
    }
	double sm=0.0,den=1;
    for(int i=0;i<n;i++) {
    	double tmp=1;
    	for(int j=0;j<n;j++) {
    		if(i!=j) {
    			tmp*=a[j];
    		}
    	}
    	sm+=tmp;
    	den*=a[i];
    }
    cout<<den/sm;
	return 0;
}

Measured memory_bytes: 4992
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scn  = new Scanner(System.in);
		String num = scn.next();
		int res = 0;
		for(char c:num.toCharArray())
		{
			int temp = (int)c-'0';
			res+=temp;
		}
		if(res%9==0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 40776
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int n;
int k;
int h[100000];
int dp[100003];

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

	cin >> n>>k;
	rep(i, n)cin >> h[i];

	rep(i, n + 3)dp[i] = 1<<30;


	dp[0] = 0;
	rep(i,n-1) {
		for (int j = 1; j <= k;j++) {
			if (i + j >= n)break;

			dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
		}
	}
	cout << dp[n-1] << endl;



	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 

 
int main() {
    long long int n, m, ans = 0, t, x = 0;
    cin >> n >> m;

    long long int h[n];
    long long int a[m], b[m];
    vector<int>* v = new vector<int> [n+1];

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

    for (long long int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        v[a[i] - 1].push_back(b[i]);
        v[b[i] - 1].push_back(a[i]);
    }


    for (long long int i = 0; i < n; i++)
    {

        if (v[i].size() == 0)
        {
            ans++;
        }
        else
        {
            x = h[v[i][0] - 1];
            t = v[i].size();
            for (int j = 0; j < t; j++)
            {
                x = max(x, h[v[i][j] - 1]);
            }
            if (h[i] > x)
            {
                ans++;
            }
        }
    }

    cout << ans;
    
    return 0;
}

Measured memory_bytes: 11048
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d\n", MIN(MIN(a + b, b + c), c + a));

  return 0;
}

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

from math import factorial

def readInts():
  return [int(s) for s in input().split(" ")]

def combi(n, r):
  r = min(n-r, r)
  if r == 0:
    return 1
  if r == 1:
    return n
  ret = 1
  for i in range(r):
    ret *= (n - i)
  return ret // factorial(r)

mod = 10 ** 9 + 7

def solve(N, K, i):
  if i == 1:
    return combi(N - K + 1, 1) % mod
  if N - K < i - 1:
    return 0

  ret = combi(K - 1, i - 1) % mod
  if N - K - (i - 1) > 0:
    ret *= combi(N - K - (i - 1) + i, i) % mod
  return ret % mod

def main():
  N, K = readInts()
  for i in range(1, K+1):
    print(solve(N, K, i))

if __name__ == "__main__":
  main()


Measured memory_bytes: 3316
n = int(input())

res = [[0, 0, 0] for i in range(n+1)]

for i in range(1, n+1):
  temp = list(map(int, input().split()))
  res[i][0] = max(res[i-1][1] + temp[0], res[i-1][2] + temp[0])
  res[i][1] = max(res[i-1][0] + temp[1], res[i-1][2] + temp[1])
  res[i][2] = max(res[i-1][0] + temp[2], res[i-1][1] + temp[2])

print(max(res[n]))

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


using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define endl        '\n'
#define ll          long long int
#define pb          push_back
#define sz(x)       (int)(x).size()
const ll mod = 1e9 + 7;

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

ll powm(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1)
res = (res * 1LL * a) % mod;
b >>= 1LL;
a = (a * 1LL * a) % mod;
}
return res;
}

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



int main() {
	fast
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
 
int n;cin>>n;
ll a[n];
for(int i=0;i<n;i++)cin>>a[i];
ll dp[n];
dp[0]=0;
for(int i=1;i<n;i++)
{
	if(i-1>=0){
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
	}
	if(i-2>=0)
	{
        dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
	}
}	

cout<<dp[n-1];

	return 0;
}



Measured memory_bytes: 5176
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;

int main()
{
    vector<int> vec(3);
    for (int i = 0; i < 3; i++)
    {
        cin>>vec.at(i);
    }
    sort(vec.begin(), vec.end());
    
    if (vec.at(0)==5&&vec.at(1)==5&&vec.at(2)==7)
    {
        cout<<"YES"<<endl;
    }else
    {
        cout<<"NO"<<endl;
    }
    
    

    


    return 0;
}

Measured memory_bytes: 3620
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    S = input()
    for i in range(len(S)):
        T = S[:-i - 1]
        if len(T) % 2 == 0 and T[len(T) // 2:] == T[:len(T) // 2]:
            print(len(T))
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
import java.io.*;
//import java.util.stream.IntStream;



public class Main {


    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //try{}
        
        int n = Integer.parseInt(sc.nextLine());
        String ans = "";

        for(int i=0;i<n;i++){
            String x = sc.nextLine();
            String y = sc.nextLine();

            int xl = x.length();
            int yl = y.length();

            int[][] c = new int[xl + 1][yl + 1];


            int l = lcs(x,y,c);

            ans += Integer.toString(l) + '\n';
        }

        System.out.print(ans);


    }

    public static int lcs(String x, String y, int[][] c){
        int xl = x.length();
        int yl = y.length();

        for(int i=1;i<=xl;i++){
            for(int j=1;j<=yl;j++){
                if(x.charAt(i-1) == y.charAt(j-1)){
                    c[i][j] = c[i-1][j-1] + 1;
                } else {
                    c[i][j] = Math.max(c[i-1][j], c[i][j-1]);
                }
            }
        }

        return c[xl][yl];

    }

}





Measured memory_bytes: 63952
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    int min=INT_MAX;
    
    for(int i=1;i<101;i++){
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=(i-x[j])*(i-x[j]);
        }
        if(min>sum){
            min=sum;
        }
    }
    cout<<min;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8


class Monster:
    def __init__(self, hp):
        self.hp = int(hp)


class Hero:
    def __init__(self, hp):
        self.hp = int(hp)

    def attack(self, monster_1st, monster_2nd):
        if self._attack(monster_1st):
            self._attack(monster_2nd)

    def _attack(self, monster):
        if monster.hp == self.hp:
            monster.hp = 0
            self.hp = 0
            return False
        elif monster.hp > self.hp:
            monster.hp -= self.hp
            self.hp = 0
            return False
        elif monster.hp < self.hp:
            self.hp -= monster.hp
            monster.hp = 0
            return True


def main():
    _ = int(input())
    monsters = list(map(Monster, input().split(' ')))
    monsters_at_start = sum(monster.hp for monster in monsters)
    heroes = list(map(Hero, input().split(' ')))

    for i, hero in enumerate(heroes):
        hero.attack(monsters[i], monsters[i + 1])

    print(monsters_at_start - sum(monster.hp for monster in monsters))

    return 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 51936
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
const int maxn = 10010;


int main(){
	long long n,a,b;
	long long cnt = 0;
	//cin >> n >> a >> b;
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a > b) cnt = 0;
	else if(n==1&& a != b) cnt = 0;
	//else if(n==1&& a == b) cnt = 1;
	else{
		long long l = (n-1)*a+b;
		long long r = a+(n-1)*b;
		cnt = r-l+1; 
		//cnt = (n-2)*(b-a)+1;
	}
	printf("%lld\n",cnt);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://abc062.contest.atcoder.jp/tasks/abc062_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    group1 = [1, 3, 5, 7, 8, 10, 12]
    group2 = [4, 6, 9, 11]
    # group3 = [2]

    ans = 'No'
    x, y = map(int, input().split())
    if x in group1 and y in group1:
        ans = 'Yes'
    elif x in group2 and y in group2:
        ans = 'Yes'
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 3188
#include<bits/stdc++.h>
    using namespace std;
    #define 	ll 			long long
    #define 	w(t)		int t; cin>>t; while(t--)  
	#define 	AsmShuvo()  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
			
    int main()
    {
    AsmShuvo()
    	
    	int a;
    	cin>>a;
    	cout<< a+ a*a + a*a*a;
		
     	return 0;
	}
	


Measured memory_bytes: 3524
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define mod 1e9+7
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

typedef struct{
	int ind,num;
}data;
int comp(const void *a,const void *b){return ((data*)b)->num - ((data*)a)->num;}

int compare(const void *a,const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int a,b;
	scanf("%d%d",&a,&b);
	if(b<a){
		int tmp=b;
		b=a;
		a=tmp;
	}
	if((b-a)%2==0)printf("%d",b-(b-a)/2);
	else
	printf("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool isok(ll a)
{
	vector<int> vi;
	while(a)
	{
		vi.push_back(a%10);
		a/=10;;
	}
	ll tc=0,fc = 0,sc = 0;
	for(int i=0;i<vi.size();i++)
	{
		if(vi[i] == 3)tc++;
		if(vi[i] == 5)fc++;
		if(vi[i] == 7)sc++;
	}
	if(tc&&fc&&sc)return 1;
	return 0;
}
int main()
{
	ll k;
	cin>>k;
	queue<ll> que;
	que.push(3);
	que.push(5);
	que.push(7);
	ll sum = 0;
	while(1)
	{
		ll now = que.front();
		que.pop();
		ll t = now*10+3;
		ll f = now*10+5;
		ll s = now*10+7;
		que.push(t);
		que.push(f);
		que.push(s);
		if(t<=k&&isok(t))
		{
			sum++;
		}
		else if(t>k)
		{
			cout<<sum<<endl;
			return 0;
		}
		if(f<=k&&isok(f))
		{
			sum++;
		}
		else if(f>k)
		{
			cout<<sum<<endl;
			return 0;
		}
		if(s<=k&&isok(s))
		{
			sum++;
		}
		else if(s>k)
		{
			cout<<sum<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 384
import copy

def bubble_sort(data_bubble):
    for i in range(len(data_bubble)):
        for j in range(len(data_bubble)-1, i, -1):
            if data_bubble[j][1] < data_bubble[j-1][1]:
                data_bubble[j], data_bubble[j-1] = data_bubble[j-1], data_bubble[j]
    return data_bubble


def selection_sort(data_selec):
    for i in range(len(data_selec)):
        minj = i
        for j in range(i, len(data_selec)):
            if data_selec[j][1] < data_selec[minj][1]:
                minj = j
        data_selec[i], data_selec[minj] = data_selec[minj], data_selec[i]
    return data_selec


def set_list(data):
    base_list = [[], [], [], [], [], [], [], [], []]
    for elem in data:
        base_list[int(elem[1]) - 1].append(elem)
    return base_list


def is_stable(base, compare):
    base_list = set_list(base)
    compare_list = set_list(compare)
    for i, num in enumerate(base_list):
        for j, key in enumerate(num):
            if key != compare_list[i][j]:
                return 'Not stable'
    return 'Stable'


_ = int(input())
data = list(input().split())
bubble_list = copy.copy(data)
bubble_list = bubble_sort(bubble_list)
print(*bubble_list)
print(is_stable(data, bubble_list))
selection_list = copy.copy(data)
selection_list = selection_sort(selection_list)
print(*selection_list)
print(is_stable(data, selection_list))



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

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

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

const ll mod = static_cast<ll>(1e9) + 7;

int main()
{
    ll r;
    cin >> r;

    cout << 3LL * r * r << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define all(a) a.begin(),a.end()
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; }
using namespace std;

struct Edge{
    int from,to,cost,color;
    Edge(){}
    Edge(int from, int to, int cost, int color):from(from),to(to),cost(cost),color(color){}
};

struct RootedTree{
    int n,root,l;
    vector<int> depth,dist;
    vector<vector<int>> par;
    vector<vector<Edge>> graph; 
    RootedTree(){}
    RootedTree(int n):n(n),depth(n),par(n),graph(n),dist(n){
        l=0; while((1<<l)<n)l++; par=vector<vector<int>>(l,vector<int>(n+1,n));
    }
    void addEdge(Edge e, bool directed){
        graph[e.from].push_back(e);
        if(!directed){swap(e.from,e.to); graph[e.from].push_back(e);}
    }
    void dfs(int v, int p=-1, int d=0, int c=0){
        if(p!=-1)par[0][v]=p; depth[v]=d; dist[v]=c;
        for(Edge e:graph[v]){
            if(e.to==p)continue;
            dfs(e.to,v,d+1,c+e.cost);
        }
    }
    void init(int r=0){
        root=r; dfs(root);
        rep(i,l-1)rep(j,n)par[i+1][j]=par[i][par[i][j]];
    }
    int lca(int x, int y){
        if(depth[x]>depth[y])swap(x,y);
        int dif=depth[y]-depth[x];
        for(int i=l-1; i>=0; i--){
            int len=1<<i;
            if(dif>=len){dif-=len; y=par[i][y];}
        }
        if(x==y)return x;
        for(int i=l-1; i>=0; i--){
            int nx=par[i][x],ny=par[i][y];
            if(nx!=ny){x=nx; y=ny;}
        }
        return par[0][x];
    }
    int depdif(int x, int y){
        int z=lca(x,y);
        return depth[x]+depth[y]-2*depth[z];
    }
    int length(int x, int y){
        int z=lca(x,y);
        return dist[x]+dist[y]-2*dist[z];
    }
};

struct Query{
    int color,id,coeff,newcost;
    Query(){}
    Query(int color, int id, int coeff, int newcost):color(color),id(id),coeff(coeff),newcost(newcost){}
};

int N,Q;
RootedTree tree;
vector<int> ans;
vector<Query> qs[100005];
int cnt[100005],sum[100005];

void dfs2(int v=0, int p=-1){
    for(auto q:qs[v]){
        int x=-sum[q.color]+q.newcost*cnt[q.color];
        ans[q.id]+=x*q.coeff;
    }
    for(auto e:tree.graph[v]){
        if(e.to==p)continue;
        cnt[e.color]++; sum[e.color]+=e.cost;
        dfs2(e.to,v);
        cnt[e.color]--; sum[e.color]-=e.cost;
    }
}

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

    cin>>N>>Q;
    tree=RootedTree(N);
    rep(i,N-1){
        int a,b,c,d; cin>>a>>b>>c>>d; a--; b--;
        tree.addEdge(Edge(a,b,d,c),false);
    }
    tree.init();

    ans.resize(Q);
    rep(i,Q){
        int x,y,a,b; cin>>x>>y>>a>>b; a--; b--;
        int c=tree.lca(a,b);
        ans[i]=tree.length(a,b);
        qs[a].push_back(Query(x,i,1,y));
        qs[b].push_back(Query(x,i,1,y));
        qs[c].push_back(Query(x,i,-2,y));
    }
    dfs2();

    rep(i,Q)cout<<ans[i]<<endl;
    return 0;

}

Measured memory_bytes: 48456
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;

void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}


int main() {
  ll N,M;cin >>N>>M;
  for(ll i=1e9;i>0;--i){
    if(M<i*N||(M-i*N)%i!=0)continue;
    cout<<i<<endl;
    break;

    
  }
	
	return 0;
}



Measured memory_bytes: 256
#include<math.h>
double x[100],y[100],A,h,c,X,Y;
i,j,k,s,m,M;
main(n){
	for(;scanf("%d",&n),n;printf("%d\n",M+2)){
		M=-1;
		for(i=n;i--;)
			scanf("%lf,%lf",x+i,y+i);
		for(i=n;--i;){
			for(j=i;j--;){
				A=hypot(x[i]-x[j],y[i]-y[j])/2;
				if(A<=1){
					c=atan2(y[i]-y[j],x[i]-x[j]);
					h=sqrt(1-A*A);
					for(s=2;s--;h=-h){
						X=x[j]+A*cos(c)-h*sin(c);
						Y=y[j]+A*sin(c)+h*cos(c);
						for(m=0,k=n;k--;M=m>M?m:M)
							m+=k-i&&k-j&&hypot(X-x[k],Y-y[k])<=1;
					}
				}
			}
		}
	}
	exit(0);
}

Measured memory_bytes: 0
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    dp = [0] * t
    mv = 0
    for a, b in ab:
        mv = max(mv, dp[-1] + b)
        for i in range(t - 1 - a, -1, -1):
            dp[i+a] = max(dp[i+a], dp[i] + b)
    print(mv)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 41328
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	int a, b, c, ans = 0, num = 0;
	string s;
	cin >> a >> b >> c;
	for (int i = 1; i <= a; i++) {
		s = to_string(i);
		for (int i = 0; i < s.size(); i++)num += s[i] - '0';
		if (num >= b && num <= c)ans += i;
		num = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long, long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << (x) << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

void Main()
{
	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U;
	cin >> U;
	if (U == S)	A--;
	if (U == T)	B--;
	cout << A << " " << B;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N=sc.nextInt(),a=0;
		for(int i=0;i<N;i++) {
			int t=sc.nextInt();
			if(i%2==0&&t%2==1) {
				a++;
			}
		}
		System.out.println(a);
	}

}


Measured memory_bytes: 35896
#include <iostream>
#define mod 1000000007
using namespace std;
long long n,a,b,ans;
long long put(long long baza, long long exponent)
{
    baza%=mod;
    if(exponent==1)
        return baza;
    if(exponent==0)
        return 1;

    long long val = put(baza, exponent/2);
    val*=val;
    val%=mod;
    if(exponent%2)
        val*=baza;
    val%=mod;
    return val;
}
long long comb(long long k, long long n)
{
    long A=1, B=1;
    for(long long i=n-k+1;i<=n;i++)
    {
        A*=i;
        A%=mod;
    }
    for(long long i=1;i<=k;i++)
    {
        B*=i;
        B%=mod;
    }
    return (A*put(B, mod-2))%mod;
}
int main()
{
    cin>>n>>a>>b;
    ans=put(2, n)-1;
    ans-=comb(a, n);
    if(ans<0)
        ans+=mod;
    ans-=comb(b, n);
    if(ans<0)
        ans+=mod;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
K, S = map(int, input().split())
ans = 0

if 3*K < S:
    print(ans)
    exit()

for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if Z < K + 1 and Z > -1:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF 999999999999999999
#define NN (ll)(1e6+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
     ll i,x;
     for(i=1;i<=5;i++)
     {
       cin>>x;
       if(x==0)
       {
         cout<<i;
         return 0;
       }
     }
   }
}


Measured memory_bytes: 3604