akhauriyash/Code-Regression huggingface dataset:
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////

list<int>::iterator it;
list<int> tab;

///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int n;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		tab.pb(x);
	}
	
	int i = 1;
	int licznik = 0;
	for(it = tab.begin(); it != tab.end(); it++){
		if(*it != i){
			licznik++;
		}
		else{
			i++;
		}
	}
	
	if(licznik == n){
		cout << "-1" << endl;
	}
	else cout << licznik << endl;
	
	
	return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	const int n = s.size();
	bool answer = false;
	for(int i = 0; i + 1 < n; ++i){
		if(s[i] == 'A' && s[i + 1] == 'C'){ answer = true; }
	}
	cout << (answer ? "Yes" : "No") << endl;
	return 0;
}



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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5)) {
      cout << "YES" << endl;
      return 0;
  }
  cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 3604
#define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<math.h>
#include<iterator>

using namespace std;

int main(){
  string s;
  cin >>s;
  long long k;
  cin >> k;
  for(int i=0;i<s.length();i++){
    if(s[i]!='a'){
      if('z'-s[i]<k){
        k-=1+'z'-s[i];
        s[i]='a';
      }
    }
  }
  k=k%26;
  s[s.length()-1]=s[s.length()-1]+k;
  cout << s <<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+10;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int p,q,r; 
  cin >> p >> q >> r;
  cout << p+q+r-max(max(p,q),r) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> w(n + 1);
    for (int i = 1; i <= n - 1; i++) {
        w[i].push_back(i + 1);
        w[i + 1].push_back(i);
    }
    w[x].push_back(y);
    w[y].push_back(x);

    vector<int> ans(n, 0);
    queue<int> q;
    for (int k = 1; k <= n; k++) {
        vector<int> dist(n + 1, -1);
        q.push(k);
        dist[k] = 0;
        while (!q.empty()) {
            int top = q.front();
            q.pop();
            for (int i : w[top]) {
                if (dist[i] != -1) continue;
                q.push(i);
                dist[i] = dist[top] + 1;
                ans[dist[i]] += 1;
            }
        }
    }

    for (int k = 1; k < n; k++) cout << ans[k] / 2 << endl;
}


Measured memory_bytes: 384
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = sorted(ab)
money = 0
for i in ab:
    if m >= i[1]:
        m -= i[1]
        money += i[0]*i[1]
        continue
    else: 
        money += m*i[0]
        break
print(money)


Measured memory_bytes: 28652
#include <stdio.h>
int main (){
	int A, B, K, angka=0;
scanf("%d", &K);
scanf("%d %d", &A, &B);//batas atas batas bawah  
		for (int i=A; i<=B;++i ){//cari tiap angka yang ada di antara batas
			if (i%K ==0){
				
				angka=1;
				break;
				}		
}
angka?printf("OK\n"):printf("NG\n");		
	
	return 0;

		}
		

Measured memory_bytes: 1616
#include<iostream>
using namespace std;
int main()
{
  int l[12];
  int i,j;
  int ans=0;
  int count[12]={};
  for(i=0;i<12;i++){
    cin >> l[i];
  }
  for(i=0;i<12;i++){
    for(j=i+1;j<12;j++){
      if(l[i]==l[j]){
	count[i]++;
	count[j]++;
      }
    }
  }
  for(i=0;i<12;i++){
    if(count[i]==0) ans=1;
  }
  if(ans==0) cout << "yes\n";
  else cout << "no\n";
  return 0;
}

Measured memory_bytes: 3088
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double dp[20][20][10000];
double d[20][20];
double x[20];
double y[20];
double calc(int a,int b,int c){
	double dot=(x[b]-x[a])*(x[c]-x[b])+(y[b]-y[a])*(y[c]-y[b]);
	double r=d[a][b]*d[b][c];
	return dot/r;
}
int main(){
	int a;
	double b,c;
	scanf("%d%lf%lf",&a,&b,&c);
	for(int i=0;i<a;i++){
		scanf("%lf%lf",x+i,y+i);
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<a;j++){
			if(i!=j)
			d[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
		}
	}
	for(int i=0;i<a;i++)
		for(int j=0;j<a;j++)
			for(int k=0;k<10000;k++)
				dp[i][j][k]=99999999;
	//for(int i=0;i<a;i++){
		for(int j=1;j<a;j++){
			dp[0][j][1]=d[0][j];
		}
	//}
	for(int i=1;i<9999;i++){
		for(int j=0;j<a;j++){
			for(int k=0;k<a;k++){
				if(j==k)continue;
				if(dp[j][k][i]>b)continue;

				for(int l=0;l<a;l++){
					if(l==k)continue;
					//printf("%d %d %d: %f %f\n",j,k,l,calc(j,k,l),cos(c/180*3.14159265359));
					if(calc(j,k,l)<cos(c/180*3.14159265359))continue;
					
					dp[k][l][i+1]=min(dp[k][l][i+1],dp[j][k][i]+d[k][l]);
					//printf("%d -> %d -> %d\n",j,k,l);
				}
			}
		}
	}
	int ret=0;
	for(int i=0;i<a;i++)
		for(int j=0;j<a;j++)
			for(int k=1;k<10000;k++)
				if(dp[i][j][k]<b)ret=max(ret,k);
	printf("%d\n",ret);
}

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

int main() {
    int i, a, b, c, count = 0;

    cin >> a >> b >> c;

    for(i = a; i <= b; i++){
        if(c % i == 0){
            count++;
        }
    }
    cout << count << endl;

    return 0;

}


Measured memory_bytes: 3120
//q3.cpp

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200


int h,w;
char flag[SIZE][SIZE];

bool check(char s[][SIZE], int mode, int y, int x,int d){
  bool flag = true;
  
  if(mode == 1){
    for(int i=y;i<y+d;i++){
      flag &= '.' == s[i][x];
    }
  }else{
    for(int i=x;i<x+d;i++){
      flag &= '.' == s[y][i];
    }
  }
  
  return flag;
}

int main(){
  int h,w,d,ans = 0;
  char s[SIZE][SIZE];
  
  scanf("%d%d%d",&h,&w,&d);

  for(int i=0;i<h;i++){
    scanf("%s",s[i]);
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(i+d <= h) ans += check(s,1,i,j,d);
      if(j+d <= w) ans += check(s,2,i,j,d);   
    }
  }
  
  printf("%d\n",ans); 
  
  return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

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(){

    ll n;
    cin >> n;
    map<ll,ll> mp;
    ll sum = 0;
    for(int i = 0; i < n; i++){
        ll v;
        cin >> v;
        mp[v]++;
        sum += v;
    }
    ll q;
    cin >> q;
    vector<ll> ans(q,0);
    for(int i = 0; i < q; i++){
        ll b, c;
        cin >> b >> c;
        if(mp[b] != 0){
            sum -= b*mp[b];
            sum += c*mp[b];
            mp[c] += mp[b];
            mp[b] = 0;
        }
        ans[i] = sum;
    }
    for(int i = 0; i < q; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 9764
import math
S = input()

N = len(S)
S_left = S[:math.ceil((N - 1) / 2)]
S_right = S[(N + 3) // 2 - 1:]


if S == S[::-1] and S_left == S_left[::-1] and S_right == S_right[::-1]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ln long long

int main () {
  ln a,b;
  cin >> a >> b;
  vector<pair<ln,int>> af;
  vector<pair<ln,int>> bf;
  int ac=0,bc=0;
  
  for(int i=2;i<=1000000;i++){
    if(a%i==0){
      af.push_back(make_pair(i,0));
      while(a%i==0){
        af[ac].second++;
        a/=i;
      }
      ac++;
    }
  }
  if(a!=1) af.push_back(make_pair(a,0));
  
  for(int i=2;i<=1000000;i++){
    if(b%i==0){
      bf.push_back(make_pair(i,0));
      while(b%i==0){
        bf[bc].second++;
        b/=i;
      }
      bc++;
    }
  }
  if(b!=1) bf.push_back(make_pair(b,0));
  
  int ans=1;
  
  for(pair<int,int> x:af){
    for(pair<int,int> y:bf){
      if(x.first==y.first) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

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

        if (S.equals(T.substring(0, T.length() - 1))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35716
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){
	int k, s, ans = 0;
	cin >> k >> s;
	for (int x = 0; x <= k; x++){
		for (int y = 0; y <= k; y++) {
			int z = s-x-y;
			if(z >= 0 && z <= k) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long k;
	cin>>k;
	long long y=k/2;
	long long move=1;
	for (long long i=0;i<=y;i++){
		move*=2;
		//cout<<move<<endl;
		if (move>k)
			break;
 	}
	cout<<move-1<<endl;
	return 0;
}

Measured memory_bytes: 256
import math

a,b,h,m = [int(x) for x in input().split()]

minutes = (m*360)/60
hours = ((h+m/60)*360)/12

def getPos(theta, length):
    y=length*math.sin(math.radians(theta))
    x=length*math.cos(math.radians(theta))
    return [x,y]

x1,y1 = getPos(hours, a)
x2,y2 = getPos(minutes, b)

print(math.sqrt((x1-x2)**2+(y1-y2)**2))


Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	int x = abs(a[1]-a[0])+abs(a[2]-a[1]);
	int y = abs(a[2]-a[0])+abs(a[1]-a[2]);
	int z = abs(a[0]-a[1])+abs(a[2]-a[0]);
	int b = abs(a[2]-a[1])+abs(a[0]-a[2]);
	int c = abs(a[1]-a[2])+abs(a[0]-a[1]);
	int d = abs(a[0]-a[2])+abs(a[1]-a[0]);
	int ans = min(x,min(y,(min(z,min(b,min(c,d))))));
	cout<<ans<<endl;

}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

  string n;
  cin >> n;

  string ans = "No";
  rep(i, 2) {
    if (n.at(i) == '9') {
      ans = "Yes";
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
data_dict = {}
k = int(input())
if k == 1:
    print(1)
else:
    ans = 3 * k * k - 3 * k + 1
    for x in range(2, k - 1):
        for y in range(x + 1, k):
            key = str(x) + "-" + str(y)
            if key in data_dict:
                c = data_dict[key]
            else:
                c = gcd(x, y)
                data_dict[key] = c
            for z in range(y + 1, k + 1):    
                if c == 1:
                    ans += 6
                else:
                    key = str(c) + "-" + str(z)
                    if key in data_dict:
                        ans += data_dict[key] * 6
                    else:
                        d = gcd(c, z)
                        data_dict[key] = d
                        ans += d * 6
    for x in range(2, k):
        for y in range(x + 1, k + 1):
            key = str(x) + "-" + str(y)
            if key in data_dict:
                ans += data_dict[key] * 6
            else:
                d = gcd(x, y)
                data_dict[key] = d
                ans += d * 6
    for x in range(2, k + 1):
        ans += x

    print(ans)




Measured memory_bytes: 10828
import java.util.Scanner;

public class Main {

    public Main() {
    }

    private static Scanner sc;

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

    private void run() {
        int A = sc.nextInt();
        int B = sc.nextInt();

        if (A == 1) {
            A = 14;
        }
        if (B == 1) {
            B = 14;
        }

        if (A == B) {
            System.out.println("Draw");
        } else if (A > B) {
            System.out.println("Alice");
        } else {
            System.out.println("Bob");
        }
    }
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  int32 ans = 0;
  REP(i,n){
    int32 a;
    cin >> a;
    if(i%2==0 && a%2)ans++;
  }
  ANS(ans);
  return 0;
}

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

int main(){
	ll n,m; cin >> n >> m;
	vl k(m);
	vector<vl> s(m,vl(0));
	rep(i,m){
		cin >> k[i];
		rep(j,k[i]){
			ll s_num; cin >> s_num; --s_num;
			s[i].push_back(s_num);
		}
	}
	vl p(m); rep(i,m)cin >> p[i];
	ll ans = 0;
	rep(tmp,(1 << n)){
		bitset<11> bit(tmp);
		ll ok = true;
		rep(i,m){
			ll sum = 0;
			rep(j,k[i]){
				if(bit.test(s[i][j]))sum++;
			}
			if(sum %2 != p[i])ok = false;
		}
		if(ok)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
constexpr int INF = 1e9;

int dp[44][444][444];
int a[44],b[44],c[44];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n, ma, mb; cin >> n >> ma >> mb;
    REP(i,n) cin >> a[i] >> b[i] >> c[i];
    REP(i,n+1) REP(j,404) REP(k,404) dp[i][j][k] = INF;

    dp[0][0][0] = 0;
    REP(i,n) {
        REP(j,404) {
            REP(k,404) {
                chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
                chmin(dp[i+1][j][k], dp[i][j][k]);
            }
        }
    }

    int ans = INF;
    rep(i,1,404) rep(j,1,404) if(i*mb == j*ma) chmin(ans, dp[n][i][j]);
    if(ans==INF) cout << -1;
    else cout << ans;
    cout << '\n';

    return 0;
}

Measured memory_bytes: 32896
#169A

#1.入力をちゃんと受け取る。
#ex:[2 5] a=2,b=5とする
a, b = map(int, input().split())
#print(a)
#print(b)


#2.目的通りの計算（二つの整数の計算）を行う
answer = a * b
#3.計算の結果を出力する

print(answer)

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

int main()
{
    string S;
    cin >> S;
    int L = S.size();
    string ans = "AC";
    if(S[0] != 'A'){
        ans = "WA";
    }

    int cnt = 0;
    for (int i = 1; i < L; ++i){
        if(isupper(S[i])){
            if( i==1 or i== L-1 or S[i] != 'C'){
                ans = "WA";
            }
            ++cnt;
        }
    }

    if( cnt != 1 ){
        ans = "WA";
    }

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

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int x,y,z,s=0;
    scanf("%d%d%d",&x,&y,&z);
    if(x>=(y+z)){
        s++;
        x=x-(y+z);
    }
    while(x>=(y+z+z)){
        s++;
        x=x-(y+z);
    }
    printf("%d\n",s);
    return 0;
}

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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

void call(ll n);
void check();
void include();
void eend();
ll i,x,n;

void call(ll n){
    i=1;
    check();
}

void check(){
    x=i;
    if(x%3==0){
        cout<<" "<<i;
        eend();
        return;
    }
    include();
}

void include(){
    if(x%10==3){
        cout<<" "<<i;
        eend();
        return;
    }
    x/=10;
    if(x){
        include();
        return;
    }
    eend();
}

void eend(){
    if(++i<=n){
        check();
        return;
    }
    cout<<endl;
}

int main(){
    cin>>n;
    call(n);
    return 0;
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int n, m;
const ll MOD = 1000000007;

ll mod_inverse(ll a, ll mod) {
  ll now = mod - 2;
  ll res = 1;
  ll b = a;
  while (now != 0) {
    if (now & 1) {
      res = ((res % MOD) * (b % MOD) % MOD);
    }
    now >>= 1;
    b = ((b % MOD) * (b % MOD) % MOD);
  }
  return res % MOD;
}

ll comb(int a, int b) {
  ll res = 1;
  ll now = a;
  for (int i = 1; i <= b; i++) {
    res = ((res % MOD) *(now % MOD)) % MOD;
    res = ((mod_inverse(i, MOD) % MOD) * (res % MOD)) % MOD;
    now--;
  }
  //cout << res << endl;
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  if (stream2 == NULL) return 0;
#endif
  cin >> n >> m;
  int now = m;
  vector<pair<int,int> > v;
  for (int i = 2; i * i <= now; i++) {
    int cont = 0;
    while (now % i == 0) {
      now /= i;
      cont++;
    }
    if (cont != 0) {
      v.push_back(make_pair(i, cont));
    }
  }
  if (now != 1) {
    v.push_back(make_pair(now, 1));
  }
  ll ans = 1;
  for (int i = 0; i < (int)v.size(); i++) {
    ans = ((comb(n - 1 + v[i].se, v[i].se) % MOD) * (ans % MOD)) % MOD;
  }
  cout << ans << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  fclose(stream2);
#endif
  return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

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

ans = [0]*(N-1)
branch1 = X-1
branch2 = N-Y
cycle = Y-X+1
for i in range(cycle//2):   # 輪の1/2まで両側(2通り）で行ける
    ans[i] += cycle
if cycle%2==0:     # 輪は偶数（両方から同じ距離がある）
    ans[cycle//2-1] -= cycle//2
ans[0] -= 1

for i in range(branch1):
    for j in range(cycle//2):
        if cycle%2==0 and j==cycle//2-1:
            ans[i+j+1] += 1
        elif j == 0:    # 直線経路は除外
            ans[i+j+1] += 1
        else:
            ans[i+j+1] += 2
for i in range(branch2):
    for j in range(cycle//2):
        if cycle%2==0 and j==cycle//2-1:
            ans[i+j+1] += 1
        elif j == 0:    # 直線経路は除外
            ans[i+j+1] += 1
        else:
            ans[i+j+1] += 2

for i in range(branch1+branch2+1):   # 直線経路
    ans[i] += branch1+branch2+1 - i

for i in range(N-1):
    print(ans[i])

Measured memory_bytes: 44656
<?php
  fscanf(STDIN, "%d", $n);
  $n1 = $n % 1000;
  $n2 = (int)($n / 10);

  $flag = false;
  if ($n1 == 000 || $n2 == 000) $flag = true;
  if ($n1 == 111 || $n2 == 111) $flag = true;
  if ($n1 == 222 || $n2 == 222) $flag = true;
  if ($n1 == 333 || $n2 == 333) $flag = true;
  if ($n1 == 444 || $n2 == 444) $flag = true;
  if ($n1 == 555 || $n2 == 555) $flag = true;
  if ($n1 == 666 || $n2 == 666) $flag = true;
  if ($n1 == 777 || $n2 == 777) $flag = true;
  if ($n1 == 888 || $n2 == 888) $flag = true;
  if ($n1 == 999 || $n2 == 999) $flag = true;

  if ($flag) {
    echo "Yes\n";
  } else {
    echo "No\n";
  }
?>


Measured memory_bytes: 4604
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	ll N;
	cin >> N;
	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}
	vc ans;

	while (N != 0) {
		//cout << N << endl;
		if (N > 0) {
			ans.push_back(char('0' + N % 2));
			N = -N / 2;
		}
		else {
			ans.push_back(char('0' + (-N % 2)));
			N = (-N + 1) / 2;
		}
	}
	//cout << ans << endl;
	bool ok = false;
	reprev(i, ans.size()) {
		if (!ok && ans[i] == '0') continue;
		else {
			ok = true;
			cout << ans[i];
		}
	}
	cout << endl;



	/*ll N, M;
	cin >> N >> M;
	vll A(N);
	cin >> A;

	int l = 0, r = 0;
	ll sum = A[0];
	ll ans = 0;
	while (true) {
		cout << "l:" << l << " r:" << r << " sum:" << sum << endl;
		if (sum % M == 0) {
			ans++;
		}

		if (r == N && l == N) {
			cout << ans << endl;
			return 0;
		}
			
		if (r < N - 1 && (A[l] % 2 == 0 || l == r)) {
			r++;
			sum += A[r];
		}
		else if (l < r){
			sum -= A[l];
			l++;
		}
		else {
			cout << ans << endl;
			return 0;
		}
	}
	
*/
	return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc165/tasks/abc165_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
    [[nodiscard]]
#elif defined(__GNUC__) && \
    (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
    __attribute__((warn_unused_result))
#endif
    FixPoint : private F {
 public:
  explicit constexpr FixPoint(F && f) noexcept : F(std::forward<F>(f)) {}

  template <typename... Args>
  constexpr decltype(auto) operator()(Args&&... args) const
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
      noexcept(noexcept(
          F::operator()(std::declval<FixPoint>(), std::declval<Args>()...)))
#endif
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};

template <typename F>
static inline constexpr decltype(auto) makeFixPoint(F&& f) noexcept {
  return FixPoint<F>{std::forward<F>(f)};
}

void solve() {
  ll N, M, Q;
  cin >> N >> M >> Q;

  struct Const {
    ll a, b, c, d;
  };

  V<Const> cs(Q);

  rep(i, Q) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    cs[i] = {a, b, c, d};
  }

  ll res = 0;

  auto dfs = makeFixPoint([&](auto f, VL& arr) -> void {
    if (arr.size() == N) {
      ll sum = 0;

      for (auto c : cs) {
        if (arr[c.b] - arr[c.a] == c.c) sum += c.d;
      }

      chmax(res, sum);
      return;
    }

    ll last_value = arr.size() == 0 ? 1 : arr.back();

    for (ll v = last_value; v <= M; ++v) {
      arr.push_back(v);
      f(arr);
      arr.pop_back();
    }
  });

  VL arr(0);
  dfs(arr);

  cout << res << "\n";
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans += sc.nextInt() - 1;
        }
        System.out.println(ans);

    }

}


Measured memory_bytes: 27348
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int A = Integer.parseInt(S[0]);
    int B = Integer.parseInt(S[1]);
    
    String ans = "";
    if(A <= 0 && B >= 0){
      ans = "Zero";
    }else if(A > 0 && B > 0){
      ans = "Positive";
    }else{
      if(Math.abs((A + B)) % 2 == 1){
        ans = "Positive";
      }else{
        ans = "Negative";
      }
    }
    System.out.println(ans);
  }
}

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

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] alph = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
            Dictionary<char, int> dic1 = new Dictionary<char, int>();
            Dictionary<char, int> dic2 = new Dictionary<char, int>();
            for (int i = 0; i < 26; i++)
            {
                dic1.Add(alph[i], 0);
                dic2.Add(alph[i], 0);
            }

            int N = int.Parse(Console.ReadLine());

            char[] cha = Console.ReadLine().ToCharArray();
            foreach (var c in cha)
                dic1[c]++;

            for(int i = 1; i < N; i++)
            {
                char[] ch = Console.ReadLine().ToCharArray();
                foreach (var c in ch)
                    dic2[c]++;

                for (int j = 0; j < 26; j++)
                {
                    dic1[alph[j]] = Math.Min(dic1[alph[j]], dic2[alph[j]]);
                    dic2[alph[j]] = 0;
                }
            }
            for(int i = 0; i < 26; i++)
            {
                for (int j = 0; j < dic1[alph[i]]; j++)
                    Console.Write(alph[i]);
            }
            Console.WriteLine();
            Console.ReadKey();
        }
    }
}

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

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  int maximum = 0;
  int now = 0;
  for(int i=0;i<n;i++){
    if(s[i]=='I'){
      now += 1;
      if (now>maximum){
        maximum = now;
      }
    }
    else{
      now += -1;
    }
  }
  cout << maximum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int A,B;
	while(scanf("%d%d",&A,&B)!=EOF)
	{
		int c;
		c=A+B;
		if(c>=10)
			printf("error\n");
		else 
			printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000000

int N, C, D[35][35], cost[3][35];

int main() {
  vector<int> id[3];
  cin >> N >> C;

  rep(i, C) {
    rep(j, C) {
      cin >> D[i][j];
    }
  }

  rep(i, N) {
    rep(j, N) {
      int tmp;
      cin >> tmp;
      id[(i + j) % 3].push_back(tmp-1);
    }
  }

  rep(i, C) {
    rep(j, 3) {
      for (int& elem : id[j]) {
        cost[j][i] += D[elem][i];
      }
    }
  }

  int ans = INF;
  rep(i, C) {
    rep(j, C) {
      if (i == j) continue;
      rep(k, C) {
        if (k == i || k == j) continue;
        ans = min(ans, cost[0][i]+cost[1][j]+cost[2][k]);
      }
    }
  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 1520
from collections import deque, defaultdict

N = int(input())
A = [deque(map(lambda a: int(a) - 1, input().split())) for _ in range(N)]

D = [0] * N
Nx = [-1] * N
que = deque(range(N))

while que:
    i = que.popleft()
    j = A[i].popleft()
    Nx[i] = j

    if Nx[j] == i:
        day = max(D[i], D[j])
        D[i] = D[j] = day + 1

        if A[i]:
            que.append(i)
        if A[j]:
            que.append(j)

if all(len(a) == 0 for a in A):
    print(max(D))
else:
    print(-1)


Measured memory_bytes: 36076
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    
    ll ans = 0;

    rep(i, n-2)if(s[i]=='A' && s[i+1] == 'B' && s[i+2] == 'C')ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long x = long.Parse(input[0]);
		long y = long.Parse(input[1]);
    Console.WriteLine((Math.Abs(x-y) >= 2) ? "Alice" : "Brown");
	}
}

Measured memory_bytes: 13140
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main(){
    int N; cin >> N;
    vector<int> B(N-1);
    rep(i,0,N-1) cin >> B[i];
    vector<ll> A(N,0);
    A[1] = A[0] = B[0];
    rep(i,1,N){
        A[i-1] = min((ll)B[i-1],A[i-1]);
        A[i] = B[i-1];
    }
    ll ans = 0;
    rep(i,0,N){
        ans = ans + A[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = numeric_limits <int>::max())
{return uniform_int_distribution<int> (l, r)(rng);}

template <typename T, typename G>
ostream& operator << (ostream& out, const pair <T, G> &a) 
{return out << "( " << a.x << ", " << a.y << ")";}

template <typename T>
ostream& operator << (ostream& out, const vector <T> &a) 
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

template <typename T>
ostream& operator << (ostream& out, const set <T> &a) 
{out << "{ "; for(const auto &i: a) out << i << ", "; return out << "}" << endl;}

template <typename T, typename G>
ostream& operator << (ostream& out, const map <T, G> &a) 
{out << "< "; for(const auto &i: a) out << i << ", "; return out << ">" << endl;}

template <typename T, size_t N>
typename enable_if<!is_same <typename remove_cv <T>::type, char>::value,
ostream&>::type operator << (ostream& out, T (&a)[N])
{out << "[ "; for(const auto &i: a) out << i << ", "; return out << "]" << endl;}

void debug_out(){cerr << endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr << (H) << ' '; debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr << '#' << #__VA_ARGS__ << ":\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n, sum = 0;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int taken = 0, last = n-1;
	while(taken < n - 1) {
		if (taken & 1)
			last--;
		debug(taken, a[last]);
		sum += a[last];
		taken++;
	}
	cout << sum << '\n';
	return 0;
}


Measured memory_bytes: 4776
#include <iostream>

using namespace std;

int main(void)
{
  int X;

  cin >> X;

  int dvd = X / 100;
  int mod = X % 100;

  if (mod <= dvd * 5) {
    cout << "1";
  } else {
    cout << "0";
  }

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  string s,t;
  cin>>s>>t;
  vector<int> G[26];
  vector<int> V[26];
  for(int i=0;i<s.size();i++){
    int tmp=s[i]-'a';
    G[tmp].push_back(i);
    tmp=t[i]-'a';
    V[tmp].push_back(i);
  }

  bool f=true;

  for(int i=0;i<26;i++){
    for(int j=0;j+1<G[i].size();j++){
      if(t[G[i][j]]!=t[G[i][j+1]])f=false;
    }
    for(int j=0;j+1<V[i].size();j++){
      if(s[V[i][j]]!=s[V[i][j+1]])f=false;
    }
  }
  if(f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 4744
n,a,d = int(input()),list(map(int,input().split())),[0 for i in range(100100)]
for x in a:
	d[x] += 1
s,q = sum(a),int(input())
for i in range(q):
	b,c = map(int,input().split())
	s += (c-b)*d[b]
	d[c] += d[b]
	d[b] = 0
	print(s)

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

class UnionFind {
    std::vector<int> p;

public:
    UnionFind(int n) : p(n, -1) {}

    int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }

    bool same(int x, int y) { return root(x) == root(y); }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (p[y] < p[x]) std::swap(x, y);
        if (p[x] == p[y]) --p[x];
        p[y] = x;
        return true;
    }
};


void solve(long long N, std::vector<std::vector<long long>> A) {
    auto B = A;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                B[j][k] = min(B[j][i] + B[i][k], B[j][k]);
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (A[i][j] != A[j][i]) {
                B = {};
            }
        }
    }
    if (A != B) {
        cout << -1 << endl;
        return;
    }
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                if (i != j && j != k && i != k) {
                    if (A[j][i] + A[i][k] == A[j][k]) {
                        B[j][k] = 0;
                    }
                }
            }
        }
    }
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < i ; j++){
            ans += B[i][j];
        }
    }
    cout << ans << endl;


}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<std::vector<long long>> A(N, std::vector<long long>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            scanf("%lld", &A[i][j]);
        }
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    cin >> N;
    
    priority_queue<double> PQ;
    REP(i, N) {
        double v;
        cin >> v;
        PQ.push(-1*v);
        // cout << "yy" << endl;
    }

    while (PQ.size() > 1) {
        double s, t;
        s = PQ.top();
        PQ.pop();
        t = PQ.top();
        PQ.pop();
        PQ.push((s+t) / 2);
    }
    
    cout << -1*PQ.top() << endl;
    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;
    
    public static void main(String[] args) {
        char[] s = nsToChars();
        int count = 0;
        for (int i = 0; i < s.length; i++) {
            if (s[i] == 'x') {
                count++;
            }
        }
        so.println(count <= 7 ? "YES":"NO");
    }
    

    private static int ni() {
        return sc.nextInt();
    }

    private static long nl() {
        return sc.nextLong();
    }

    private static String ns() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0);
    }

    private static long[] nlongs(int n, int padding) {
        long[] a = new long[padding + n];
        for (int i = 0; i < n; i++)
            a[padding + i] = ni();
        return a;
    }
}


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

#define rep(i, n)  for (int i = 0; i < (n) ; ++i)

using namespace std;
using ll=long long;

const int INF = 100000;

int main() {
    string s;
    cin >> s;
    rep(i, 2) {
        if (s[i] != s[i + 1]) {
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k,a,b; cin >> k >> a >> b;
    bool ok=0;
    for(int i=a;i<=b;i++){
        if(i%k==0)ok=1;
    }
    if(ok)printf("OK\n");
    else printf("NG\n");
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

bool cmp(ii a, ii b)
{
	if(a.fi!=b.fi) return a.fi>b.fi;
	else return a.se>b.se;
}

vector<ii> vec;
ll ans[100001];


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vec.resize(n);
	ll sum = 0;
	for(int i = 0; i < n; i++)
	{
		ll x; cin>>x;
		vec[i].fi=x;vec[i].se=i;
		sum+=x;
	}
	sort(vec.begin(),vec.end(),cmp);
	ll weight = 0;
	for(int i = 0; i < vec.size(); i++)
	{
		//cerr<<"IDX : "<<i<<'\n';
		ll cnt = vec[i].fi; ll idx = vec[i].se;
		if(i+1<vec.size()&&vec[i+1].fi==vec[i].fi)
		{
			weight++;
			continue;
		}
		if(i==int(vec.size()) - 1)
		{
			ans[idx]+=cnt*(weight+1);
			break;
		}
		int ptr = i + 1;
		int nxtval = vec[ptr].fi;
		int ext = 1;
		while(ptr<n&&vec[ptr].fi==nxtval)
		{
			ext++;
			ptr++;
		}
		ptr--;
		ext--;
		if(vec[ptr].se<idx)
		{
			ans[idx]+=(cnt-(nxtval+1))*(weight+1)+1+weight;
			//ans[vec[ptr].se]+=weight;
			weight++;
			continue;
		}
		ans[idx]+=(cnt-nxtval)*(weight+1);
		//cerr<<idx+1<<' '<<ans[idx]<<'\n';
		vec[ptr].se=idx;
		i=ptr-1;
		weight+=ext;
		//cerr<<"SPECIAL : "<<i<<'\n';
		continue;
	}
	for(int i=0;i<n;i++)
	{
		cout<<ans[i]<<'\n';
	}
}


Measured memory_bytes: 3456
N = int(input())
ans = 0

def make_divisors(n):
  divisors = []
  for i in range(1, N+1):
    if n % i == 0:
      divisors.append(i)
  return divisors

for i in range (1,N+1):
  a = len(make_divisors(i))
  if (a == 8) and (i % 2 != 0):
    ans = ans + 1
print(ans)

Measured memory_bytes: 3060