akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < (int)(n); i++)
using ull = unsigned long long;

int main() {
    ull N, A, B;
    cin >> N >> A >> B;

    if ((A + B) > 0) {
        cout << (N / (A + B)) * A + min( N % (A + B) , A) << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}



Measured memory_bytes: 256
//--- pD ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	public Solution () {
		reader = new Reader();
		while (reader.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
 		int n = ni(), m = ni(), k = ni();
		DJSet uf = new DJSet(n);

		Map<Integer, Set<Integer>> map = new HashMap<>();
		for (int i=0; i<m; i++) {
			int t1 = ni(), t2 = ni();
			int a = Math.min(t1, t2);
			int b = Math.max(t1, t2);
			a--;
			b--;
			uf.union(a, b);
			map.putIfAbsent(a, new HashSet<>());
			map.get(a).add(b);
			map.putIfAbsent(b, new HashSet<>());
			map.get(b).add(a);
		}

		for (int i=0; i<k; i++) {
			int t1 = ni(), t2 = ni();
			int a = Math.min(t1, t2);
			int b = Math.max(t1, t2);
			a--;
			b--;
			map.putIfAbsent(a, new HashSet<>());
			map.get(a).add(b);
			map.putIfAbsent(b, new HashSet<>());
			map.get(b).add(a);
		}

		int[] res = new int[n];
		for (int i=0; i<n; i++) {
			int t = uf.getSize(i) - 1;
			if (map.get(i) != null) {
				for (int u: map.get(i)) {
					if (uf.equiv(i, u)) t--;
				}
			}
			res[i] = t;
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i<n; i++) {
			sb.append(String.valueOf(res[i]) + " ");
		}
		System.out.println(sb.toString().trim());
		return;
	}
	private int ni() {return Integer.parseInt(reader.next());}
	private String ns() {return reader.next();}
}

class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
}

class DJSet {
	public int[] upper;
    public int[] size;

	public DJSet(int n) {
		upper = new int[n];
		Arrays.fill(upper, -1);

        size = new int[n];
        Arrays.fill(size, 1);
	}

	public int find(int x) {
		return upper[x] < 0 ? x : (upper[x] = find(upper[x]));
	}

	public boolean equiv(int x, int y) {
		return find(x) == find(y);
	}

	public boolean union(int x, int y) {
		x = find(x);
		y = find(y);
		if (x != y) {
			if (upper[y] < upper[x]) {
				int d = x;
				x = y;
				y = d;
			}
            size[x] += size[y];
			upper[x] += upper[y];
			upper[y] = x;
		}
		return x == y;
	}

	public int count() {
		int ct = 0;
		for (int u : upper)
			if (u < 0)
				ct++;
		return ct;
	}

    public int getSize(int x) {
        return size[find(x)];
    }
}


Measured memory_bytes: 127448
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;

int main(){
    int N; cin >> N;
    vector<vector<long long>> v(N, vector<long long> (2));
    for(int i=0;i<N;i++){
        int a, b; cin >> a >> b;
        v[i][0]=b; v[i][1]=a;
    }
    sort(v.begin(), v.end());
    string ans = "Yes";
    long long s = 0;
    for(int i=0;i<N;i++){
        s+=v[i][1];
        if(s>v[i][0]) {ans = "No"; break;}
    }
    cout << ans << endl;
}


Measured memory_bytes: 11136
import sys
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a, b, c, d, e]
ans = 1 <<10
for i in itertools.permutations(lst, 5):
    cnt = 0
    for num, j in enumerate(i):
        if num == 4:
            cnt += j
            break
        if j%10 != 0:
            cnt += 10 * (j//10) + 10
        else: cnt += j
    ans = min(ans, cnt)

print(ans)




Measured memory_bytes: 9180
// ABC 151-F
// 2020.1.12 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-10

typedef struct { double x, y; } PP;
PP p[31];

double dist(PP a, PP b)
{
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt(x*x + y*y);
}

double solve_by_movement(int n)
{
	int  k, i, t;
	PP a;
	double move, max, d;

    a.x = a.y = 500;
	move = 0.5;
	while (move > EPS) {
		for (t = 0; t < 1000; t++) {
			max = 0;
			for (i = 0; i < n; i++) {
				if ((d = dist(a, p[i])) > max) max = d, k = i;
			}
			a.x += (p[k].x - a.x)*move;
			a.y += (p[k].y - a.y)*move;
		}
		move /= 2;
	}
	return max;
}

int main()
{
	int i, x, y, N;

	scanf("%d", &N);
	for (i = 0; i < N; ++i) {
		scanf("%d%d", &x, &y);
		p[i].x = x, p[i].y = y;
	}
	printf("%.12lf\n", solve_by_movement(N));
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
bool vis[100001];
int dis[100001];
int main()
{
	string s;
	int cnt=0;
	cin>>s;
	int n=s.length();
	for(int i=0;i<n/2;i++)
	{
		if(s[i]!=s[n-i-1])cnt++;
	}
	cout<<cnt;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
int n; ll a[100005],sum,sum2;
int main(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
		sum2+=i+1;
	}
	if(sum%sum2 != 0){
		puts("NO"); return 0;
	}
	ll cnt = sum/sum2,S = 0 ;
	rep(i,n){
		int j = (i+1)%n;
		ll zan = a[i]+cnt;
		if(zan > a[j]){
			if( (zan-a[j])%n != 0 ){
				puts("NO"); return 0;
			}
			S += (zan-a[j])/n;
		}
	}
	puts((S==cnt?"YES":"NO"));
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) ((a>b)? a:b)
int main()
{
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(a-c)<=d){
    cout<<"Yes";
    return 0;
  }
  else if(abs(a-b)<=d&&abs(b-c)<=d){
    cout<<"Yes";
    return 0;
  }
  else cout<<"No";
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long dp[60][2];
int n,p;
int main(){
	scanf("%d%d",&n,&p); dp[0][0]=1;
	for (int i=1;i<=n;i++){
		int k; scanf("%d",&k); k%=2;
		for (int j=0;j<2;j++)
			dp[i][j]=dp[i-1][j]+dp[i-1][j^k];
	}
	cout<<dp[n][p]<<endl;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

#define NIL NULL

Node root;

Node treeMaximum(Node x){
  while( x->right != NIL ) x = x->right;
  return x;
}

Node treeMinimum(Node x){
  while( x->left != NIL ) x = x->left;
  return x;
}

Node treeSearch(Node u, int k){
  while( u != NIL && k != u->key ){
    if ( k < u->key ) u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  if ( x->right != NIL ) return treeMinimum(x->right);
  Node y = x->parent;
  while( y != NIL && x == y->right ){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if ( z->left == NIL || z->right == NIL ) y = z;
  else y = treeSuccessor(z);
  if ( y->left != NIL ) x = y->left;
  else x = y->right;

  if ( x != NIL ) x->parent = y->parent;

  if ( y->parent == NIL ){
    root = x;
  } else {
    if (y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }

  if ( y != z ){
    z->key = y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if ( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if ( y == NIL ){
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node u){
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node u){
  if ( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( strcmp(com, "find") == 0 ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
	else printf("no\n");
      } else if ( com[0] == 'i' ){
       scanf("%d", &x);
       insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20492
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<ll> vi;
int main(){
    ios_base::sync_with_stdio(false);
	ll n;cin>>n;
	vi v(n);
	for(ll i=0;i<n;i++){
		ll a;cin>>a;
		v[a-1]=i;
	}
	ll ans=1,cnt=1;
	for(ll i=0;i<n-1;i++){
		if(v[i]<v[i+1])
			cnt++;
		else
			cnt=1;
		ans=max(cnt,ans);
	}
	cout<<n-ans<<endl;
	return 0;
}



Measured memory_bytes: 4828
import math
n = int(input())
lis = [int(input()) for i in range(n)]
lis.sort()
ans = 0
if n % 2 == 0:
  lisa = lis[:n//2]
  lisb = lis[n//2:]
  lia = []
  lib = []
  lic = []
  lid = []
  for i in range(n//2):
    lia.append(lisa[i])
    lib.append(lisb[i])
    lic.append(lisa[i])
    lid.append(lisb[-(i+1)])
    lia.append(lisb[i])
    lib.append(lisa[i])
    lic.append(lisb[-(i+1)])
    lid.append(lisa[i])
  coa = 0
  cob = 0
  coc = 0
  cod = 0
  for i in range(n-1):
    coa += abs(lia[i+1]-lia[i])
    cob += abs(lib[i+1]-lib[i])
    coc += abs(lic[i+1]-lic[i])
    cod += abs(lid[i+1]-lid[i])
  print(max(coa,cob,coc,cod))
else:
  lia = [lis[(n-1)//2]]
  lib = [lis[(n-1)//2]]
  lic = [lis[(n-1)//2]]
  lid = [lis[(n-1)//2]]
  lis.remove(lis[(n-1)//2])
  lisa = lis[:n//2]
  lisb = lis[n//2:]
  for i in range(n//2):
    lia.append(lisa[i])
    lib.append(lisb[i])
    lic.append(lisa[i])
    lid.append(lisb[-(i+1)])
    lia.append(lisb[i])
    lib.append(lisa[i])
    lic.append(lisb[-(i+1)])
    lid.append(lisa[i])
  coa = 0
  cob = 0
  coc = 0
  cod = 0
  for i in range(n-1):
    coa += abs(lia[i+1]-lia[i])
    cob += abs(lib[i+1]-lib[i])
    coc += abs(lic[i+1]-lic[i])
    cod += abs(lid[i+1]-lid[i])
  print(max(coa,cob,coc,cod))

Measured memory_bytes: 14456
N, K = map(int, input().split())
h = list(map(int,input().split()))

dp = [float('inf')]*N

dp[0] = 0

for i in range(1,N):
    k = 1
    while(i-k >= 0):
        dp[i] = min(dp[i], dp[i-k]+abs(h[i]-h[i-k]))
        if k == K:
            break
        if k < K:
            k += 1

print(dp[N-1])

Measured memory_bytes: 85144
#include <iostream>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

long long N, M, A[200009], L[200009], R[200009], P[200009], dp[200009], dp2[200009];

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) scanf("%lld", &A[i]);
	for (int i = 1; i <= N; i++) P[i] = i;
	for (int i = 1; i <= M; i++) {
		scanf("%lld%lld", &L[i], &R[i]); P[R[i]] = min(P[R[i]], L[i]);
	}
	for (int i = N - 1; i >= 1; i--) P[i] = min(P[i + 1], P[i]);

	for (int i = 0; i <= N; i++) { dp[i] = -(1LL << 60); dp2[i] = -(1LL << 60); }
	dp[0] = 0; dp2[0] = 0;
	for (int i = 1; i <= N; i++) {
		dp[i] = dp2[P[i] - 1] + A[i];
		dp2[i] = max(dp[i], dp2[i - 1]);
	}
	long long maxn = 0;
	for (int i = 1; i <= N; i++) maxn = max(maxn, dp[i]);
	cout << maxn << endl;
	return 0;
}


Measured memory_bytes: 12344
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;

int INF=1e9;
int main(){
    int n,m;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    cin>>m;
    vector<int>b(m);
    for(int i=0;i<m;i++){
      cin>>b[i];
    }
    cout<<lexicographical_compare(a.begin(),a.end(),b.begin(),b.end())<<endl;
}


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

using namespace std;

int main(void){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};  

  ll k;
  cin >> k;
  
  k--;
  cout << a[k] << endl;

  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {

    ll n;
    cin>>n;
    map<ll,ll>M;
    M[1]=0;
    for(int i=2; i<n+1; i++){
        ll ar;
        cin>>ar;
        M[ar]++;
    }
    for(int i=1; i<n+1; i++){
        cout<<M[i]<<endl;
    }
}


Measured memory_bytes: 16128
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>


int N, K, ans;
vi D;

vector<bool> like;

bool check(int M){
    int tmp;
    while(M > 0){
        tmp = M % 10;
        if(!like[tmp]) return false;
        M /= 10;
    }
    return true;
}

void solve(){
    for(int m = N; m < INF; ++m){
        if(check(m)){
            ans = m;
            break;
        }
    }
    cout << ans << endl;
}

int main(){
    cin >> N >> K;
    like.resize(10, true);
    D.resize(K);

    rep(i, K) {
        cin >> D[i];
        like[D[i]] = false;
    }

    solve();
}


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

using namespace std;

int main()
{
  int a[3]; cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  if(a[0] == 5 && a[1] == 5 && a[2] == 7)
    cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
const int INF=1e9+7;
const int mod=1e9+7;
struct poi{
	int X;int Y;int Z;
  bool operator<(const poi&R)const{
		return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
	}
};
//
//ACACACACACACACACACACACAC//
//WAWAWAWAWAWAWAWAWAWAWAWA//
//CECECECECECECECECECECECE//
//RERERERERERERERERERERERE//
//TLETLETLETLETLETLETLETLE//
//
int N;
int A[200000];
int l[200000],r[200000];
int main(){
	cin>>N;
	FOR(i,0,N){
		cin>>A[i];
	}
	VE V;
	FOR(i,0,N){
		while(!V.empty()&&A[V.back()]>A[i]){
			V.PPB();
		}
		if(V.empty()){
			l[i]=i+1;
		}else{
			l[i]=i-V.back();
		}
		V.PB(i);
	}
	V.clear();
	ROF(i,0,N){
		while(!V.empty()&&A[V.back()]>A[i]){
			V.PPB();
		}
		if(V.empty()){
			r[i]=N-i;
		}else{
			r[i]=V.back()-i;
		}
		V.PB(i);
	}
	ll ans=0;
	FOR(i,0,N){
		ans+=(ll)l[i]*r[i]*A[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3448
n = int(input())
List = list(map(int,input().split()))
direction = 1
ahead = []
post = []
for i in range(n):
  if direction == 1:
    post.append(List[i])
  else:
    ahead.append(List[i])
  direction *= -1
if direction == 1:
  ans = ahead[::-1]+post
else:
  ans = post[::-1]+ahead
print(*ans)


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

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

	for (int l = 3; 0 <= l; l--)
	{
		for (int i = 0; i + l <= s.size(); i++)
		{
			string t = s.substr(i, l);

			bool f = true;
			for (auto &&c : t)
			{
				f &= (c == 'R');
			}

			if (f)
			{
				cout << l << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3596
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, 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, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
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 TUPLE(): return tuple(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 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

n, m = MAP()
x = LIST()
y = LIST()

def acc(A):
	acc = []
	tmp = 0
	for a in A:
		tmp += a
		tmp %= mod
		acc.append(tmp)
	return acc

def sum_combinations(A, k):
	A_acc = acc(A)
	A_sum = 0

	for i in range(k):
		tmp = (A_acc[-1] - A_acc[i]) %mod
		tmp = (tmp-A[i] * (k-1-i)%mod) %mod
		A_sum = (A_sum + tmp) %mod

	return A_sum

print(sum_combinations(x, n) * sum_combinations(y, m) %mod)


Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define maxn 200001
#define maxa 1000005
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

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

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

ll power(ll a, ll b = MOD-2){
    if(b == 0) return 1;
    ll r = power(a, b/2);
    r = (r*r)%MOD;
    if(b%2 == 1) r = (r*a)%MOD;
    return r;
}

vector<ll> vec[55];
ll par[55], dep[55], X[21], Y[21], lca[21], n, m, dp[1<<21];

void  dfs(ll u, ll p){
    par[u] = p;
    dep[u] = dep[p]+1;
    for(auto x: vec[u]){
        if(p != x){
            dfs(x, u);
        }
    }
}

void solve(){
    ll  n; string s;
    cin >>n >> s;
    ll c = 0;
    for(ll i = 0 ; i < n-2;i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') c++;
    }cout << c ;
}

int main()
{
    fast();
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
import numpy as np

N, M = map(int, input().split())
A = np.array([list(input()) for _ in range(N)])
B = np.array([list(input()) for _ in range(M)])

bl = False
for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M, j:j+M] == B).all():
      bl = True
print("Yes" if bl else "No")      

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

map<int ,int>mp;
int main()
{
    int n, m, i, j=0,sum=0;
    cin>>n; for(i=0; i<n; i++){
         cin>>m; mp[m]++; if(mp[m]==2) j=1;
    }
    j==0?cout<<"YES"<<endl:cout<<"NO"<<endl;
    return 0;
}



Measured memory_bytes: 9600
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	symbols := strings.Split(s, "")

	num := 0
	for _, v := range symbols {
		if v == "+" {
			num++
		} else {
			num--
		}
	}
	fmt.Println(num)
}


Measured memory_bytes: 640
<?php
  $n = trim(fgets(STDIN));
  $a = explode(" ", trim(fgets(STDIN)));
  $b = [];
  if($n%2 == 0){
      $g = $n-1;
      $k = 0;
      while($g > 0){
          $b[] = $a[$g];
          $g -= 2;
      }
      while($k < $n){
          $b[] = $a[$k];
          $k += 2;
      }
  }else{
      $k = $n-1;
      $g = 1;
      while($k >= 0){
          $b[] = $a[$k];
          $k -= 2;
      }
      while($g < $n){
          $b[] = $a[$g];
          $g += 2;
      }
  }
//   print_r($b);
  
  for($i=0; $i<$n; $i++){
      echo $b[$i];
      if($i<$n-1){
          echo " ";
      }
  }

Measured memory_bytes: 33136
import sys
input = sys.stdin.readline
N = int(input())
XY = [tuple(map(int,input().split() + [i])) for i in range(N)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self._size = [1] * N
        self.count = 0
    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)
    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._size[ra] < self._size[rb]: ra,rb = rb,ra
        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        self.count += 1
    def size(self,a):
        return self._size[self.root(a)]

uf = UnionFind(N)
sx = sorted(XY, key=lambda x:x[0])
sy = sorted(XY, key=lambda x:x[1])

es = []
for (x1,_,i),(x2,_,j) in zip(sx,sx[1:]):
    es.append((x2-x1, i, j))
for (_,y1,i),(_,y2,j) in zip(sy,sy[1:]):
    es.append((y2-y1, i, j))
es.sort(key=lambda x:x[0])

ans = 0
for d,i,j in es:
    if uf.is_same(i,j): continue
    uf.unite(i,j)
    ans += d
print(ans)

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
  ll n , r;
  cin >> n >> r;
  if( n >=10)cout << r;
  else cout << r+100*(10-n);
	
	return 0;
}


Measured memory_bytes: 256
@a=map~~<>,1..<>;
@c=<>;
for(@a){
	($a,$b)=glob;
	$m=1e9;
	$z=@c;
	$i=0;
	for(@c){
		$i+=/ /;
		$m-=$-=$m-abs($`-$a)-abs$'-$b;
		$-&&($z=$i)
	}
	print$z,$/
}


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

int main(){
    string a,b;
    cin>>a>>b;
    if(a =="H" && b == "H"){
        cout<<"H"<<endl;
    }else if(a =="D" && b == "D"){
        cout <<"H" <<endl;
    }else if(a =="H" && b == "D"){
        cout <<"D" <<endl;
    }else if(a =="D" && b == "H"){
        cout <<"D" <<endl;
    }
}



Measured memory_bytes: 256
#include<stdio.h>

int gcd(int x, int y);  // 最大公約数を求める関数

int main()
{
    int x, y, K;
    int gcd_num;
    int A[100];
    int j = 0;
    scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &K);
    gcd_num = gcd(x, y);
    for(int i = 1; i <= gcd_num; i++){
        if( gcd_num % i == 0){
            A[j] = i;
            j++;
        }
    }

    printf("%d\n", A[j- K]);

    return 0;
}

// 最大公約数を求める関数
int gcd(int x, int y)
{
    int r;

    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0)  // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

Measured memory_bytes: 128
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
		string inpt = Reader.ReadLine();
		int idx = int.Parse(Reader.ReadLine()) - 1;
		List<char> charList = inpt.Distinct().OrderBy(a => a).ToList();
		if(charList.Count > 5) {
			charList = charList.Take(5).ToList();
		}

		List<string> words = new List<string>();
		foreach(char c in charList) {
			for (int i = 0; i < inpt.Length; i++) {
				if(inpt[i] != c) {
					continue;
				}
				for (int j = 1; j <= 5; j++) {
					if(i+j>inpt.Length) {
						continue;
					}
					string tmp = inpt.Substring(i, j);
					if(!words.Contains(tmp)) {
						words.Add(tmp);
					}
				}
			}
			if (words.Count >= 5)
            {
                break;
            }
		}
		words.Sort();
		Console.WriteLine(words[idx]);
	}


    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


atcoderandatcodeer
5


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 13664
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    S = input()

    ai, zi = 0, len(S) - 1

    while S[ai] != "A":
        ai += 1

    while S[zi] != "Z":
        zi -= 1

    print(zi - ai + 1)

main()


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

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<int>());


    int Alice=0,Bob=0;
    for(int i = 0;i<n;i++){
        if(!(i%2)){
            Alice+=a[i];
        }else{
            Bob+=a[i];
        }
    }

    int ans= Alice-Bob;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#if loc||local
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<ll(n);++i)
#define repr(i,n) for(ll i=ll(n);i-->0;)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
struct union_find{
  size_t n;
  std::vector<int> par;
  size_t group;
  union_find(){}
  union_find(size_t _n):n(_n),group(_n){
    par.resize(n,-1);
  }
  void reset(size_t _n){
    n = _n;
    group = n;
    par.clear();
    par.resize(n,-1);
  }
  int root(int k){
    if(par[k]<0)return k;
    return par[k] = root(par[k]);
  }
  int size(int k){
    k = root(k);
    return -par[k];
  }
  int operator[](int k){
    return size(k);
  }
  bool unite(int a,int b){
    a = root(a);
    b = root(b);
    if(a==b)return false;
    if(size(a)<size(b))std::swap(a,b);
    group--;
    par[a] += par[b];
    par[b] = a;
    return true;
  }
  bool operator()(int a,int b){
    return unite(a,b);
  }
  bool same(int a,int b){
    return root(a) == root(b);
  }
};
using T3 = tuple<ll,ll,ll>;
using T4 = tuple<ll,ll,ll,ll>;
signed main(){
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  constexpr char newl = '\n';

  int n;
  cin>>n;
  vector<T3> points(n);
  rep(i,n){
    int x,y;
    cin>>x>>y;
    x--;y--;
    points[i] = {x,y,i};
  }
  sort(begin(points),end(points));

  union_find uni(n);
  set<pll> st;
  rep(i,n){
    auto[xi,yi,ii] = points[i];
    ll merge_min = yi;
    for(auto itr=begin(st);itr!=end(st);){
      auto[yj,j]=*itr;
      if(yj>yi)break;
      uni.unite(ii,j);
      chmin(merge_min,yj);
      itr = st.erase(itr);
    }
    st.emplace(merge_min,ii);
  }
  rep(k,n)cout<<uni[k]<<newl;

}

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

using namespace std;

class Dice
{
public:
    int label[6], tmp;

    void in()
    {
        rep(i, 6) scanf("%d", &label[i]);
    }

    void rollS()
    {
        tmp = label[0];
        label[0] = label[4];
        label[4] = label[5];
        label[5] = label[1];
        label[1] = tmp;
    }

    void rollN()
    {
        tmp = label[0];
        label[0] = label[1];
        label[1] = label[5];
        label[5] = label[4];
        label[4] = tmp;
    }

    void rollE()
    {
        tmp = label[0];
        label[0] = label[3];
        label[3] = label[5];
        label[5] = label[2];
        label[2] = tmp;
    }

    void rollW()
    {
        tmp = label[0];
        label[0] = label[2];
        label[2] = label[5];
        label[5] = label[3];
        label[3] = tmp;
    }

    void sideturn()
    {
        tmp = label[1];
        label[1] = label[2];
        label[2] = label[4];
        label[4] = label[3];
        label[3] = tmp;
    }
};

bool check2(Dice d1, Dice d2)
{
    bool c = true;
    FOR(i, 1, 5)
    {
        c = c && d1.label[i] == d2.label[i];
    }

    return c;
}

bool check1(Dice d1, Dice d2)
{
    bool b = false;

    if (d1.label[0] == d2.label[0] && d1.label[5] == d2.label[5])
    {
        rep(i, 4)
        {
            b = b || check2(d1, d2);
            d2.sideturn();
        }
    }
    return b;
}

bool isSame(Dice d1, Dice d2)
{
    bool a = false;

    a = a || check1(d1, d2);
    d2.rollN();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollE();
    a = a || check1(d1, d2);
    d2.rollN();
    a = a || check1(d1, d2);

    return a;
}

int main()
{
    Dice d1, d2;
    d1.in();
    d2.in();

    if (isSame(d1, d2))
        printf("Yes\n");
    else
        printf("No\n");
}


Measured memory_bytes: 3164
L=gets.to_i


edges=[]
count=0

if L>=2**19
  edges << [19,20,0]
  edges << [19,20,2**18]
  count+=2**19
end

19.downto(2) do |i|
  edges << [i-1,i,0]
  edges << [i-1,i,2**(i-2)]
  if L[i-1]==1
    edges << [i,20,count]
    count+=2**(i-1)
  end
end

if L[0]==1
  edges << [1,20,count]
end

puts "20 #{edges.size}"
edges.each do |a,b,c|
  puts "#{a} #{b} #{c}"
end


Measured memory_bytes: 1788
n = int(input())
a = list(map(int, input().split()))

money = 1000
stock = 0

diff = ['-'] * n
for i in range(1, n):
    if a[i] < a[i - 1]:
        diff[i] = '-'
    elif a[i] > a[i - 1]:
        diff[i] = '+'
    elif a[i] == a[i - 1]:
        diff[i] = diff[i - 1]

for i in range(n - 1):
    if diff[i] == '-':
        if diff[i + 1] == '+':
            stock += money // a[i]
            money = money % a[i]
    elif diff[i] == '+':
        if diff[i + 1] == '-':
            money += stock * a[i]
            stock = 0
if stock > 0:
    money += stock * a[n - 1]

print(money)

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

#define MAX 2000003

int A[MAX];
int heap_size=0;

int Parent(int i){
  return i/2;
}
int Left(int i){
  return 2*i;
}
int Right(int i){
  return 2*i+1;
}

void maxHeapify(int i){
  int l,r,largest;
  int temp;
  
  l = Left(i);
  r = Right(i);
  
  
  if((l <= heap_size) && (A[l] > A[i])){
    largest = l;
  }
  else {
    largest = i;
  }
  
  if((r <= heap_size) && (A[r] > A[largest])){
    largest = r;
  } 
  
  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    
    maxHeapify(largest);
  } 
}

int heapExtractMax(void){
  int max,j;
  if(heap_size < 1){
    return -20;
  }
  max = A[1];
  A[1] = A[heap_size];
  heap_size = heap_size-1;

  maxHeapify(1);
  
  return max;
}

void heapIncreaseKey(int i,int key){
  int temp;
  if(key < A[i]){
    printf("error\n");
    exit(1);
  }
  
  A[i] = key;
  
  while((i > 1) && (A[Parent(i)] < A[i])){
    temp = A[i];
    A[i] = A[Parent(i)];
    A[Parent(i)] = temp;

    i = Parent(i);
  }
}

void maxHeapInsert(int key){
  heap_size = heap_size+1;
  A[heap_size] = -1000000000;
  heapIncreaseKey(heap_size,key);
}

int main(void){
  int i=1,j=0,max,a;
  char com[20];
  
  while(1){
    scanf("%s",com);  
    if(com[0] == 'i'){
      scanf("%d",&a);
      maxHeapInsert(a);
  
      //heap_size++;
    }
    
    else if(com[0] == 'e' && com[1] == 'x'){
      max = heapExtractMax();
      if(max == -20){
	exit(0);
      }
      printf("%d\n",max);
    }
    else {
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 4332
#include <bits/stdc++.h>
#include <iomanip>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  bool judge = 1;
  if(T.size() == S.size() + 1) {
    for(ll i = 0; i < S.size(); i++) {
      if(S.at(i) != T.at(i)) judge = 0;
    }
  }
  else judge = 0;
  if(judge) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3632
def abc_150_b
    n = gets.chomp.to_i
    s = gets.chomp

    cnt = 0
    st = 0
    s.each_char do |c|
        case c
        when 'A'
            #st = (st == 0) ? 1 : 0
            st = 1
        when 'B'
            st = (st == 1) ? 2 : 0
        when 'C'
            cnt += 1 if st == 2
            st = 0
        else
            st = 0
        end
    end

    puts cnt
end

abc_150_b

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, FN) for(ll i = 0; i < ( FN ); i++)

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> hp;
    FOR(i, n){
        ll temp;
        cin >> temp;
        hp.push_back(temp);
    }

    ll left = 0, right = 4000000000;
    while(right - left > 1) {
        ll mid = ( left + right ) / 2;
        ll sum = 0;
        FOR(i, n){
            if(hp[i] - b * mid > 0) sum += ( hp[i] - b * mid + ( a - b - 1 ) ) / ( a - b );
            if(sum > mid) break;
        }
        if(sum > mid) left = mid;
        else right = mid;
    }
    cout << right << endl;

    return 0;
}


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

using namespace std;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    for(auto c : s){
        char x=(c-'A'+n)%26 + 'A';
        cout << x;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;


struct edge
{
    int from;
    int to;
    int cost;
    edge(int from, int to, int cost) : from(from), to(to), cost(cost) {}
};
typedef vector<edge> Edges;

struct UnionFind
{
    vector< int > data;
    
    UnionFind(int sz){
        data.assign(sz, -1);
    }
    
    bool unite(int x, int y){
        x = root(x), y = root(y);
        if(x == y) return false;
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    
    int root(int k){
        if(data[k] < 0) return(k);
        return (data[k] = root(data[k]));
    }
    
    int size(int k){
        return -data[root(k)];
    }
};

int Kruskal(Edges &E, int V){
    sort(All(E), [](const edge &a, const edge &b) {
        return (a.cost < b.cost);
    });

    UnionFind MST(V);
    int res = 0;
    for(auto e: E){
        if(MST.unite(e.from, e.to)) res += e.cost;
    }

    return res;
}


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

    int N;
    cin >> N;
    vector<P> cityX, cityY;
    REP(i, N){
        int x, y;
        cin >> x >> y;
        cityX.pb(mp(x, i));
        cityY.pb(mp(y, i));
    }
    sort(All(cityX));
    sort(All(cityY));

    Edges E;
    REP(i, N-1) E.pb(edge(cityX[i].second, cityX[i+1].second, cityX[i+1].first - cityX[i].first));
    FOR(i, 1, N) E.pb(edge(cityX[i].second, cityX[i-1].second, cityX[i].first - cityX[i-1].first));

    REP(i, N-1) E.pb(edge(cityY[i].second, cityY[i+1].second, cityY[i+1].first - cityY[i].first));
    FOR(i, 1, N) E.pb(edge(cityY[i].second, cityY[i-1].second, cityY[i].first - cityY[i-1].first));

    cout << Kruskal(E, N) << "\n";
    return 0;
}

Measured memory_bytes: 19164
#include <cstdio>
using namespace std;
int f[60005];
int main(){
    int n,x,y,z,tmp,i;
    scanf("%d",&n);
    for(x=1;x<=100;x++){
        for(y=1;y<=100;y++){
            for(z=1;z<=100;z++){
                tmp=x*x+y*y+z*z+x*y+y*z+x*z;
                f[tmp]++;
            }
        }
    }
    for(i=1;i<=n;i++){
        printf("%d\n",f[i]);
    }
    return 0;
}


Measured memory_bytes: 1940
#include<iostream>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int e,ans;
	while(scanf("%d",&e),e){
		ans=e;
		int x;
		double d=sqrt(e)+1,g=pow(e,(double)1/3)+1;
		rep(y,d){
			rep(z,g){
				x=e-y*y-z*z*z;
				if(x<0)continue;
				ans=min(ans,x+y+z);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1268
#include <iostream>
#include <string>
#include <vector>
#include <map>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main(){
	int N, Q;
	cin >> N;
	map<LL, LL> count;
	LL sum = 0;
	REP(i, N) {
		int A;
		cin >> A;
		count[A]++;
		sum += A;
	}
	cin >> Q;
	REP(i, Q) {
		int B, C;
		cin >> B >> C;
		if(B != C) {
			sum += (C - B) * count[B];
			count[C] += count[B];
			count[B] = 0;
		}
		cout << sum << endl;
	}
}

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

int main() {
	long long x;
	int power=0;
	cin >> x;
	while (x>0)
	{
		power++;
		x=x>>1;
	}
	x=1;
	x=x<<power;
	x--;
	cout << x;
	return 0;
}

Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int a[303];
int cnt[4];
double dp[303][303][303];
bool flg[303][303][303];

double f(int c1, int c2, int c3){
    if(flg[c1][c2][c3])return dp[c1][c2][c3];
    flg[c1][c2][c3] = true;
    if(c1 == 0 && c2 == 0 && c3 == 0)return 0.0;
    double ret = 0.0;
    if(c1)ret += f(c1 - 1, c2, c3)*c1/(c1 + c2 + c3);
    if(c2)ret += f(c1 + 1, c2 - 1, c3)*c2/(c1 + c2 + c3);
    if(c3)ret += f(c1, c2 + 1, c3 - 1)*c3/(c1 + c2 + c3);
    ret += (double)(n)/(c1 + c2 + c3);
    return dp[c1][c2][c3] = ret;
}

int main(){
    cin >> n;
    REP(i, n){
        cin >> a[i];
        cnt[a[i]]++;
    }
    cout << fixed << setprecision(12) << f(cnt[1], cnt[2], cnt[3]) << endl;
}

Measured memory_bytes: 243968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
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; }



int main(){
    int r, c, k, a, b;
    cin >> r >> c >> k;
    vector<int> v(k), xx(k), yy(k);
    map<pair<ll, ll>, int > mp;
    rep(i, k){
        cin >> a >> b >> v.at(i);
        xx.at(i) = a;
        yy.at(i) = b;
        mp[make_pair(a, b)] = v.at(i);
    }
    vector<vector<vector<ll> > > dp(3005, vector<vector<ll> > (3005, vector<ll>(4, 0)));
    dp[0][0][0] = 0;
    rep2(x, 1, r+1){
        rep2(y,1, c+1){
            rep(count, 4){
                // アイテムが有る場合
                if(mp.count({x, y}) != 0 && count != 0){ // count == 0の場合には行内でアイテムを取得することができない
                    ll tmp = -1 * INF;
                    chmax(tmp, dp[x-1][y][3] + mp[{x, y}]); // 個数制限が多いものが最も数が大きくなっているはず(無条件でアイテム取得)
                    if(count > 0) chmax(tmp, dp[x][y-1][count-1] + mp[{x, y}]); // アイテムを取得する(count == 0だったらアイテムを取得できない)
                    chmax(tmp, dp[x][y-1][count]); // アイテムを取得しない場合
                    if(count > 0) chmax(tmp, dp[x][y][count-1]); // アイテムが一つ小さい場合よりは大きいはず
                    dp[x][y][count] = tmp;
                }

                // アイテムがない場合
                else {
                    ll tmp = -1 * INF;
                    chmax(tmp, dp[x][y-1][count]);
                    chmax(tmp, dp[x-1][y][3]);
                    if(count > 0) chmax(tmp, dp[x][y][count-1]);
                    dp[x][y][count] = tmp;
                }
            }
        }
    }
    /*
    rep(y, c+1){
        rep(x, r+1){
            rep(count, 4){
                cout << dp[x][y][count] << " ";
            }
            cout << "#";
        }
        cout << endl;
    */
    cout << dp[r][c][3] << endl;
}

Measured memory_bytes: 653208
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

public class Main{
	static Scanner sc;

	public static void main(String[] args) throws Exception {
		//InputStream in = new FileInputStream("src/input.txt");
		InputStream in = System.in;
		//PrintStream out = new PrintStream("src/output.txt");

		//System.setOut(out);

		sc = new Scanner(in);

		int N = sc.nextInt();
		int[] A = new int[N];

		int count = 1;

		for(int i = 0; i < N; i++){
			A[i] = sc.nextInt();
			if(A[i] % 2 == 0){
				count *= 2;
			}
		}

		System.out.println((int)((Math.pow(3, N))-count));

		//out.close();
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll x, a, b; cin >> x >> a >> b;
  if (abs(x-a) < abs(x-b)) {
    cout << "A" << endl;
  } else {
    cout << "B" << endl;
  }
  return 0;
}


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

int main(){
    int first,second,third;
    int number;
    
    first=0;
    second=0;
    third=0;
    
    for(int i=0;i<10;i++){
        cin >> number;
        if(number>first){
            third=second;
            second=first;
            first=number;
        }
        else if(number>second){
            third=second;
            second=number;
        }
        else if(number>third){
            third=number;
        }
    }
    
    cout << first << endl << second << endl << third << endl;

    return 0;
}


Measured memory_bytes: 3104