akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 1;										/* デバッグプリント 提出時は0 */

int dp[101][10001] = {0};

int main()
{
	int		N,W,v[101],w[101],i,j;
	//int		*dp;
	scanf("%d %d", &N, &W);
	for(i=1; i<=N; i++) {
		scanf("%d %d",&v[i],&w[i]);
	}

	//dp = calloc(101*10001, sizeof(int));

	for(i=1;i<=N;i++) {
		for(j=0;j<=W;j++) {
			if (j<w[i]) {
				dp[i][j] = dp[i-1][j];
			} else {
				dp[i][j] = max( dp[i-1][j] , dp[i-1][j-w[i]]+v[i]);
			}
		}
	}

	printf("%d\n",dp[N][W]);

	return 0;
}



Measured memory_bytes: 5644
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
 
    int A, B, C;
    cin >> A >> B >> C;
    int endA = min(A, B+C);
    int trans = endA - B;
    cout << C-trans << endl;
 
    return 0;
}

Measured memory_bytes: 256
x, k, d = gets.split(" ").map(&:to_i)

if x.abs >= k * d
  puts x.abs - (k * d)
  exit
end

before_0 = x / d 
# puts x - (before_0 * d)
# puts (x - (before_0 * d) - d)
# puts [(x - (before_0 * d)).abs, (x - (before_0 * d) - d).abs].min
# puts k - before_0
if (k - before_0) % 2 == 0
  puts (x - (before_0 * d)).abs
else (k - before_0) % 2 != 0
  puts  (x - (before_0 * d) - d).abs
end

Measured memory_bytes: 14296
//include,namespace
 #include<bits/stdc++.h>
 #include<iostream> 
 #include <queue>
 #include <vector>
 #include <string>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
#define pai 3.141592653589793

////////////////いろいろあるよ//////////////////////////////////
int main(){
	double S,L,H,M;
  cin >> S >> L >> H >> M;
  double karikaku = abs((30*H+30*M/60)-6*M);
  double kaku = min(karikaku,360-karikaku);
  cout << fixed << setprecision(20);
  cout << sqrt(abs(pow(S,2)+pow(L,2)-2*S*L*cos(kaku*(pai/180))))<< endl;

    
    
  
}

Measured memory_bytes: 4216
#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(x) x.begin(),x.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
const int maxn=500000+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
template <class T1, class T2>inline void gmax(T1 &a,T2 b){if (b>a) a=b;}
template <class T1, class T2>inline void gmin(T1 &a,T2 b){if (b<a) a=b;}
void up(int&x,int y){x+=y;if(x>=P)x-=P;}
/*ll x,y;
int main(){
    read(x),read(y);
    if (x<y) cout<<x<<endl;
    else{
        if (x%y==0) cout<<-1<<endl;
        else cout<<x<<endl;
    }
    return 0;
}*/
const int N=10000+10;
ll n,i,a[N],b[N],tga[N],tgb[N];
int main(){
    read(n);
    for (i=1;i<=n;i++) read(a[i]);
    for (i=1;i<=n;i++) read(b[i]);
    ll tmp=0;
    for (i=1;i<=n;i++){
        if (a[i]>b[i]) tmp+=(a[i]-b[i])*2;
    }
    for (i=1;i<=n;i++){
        if (a[i]<b[i]) tmp-=((b[i]-a[i])&1)?(b[i]-a[i]-1):(b[i]-a[i]);
    }
    puts(tmp<=0?"Yes":"No");
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>

int w[200000];
int n,k;

bool can(long long int x) {
    long long int load=0,count=1;
    for(int i=0; i<n; i++) {
        if(w[i]>x)
            return false;
        if(load+w[i]<=x)
            load+=w[i];
        else
            count++, load=w[i];
    }
    return count <= k;
}

int main(void) {
    scanf("%d%d",&n,&k);
    for(int i=0; i<n; i++)
        scanf("%d",&w[i]);

    long long int a=0, b=10000000000;
    while(b-a>1) {
        long long int m=(a+b)/2;
        if(can(m))
            b=m;
        else
            a=m;
    }
    printf("%lld\n", b);
    return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#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()
using namespace std;
typedef long long ll;
 
int main()
{
  int A, B;
  cin >> A >> B;

  string a = to_string(A);
  string b = to_string(B);
  string c = a + b;
  int d = stoi(c);
  double e = sqrt(d);
  if(floor(e) == e){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
 
typedef long long ll;
 
ll a[100005];
ll b[100005];
ll sumA[100005];
ll sumB[100005];
 
ll ma(ll a, ll b);
 
int main() {
 
	int N, K;
 
	scanf("%d %d",&N,&K);
 
	int i;
 
	ll s = 0ll;
	for (i = 0; i < N; i++) {
		scanf(" %lld",&a[i]);
		b[i] = ma(0ll,a[i]);
		s += a[i];
		sumA[i] = s;
	}
 
	s = 0ll;
	for (i = 0; i < N; i++) {
		s += b[i];
		sumB[i] = s;
	}
 
 
	int l = 0;
	int r = K-1;
 
	ll ans = 0ll;
 
	while (1) {
		if (r >= N) { break; }
		ll S = sumA[r];
		if (l != 0) { S -= sumA[l - 1]; }
		S = ma(S, 0ll);
		if (l == 0) {
			ll add = sumB[N - 1] - sumB[K - 1];
			S += add;
		}
		else if (r == N - 1) {
			ll add = sumB[l - 1];
			S += add;
		}
		else {
			ll add1 = sumB[l - 1];
			ll add2 = sumB[N - 1] - sumB[r];
			S += add1 + add2;
		}
		if (S > ans) { ans = S; }
		l++;
		r++;
	}
	printf("%lld\n",ans);
 
	return 0;
}
ll ma(ll a, ll b) {
	if (a >= b) { return a; }
	else { return b; }
}

Measured memory_bytes: 3328
def main():

    M = int(input())

    ans = 0
    a = 0
    b = 0
    for i in range(M):
        d, c = map(int, input().split())
        a += c
        b += c * d
    v = b + a * 9

    if v % 9 == 0:
        return v // 9 - 2
    else:
        return v // 9 - 1

if __name__ == '__main__':
    print(main())

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

using namespace std;

int main()
{
  int a, b, c;
  int min, max;
  int tmp;

  cin >> a >> b >> c;

  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }
  if(b>c){
    tmp = b;
    b = c;
    c = tmp;
  }
  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }

  cout << a << " " << c << endl;
  return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;

using namespace std;

int main() {
	int n;
	cin >> n;
	int k;
	cin >> k;
	set<int> abd;
	ff(i, 0, k) {
		int a;
		cin >> a;
		abd.insert(a);
	}
	i64 ans = n;
	int go = 0;
	while (1) {
		int a = ans;
		while (1) {
			if (a == 0) {
				go++;
				break;
			}
			int b = a % 10;
			if (abd.count(b))break;
			a /= 10;
		}
		if (go)break;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }

  mint ans = mint(0);
  mint t = mint(2);
  combination nCr = combination(N);
  mint s = mint(8);

  for (ll i = 1; i <= N; i++) {
    // cout << t.pow(i).x - 2 << endl;
    ans = ans + (t.pow(i) - 2) * nCr(N, i) * s.pow(N-i);
  }

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


Measured memory_bytes: 18696
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,ll,ll> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> P;
int n;
ll m;
int primecount[105];
int dp[105][80];
void primeget(int num)
{
  for(int i=2;i*i<=num;i++)
    {
      int cnt=0;
      if(num%i==0)
	{
	  while(num%i==0)
	    {
	      cnt++;
	      num/=i;
	    }
	}
      primecount[i]+=cnt;
    }
  if(num>1)
    {
      primecount[num]++;
    }
}
int main(void)
{
  memset(primecount,0,sizeof(primecount));
  memset(dp,0,sizeof(dp));
  dp[0][1]=1;
  cin >> n;
  for(int i=2;i<=n;i++)
    {
      primeget(i);
    }
  for(int i=0;i<=100;i++)
    {
      primecount[i]++;
    }
  /*for(int i=0;i<=100;i++)
    {
      cout << primecount[i] << ' ';
      if(i%10==0) cout << endl;
      }*/
  for(int i=0;i<=100;i++)
    {
      for(int k=0;k<=75;k++)
	{
	  for(int j=0;j<primecount[i];j++)
	    {
	      if(k*(j+1)<=75)
		{
		  dp[i+1][k*(j+1)]+=dp[i][k];
		}
	    }
	}
    }
  cout << dp[100][75] << endl;
  return 0;
}



Measured memory_bytes: 256
S = input()
Q = int(input())
f = True
l = []
r = []
for _ in range(Q):
    q = input()
    if q == "1":
        f = not f
    else:
        _, F, C = q.split()
        if F == "1":
            t = l if f else r
            t.append(C)
        else:
            t = r if f else l
            t.append(C)
if f:
    l.reverse()
    ans = "".join(l) + S + "".join(r)
else:
    r.reverse()
    ans = "".join(r) + S[::-1] + "".join(l)
print(ans)

Measured memory_bytes: 5736
N = int(input())
A = [int(input()) for _ in range(N)]

x = 1
c = {x}
count = 1
while True:
    if A[x-1] == 2:
        print(count)
        break
    if A[x-1] in c:
        print(-1)
        break
    x = A[x-1]
    c.add(x)
    count += 1


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

int main(int argc, char const *argv[])
{
	int h,n;
	cin>>h>>n;
	int a[n],b[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i];
	}
	int dp[100005];
	for (int i = 0; i < h+5; ++i)
	{
		dp[i]=200000000;
	}
	dp[0]=0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j <= a[i]; ++j)
		{
			dp[j]=min(dp[j],b[i]);
		}
	}
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (i+a[j]<=h)
			{
				dp[i+a[j]]=min(dp[i+a[j]],dp[i]+b[j]);
			}
		}
	}
	cout<<dp[h]<<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)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int N, K;
    cin >> N >> K;
    if(N % K == 0) cout << "0" <<endl;
    else cout << "1" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,i,j;
	int n[250];
	while(~scanf("%d%d",&a,&b)&&a>=2)
	{
		c=0;
		for(i=0;i<a;i++)
		{
		n[i]=b++;
		c+=n[i];
			
		}
		if(n[0]<0&&n[a-1]>0)
		printf("%d\n",c);
		else if(n[0]==0||n[a-1]==0)
		printf("%d\n",c);
		else
		{
			if(n[0]<0&&n[a-1]<0)
			printf("%d\n",c-n[a-1]);
			else
			printf("%d\n",c-n[0]);
		}
	
	}
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

constexpr int MAXN = 100005;
int n;
int mod;
int dp[2][MAXN];
vi tree[MAXN];

int sum(int a, int b) {
    int c = a + b;
    if (c >= mod)
        c -= mod;
    return c;
}

int prod(int a, int b) {
    return 1LL * a * b % mod;
}

void dfs_down(int u, int p = -1) {
    dp[0][u] = 1;
    for (int v : tree[u]) {
        if (v == p)
            continue;

        dfs_down(v, u);
        dp[0][u] = prod(dp[0][u], sum(1, dp[0][v]));
    }
}

void dfs_up(int u, int p = -1) {
    vi children;
    for (int v : tree[u]) {
        if (v == p) continue;
        children.push_back(v);
    }

    // dp[1][u] = 1 + dp[1][p[u]] * (1 + dp[0][v]) where v is a sibling of u
    int deg = children.size();
    vi prefs(deg), suffs(deg);
    for (int i = 0; i < deg; ++i) {
        int v = children[i];
        suffs[i] = prefs[i] = sum(1, dp[0][v]);
    }

    for (int i = 1; i < deg; ++i) {
        prefs[i] = prod(prefs[i - 1], prefs[i]);
    }
    for (int i = deg - 2; i >= 0; --i) {
        suffs[i] = prod(suffs[i + 1], suffs[i]);
    }

    for (int i = 0; i < deg; ++i) {
        int v = children[i];
        dp[1][v] = 1;
        if (i > 0) {
            dp[1][v] = prod(dp[1][v], prefs[i - 1]);
        }
        if (i + 1 < deg) {
            dp[1][v] = prod(dp[1][v], suffs[i + 1]);
        }

        dp[1][v] = prod(dp[1][v], dp[1][u]);
        dp[1][v] = sum(dp[1][v], 1);
        dfs_up(v, u);
    }
}

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

    cin >> n >> mod;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        tree[u].push_back(v);
        tree[v].push_back(u);
    }

    // dp[0][u] = ways to make tree rooted at u, only going down
    // dp[1][u] = ways to make tree with u as leaf
    //
    // dp[u] = dp[0][u] * dp[1][u] - 1
    dfs_down(0);
    dp[1][0] = 1;
    dfs_up(0);

    for (int u = 0; u < n; ++u) {
        int ans = prod(dp[0][u], dp[1][u]);
        cout << ans << '\n';
    }

    return 0;
}

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

#define PII pair < int , int >
const int _ = 3e5 + 7;
int sum[_] , N , M; PII segt[_];
namespace BIT{
#define lowbit(x) (x & -x)
	int arr[_];
	void add(int x , int val){while(x <= M){arr[x] += val; x += lowbit(x);}}
	int qry(int x){int sum = 0; while(x){sum += arr[x]; x -= lowbit(x);} return sum;}
}using namespace BIT;

int main(){
	ios::sync_with_stdio(0); cin >> N >> M;
	for(int i = 1 ; i <= N ; ++i) cin >> segt[i].first >> segt[i].second;
	sort(segt + 1 , segt + N + 1); int pos = 1; priority_queue < PII > q;
	for(int i = 1 ; i <= M ; ++i){
		while(!q.empty() && q.top().first == -i){add(q.top().second , -1); q.pop();}
		while(pos <= N && segt[pos].first == i){add(i , 1); q.push(PII(-segt[pos++].second - 1 , i));}
		for(int j = 1 ; j * j <= i ; ++j)
			if(!(i % j)){sum[j] += qry(i) - qry(i - j); if(j != i / j) sum[i / j] += qry(i) - qry(i - i / j);}
	}
	for(int i = 1 ; i <= M ; ++i) cout << sum[i] << endl;
	return 0;
}

Measured memory_bytes: 8816
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1<<30
const int mod = 1e9+7;

int main(){
    ll n; cin >> n;
    vl ans;
    if(n==3){
        puts("2 5 63");
        return 0;
    }
    if(n<=15000){
        if(n%3==0){
            rep(i,4) ans.push_back(i*6+3);
            REP(i,1,n-3) ans.push_back(i*2);
        }else{
            ans.push_back(3); ans.push_back(9);
            REP(i,1,n-1) ans.push_back(i*2);
        }
    }else{
        if(n%2==0){
            REP(i,1,15001) ans.push_back(i*2);
            rep(i,n-15000) ans.push_back(i*6+3);
        }else{
            REP(i,1,15000) ans.push_back(i*2);
            rep(i,n-14999) ans.push_back(i*6+3);
        }
    }
    for(auto i : ans) cout << i << " ";
    cout << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        int first = -1, last = -2;
        for (int i = 0; i < input.length(); i++) {
            if(input.charAt(i) == 'A'){
                first = i;
                break;
            }
        }
        for(int i = input.length() - 1; i >= 0; i--){
            if(input.charAt(i) == 'Z'){
                last = i;
                break;
            }
        }
        System.out.println(last - first + 1);
    }
}

Measured memory_bytes: 26500
S = input()

## 後ろの桁から処理したいので配列を逆転する
S = S[::-1]

## 累積和の配列
cs = [0] * (len(S) + 1)

## 桁
d = 1

for i in range(len(S)):
  ## i+1桁目の2019で割った余り
  m = (int(S[i]) * d) % 2019

  ## 累積和を求める
  ## 同じあまりの数が知りたいので、こちらも2019で割った余りを保存する
  cs[i+1] = (cs[i] + m) % 2019

  ## 次の位へ
  d *= 10

  ## 位が大きくなるのでこれも余りをとっておく
  d %= 2019


res = 0
c = [0] * 2019

## 同じあまりの値がいくつあるか数える
for n in cs:
  c[n] += 1

## 同じ値あまりの数を重複なく２つ選ぶ場合の数の合計が答え
for n in c:
  # nC2
  res += n * (n - 1) // 2


print(res)




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

int main() {
    int N; cin>>N;
    vector<int>odd(100010,0);
    vector<int>even(100010,0);
    int od=0,ev=0;
    rep(i,N){
        int t; cin>>t;
        if(i%2==0){
            odd[t]++;
            if(odd[t]>odd[od])od=t;
        }
        else {
            even[t]++;
            if(even[t]>even[ev])ev=t;
        }
    }
    sort(odd.begin(),odd.end());
    reverse(odd.begin(),odd.end());
    sort(even.begin(),even.end());
    reverse(even.begin(),even.end());
    if(od==ev){
        cout<<N-max(even[0]+odd[1],even[1]+odd[0])<<endl;
    }
    else cout<<N-even[0]-odd[0]<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
template <typename T = int>
T in() {
    T temp;
    cin >> temp;
    return temp;
}


int main() {
    int N(in()), M(in());
    map<int, int> drink;
   
    for (int i = 0; i < N; i++) {
        int A, B;
        cin >> A >> B;
        if (drink.find(A) == drink.cend()) drink[A] = 0;
        drink[A] += B;
    }

    uint64_t credit = 0;
    do {
        auto target = drink.begin();             
        int var = min(M, target->second);
        M -= var;
        target->second -= var;
        credit += (uint64_t)var * target->first;
        drink.erase(target);
    } while (M > 0);

    cout << credit << endl;
    return 0;
}




Measured memory_bytes: 4992
#include <iostream>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    int n;
    cin >> n;
    int l = 0, r = n;
    while(r-l > 1) {
        int m = (r+l)/2;
        if(m*1.08 < n) l = m;
        else r = m;
    }
    double p = r * 1.08;
    if(p >= n && p < n+1) cout << r << endl;
    else cout << ":(" << endl;

    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
ll s;
cin >> s;
ll x=(1000000000LL-s%1000000000LL)%1000000000LL;
ll y=(s+x)/1000000000LL;

cout << "0 0 1000000000 1 " << x <<" "<< y << endl;
}


Measured memory_bytes: 256
#import
#import math
#import numpy as np
N = int(input())
#= input()
#= map(int, input().split())
c = list(map(str, input()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= [int(input()) for _ in range(N)]
#= {i:[] for i in range(N)}

whitec = c.count("W")

res = 0

for i in range(N - whitec, N):
    if c[i] == "R":
        res += 1

print(res)

Measured memory_bytes: 10724
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout << '\n';
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << (#x) << "=" << x << "]" << '\n';
#define deb2(x,y) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "]" << '\n';
#define deb3(x,y,z) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "] [" << (#z) << "=" << z << "]" << '\n';

void solve(){
  int n; cin>>n;
  int cnt=0;
  for(int i=1 ; i<n ; i++){
    cnt+=(n-1)/i;
  }
  cout<<cnt;LOL
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int _ = 1; //cin >> _;
  for(int i = 1 ; i <= _ ; i++){
    //cout << "Case #" << i << ": ";
    solve();
  }
  return 0;
}

Measured memory_bytes: 3648
import Data.List
import Data.Maybe

main :: IO ()
main = do
    _ <- getLine
    s <- getLine
    let le = scanl (\a c -> if c == 'E' then a+1 else a) 0 s
        rw = scanr (\c a -> if c == 'W' then a+1 else a) 0 s
        z = zipWith (+) le rw
        p = fromJust $ elemIndex (maximum z) z
        (pl,pr) = splitAt p s
        count f = length . filter f
    print $ count (=='W') pl + count (=='E') pr


Measured memory_bytes: 81276
#include<bits/stdc++.h>
using namespace std;
#define MAXN	2005
#define INF	1e9
#define P	1000000007
int cnt, a[MAXN];
void work(long long n) {
	if (n == 1) {
		cnt = 0;
		return;
	}
	if (n % 2 == 0) {
		work(n / 2);
		cnt++; a[cnt] = cnt;
	} else {
		work(n - 1);
		for (int i = cnt; i >= 1; i--)
			a[i + 1] = a[i];
		a[1] = ++cnt;
	}
}
int main() {
	long long n; cin >> n; n++;
	work(n);
	cout << cnt * 2 << endl;
	for (int i = 1; i <= cnt; i++)
		cout << a[i] << ' ';
	for (int i = 1; i < cnt; i++)
		cout << i << ' ';
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
	int h, w;
	char s[50][51];
	int num[50][50];

	scanf("%d %d", &h, &w);

	int x, y;
	for(x=0;x<w;x++) {
		for(y=0;y<h;y++) {
			num[y][x] = 0;
		}
	}

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

	for(y=0;y<h;y++) {
		for(x=0;x<w;x++) {
			if(s[y][x] == '#') {
				if(y > 0) {
					if(x > 0) num[y-1][x-1] += 1;
					num[y-1][x] += 1;
					if(x < w-1) num[y-1][x+1] += 1;
				}
				if(x > 0) num[y][x-1] += 1;
				if(x < w-1) num[y][x+1] += 1;
				if(y < h-1) {
					if(x > 0) num[y+1][x-1] += 1;
					num[y+1][x] += 1;
					if(x < w-1) num[y+1][x+1] += 1;
				}
			}
		}
	}
	for(y=0;y<h;y++) {
		for(x=0;x<w;x++) {
			if(s[y][x] != '#') {
				s[y][x] = (char)(num[y][x] + '0');
			}
		}
		printf("%s\n", s[y]);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

        bool flag = false;
        for (int i = A; i <= B; i++) {
                if (i % K == 0)
                        flag = true;
        }

        if (flag) {
                cout << "OK" << endl;
        }
        else {
                cout << "NG" << endl;
        }

        return 0;
}

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

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

  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  }
  else if (S == "Cloudy") {
    cout << "Rainy" << endl;
  }
  else cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
cnt = [0] * 61
for i in a:
    for j in range(61):
        if i >> j & 1:
            cnt[j] += 1

ans = 0
for i in range(61):
    ans += pow(2, i, mod) * ((n - cnt[i]) * cnt[i])
    ans %= mod
print(ans)

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

uint getResult(const vector<uint> &A, const vector<uint> &B, const uint N){
  uint maxIndex = 0;
  for(uint i = 1; i < N; i++){
    if(A[maxIndex] < A[i]) maxIndex = i;
  }
  return A[maxIndex] + B[maxIndex];
}

int main(){
  uint N;
  cin >> N;
  
  vector<uint> A(N), B(N);
  for(uint i = 0; i < N; i++){
    cin >> A[i] >> B[i];
  }
  
  uint result = getResult(A, B, N);
  
  cout << result;
  return 0;
}

Measured memory_bytes: 4048
#include <cstdio>
using namespace std;

typedef long long Int;

int main(){
	const int AIM = 1000000;
	int n;
	int num, per, sum;
	bool exist;
	bool comp[4001];
	Int pro[4001];
	
	while(true){
		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 1; i <= 4000; i++){
			comp[i] = false;
			pro[i] = 0;
		}
		exist = false;
		for(int i = 0; i < n; i++){
			scanf("%d%d%d", &num, &per, &sum);
			if(comp[num]) continue;
			if(pro[num] + (Int)per * sum >= AIM){
				exist = true;
				comp[num] = true;
				printf("%d\n", num);
			}
			else{
				pro[num] += (Int)per * sum;
			}
		}
		if(!exist) printf("NA\n");
	}
	
	return 0;
}

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

class Cube
{
  public:
	  int f[6];
	  Cube (){}
	  void roll_z()
	  {
		  roll(1, 2, 4, 3);
	  }
	  void roll_y()
	  {
		  roll(0, 2, 5, 3);
	  }
	  void roll_x()
	  {
		  roll(0, 1, 5, 4);
	  }
	  void roll(int i, int j, int k, int l)
	  {
		  int t = f[i];
		  f[i] = f[j];
		  f[j] = f[k];
		  f[k] = f[l];
		  f[l] = t;
	  }
	  void move( char ch )
	  {
		  if ( ch == 'E')
		  {
			  for ( int i = 0; i < 3; i++)
			  {
				  roll_y();
			  }
		  }
		  else if ( ch == 'W')
		  {
			  roll_y();
		  }
		  else if ( ch == 'N')
		  {
			  roll_x();
		  }
		  else if ( ch == 'S')
		  {
			  for ( int i = 0; i < 3; i++)
			  {
				  roll_x();
			  }
		  }
	  }
};


int main()
{
    Cube c;
	string com;
	
	for ( int i = 0; i < 6; i++ )
	{
		cin >> c.f[i];
	}
	cin >> com;

	for ( int i = 0; i < com.size(); i++ )
	{
		c.move(com[i]);
	}
	cout << c.f[0] << endl;

	return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

int main(){
    
    int a;
    cin >> a;
    for(int i=1;i<=9;i++){
        if(a%i==0&&a/i<=9){
            cout << "Yes"<<endl;
            return 0;
        }
    }
    cout << "No"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long N,M;cin >> N >> M;
    long long ans = 0;
    if(N*2 <= M){
        ans += N;
        M -= N*2;
        N = 0;
    }
    else{
        ans += M/2;
        M -= ans*2;
    }
    ans += M/4;
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  int n;
  cin >> n;
  vector<pair<int, pair<int, int>>> x(n);


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

  int X, Y, th;
  int H = -1, ok;
  for (int i = 0; i <= 100; i++){
    for (int j = 0; j <= 100; j++){
      H = -1;
      ok = 1;
      for (int k = n - 1; k >= 0; k--){
        if (x[k].first > 0){
          if (H == -1){
            H = abs(x[k].second.first - i) + abs(x[k].second.second - j) + x[k].first;
          }
          else {
            if (H != abs(x[k].second.first - i) + abs(x[k].second.second - j) + x[k].first)
              ok = 0;
          }
        }
        else {
          if (H > abs(x[k].second.first - i) + abs(x[k].second.second - j))
            ok = 0;
        }
      }
      if (ok){
        X = i;
        Y = j;
        th = H;
        break;
      }
    }
  }


  cout << X << " " << Y << " " << th << endl;




  return 0;
}

ll gcd(ll a, ll b){
  if (a < b)
    return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String args[]){
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            int num = Integer.parseInt(br.readLine());
            System.out.println(num * num * num);

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


Measured memory_bytes: 24396
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;

  sort(s.begin(), s.end());
  if (s.at(0) == s.at(1) && s.at(1) != s.at(2) && s.at(2) == s.at(3)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var n, k int

	firstArg := nextLine()
	nSlice := strings.Split(firstArg, " ")

	n, _ = strconv.Atoi(nSlice[0])
	k, _ = strconv.Atoi(nSlice[1])

	fmt.Print(n * k)
}

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

bool stringcmp(string s, string t) {
	int N = min(s.size(), t.size());
	for (int i = 0; i < N; ++i) {
		if (s[i] == t[i]) {
			continue;
		}
		return s[i] < t[i];
	}
	return (s.size() < t.size());
}

signed main() {
	int n;
	cin >> n;
	int taro = 0, hana = 0;
	for (int i = 0; i < n; ++i) {
		string s, t;
		cin >> s >> t;
		if (s == t) {
			taro++; hana++;
		}
		else if (stringcmp(s, t)) {
			hana += 3;
		}
		else {
			taro += 3;
		}
	}
	cout << taro << ' ' << hana << endl;
}



Measured memory_bytes: 3140
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <iomanip>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N;
    cin >> N;
    auto a = InputVec(N);
    vector<ll> count(N+1);
    ll tot = 0;
    for (int i = N; i >= 1; --i) {
        ll tmp = i*2;
        ll tmpCount = 0;
        while(tmp <= N){
            tmpCount += count[tmp];
            tmp += i;
        }
        if(tmpCount % 2 != a[i-1]){
            count[i]++;
            tot++;
        }
    }
    cout << tot << endl;
    for (int i = 1; i < N+1; ++i) {
        if(count[i] != 0)
        cout << i << " ";
    }
}


Measured memory_bytes: 3968
#include <stdio.h>
#include <stdio.h>

int main(void)
{
    int n, i, j, a[6];
    double x;
 
    for (i = 0; i < 6; i++)
        a[i] = 0;
 
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%lf", &x);
        if (x < 165.0)
            a[0]++;
        else if (x < 170)
            a[1]++;
        else if (x < 175)
            a[2]++;
        else if (x < 180)
            a[3]++;
        else if (x < 185)
            a[4]++;
        else
            a[5]++;
    }
    for (i = 0; i < 6; i++)
    {
        printf("%d:", i+1);
        for (j = 0; j < a[i]; j++)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> w(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i].second >> w[i].first;
    }
    sort(w.begin(), w.end());
    ll sum = 0;
    string ans = "Yes";
    for (int i = 0; i < n; i++) {
        sum += w[i].second;
        if (sum > w[i].first) {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6424
import java.util.*;
public class Main{
  public static void main(String[] args){
  	Scanner scn = new Scanner(System.in);
	    int n = scn.nextInt();
	    scn.nextLine();
	    String []arr = new String[n];
	    Map<String,Integer> map = new HashMap<String,Integer>();
	    for(int i=0;i<n;i++){
	      arr[i] = scn.nextLine();
	      if(map.containsKey(arr[i]))
	    	  map.put(arr[i], map.get(arr[i])+1);
	      else
	    	  map.put(arr[i],1);
	    }
	    int count = 0;
	    for(String s:map.keySet())
	    	count++;
	    System.out.println(count);
  }
}


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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define mxn 100005
using namespace std;

int solve(ll n)
{
//    FLASH
  //  ll n;
    //cin >> n;
    ll k = 0,i = 1;
    string s;
    int len = 0;
    while(k < n){
        i *= 26;
        k += (i);
        len++;
    }
    if(k == n){
        while(len-- > 0)
            cout << 'z';
        cout << '\n' ;
        return 0;
    }
    k -= i;
    i /= 26;
    n = n - k;
    while(n > 0 && i > 0){
        int c = n / i;
        if(n % i == 0)
            c--;
        char h = (char)(c + 'a');
        s.pb(h);
        n = n % i;
        i /= 26;
        len--;
    }
    while(len-- > 0)
        s.pb('z');
    cout << s << '\n';
    return 0;
}
int main()
{
    ll t ;
    cin >> t;
    solve(t);
    
    return 0;
}


Measured memory_bytes: 3624
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

struct IntL {
    long long pos;
    long long s;
    long long t;
};

bool comp_intl(const IntL &a, const IntL &b) {
    return a.pos < b.pos;
}

int main() {

    int N;
    cin >> N;

    vector<IntL> vx;
    vector<IntL> vy;

    for (int i = 0; i < N; i++) {
        long long x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1 == x2) {
            IntL intL = {x1, min(y1, y2), max(y1, y2)};
            vy.push_back(intL);
        }
        if (y1 == y2) {
            IntL intL = {y1, min(x1, x2), max(x1, x2)};
            vx.push_back(intL);
        }
    }

    sort(vy.begin(), vy.end(), comp_intl);

    long long ans = 0;
    for (auto li: vx) {
        long long left = li.s;
        long long right = li.t;
        long long posY = li.pos;
        auto s1 = lower_bound(vy.begin(), vy.end(), (IntL) {left, LONG_LONG_MIN, LONG_LONG_MIN}, comp_intl);
        auto s2 = upper_bound(vy.begin(), vy.end(), (IntL) {right, LONG_LONG_MIN, LONG_LONG_MIN}, comp_intl);
        for (auto i = s1; i != s2; i++) {
            if (i->s <= posY && posY <= i->t) ans++;
        }
    }

    cout << ans << endl;

}














































Measured memory_bytes: 6012
#include <iostream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>

#define rep(i,n)	for(int i = 0;i < n;i++)
#define rep2(i,n)	for(int i = 1;i <= n;i++)
#define each(i,x)	for(auto & i : x)

struct edge
{
	edge(int _s,int _t,int _cost)
	{
		s = _s;t = _t;cost = _cost;
	}
	int s;
	int t;
	int cost;
};

using namespace std;

int main()
{
	int c,n,m,s,d;
	cin >> c >> n >> m >> s >> d;
	while(c || n || m || s || d)
	{
		s--;d--;
		vector<list<edge>> town(n);
		vector<edge> eary;
		rep(i,m)
		{
			int a,b,f;
			cin >> a >> b >> f;
			a--;b--;
			town[a].push_back(edge(a,b,f));
			town[b].push_back(edge(b,a,f));
			eary.push_back(edge(a,b,f));
		}
		vector<vector<int>> cost(c+1,vector<int>(n,2000000));
		cost[0][s] = 0;
		bool flg;
		do
		{
			flg = false;
			each(e,eary)
			{
				rep(i,c+1)
				{
					if(cost[i][e.s] > cost[i][e.t] + e.cost)
					{
						cost[i][e.s] = cost[i][e.t] + e.cost;
						flg = true;
					}
					else if(cost[i][e.t] > cost[i][e.s] + e.cost)
					{
						cost[i][e.t] = cost[i][e.s] + e.cost;
						flg = true;
					}
				}
				rep(i,c)
				{
					if(cost[i+1][e.s] > cost[i][e.t] + e.cost/2)
					{
						cost[i+1][e.s] = cost[i][e.t] + e.cost/2;
						flg = true;
					}
					if(cost[i+1][e.t] > cost[i][e.s] + e.cost/2)
					{
						cost[i+1][e.t] = cost[i][e.s] + e.cost/2;
						flg = true;
					}
				}
			}
		}while(flg);
		int min = 10000000;
		rep(i,c+1)
		{
			if(cost[i][d] < min)
			{
				min = cost[i][d];
			}
		}
		cout << min << endl;
		cin >> c >> n >> m >> s >> d;
	}
	return 0;
}

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

int main(){
	long long n, d;
	cin>>n>>d;
	int ans=0;
	for(int i=1;i<=n;i++){
		long long x,y;
		cin>>x>>y;
		if((x*x+y*y)<=d*d){
			ans++;
		}
	}
	cout<<ans<<endl;
}


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

int main(){
    int n;
    cin >> n;
    int A[n+10];
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    
    for(int k = 0; k < n; k++){
            cout << A[k];
            if(k != n-1) cout << " ";
            else cout << endl;
        }
    for(int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
            A[j+1]=v;
        }
        for(int k = 0; k < n; k++){
                cout << A[k];
                if(k != n-1) cout << " ";
                else cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3112
/****************************
** In the name of Allah    **
** Author: Farhad          **
** From  : IIT,JU          **
*****************************/
#include<bits/stdc++.h>
using namespace std;
bool check_pal(int x)
{
    int num2=x,num=0;
    while(x>0)
    {
        num = num*10 + x%10;
        x/=10;
    }
    //cout<<num<<" "<<num2<<endl;
    if(num==num2) return true;
    return false;
}
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,ans=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(check_pal(i)==true) ans++;
    }

    cout<<ans<<endl;

    return 0;
}



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


int main(void){
  int N;
  cin >> N;
  vector<int> P(N), Q(N), a(N);
  for(int i = 0; i < N; i++){
    cin >> P[i];
    a[i] = i + 1;
  }
  for(int i = 0; i < N; i++) cin >> Q[i];
  map<vector<int>, int> mp;
  while(next_permutation(a.begin(), a.end())){
   mp[a] = mp.size();
  }
  cout << abs(mp[P] - mp[Q]);
  
  return 0;
}

Measured memory_bytes: 5248
#include<iostream>
using namespace std;
int main(){
  int a,b;cin>>a>>b;
  if(a==b)cout<<"Draw";
    else if(a!=1&&b!=1){
      if(a>b)cout<<"Alice";
      else cout<<"Bob";
    }else{
      if(a>b)cout<<"Bob";
      else cout<<"Alice";
      }
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	long long i;
	int j;
	for(i=0; i<(1 << n); i++)
	{
		int cnt = 0;
		for(j=0; j<n; j++)
		{
			if(i & (1 << j)) cnt++;
		}
		if(cnt == m)
		{
			cout << i << ":";
			for(j=0; j<n; j++)
			{
				if((1 << j) & i) cout << " " << j;
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3104