akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int k;
    scanf("%d", &k);
    if(k==1||k==2||k==3||k==5||k==7||k==11||k==13||k==15||k==17||k==19||k==23||k==29||k==31){
        printf("%d", 1);
    } else if (k==4||k==6||k==9||k==10||k==14||k==21||k==22||k==25||k==26){
        printf("%d", 2);
    } else if (k==8||k==12||k==18||k==20||k==27){
        printf("%d", 5);
    } else if (k==28||k==30){
        printf("%d", 4);
    } else if (k==16){
        printf("%d", 14);
    } else if(k==24){
        printf("%d", 15);
    } else {
        printf("%d", 51);
    }
    
    return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void pV(vector<ll> A){
    cout << "[vector]";
    for(int i=0; i<A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

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

    // input
    string S;
    cin >> S;

    int answer = 0;
    FOR(i, 0, 4){
        if(S[i]=='+'){
            answer++;
        }else{
            answer--;
        }
    }

    p(answer);

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	static int a,b,total;

	public static void main(String[] args){
      	Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
		total=0;

		push();
		push();

		System.out.println(total);
	}

	public static void push() {
		if(a>=b) {
			total+=a;
			a--;
		}else {
			total+=b;
			b--;
		}
	}
}

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

int main(){
    int m,f,b;
    cin>>m>>f>>b;
    if(b<=m){
        cout<<0<<endl;
    }else if(b-m<=f){
        cout<<b-m<<endl;
    }else{
        cout<<"NA"<<endl;
    }
    return 0;
}


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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

signed main()
{

	string s; cin >> s;

	//14買いで7回以上かつ
int cnt{};

	for(auto x: s){
		if(x == 'o'){
			cnt++;
		}
	}

//15-s.size()が

	if(s.size() <= 7){
		cout << "YES" << endl;
	}
	else if(s.size()-cnt <= 7){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>

#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))

using namespace std;

int main(){
    int n;
    int x;
    int ans = 0;
    cin >> n;
    int a[n];
    cin >> x;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    //入力

    sort(a, a + SIZE_OF_ARRAY(a));

    for(int j=0;j<n-1;j++){
        if(x < a[j]){
            break;
        }
        else{
            x = x - a[j];
            ans++;
            // printf("x:%d\n",x);
        }
    }

    if(x == a[n-1]){
        ans++;
    }

    printf("%d",ans);

}


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

using namespace std;

class graph
{
  int v;
  list<int> *l;
  int *max_depth;

  public:

  graph(int v)
  {
    this->v = v;
    l = new list<int>[v+1];
    max_depth = new int[v+1];

    for(int i = 0 ; i<=v ; i++)
      max_depth[i] = 0;
  }

  void add_edge(int x , int y)
  {
    l[x].push_back(y);
  }

  void print_graph()
  {
    for(int i = 1 ; i<=v ; i++)
    {
      cout<<i<<" : ";
      for(int x : l[i])
      {
        cout<<x<<" -> ";
      }
      cout<<endl;
    }
  }

  int cal_max_depth(int start , bool visited[])
  {
    if(visited[start] == true)
    {
      return max_depth[start];
    }


    visited[start] = true;
    int ans = 0;

    for(auto nbr : l[start])
    {
      ans = max(ans, 1 + cal_max_depth(nbr,visited));
    }

    //cout<<"Max_depth of "<<start<<" is set as: "<<ans<<endl;
    return max_depth[start] = ans;
  }

  void func()
  {
    bool visited[v+1];
    for(int i = 0 ; i<=v ; i++)
        visited[i] =false;

    for(int i = 1 ; i<=v ; i++)
    {
      if(visited[i] == false)
      {
        max_depth[i] = cal_max_depth(i,visited);
      }
    }

    int ans = 0;

    for(int i = 1 ; i<=v ; i++)
    {
      ans = max(ans,max_depth[i]);
    }

    cout<<ans;
  }

};

int main()
{
  int n, m;
  cin>>n>>m;
  graph G(n);
  int u,v;

  for(int i = 0 ; i<m ; i++)
  {
    cin>>u>>v;
    G.add_edge(u,v);
  }

  G.func();
  //G.print_graph();

  
  return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, M;
	cin >> N >> M;
	vector<int64> G[112345];
	REP(i, M) {
	  int64 u, v;
	  cin >> u >> v; u--; v--;
	  G[u].push_back(v);
	  G[v].push_back(u);
	}
	priority_queue<PLL, vector<PLL>, greater<PLL>> pq;
	vector<int64> d(N, INF_LL);
	d[0] = 0;
	pq.emplace(0, 0);
	while (pq.size()) {
	  int64 v, c;
	  tie(c, v) = pq.top(); pq.pop();
	  if (d[v] < c) continue;
	  for (auto& e : G[v]) {
	    if (d[e] > d[v] + 1) {
	      d[e] = d[v] + 1;
	      pq.emplace(d[e], e);
	    }
	  }
	}

	cout << "Yes" << endl;
	FOR(i, 1, N) {
	  for (auto &u : G[i]) {
	    if (d[u] + 1 == d[i]) {
	      cout << u + 1 << endl;
	      break;
	    }
	  }
	}
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    string S;
    cin >> N >> S;

    ll cnt = 0;
    REP(i,0,N-2) {
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ++cnt;
    }   
    _PR(cnt);

    return 0;
}

/*



*/

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

int main() {
    int n,d,x;cin>>n>>d>>x;
    int a[n];rep(i,n)cin>>a[i];
    int ans = x;
    rep(i,n){
        int tmp=1;
        ++ans;
        while(tmp<=d){
            tmp+=a[i];
            if(tmp<=d)++ans;
        }
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3640
import sys
input = sys.stdin.readline

N,M,R = map(int,input().split())
r = list(map(int,input().split()))
S = [[]for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    S[a-1].append([b-1,c])
    S[b-1].append([a-1,c])
d = [[float('inf')]*N for i in range(N)]
queue = []
hoge = [0]*(M)
for i in range(N):
    queue = [i]
    d[i][i] = 0
    while queue !=[]:
        l = 0
        for q in queue:
            for next,c in S[q]:
                if d[i][next] > d[i][q]+c:
                    d[i][next] = d[i][q]+c
                    if not(next in hoge[:l]):
                        hoge[l] = next
                        l += 1
        queue = hoge[:l]
def func(x,l):
    if l == []:
        return 0
    ans = float('inf')
    for i in range(len(l)):
        ans =min(ans,func(l[i],l[:i]+l[i+1:]) + d[x-1][l[i]-1])
    return ans
ans = float('inf')
for i in r:
    ans = min(ans,func(i,r))
print(ans)

Measured memory_bytes: 95708
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

int main(){

  long long int N, tmp;
  std::vector<long long int> P;

  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    P.push_back(tmp);
  }

  long long int ans = 1;
  long long int min = P[0];
  for(long long int i = 1; i < N; i++){
    if(P[i] < min){
      ans++;
      min = P[i];
    }
  }

  std::cerr << "Answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 2420
import sys

def gcd(a, b): return gcd(b, a % b) if b else abs(a)
def lcm(a, b): return abs(a // gcd(a, b) * b)

a, b = map(int, sys.stdin.readline().split())

def main():
    print(lcm(a, b))

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 3060
//rohitaas_15
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> o_set;
#define ll  long long
#define int ll
#define um(a,b) unordered_map<a,b>
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(),v.end()
#define f(a,b) for(ll i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define show(x) cout<<x<<"\n"
#define printvector(v,n) f(0,n-1){cout<<v[i]<<" ";}
#define input(v,n) f(0,n-1){cin>>v[i];}
#define vr vector<ll>
#define check() cout<<"hi"<<"\n"
#define MOD 1000000007
//#define endl "\n"
#define maxv(v) *max_element(all(v));
#define minv(v) *min_element(all(v));
#define sumv(v) accumulate(all(v),0)
#define test() ll t;cin>>t;while(t--)
ll search(vr arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
ll CmP(ll n, ll r, ll p=MOD){if (r==0)return 1;ll fac[n+1];fac[0] = 1;for (ll i=1 ; i<=n; i++)fac[i] = fac[i-1]*i%p; return (fac[n]* modInverse(fac[r], p) % p *modInverse(fac[n-r], p) % p) % p; }
/*ll constructSTUtil(vr v,ll start,ll end,int *st,ll index)
{
	if(start==end)
	{
		st[index]=v[start];
		return st[index];
	}
	ll mid=(start+end)/2;
	st[index]=constructSTUtil(v,start,mid,st,2*index)+constructSTUtil(v,mid+1,end,st,2*index+1);
	return st[index];
}
ll *constructST(vr v,ll n)
{
	ll po=(ll)(ceil(log2(n)));
	ll msize=2*power(2,po)+1;
	vr st[msize];
	constructSTUtil(v,0,n-1,st,1);
	return st;
}*/
ll ask1(ll y)
{
	cout<<1<<" "<<y<<endl;
	ll x;
	cin>>x;
	return x;
}
ll repair()
{
	cout<<2<<endl;
	return 0;
}
bool compare(pair<ll,ll> &a,pair<ll,ll> &b)
{
	return a.second<b.second;
}
signed main()
{
	/*#ifndef ONLINE_JUDGE
	 freopen("input.txt","r",stdin);
	 freopen("output.txt","w",stdout);
	 #endif
     */
	 /*ll t;
	 cin>>t;
	 while(t--)
	 {
	 	*/
	 	ll a,b,c,d;
	 	cin>>a>>b>>c>>d;
	 	while(true)
	 	{
	 		c-=b;
	 		if(c<=0)
	 		{
	 			show("Yes");
	 			break;
	 		}
	 		a-=d;
	 		if(a<=0)
	 		{
	 			show("No");
	 			break;
	 		}
	 	}



	
	 	
	 	
	//}
	/*cout<<"Case #"<<cccc-t<<": ";
		cout<<*/

}


Measured memory_bytes: 3600
n=int(input())
l = list(map(int, input().split()))
count=0
kount=0
for i in range(n):
    if l[i]%2==0:
        count+=1
        if l[i]%3==0:
            kount+=1 
        elif l[i]%5==0: 
          kount+=1
if count==kount:
         print("APPROVED")
else:
         print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=200010;

ll h[N],a[N];

ll sgt[4*N];

void build(ll st,ll en,ll pos)
{
    if(st==en){
        sgt[pos]=0;
        return;
    }
    ll mid=(st+en)/2;
    build(st,mid,2*pos+1);
    build(mid+1,en,2*pos+2);
    sgt[pos]=max(sgt[2*pos+1],sgt[2*pos+2]);
}

void update(ll st,ll en,ll pos,ll idx,ll val)
{
    if(st==en){
        sgt[pos]=val;
        return;
    }
    ll mid=(st+en)/2;
    if(idx>=st&&idx<=mid){update(st,mid,2*pos+1,idx,val);}
    else{update(mid+1,en,2*pos+2,idx,val);}
    sgt[pos]=max(sgt[2*pos+1],sgt[2*pos+2]);
}

ll query(ll st,ll en,ll pos,ll l,ll r)
{
    if(st>r||en<l){return 0;}
    if(st>=l&&en<=r){return sgt[pos];}
    ll mid=(st+en)/2;
    return max(query(st,mid,2*pos+1,l,r),query(mid+1,en,2*pos+2,l,r));
}

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

    ll n;
    cin>>n;
    for(ll i=0;i<n;++i){cin>>h[i];--h[i];}
    for(ll i=0;i<n;++i){cin>>a[i];}
    build(0,n-1,0);

    ll dp[n];
    dp[0]=a[0];
    update(0,n-1,0,h[0],a[0]);

    for(ll i=1;i<n;++i)
    {

            ll lol=query(0,n-1,0,0,h[i]-1);

        dp[i]=lol+a[i];
        update(0,n-1,0,h[i],dp[i]);
    }

    ll ans=*max_element(dp,dp+n);

    cout<<ans<<endl;

    return (0);
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 5000;
const int M = 500;
const int MOD = 1e9 + 7;
const int alpha = 26;
const double PI = acos(-1);
ll n, k;
ll ans = 0;
ll a[N];
pll b[N];

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        b[i] = {a[i], i};
    }
    sort(b, b + n);
    reverse(b, b + n);
    vector<ll> dp(n);
    for (int j = 0; j < n; j++)
    {
        vector<ll> dp2(n + 1);
        for (int i = 0; i < n; i++)
        {
            int L = i;
            int R = n - 1 - j + i;
            //cout << L << " " << R << endl;
            if (0 <= L && R < n && L <= R)
            {
                dp2[i + 1] = max((ll)dp2[i + 1], dp[i] + abs(L - b[j].second) * b[j].first);
                dp2[i] = max((ll)dp2[i], dp[i] + abs(R - b[j].second) * b[j].first);
            }
        }
        //cout << b[j].first << " " << b[j].second << "\n";
        //for (int i = 0; i <= n; i++) cout << dp2[i] << " ";
        //cout << "\n";
        dp = dp2;
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++) ans = max(ans, (ll)dp[i]);
    cout << ans;
}


Measured memory_bytes: 3740
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define 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++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

//const long long MOD = 1000000007;
const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b; cin >> a >> b;
	if (a <= 5)cout << 0 << endl;
	else if (6 <= a && a <= 12)cout << b / 2 << endl;
	else cout << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
        int K, A, B;

        scanf("%d %d %d", &K, &A, &B);
        for(; A <= B; A++) {
                if(A % K == 0) {
                        printf("OK");
                        return 0;
                }
        }
        printf("NG");

        return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  for(int i = 0; i < (int)s.size() - 1; i++) {
    if(s[i] == s[i + 1]) {
      puts("Bad");
      return 0;
    }
  }
  puts("Good");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	int h[n];
	int i;
	for(i=0;i<n;i++)
	{
		cin>>h[i];
	}
	int dp[n];
	dp[0]=0;
	for(i=1;i<min(k,n);i++)
	{
		dp[i]=abs(h[i]-h[0]);
	}
	int j;
	for(i=k;i<n;i++)
	{
		int mini=dp[i-1]+abs(h[i]-h[i-1]);
		for(j=i-1;j>max(-1,i-1-k);j--)
		{
			mini=min(mini,dp[j]+abs(h[i]-h[j]));
		}
		dp[i]=mini;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 4396
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
using P = pair<int,int>;
 
const int M = 1000005;
 
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> cnt(M);
    for(int x : a){
        if(cnt[x] != 0){
            cnt[x] = 2;
            continue;
        }
        for(int i = x; i < M; i+= x) cnt[i]++;
    }
    int ans = 0;
    for(int x: a){
        if(cnt[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7984
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<deque>
#include<sstream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<bitset>
#include<time.h>
#include<cstdlib>
#include<cassert>
#define ll long long
using namespace std;

string s;
                   
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
  cin>>s;
  if(s[0]=='9' || s[1]=='9')cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


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

    if(a == b && b == c && c == a){
        cout <<"No" << endl;
    }else if(a == b || b == c || c == a){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

  

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        long inu = sc.nextLong();

        StringBuilder sb = new StringBuilder();
        while (inu > 0) {
            inu -= 1;
            long a = inu % 26;
            inu /= 26;
            char c = (char)(a + 'a');
            sb.insert(0, c);
        }

        System.out.println(sb.toString());
    }
}

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

int main(){
  int N,M,X;
  cin >> N >> M >> X;
  vector<int> C(N);
  vector<vector<int>> A(N, vector<int>(M));
  for(int i=0; i<N; i++){
    cin >> C[i];
    for(int j=0; j<M; j++){
      cin >> A[i][j];
    }
  }
  int ans = 1200001;
  for(int bit=0; bit<(1<<N); bit++){
    int sum = 0;
    vector<int> learn(M,0);
    for(int i=0; i<N; i++){
      if(bit>>i&1){
        sum += C[i];
        for(int j=0; j<M; j++)
          learn[j] += A[i][j];
      }
    }
    bool ok = true;
    for(int i=0; i<M; i++)
      if(learn[i] < X)
        ok = false;
    if(ok)
      ans = min(ans, sum);
  }
  if(ans == 1200001)
    cout << -1 << endl;
  else
    cout << ans << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define MOD 998244353LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string s;
int dp[4005][4005];
int suma[4005];
int sumb[4005];

int main(void){
    cin >> s;
    int n=s.size();
    for(int i=0;i<(int)s.size();i++){
        suma[i+1]+=suma[i];
        sumb[i+1]+=sumb[i];
        if(s[i]=='0'){
            suma[i+1]+=2;
        }
        if(s[i]=='1'){
            suma[i+1]+=1;
            sumb[i+1]+=1;
        }
        if(s[i]=='2'){
            sumb[i+1]+=2;
        }
    }
    for(int i=n;i<2*n;i++){
        suma[i+1]+=suma[i];
        sumb[i+1]+=sumb[i];
    }
    dp[0][0]=1;
    for(int i=0;i<n*2;i++){
        for(int j=0;j<=i;j++){
            //printf("%d %d %d\n",i,j,dp[i][j]);
            if(dp[i][j]==0)continue;
            if(suma[i+1]>=j+1){
                dp[i+1][j+1]+=dp[i][j];
                dp[i+1][j+1]%=MOD;
            }
            if(sumb[i+1]>=i-j+1){
                dp[i+1][j]+=dp[i][j];
                dp[i+1][j]%=MOD;
            }
        }
    }
    printf("%d\n",dp[n*2][suma[n]]);
    return 0;
}

Measured memory_bytes: 60544
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoderBeginnerContest152
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split().ToArray();
			var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();

			var u = Console.ReadLine();

			if (u == input[0])
			{
				System.Console.WriteLine(--inputs[0] + " " + inputs[1]);
			}
			else
			{
				System.Console.WriteLine(inputs[0] + " " + --inputs[1]);
			}


		}
	}
}

Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int a, b, r;
	cin >> r >> a >> b;
	if ((r * 100 + a * 10 + b) % 4 == 0) { cout << "YES" << endl; }
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>


using namespace std;

auto solve (vector<int64_t> const & nums) {
    int ans = 0;

    vector<int> v (nums.size());

    int count = 0;
    for (int i = 0; i < nums.size (); ++i) {
        v[i] += count;
        if (nums[i] == 0)
            count++;
    }

    count = 0;
    for (int i = nums.size() - 1; 0 <= i; --i) {
        v[i] += count;
        if (nums[i] == 1)
            count++;
    }

    auto it = std::min_element(v.begin(), v.end());

    return *it;
}

int main () {
    int n;
    cin >> n;
    vector<int64_t> nums;
    nums.reserve(n);

    char y;
    while (!std::cin.eof()) {
        if (!std::cin.get(y))
            break;
        if (y != 'W' && y != 'E')
            continue;

        int val = (y == 'W') ? 0 : 1;
        nums.push_back(val);
    }

    cout << solve (nums) << endl;

    return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, m, a, b, c, ans = 0;
  scanf("%lld%lld", &n, &m);
  ll cnt[m];
  for(i = 0; i < m; ++i) cnt[i] = 0;
  for(i = 0; i < n; ++i) {
    scanf("%lld", &k);
    for(j = 0; j < k; ++j) scanf("%lld", &a), cnt[--a]++;
  }
  for(i = 0; i < m; ++i) if(cnt[i] == n) ++ans;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.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 ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    int a,b,c; cin>>a>>b>>c;
    cout<<max(c-a+b,0)<<endl;
}

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

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif
    int n,k;
    cin>>n>>k;
    set<int> s;
    while(k--){
    	int p;
    	cin>>p;
    	
    	while(p--){
    		int k;
    		cin>>k;
    		s.insert(k);
    	}

    }
    cout << n-s.size() ; 
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	
	if(a[0] == 5 && a[1] == 5 && a[2] == 7){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void Tree(int * ,int);
int main() {
  int i,h;
  int A[250];
  scanf("%d",&h);
  for (i = 0; i < h; i++) {
    scanf("%d",&A[i]);
  }
  Tree(A,h);
  return 0;
}
void Tree(int *A,int h){
  int i;
  for (i = 0; i < h; i++) {
    printf("node %d: key = %d, ",i+1,A[i]);
    if (i != 0) {
      printf("parent key = %d, ",A[(i-1)/2]);
    }
    if (2*i+1 < h) {
      printf("left key = %d, ",A[2*i+1]);
    }
    if (2*i+2 < h) {
      printf("right key = %d, ",A[2*i+2]);
    }
    printf("\n");
  }

}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int n;
	vector<int>p;
	cin >> n;
	int m = n;
	for (int i = 2; i*i < m; i++){
		while (1){
			if (n % i == 0){
				p.push_back(i);
				n = n / i;
			}
			else break;
		}
	}
		if (n != 1)p.push_back(n);
		cout << m << ":";
		for (int i = 0; i < p.size(); i++){
			cout <<" "<< p[i];
		}
		cout << endl;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

int co[700][330];
int C=330;

int dp[330][330];

int get(vector<char> a, vector<char> b){
	int n=a.size();
	for (int i=0;i<=n;i++){
		for (int ii=0;ii<=n;ii++){
			dp[i][ii]=n*n*n;
		}
	}
	memset(co, 0, sizeof(co));
	for (int i=0;i<n;i++){
		for (int ii=0;ii<n;ii++){
			if (a[i]==b[ii]){
				co[i-ii+C][i]++;
			}
		}
	}
	for (int i=0;i<700;i++){
		for (int j=1;j<310;j++){
			co[i][j]+=co[i][j-1];
		}
	}
	dp[0][0]=0;
	for (int i=0;i<=n;i++){
		for (int ii=0;ii<=n;ii++){
			dp[i][ii]+=co[ii-i+C][n-1-i];
			dp[i+1][ii]=min(dp[i+1][ii], dp[i][ii]);
			dp[i][ii+1]=min(dp[i][ii+1], dp[i][ii]);
		}
	}
	return dp[n][n];
}

string s[333];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	//n=300;m=300;
	for (int i=0;i<n;i++){
		cin>>s[i];
	}
	int v=0;
	for (int i=1;i<m;i++){
		vector<char> a,b;
		for (int j=0;j<n;j++){
			a.push_back(s[j][i-1]);
			b.push_back(s[j][i]);
		}
		v+=get(a, b);
	}
	cout<<v<<endl;
}

Measured memory_bytes: 1792
num1=[]
num2=[]
for i in range(4):
    x=int(input())
    num1.append(x)
    
for i in range(2):
    y=int(input())
    num2.append(y)   
    
num1.sort()
num2.sort()

a=num1[1]
b=num1[2]
c=num1[3]
d=num2[1]
    

date=int(a+b+c+d)


print(date)



Measured memory_bytes: 5596
/*
the top of the losers
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))
#define    X            real()
#define    Y            imag()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<double>
#define     point        complex<double>
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    PI  acos(-1)
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}


int main(){
      GO();
      int n,k;
      cin>>n>>k;
      int cnt=0;
      for(int i=0;i<n;i++){
        int no;
        cin>>no;
        if(no>=k)
            cnt++;
      }
      cout<<cnt<<endl;

}


Measured memory_bytes: 256
# AFTER CONTEST


def solve(n):
    if n % 7 == 0:
        n //= 7

    if n % 2 == 0 or n % 5 == 0:
        return -1

    # Since R(k) = 1...1 = (10^k - 1) / 9, we have
    #   n | R(k)
    #   <=> 10^k = 1 ∈ Z_9n
    n9 = n * 9
    d = 10 % n9
    for i in range(n9):
        if d == 1:
            return i + 1
        d = (10 * d) % n9
    raise RuntimeError()


def main(istr, ostr):
    (k,) = list(map(int, istr.readline().strip().split()))
    result = solve(k)
    print(result, file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)


Measured memory_bytes: 9116
void main() {
	auto arr = [ri,ri,ri,ri,ri];
	int res = int.max;
	do {
		int current = 0;
		foreach(v; arr) {
			if(current % 10 != 0) current += (10 - current % 10);
			current += v;
		}
		res = min(res, current);
	} while(nextPermutation(arr));
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
)

func main() {
	sc := NewScanner()

	n := sc.NextInt()

	ans := "APPROVED"
	for i := 0; i < n; i++ {
		n := sc.NextInt()
		if n%2 != 0 {
			continue
		}
		if n%3 != 0 && n%5 != 0 {
			ans = "DENIED"
		}
	}
	fmt.Printf("%+v\n", ans) // output for debug
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1776
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  ll N, M;

  cin >> N >> M;

  unordered_map<ll, ll> os;
  unordered_map<ll, ll> ns;

  for (ll i = 0; i < M; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 1)
      os[b]++;
    else if (b == 1)
      os[a]++;
    else if (a == N)
      ns[b]++;
    else if (b == N)
      ns[a]++;
  }

  bool ans = false;
  for (auto& kv : os) {
    if(ns[kv.first] > 0){
      ans = true;
      break;
    }
  }

  string ansstr = (ans) ? "POSSIBLE" : "IMPOSSIBLE";

  cout << ansstr << endl;

  return 0;
}


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

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	std::vector<int> imos(N + 1);
	for (int m_i{}; m_i < M; m_i++)
	{
		int L, R;
		scanf("%d%d", &L, &R);
		L--;
		imos[L]++;
		imos[R]--;
	}
	for (int i{1}; i <= N; i++)
		imos[i] += imos[i - 1];
	int count{};
	for (int i{}; i < N; i++)
		if (imos[i] == M)
			count++;

	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (N,K) = readLine()!!.split(" ").map{ i -> i.toInt() }
    var result = 1
    for(i in 1..N){
      if(i == 1) {
        result *= K
        continue
        }
      result *= K-1
    }
    println(result)
}

Measured memory_bytes: 36144
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	string s;
	int n = 0, i;
	cin >> s;
	fo(i, 0, 3)
	n += (s[i] == 'A');
	if(n == 0 || n == 3) cout << "No";
	else cout << "Yes";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int m, a, r, c, h, n;
int u[] = {0, 1, 2, 3, 4};
int32_t main() {
	cin >> n;
	string s;
	for(int i = 0; i < n; i++) {
		cin >> s;
		if(s[0] == 'M')
			m++;
		if(s[0] == 'A')
			a++;
		if(s[0] == 'R')
			r++;
		if(s[0] == 'C')
			c++;
		if(s[0] == 'H')
			h++;
	}
	int ans = 0;
	vector<int> v;
	v.push_back(m);
	v.push_back(a);
	v.push_back(r);
	v.push_back(c);
	v.push_back(h);
	int res = 1;
	for(int j = 0; j < 3; j++) {
		res = res * (v[j]);
	}
	ans += res;
//	for(int i : v)
//		cout << i << " : ";
//	cout << endl;
	while(next_permutation(u, u + 5)) {
		res = 1;
		for(int j = 0; j < 3; j++)
			res *= v[u[j]];
		ans += res;
	}
	cout << ans / 12;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll dp[3010][3010];
ll a[3010];

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) dp[i][i] = 0;
    
    for(int w = 1; w <= n; w++){
        for(int l = 0; l+w <= n; l++){
            int r= l + w;
            if (w%2 == n%2) dp[l][r] = max(dp[l+1][r] + a[l], dp[l][r-1] + a[r-1]);
            else dp[l][r] = min(dp[l+1][r] - a[l], dp[l][r-1] - a[r-1]);
        }
    }

    cout << dp[0][n] << endl;
    return 0;
}


Measured memory_bytes: 49820
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{   int a,b,x;
    scanf("%d%d%d",&a,&b,&x);
    double ans;
    if(x<=a*a*b/2){
        ans=atan((double)x/((double)a*b*b/2));
    }else{
        double h=2*((double)a*a*b-(double)x)/((double)a*a);
        double V=h*a*a;
        double nx=x-(b-h)*a*a;
        ans=atan((double)a/h);
    }
    printf("%.8lf",90-ans*180/(atan(1)*4.0));
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <map>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

ll vs[60];

ll dp[60][60];


int main(void) {
  REP(i, 60) {
    dp[i][0] = 1;
    for(int j = 1; j <= i; ++j) {
      dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
    }
  }
  
  int n, lb, ub;
  scanf("%d%d%d", &n, &lb, &ub);
  REP(i, n) {
    scanf("%lld", &vs[i]);
  }
  sort(vs, vs + n);
  ll sum = 0;
  REP(i, lb) {
    sum += vs[n-1-i];
  }
  printf("%.10f\n", sum * 1.0 / lb);

  int cnt1 = 0;
  REP(i, n) {
    if(vs[i] == vs[n-lb]) {
      ++cnt1;
    }
  }

  ll res = 0;

  {
    int cnt2 = 0;
    for(int j = n-lb; j < n; ++j) {
      if(vs[j] == vs[n-lb]) {
        ++cnt2;
      }
    }
    res += dp[cnt1][cnt2];
  }

  if (vs[n-lb] == vs[n-1]) {
    for(int i = lb + 1; i <= ub; ++i) {
      if(vs[n-i] == vs[n-lb]) {
        int cnt2 = 0;
        for(int j = n-i; j < n; ++j) {
          if(vs[j] == vs[n-i]) {
            ++cnt2;
          }
        }
        res += dp[cnt1][cnt2];
      }
    }
  }
  
  printf("%lld\n", res);
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    ll X;
    cin >> X;
    ll a = 0, b = 0;
    if (X == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        a = X / 500;
        b = (X % 500) / 5;

        cout << 1000 * a + 5 * b << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var C = Read()[0];

            Console.WriteLine((char)((int)C + 1));
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;

ll N; // グローバル変数

ll make753(ll value);
bool contain753(ll value);

int main(){
 cin>>N;
 ll ans = 0; //７５３数の数を記録する変数

 ans += make753(3);

 ans += make753(5);

 ans += make753(7);

cout<<ans<<endl;

return 0;
}

ll make753(ll value){
    if(value>N){
        return 0;  // 戻り値０を上のノードに渡し再帰を終える
    }
    ll part_ans=0;

    if(contain753(value)==true){
        part_ans++;
    }

    part_ans += make753( value*10 + 3 );

    part_ans += make753( value*10 + 5 );

    part_ans += make753( value*10 + 7 );
    
    return part_ans;

}

bool contain753(ll value){
    ll box753[10]={};
    for(;;){
        box753[value%10]++;
        value = value / 10 ;
        if(value==0) break;
    }
    //cout<<1<<endl;

    return (box753[3]>=1 and box753[5]>=1 and box753[7]>=1) ;

}

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

int main(void){

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

    int b,r;

    b = 0;
    r = 0;

    int n;

    cin >> n;

    char tmp[100];

    cin >> tmp;

    for(int i = 0;i<n;i++){
        //cin >> tmp;
        if(tmp[i] == 'B'){
            b++;
        }else {
            r++;
        }
    }

    if(r>b){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }




    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	string S;
	cin >> S;
	if (S == "SSS")
	{
		cout << 0 << endl;
	}
	if (S == "RSS")
	{
		cout << 1 << endl;
	}
	if (S == "SRS")
	{
		cout << 1 << endl;
	}
	if (S == "SSR")
	{
		cout << 1 << endl;
	}
	if (S == "RSR")
	{
		cout << 1 << endl;
	}
	if (S == "RRS")
	{
		cout << 2 << endl;
	}
	if (S == "SRR")
	{
		cout << 2 << endl;
	}
	if (S == "RRR")
	{
		cout << 3 << endl;
	}
}

Measured memory_bytes: 3552