akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

ans = 1
for i in range(1, N+1):
	ans = (ans*i)%mod

print(ans)

Measured memory_bytes: 22548
#include <stdio.h>

int main(void) {
    int n, i, boundary = 0;
    scanf("%d", &n);
    int h[n];
    for ( i = 0; i < n; i++ ) {
        scanf("%d", &h[i]);
        if ( (h[i] - boundary) < -1 ) {
            printf("No\n");
            return 0;
        }
        if ( h[i] > boundary ) {
            boundary = h[i];
        }
    }
    printf("Yes\n");
    return 0;
}

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

int main(void) {
	int len;
	char s[128];

	fgets(s, sizeof(s), stdin);
	len = strlen(s);
	if(s[len - 1]  == '\n') {
		len -= 1;
	}
	printf("%c%d%c\n", s[0], len - 2, s[len - 1]);

	return 0;
}


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

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

    if (a == b) {
        if (a == c) cout << "No" << endl;
        else cout << "Yes" << endl;
    } else {
        if (a == c) cout << "Yes" << endl;
        else {
            if (b == c) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.array, std.range;

void main()
{
    foreach(_; 0 .. readln.chomp.to!int)
    {
        auto digits = readln.chomp.map!(digit => cast(int)(digit - '0')).array.sort!"a > b";
        (digits.reduce!"a * 10 + b" - digits.retro.reduce!"a * 10 + b").writeln;
    }
}

Measured memory_bytes: 1060
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>n>>k;
    ll f[n+1];
    memset(f,0,sizeof f);
    for(i=1;i<=k;i++)
    {
        cin>>m;
        for(j=1;j<=m;j++)
        {
            cin>>x;
            f[x] = 1;
        }


    }
            for(j=1;j<=n;j++)
        {
            if(f[j]==0)
                y++;
        }
    cout<<y<<endl;
    return 0;
}



Measured memory_bytes: 3636
N, X, Y = map(int, input().split())

ans = [ 0 for _ in range(N-1)]

for i in range(1, N+1):
    for j in range(i+1, N+1):
        distance = min(abs(j-i),abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))
        # print(i, j, distance)
        ans[distance-1] += 1
for x in ans:
    print(x)

Measured memory_bytes: 47708
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

ll n;
ll k,a[200010];
vector<ll> a_n,a_p;

void solve(){
  cin >> n >> k;
  rep(i,n){
    cin >> a[i];
    if(a[i]<0) a_n.push_back(-a[i]);
    else if(a[i]>0) a_p.push_back(a[i]);
  }
  ll pos=a_p.size(),neg=a_n.size();
  sort(a_n.begin(),a_n.end());
  sort(a_p.begin(),a_p.end());
  //cout << pos << " " << neg << endl;
  ll m=n*(n-1)/2;
  if(pos*neg>=k){
    ll l=0,r=INF;
    while(r-l>1){
      ll mid=(l+r)/2;
      ll num=0;
      rep(i,pos){
        num+=a_n.end()-lower_bound(a_n.begin(),a_n.end(),(mid-1)/a_p[i]+1);
      }
      //cout << mid << " " << num << endl;
      if(num<k) r=mid;
      else l=mid;
    }
    cout << -l << endl;
  }
  else if(m-neg*(neg-1)/2-pos*(pos-1)/2<k){
    ll l=0,r=INF;
    while(r-l>1){
      ll mid=(l+r)/2;
      ll num=0;
      rep(i,pos){
        num+=a_p.end()-lower_bound(a_p.begin(),a_p.end(),(mid-1)/a_p[i]+1);
        if(a_p[i]*a_p[i]>=mid){
          num--;
        }
      }
      rep(i,neg){
        num+=a_n.end()-lower_bound(a_n.begin(),a_n.end(),(mid-1)/a_n[i]+1);
        if(a_n[i]*a_n[i]>=mid){
          num--;
        }
      }
      //cout << mid << " " << num/2 << endl;
      if(num/2<m-k+1) r=mid;
      else l=mid;
    }
    cout << l << endl;
  }
  else cout << 0 << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

// 二分探索が悪そうなので誰かのコードを参考にできないかなぁ
// https://atcoder.jp/contests/abc153/submissions/9815280

ll find_r(int i, ll x, ll d, vector<pair<ll,ll>>& xh) {
  ll ok = i;
  ll ng = xh.size();
  ll Z = x+2*d;
  while(ng-ok>1) {
    int m = (ok+ng)/2;
    ll tx = xh[m].first;
    if(tx<=Z) {
      ok = m;
    } else {
      ng = m;
    }
  }
  return ok;
}

int main() {
  ll n,d,a;
  cin>>n>>d>>a;
  vector<pair<ll,ll>> xh;
  rep(i,n) {
    ll x,h;
    cin>>x>>h;
    h=(h+a-1)/a;
    xh.push_back(make_pair(x,h));
  }
  sort(xh.begin(),xh.end());
  vector<ll> r(n);
  r[n-1]=n-1;
  rep(i,n-1) {
    ll x,h;
    tie(x,h)=xh[i];
    r[i]=find_r(i,x,d,xh);
    //r[i]=i;
  }
  ll ans=0;
  vector<ll> acc(n+1);
  ll discount = 0;
  rep(i,n) {
    ll x,h;
    tie(x,h)=xh[i];
    
    h-=discount;
    h+=acc[i];
    if(h>0) {
      ans+=h;
      acc[r[i]+1]+=h;
      discount+=h;
    }
    acc[i+1]+=acc[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7148
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;
int main() {
	int D, N,i,j,k,l,I,m,M,flag,sum;
	sum = 0;
	l = 0;
	cin >> N>>M;
	long long int ans[8] = {};
	vector<long long int>x(N);
	vector<long long int>y(N);
	vector<long long int>z(N);
	vector<long long int>X(N);
	for (i = 0; i < N; i++) {
		cin >> x[i]>>y[i]>>z[i];
	}
	int a[2] = { 1,-1 };
	int b[2] = { 1,-1 };
	int c[2] = { 1,-1 };
	for (i = 0; i <= 1; i++) {
		for (j = 0; j <= 1; j++) {
			for(k = 0; k <= 1; k++) {
				for (I = 0; I < N; I++) {
					X[I] = a[i] * x[I] + b[j] * y[I] + c[k] * z[I];
				}
				sort(X.begin(), X.end());
				for (int K = N - 1; K >= N - M; K--) {
					ans[l] += X[K];
				}
				l++;
			}
		}
	}

	sort(ans, ans + 8);
	cout << ans[7] << endl;


	return 0;
}


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

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

    int h, w;
    cin >> h >> w;

    vector<string> str(h);
    REP(i, h) cin >> str[i];

    REP(i, w + 2) cout << '#';
    cout << '\n';

    REP(i, h) cout << '#' << str[i] << '#' << '\n';

    REP(i, w + 2) cout << '#';
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
#define int long long
	int n;
	string s;
	cin >> n >> s;
	string a, b;
	REP(i, 2 * n) {
		if (i < n) {
			a.push_back(s[i]);
		}
		else {
			b.push_back(s[i]);
		}
	}
	reverse(b.begin(), b.end());
	int ans[2] = {};
	map<pair<string,string>, int> gogo;
	for (int tere = 0; tere < 1; ++tere) {
		for (int i = 0; i < (1 << n); ++i) {
			string c, d;
			int now_itr = i;
			for (int q = 0;q < n; ++q) {
				if (now_itr % 2 == 1) {
					c.push_back(a[q]);
				}
				else {
					d.push_back(a[q]);
				}

				now_itr /= 2;
			}
			gogo[make_pair(c,d)]++;
		}
		for (int i = 0; i < (1 << n); ++i) {
			string c, d;
			int now_itr = i;
			for (int q = 0;q < n; ++q) {
				if (now_itr % 2 == 1) {
					c.push_back(b[q]);
				}
				else {
					d.push_back(b[q]);
				}
				now_itr /= 2;
			}
			ans[0] += gogo[make_pair(c,d)];
		}
	}
	cout << ans[0] << endl;
}

Measured memory_bytes: 49408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <ext/rope>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define vi vector<int>
#define pii pair<int,int>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
const int maxn=1e5+10;
const int dis[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
using namespace std;
using namespace __gnu_cxx;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
int n,m,a[maxn];
int main()
{
    int i,j,k,t;
    scanf("%d",&n);
    rep(i,0,2*n-1)scanf("%d",&a[i]);
    sort(a,a+2*n);
    int ans=0;
    for(i=0;i<2*n;i+=2)ans+=a[i];
    printf("%d\n",ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define pback push_back
#define mpair make_pair
#define MODN 1000000007

using namespace std;

#define ull long long

int main(){

    int n;
    cin >> n;

    vector<double> v;

    rep(i,n){
        double tmp;
        cin >> tmp;
        v.pback(tmp);
    }

    sort(v.begin(), v.end());

    double value = (v[0] + v[1]) / 2;

    for(int i = 2; i <= n - 1; i++){
        value = (value + v[i]) / 2;
    }

    cout << setprecision(10) << value << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int s,n,m;
  cin>>s;
  n=s/100;
  m=s%100;
  if(1<=n && n<=12 && 1<=m && m<=12) cout<<"AMBIGUOUS"<<endl;
  else if(1<=m && m<=12) cout<<"YYMM"<<endl;
  else if(1<=n && n<=12) cout<<"MMYY"<<endl;
  else cout<<"NA"<<endl;
}

Measured memory_bytes: 256
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# from collections import deque
# import heapq

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
H, N = map(int, input().split())
# A = list(map(int, input().split()))
# A = list(map(lambda x: int(x)*(-1), input().split()))
# B = list(map(int, input().split()))
A_B = [list(map(int,input().split())) for _ in range(N)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# edges = [list(map(int,input().split())) for _ in range(N - 1)]
# tree = [[] for _ in range(N + 1)]

# for edge in edges:
#     tree[edge[0]].append(edge[1])
#     tree[edge[1]].append(edge[0])

# depth = [-1] * (N + 1)
# depth[1] = 0
# count = [0] * (N + 1)

# for i in range(Q):
#     p, x = map(int, input().split())
#     count[p] += x

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + 1
#             dfs(tree, l[0])
# dfs(tree, 1)


# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr



# bfs
# tree = [[] for _ in range(N + 1)]
# edges = [list(map(int,input().split())) for _ in range(M)]

# for edge in edges:
#     tree[edge[0]].append(edge[1])
#     tree[edge[1]].append(edge[0])

# depth = [-1] * (N + 1)
# depth[1] = 0

# d = deque()
# d.append(1)

# ans = [0] * (N + 1)
# while d:
#  v = d.popleft()
#  for i in tree[v]:
#    if depth[i] != -1:
#      continue
#    depth[i] = depth[v] + 1
#    ans[i] = v
#    d.append(i)

# # ans = depth[2:]
# print('Yes')
# print(*ans[2:], sep="\n")

max_a = max(a for a, b in A_B)

max_damege = H + max_a

dp = [0] * (max_damege + 1)

for i in range(max_damege + 1):
    dp[i] = min(dp[i-a]+b for a,b in A_B)

print(min(dp[H-1:]))

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

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

  if(s.size() <= k) {
    cout << s << endl;
  }
  else if(s.size() > k) {
    rep(i,k) cout << s.at(i);
    cout << "..." << endl;
  }
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5;
struct node
{
	int x,i;
	bool operator < (const node &o) const
	{
		return x<o.x;
	}
}nd[maxn];
int n,mp[maxn];
int sz,lc[maxn],rc[maxn];
vector<int> G[maxn];
void init()
{
	for (int i=0;i<maxn;i++) G[i].clear();
	sz=2*n;
}
void add(int u,int v)
{
	G[u].push_back(v);
}
void build(int l,int r)
{
	int o=sz++;
	if (l==r)
	{
		lc[o]=rc[o]=0;add(o,mp[nd[l].i^1]);
		return ;
	}
	int mid=(l+r)/2;
	lc[o]=sz;build(l,mid);
	rc[o]=sz;build(mid+1,r);
	add(o,lc[o]);add(o,rc[o]);
}
int get1(int x)
{
	int l=0,r=2*n-1,mid,ret;
	while (l<=r)
	{
		mid=(l+r)/2;
		if (nd[mid].x>=x)
		{
			ret=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	return ret;
}
int get2(int x)
{
	int l=0,r=2*n-1,mid,ret;
	while (l<=r)
	{
		mid=(l+r)/2;
		if (nd[mid].x<=x)
		{
			ret=mid;
			l=mid+1;
		}
		else r=mid-1;
	}
	return ret;
}
void work(int o,int l,int r,int ql,int qr,int p)
{
	if (ql<=l&&r<=qr)
	{
		add(p,o);return ;
	}
	int mid=(l+r)/2;
	if (ql<=mid) work(lc[o],l,mid,ql,qr,p);
	if (qr>mid) work(rc[o],mid+1,r,ql,qr,p);
}
int dfs_clock,scc_cnt,sccno[maxn],pre[maxn],low[maxn];
stack<int> S;
void dfs(int u)
{
	pre[u]=low[u]=++dfs_clock;
	S.push(u);
	for (int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if (!pre[v])
		{
			dfs(v);low[u]=min(low[u],low[v]);
		}
		else if (!sccno[v]) low[u]=min(low[u],pre[v]);
	}
	if (low[u]==pre[u])
	{
		scc_cnt++;
		for (;;)
		{
			int x=S.top();S.pop();
			sccno[x]=scc_cnt;
			if (x==u) break;
		}
	}
}
void tarjan(int n)
{
	dfs_clock=scc_cnt=0;
	memset(sccno,0,sizeof(sccno));
	memset(pre,0,sizeof(pre));
	for (int i=0;i<n;i++) if (!pre[i]) dfs(i);
}
bool check(int mid)
{
	init();
	build(0,2*n-1);
	for (int i=0;i<2*n;i++)
	{
		int i1=get1(nd[i].x-mid+1),i2=get2(nd[i].x+mid-1);
		if (i1<i) work(2*n,0,2*n-1,i1,i-1,i);
		if (i<i2) work(2*n,0,2*n-1,i+1,i2,i);
	}
	tarjan(sz);
	for (int i=0;i<2*n;i++) if (sccno[i]==sccno[mp[nd[i].i^1]]) return 0;
	return 1;
}
int main()
{
	cin>>n;
	for (int i=0;i<2*n;i++) scanf("%d",&nd[i].x),nd[i].i=i;
	sort(nd,nd+2*n);
	for (int i=0;i<2*n;i++) mp[nd[i].i]=i;
	
	//cout<<check(17);
	
	int l=1,r=1e9,mid,ans=0;
	while (l<=r)
	{
		mid=(l+r)/2;
		if (check(mid))
		{
			ans=mid;
			l=mid+1;
		}
		else r=mid-1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 28560
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (long long)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(int i = 0; i <  n ; i++)
#define  reps(i,n)         for(int i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
const ll MOD = 1e9+7;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}


ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}


const int N = 100;
vi adj[N];



int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll d,t,s;cin>>d>>t>>s;
if(s*t<d){
	cout<<"No";
	}else{
		cout<<"Yes";
		}

}





	
	




		



Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
static const int inf = 1 << 30;

int main(void)
{
  int a, b;
  bool f = false;
  cin >> a >> b;
  for (int c = 1; c <= 3; c++)
  {
    if ((a * b * c) % 2 == 1)
    {
      f = true;
    }
  }
  cout << (f ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll no = n/(a+b);
    no*=a;
    ll rem = n%(a+b);
    ll no2 = min(rem,a);
    no+=no2;
    // cout<<no2<<"\n";
    cout<<no<<"\n";

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3700
#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
if(a<b)
{
printf("a < b\n");
}
if(a==b)
{
printf("a == b\n");
}
if(a>b)
{
printf("a > b\n");
}
return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  int a, b;
  cin >> a >> b;
  cout << a*b << endl;
}


Measured memory_bytes: 3632
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            print("Bad")
            quit()
    print("Good")
    return

#B
def B():
    n,l = LI()
    a = [i+l for i in range(n)]
    ans = sum(a)
    m = n+l-1
    for i in a[::-1]:
        if i < 0:break
        m = min(m,i)
    ans -= m
    print(ans)
    return

#C
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)
def C():
    a,b,c,d = LI()
    g = gcd(c,d)
    l = c*d//g
    sc = b//c-(a-1)//c
    sd = b//d-(a-1)//d
    sl = b//l-(a-1)//l
    print(b-a+1-sc-sd+sl)
    return

#D
def D():
    n = I()
    w = LIR(n)
    w.sort(key = lambda x: x[1])
    t = 0
    for a,b in w:
        if t+a > b:
            print("No")
            quit()
        t += a
    print("Yes")
    return

#E
def E():
    n,k = LI()
    if k == 0:
        m = (n*(n-1))//2
        print(m)
        for i in range(1,n+1):
            for j in range(i+1,n+1):
                print(i,j)
    else:
        if k > ((n-1)*(n-2))//2:
            print(-1)
        else:
            ans = []
            for i in range(2,n+1):
                ans.append((1,i))
            m = ((n-1)*(n-2))//2
            for i in range(2,n+1):
                for j in range(i+1,n+1):
                    if m == k:break
                    ans.append((i,j))
                    m -= 1
                if m == k:break
            print(len(ans))
            for i,j in ans:
                print(i,j)
    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    E()


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

typedef long long ll;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> dist;
    for (int i = 0; i < n; i++)
    {
        int d;
        cin >> d;
        dist.push_back(d);
    }
    ll res = 0;
    for (int i = 0; i < dist.size() - 1; i++)
    {
        res += min(1ll * b, 1ll * a * (dist[i + 1] - dist[i]));
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<algorithm>
#define f first
#define s second

using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef long long ll;
typedef pair<int,int> P;

mat mul(mat &A,mat &B){
  mat C(A.size(),vec(B[0].size()));
  for(int i=0;i<A.size();i++)
    for(int k=0;k<B.size();k++)
      for(int j=0;j<B[0].size();j++)
	C[i][j]+=A[i][k]*B[k][j];

  return C;
} 

mat pow(mat A,ll n){
  mat B(A.size(),vec(A.size()));
  for(int i=0;i<A.size();i++)B[i][i]=1;
  while(n>0){
    if(n&1)B=mul(B,A);
    A=mul(A,A);
    n>>=1;
  }
  return B;
}

int main(void){

  int n,m,z,s,d;
  vector<P>G;

  while(cin >> n >> m >> z,n|m|z){
    G.clear();
    G.push_back(P(1,1));
    for(int i=0;i<m;i++){
      cin >> s >> d;
      G.push_back(P(s,d));
      G.push_back(P(d,s));
    }

    mat A(G.size(),vec(G.size()));
 
    for(int i=0;i<G.size();i++)
      for(int j=1;j<G.size();j++)
	if(i!=j && G[i].f!=G[j].s && G[i].s==G[j].f)A[i][j]=1;

    A=pow(A,z);

    bool fg=false;
    for(int i=0;i<A.size();i++)
      if(G[i].s==n && A[0][i])fg=true;

    cout << (fg?"yes":"no") << endl;
  }
  return 0;
}

Measured memory_bytes: 1376
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int front = Integer.parseInt(s.substring(0, 2));
		int back = Integer.parseInt(s.substring(2));
		if ((front >= 1 && 12 >= front) && (back >= 1 && 12 >= back)) {
			System.out.println("AMBIGUOUS");
		} else if ((front < 1 || 12 < front) && (back < 1 || 12 < back)) {
			System.out.println("NA");
		} else if (front < 1 || 12 < front) {
			System.out.println("YYMM");
		} else {
			System.out.println("MMYY");
		}
	}
}


Measured memory_bytes: 21716
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int A, B; cin >> A >> B;

    int sum = 1, ans = 0;
    while(sum < B) {
        sum = sum + A - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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


signed main() {
int N, K;
cin >> N >> K;

vector<int> H(N);
for( int i = 0; i < N; i++ ) cin >> H.at(i);
sort(H.begin(), H.end());
reverse(H.begin(), H.end());

int cnt = 0;
int ans = 0;
for( int i = 0; i < N; i++ ){
if( cnt < K ){
cnt++;
}else{
ans += H.at(i);
}
}

cout << ans << endl;

}
  

  

  

  



Measured memory_bytes: 1792
#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>;
 
int main(){
    int n;
    cin >> n;
    vector<int> ns(n);
    rep(i, n) cin >> ns.at(i);
    sort(ns.begin(), ns.end());
    reverse(ns.begin(), ns.end());
    int al = 0;
    int bo = 0;
    rep(i, n){
        if(i%2 == 0){
            al += ns.at(i);
        }else{
            bo += ns.at(i);
        }
    }
    cout << al-bo << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>

using namespace std;

int main() {
	char S[100], ans[100];
	int p, i;
	scanf("%s", S);

	p = 0;
	i = 0;
	ans[0] = 'A';
	ans[1] = 'K';
	ans[2] = 'I';
	ans[3] = 'H';
	ans[4] = 'A';
	ans[5] = 'B';
	ans[6] = 'A';
	ans[7] = 'R';
	ans[8] = 'A';

	while(p < 9 || i< strlen(S)) {
		if (ans[p] == S[i]) {
			p++;
			i++;
		}
		else if (ans[p] == 'A') {
			p++;
		}
		else {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");

}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl v(n);  // v[i] : iが入力された回数
    rep(i, n) {
        ll a;
        cin >> a;
        v[a]++;
    }

    ll m = n/2;
    if(n%2 == 0) {
        for(ll i = 1; i < n; i += 2) {
            if(v[i] != 2) {
                out(0);
                re0;
            }
        }
    }
    else if(n%2 == 1) {
        if(v[0] != 1) {
            out(0);
            re0;
        }
        for(ll i = 2; i < n; i += 2) {
            if(v[i] != 2) {
                out(0);
                re0;
            }
        }
    }

    ll ans = 1;
    rep(i, m) {
        ans *= 2;
        ans %= mod;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    string s;
    cin >> s;
    bool ok = true;
    map<char, int> m;
    rep(i, s.size()) {
        char c = s[i];
        if(m[c] == 0) m[c]++;
        else ok = false;
    }

    yn(ok);

    return 0;
}


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

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> m(n);
	for (int i = 0; i < n; i++) cin >> m.at(i);

	int sum = 0;
	for(int i = 0; i < n; i++) sum += m.at(i);

	int min = 1001;
	for(int i = 0; i < n; i++) {
		if(m.at(i) < min) min = m.at(i);
	}

	cout << n + (x - sum) / min;

 	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        Integer[] b = new Integer[m];
        for (int i = 0; i < m; i++) {
            b[i] = Integer.parseInt(sc.next());
        }
        ArrayList<Integer[]> aList = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Integer[] a = new Integer[m];
            for (int j = 0; j < m; j++) {
                a[j] = Integer.parseInt(sc.next());
            }
            aList.add(a);
        }

        int result = 0;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += aList.get(i)[j] * b[j];
            }
            if (sum + c > 0) {
                result++;
            }
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 24020
#include <cstdio>
#include <set>

using namespace std;

void debug(multiset<long> hoge){
    for(auto i=hoge.begin(); i != hoge.end(); i++){
        printf("%ld, ", *i);
    }
    printf("\n");
}

int main(){
    multiset<long> colors;
    int n;
    scanf("%d", &n);
    int a;
    for(int i=0; i < n; i++){
        scanf("%d", &a);
        decltype(colors)::iterator it = colors.upper_bound(-a);
        if(it == colors.end()){
            colors.insert(-a);
            // printf("new color\n");
        }else{
            colors.erase(it);
            colors.insert(-a);
        }
        // debug(colors);
    }
    printf("%d\n", colors.size());
    return 0;
}

Measured memory_bytes: 4864
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP2(i,n,s) for(int i=(int)s;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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

    ll p = 1;
    REP2(i,n+1,1) {
        p = (p*i) % ((int)1e9 + 7);
    }

    cout << p << endl;
}


Measured memory_bytes: 256
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 1000000
for i in range(m):
    x, y, c = map(int, input().split())
    ans = min(ans, A[x - 1] + B[y - 1] - c)
A.sort()
B.sort()
ans = min(ans, A[0] + B[0])
print(ans)


Measured memory_bytes: 18612
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n,n){
		stack<pii> st;
		rep(i,n){
			int t;
			cin>>t;
			if(i==0) st.push(mkp(t,1));
			else if(i%2==1){
				pii tt=st.top();
				st.pop();
				if(tt.F!=t){
					st.push(mkp(t,tt.S+1));
				}
				else{
					// cout<<"afa\n";
					// cout<<t<<endl;
					st.push(tt);
					st.push(mkp(t,1));
				}
				while(st.size()>1){
					pii t1=st.top();
					st.pop();
					pii t2=st.top();
					st.pop();
					if(t1.F==t2.F){
						// cout<<"fafafaf"<<t1.F<<endl;
						st.push(mkp(t1.F,t1.S+t2.S));
					}
					else{
						st.push(t2);
						st.push(t1);
						break;
					}
				}
			}
			else{
				pii t1=st.top();
				st.pop();
				if(t1.F==t){
					// cout<<"hoge\n";
					st.push(mkp(t1.F,t1.S+1));
				}
				else{
					st.push(t1);
					st.push(mkp(t,1));
				}
				// cout<<"faga"<<endl;
			}
			// cout<<i<<" "<<st.top().F<<" "<<st.top().S<<endl;
		}
		int ans=0;
		while(!st.empty()){
			if(st.top().F==0){
				ans+=st.top().S;
			}
			st.pop();
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, K, T, W, H, M, C;

const int MAX = 5100000;
const ll MOD = 1e9 + 7;

const double PI=3.14159265358979323846;


long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modinv(ll a) {
    ll b = MOD, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

ll modpow(ll x, ll n) {
  ll ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= MOD;
    (x *= x) %= MOD;
    n >>= 1;
  }
  return ret;
}

struct Eratos {
    vector<int> primes;
    vector<bool> isprime;
    vector<int> min_factor;

    Eratos(int MAX) : primes(),
                      isprime(MAX+1, true),
                      min_factor(MAX+1, -1) {
        isprime[0] = isprime[1] = false;
        min_factor[0] = 0, min_factor[1] = 1;
        for (int i = 2; i <= MAX; ++i) {
            if (!isprime[i]) continue;
            primes.push_back(i);
            min_factor[i] = i;
            for (int j = i*2; j <= MAX; j += i) {
                isprime[j] = false;
                if (min_factor[j] == -1) min_factor[j] = i;
            }
        }
    }

    // prime factorization
    vector<pair<int,int>> prime_factorize(int n) {
        vector<pair<int,int> > res;
        while (n != 1) {
            int prime = min_factor[n];
            int exp = 0;
            while (min_factor[n] == prime) {
                ++exp;
                n /= prime;
            }
            res.push_back(make_pair(prime, exp));
        }
        return res;
    }
};

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

  
int main(){
    cin >> N;
    vector<ll> A(N); REP(i,N) cin >> A[i];
    vector<ll> B = A;
    Eratos er(*max_element(ALL(A)) );
    vector<int> table(1e6 + 10, 0);
    REP(i,N){
        auto p = er.prime_factorize(A[i]);
        REP(i, p.size()) table[p[i].first] = max(p[i].second, table[p[i].first] );
    }
    ll L = 1;
    for(int i = 0; i < table.size(); ++i){
        L *= modpow(i, table[i]); L %= MOD;
    }
    ll ans = 0;
    REP(i,N){
        ans += L * modinv(A[i]); ans %= MOD;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
int main(){
	int a,b,ans;
	cin >> a >> b;
	if(a>=13){
		ans = b;
	}
	else if(a>5) ans = b/2;
	else ans = 0;
	cout << ans << endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
//計算量に気をつけよう
using namespace std;

bool binarySearch(vector<int> data, int target) {
   int start = 0;
   int end = data.size() - 1;
 

   while(end - start >= 0) {
      int middle = (start +  end) / 2;
      if(data[middle] > target) {
         end = middle - 1;
      } else if(data[middle] < target) {
         start = middle + 1;
      } else {
         return true;
      }
   }

   return false;
}

   
int main () {
   int n;
   cin >> n;
   vector<int> S;
   for(int i = 0; i < n; i++) {
      int r;
      cin >> r;
      S.push_back(r);
   }

   int q;
   cin >> q;
   vector<int> T;
   for(int i = 0; i < q; i++) {
      int r;
      cin >> r;
      T.push_back(r);
   }

   int count = 0;
   for(int i = 0; i < q; i++) {
      if(binarySearch(S, T[i])) {
         count ++;
      }
   }

   cout << count << endl;
}


Measured memory_bytes: 4108
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define fastio                              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
#define read                                freopen("input.txt", "r", stdin);
#define write                               freopen("output.txt", "w", stdout);
#define nl                                  '\n'
#define LCM(a,b)                            (a / __gcd(a,b) ) *b
#define GCD(a,b)                            __gcd(a,b)
#define mem(v, val)                         memset(v, val, sizeof(v))
#define TC                                  int t; cin >> t; for(int tc = 1; tc <= t; tc++)
#define inp(x)                              for(auto& iinput:x) cin >> iinput
#define out(x)                              for(auto& ooutput:x) cout << ooutput << ' '; cout << nl;
#define sq(a)                               ((a) * (a))

#define ll                                  long long
#define vi                                  vector<int>
#define pb                                  push_back
#define vpii                                vector<pair<int, int>>
#define mp                                  make_pair
#define ff                                  first
#define ss                                  second
#define all(v)                              v.begin(), v.end()
#define rsort(v)                            sort(v.rbegin(), v.rend())
#define debug(x)                            cerr << #x << " = " << x << nl

using namespace std;



int main(){
    #ifndef ONLINE_JUDGE
        read;
        write;
    #endif
    ll n;
    cin >> n;
    ll x;
    map<int, bool> mp;
    while(n--) {
    	cin >> x;
    	if(mp.find(x) == mp.end()) mp[x] = true;
    	else mp.erase(x);
    }
    cout << mp.size();




    return 0;

}

Measured memory_bytes: 8180
#include <stdio.h>


int n,m;
int a[50];
int b[50];
bool visited[51]={};
int del;

void dfs(int x)
{
    visited[x]=true;
    for(int i=0;i<m;i++)
    {
        if(i==del) continue;
        if(a[i]==x&&!visited[b[i]])
        {
            dfs(b[i]);
        }
        if(b[i]==x&&!visited[a[i]])
        {
            dfs(a[i]);
        }
    }
    return;
}



int main()
{
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++) scanf("%d %d",&a[i],&b[i]);

    int ans=0;
    for(int i=0;i<m;i++)
    {
        del=i;
        for(int j=1;j<=n;j++) visited[j]=false;
        dfs(1);
        for(int j=1;j<=n;j++)
        {
            if(!visited[j])
            {
                ans++;
                break;
            }
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 128
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>?5*8},'ruby',$0)
require 'set'
def dfs(z,c)
	f=S[c]
	r=[0,c]
	G[c].each{|e|
		next if e==z
		t=dfs(c,e)
		r=[r,[t[0]+f,t[1]]].max
	}
	r
end
N=gets.to_i
G=Hash.new{|h,k|h[k]=Set.new}
(N-1).times{
	a,b=gets.split.map(&:to_i)
	G[a-1]<<b-1
	G[b-1]<<a-1
}
A=gets.chomp
(p A.count(?W);exit) if A.count(?W)<2
r=N-1
Q=N.times.select{|i|G[i].size==1&&A[i]==?B}
while !Q.empty?
	c=Q.shift
	r-=1
	G[c].each{|e|
		G[e].delete c
		Q<<e if G[e].size==1&&A[e]==?B
	}
	G.delete c
end
r*=2
S={}
G.keys.each{|k|
	G.delete k if G[k].empty?
	r+=S[k]=((A[k]==?B?0:1)+G[k].size)%2
}
p r-dfs(-1,dfs(-1,G.each_key.first)[1])[0]*2

Measured memory_bytes: 370344
#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 pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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;
ll const MOD = 1000000007;


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

int n,k;
cin >> n >> k;

int ans = 1;
rep(i,n) {
    ans = min(ans*2,ans+k);
}

cout << ans << endl;

return 0;
}

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

vector<int> solve(string s) {
	map<char, int> m;
	int cnt = 0;
	vector<int> res(s.size());
	rep(i, s.size()) {
		if(!m.count(s[i])) {
			m[s[i]] = cnt;
			cnt++;
		}
		res[i] = m[s[i]];
	}
	// rep(i, s.size()) cout << res[i] << endl;
	return res;
}

int main() {
	string s, t;
	cin >> s >> t;
	string ans = "No";
	if(solve(s) == solve(t)) ans = "Yes";
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string s; cin >> s;

	int n = (int)s.length() - 2;

	cout << s[0] << n << s[n+1] << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import Counter


def i1str():
    return input()


def istrs(n=None):
    if n is None:
        return input().split()
    a = []
    for _ in range(n):
        a.append(istrs())
    return a


def i1num():
    return int(input())


def inums(n=None):
    if n is None:
        return list(map(int, input().split()))
    a = []
    for _ in range(n):
        a.append(inums())
    return a


def ostrs(l, sp=" "):
    print(sp.join(l))


def onums(l, sp=" "):
    print(sp.join(map(str, l)))


def solve(n, a):
    cnt = Counter(a)
    for i in range(n):
        print(cnt[i+1])


if __name__ == "__main__":
    n = i1num()
    a = inums()
    solve(n, a)


Measured memory_bytes: 34244
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int h, w, m;
  cin >> h >> w >> m;

  map<int, int> hl, wl;
  map<P, int> b;
  rep(i, m) {
    int hi, wi;
    cin >> hi >> wi;
    hi--;
    wi--;
    hl[hi]++;
    wl[wi]++;
    b[{hi, wi}] = 1;
  }

  V<P> nh(h), nw(w);
  for (auto e : hl) nh.push_back({e.second, e.first});
  for (auto e : wl) nw.push_back({e.second, e.first});

  sort(nh.rbegin(), nh.rend());
  sort(nw.rbegin(), nw.rend());

  ll ans = 0;
  rep(i, h) {
    if (nh[0].first > nh[i].first) break;
    rep(j, w) {
      if (nw[0].first > nw[j].first) break;
      ll tmp = nh[i].first + nw[j].first;
      int x = nw[j].second;
      int y = nh[i].second;
      if (b[{y, x}] > 0) tmp--;
      ans = max(ans, tmp);
      if (b[{y, x}] == 0) break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 87464
#include<cstdio>
#include<cstring>
#include<utility>
#include<algorithm>
using namespace std;
char s[200010];
pair<int,pair<int ,int>> dp[200010];
int main(){
    int n,r[26];
    scanf("%s",s);
    n=strlen(s);
    dp[n]=make_pair(1,make_pair(0,n));
    for(int i=0;i<26;i++){
        r[i]=n;
    }
    r[s[n-1]-'a']=n-1;
    for(int i=n-1;i>=0;i--){
        dp[i]=make_pair(300000,make_pair(0,n));
        for(int j=0;j<26;j++){
            if(r[j]==n){
                dp[i]=min(dp[i],make_pair(1,make_pair(j,n)));
            }
            else{
                dp[i]=min(dp[i],make_pair(1+dp[r[j]+1].first,make_pair(j,r[j])));
            }
        }
        if(i){
            r[s[i-1]-'a']=i-1;
        }
    }
    for(int i=0;i!=n+1;i=dp[i].second.second+1){
        printf("%c",dp[i].second.first+'a');
    }
    printf("\n");
}

Measured memory_bytes: 2688
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {

    int a,b;
    cin >> a >> b;

    if(a > b)
    printf("a > b\n");

    if(a < b)
    printf("a < b\n");

    if( a == b)
    printf("a == b\n");

	return 0;
}


Measured memory_bytes: 3008