akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  string s;
  cin >> s;
  int n = s.size();
  ll ans = 0,now = 0;
  rep(i,n){
    if(s[i] == 'W'){
      ans += abs(now - i);
      now++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
//Code by ASIM FOIZE AIMON
//CSE'19;CUET
//avoid copy paste//Hit the frined button
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl "\n"
#define int int64_t
#define ll long long
#define yes printf("Y\n")
#define no printf("N\n")

int32_t main()
{
/*#ifndef ONLINE_JUDGE
    freopen("/media/AIMON/SSDVol/Progs/CodeForces/input.txt", "r", stdin);
    freopen("/media/AIMON/SSDVol/Progs/CodeForces/output.txt", "w", stdout);
#endif*/
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b==c+d)
        cout<<"Balanced"<<endl;
    else if(a+b>c+d)
        cout<<"Left"<<endl;
    else
        cout<<"Right"<<endl;
}


Measured memory_bytes: 3612
/*
 *    FileName:
 *      Source:
 *        Date:
 *      Author: Mew
 *	  Function:
 */
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iomanip>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<iterator>
#include<ctime>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int l = s.length();
	int tag = 0;
	for(int i=0;i<l;i++){
		if(tag == 0 && s[i] == 'C')tag = 1;
		if(tag == 1 && s[i] == 'F')tag = 2;
	}
	if(tag == 2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



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

constexpr int INF = 1 << 30;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

signed main() {

    int H, W;   cin >> H >> W;
    vector<string> board(H);
    REP(i, H) cin >> board[i];

    int white = 0;
    REP(i, H) REP(j, W) white += board[i][j] == '.';

    vector<vector<int>> dp(H, vector<int>(W, INF));
    queue<pair<int, int>> Q;

    dp[0][0] = 0;
    Q.emplace(0, 0);

    while (not Q.empty()) {
        pair<int, int> tp = Q.front(); Q.pop();
        int x, y;
        tie(x, y) = tp;
        REP(k, 4) {
            int nx = x + dx[k];
            int ny = y + dy[k];
            if (nx < 0 or nx >= H or nx < 0 or ny >= W) continue;
            if (board[nx][ny] == '#') continue;
            if (dp[nx][ny] <= dp[x][y] + 1) continue;
            dp[nx][ny] = dp[x][y] + 1;
            Q.emplace(nx, ny);
        }
    }

    if (dp[H - 1][W - 1] == INF) cout << -1 << endl;
    else cout << white - dp[H - 1][W - 1] - 1 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;
int M, K;


void solve() {
    if (K == 0) {
        FOR(1ll << M)
        cout << i << " " << i << " ";
        cout << endl;

    } else if (K == 1 && M == 1) {
        cout << -1 << endl;
    } else if (K >= (1ll << M)) {
        cout << -1 << endl;
    } else {
        FOR((1ll << M)) {
            if (i != K)
                cout << i << " ";
        }
        cout << K << " ";
        for (int i = (1ll << M) - 1; i >= 0; i--) {
            if (i != K)
                cout << i << " ";
        }
        cout << K << " " << endl;
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> M >> K;


    solve();
    return 0;
}


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

int main(){
    int n;
    long long a[200001];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    map<long long,long long> data;
    vector<long long> mem;
    for(int i=1;i<=n;i++){
        if(data.find(a[i])!=data.end()){
            data[a[i]]++;
        }else{
            data[a[i]]=1;
            mem.push_back(a[i]);
        }
    }
    long long sum=0;
    for(int i=0;i<mem.size();i++){
        sum+=data[mem[i]]*(data[mem[i]]-1)/2;
    }
    for(int k=1;k<=n;k++){
        if(data[a[k]]==1){
            cout<<sum<<endl;
            continue;
        }
        long long temp=data[a[k]]-1;
        cout<<sum-temp<<endl;
    }
    return 0;
}

Measured memory_bytes: 13940
#include <bits/stdc++.h>
using i64 = long long;

long long *fact, *inv;

template <class T>
T pow(T x, T n, T mod) {
    T ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

template <class T>
T inverse(T x, T p) { return pow(x, p - 2, p); }

void init_factorial(int n, long long mod) {
    fact = new long long[n + 1];
    inv = new long long[n + 1];
    fact[0] = 1;
    for (long long i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    inv[n] = inverse(fact[n], mod);
    for (long long i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod;
}

int main() {
    int q;
    constexpr i64 mod = 1000003;
    std::cin >> q;
    init_factorial(mod - 1, mod);
    while (q--) {
        i64 x, d, n;
        std::cin >> x >> d >> n;
        if (d == 0) {
            std::cout << pow(x, n, mod) << std::endl;
            continue;
        }
        auto t = x * inverse(d, mod) % mod;
        if (t + n - 1 >= mod || t == 0) std::cout << 0 << std::endl;
        else std::cout << fact[t + n - 1] * inv[t - 1] % mod * pow(d, n, mod) % mod << std::endl;
    }

    return 0;
}


Measured memory_bytes: 16512
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

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

	vector<int> a(n);
	set<int> b;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

		b.insert(a[i]);
	}
	sort(a.begin(), a.end());

	if (b.size() > 3) {
		cout << "No" << endl;
	} else if (b.size() == 3) {
		if (n % 3 != 0) {
			cout << "No" << endl;
		} else {
			vector<pair<int, int>> v;
			v.emplace_back(make_pair(a[0], 1));

			for (int i = 1; i < n; i++) {
				if (a[i - 1] == a[i]) {
					v[v.size() - 1].second++;
				} else {
					v.emplace_back(make_pair(a[i], 1));
				}
			}

			if ((v[0].first ^ v[1].first) == v[2].first && v[0].second * 3 == n && v[1].second * 3 == n) {
				cout << "Yes" << endl;
			} else {
				cout << "No" << endl;
			}
		}
	} else if (b.size() == 2) {
		if (n % 3 != 0) {
			cout << "No" << endl;
		} else {
			vector<pair<int, int>> v;
			v.emplace_back(make_pair(a[0], 1));

			for (int i = 1; i < n; i++) {
				if (a[i - 1] == a[i]) {
					v[v.size() - 1].second++;
				} else {
					v.emplace_back(make_pair(a[i], 1));
				}
			}

			if (v[0].first == 0 && v[0].second * 3 == n) {
				cout << "Yes" << endl;
			} else {
				cout << "No" << endl;
			}
		}
	} else {
		if (a[0] == 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main()
{
  int n;
  cin >> n;
  double D[n];
  for (int i = 0; i < n; ++i)
  {
    cin >> D[i];
  }


  
  vector<double> vec(n + 1, 0);
  vec[0] = 1 - D[0];
  vec[1] = D[0];

  for (int i = 1; i < n; ++i)
  {
     for (int j = n; j >= 0; --j)
     {
        vec[j] = vec[j] * (1 - D[i]);

        if(j != 0)
        vec[j] += vec[j - 1] * D[i];
     }
  }

  double ans = 0;

  for (int i = 0; i <= n; ++i)
  {
     int nheads = i;
     int ntails = n - i;

     if(nheads > ntails) ans += vec[i];
  }
  cout << fixed << setprecision(10) << ans;

  return 0;
}

Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const a = nextInt()
    console.log(a + a*a + a*a*a)

}
Main()


Measured memory_bytes: 29696
#include <iostream>
using namespace std ; 
long long  b[102][102]  , v , e ; 
int main() {
	cin >> v >> e ;  
	for(int i=1 ; i<=v ; i++) {
		for(int j=1 ; j<=v ; j++) {
			if(i==j) {
				b[i][j]=0;
			}
			else {
				b[i][j]=1e18 ;
			}
		}
	}
	for(int i= 0 ; i < e ; i++) {
		int x , y , z  ; 
		cin >> x >> y >> z ; 
		b[x+1][y+1]=z;
	}
	for(int x=1 ; x<=v ; x++) {
		for(int y=1 ; y<=v ; y++) {
			for(int z=1; z<=v ; z++) {
				b[y][z]=min(b[y][z],b[y][x]+b[x][z]);
				if(y==z) {
					if(b[y][z]<0) {
						cout << "NEGATIVE CYCLE" << endl ;
						return 0 ;  					
					}
				}
			}
		}
	}
	for(int i=1 ; i<=v ; i++) {
		for(int j=1 ; j<=v ; j++) {
			if(j != 1) {
				if(b[i][j]>2e9) {
					cout<< " INF";  
				}
				else {
					cout << " "<<b[i][j] ;
				}
			}
			else {
				if(b[i][j]>2e9) {
					cout<< "INF";  
				}
				else {
					cout << b[i][j] ;
				}				
			}
		}
		cout << endl ; 
	}
	
}


Measured memory_bytes: 3160
// https://cses.fi/problemset/task/1734/
#include <bits/stdc++.h>

using namespace std;
using iii = tuple<int, int, int>;
using mii = map<int, int>;
using vi = vector<int>;
using viii = vector<iii>;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q, a, b;
  cin >> n >> q;
  vi x(n);
  mii m;
  for (int i = 0; i < n; i++) {
    int y;
    cin >> y;
    if (m.count(y)) x[i] = m[y];
    else x[i] = m.size(), m[y] = x[i];
  }
  viii y(q);
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    y[i] = make_tuple(a-1, b, i);
  }
  int k = sqrt(n);
  sort(y.begin(), y.end(), [&](iii x, iii y) -> bool {
    int a1, b1, i1, a2, b2, i2;
    tie(a1, b1, i1) = x;
    tie(a2, b2, i2) = y;
    int a1q = a1/k, a2q = a2/k;
    if (a1q < a2q) return true;
    if (a1q > a2q) return false;
    return b1 < b2;
  });
  vi res(q);
  vi count(m.size());
  int l = 0, r = 0, ans = 0;
  for (iii z : y) {
    int i;
    tie(a, b, i) = z;
    while (r < b) if (++count[x[r++]] == 1) ans++;
    while (r > b) if (--count[x[--r]] == 0) ans--;
    while (l < a) if (--count[x[l++]] == 0) ans--;
    while (l > a) if (++count[x[--l]] == 1) ans++;
    res[i] = ans;
  }
  for (int z : res) cout << z << '\n';
}


Measured memory_bytes: 38988
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

int input() {
	constexpr int SIZE = 16;
	int res = 0;
	for(int i = 0; i < SIZE; ++i) {
		int in;
		cin >> in;
		res = (res << 1) | in;
	}
	return res;
}

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

	for(int n, c; cin >> n >> c && n;) {
		vector<int> a(n), b(c);
		for(auto &e : a) e = input();
		for(auto &e : b) e = input();

		b.emplace_back(0);

		unordered_map<int, int> calc;
		calc[0] = 0;

		for(const auto &on : a) {
			unordered_map<int, int> next_calc;

			for(const auto &current : calc) {
				const int before = (current.first | on);
				const int before_count = __builtin_popcount(before);

				for(const auto &e : b) {
					const int after = (before & ~e);
					const int score = current.second + before_count - __builtin_popcount(after);
					chmax(next_calc[after], score);
				}
			}

			calc = move(next_calc);
		}

		int ans = 0;
		for(const auto &e : calc){
			chmax(ans, e.second);
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 8532
#include <stdio.h>
 
int main(void){
   int N, K;

   scanf("%d %d",&N,&K);

   int d[K], A[K][N], i, j, B[N], ans=0;

   for(i=0;i<K;i=i+1){
      scanf("%d",&d[i]);

      for(j=0;j<d[i];j=j+1){
         scanf("%d",&A[i][j]);
      }
   }

   for(i=0;i<N;i=i+1)
      B[i]=0;
   
   for(i=0;i<K;i=i+1){
      for(j=0;j<d[i];j=j+1){
         B[(A[i][j]-1)]=B[(A[i][j]-1)]+1;
      }
   }  
   
   for(i=0;i<N;i=i+1){
      if(B[i]==0)
      ans=ans+1;
   }

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

Measured memory_bytes: 1692
import           Data.Maybe
import qualified Data.ByteString.Char8         as C8

getInts :: IO [Int]
getInts = fmap (map (fst . fromJust . C8.readInt) . C8.words) C8.getLine

main :: IO ()
main = do
    _  <- getLine
    hs <- getInts
    print $ solve (0 : hs)

solve :: [Int] -> Int
solve hs = sum . filter (\x -> x > 0) . zipWith (-) (tail hs) $ hs


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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

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

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);
inline ll pow5(ll);

// ================ Main Loop ================
int main() {
    ll x;
    cin >> x;
    vector<ll> fived;
    int i = 0;
    /*while(pow5(i) - pow5(i - 1) < 1e9) {
        fived.push_back(pow5(i));
        // cout << fived[i] << endl;
        i++;
    }*/
    int sz = 120;
    for(int a = -sz; a <= sz; a++) {
        for(int b = -sz; b <= sz; b++) {
            if(pow5(a) == pow5(b) + x) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

template <class T>
inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

inline ll pow5(ll x) {
    return x * x * x * x * x;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int n,w,a[1002],v[1002],c[1002],m,val;
	cin>>n>>w;
	
	int dp[w+7];
	memset(dp,0,sizeof(dp));
	for (int i=0;i<n;i++)
	{
		cin>>m>>val;
		for (int j=w;j>=m;j--) dp[j]=max(dp[j],val+dp[j-m]);
	}
	cout<<dp[w]<<"\n";
	
}


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

using std::cin;
using std::cout;
using std::endl;
using std::terminate;


template<class T> inline T min(T X, T Y) {
    return X < Y ? X : Y;
}

template<class T> inline T abs(T X) {
    return X > 0 ? X : -X;
}

void solve() {
    int N, X, Y; cin >> N >> X >> Y;
    int k[N];
    for (int i = 1; i <= N - 1; ++i) {
        k[i] = 0;
    }

    for (int i = 1; i <= N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            int l = min(abs(j - i), min(abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X)));
            k[l]++;
        }
    }

    for (int i = 1; i <= N - 1; ++i) {
        cout << k[i] << endl;
    }
}

int main() {

#ifdef DEV
    std::ifstream in("input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
  int H, W;
  cin >> H >> W;
  for(int row=0; row<H; row++){
    for(int col=0; col<W; col++){
      string s;
      cin >> s;
      if(s=="snuke"){
        cout << char(col + 'A') << row + 1 << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<memory.h>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int N, W;
    //freopen("input.txt", "r", stdin);
    scanf("%d%d", &N, &W);
    vector<int>w(N);
    vector<int>v(N);
    for(int i=0; i<N; i++)
    {
        scanf("%d%d", &w[i], &v[i]);
    }
    vector<vector<long> > dp(N+1, vector<long>(W+1, 0));
    for(int i=1; i<=N; i++)
    {
        for(int j=1; j<=W; j++)
        {
            if(j>=w[i-1])dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    printf("%ld\n", dp[N][W]);
    return 0;
}

Measured memory_bytes: 80256
#include <iostream>

int main()
{
    int s, m, h;
    std::cin >> s;
    m = s / 60;
    s = s % 60;
    h = m / 60;
    m = m % 60;
    std::cout << h << ':' << m << ':' << s << std::endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(i,array) for(auto& x:array)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mod 1000000007
#define inf 10000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

vll b(1e6+9);
ll s;

int main(){
    cin>>s;
    b[s]++;
    rep(i,1e6+9){
        if(s%2==0)s=s/2;
        else s=3*s+1;
        if(b[s]==0)b[s]++;
        else{
            cout<<i+2<<endl;
            break;
        }
    }
    return 0;
}

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

int main() {
    long n, m;
    cin >> n >> m;
    long ans = 1;
    for (long i = 1; i * i <= m; i++) {
        long r = m % i;
        if (r == 0) {
            if (m >= i * n)
                ans = max(i, ans);
            if (i >= n)
                ans = max(m / i, ans);
        }
    }
    cout << ans << endl;
    return 0;
}



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

typedef long long ll;

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

  int f=2;  // 0:非単調増加 1:非単調減少 2:未決定
  int cnt=1;
  for(int i=0; i<N-1; i++){
    if(a[i]<a[i+1]){
      if(f==2){
        f=1;
      }
      else if(f==0){
        f=2;
        cnt++;
      }
    }
    else if(a[i]>a[i+1]){
      if(f==2){
        f=0;
      }
      else if(f==1){
        f=2;
        cnt++;
      }
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int main() {
    double x,y,l,n; ll d,c=0; cin>>n>>d;
    while(n--)
    {
        cin>>x>>y;
        l=sqrt(x*x+y*y);
        if (l<=d) {c++;}
    }
    cout<<c;
	return 0;
}

Measured memory_bytes: 3808
#include<iostream>
#define N 110
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,a,b,temp;	
struct nex{
	int x,y;
};
nex next[N][N];
int used[N][N];
int func(int p/*y*/,int q/*x*/){
	if(used[p][q]==1)
		return 0;
	if(used[p][q]==2)
		return 1;
	used[p][q]=2;
	nex pre=next[p][q];
	return func(pre.y,pre.x);
}
int main(){
	while(cin>>n,n){
		temp=0;
		rep(i,n)
		rep(j,n){
			used[i][j]=0;
			cin>>a>>b;
			next[i][j].x=a;
			next[i][j].y=b;
		}
		rep(i,n)
		rep(j,n){
			if(used[i][j]==0){
				if(func(i,j)){
					temp++;
				}
				rep(h,n)
						rep(k,n)
						if(used[h][k]==2)
							used[h][k]=1;
			}
		}
		cout<<temp<<endl;
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  bool A = false;
  int d = 0;
  
  for(int i = 1; i < 10; i++){
    for(int j = 1; j < 10; j++){
      if(i*j == N){
       A = true;
       break;
      }
    }
    if(A){
      break;
    }
  }
  
  if(A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
   int n,m,ans=0;
   cin>>n>>m;
   if(n>=13)
   ans=m;
   else if(n<13&&n>=6)
   ans=m/2;
   cout<<ans<<"\n";

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int a, b, c;
int main()
{
	scanf("%d%d%d", &a, &b, &c);
	int sum = a + b + c;
	if (sum >= 22)
		printf("bust\n");
	else
		printf("win");
		
	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

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

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

ll modpower(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll mod) {
    return modpower(a, mod - 2, mod);
}

ll largeCOM(ll n, ll r, ll mod) {
    ll u = 1, d = 1;
    rep (i, r) {
        u = (u * (n - i)) % mod;
        d = (d * (r - i)) % mod;
    }
    return u * modinv(d, mod) % mod;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll n;
    int a, b;
    cin >> n >> a >> b;
    ll res = modpower((ll)2, n, MOD) - 1;
    ll x = largeCOM(n, (ll)a, MOD);
    res -= x;
    if (res < 0) res += MOD;
    ll y = largeCOM(n, (ll)b, MOD);
    res -= y;
    if (res < 0) res += MOD;
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  string s,t;
  cin >> s >> t;
  string res = s;
  bool u = false;
  REP(i,s.size()-t.size()+1){
    string str = s.substr(i,t.size());
    bool f = true;
    REP(j,t.size()){
      if(str[j] != t[j] && str[j] != '?'){
	f = false;
      }
    }
    //cout << str << endl;
    if(f){
      string r = s;
      int k = 0;
      rep(j,i,i+t.size()){
	r[j] = t[k];
	k++;
      }
      REP(j,r.size()){
	if(r[j] == '?')
	  r[j] = 'a';
      }
      if(!u)
	res = r;
      else
	res = min(r,res);
      //cout << res << endl;
    }
    
  }
  bool f = true;
  REP(i,res.size()){
    if(res[i] == '?')
      f = false;
  }
  if(f)
    cout << res << endl;
  else
    cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int i, sum,tc, num[100000],save, j, min;
	
	scanf("%d", &tc);
	for(i =0; i<tc; i++)
		scanf("%d", &num[i]);
	min = num[0];
	for(i =0; i < tc; i++)
	{
		if(num[i] >= min)
		{
			min = num[i];
		
			save = i;
		}
	}
	sum = 0;
	for(i = 0; i<tc; i++)
	{
		if(i==save)
			sum = sum + num[i] / 2;
		else 
			sum += num[i];
	}
	printf("%d\n", sum);
	return 0;
}

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

const int N = 20;

int a[N][N];

int main() {
    ios::sync_with_stdio(0);                                                                                                                               
    cin.tie(0);
    int n, m, x;
    cin >> n >> m >> x;
    vector <int> cc(n);
    for (int i = 0; i < n; i++) {
        cin >> cc[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int mn = 1e9;
    for (int msk = 0; msk < (1 << n); msk++) {
        vector <int> c(m);
        for (int i = 0; i < n; i++) {
            if ((msk >> i) & 1) {
                for (int j = 0; j < m; j++) {
                    c[j] += a[i][j];
                }
            }
        }
        bool good = true;
        for (int i = 0; i < m; i++) {
            if (c[i] < x) good = false;
        }
        if (good) {
            int cur = 0;
            for (int i = 0; i < n; i++) {
                if ((msk >> i) & 1) {
                    cur += cc[i];
                }
            }
            mn = min(mn, cur);
        }
    }
    cout << (mn == 1e9 ? -1 : mn) << '\n';
    return 0;   
}

Measured memory_bytes: 3600
#include<stdio.h>
#define MAX 100000
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node Three[MAX];

int getDepth(int K){
  int depth = 0;

  for(depth = 0; Three[K].p != NIL; depth++){
    K = Three[K].p;
  }
return depth;
}

int main(){
  int i,j,n;
  int num,deg,child,l = 0;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    Three[i].p = NIL;
    Three[i].l = NIL;
    Three[i].r = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&num,&deg);

    for(j = 0; j < deg; j++){
      scanf("%d",&child);
      if(j == 0) Three[num].l = child;
      else Three[l].r = child;
      l = child;
      Three[child].p = num;
    }
  }

  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d",i,Three[i].p,getDepth(i));

    if(getDepth(i) == 0){
      printf(", root, [");
    }
    else if(Three[i].l == NIL){
      printf(", leaf, [");
    }
    else{
      printf(", internal node, [");
    }

    j = Three[i].l;

    while(j != NIL){
      printf("%d", j);
      j = Three[j].r;

      if(j != NIL){
	printf(", ");
      }
    }
    printf("]\n");
  }

  return 0;
}

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

int main(int argc, char *argv[]) {
  string str;
  cin >> str;
  for (auto &ch : str) {
    if (ch == '9') ch = '1';
    else if (ch == '1') ch = '9';
  }
  cout << str << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
  private static class Solver {
    int solve(int W, List<Integer> values, List<Integer> weights) {
      int[] dp = new int[W + 1];
      for (int i = 1; i <= values.size(); ++i) {
        for (int j = 0; j <= W; ++j) {
          int v = values.get(i - 1);
          int w = weights.get(i - 1);
          if (j - w >= 0) {
            dp[j] = Math.max(dp[j], dp[j - w] + v);
          }
        }
      }
      return dp[W];
    }
  }

  private static final Pattern SPLIT = Pattern.compile("\\s");
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    List<Integer> weights = new ArrayList<>();
    List<Integer> values = new ArrayList<>();
    List<Integer> NW = Stream.of(SPLIT.split(scanner.nextLine())).map(Integer::valueOf)
        .collect(Collectors.toList());
    final int N = NW.get(0);
    final int W = NW.get(1);
    for (int i = 0; i < N; ++i) {
      List<Integer> collect = Stream.of(SPLIT.split(scanner.nextLine())).map(Integer::valueOf)
          .collect(Collectors.toList());
      values.add(collect.get(0));
      weights.add(collect.get(1));
    }
    System.out.println(new Solver().solve(W, values, weights));
  }
}

Measured memory_bytes: 33148
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>


using namespace std;

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

    s[K-1] = tolower(s[K-1]);
    cout << s;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[3,5,7,11,13]
ans=[0]*10000
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            ans[l[i]*l[j]*l[k]]=1
ans[135]=1
ans[189]=1
print(sum(ans[:n+1]))

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

int main() {
	string s,t="CODEFESTIVAL2016";
	cin>>s;
	int ans=0;
	for(int i=0;i<16;i++){
		if(s[i]!=t[i])ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.equals("SUN")) {
            System.out.println(7);
        }
        else if (s.equals("MON")) {
            System.out.println(6);
        }
        else if (s.equals("TUE")) {
            System.out.println(5);
        }
        else if (s.equals("WED")) {
            System.out.println(4);
        }
        else if (s.equals("THU")) {
            System.out.println(3);
        }
        else if (s.equals("FRI")) {
            System.out.println(2);
        }
        else if (s.equals("SAT")) {
            System.out.println(1);
        }
        else {
            throw new RuntimeException("Zzz");
        }
    }
}


Measured memory_bytes: 23892
s = gets.to_s.chomp
k = gets.to_s.to_i

b = s.bytes
# p "az".bytes #=> [97, 122]
ans = 'a' * s.size
b.each_with_index do |c, i|
  
  if c == 97
    next
  else
    d = 123 - c
    if d <= k
      k -= d
    else
      ans[i] = s[i]
    end
  end
end

ans[-1] = (97 + (ans[-1].ord + k - 97) % 26).chr

puts ans

Measured memory_bytes: 2940
s=input()
if(s[0:7]=='keyence'):
    print('YES')
    exit()
elif(s[-7:]=='keyence'):
    print('YES')
    exit()    
else:
    for i in range(7):
        t=s[0:i+1]+s[-6+i:]
        
        if(s[0:i+1]+s[-6+i:]=='keyence'):   
            print('YES')
            exit()
print('NO')       

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int  l = sc.nextInt();
		int  a = sc.nextInt();
		int  b = sc.nextInt();
		int  c = sc.nextInt();
		int  d = sc.nextInt();
		int l1=a/c;
		int l2=b/d;
		if(a%c!=0) l1+=1;
		if(b%d!=0) l2+=1;
		if(l1<l2) l1=l2;
		System.out.println(l-l1);
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

string s;


int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
   
  cin >> s;
  
 bool flag=true;
  
  ll n=s.length();
  
  rep(i,0,n) if(s[i]!=s[n-1-i]) flag=false;
  
  string t="";
  string u="";
  
  rep(i,0,(n-1)/2) t+=s[i];
  rep(i,(n+1)/2,n) u+=s[i];
  
  string x,y;
  x=t;
  y=u;
  
  reverse(t.begin(),t.end());
  reverse(u.begin(),u.end());
  
  if(x!=t||y!=u) flag=false;
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    n %= 10;
    if (n == 3) cout << "bon" << endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
    else cout << "hon" << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){

    int k, a, b;

    cin >> k >> a >> b;

    int i = 0;
    while(1){
        int ans = k*i;
        if(a <= ans && ans <= b){
            cout << "OK" << endl;
            break;
        }else if(a <= ans && ans > b){
            cout << "NG" << endl;
            break;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	set<int> A{ a,b,c };
	cout << A.size() << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int size = n;
        int[][] graph = new int[size][size];

        while (n-- > 0) {
            int row = sc.nextInt() - 1;
            int item = sc.nextInt();
            while (item-- > 0) {
                graph[row][sc.nextInt() - 1] = 1;
                //printArr(graph, size);
            }
        }
        printArr(graph, size);
    }

    static void printArr(int[][] arr, int size) {
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                System.out.print(arr[i][j]);
                System.out.print(j < size - 1 ? " " : "");
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 34316
#include "bits/stdc++.h"
using namespace std;
#define test int t; cin >> t; while (t--)
#define fast ios::sync_with_stdio(NULL); cin.tie(NULL)
#define mod 1000000007
#define endl "\n"
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define ALL(v) v.begin(),v.end()
#define ll long long
typedef vector<ll> vecll;
typedef vector<int> veci;
typedef vector<char> vecc;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define time 1.0 * clock() / CLOCKS_PER_SEC


int main(){
    fast;

    //test{}
    ll m,n;
    cin >>m>>n;
    cout<< ((m*(m-1))/2)+((n*(n-1))/2);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,m; cin >> n >> m;
    cout << n - m + 1 << endl;
}




Measured memory_bytes: 256
s = input()

for bit in range(1<<3):
    f = s[0]
    for i in range(3):
        if (bit>>i) & 1:
            f += "+"
        else:
            f += "-"
        f += s[i+1]
    
    ans = eval(f)
    if ans == 7:
        print(f + "=7")
        exit()

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<int>();
            for (int i = 0; i < 10; i++)
            {
                list.Add(int.Parse(Console.ReadLine()));
            }
            list.Sort();
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(list[9-i]);
            }
        }
    }
}

Measured memory_bytes: 9164
num = gets.to_i
arr = []
dp = Array.new(num)
num.times do |i|
	arr[i] = gets.split.map(&:to_i)
	dp[i] = Array.new(3, -Float::INFINITY)
end
dp[0] = arr[0]

(num-1).times do |i|
	3.times do |j|
		3.times do |k|
			if j != k
				dp[i+1][k] = [dp[i][j] + arr[i+1][k], dp[i+1][k]].max
			end
		end
	end
end

p dp[num-1].max

Measured memory_bytes: 25980
#include <iostream>

int main(int argc, char const *argv[])
{
  int a, b;
  std::cin >> a;
  std::cin >> b;

  if (b % a == 0) {
    std::cout << a + b << std::endl;
  } else {
    std::cout << b - a << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=input()
b=input()
c=[]
i=0
while i<n:
    if i==n-1:
        c.append(1)
        i+=1
    elif a[i]==a[i+1]:
        c.append(0)
        i+=2
    else:
        c.append(1)
        i+=1
if c[0]==0: count=6
else: count=3
    
for i in range(len(c)-1):
    if c[i]==1: count*=2
    elif c[i]==0 and c[i+1]==0: count*=3
print(count%1000000007)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = Double.parseDouble(sc.next());
        double b = Double.parseDouble(sc.next());

        if (a > b){
        	System.out.println("GREATER");
        }else if (b > a){
        	System.out.println("LESS");
        }else {
        	System.out.println("EQUAL");
        }
    }
}

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

char RPS(char h) {
    char c;
    if(h == 'r')
        c = 'p';
    else if(h == 's')
        c = 'r';
    else
        c = 's';
    return c;
}

int main() {
    int N,K,R,S,P,i,a=0;
    string T;
    cin >> N >> K >> R >> S >> P >> T;

    string ph="";
    map<char,int> sc;
    sc['r'] = R;
    sc['s'] = S;
    sc['p'] = P;

    for(i=0; i<K; i++) {
        ph += RPS(T.at(i));
        a += sc.at(RPS(T.at(i)));
    }

    for(i=K; i<N; i++) {
        char ch = RPS(T.at(i));
        if(ch != ph.at(i%K)) {
            a += sc.at(ch);
            ph.at(i%K) = ch;
        } else {
            if(i+K < N) {
                set<char> h;
                h.insert('r');
                h.insert('s');
                h.insert('p');
                h.erase(ph.at(i%K));
                h.erase(RPS(T.at(i+K)));
                ph.at(i%K) =*begin(h);
            }
        }
    }

    cout << a << endl;
}

Measured memory_bytes: 640
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<f64>();
    let mut sum = 0.0;
    for i in 0..n {
        let a2 = 1.0 / a[i];
        sum += a2;
    }
    let ans = 1.0 / sum;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	vector<int>a(5);
	int k;
	bool f = false;

	int i,j;
	for (i = 0; i < 5; i++)
	{
		cin >> a.at(i);
	}
	cin >> k;

	for (i = 0; i < 4; i++)
	{
		for (j = i; j < 5; j++)
		{
			if (a.at(j) - a.at(i) > k)
				f = true;
		}
	}
	if (f)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;
}

Measured memory_bytes: 3568
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define fi first
#define se second
#define sqrt(x) sqrt(abs(x))
#define sqr(x) ((x) * (x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define fill(x, y) memset(x, y, sizeof(x))
#define mp make_pair
#define pb emplace_back
#define popcnt __builtin_popcount
#define ctz __builtin_ctz

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
template <class T> using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;
    return in;
}

template <class T>
ostream& operator << (ostream &out, vector <T> &a) {
    for (T &i: a) out << i << ' ';
    return out;
}

template <class T>
ostream& operator << (ostream &out, set <T> &a) {
    for (auto &i: a) out << i << ' ';
    return out;
}

template <class T, class U>
istream& operator >> (istream &in, pair <T, U> &p) {
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator << (ostream &out, pair <T, U> &p) {
    out << p.first << ' ' << p.second;
    return out;
}

void fastIO() {
    ios_base:: sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
}

int ans = -1;

signed main() {
    fastIO();

    int a, b;
    cin >> a >> b;
    for (int i = 1009; i >= 1; --i) {
        if (int(i * 0.08) == a && int(i * 0.1) == b) {
            ans = i;
        }
    }

    cout << ans;

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ:
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */



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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

struct UnionFind {
#define MAX 200001
    int root[MAX];
    void Init() {rep(i,MAX) root[i] = -1;}
    void unite(int a ,int b) {
        int a_root = find(a),b_root = find(b);
        if (a_root != b_root) {
            if (root[a_root] > root[b_root]) {
                root[a_root] += root[b_root];
                root[b_root] = a_root;
            } else {
                root[b_root] += root[a_root];
                root[a_root] = b_root;
            }
        }
    }
    int find(int a) {
        if (root[a] < 0) return a;
        else {
            root[a] = find(root[a]);
            return root[a];
        }
    }
    int size(int a) {
        int a_root = find(a);
        return -root[a_root];
    }
    /*
     * root : rootの番号
     * unite : 併合
     * find : aのrootを返す
     * size : aのグループの要素数
     * */
};

int h,w,W,memo[402][402], cnt[402][402][2], ans;
UnionFind UF;
set<int> st;

signed main() {
    rep(i,402) rep(j,402) memo[i][j] = -1;
    UF.Init();
    cin >> h >> w;W=w+2;
    rep1(i,h) rep1(j,w) {
        char tmp;
        cin >> tmp;
        if (tmp == '.') memo[i][j] = 0, cnt[i][j][0]++;
        else memo[i][j] = 1, cnt[i][j][1]++;
    }
    rep1(i,h) rep1(j,w) {
        int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
        rep(k,4) {
            int I=i+dy[k], J=j+dx[k];
            if (memo[i][j] == -1 || memo[I][J] == -1) continue;
            if (memo[i][j] != memo[I][J] && UF.find(i*W+j) != UF.find(I*W+J)) {
                int ij = UF.find(i*W+j), IJ = UF.find(I*W+J);
                int ii = ij/W, jj = ij%W, II = IJ/W, JJ = IJ%W;
                int tmp0 = cnt[ii][jj][0] + cnt[II][JJ][0], tmp1 = cnt[ii][jj][1] + cnt[II][JJ][1];
                cnt[ii][jj][0] = cnt[II][JJ][0] = tmp0;
                cnt[ii][jj][1] = cnt[II][JJ][1] = tmp1;
                UF.unite(ij, IJ);
            }
        }
    }
    rep1(i,h) rep1(j,w) st.insert(UF.find(i*W+j));
    for(auto i : st) ans += cnt[i/W][i%W][0] * cnt[i/W][i%W][1];
    cout << ans << endl;
}

Measured memory_bytes: 12160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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

int main(){
	int n,m;

	cin >> n >> m;

	cout << n+1-m << endl;

	return 0;
}

Measured memory_bytes: 256