akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	static final int INF=1<<28;
	static final double EPS=1e-9;

	int n, s;
	int[][] sum;

	void run(){
		n=10;
		s=330;
		init();
		for(; sc.hasNext();){
			n=sc.nextInt();
			s=sc.nextInt();
			if(n<=10&&s<=330){
				println(sum[n-1][s]+"");
			}else{
				println("0");
			}
		}
		sc.close();
	}

	void init(){
		int[][] dp=new int[s+1][1<<10];
		int[][] dp2=new int[s+1][1<<10];
		sum=new int[n][s+1];
		dp[0][0]=1;

		for(int j=0; j<n; j++){
			for(int i=0; i<=s; i++){
				System.arraycopy(dp[i], 0, dp2[i], 0, 1<<10);
				Arrays.fill(dp[i], 0);
			}
			for(int i=0; i<10; i++){
				int d=(j+1)*i;
				for(int b=0; b<1<<10; b++){
					if(((1<<i)&b)==0){
						for(int k=0; k+d<=s; k++){
							dp[k+d][(1<<i)|b]+=dp2[k][b];
						}
					}
				}
			}
			for(int i=0; i<=s; i++){
				for(int b=0; b<1<<10; b++){
					sum[j][i]+=dp[i][b];
				}
			}
		}
	}

	int rec(int sum, int flag, int k){
		if(sum>s){
			return 0;
		}
		if(k==n){
			if(sum==s){
				return 1;
			}else{
				return 0;
			}
		}
		int ret=0;
		for(int i=0; i<10; i++){
			if(((1<<i)&flag)==0){
				ret+=rec(sum+(k+1)*i, (1<<i)|flag, k+1);
			}
		}
		return ret;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

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

#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-funroll-loops")
#pragma GCC target("avx,sse4")

#define mms(a,n) memset(a,0,sizeof((a)[0])*(n))
#define mmp(a,b,n) memcpy(a,b,sizeof((b)[0])*(n))
#define lowbit(x) ((x)&-(x))
#define pb push_back
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define fo(i,l,r) for(register int i=l,_lim_=r;i<=_lim_;i++)
#define fd(i,r,l) for(register int i=r,_lim_=l;i>=_lim_;i--)
#define fos(i,l,r,d) for(register int i=l,_lim_=r;i<=r;i+=d)
#define fol(i,l,r) for(register ll i=l,_lim_=r;i<=_lim_;i++)
#define fdl(i,r,l) for(register ll i=r,_lim_=l;i>=_lim_;i--)
#define fosl(i,l,r,d) for(register ll i=l,_lim_=r;i<=r;i+=d)
#define Clear(a) memset(a,0,sizeof(a))
#define Copy(a,b) memcpy(a,b,sizeof(b))
#define ALL(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ldb;
typedef double db;
typedef pair<int,int> pi;
template<class T>inline void vnique(vector<T> &r){sort(ALL(r));auto t=unique(ALL(r));r.erase(t,r.end());}

const int N=65,M=1000005,P=1e9+7,dx[]={-1,1,0,0},dy[]={0,0,-1,1};

int n,m,K,a,x[N],y[N],lx,ly,cnt[N][N],s1[M],s2[M],dis[N][N],ql,qr;
bool fb[N][N],mark1[M],mark2[M];
vector<int>px,py;
pi qu[N*N];

void bfs(int x,int y){
	fo(i,0,lx)fo(j,0,ly)dis[i][j]=N<<1;
	dis[x][y]=0;qu[ql=qr=1]={x,y};
	while(ql<=qr){
		int u=qu[ql].fi,v=qu[ql].se;ql++;
		fo(i,0,3){
			int tu=u+dx[i],tv=v+dy[i];
			if(tu>lx||tv>ly||tu<0||tv<0||dis[tu][tv]<=dis[u][v]+1||fb[tu][tv])continue;
			dis[tu][tv]=dis[u][v]+1;qu[++qr]={tu,tv};
		}
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&K);
	px.pb(1);px.pb(n+1);py.pb(1);py.pb(m+1); 
	fo(i,1,n)s1[i]=m;fo(i,1,m)s2[i]=n;
	fo(i,1,K){
		scanf("%d%d",&x[i],&y[i]);
		x[i]++,px.pb(x[i]),px.pb(x[i]+1);
		y[i]++,py.pb(y[i]),py.pb(y[i]+1);
		s1[x[i]]--;mark1[x[i]]=true;
		s2[y[i]]--;mark2[y[i]]=true;
	}
	fo(i,1,n)(s1[i]+=s1[i-1])%=P;fo(i,1,m)(s2[i]+=s2[i-1])%=P;
	fo(i,1,n-1)if(!mark1[i]&&!mark1[i+1])a=(a+(ll)2*s1[i]*(s1[n]-s1[i]))%P;
	fo(i,1,m-1)if(!mark2[i]&&!mark2[i+1])a=(a+(ll)2*s2[i]*(s2[m]-s2[i]))%P;
	vnique(px);vnique(py);lx=SZ(px)-2;ly=SZ(py)-2;
	fo(i,1,K)fb[lower_bound(ALL(px),x[i])-px.begin()][lower_bound(ALL(py),y[i])-py.begin()]=true;
	fo(i,0,lx)fo(j,0,ly)cnt[i][j]=(ll)(px[i+1]-px[i])*(py[j+1]-py[j])%P;
	fo(i,0,lx)fo(j,0,ly)if(!fb[i][j]){
		bfs(i,j);
		fo(k,0,lx)fo(t,0,ly)if(!fb[k][t])a=(a+(ll)cnt[i][j]*dis[k][t]%P*cnt[k][t])%P;
	}
	if(a<0)a+=P;a=(ll)a*(P/2+1)%P;
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)1e9+7)
#define MAX ((ull)1e9)

int main(){
	int n;
	cin >> n;
	double d[n+1][n+1];	//d[i][j]=i枚目のコインまで投げて表がj枚となる確率
	for(int i=0; i<n+1; i++) d[0][i]=1.0;

	for(int i=1; i<=n; i++){
		double p;
		cin >> p;
		d[i][0]=(1.0-p)*d[i-1][0];
		for(int j=1; j<i; j++){
			d[i][j]=p*d[i-1][j-1]+(1.0-p)*d[i-1][j];
		}
		d[i][i]=p*d[i-1][i-1];
	}

	double ans=0.0;
	for(int i=(n+1)/2; i<=n; i++){
		ans+=d[n][i];
	}
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 70528
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  char s[16], in[128];
  int N, res = 0;
  scanf("%s", s);
  scanf("%d", &N);
  rep(i, N){
    scanf("%s", in);
    rep(j, strlen(in)){
      int f = 1;
      rep(k, strlen(s)) if(in[(j+k)%strlen(in)] != s[k]) f = 0;
      if(f){
	res++;
	break;
      }
    }
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 1188
import sys
import itertools
import numpy as np
import networkx as nx

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1')

A = []
B = []
E = []

for i, j in itertools.product(range(N), range(M)):
    if S[i, j] == '#':
        continue
    elif (i + j) & 1:
        A.append((i, j))
    else:
        B.append((i, j))

for i, j in A:
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        i1, j1 = i + dx, j + dy
        if 0 <= i1 < N and 0 <= j1 < M and S[i1, j1] != '#':
            E.append(((i, j), (i1, j1)))

G = nx.Graph()
G.add_nodes_from(A, bipartite=0)
G.add_nodes_from(B, bipartite=1)
G.add_edges_from(E)

M = nx.bipartite.maximum_matching(G, A)
for key, item in M.items():
    i, j = key
    i1, j1 = item
    if i1 == i + 1:
        a, b = 'v', '^'
    elif i1 == i - 1:
        a, b = '^', 'v'
    elif j1 == j + 1:
        a, b = '>', '<'
    else:
        a, b = '<', '>'
    S[i, j], S[i1, j1] = a, b

print(len(M) // 2)
for row in S:
    print(''.join(row))

Measured memory_bytes: 69656
#include <iostream> 
#include <cstdio> 
#include <fstream> 
#include <algorithm> 
#include <cmath> 
#include <deque> 
#include <vector> 
#include <queue> 
#include <string> 
#include <cstring> 
#include <map> 
#include <stack> 
#include <set> 
typedef  long long ll;
const int  maxn =110000;
using namespace std;
ll n, m;
ll a[maxn];
int main()
{
	ll ans = 0;
	cin >> n;
	for (ll i = 1; i <= n + 1; i++)
	{
		scanf("%lld", &a[i]);
	}
	for (ll i = 1; i <= n; i++)
	{
		scanf("%lld", &m);
		ans += min(a[i], m);
		if (m > a[i])
		{
			ll t = min(a[i + 1], m - a[i]);
			ans += t;
			a[i + 1] -= t;
		}
	}
	printf("%lld", ans);
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct R{
	string L;
	int P,A,B,C,D,E,F,S,M;
	int SUM;int SY;
	double W;
};

int main(){

	int N;
	while(1){   
		cin>>N;if(N==0)break;

		struct R R1[51]={};

		for(int i=0;i<N;i++)
			{cin>>R1[i].L>>R1[i].P>>R1[i].A>>R1[i].B>>R1[i].C>>R1[i].D>>R1[i].E>>R1[i].F>>R1[i].S>>R1[i].M;
		R1[i].SUM=R1[i].S*R1[i].F*R1[i].M-R1[i].P;
		R1[i].SY=R1[i].A+R1[i].B+R1[i].C+(R1[i].D+R1[i].E)*R1[i].M;
		R1[i].W=(double)R1[i].SUM/R1[i].SY;
		}

		for(int i=0;i<N;i++)
			for(int j=N-1;j>i;j--)
				if(R1[j].W>R1[j-1].W){struct R RT=R1[j];R1[j]=R1[j-1];R1[j-1]=RT;}


		for(int i=0;i<N;i++)
			for(int j=N-1;j>i;j--)
				if(R1[j].W==R1[j-1].W&&R1[j].L<R1[j-1].L){struct R RT=R1[j];R1[j]=R1[j-1];R1[j-1]=RT;}


		for(int i=0;i<N;i++)
			cout<<R1[i].L<<endl;//<<R1[i].SUM<<R1[i].SY<<R1[i].W<<endl;

		cout<<"#"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdio.h>

using namespace std;

struct point {
	double x;
	double y;
};

struct circle {
	point center;
	double radius;
};

struct line { // ax + by + c = 0
	double a;
	double b;
	double c;
};

std::istream& operator >> (std::istream& is, point& p)
{
	is >> p.x >> p.y;
	return is;
}

bool operator == (const point& p1, const point& p2)
{
	return p1.x == p2.x && p1.y == p2.y;
}

double get_distance(const point& p1, const point& p2)
{
	return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}

bool get_crosspoint(const line& l1, const line& l2, point *result)
{
	double denominator = l1.a * l2.b - l1.b * l2.a;
	if (denominator == 0) {
		return false;
	}
	result->x = (l1.b * l2.c - l2.b * l1.c) / denominator;
	result->y = (l2.a * l1.c - l1.a * l2.c) / denominator;
	return true;
}

bool get_bisector(const point& p1, const point& p2, line *result)
{
	if (p1 == p2) {
		return false;
	}
	result->a = 2 * (p1.x - p2.x);
	result->b = 2 * (p1.y - p2.y);
	result->c = -(p1.y - p2.y) * (p1.y + p2.y) - (p1.x - p2.x) * (p1.x + p2.x);
	return true;
}

bool get_circum_circle(const point& p1, const point& p2, const point& p3, circle *result)
{
	double a = get_distance(p1, p2);
	double b = get_distance(p2, p3);
	double c = get_distance(p3, p1);

	// 半径の公式
	result->radius = a * b * c / sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));

	line line_p1p2;
	line line_p2p3;

	// 頂点の垂直2等分線の交点が外心
	return get_bisector(p1, p2, &line_p1p2) &&
		   get_bisector(p2, p3, &line_p2p3) &&
		   get_crosspoint(line_p1p2, line_p2p3, &result->center);
}

circle get_circum_circle(istream& is)
{
	point p1, p2, p3;
	circle result;
	is >> p1 >> p2 >> p3;

	get_circum_circle(p1, p2, p3, &result);
	return result;
}

int main(void)
{
	int n;

	std::cin >> n;

	while (n--) {
		circle c = get_circum_circle(std::cin);
		printf("%.3f %.3f %.3f\n", c.center.x, c.center.y, c.radius);
	}
	return 0;
}


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

int main() {
  string S; cin >> S;
  int payment = 700;
  for (int i = 0; i<3; i++) {
    if (S.at(i) == 'o') {
      payment += 100;
    }
  }
  cout << payment << endl;
}



Measured memory_bytes: 256
n=int(input());t,x,y,r1,r2=[],[],[],0,0
for _ in range(n):
  a,b,c=map(int,input().split())
  t.append(a);x.append(b),y.append(c)
for i in range(n):
  r1,r2=[[t[0],x[0]+y[0]],[t[i]-t[i-1],abs(x[i]-x[i-1])+abs(y[i]-y[i-1])]][i!=0]
  if not (r1>=r2 and r1%2==r2%2): print('No');break
else:
  print('Yes')

Measured memory_bytes: 17632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

ll a,v;
ll b,w;
cin >> a >> v;
cin >> b >> w;
ll t;
cin >> t;

if(w >= v) {
    cout << "NO" << endl;
    return 0;
}

ll c = abs(a-b);
ll u = abs(v-w);

if(c <= u*t) {
    cout << "YES" << endl;
} else {
    cout << "NO" << endl;
}

return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    cout << (a + b) % 24 << endl;
    
    
}


Measured memory_bytes: 256
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc137_a.cpp
 * time   : Sat May  2 01:42:16 2020
 * quest  : A - +-x
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << max(a + b, max(a - b, a * b)) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, a, b; cin >> n >> a >> b;
    vi x(n, 0);
    ll sum = 0;
    rep(i, n){
        cin >> x[i];
        if(i > 0) sum += (a*(x[i]-x[i-1]) > b) ? b : a*(x[i]-x[i-1]);
    }
    cout << sum << endl;
}

Measured memory_bytes: 1024
n=int(input())
a=list(map(int,input().split()))
b=[(a[i],i)for i in range(n)]
b.sort(reverse=1)
dp=[(n+1)*[0]for _ in range(n+1)]
for i in range(1,n+1):
  p,j=b[i-1]
  if j<i-1:break
  dp[i][0]+=dp[i-1][0]+p*(j-(i-1))
for i in range(1,n+1):
  p,j=b[i-1]
  if j>(n-i):break
  dp[0][i]+=dp[0][i-1]+p*((n-i)-j)
for i in range(1,n):
  for j in range(1,n):
    if i+j>n:break
    p,k=b[i+j-1]
    if (i-1)<=k:
      dp[i][j]=max(dp[i][j],dp[i-1][j]+p*(k-(i-1)))
    if k<=(n-j):
      dp[i][j]=max(dp[i][j],dp[i][j-1]+p*((n-j)-k))
ans=0
for i in range(n+1):ans=max(ans,dp[i][n-i])
print(ans)

Measured memory_bytes: 100196
#include<cstdio>
int main()
{
	int a,b,c,t;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF)
	{
	
		if(a<b)
		{
			t=a;
			a=b;
			b=t;
		}
		if(a<c)
		{
			t=a;
			a=c;
			c=t;
		}
		if(a==b+c)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n";
#define ll long long

const ll MOD = 1e9 + 7;

ll update_number(ll a) {
    if(a%10!=0) {
        a += 10 - a%10;
    }
    return a;
}

int main() {
    vector<ll> input,first_num;
    ll tmp;
    REP(i,5) {
        cin >> tmp;
        input.push_back(update_number(tmp));
        first_num.push_back(tmp%10);
    }
    //0以外での最小値を探す
    int min = 1e4;
    REP(i, 5) {
        if(first_num[i]!=0 && min > first_num[i]) min = first_num[i];
    }
    min = (min!=1e4 && min!=0)?10-min:0;
    int ans = 0;
    REP(i, 5) ans += input[i];
    OUT(ans-min);
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple{
    private int N;
    private double[] t, v;
    void Solve(){
        //input
        N = io.Int;
        t = new double[N + 2];
        v = new double[N + 2];
        for(int i = 0; i < N; ++i) t[i + 1] = io.Double;
        for(int i = 0; i < N; ++i) v[i + 1] = io.Double;
        //cal
        var start = new double[N + 2];
        var time = 0D;
        for(int i = 0; i < N + 2; ++i){
            start[i] = time;
            time += t[i];            
        }
        var pre = 0D;
        var cur = 0D;
        var ans = 0D;
        var tmp = new double[N + 2];
        for(int i = 0; i < time * 2; ++i){
            pre = cur;
            var cTime = i / 2D;
            for(int j = 0; j < N + 2; ++j){
                if(cTime < start[j])  tmp[j] = v[j] +start[j]-cTime; 
                else if(start[j] <= cTime && cTime <= start[j] + t[j]) tmp[j] = v[j];
                else tmp[j] = v[j] + cTime - (start[j] + t[j]);                                                                     
            }
            cur = tmp.Min();
            ans += (pre + cur) * 0.5 / 2;
        }
        pre = cur;
        cur = 0;
        ans += (pre + cur) * 0.5 / 2;
        //ret
        Console.WriteLine(ans);       
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream(){
        Solve();
        io.writeFlush();
    }
}
class SimpleIO{
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[]{' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
    public SimpleIO(){
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next(){
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


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

namespace _166_c_2
{
    internal class Peaks
    {
        private static void Main(string[] args)
        {
            var nm = Console.ReadLine()?.Split(" ").Select(int.Parse).ToArray();
            if (nm == null) return;
            var n = nm[0];
            var m = nm[1];

            var h = Console.ReadLine()?.Split(" ").Select(int.Parse).ToArray();
            if (h == null) return;

            // 隣り合うPeakではない山をカウントし、全体から減算する
            var notPeak = new Dictionary<int, int>();
            for (var i = 0; i < m; i++)
            {
                var ab = Console.ReadLine()?.Split(" ").Select(int.Parse).ToArray();
                if (ab == null) return;
                var a = ab[0] - 1;
                var b = ab[1] - 1;

                if (h[a] < h[b])
                {
                    notPeak[a] = 1;
                }
                else if (h[a] > h[b])
                {
                    notPeak[b] = 1;
                }
                else
                {
                    notPeak[a] = 1;
                    notPeak[b] = 1;
                }
            }

            var peaks = n - notPeak.Count;
            Console.WriteLine(peaks);
        }
    }
}

Measured memory_bytes: 55660
#include <iostream>

int main(){
	using namespace std;
	int n,i;
	double w;
	cin >> n ;
	int a[n];
	for (i = 0; i < n; i++) {
		cin >> a[n];
		w += 1.0 / a[n];
	}
	cout << 1.0 / w  << endl;

	return 0;
}

Measured memory_bytes: 256
a = 700
b = input("").count('o')
     
if b == 3:
  c = a + 300
  print(c)
      
elif b == 2:
  d = a + 200
  print(d)
      
elif b == 1:
  e = a + 100
  print(e)
 
else:
  print(a)

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

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

int main() {
  ll n, k;
  cin >> n >> k;

  if(k == 0){
    cout << n*n << endl;
    return 0;
  }

  ll ans = 0;
  for(ll i = k+1; i <= n; ++i){
    ans += (n / i) * (i - k);
    ans += max((ll)0, n % i - k + 1);
  }
  cout << ans << endl;
  return 0;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

template<typename T>
vector<T> smallest_prime_factors(T n) {

    vector<T> spf(n + 1);
    for (int i = 0; i <= n; i++) spf[i] = i;


    for (T i = 2; i * i <= n; i++) {

        // 素数だったら
        if (spf[i] == i) {

            for (T j = i * i; j <= n; j += i) {

                // iを持つ整数かつまだ素数が決まっていないなら
                if (spf[j] == j) {
                    spf[j] = i;
                }
            }
        }
    }

    return spf;
}

int main(){
    int n; cin >> n;
    vector<ll> lis(n);
    REP(i, 0, n){scanf("%lld", &lis[i]);}
    ll setwise = lis[0];
    REP(i, 1, n){
        setwise = gcd(setwise, lis[i]);
    }
    int f = 1;
    auto spf  = smallest_prime_factors(2 * 1e6);
    map<ll, int>mp;
    vector<int> flag(2 * 1e6, 0);
    REP(i, 0, n){
        ll cp = lis[i];
        while(cp != 1){
            int k = spf[cp];
            while(cp % k == 0){
                cp /= k;
            }
            flag[k]++;
            if(flag[k] != 1){
                f = 0;
            }
        }
    }
    if(f == 1){
        cout << "pairwise coprime" << endl;
    }else if(setwise == 1){
        cout << "setwise coprime" << endl;
    }else{
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 34340
#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;
typedef long long ll;
typedef pair<int,int> pii;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,  //less_equal
             tree_order_statistics_node_update> oset; 
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int MAXK = 2e3 + 2;
#define sz(x) (int)(x).size()
#define f first




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

int n;
cin >> n;
double x;
long double dem = 0.0;
for(int i = 0 ; i < n ; i++)
 {
 	cin >> x;
 	dem+=(1.0/x);
 }
 dem=1.0/dem;
 cout << fixed << setprecision(5) << dem << '\n';


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int Ans=0;
    int a[105];
    cin >> N;
    REP(i,N){cin >> a[i];}
    sort(a,a+N,greater<int>());
    REP(i,N){
        if(i%2==0){
            Ans+=a[i];
        }else{
            Ans-=a[i];
        }
    }
    cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MIN / 2 + 1;
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll m = 1 + n % 2;
    vector<vector<ll>> dp(n + 1, vector<ll>(m + 2, inf));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, m + 1) {
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
            ll v = dp[i][j];
            if ((i + j) % 2 == 0) v += a[i];
            dp[i + 1][j] = max(dp[i + 1][j], v);
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Pow(ll A, ll N){
  if (N == 0) return 1;
  if (N % 2 == 0) return Pow(A * A % MOD, N / 2);
  else return A * Pow(A * A % MOD, N / 2) % MOD;
}

int K;
string S;
ll N, Five[int(1e6+5)], Six[int(1e6+5)];

int main(){
  cin >> K >> S;
  N = S.length();
  Five[0] = 1;
  for (int i = 1; i <= K; i++){
    Five[i] = Five[i-1] * 25 % MOD;
  }
  Six[0] = 1;
  for (int i = 1; i <= K; i++){
    Six[i] = Six[i-1] * 26 % MOD;
  }

  ll ans = 0, nCr = 1;
  for (int i = 0; i <= K; i++){
    ll now = Five[i] * Six[K - i] % MOD;
    now *= nCr; now %= MOD;
    ans += now; ans %= MOD;

    nCr *= N + i; nCr %= MOD;
    nCr *= Pow(i + 1, MOD - 2); nCr %= MOD;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
        int N,K,i,j,ans = 1;
        cin >> N >> K;
        while(ans <= K && N!=0){
                ans *= 2;
                N--;
                //cout << ans << endl;
        }
        while(N!=0){
                ans+=K;
                N--;
                //cout << ans << endl;
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256
num_input=list(map(int,input().split()))

a=num_input[0]
b=num_input[1]
c=num_input[2]
yakusu_count=0

for i in range(a,b+1):
    if c%i==0:
        yakusu_count=yakusu_count+1

print(yakusu_count)



Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int n;
vector< pair<int, int> > input;

int dfs(int* p) {
  int t = input[*p].first + 1;
  char e = (char) input[*p].second;
  int ans = e == '+' ? 0 : e == '*' ? 1 : e;
  for((*p)++; input[*p].first >= t && *p < n;) if(e == '+') ans += dfs(p); else ans *= dfs(p);
  return ans;
}

int main(void) {
  while(cin >> n, n != 0) {
    input.clear();
    REP(i, 0, n) {
      string line; cin >> line;
      int level = 0;
      for(; line[level] == '.'; level++);
      input.push_back(pair<int, int>(level, line[level] == '+' || line[level] == '*' ? line[level] : line[level] - '0'));
    }
    int i = 0;
    cout << dfs(&i) << endl;
  }
  return 0;
}

Measured memory_bytes: 3044
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (int argc, char const *argv[])
{
    int64_t N, M, K, A;
    int64_t like[30] = {0}, ans = 0;

    scanf("%"PRId64"%"PRId64, &N, &M);
    for (int i = 0; i < N; i++) {
        scanf("%"PRId64, &K);
        for (int j = 0; j < K; j++) {
            scanf("%"PRId64, &A);
            like[A - 1]++;
        }
    }

    for (int i = 0; i < M; i++) {
        if (like[i] == N) ans++;
    }

    printf("%"PRId64"\n", ans);

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a = n;
  int f = 0;
  
  while(n > 0){
    f += n % 10;
    n /= 10;
  }
  
  if(a % f == 0){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> x(n);
    for(int i = 0 ; i < n ; i += 1){
        cin >> x[i].first;
        x[i].second = i+1;
    }
    sort(x.begin(),x.end());
    for(int i = 0 ; i < n ; i += 1){
        cout << x[i].second << " ";
    }
}

Measured memory_bytes: 1536
n=int(input())
f=['' for _ in range(n)]
p=[[] for _ in range(n)]
for i in range(n):
  f[i]=int(''.join(input().split()),2)
for i in range(n):
  p[i]=list(map(int,input().split()))
ans=-10**9
for i in range(1,1024):
  tmp=0
  for j in range(n):
    k=str(format(i&f[j],'010b')).count('1')
    tmp+=p[j][k]
  ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

ll as[200000+10];
ll cs[200000+10];


int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    scanf("%lld", &as[i]);
    cs[i+1] = cs[i] + as[i];
  }
  ll res = 1e18;
  REP(i, n-1) {
    ll left = cs[i+1];
    ll right = cs[n] - left;
    ll cost = abs(right - left);
    res = min(res, cost);
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 3328
module Main where

import           Control.Monad
import           Data.List
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector as V

main :: IO ()
main = do
  n <- getLine
  x <- getLine
  let red = (length . filter (== 'R')) x
      blue = length x - red
  putStrLn
    $ if red > blue
      then "Yes"
      else "No"

Measured memory_bytes: 380
#include <bits/stdc++.h>
#define ll uint64_t
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <set <int> >
#define REP(a, b, step) for (int a = 0; a < b; a += step)
#define inf 1000000000
 
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    int n, l;
    cin >> n >> l;
    string arr[n];
    REP(i, n, 1) {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    REP(i, n, 1) {
        cout << arr[i];
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(){
	int i,j,last,base;
	int N,Q,L;
	int x[100001];
	int b[100001];
	int ans[100001];
	int c[100001];
	int d[100001];
	int jumb1000[100001];
		
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		scanf("%d",&x[i]);
	}
	
	scanf("%d",&L);
	i=1;j=1;
	for(;i<=N;){
		for(;j<=N;){
			if((x[j]-x[i]<=L)){
				last = j;
				j++;
				
			}else{
				b[i]=last;
				i++;
			}
		}
		if(last==N){
			b[i]=last;
			i++;
		}
	}
	
	for(i=1;i<=N;i++){
		
		base = i;
		for(j=1;j<101;j++){
			if(b[base]<N&&base<N){
				base=b[base];
			}
			else{
				jumb1000[i] =N+1;
				break;
			}
		}
		if(jumb1000[i] !=N+1 )
			jumb1000[i] =base;
	}
	
	scanf("%d",&Q);
	for(i=1;i<=Q;i++){
		scanf("%d",&c[i]);
		scanf("%d",&d[i]);
	}
	for(i=1;i<=Q;i++){

		if(c[i]>d[i]){
			j=c[i];c[i]=d[i];d[i]=j;
		}

		if(L==1){
			ans[i]=d[i]-c[i];continue;
		}
		
		j=1;
		
		while(b[c[i]]<d[i]){
			
			if(jumb1000[c[i]]<d[i]){
				j+=100;c[i]=jumb1000[c[i]];
				continue;
			}
			c[i]=b[c[i]];
			j++;
		}
		ans[i]=j;
	}
	for(i=1;i<=Q;i++){
		printf("%d\n",ans[i]);
	}
	return 0;
}

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

class Cmondai
{
    static void Main()
    {
        var nk = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var N = nk[0];
        var K = nk[1];
        var A = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var ans = 1;
        if ((N - K) % (K - 1) != 0) ans++;
        ans+=(N-K) / (K - 1);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 19936
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;



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

	for(ll h = 1; h <= 3500; h++){
		for(ll n = 1; n <= 3500; n++){
			if((4*h*n - N*n - N*h)>=1){
				if((N*n*h)%(4*h*n - N*n - N*h)==0){
					//printf("b\n");
					ll w = (N*n*h)/(4*h*n - N*n - N*h);
					cout << h << " " << n << " " << w << endl;
					return 0;
				}else{
					ll w = (N*n*h)/(4*h*n - N*n - N*h);
					//printf("h,n,w : %d,%d,%d\n",h,n,w);
				}
			}
		}
	}

	return 0;

}


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

int main()
{
    int n; cin>>n;
    vector<vector<int>> a(n);
    for(auto& v: a) {
        vector<int> t(n);
        for(int& e: t) cin>>e;
        v=t;
    }

    auto b=a;
    for(int k=0; k<n; ++k)
        for(int i=0; i<n; ++i)
            for(int j=0; j<n; ++j) {
                if (a[i][j]>a[i][k]+a[k][j]) return cout<<"-1\n", 0;
                if (j!=k && j!=i && a[k][i]==a[k][j]+a[j][i]) b[k][i]=0;
            }
    long res=0;
    for(auto& v: b) for(auto& e: v) res+=e;
    cout<<res/2<<endl;
}

Measured memory_bytes: 1024
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()
if n == 0:
    print("0")
    exit()
ans = ""
while n:
    r = n % -2
    n = n // -2
    if r == -1:
        n += 1
        r += 2
    if r:
        ans = "1" + ans
    else:
        ans = "0" + ans

        
print(ans)

Measured memory_bytes: 81420
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N,K,Q;
    cin >> N >> K >> Q;
    vector<int> a(N);
    rep(i,N)cin >> a[i];
    int ans = inf;
    for(int i=0;i<N;i++){
        // 最小値をa[i]とする
        // a[i]未満の数値は候補から外れるので a[i]未満で区切る
        vector<int> v;
        vector<vector<int>> g;
        map<int,int> mp;
        // 数の候補をmapに入れていく
        for(int j=0;j<N;j++){
            if(a[j]<a[i]){
                sort(ALL(v));
                if(v.size()>=K){
                    for(int i=0;i<=v.size()-K;i++){
                        mp[v[i]]++;
                    }
                }
                v.clear();
            }else if(a[j]>=a[i]){
                v.push_back(a[j]);
            }
        }
        if(v.size()>=K){
            sort(ALL(v));
            for(int i=0;i<=v.size()-K;i++){
                mp[v[i]]++;
            }
            v.clear();
        }        
        int cnt = 0;
        int now = 0;
        for(auto &x:mp){
            if(cnt>=Q)break;
            while(x.second){
                cnt++;
                x.second--;
                now = x.first;
            }
        }
        if(cnt>=Q)ans = min(abs(a[i]-now),ans);
    }
    cout << ans << endl;
}

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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


signed main(){

	string n;
	cin >> n;

	for (int i = 0; i < n.length(); i++){
		if (n[i] == '1') cout << 9;
		else if (n[i] == '9') cout << 1;
		else cout << n[i];
		
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 764
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) { stderr.writeln(arg); }
int size(T)(in T s) { return cast(int)s.length; }

void main() {
    int N; readf("%d\n", &N);
    auto S = readln.chomp;
    int k = 0;
    char[] ans;
    char[] buf;
    for (int i = 0; i < N; i++) {
        char c = S[i];
        ans ~= c;
        if (c == '(') {
            k--;
        } else if (c == ')') {
            if (k >= 0) {
                ans = '(' ~ ans;
            } else {
                k++;
            }
        } else {
            assert(false);
        }
    }
    if (k < 0) {
        k = -k;
        foreach (j; 0 .. k) { ans ~= ')'; }
    }
    writeln(ans);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(H>=y+r&&W>=x+r&&r<=x&&r<=y)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<cstring>
#include<stdlib.h>
using namespace std;



class CPriorityQueue{
	
public:
	CPriorityQueue();
	bool Insert(int key);
	bool Extract(void);
	int countOrder;							//何個目の命令かカウントする
	static const int ORDER_MAX = 2000000;	//命令数のMAX
	const int KEY_MAX = 2000000000;			//要素の最大値
	const int KEY_MIN = 0;					//要素の最小値
	
private:
	int queue[ORDER_MAX];			//Queue
	int indexQueue;					//Queueに格納されているデータ数
};


CPriorityQueue::CPriorityQueue() : countOrder(0), indexQueue(0){
	
	memset(queue, 0, sizeof(&queue[0]));
}


/*
-------------------------------------
関数名：Insert
	in     : 入力"insert"の後につづく要素
	return : bool型
-------------------------------------
*/
bool CPriorityQueue::Insert(int key){
	
	//要素の制約をCheckする
	if((KEY_MIN > key) || (key > KEY_MAX)){
		return false;
	}
	
	//keyを末尾に追加
	queue[indexQueue] = key;
	
	//keyが親ノードより大きければ入れ替える
	int indexParentQueue = (indexQueue - 1) / 2;
	int i = indexQueue;
	while(i != 0){
		if(queue[i] > queue[indexParentQueue]){
			swap(queue[i], queue[indexParentQueue]);
			i = indexParentQueue;
			if(i == 2){
				indexParentQueue = 0;
			}
			else{
				indexParentQueue = (i - 1) / 2;
			}
		}
		else{
			break;
		}
	}
	indexQueue++;
	
	return true;
}


/*
-------------------------------------
extract()
	in     : なし
	return : bool型
-------------------------------------
*/
bool CPriorityQueue::Extract(void){
	
	//Queueにデータが格納されていなければERROR
	if(indexQueue == 0){
		return false;
	}
	
	
	//Queueの先頭を表示
	cout << queue[0] << endl;
	
	
	//Queueの末尾と先頭を入れ替える
	indexQueue--;
	queue[0] = queue[indexQueue];
	
	
	//Queueの先頭と子ノードを比較し、子ノードのほうが値が小さければ入れ替える
	int indexParentQueue = 0;
	while(1){
		if(indexQueue <= ((2 * indexParentQueue) + 1)){
			//子ノードがない
			break;
		}
		else if((indexQueue <= (2 * (indexParentQueue + 1))) ||
				(queue[(2 * indexParentQueue) + 1] > queue[2 * (indexParentQueue + 1)])){
			//子ノードが1つ または 左の子ノードの方が大きい
			if(queue[(2 * indexParentQueue) + 1] > queue[indexParentQueue]){
				swap(queue[(2 * indexParentQueue) + 1], queue[indexParentQueue]);
				indexParentQueue = (2 * indexParentQueue) + 1;
			}
			else{
				//子ノードより親ノードの方が大きい
				break;
			}
		}
		else{
			//右の子ノードの方が大きい
			if(queue[2 * (indexParentQueue + 1)] > queue[indexParentQueue]){
				swap(queue[2 * (indexParentQueue + 1)], queue[indexParentQueue]);
				indexParentQueue = 2 * (indexParentQueue + 1);
			}
			else{
				//子ノードより親ノードの方が大きい
				break;
			}
		}
		
		
	}
	
	return true;
}


int main(){
	
	CPriorityQueue priorityQueue;
	string str;
	char num[11];
	int key = 0;						//insertで挿入する要素
	
	while(priorityQueue.countOrder <= priorityQueue.ORDER_MAX){
		cin >> str;
		priorityQueue.countOrder++;
		
		if(str == "end"){
			break;
		}
		else if(str.compare(0, 6, "insert") == 0){
			//insertに続く要素を取得
			cin >> num;
			key = atoi(num);
			
			if(priorityQueue.Insert(key) == false){
				return -1;
			}
		}
		else if(str.compare(0, 7, "extract") == 0){
			if(priorityQueue.Extract() == false){
				return -1;
			}
		}
		else{
			//ここに入ることはない
		}
	}
	
	return 0;
}





Measured memory_bytes: 6976
#include <bits/stdc++.h>
#define maxn 200005
#define MOD 1000000007
#define INF 10000000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

void solve(){
    string s;
    cin >> s;
    if(s[3] == s[2] && s[4] == s[5]) cout << "Yes\n";
    else cout << "No\n";
}

int main()
{
    fast();
    int t= 1;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
answer = 0
pf     = {}
m=int(input())
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:
  pf[m]=1

for i, j in pf.items():
  temp = j
  for k in range(1, j+1):
    temp   -= k
    if temp < 0:
      break
    else:
      answer += 1
      
print(answer)

Measured memory_bytes: 9468
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	fmt.Scan(&n)

	s := strings.Split(n,"")

	if s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=2e4+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;
const ll C = 30000;

int a[MAXn],b[MAXn];
int p[MAXn];
bool vis[MAXn];
int main(){
    IOS();
    int n;
    cin >> n;
    for (int i=1;i<=n;++i) {
        cin >> p[i];
        a[i] = C * i;
        b[i] = C * (n-i+1);
    }
    for (int i=1;i<=n;++i) {
        b[p[i]] += i;
    }
    for (int i=1;i<=n;++i) {
        cout << a[i] << " \n"[i==n];
    }
    for (int i=1;i<=n;++i) {
        cout << b[i] << " \n"[i==n];
    }
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<58;
const ll mod=1e9+7;


int main(){
  int i,j;
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c<=21) cout<<"win"<<endl;
  else cout<<"bust"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
//AtCoder ABC080 C - Shopping Street
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> ff(N);
    for(auto&& f:ff){ //bitにして
        ll v=0;
        for(int i=0;i<10;++i){
            v<<=1;
            ll fin;
            cin>>fin;
            v+=fin;
        }
        f=v;
    }
    vector<vector<ll>> ptbl(N,vector<ll>(11));
    for(auto&& pt:ptbl){
        for(auto&& p:pt){
            cin>>p;
        }
    }
    //全探索
    ll end=1<<10;
    ll ans=INT64_MIN;
    for(ll i=1;i<end;++i){ //0は不可
        ll gain=0;
        for(ll j=0;j<ff.size();++j){
            ll msk = (ff[j] & i);
            //bitをカウント
            auto num = __builtin_popcountll(msk);
            gain += ptbl[j][num];
        }
        ans=max(ans,gain);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

G = [[0] * W for _ in range(H)]

h = 0
w = 0
w_flag = True #右向き

for index, a in enumerate(A):
    count = 0
    while count < a:
        count += 1
        G[h][w] = index + 1
        if w_flag:
            if w == W - 1:
                h += 1
                w_flag = False
            else:
                w += 1
        else:
            if w == 0:
                h += 1
                w_flag = True
            else:
                w -= 1



for tmp in G:
    print (*tmp, sep = ' ')

Measured memory_bytes: 3920
import sys
input = sys.stdin.readline
n, h = map(int, input().split())
ab = []
for i in range(n):
  a, b = map(int, input().split())
  ab.append((-a, b, i))
  
ab.sort()
index = ab[0][2]
ai = -ab[0][0]
bi = ab[0][1]

ab2 = ab[:]
ab2.sort(key = lambda x:x[1], reverse = True)

cnt = 0

for a, b, i in ab2:
    if i == index:
        continue
    if b < ai:
        break
    if h <= bi:
        print(cnt+1)
        sys.exit()
    h -= b
    cnt += 1
    if h <= 0:
        print(cnt)
        sys.exit()


print(cnt + 1 +  max(0, h - bi + ai - 1) // ai)

Measured memory_bytes: 23116
n=int(input())
l=list(map(int,input().split()))
print(" ".join(map(str,l)))
for i in range(1,n):
    v=l[i]
    j=i-1
    while j>=0 and l[j]>v:
        l[j+1]=l[j]
        j-=1
    l[j+1]=v
    print(" ".join(map(str,l)))


Measured memory_bytes: 5596