akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int x, y;
    while (cin >> x >> y && (x > 0 || y > 0)){
        printf("%d %d\n", min(x,y), max(x,y));
    }
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    stack<int> ans;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(ans.empty()&&a==1)
            ans.push(a);
        else if(!ans.empty()&&a==ans.top()+1)
            ans.push(a);
    }
    if(ans.empty())
        cout<<-1;
    else 
        cout<<n-ans.size();
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    
    int r,D,x;
    cin>>r>>D>>x;
    
    int ans=x;
    for(int i=0;i<10;i++){
        ans = r*ans-D;
        cout<<ans<<endl;
    }
    
}


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

#define INF (INT64_MAX/2)
#define MAX_V 100010

struct edge {
	int to, cost;
	edge( int a, int b ) { to = a; cost = b; }
};
typedef pair<int, int> P;

int V;
vector<vector<edge>> G;
vector<long long> d;

void dijkstra( int s )
{
	priority_queue<P, vector<P>, greater<P>> que;
	fill( d.begin(), d.begin() + V, INF );
	d[s] = 0;
	que.push( P( 0, s ) );
	while( !que.empty() ) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if( d[v] < p.first ) continue;
		for( auto e : G[v] ) {
			if( d[e.to] > d[v] + e.cost ) {
				d[e.to] = d[v] + e.cost;
				que.push( P( d[e.to], e.to ) );
			}
		}
	}
}

int main()
{
	int n, m, s, t;
	scanf( "%d %d %d %d", &n, &m, &s, &t );
	vector<int> u( m );
	vector<int> v( m );
	vector<int> a( m );
	vector<int> b( m );
	for( int i = 0; i < m; i++ ) {
		scanf( "%d %d %d %d", &u[i], &v[i], &a[i], &b[i] );
		u[i]--;
		v[i]--;
	}
	s--;
	t--;

	V = n;
	G = vector<vector<edge>>( n );
	for( int i = 0; i < m; i++ ) {
		G[ u[i] ].push_back( edge( v[i], a[i] ) );
		G[ v[i] ].push_back( edge( u[i], a[i] ) );
	}
	d = vector<long long>( MAX_V );
	dijkstra( s );
	vector<long long> d1 = d;

	G.clear();
	G = vector<vector<edge>>( n );
	for( int i = 0; i < m; i++ ) {
		G[ u[i] ].push_back( edge( v[i], b[i] ) );
		G[ v[i] ].push_back( edge( u[i], b[i] ) );
	}
	dijkstra( t );

	vector<pair<long long, int>> so( V );
	for( int i = 0; i < V; i++ ) {
		so[i] = make_pair( 1000000000000000 - d1[i] - d[i], i );
	}
	sort( so.begin(), so.end(), greater<pair<long long, int>>() );
	vector<long long> ans( V );
	int j = 0;
	for( int i = 0; i < V; i++ ) {
		while( so[j].second < i ) j++;
		ans[i] = so[j].first;
	}

	for( int i = 0; i < V; i++ ) {
		printf("%lld\n", ans[i] );
	}
}

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

using namespace std;

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

#define int ll

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

	if(n>=30){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
#define N 200015
const int p=1e9+7;
struct edge{int to,nxxt;}e[N];
int n,m,k,head[N],cnt=1,dfn[N],low[N],cn,an,siz[N],a[N][2],eds[N];
int f[N],inv[N],finv[N];
ll bel[N];
stack<int>s;
inline int ksm(int d,int tk){int ret=1;while(tk){if(tk&1)ret=1ll*ret*d%p;d=1ll*d*d%p;tk>>=1;}return ret;}
void tarjan(int x)
{
	dfn[x]=low[x]=++cn;s.push(x);
	for(int i=head[x];i;i=e[i].nxxt)
	{
		int j=e[i].to;
		if(!dfn[j])
		{
			tarjan(j);low[x]=min(low[x],low[j]);
			if(dfn[x]<=low[j])
			{
				an++;int w=0;
				do
				{
					w=s.top();s.pop();bel[w]|=1ll<<an;siz[an]++;
				}while((!s.empty())&&w!=j);
				siz[an]++;bel[x]|=1ll<<an;
			}
		}
		else low[x]=min(low[x],dfn[j]);
	}
}
inline void ins(int u,int v){e[cnt].to=v;e[cnt].nxxt=head[u];head[u]=cnt++;}
inline int C(int nn,int mm)
{
	if(nn<mm)return 0;
	if(nn==mm||mm==0)return 1;
	return 1ll*f[nn]*finv[mm]%p*finv[nn-mm]%p;
}
inline int cal(int x)
{
	int ret=0;
	for(int i=1;i<=x;i++)ret=(ret+ksm(k,__gcd(i,x)))%p;
	return 1ll*ret*inv[x]%p;
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=m;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);a[i][0]=x,a[i][1]=y;
	}
	for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i);
	int ans=1;
	for(int i=1;i<=m;i++)
	{
		if(bel[a[i][0]]&bel[a[i][1]])
		{
			ll x=bel[a[i][0]]&bel[a[i][1]];
			for(int j=1;j<=an;j++)if(x&(1ll<<j))eds[j]++;
		}
		else ans=1ll*ans*k%p;
	}f[0]=finv[0]=inv[1]=f[1]=finv[1]=1;
	for(int i=2;i<=100000;i++)
	{
		inv[i]=1ll*(p-p/i)*inv[p%i]%p;
		f[i]=1ll*f[i-1]*i%p;finv[i]=1ll*finv[i-1]*inv[i]%p;
	}
	for(int i=1;i<=an;i++)
	{
		if(eds[i]==siz[i])ans=1ll*ans*cal(siz[i])%p;
		else if(eds[i]<siz[i])ans=1ll*ans*k%p;
		else ans=1ll*ans*C(eds[i]+k-1,k-1)%p;
	}printf("%d\n",ans);
}


Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
bool result(int x, int y, int z, int e){
	return ((x*x+z*z+y*y+x*y+y*z+z*x) <= e);
}
int main()
{
	int n, x, y, z, c = 0;
	cin>>n;
	for(int e = 1; e <= n; e++){
		c = 0;
		for( x = 1; x < int(sqrt(e));x++){
			for( y = 1; y < int(sqrt(e)); y++){
				for( z = 1; z < int(sqrt(e)); z++){
					 if((x*x+z*z+y*y+x*y+y*z+z*x) == e)
						 ++c;
					 else if((x*x+z*z+y*y+x*y+y*z+z*x) > e){
						 break;
					 }
				}
			}
		}
		cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
   #define PP pair<int,pair<int,int>>
const int MAX = 1000001;
const int MOD =1000000007;
const int INV2 = (MOD+1)/2;



     signed main(){
int a,b,c,k;
cin>>a>>b>>c>>k;
if(a+b<k){
  cout<<a-(k-a-b)<<endl;
}else{
  cout<<min(k,a)<<endl;
  return 0;
}




}


        


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;

int dx[] = {1, 1, 0, -1, -1, 0};
int dy[] = {0, 1, 1, 0, -1, -1};

int main() {
    int t, n;   // ターン数 t, 障害物の数 n
    while (cin >> t >> n, t) {
        map<pair<int, int>, int> dp;
        while (n--) {
            int x, y; cin >> x >> y;
            dp[{x, y}] = -1;
        }
        int sx, sy; cin >> sx >> sy;
        queue<pair<pair<int, int>, int>> q;
        q.emplace(make_pair(sx, sy), t);
        while (!q.empty()) {
            auto p = q.front(); q.pop();
            int cx = p.first.first, cy = p.first.second, t = p.second;
            if (dp[{cx, cy}] != 0) continue;
            if (t < 0) continue;
            dp[{cx, cy}] = 1;
            for (int i = 0; i < 6; i++) {
                q.emplace(make_pair(cx + dx[i], cy + dy[i]), t - 1);
            }
        }
        int cnt = 0;
        for (auto p : dp) if (p.second == 1) cnt++;
        cout << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 3300
#include <stdio.h>

#define N 300000
int c[N];

int main(void)
{
    int n, i, j;
    for(i=2;i*i<N;++i) if (!c[i])
        for(j=i*i;j<N;j+=i) c[j]=1;

    while (scanf("%d", &n), n) {
        int res=0;
        for(i=n+1;i<=n+n;++i) res+=!c[i];
        printf("%d\n", res);
    }
    return 0;
}

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

int main() {
	int N, K; cin >> N >> K;
	vector<int>h(N); 
	for (int i = 0; i < N; i++) cin >> h[i];
	sort(h.begin(), h.end());

	int ans = (int)1e9;
	for (int i = 0; i <= (N - K); i++)ans = min(ans, h[i + (K - 1)] - h[i]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
    int K, N;
    int A[200001];
    
    scanf("%d %d", &K, &N);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);

    int L[N];
    for (int i = 0; i < N-1; i++) L[i] = A[i+1] - A[i];
    L[N-1] = (K - A[N-1]) + A[0];
    sort(L, L + N);

    int ans = 0;
    for (int i = 0; i < N-1; i++) ans += L[i];

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

Measured memory_bytes: 1664
#include<stdio.h>
int main(){
  int n,m,mi,min,i,j,k,a,b;
  while(scanf("%d %d",&m,&n),n||m){
    int d[110][110][2]={0};
    n++;
    while(m--){
      scanf("%d %d %d %d",&a,&b,&i,&j);
      d[a][b][0]=d[b][a][0]=i;
      d[a][b][1]=d[b][a][1]=j;
    }
    scanf("%d",&m);
    while(m--){
      scanf("%d %d %d",&mi,&b,&k);
      int c[110]={0};
      int f[110]={0};
      for(i=1;i<n;i++){
	f[mi]=1;
	for(j=1;j<n;j++){
	  if(f[j]||d[mi][j][k]==0)continue;
	  if(c[j]==0||c[j]>c[mi]+d[mi][j][k])c[j]=c[mi]+d[mi][j][k];
	}
	min=2100000000;
	for(j=1;j<n;j++){
	  if(f[j]||c[j]==0)continue;
	  if(min>c[j])min=c[mi=j];
	}
      }
      printf("%d\n",c[b]);
    }
  }
  return 0;
}

Measured memory_bytes: 700
# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])
    LR = [tuple(map(int, a.split())) for a in args[1:]]
    L, R = zip(*LR)

    ret = 0

    # lp, rq = max(L), min(R)
    lp, rq = 0, 1+10**9
    for l, r in LR:
        lp, rq = max(lp, l), min(rq, r)

    ret = max(0, 1+rq-lp) + max(0, max(1+r-l for l, r in LR))

    AB = [[max(0, 1+r-lp), max(0, 1+rq-l)] for l, r in LR]
    AB.sort(key=lambda x: (x[0], -x[1]))
    A, B = map(list, zip(*AB))

    # for i in range(1, n):
    #     ret = max(ret, min(A[i:]) + min(B[:i]))
    b_min = 1+10**9
    for i in range(n-1):
        b_min = min(b_min, B[i])
        ret = max(ret, b_min + A[i+1])

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


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


int main(){

        double W , H , x,y;
        cin >> W >> H >> x >> y;

        cout << W * H /2 << endl;

        if(2*x==W && 2*y == H){
                cout << 1;
        }else{
                cout << 0;
        }

}

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

int n;					//えぬ
int a[100][100] = {0};	//辺の重さ
int f[100] = {0};		//その頂点がすでに連結済みかどうか、その集団の番号
int c = 0;				//全体の重さ
int d = 1;				//次につける集団番号
int s = 0;				//選んだ本数
vector<int> w;			//木のリスト、軽いもの順
int wc = 0;				//見てる木のリストの位置

int main(){
	cin >> n;
	//まず辺の重さをaに入れる
	//wに辺のリストを入れる
	for ( int i = 0; i < n; i++ ) {
		for ( int j = 0; j < n; j++ ) {
			cin >> a[i][j];
			if ( a[i][j] != -1 && i < j ) w.push_back( a[i][j] );
		}
	}
	sort( w.begin(),w.end() );
	while(true) {									//n-1本選ぶまで無限ループ
		for ( int i = 0; i < n - 1; i++ ) {			// i < j を満たすように木を調べ続ける
			for ( int j = i + 1; j < n; j++ ) {
				if ( a[i][j] != w[wc] ) continue;	//その木が一番軽い木だったらそれを対象に検査を始める
				if ( f[i] > 0 && f[j] > 0 ) {		//その木の両端が両方とも連結済みだったら
					if ( f[i] != f[j] ) {
						int y = f[j];
						for ( int x = 0; x < n; x++ ) {
							if ( f[x] == y ) f[x] = f[i];
						}
						c += a[i][j];
						s++;
					}
				}else if ( f[i] == 0 && f[j] == 0 ) {
					f[i] = d;
					f[j] = d;
					d++;
					c += a[i][j];
					s++;
				}else {
					if ( f[i] == 0 ) {
						f[i] = f[j];
						c += a[i][j];
						s++;
					}else {
						f[j] = f[i];
						c += a[i][j];
						s++;
					}
				}
				wc++;
				a[i][j] = -1;
				if ( s == n-1 ) break;
			}
			if ( s == n-1 ) break;
		}
		if ( s == n-1 ) break;
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 1292
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 

const ll mod = 1e9+7;
const ll inf=1e18+1e17;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N=1e5+6;
const long double pi=3.14159265358979323;

void solve(){

	int n,m;
	cin>>n>>m;
	ll val=0;
	for (int i=0;i<m;i++){
		int aa;
		cin>>aa;
		val+=aa;
	}
	if ( val>n)
		cout<<-1<<'\n';
	else
		cout<<n-val<<'\n';



}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll t=1;
//	cin>>t;
    for (int i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}





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

using namespace std;
#define int long long
// skjfhkshdkhksjhjsf
const int N=1e5+5;

int n,m,sz,ok,ans;
int cnt[N];
vector<int> adj[N];

void dfs(int u,int type){
    if(ok) return;
    if(type) sz++;
    cnt[u]=type;
    for(int i=0;i<adj[u].size();++i){
        int v=adj[u][i];
        if(ok) return;
        if(cnt[v]==-1)
            dfs(v,1-type);
        else if(cnt[v]==type){
            ok=1;
            return;
        }
    }
}
signed main(){
    cin>>n>>m;
    memset(cnt,-1,sizeof cnt);
    for(int i=1;i<=m;++i){
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1,1);
    if(ok) ans=((n-1)*n/2)-m;
    else  ans=sz*(n-sz)-m;
    cout<<ans;
}


Measured memory_bytes: 7424
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long LL;
#define INF (1 << 29)


//N個の全パターンの配列ベクトルを返す
vector <vector <int> > make_pattern(int N){ 
  vector <vector <int> > pattern;
  vector <int> v;
  v.push_back(1);
  pattern.push_back(v);
  
  for(int i=1;i<N;i++){
	vector <vector <int> > t;
	int p_num=pattern.size();
	int v_num=pattern[0].size();

	for(int j=0;j<p_num;j++){
	  for(int k=0;k<v_num+1;k++){
		pattern[j].insert(pattern[j].begin()+k,i+1);
		t.push_back(pattern[j]);
		pattern[j][k]=pattern[j].back();
		pattern[j].pop_back();
		//pattern[j].erase(pattern[j].begin()+k);
	  }
	}
	pattern=t;
  }
  return pattern;
}

int main(){
  int N,M,R;
  cin >> N >> M >> R;
  vector<int> r(R);
  for(int i=0;i<R;i++){
	cin >> r[i];
  }

  vector<vector<int> > d(N,vector<int>(N,INF));
  for(int i=0;i<M;i++){
	int t_next1,t_next2,t_d;
	cin >> t_next1 >> t_next2 >> t_d;
	if(d[t_next1-1][t_next2-1]>t_d){
	  d[t_next1-1][t_next2-1]=t_d;
	  d[t_next2-1][t_next1-1]=t_d;
	}
  }

  for(int k=0;k<N;k++){
	for(int i=0;i<N;i++){
	  for(int j=0;j<N;j++){
		if(d[i][j]>d[i][k]+d[k][j]){
		  d[i][j]=d[i][k]+d[k][j];
		}
	  }
	}
  }

  vector <vector <int> > pattern=make_pattern(R);

  int min_d=INF;
  for(int i=0;i<pattern.size();i++){
	int t_d=0;
	for(int j=0;j<R-1;j++){
	  t_d+=d[r[pattern[i][j]-1]-1][r[pattern[i][j+1]-1]-1];
	}
	if(min_d>t_d){
	  min_d=t_d;
	}
  }

  cout << min_d << endl;

  return 0;
}

Measured memory_bytes: 6528
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    a, b = gets.chomp.split.map(&:to_i)

    ans = a - b * 2
    ans = 0 if ans < 0
    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2044
#include <stdio.h>
#include <stdlib.h>

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

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

int main() {
	int N, M, X[100000], i, d[100000], sum = 0;

	scanf("%d %d", &N, &M);
	for (i = 0; i < M; i++) {
		scanf("%d", &X[i]);
	}

	if (N >= M) {
		printf("0");
		return 0;
	}

	qsort(X, M, sizeof(int), asc);
	for (i = 1; i < M; i++) {
		d[i - 1] = X[i] - X[i - 1];
		sum = sum + d[i - 1];
	}

	qsort(d, M - 1, sizeof(int), desc);
	for (i = 0; i < N - 1; i++) {
		sum = sum - d[i];
	}

	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 1268
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B, M = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    XYC = [[int(x) for x in input().split()] for _ in range(M)]

    ans = min(a) + min(b)

    for x, y, c in XYC:
        tmp = a[x - 1] + b[y - 1] - c
        ans = min(ans, tmp)

    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 32548
#include<stdio.h>
int main()
{

    int a,h,m,s;
    scanf("%d",&a);
    h = a/3600;
    m = (a%3600)/60;
    s = (a%3600)%60;
    printf("%d:%d:%d\n",h,m,s);


    return 0;
}

Measured memory_bytes: 592
n, m, x = list(map(int, input().split()))
cl = []
al = []

for i in range(n):
    c = input()
    a = []
    asum = 0
    for i, d in enumerate(c.split()):
        if i == 0:
            cl.append(int(d))
        else:
            a.append(int(d))
            # asum += int(d)
    al.append(a)


def filter(l, x):
    for e in l:
        if int(e) < x:
            return False
    return True


ok_price_list = []

for i in range(2**n):
    f = '0%db' % n
    si = format(i, f)
    price = [int(x) * int(y) for (x, y) in zip(si, cl)]
    point_sum = [0 for m in range(n)]
    for j, sb in enumerate(si):
        if sb == '1':
            point_sum = [x+y for (x, y) in zip(point_sum, al[j])]
    if filter(point_sum, x):
        ok_price_list.append(sum(price))
if len(ok_price_list) > 0:
    print(sorted(ok_price_list)[0])
else:
    print(-1)

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


int main() {

    int N; cin >> N;
    vector<int> P(N);
    forn(i,N) cin >> P[i];
    int cnt = 0;
    for (int i = 1; i < N+1; i++) {
        if (P[i-1] != i) {
            cnt++;
        }
    }
    if (cnt == 2 || cnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
def resolve():
    n=int(input())
    a=[]
    b=[]
    for _ in range(n):
        x, y = map(int, input().split())
        a.append(x)
        b.append(y)
    a.sort()
    b.sort()
    if n%2==0:
        k=int(n/2)
        print(int(2*((b[k]+b[k-1])/2-(a[k]+a[k-1])/2)+1))
    else:
        k=n//2
        print(b[k]-a[k]+1)
resolve()

Measured memory_bytes: 104700
import math
import heapq
N,M = list(map(int, input().split()))
a=list(map(int, input().split()))

npA = []
for x in a:
    heapq.heappush(npA, -x)

# for x in range(N):
#     print(a[x])
npA.sort()


for x in range(M):
    # temp=heapq.heappop(npA)
    # print("{}//2={}".format(temp,math.ceil(temp/2)))
    heapq.heappush(npA, math.ceil(heapq.heappop(npA)/2))#get the max value!!
    

total = 0
for x in range(N):
    # temp = heapq.heappop(npA)
    # print(temp)
    total+=heapq.heappop(npA)

print(-total)




Measured memory_bytes: 14380
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int x,y; cin>>x>>y;
    vector<set<int>> s{
        {1,3,5,7,8,10,12},
        {4,6,9,11},
        {2}
    };
    
    rep(i,0,3){
        if(s[i].count(x)==1 and s[i].count(y)==1){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

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

long long gcd(long long x, long long y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

long long lcm(long long x, long long y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

const int p[] = {-1, 1, 1};
int N;

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    int n = s.size();
    int l = 0, r = n - 1;
    while (l < r)
    {
        if (s[l] != s[r])
        {
            cnt++;
            if (s[l] != 'x' and s[r] != 'x')
            {
                cout << -1 << endl;
                return 0;
            }
            else if (s[l] != 'x')
            {
                r--;
            }
            else
            {
                l++;
            }
        }
        else
        {
            l++;
            r--;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)

typedef unsigned long long ull;
typedef long long ll;

const int INF = 1001001001;
const ll MOD = 1e9 + 7;

using namespace std;
using P = pair<int,int>;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  vector<ll> a(n);
  rep(i, n) {
      cin >> a[i];
  }
  
  sort(a.begin(), a.end(), greater<ll>());
  ll height = 0; ll width = 0;
  rep(i, n-1) {
      if (a[i] == a[i+1]) 
      {
          if (height)
          {
              width = a[i];
              break;
          }
          height = a[i]; i++;
      }
  }
  cout << height*width << endl;
  return 0;
}

Measured memory_bytes: 1024
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b=split(readline())
    a=parse(BigFloat,a)
    b=parse(BigFloat,b)
    ans=Int128(floor(a*b))
    print(ans)
end
main()

Measured memory_bytes: 181192
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
      n: usize,
      a: [usize;n],
    }

    let mut money: isize = 1000;

    for i in 1..n {
        if a[i - 1] < a[i] {
            let b: isize = money / (a[i - 1] as isize);
            money -= b * (a[i - 1] as isize);
            money += b * (a[i] as isize);
        }
    }
    println!("{}", money);
}


Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    int x[n], y[n], t[n];
    x[0] = 0;
    y[0] = 0;
    t[0] = 0;
    for(int i=1;i<=n;i++){
        cin >> t[i] >> x[i] >> y[i];
    }

    string result = "Yes";
    for(int i=0; i<n; i++){
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1]-x[i]) + abs(y[i+1] - y[i]);
        if(dt < dist) result = "No";
        if(dist%2 != dt%2) result="No";
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 1408
s = input()
l = len(s)

def ispalindrome(str): return 1 if str == str[::-1] else 0

s_2 = s[:int((l-2)/2+1)]
s_3 = s[int((l+3)/2-1):]

if ispalindrome(s) == 1 and ispalindrome(s_2) == 1 and ispalindrome(s_3) == 1: 
    print("Yes")
else:
    print("No")




Measured memory_bytes: 2940
// 解き直し.
// ABC 131解説.
// https://img.atcoder.jp/abc131/editorial.pdf
#include <bits/stdc++.h>
using namespace std;

int main() {
    
    // 1. 入力情報取得.
    int N, K;
    scanf("%d %d", &N, &K);
    
    // 2. 以下, 解説通り.
    // -> 解が存在しない場合は, 終了.
    int upper = (N - 1) * (N - 2) / 2;
    if(K > upper){
        printf("%d\n", -1);
        return 0;
    }
    
    // 3. 頂点 1 を中心とするスターを作成後, 
    // 頂点 2 ～ 頂点 N の間に, 必要な本数だけ, 辺を追加し, 出力.
    // -> 必要な本数は, (upper - K)本 とする.
    int M = (N - 1) + (upper - K);
    int counter = M;
    printf("%d\n", M);
    for(int i = 1; i < N; i++) for(int j = i + 1; j <= N; j++) if(M > 0) printf("%d %d\n", i, j), M--;
    
    // 4. 後処理.
    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main(){
string x,s,e; cin>>x>>s;
int a,b; cin>>a>>b;
cin>>e;
if(x == e){
    a-=1;
}
else{
    b-=1;
}
cout<<a<<" "<<b;
}


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

public class P
{
    public int a { get; set; }
    public int b { get; set; }
    public int c { get; set; }
    public int count { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(int n)
    {
        var ans = 0;
        var q = new Queue<P>();
        for (int i = 0; i < n; i++)
            q.Enqueue(new P { a = i + 1, count = 1 });
        while (q.Count() > 0)
        {
            var w = q.Dequeue();
            if (w.count == 3)
            {
                ans += gcd(w.a, w.b, w.c);
            }
            else if (w.count == 1)
            {
                for (int i = 0; i < n; i++)
                    q.Enqueue(new P { a = w.a, b = i + 1, count = 2 });
            }
            else
            {
                for (int i = 0; i < n; i++)
                    q.Enqueue(new P { a = w.a, b = w.b, c = i + 1, count = 3 });
            }
        }
        Console.WriteLine(ans);
    }
    static int gcd(int a, int b, int c) => gcd(a, gcd(b, c));

    static int gcd(int a, int b)
    {
        if (a < b) return gcd(b, a);
        while (b != 0)
        {
            var w = a % b;
            a = b;
            b = w;
        }
        return a;
    }
}


Measured memory_bytes: 370428
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
int par[51];   //親
int rankt[51]; //木の深さ
void init(int n)
{
    for (int i = 1; i <= n; i++)
    {
        par[i] = i;
        rankt
            [i] = 0;
    }
}
//木の根を求める
int find(int x)
{
    if (par[x] == x)
    {
        return x;
    }
    else
    {
        return par[x] = find(par[x]);
    }
}
//併合
void unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (rankt
            [x] < rankt
                      [y])
    {
        par[x] = y;
    }
    else
    {
        par[y] = x;
        if (rankt
                [x] == rankt
                           [y])
            rankt
                [x]++;
    }
}
bool same(int x, int y)
{
    return find(x) == find(y);
}
int size(int x)
{
    return -par[find(x)];
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    int ans = 0;
    vector<p> edge;
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        edge.push_back(make_pair(a, b));
    }
    for (int i = 0; i < m; i++)
    {
        init(n);
        for (int j = 0; j < m; j++)
        {
            if (j != i)
            {
                unite(edge[j].first, edge[j].second);
            }
        }

        for (int k = 1; k < n; k++)
        {
            if (!same(k, k + 1))
            {
                ans++;

                break;
            }
        }
    }
    cout << ans << "\n";
}

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

int main(){
  int k;
  int board[3];
  cin >> board[0] >> board[1] >> board[2] >> k;
  sort(board,board + 3);
  cout << board[0] + board[1] + board[2] * (1<<k) << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

void solve(){
    int N;
    cin >> N;

    vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    ll ans = 0, rem;
    for (int i = N-1; i >= 0; i--) {
        rem = (A[i] + ans) % B[i];
        ans += (rem == 0) ? 0 : B[i] - rem;
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 1792
#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
#define all(x) (x).begin(), (x).end() 

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
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;

long long INF=numeric_limits<long long>::max();

int h,w,answer=0;
int adj[2022][2022], ans[2022][2022],visr[2022][2022],visd[2022][2022];

void dfs_right(int x, int y){
	int cur = y;
	int cnt = 0;
	while(cur<w){
		if(adj[x][cur]){
			break;
		}
		else{
			cnt++;
		}
		cur++;
	}
	for(int j = y; j <= cur; j++){
		ans[x][j] += cnt;
		visr[x][j]=1;
	}
}

void dfs_down(int x, int y){
	int cur = x;
	int cnt = 0;
	while(cur<h){
		if(adj[cur][y]){
			break;
		}
		else{
			cnt++;
		}
		cur++;
	}
	for(int j = x; j <= cur; j++){
		ans[j][y] += cnt;
		visd[j][y]=1;
	}
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    cin >> h >> w;
    string s;
    for(int i = 0; i < h; i++){
		cin >> s;
		for(int j = 0; j < w; j++){
			if(s[j]=='#')adj[i][j] = 1;
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(!adj[i][j]){
				if(!visr[i][j])dfs_right(i,j);
				if(!visd[i][j])dfs_down(i,j);
				answer=max(answer,ans[i][j]);
			}
		}
	}
	cout << answer-1 << endl;
}	


Measured memory_bytes: 64000
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
	int n, x;
	cin >> n >> x;
	ll dis[n], ans = 0;
	for(int i = 0; i < n; i++){
		ll num;
		cin >> num;
		dis[i] = fabs(num - x);
		ans = __gcd(ans, dis[i]);
	}
	cout << ans;
}

Measured memory_bytes: 1024
from math import gcd
import sys

def lcm(a, b):
    return a * b // gcd(a, b)

N = int(input())
T = [int(input()) for _ in range(N)]

if N == 1:
    print(T[0])
    sys.exit()

l = lcm(T[0], T[1])
for i in range(2, N):
    l = lcm(l, T[i])

print(l)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
vector<int> a(100010);
ll sum;
int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    int x;cin>>x;
    sum+=x;
    a[x]++;
  }
  
  int q;cin>>q;
  for(int i=0;i<q;++i){
    int b,c;cin>>b>>c;
    a[c]+=a[b];
    ll sa=c*a[b]-b*a[b];
    sum+=sa;
    a[b]=0;
    cout<<sum<<endl;
  }
}


Measured memory_bytes: 3696
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

bool check(vector<uint32> &p)
{
    uint32 l = p.size();
    for(uint32 i=0; i<l; i++){
        if(p[i] == i){
            return false;
        }
    }
    return true;
}
void func(void)
{
//DEBUG_OUT("----\n");
    uint32 N;
    cin >> N;

    vector<uint32> p(N);
    for(uint32 i=0; i<N; i++){
        uint32 tmp_p;
        cin >> tmp_p;
        p[i] = tmp_p - 1;
    }

    uint32 swapCnt = 0;
    while(check(p) == false){
        for(uint32 i=0; i<N-1; i++){
            if(i==p[i]){
                swap(p[i], p[i+1]);
                swapCnt++;
            }
        }
        if(p[N-1] == N-1){
            swap(p[N-1], p[N-2]);
            swapCnt++;
        }
    }

    cout << swapCnt << endl;
    
    return;
}



Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int a,b,m,x,y,c;cin>>a>>b>>m;
    vector<int> A(a);for(int i=0;i<a;i++)cin>>A[i];
    vector<int> B(b);for(int i=0;i<b;i++)cin>>B[i];
    int ans=*min_element(all(A))+*min_element(all(B));
    for(int i=0;i<m;i++){
        cin>>x>>y>>c;
        ans=min(ans,(A[x-1]+B[y-1]-c));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

public class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        int x, y, d , r;
        double f;
        try{
        	String[] list = br.readLine().split(" ");
        	x = Integer.parseInt(list[0]);
        	y = Integer.parseInt(list[1]);
        	
        	d = x / y;
        	r = x % y;
        	f = (double)x / (double)y;
        	DecimalFormat df = new DecimalFormat("0.00000");
            System.out.println(d + " " + r + " " + df.format(f));
        }
        catch(IOException e){
        	e.printStackTrace();
        }
	}

}

Measured memory_bytes: 26040
#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 < (n); ++i)
#define rep2(i, x, n) for(int i = x; i < (n); ++i)

int main()
{
    string s;
    cin >> s;
    int n = 0;
    rep(i, s.size()) {
        n += s[i] - '0';
        n %= 9;
    }
    if (n == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3708
#ITP1-ITP1_5_C
while True:
  h,w = (input().split())
  h = int(h)
  w = int(w)
  if h == 0 and w == 0:
    break
  for a in range(1,h+1):
    if a%2 == 1:
      print("#."*(w//2),"#"*(w%2),sep="")
    else:
      print(".#"*(w//2),"."*(w%2),sep="")
  print("")


Measured memory_bytes: 5624
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;

void bubble_sort(vector<string> &vec, int size);
void selection_sort(vector<string> &vec, int size);
void print_vector(vector<string> vec, int size);
bool is_same_vector(vector<string> vec1, vector<string> vec2);

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

    vector<string> vec(n);
    for (int i = 0; i < n; ++i)
        cin >> vec[i];

    vector<string> bubble_vec(vec);
    bubble_sort(bubble_vec, n);
    print_vector(bubble_vec, n);
    cout << "Stable\n";

    vector<string> selection_vec(vec);
    selection_sort(selection_vec, n);
    print_vector(selection_vec, n);
    if (is_same_vector(bubble_vec, selection_vec))
        cout << "Stable\n";
    else
        cout << "Not stable\n";
}

void bubble_sort(vector<string> &vec, int size)
{
    for (int i = 0; i < size; ++i) {
        bool flag = false;
        for (int j = size - 1; j > i; --j) {
            if (vec[j][1] < vec[j - 1][1]) {
                swap(vec[j], vec[j - 1]);
                flag = true;
            }
        }

        if (!flag)
            break;
    }
}

void selection_sort(vector<string> &vec, int size)
{
    for (int i = 0; i < size; ++i) {
        int min_index = i;

        for (int j = i + 1; j < size; ++j) {
            if (vec[j][1] < vec[min_index][1])
                min_index = j;
        }

        swap(vec[i], vec[min_index]);
    }
}

void print_vector(vector<string> vec, int size)
{
    cout << vec[0];
    for (int i = 1; i < size; ++i)
        cout << ' ' << vec[i];
    cout << '\n';
}

bool is_same_vector(vector<string> vec1, vector<string> vec2)
{
    if (vec1.size() != vec2.size())
        return false;

    for (int i = 0; i < vec1.size(); ++i) {
        if (vec1[i] != vec2[i])
            return false;
    }

    return true;
}



Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define endl '\n'  
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< int , int > mypair;
typedef priority_queue <int> max_heap;
typedef priority_queue <int, vector<int>, greater<int> > min_heap;
const ll mod=1e9+7;
const ll inf=1e9;
const ll N=1e5+10;


int main()
{
	boost;
	int n;
	cin>>n;
	cout<<ld(1)-ld(n/2)/ld(n)<<endl;
   	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>

using namespace std;

int main(void){
  int a;
  int i,j;
  vector<int> s;
  for(i = 6;i < 300000;i++){
    if(i%7==1 || i%7==6){
      a = 1;
      for(j = 0;j < s.size();j++){
	if(i%s[j] == 0){
	  a = 0;
	  break;
	}
	if(s[j]*s[j] > i) break;
      }
      if(a) s.push_back(i);
    }
  }
  while(true){
    cin >> a;
    if(a == 1) break;
    cout << a << ":";
    for(j = 0;j < s.size();j++){
      if(a%s[j] == 0) cout << " " << s[j];
    }
    cout << endl;
  }
}

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

const int N = 2e6;

int main() {
	clog << "Ready\n";
	
	int n;
	cin >> n;
	double sum = 0;
	
	for (int i = 1; i <= n; ++ i) {
		double x;
		cin >> x;
		string type;
		cin >> type;
		if (type == "JPY")
			sum += x;
		else
			sum += double(x * 380000);
	}
	
	cout << fixed << setprecision(8) << sum;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

int main() {

	long long  a, b; cin >> a >> b;

	long long  lo = 1, hi = 1e4, ans = -1;
	while (lo <= hi) {
		long long  x = lo + (hi - lo) / 2;
		int l = ((x * 8) / 100), r = (x / 10);

		if (l == a and r == b) ans = x, hi = x - 1;
		else if (l < a or r < b) lo = x + 1;
		else if (l > a or r > b) hi = x - 1;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3228
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#include <memory.h>

using namespace std;

typedef long long ll;

int a[20001];

void prt(int t){
  for(int i=1;i<=t;i++) cout << a[i] << " ";
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  int id = 1;
  for(int i=1;i<=30000;i++){
    if(i %2 == 0 || i %3 == 0){
      a[id] = i;
      id++;
    }
  }
  if(N == 3){
    cout << 2 << " " << 5 << " " << 63 << endl;
    return 0;
  }else if(N == 4){
    cout << 2 << " " << 5 << " " << 20 << " " << 63 << endl;
    return 0;
  }
  int t = (N /8) * 8;
  int m = N %8;
  if(m == 0){
    prt(t);
    cout << endl;
  }else if(m == 1){
    prt(t);
    cout << a[t+4] << endl;
  }else if(m == 2){
    prt(t);
    cout << a[t+1] << " " << a[t+3] << endl;
  }else if(m == 3){
    prt(t);
    cout << a[t+2] << " " << a[t+4] << " " << a[t+6] << endl;
  }else if(m == 4){
    prt(t);
    cout << a[t+2] << " " << a[t+4] << " " << a[t+6] << " "
    << a[t+8] << endl;
  }else if(m == 5){
    prt(t);
    cout << a[t+1] << " " << a[t+2] << " " << a[t+3] << " "
    << a[t+4] << " " << a[t+6] << endl;
  }else if(m == 6){
    prt(t);
    cout << a[t+1] << " " << a[t+2] << " " << a[t+3] << " "
    << a[t+5] << " " << a[t+6] << " " << a[t+7] << endl;
  }else if(m == 7){
    prt(t);
    cout << a[t+1] << " " << a[t+2] << " " << a[t+3] << " "
    << a[t+4] << " " << a[t+5] << " " << a[t+6] << " " << a[t+7] << endl;
  }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define positiverep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/
struct playerinfo{
  int64_t eattime;
  int64_t id;
};

int main(){
  double a,b,x;
  cin >> a >> b >> x;
  static const double pi = 3.141592653589793;
  if(x <= a*a*b/2){
    printf("%.12lf",atan((a*b*b)/(2*x))*360/(2*pi));
  }else{
    printf("%.12lf",atan(2*((a*a*b)-x)/(a*a*a))*360/(2*pi));
  }
}

Measured memory_bytes: 256
H,W=map(int,input().split());S=[input()for _ in range(H)];T=[""]*H
for i,l in enumerate(S):
 for j,c in enumerate(l):
  T[i]+=str(sum(S[i+p][j+q]=="#"for p in[-1,0,1]for q in[-1,0,1]if(0<=i+p<H)&(0<=j+q<W)))if c=="."else c
print("\n".join(T))

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

using namespace std;

int N;
long long mem[90];

long long Lucas(int a){
    if(mem[a]!=-1)return mem[a];
    if(a==0)return 2;
    else if(a==1)return 1;
    return mem[a]=Lucas(a-2)+Lucas(a-1);
}

int main(){
    cin >> N;
    for (int i=0;i<=N;i++)mem[i]=-1;
    cout << Lucas(N) << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/any.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto i:v)output(i);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define sum(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}

template<typename T>struct SEG{
    lint n=1;
    vector<T> node;
    T init;
    SEG(lint size,T _init){
        init=_init;
        while(n<size)n*=2;
        node.resize(n*2-1,init);
    }
    void update(lint x,T val){
        x+=(n-1);
        node[x]=val;
        while(x>0){
            x=(x-1)/2;
            node[x]=func(node[x*2+1],node[x*2+2]);
        }
    }
    T get(lint a,lint b,lint k=0,lint l=0,lint r=-1){
        if(r<0)r=n;
        if(r<=a||b<=l)return init;
        if(a<=l&&r<=b)return node[k];
        else{
            lint vl=get(a,b,k*2+1,l,(l+r)/2);
            lint vr=get(a,b,k*2+2,(l+r)/2,r);
            return func(vl,vr);
        }
    }
    T func(T s,T t){
        return min(s,t);
    }
};

int main(){
    lint n,q;
    cin>>n>>q;
    SEG<lint> seg=SEG<lint>(n,2147483647);
    rep(i,q){
        lint query;
        cin>>query;
        if(query==0){
            lint s,t;
            cin>>s>>t;
            seg.update(s,t);
        }else{
            lint s,t;
            cin>>s>>t;
            cout<<seg.get(s,t+1)<<endl;
        }
    }
}


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

using namespace std;

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

    int cnt[100] = {0};
    int same_cnt = 0;
    for(int i = 1; i <= n; ++i){
        int max = i;
        while(true){
            if(max/10 == 0) break;
            else {
                max = max/10;
            }
        }
        int min = i - i/10*10;
        ++cnt[max*10 + min];
    }

    int ans = 0;
    for(int i = 11; i <= 99; ++i){
        if(i%10 != 0){
            ans += cnt[i] * cnt[(i-i/10*10)*10 + i/10];
        }
    }
    
    cout << ans << endl;

    return 0;
}

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

int main(){
	int a,b; cin>>a>>b;
	if(a==b){cout<<"Draw"<<endl; return 0;}
	if(a==1){cout<<"Alice"<<endl; return 0;}
	if(b==1){cout<<"Bob"<<endl; return 0;}
	if(a>b) cout<<"Alice"<<endl;
	else if(a<b) cout<<"Bob"<<endl;
}

Measured memory_bytes: 3600