akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lowbit(a) ((a) & -(a))
#define clean(a, b) memset(a, b, sizeof(a))
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 2e6 + 9;

int _;

//========================================================================
int a[maxn],n,k;
bool check(int now)
{
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        sum+=(a[i]-1)/now;
    }
    if(sum<=k) return 1;
    return 0;
}
int two_points(int minn,int maxx)
{
    int l=minn,r=maxx,mid,ans;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(mid)) r=mid-1;
        else l=mid+1;
        ans=r+1;
    }
    return ans;
}
//========================================================================
int main()
{
    int maxx=0;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        maxx=max(maxx,a[i]);
    }
    int ans=two_points(1,maxx);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#define int long long
using namespace std;
 
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int t = 1;
    while (t--) {
        int n;
        cin >> n;
        vector <int> h(n), dp(n);
        for(int &x : h) cin >> x;

        dp[n - 2] = abs(h[n - 1] - h[n - 2]);
        for(int i = n - 3; i >= 0; i--) {
            dp[i] = min(dp[i + 1] + abs(h[i + 1] - h[i]), dp[i + 2] + abs(h[i + 2] - h[i]));
        }
        cout << dp[0] << "\n";
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> b(n - 1);
    for (int i = 0; i < n - 1; i++) {
        cin >> b.at(i);
    }

    int sum = b.at(0);
    for (int i = 1; i < n - 1; i++) {
        sum += min(b.at(i - 1), b.at(i));
    }
    sum += b.at(n - 2);
    cout << sum << endl;
}

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

int lis(const vector<int>& xs)
{
    set<int> s;
    for (const int x : xs)
    {
        s.insert(x);
        const auto it = s.upper_bound(x);
        if (it != s.end())
            s.erase(it);
    }
    return int(s.size());
}

int main()
{
    cout << setprecision(15) << fixed;

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    if (x1 > x2)
    {
        swap(x1, x2);
        swap(y1, y2);
    }

    const bool flipped = y1 > y2;
    if (flipped)
        y1 = -y1, y2 = -y2;

    int N;
    cin >> N;

    vector<pair<int, int>> points;
    for (int i = 0; i < N; i++)
    {
        int X, Y;
        cin >> X >> Y;

        if (flipped) Y = -Y;

        if (x1 <= X && X <= x2 && y1 <= Y && Y <= y2)
            points.push_back({X, Y});
    }
    sort(begin(points), end(points));

    vector<int> ys;
    for (const auto p : points)
        ys.push_back(p.second);
    const int fountains_reached = lis(ys);

    const double straight_length = 100.0*((x2-x1) + (y2-y1));
    const double extra = 2*(20*atan(1) - 10);
    const double savings = 20 - 20*atan(1);
    double total = straight_length - fountains_reached*savings;
    if (fountains_reached == min(x2-x1+1, y2-y1+1))
    {
        total += savings;
        total += extra;
    }
    cout << total << endl;
}


Measured memory_bytes: 12252
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool isPerfectSquare(ll x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss < b.ss;
    return (a.ff > b.ff); 
}
//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////

void solve()
{
    
    ll n,m;
    cin>>n>>m;

    if(n<=m)
    {
        cout<<"unsafe";
    }
    else
        cout<<"safe";

    return;
}
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 

Measured memory_bytes: 3688
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int main(){
  long long K,A,B;
  cin>>K>>A>>B;
  if(K<=0){
    cout<<"0"<<endl;
  }else{
    if(A<K&&A<=B){
      cout<<"-1"<<endl;
    }else if(K<=A){
      cout<<"1"<<endl;
    }else{
      K-=A;
      cout<<(K+(A-B)-1)/(A-B)*2+1<<endl;
    }
  }
  return 0;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vs = V<string>;

int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;

    Vs ss;
    int f=0;
    while(f<s.size()){
        int i=0;
        while(f+i<s.size()){
            if(s[f+i]!=s[f]){
                ss.pb(s.substr(f,i));
                break;
            }else if(f+i==s.size()-1){
                ss.pb(s.substr(f,i+1));
                f++;
                break;
            }
            i++;
        }
        f+=i;
    }


    int cnt = 0;
    for(int i=0; i<ss.size(); i++){
        if(cnt==k) break;
        if(i%2==0) continue;
        for(int j=0; j<ss[i].size(); j++){
            ss[i][j] = (ss[i][j]=='R')?'L':'R';
        }
        cnt++;
    }

    string s2 = "";
    for(int i=0; i<ss.size(); i++){
        s2 += ss[i];
    }

    cnt = 0;
    for(int i=0; i<s2.size(); i++){
        if(s2[i] == 'R'){
            if(i+1<s2.size()){
                cnt += (s2[i+1]=='R')?1:0;
            }
        }else{
            if(i-1>=0){
                cnt += (s2[i-1]=='L')?1:0;
            }
        }
    }

    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 6004
#include<stdio.h>
int main(){
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    m=(S-3600*h)/60;
    s=S-h*3600-m*60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 2740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  n %= 10;
  if (n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon\n";
  } else if (n == 3) {
    cout << "bon\n";
  } else {
    cout << "hon\n";
  }
}

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

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

signed main(){
        llin(n);
        llin(m);
        vllin(a,n);
        vpl4 d(m);
        ll t=0;
        FOR(i,0,m-1){
                cin >>d[i].se;
                cin >>d[i].fi;
        }
        rSORT(d);
        SORT(a);
        FOR(i,0,n-1){
                if(t>m-1) break;
                if(a[i]<d[t].fi){
                        a[i]=d[t].fi;
                        d[t].se-=1;
                        if(d[t].se==0) t++;
                }else{
                        break;
                }
        }
        ll ans=0;
        FOR(i,0,n-1){
                ans+=a[i];
        }
        sal(ans);
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int count=0;

  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
      count++;
    }
  }
  if(count==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}

Measured memory_bytes: 3596
import java.util.*;

public class Main{

	static int p[];
	static int c[];
	static int d, g;
	static int max = 0;
	static int dp[];	
	
	public static int solve(int k){
		int count = 0, sum = 0;
		if(k == d) {
			int tmp = -1;
			for(int i = 0; i < d; ++i){
				if(dp[i] == -1)tmp = i;
				else {
					sum += p[i] * (i + 1) + c[i] / 100;
					count += p[i];
				}
			}
			if(tmp == -1){
				if(sum < g / 100)return max;
				else return 0;
			}
			int tmp2 = (g / 100 - sum + tmp) / (tmp + 1);		
			if(tmp2 <= p[tmp] - 1){
				if(tmp2 <= 0)tmp2 = 0;
				count = tmp2;
				if(tmp == -1)count = 0;
			}
			else count = max;
			return count;
		}
		dp[k] = 1;
		count = p[k] + solve(k + 1);
		dp[k] = -1;
		count = Math.min(solve(k + 1), count);
		return count;
	}

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		d = sc.nextInt();
		g = sc.nextInt();
		p = new int[d];
		c = new int[d];
		dp = new int[d];
		for(int i = 0; i < d; ++i){
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
			max += p[i];
		}
		sc.close();
		int ans = solve(0);
		System.out.println(ans);
	}
}

Measured memory_bytes: 22868
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

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


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

set<complex<int> > jem;
set<complex<int> > cood;
map<char, complex<int> > inst;
namespace std {
  bool operator < (const complex<int>& a, const complex<int>& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

int main(){
	while(1){
		int n,m;
		inst['N']=complex<int>(0,1);
		inst['S']=complex<int>(0,-1);
		inst['E']=complex<int>(1,0);
		inst['W']=complex<int>(-1,0);
		jem.clear();
		cood.clear();
		cin>>n;
		if(n==0)return 0;
		REP(i,n){
			int x, y;
			cin>>x>>y;
			jem.insert(complex<int>(x,y));
		}
		cin>>m;
		complex<int> cur(10,10);
		cood.insert(cur);
		REP(i,m){
			char c;
			int l;
			cin>>c>>l;
			REP(j,l){
				cur+=inst[c];
				cood.insert(cur);
			}
		}
		int flag = 0;
		for(set<complex<int> >::iterator it = jem.begin(); it!= jem.end(); it++){
			if(!EXIST(cood, *it)){
				cout << "No" << endl;
				flag = 1;
				break;
			}
		}
		if(flag == 0)cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 1196
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		Main instance = new Main();
		instance.solve();
	}

	private void solve() {
		try {
			int n = sc.nextInt();
			int[] d = new int[n];
			for (int i = 0; i < n; i++) {
				d[i] = sc.nextInt();
			}
			Arrays.sort(d);

			int count = 1;
			for (int i = 1; i < n; i++) {
				if (d[i - 1] != d[i]) {
					count++;
				}
			}
			System.out.println(count);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 21844
N, M = map(int, input().split())
S = input()

i = N
ans = []
while i > 0:
    for j in reversed(range(1, M + 1)):
        if i - j >= 0 and S[i - j] == "0":
            ans.append(j)
            i -= j
            break
    else:
        ans = []
        break

if ans:
    print(*ans[::-1])
else:
    print(-1)


Measured memory_bytes: 84348
S = input()
check = []
for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        check.append(i)
ans = 1

if len(check) == 0:
    print(0)
else:
    num = 1
    for i in range(len(check) - 1):

        if check[i] + 1 == check[i+1]:
            num += 1
            ans = max(ans, num)
        else:
            num = 1
    print(ans)


Measured memory_bytes: 3060
S = input()

l = 0
r = len(S) - 1
ret = 0
while l <= r:
    if S[l] == S[r]:
        l += 1
        r -= 1
    elif S[l] == 'x' and S[r] != 'x':
        ret += 1
        l += 1
    elif S[l] != 'x' and S[r] == 'x':
        ret += 1
        r -= 1
    else:
        print(-1)
        exit()

print(ret)


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


int main(){
  ll n;
  cin >>n;
  ll ans =0;
  if(n%2==0){
    ans= n/2;
  }
  else {
    ans =n-1;
  }
  ll sqrtans =sqrt(n);

  for(ll i=sqrtans;i>2;--i){
    if(n%i==0){
      ans=i+(n/i)-2;
      break;
    }
  }
  cout <<ans<<endl;

}


Measured memory_bytes: 256
#include<stdio.h>

void sorting(int a[]);
#define N 3
int main() {
	int sort[N];
	int i, d;
	for (i = 0;i < N;i++) {
		scanf("%d", &sort[i]);
	}
	sorting(sort);
	for (i = 0;i < N;i++) {
		printf("%d", sort[i]);
		if (i < N - 1) {
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}

void sorting(int a[]) {
	int i, d,j;
	for (i = 0;i < N - 1;i++) {
		for (j = 1;j < N ;j++) {
			if (a[i] > a[j]) {
				d = a[i];
				a[i] = a[j];
				a[j] = d;
			}
		}
	}
}

Measured memory_bytes: 2752
#include<stdio.h>
 
int main(){
    double sum;
    double a;
    int i;
    while(~scanf("%lf",&a)){
        sum=0;
        sum+=a;
        for(i=2;i<=10;i++){
 
            if(i%2==0){
                a=2*a;
            }else{
                a=a/3;
            }
            sum+=a;
        }
        printf("%f\n",sum);
    }
     
    return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */
void yes(){
  cout << "Yes" << endl;
  exit(0);
}

void no(){
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll x,y; cin >> x >> y;
  vector<vector<ll>> g(3);
  g[0] = {1,3,5,7,8,10,12};
  g[1] = {4,6,9,11};
  g[2] = {2};

  ll a,b;
  REP(i, 3) REP(j, g[i].size()){
    if(x==g[i][j]) a = i;
    if(y==g[i][j]) b = i;
  }
  if(a==b) yes();
  else no();
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	for {
		fmt.Scan(&n)
		if n == 0 {
			break
		}
		a := make([]int, n)
		s := 0
		for i := range a {
			fmt.Scan(&a[i])
			s += a[i]
		}
		m := float64(s) / float64(n)
		v := 0.0
		for _, e := range a {
			v += (float64(e) - m) * (float64(e) - m)
		}
		v /= float64(n)
		std := math.Sqrt(v)
		fmt.Printf("%f\n", std)
	}
}



Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,ai;
    cin>>n;
    int cnt1=0,cnt2=0;
    rep(i,n){
        cin>>ai;
        if(ai%4==0) ++cnt2;
        else if(ai%2==0) ++cnt1;
    }
    if(cnt2*2+1>=n||cnt1+cnt2*2>=n) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

int main() {
  int N; cin >> N;
  ll A[N]={}; rep(i,N) { int tmp; cin >> tmp; tmp--; A[tmp]++; }

  sort(A,A+N);
  ll sum[N+1]={}; 
  rep(i,N) sum[i+1] = sum[i] + A[i];
  ll count[N]={};
  int size = N - (lower_bound(A,A+N,1) - A);
  for(int i=1; i<=N; i++) {
    int pos = lower_bound(A,A+N,i) - A;
    count[i-1] = sum[pos]/i + (N-pos);
  }

  reverse(count,count+N);
  for (int i=1; i<=N; i++) {
    int result = N - (lower_bound(count,count+N,i)-count);
    if (i>size) result = 0;
    cout << result << endl;
  }
  // rep(i,N) cout << count[i] << endl;
  return 0;
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a>=b){
    for(int i=0;i<a;i++){
      cout << b;
    }
  }else{
    for(int i=0;i<b;i++){
      cout << a;
    }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
//cout << std::fixed << std::setprecision(15) << y << endl;


#define PI 3.141592653589793

double r2d(double radian){
    return radian * 180.0 / PI;
}

int main(){
    double a, b, x;
    cin >> a >> b >> x;

    double ans;
    if(x <= (a * a * b) / 2.0){
        double bottomWidth = (2.0 * x) / (a * b);
        ans = r2d(atan(b / bottomWidth)); 
    }else{
        double centerHeight = x / (a * a);
        ans = r2d(atan(((b - centerHeight) * 2.0) / a));
    }

    cout << std::fixed << std::setprecision(15) << ans << endl;


    return 0;
}


Measured memory_bytes: 4020
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>

size_t combination(size_t n, size_t r){
    if (r == 0 || r == n){
        return 1;
    }else if(r == 1){
        return n;
    }else{
        return (combination(n - 1, r - 1) + combination(n - 1, r));
    }
}

int main(){
    
    size_t n;

    std::cin >> n;

    std::unordered_map<std::string, size_t> s;

    for(size_t i = 0; i < n; i++){
        std::string tmp;
        std::cin >> tmp;
        std::sort(tmp.begin(), tmp.end());
        if(s.find(tmp) == s.end()){
            s.emplace(tmp, 1);
        }else{
            s[tmp]++;
        }
    }

    size_t ans = 0;

    for(const auto& e : s){
        if(e.second != 1) ans += combination(e.second, 2);
    }

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


Measured memory_bytes: 10660
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;

  int ret = 0;
  int pivot = 0;
  int curr_len = 1;
  int next_len = 1;
  while (true) {
    if (pivot + curr_len == s.size()) {
      ++ret;
      break;
    }
    // compare
    if (s.substr(pivot, curr_len) == s.substr(pivot + curr_len, next_len)) {
      ++next_len;
      if (pivot + curr_len + next_len > s.size()) {
        ++ret;
        break;
      }
    } else {
      pivot += curr_len;
      curr_len = next_len;
      next_len = 1;
      ++ret;
    }
  }

  cout << ret << endl;

  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int count = 0;
  while(n--){
    int l,r;
    cin >> l >> r;
    r(i,r-l+1)++count;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
A = l()
num = A[0]
ans = 0
for i in range(N-1):
    if num > A[i+1]:
        ans += num-A[i+1]
    else:
        num = A[i+1]
print(ans)

Measured memory_bytes: 34360
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define INF 999999999
typedef long long ll;
using namespace std;
int main() {
    string S;
    cin >> S;
    int conv = 0;
    int conv_min;
    REP(i, S.size()) {
        if(i%2 == 0) {
            if(S[i] != '0') {
                conv++;
            }
        }
        else{
            if(S[i] != '1') {
                conv++;
            }
        }
    }
    conv_min = conv;
    conv = 0;
    REP(i, S.size()) {
        if(i%2 == 0) {
            if(S[i] != '1') {
                conv++;
            }
        }else{
            if(S[i] != '0') {
                conv++;
            }
        }
    }
    conv_min = min(conv, conv_min);
    cout << conv_min << "\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int n,k;
  cin>>n>>k;
  
  if (n==1){
    cout<<k<<endl;
  }
  else {
    long int ans;
    ans=k*pow(k-1,n-1);
    cout<< ans<<endl;
  }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var n int
  fmt.Scan(&n)
  d := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&d[i])
  }
  l := make(map[int]int, n)
  for i, v := range d {
    l[v] = i
  }
  fmt.Println(len(l))
}

Measured memory_bytes: 512
while 1:
     (H,W) = [int(i) for i in input().split()]
     if H==W==0:
          break
     for i in range(H):
          for j in range(W):
               if (i+j)%2==0:print ('#',end="")
               else: print('.',end="")
          print('')
     print('')


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	int n;
	cin >> n;
	int ans = (n/500)*1000;
	n %= 500;
	ans += (n/5)*5;
	cout << ans;
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int, input().split())
h_angle = 360 * M / 60
j_angle = 360 * (H * 60 + M) / (12 * 60)
angle = min(abs(h_angle - j_angle), 360-abs(h_angle - j_angle))
ans = (A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(angle))) ** 0.5
print(ans)

Measured memory_bytes: 9504
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

int main(){
    string S, T;
    cin >> S >> T;

    map<char, vector<long long>> mp;
    for (long long i = 0; i < (long long)S.size();i++)
        mp[S[i]].push_back(i);
    
    for(auto t:T){
        if(mp[t].size() == 0){
            cout << -1 << endl;
            return 0;
        }
    }
    long long sum = 0, pre = -1;
    for(auto t:T){
        auto&& vec = mp[t];
        auto&& now = upper_bound(vec.begin(), vec.end(), pre);
        if(now == vec.end() || *now <= pre){
            sum++;
            pre = vec.front();
        }else{
            pre = *now;
        }
    }
    cout << sum * (long long)S.size() + pre + 1 << endl;
    return 0;
}

Measured memory_bytes: 1728
import java.lang.reflect.Array;
import java.util.*;
public class Main {




    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n_x = Integer.parseInt(scan.next()) + 1;
        int[] xpoint = new int[n_x];

        int m_y = Integer.parseInt(scan.next()) + 1;
        int[] ypoint = new int[m_y];

        xpoint[0] = Integer.parseInt(scan.next());

        ypoint[0] =  Integer.parseInt(scan.next());

        for(int i = 1; i < n_x; i++){
            xpoint[i] =  Integer.parseInt(scan.next());
        }

        for(int i = 1; i < m_y ; i++){
            ypoint[i] =  Integer.parseInt(scan.next());
        }

        Arrays.sort(xpoint);
        Arrays.sort(ypoint);
        
        if(xpoint[n_x -1] < ypoint[0]){

            System.out.println("No War");
        }
        else{

            System.out.println("War");
        }
    }
}


Measured memory_bytes: 25044
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    
    static void solve(long X){
        for(long A = -200; A <=200; A++) for(long B = -200; B <=200; B++){
            if(A*A*A*A*A - B*B*B*B*B == X){
                System.out.printf("%d %d\n", A, B);
                return;
            }
        }
        System.out.printf("%d :(\n", X);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();

        solve(X);
    }
}


Measured memory_bytes: 35912
mod = 10**9+7

FRAC_RANGE = 2000000
frac = [1] * FRAC_RANGE

for i in range(2,FRAC_RANGE):
    frac[i] = frac[i-1] * i % mod

def combi(n,k):
    a = frac[n]
    b = modpow(frac[k],mod-2)
    c = modpow(frac[n-k],mod-2)
    return a*b*c%mod

def bi(x):
    o = []
    while x != 0:
        o.append(x%2)
        x //= 2
    return o

def modpow(m,n):
    o = bi(n)
    p = [m]
    leo = len(o)
    while leo > len(p):
        a = p[-1]
        p.append(a*a%mod)
    b = 1
    for i in range(leo):
        if o[i] == 1:
            b *= p[i]
            b %= mod
    return b

X,Y = map(int,input().split())

A = (-1) * X +   2  * Y
B =   2  * X + (-1) * Y

if A % 3 or B % 3 or A < 0 or B < 0:
    print(0)
    exit()

A //= 3
B //= 3

print(combi(A+B,min(A,B)))

Measured memory_bytes: 55788
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define readi(x) scanf("%d", &x)
#define reads(s) scanf("%s", s)
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100002
#define MOD 1000000007


int main(void) {
	long long int n, c;
	scanf("%lld %lld", &n, &c);
	long long int x[MAX], v[MAX];
	x[0] = 0; x[n + 1] = c;
	v[0] = v[n + 1] = 0;
	for ( int i = 1; i <= n; i++ )  
		scanf("%lld %lld", &x[i], &v[i]);

	// 時計回りの位置をA,反時計回りの位置をB
	// va[a]: v(1) + v(2)     + ... + v(a)
	// vb[b]: v(n) + v(n - 1) + ... + v(b)
	long long int va[MAX], vb[MAX];
	va[0] = va[n + 1] = 0;
	vb[0] = vb[n + 1] = 0; 
	for ( int i = 0; i < n; i++ )
		va[i + 1] = va[i] + v[i + 1];
	vb[n] = v[n];
	for ( int i = n; i > 1; i-- )
		vb[i - 1] = vb[i] + v[i - 1];

	// geta(a): v(1) + v(2)   + ... + v(a) - x(a)
	// getb(b): v(n) + v(n-1) + ... + v(b) - (c - x(b))
	long long int geta[MAX], getb[MAX];
	geta[0] = geta[n + 1] = 0;
	getb[0] = getb[n + 1] = 0;
	for ( int i = 1; i <= n; i++ ) {
		geta[i] = va[i] - x[i];
		getb[i] = vb[i] - ( c - x[i] );
	}

	// maxa(a): max{ geta(0), geta(1), ..., get(a) }
	// maxb(b): max{ getb(n), getb(n-1), ..., getb(b) }
	long long int maxa[MAX], maxb[MAX];
	maxa[0] = maxa[n + 1] = 0;
	maxb[0] = maxb[n + 1] = 0;
	for ( int i = 0; i < n; i++ ) {
		maxa[i + 1] = max(maxa[i], geta[i + 1]);
		maxb[n - i] = max(maxb[n - i + 1], getb[n - i]);
	}

	long long int ans = 0;
	for ( int i = 0; i <= n; i++ ) {
		ans = max(ans, maxa[i] + getb[i + 1] - (c - x[i + 1]));
		ans = max(ans, maxb[i + 1] + geta[i] - x[i]);
	}

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


Measured memory_bytes: 6400
#include<stdio.h>

int main()
{
    int sum=0;
    int i,j,n,count=0;
    int prime[105000]={0};

    for(i = 2;i <= 105000;i++) prime[i]=1;

    for(i = 2;i <= 105000;i++){
        if(prime[i]){
            for(j=i+i;j<=105000;j+=i) prime[j]=0;
            prime[i]=++count;
        }
    }

    while(scanf("%d",&n),n){

        sum=0;

        for(i=0;prime[i]<n;i++){
            if(prime[i]!=0){
                sum+=i;
            }
        }
        sum+=i;

        printf("%lld\n",sum);

    }
    return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
   int a, b;
   cin >> a >> b;
   int ans = 1;
   int ever = a;
   if ( b == 1) cout << 0 << endl;
   else {
       while(ever < b){
           ever += a -1;
           ans ++;
       }
       cout << ans << endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int D;
	cin >> D;
	int c[26];
	rep(i, 26) cin >> c[i];
	int s[D][26];
	rep(i, D) rep(j, 26) cin >> s[i][j];
	rep(i, D) {
		int sc = 0, id;
		rep(j, 26) {
			if(sc < s[i][j]) {
				sc = s[i][j];
				id = j;
			}
		}
		cout << id + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3692
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int get(const vvi& a,int i,int j)
{
	if(i<0 || a.size()<=i || j<0 || a[i].size()<=j)
		return 0;
	return a[i][j];
}

int main()
{
	for(int n;cin>>n,n;){
		vs s(n);
		rep(i,n)
			cin>>s[i];
		vvi a(n,vi(n)),b=a,c=a,d=a;
		rep(i,n) rep(j,n)
			if(s[i][j]=='1'){
				a[i][j]=get(a,i-1,j)+1;
				b[i][j]=get(b,i,j-1)+1;
				c[i][j]=get(c,i-1,j-1)+1;
				d[i][j]=get(d,i-1,j+1)+1;
			}
		int res=0;
		rep(i,n) rep(j,n)
			res=max(res,max(max(a[i][j],b[i][j]),max(c[i][j],d[i][j])));
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1056
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m = nm()
    X = nl()
    if n >= m:
        print(0)
    else:
        X = sorted(X)
        D = [X[i + 1] - X[i] for i in range(m - 1)]
        D = sorted(D, reverse=True)
        print(sum(D[n - 1:]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20556
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    HashSet<Integer> set = new HashSet<Integer>();
    for(int i = 0; i < 3; i++) {
      set.add(sc.nextInt());
    }
    System.out.println(set.size());
  }
}

Measured memory_bytes: 23764
import numpy as np
def seachPrimeNum(N):
  max = int(np.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

n=10**5
a=seachPrimeNum(n)
b=[]
y=0
x=0
while x<=100000:
  t=a[y]
  x=t*2-1
  b.append(x)
  y+=1
  
c=set(a)&set(b)

q=int(input())
r=[0 for _ in range(100000)]
for f in c:
  r[f]=1
for g in range(len(r)-1):
  r[g+1]=r[g]+r[g+1]

for p in range(q):
  w,z=map(int,input().split())
  print(r[z]-r[w-1])



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

using i8   = int8_t;
using u8   = uint8_t;
using i16  = int16_t;
using u16  = uint16_t;
using i32  = int32_t;
using u32  = uint32_t;
using i64  = int64_t;
using u64  = uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;

using f32  = float;
using f64  = double;
using f80  = __float80;
using f128 = __float128;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'000LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// {{{ util
#define FOR(i, start, end) for(i64 i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cc) { return (f)(begin(cc), end(cc), ## __VA_ARGS__); })(c))

template<typename T, typename U>
bool chmax(T& xmax, const U& x) {
    if(xmax < x) {
        xmax = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T, typename U>
bool chmin(T& xmin, const U& x) {
    if(x < xmin) {
        xmin = x;
        return true;
    }
    else {
        return false;
    }
}

template<typename T>
void RD(T& x) {
    cin >> x;
#ifdef PROCON_LOCAL
    assert(cin);
#endif
}

template<typename T>
void RD(vector<T>& v, int n) {
    v.reserve(n);
    REP(_, n) {
        T e; RD(e);
        v.emplace_back(e);
    }
}

template<typename T>
void PRINT(const T& x) {
    cout << x;
}

template<typename T>
void PRINT(const vector<T>& v) {
    for(auto first = begin(v), it = first; it != end(v); ++it) {
        if(it != first)
            cout << ' ';
        cout << *it;
    }
}

template<typename T>
void PRINTLN(const T& x) {
    PRINT(x);
    cout << '\n';
}

template<typename T>
void DBG_IMPL(i64 line, const char* expr, const T& value) {
#ifdef PROCON_LOCAL
    cerr << "[LINE " << line << "]: ";
    cerr << expr << " = " << value << "\n";
#endif
}

#define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr))
// }}}

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

i64 A, B, K;

void solve() {
    vector<i64> v;
    FOR(i, 1, min(A,B)+1) {
        if(A%i == 0 && B%i == 0)
            v.emplace_back(i);
    }
    ALL(reverse, v);

    i64 ans = v[K-1];

    PRINTLN(ans);
}

signed main() {
    RD(A);
    RD(B);
    RD(K);

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define all(vec) vec.begin(), vec.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
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;
}

int main(){
  cout << fixed << setprecision(15);
  ll n, a, b, c, d, e; cin >> n >> a >> b >> c >> d >> e;
  ll x = min({a, b, c, d, e});
  ll ans = (n + x - 1) / x + 4;
  cout << ans << endl;
}

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

int main(){
  double a,b,x,rad;
  cin>> a >> b >> x;
  if (x>=a*a*b/2.0) rad=atan(2.0*(a*a*b-x)/a/a/a);
  else rad=atan(a*b*b/2.0/x);
  printf("%.7f\n",rad/M_PI*180.0);
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

map<int, int> D;
int N,M,T;

int main()
{
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> T;
		D[T]++;
	}
	cin >> M;
	while(M--)
	{
		cin >> T;
		if(D[T]--<=0)
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 9600
import sys

def pmatch(A, B, X, Y):
    for y, Bx in enumerate(B):
        for x, b in enumerate(Bx):
            if A[Y+y][X+x] != b:
                return False
    return True

def main():
    raw = sys.stdin.readlines()
    N, M = map(int, raw[0].split())
    A = [i.rstrip() for i in raw[1:N+1]]
    B = [i.rstrip() for i in raw[N+1:]]

    rg = range(N-M+1)

    for Y in rg:
        for X in rg:
            if pmatch(A, B, X, Y):
                return True

    return False

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

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * treeMinimum(Node *x) {
    while( x->left != NIL ) x = x->left;
    return x;
}

Node * find(Node *u, int k) {
    while(u != NIL && k != u->key ) {
        if (k < u->key ) u = u->left;
        else u = u->right;
    }
    return u;
}

Node * treeSuccessor(Node *x) {
    if (x->right != NIL) return treeMinimum(x->right);
    Node *y = x->parent;
    while( y != NIL && x == y->right) {
        x = y;
        y = y->parent;
    }
    return y;
}

void treeDelete(Node *z) {
    Node *y;
    Node *x;
    
    if (z->left == NIL || z->right == NIL) y = z;
    else y = treeSuccessor(z);
    if (y ->left != NIL) {
        x = y->left;
    } else {
        x = y->right;
    }
    
    if(x != NIL) {
        x->parent = y->parent;
    }
    
    if ( y->parent == NIL) {
        root = x;
    } else {
        if (y == y->parent->left) {
            y->parent->left = x;
        } else {
            y->parent->right = x;
        }
    }
    
    if ( y != z) {
        z->key = y->key;
    }
    
    free(y);
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z -> key = k;
    z -> left = NIL;
    z -> right = NIL;
    
    while( x != NIL ) {
        y = x;
        if ( z->key < x->key ) {
            x = x -> left;
        }
        else {
            x = x -> right;
        } 
    }
    z -> parent = y;
    if( y == NIL ) {
        root = z;
    }
    else {
        if ( z->key < y->key ) {
            y -> left = z;
        }
        else {
            y -> right = z;
        }
    }
}

void inorder(Node *u) {
    if ( u == NIL )  return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if ( u == NIL ) return;
    printf(" %d", u -> key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        cin >> com;
        if (com[0] == 'f') {
            scanf("%d", &x);
            Node *t = find(root, x);
            if (t != NIL) printf("yes\n");
            else printf("no\n");
        } else if (com == "insert" ) {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print" ) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        } else if ( com == "delete") {
            scanf("%d", &x);
            treeDelete(find(root, x));
        }
    }
    
    return 0;
}


Measured memory_bytes: 22060
program Rated_for_Me;
var
R:Integer;
begin
readln(R);
  if (R>=0) and (R<1200) then
    writeln('ABC')
  else if (R>=1200) and (R<2800) then
    writeln('ARC')
  else if (R>=2800) and (R<=4208) then
    writeln('AGC')
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll gcd(ll a2,ll b2){
	ll t;
	while(b2!=0){
		t=a2%b2;
		a2=b2;
		b2=t;
	}
	return a2;
}

int main() {

	int s,w;
	cin>>s>>w;

	if(w>=s)cout<<"unsafe"<<endl;
	else cout<<"safe"<<endl;


	return 0;
}


Measured memory_bytes: 3620
if __name__ =='__main__':
    a, b = list(map(int,input().split()))
    if b == 1:
        print(0)
    else :
        c = 1
        d = a
        while True:
            if d >= b:
                print(c)
                break
            else :
                d += a-1
                c+=1

Measured memory_bytes: 2940
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	n := nextInt()
	s := nextStr()

	cnt := 0
	// ある暗証番号を作れるか？
	for i := 0; i < 1000; i++ {
		key := fmt.Sprintf("%03d", i)
		// 1桁目捜索
		idx1 := -1
		for j := 0; j < n-2; j++ {
			if s[j] == key[0] {
				idx1 = j
				break
			}
		}
		if idx1 == -1 {
			continue
		}

		// 2桁目捜索
		idx2 := -1
		for j := idx1 + 1; j < n-1; j++ {
			if s[j] == key[1] {
				idx2 = j
				break
			}
		}
		if idx2 == -1 {
			continue
		}

		// 3桁目捜索
		//idx3:=-2
		for j := idx2 + 1; j < n; j++ {
			//fmt.Println(idx2, j)
			if s[j] == key[2] {
				//fmt.Println(i, cnt, key)
				cnt++
				break
			}
		}
		//if idx3==-1{continue}
	}

	fmt.Println(cnt)

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  int ans;
  if(13 <= a) ans = b;
  else if(6 <= a) ans = b/2;
  else ans = 0;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


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

	ll c = __gcd(a,b);
	ll ans = 1;

	for (ll i = 2; i*i < c; i++) {
		if (c%i == 0) {
			ans++;
			while (1) {
				if (c%i == 0)c /= i;
				else break;
			}
		}
	}

	if (c != 1)ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256