akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int a = 'A' - 0;
    rep(i,s.size()){
        int m = s[i] -0;
        int e = (m-a+n)%26;
        char p = e+a;
        cout << p;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,1,-1,1,-1,-1,0};
int dy[]={0,1,1,-1,-1,1,0,-1};



LL fpow(LL a, LL n){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}



int main(){
    int n;cin >> n;
    vector<LL> a(n);
    vector<LL> cnt(1000001,0);
    vector<vector<P>> ma(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        LL t = a[i];
        for (int j = 2; j * j <= a[i]; j++) {
            if(t % j) continue;
            LL tmp = 0;
            while(t % j == 0){
                tmp++;
                t /= j;
            }
            cnt[j] = max(cnt[j], tmp);
            ma[i].pb(mp(j, tmp));
        }
        if(t!=1){
            cnt[t] = max(cnt[t], 1LL);
            ma[i].pb(mp(t, 1));
        }
    }
    LL sum = 1;
    for (int i = 2; i <= 1000000; i++) {
        if(cnt[i]) sum = sum * fpow(i, cnt[i])%mod;
    }
    LL ans = 0;
    for (int j = 0; j < n; j++) {
        LL tmp = sum;
        for (int k = 0; k < ma[j].size(); k++) {
            tmp = tmp * fpow(fpow(ma[j][k].fs, ma[j][k].sc), mod - 2)%mod;
        }
        ans = (ans + tmp)%mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9728
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n, k;
    int snk[111] = {};
    scanf("%d %d", &n, &k);
    int d, a;
    for (int i = 0; i < k; i++)
    {
        scanf("%d", &d);
        for (int j = 0; j < d; j++)
        {
            scanf("%d", &a);
            snk[a] = 1;
        }
    }
    int ans = n;
    for (int i = 1; i <= n; i++)
    {
        if (snk[i] == 1)
        {
            ans--;
        }
    }
    printf("%d", ans);
    return 0;
}

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

int t = 1000000000;

int recur(int n,int c){
  if (c > t){
    return c;
  }
  if (n%2 == 0){
    return recur(n/2,c+1);
  }else{
    return c;
  }
}

int main(){
  int n;
  cin >> n;
  for (int i=0;i<n;i++){
    int a;
    cin >> a;
    int c;
    c = recur(a,0);
    if (c < t){
      t = c;
    }
  }
  cout << t << endl;
  return 0;
}



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

// aを常に小さい値にする
template<class T> void chmin(T &a, T b){ if(a>b) a = b; }

// 二分探索 前方のindexを返すもの（自分自身を含む） 前方: -INF側のこと
template<class T> int former(const vector<T> &v, T x){
    return upper_bound(v.begin(), v.end(), x) - v.begin() -1; // upper_bound : keyより大きい要素の内の一番左側のイテレータを返す
}
// 二分探索 後方のindexを返すもの（自分自身を含む）後方: INF側のこと
template<class T> int latter(const vector<T> &v, T x){
    return lower_bound(v.begin(), v.end(), x) - v.begin(); // lower_bound : key以上の要素の内の一番左側のイテレータを返す
}

/*
 *
 * */


int main() {

    int A, B, K;
    cin >> A >> B >> K;

    int count = 0;
    int res[100];
    for (int i = 100; i >= 1; --i) {
        if(A%i == 0&&B%i== 0){
            count++;
        }
        
        if(count == K){
            cout << i << endl;
            return 0;
        }
    }
}

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

const int MXN = 1e5 + 20;

int n, m, dp[MXN];
vector <int> e[MXN];

void npt() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		e[--a].push_back(--b);
	}
}

int gt(int v) {
	if (dp[v] != -1)
		return dp[v];
	int res = 0;
	for (auto i: e[v])
		res = max(res, gt(i) + 1);
	return dp[v] = res;
}

void slv() {
	for (int i = 0; i < n; i++) dp[i] = -1;
	int ans = 0;
	for (int i = 0; i < n; i++)
		ans = max(ans, gt(i));
	cout << ans << endl;
}

int main() {
	npt();
	slv();
	return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}

int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_V = 100+5;
typedef ll CAP;
const CAP INF = (ll)(1LL << 58);

struct Edge{ int dst; CAP cap; int rev; };
vector<Edge> adj[MAX_V];
int level[MAX_V];
int done[MAX_V];
void clearedge() { REP(i, MAX_V) adj[i].clear(); }
void addedge(int u, int v, CAP c1, CAP c2) {
  adj[u].push_back( (Edge){v, c1, (int)adj[v].size() + (u == v)} );
  adj[v].push_back( (Edge){u, c2, (int)adj[u].size() - 1} );
}

CAP dinic_dfs(int v, CAP flow, int t) {
  if (v == t || flow == 0) return flow;
  for ( ; done[v] < (int)adj[v].size(); done[v]++) {
    Edge &e = adj[v][done[v]];
    if (level[v] >= level[e.dst]) continue;
    CAP f = dinic_dfs(e.dst, min(flow, e.cap), t);
    if (f > 0) {
      e.cap -= f;
      adj[e.dst][e.rev].cap += f;
      return f;
    }
  }
  return 0;
}

bool dinic_bfs(int s, int t) {
  memset(level, -1, sizeof(level));
  queue<int> q; q.push(s); level[s] = 0;
  while (!q.empty()) {
    int here = q.front(); q.pop();
    for (const Edge &e : adj[here]) {
      if (e.cap > 0 && level[e.dst] == -1) {
        level[e.dst] = level[here] + 1;
        q.push(e.dst);
      }
    }
  }
  return level[t] >= 0;
}

CAP dinic(int s, int t) {
  CAP res = 0;
  while (dinic_bfs(s,t)) {
    memset(done, 0, sizeof(done));
    for (CAP f; (f = dinic_dfs(s, INF, t)) > 0; ) res += f;
  }
  return res;
}

ll A[100];

int main2() {
  clearedge();
  int N = nextInt();
  REP(i, N) A[i] = nextInt();

  int s = 0;
  int t = N+1;
  REP(i, N) {
    if (A[i] < 0) {
      addedge(s, i+1, -A[i], 0);
    }
    if (A[i] > 0) {
      addedge(i+1, t, A[i], 0);
    }
  }

  for (int i = 1; i <= N; i++) {
    for (int j = i * 2; j <= N; j += i)
      addedge(i, j, INF, 0);
  }

  ll base = 0;
  REP(i, N) base += max(0LL, A[i]);
  ll ans = base - dinic(s, t);
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



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

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

    long long countOfTen = 0;
    if (n > 9 && n % 2 == 0)
    {
        long long count = n / 10, devideByNum = 10;
        while (count > 0)
        {
            countOfTen += count;
            devideByNum *= 5;
            count = n / devideByNum;
        }
    }

    cout << countOfTen << endl;
}

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

vector<long long> g,s;
int si[300000] = {0};
int ok(int n){
	return n%7 == 1 || n % 7 == 6;
}
int ert(int n){
	for(int i = 1 ; g[i]*g[i] < n ; i++){
		if(!si[g[i]]){
			for(long long j = g[i]*g[i] ; j < n ; j += g[i]){
				si[j] = 1;
			}
		}
	}
}

int main(){
	for(int i = 0 ; i < 300000 ; i++)
		if(ok(i))g.push_back(i);
	ert(300000);
	for(int i = 1 ; i < g.size() ; i++)
		if(!si[g[i]]) s.push_back(g[i]);
	int n;
	while(cin >> n && n != 1){
		cout << n << ":";
		for(int i = 0 ; i < s.size() ; i++){
			if(n%s[i]==0) cout << " " << s[i];
		}
		cout << endl;
	}
	
}

Measured memory_bytes: 3168
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a,int b){return a*b/gcd(a,b);}

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int x, y;
    cin >> x >> y;
    cout << x+y/2 << endl;
}

Measured memory_bytes: 256
n = int(input())
s1 = input()
d = {}

for i in range(len(s1)):
    if s1[i] in d:
        d[s1[i]] += 1
    else:
        d[s1[i]] = 1

for i in range(n-1):
    di = {}
    s = input()
    for i in range(len(s)):
        if s[i] in di:
            di[s[i]] += 1
        else:
            di[s[i]] = 1

    delete = []
    for key, value in d.items():
        if key in di:
            d[key] = min(value, di[key])
        else:
            delete.append(key)

    for key in delete:
        del d[key]

ans = ""

for key, value in sorted(d.items()):
    ans += key*value

print(ans)

Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)

int N, Q;
int S[1000000];
vector<int> T;
multiset<int> L;

bool check(int r, int X) {
  int dame = 0;
  int pre = 0;
  for(int l : L) {
    int lb = lower_bound(T.begin(), T.end(), l - r) - T.begin();
    dame += max(0, lb - pre);
    pre = upper_bound(T.begin(), T.end(), l) - T.begin();
  }
  dame += N - pre;
  return dame <= X;
}

int main() {
  ios::sync_with_stdio(false);
  cin >> N >> Q;
  REP(i,N) cin >> S[i];
  T = vector<int>(S, S + N);
  sort(T.begin(), T.end());
  while(Q--) {
    string query; int arg; cin >> query >> arg;
    if(query == "ADD") {
      --arg; L.insert(S[arg]);
    }
    else if(query == "REMOVE") {
      --arg; L.erase(L.find(S[arg]));
    }
    else {
      int r = 1 << 30, sub = 1 << 30;
      while(sub > 0) {
        if(r - sub >= 0 && check(r - sub, arg)) r -= sub;
        else sub /= 2;
      }
      if(r == 1 << 30) cout << "NA" << endl;
      else cout << r << endl;
    }
  }
}

Measured memory_bytes: 8852
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    string a[51],b[51];

    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<m;i++) cin >> b[i];

    for(int i=0 ; i<=n-m ; i++){
        for(int j=0 ; j<=n-m ; j++ ){
            bool isOK = true;
            for(int k=0 ; k < m ; k++){
                if(a[i+k].substr(j,m)!=b[k].substr(0,m)) {isOK=false;break;}
            }
            if(isOK){Yes(1);return 0;}
        }
    }
    Yes(0)
}

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

int main() {
  int a,b,c,x;
  cin>>a>>b>>c;
  x=a*c-b;
  cout << x << endl;
  for(int i=0;i<9;i++){
    x = x*a-b;
    cout << x <<endl;
  }
  
  
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
int H = sc.nextInt();
int W = sc.nextInt();
char[][] s=new char[H][W];
for(int i=0;i<H;i++){
    String p = sc.next();
    for(int j=0;j<W;j++){
        s[i][j]=p.charAt(j);
    }
}
int[] dx={0,1,0,-1};
int[] dy={1,0,-1,0};
for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
        int c=0;
        if(s[i][j]=='#'){
            for (int k = 0; k < 4; k++) {
                int x=j+dx[k];
                int y=i+dy[k];
                if(0<=x&&x<W&&0<=y&&y<H){
                    if(s[y][x]=='#')c++;
                }
            }
            if(c==0){
                out.println("No");exit(0);
            }
        }
    }
}
    out.println("Yes");
}}

Measured memory_bytes: 22736
#include <iostream>
int main(void)
{
  int h, w;
  while (1) {
    std::cin >> h >> w;
    if (h == 0 && w == 0) break;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        std::cout << "#"; 
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
}

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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll inf = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/


int main(){
    fIO

    int n;
    cin >> n;

    map<string, ll> mp;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        int cnt[26] = {};
        for(auto ch : s){
            cnt[ch - 'a']++;
        }
        string temp;
        for(int i = 0; i < 26; i++){
            temp += to_string(cnt[i]);
        }
        //cout << temp << "\n";
        mp[temp]++;
    }

    ll ans = 0;
    for(auto it : mp){
        ans += it.second * (it.second - 1) / 2;
    }
    cout << ans;
}









Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    string s;cin>>s;
    For(i,0,s.size()) cout<<"x";
    cout<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


ll n, s[210][210], cnt, c[210];
vector<ll> g1[210];
bool ok = true;
bool used[210];
ll ans;

void dfs(ll a, ll b) {
	c[a] = b;
	REP(i, g1[a].size()) {
		if (c[g1[a][i]] == 0) {
			dfs(g1[a][i], 3 - c[a]);
		}
		else if (c[g1[a][i]] != 3 - c[a]) ok = false;
	}
	
}



ll d[210]; // 結果
struct edge { ll to, cost; };
vector<edge> g[210]; //隣接リスト to, cost
void dijkstra(ll a) {
	priority_queue<P, vector<P>, greater<P> > q;
	fill(d, d + n, INF);
	d[a] = 0;
	q.push(P(0, a));
	while (!q.empty()) {
		P p = q.top();
		q.pop();
		ll v = p.second;
		if (d[v] < p.first) continue;
		REP(i, g[v].size()) {
			edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				q.push(P(d[e.to], e.to));
			}
		}
	}
}
int main() {
	cin >> n;
	REP(i, n) {
		string r;
		cin >> r;
		REP(j, n) {
			s[i][j] = r[j] - '0'; 
			if (s[i][j] == 1) {
				g1[i].push_back(j);
				g[i].push_back({ j,1 });
			}
		}
	}
	dfs(0, 1);
	if (!ok) {
		cout << -1 << endl;
		return 0;
	}
	REP(i, n) {
		dijkstra(i);
		REP(j, n) {
			ans = max(ans, d[j]);
		}
	}
	cout << ans + 1 << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define int long long int

using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e18;
const double PI = acos(-1);
const int MOD = 1e9 + 7;

int n, l;
int a[100010];
VI ans;
signed main()
{
  cin >> n >> l;
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }

  int num = -1;
  for(int i = 1; i <= n - 1; i++){
    if(a[i] + a[i + 1] >= l){
      num = i;
    }
  }

  if(num == -1){
    cout << "Impossible" << endl;
  }
  else{
    for(int i = num; i <= n - 1; i++){
      ans.PB(i);
    }
    for(int i = num - 1; i >= 1; i--){
      ans.PB(i);
    }

    cout << "Possible" << endl;
    for(int i = ans.size() - 1; i >= 0; i--){
      cout << ans[i] << endl;
    }
  }
  /*
  int left = 1, right = n - 1;
  while(true){
    if(left != right){
      if(a[left] < a[right + 1]){
	ans.PB(left++);
      }
      else{
	ans.PB(right--);
      }
    }
    else{
      ans.PB(left);
      if(a[left] + a[right + 1] >= l){
	cout << "Possible" << endl;
	for(int i = 0; i < ans.size(); i++){
	  cout << ans[i] << endl;
	}
      }
      else{
	cout << "Impossible" << endl;
      }
      break;
    }
  }
  */
  return 0;
}


Measured memory_bytes: 2548
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

ll polyhash(string S, ll x, ll p) {
    int slen = S.size();
    ll hash = 0;
    for (int i = slen - 1; i >= 0; i--) {
        hash = (hash * x + (ll)S[i]) % p;
    }
    return hash;
}

void preComputeHashes(string S, ll x, ll p, int len, vector<ll>& res) {
    int slen = S.size();
    string sub = S.substr(slen - len, len);
    res[res.size() - 1] = polyhash(sub, x, p);
    ll y = 1;
    rep(i, len) y = (y * x) % p;

    for (int i = slen - len - 1; i >= 0; i--) {
        res[i] = (((x * res[i + 1] + S[i] - y * S[i + len]) % p) + p) % p;
    }
}

void findSubStr(string S, string P, vector<int>& res) {
    ll p = 1000000009;
    ll x = 263;
    ll phash = polyhash(P, x, p);
    int slen = S.size();
    int plen = P.size();
    vector<ll> thashes(slen - plen + 1);
    preComputeHashes(S, x, p, plen, thashes);

    rep(i, slen - plen + 1) {
        if (phash == thashes[i]) res.push_back(i);
    }
}

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

    string T, P;
    cin>>T>>P;
    vector<int> res;
    if (T.size() >= P.size()) {
        findSubStr(T, P, res);
    }
    rep(i, res.size()) cout<<res[i]<<endl;
}


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

#define rep(i,l,n) for(int (i)=(l);(i)<(n);(i)++)
#define min(a,b) (a)<(b)?(a):(b)
#define max(a,b) (a)>(b)?(a):(b)
#define abs(a) (a)>0?(a):-(a)
#define llong long long

int main(){
	int N; scanf("%d",&N);
	N++;
	llong cnt=0;
	rep(i,1,N){
		if( i%3 && i%5 ) cnt+=i;
	}
	printf("%lld",cnt);
	return 0;
}


Measured memory_bytes: 1732
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let C = 1e9 + 7;
	let C2 = 1e5;
	let N = parseInt(input[0][0], 10);
	let v_A = input[1].map(e => parseInt(e, 10));

	let v_TF = Array.from({length: 1e6}, () => true);
	for (let i = 2;  i <= 1e6 / 2; i++){
		for (let j = 2; j <= 1e6 / i; j++){
			v_TF[i * j - 1] = false;
		}
	}
	v_TF[0] = false;
	let v_prime = [];
	for (let i = 1; i < v_TF.length; i++){
		if (v_TF[i]) v_prime.push(i + 1);
	}
	const lowerBound = (arr, n) => {
		let first = 0, last = arr.length - 1, middle;
		while (first <= last) {
			middle = 0 | (first + last) / 2;
			if (arr[middle] < n) first = middle + 1;
			else last = middle - 1;
		}
		return first;
	}

	//calculate saishokobaisu
	let v_howManyTimes = Array.from({length: v_prime.length}, () => 0);
	let tmp;
	let arr_soinsu = Array.from({length: N}, () => []);
	whole_loop:
	for (let i = 0; i < N; i ++){
		tmp =  v_A[i];
		for (let j = 0; j < v_prime.length; j++){
			let count = 0;
			if (v_TF[tmp - 1]) { // check whether tmp is prime number
				arr_soinsu[i].push([tmp, 1])
				v_howManyTimes[lowerBound(v_prime, tmp)] = Math.max(v_howManyTimes[lowerBound(v_prime, tmp)], 1);
				continue whole_loop;
			} 
			while (tmp % v_prime[j] === 0){
				tmp /= v_prime[j];
				count ++;
			}
			if (count !== 0) arr_soinsu[i].push([v_prime[j], count]);
			v_howManyTimes[j] = Math.max(v_howManyTimes[j], count);
			if (tmp === 1) continue whole_loop;
		}
	}

	let P = 1;
	for (let i = 0; i < v_prime.length; i ++){
		for (let j = 1; j <= v_howManyTimes[i]; j ++){
			P = kakeruR(P, v_prime[i], C, C2);
		}
	}

	//calculate inverse
	let v_INV = INV(1e6, C, C2);

	//calculate ans

	let ans = 0;
	for (let i = 0; i < N; i ++){
		tmp = P;
		// for (let j = 0; j < v_prime.length; j ++){
		// 	if (arr_soinsu[i][j] !== 0){
		// 		for (let k = 1; k <= arr_soinsu[i][j]; k ++){
		// 			tmp = kakeruR(tmp, v_INV[v_prime[j]], C, C2);
		// 		}
		// 	}
		// }
		for (let x of arr_soinsu[i]){
			for (let k = 1; k <= x[1]; k ++){
				tmp = kakeruR(tmp, v_INV[x[0]], C, C2);
			}
		}
		ans += tmp;
		ans %= C;
	}
	console.log(ans); 
}

function  INV(n, MOD, C2) { //return [0!^-1, 1!^-1, 2!^-1, ..., n!^-1]
    let inv;
    inv = [0,1];
    for (var i = 2; i <= n; i++){
        inv.push(MOD - kakeruR(inv[MOD%i], (MOD / i | 0), MOD, C2) % MOD);
    }
    return inv;
}

function kakeruR(a, b, C, C2){
    var tmpQ, tmpR, ans;
    tmpQ = (b / C2 | 0);
    tmpR = b - (tmpQ * C2);
    ans = (a * tmpQ % C) * C2 % C + (a * tmpR);
    ans %= C;
    return ans;
}

// function saishoKobai(x, y){
//     if (x < y) [x, y] = [y, x];
//     var tmp1 = x;
//     var tmp2 = y;
//     while (tmp2 != 0){
//         [tmp1, tmp2] = [tmp2, tmp1 % tmp2];
//     }
//     return (BigInt(x) * BigInt(y) / BigInt(tmp1));
// }



Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 80564
def main():
	# n,k = map(int,input().split())
	# n = int(input())
	s = str(input())
	# a = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	s = list(s)
	ans = 0
	for i in range(len(s)):
		# print(s[i])
		# print(len(s[i]) % 2)
		if i % 2 == 0:
			if s[i] == 'L':
				ans = 1
		else:
			if s[i] == 'R':
				ans = 1
	if ans == 0:
		print("Yes")
	else:
		print("No")





if __name__ == '__main__':
	main()

Measured memory_bytes: 38256
#include<iostream>
#include<math.h>
using namespace std;

long N, P;

void eratos(long primes[], long size) {
    for (long i=1; i<size; i++) {
        if (primes[i]==1) {
            long t = 1;
            while (i+t*(i+1)<size) {
                primes[i+t*(i+1)] = 0;
                t += 1;
            }
        }
    } 
}

void prime_factorization(long fact[], long primes[], long size) {
    long d = P;
    for (long i=1; i<size; i++) {
        if (primes[i]==1) {
            long tmp = pow((i+1),N);
            while (d%tmp ==0) {
                fact[i] += 1;
                d /= tmp;
            }
        }
        if (d==0) {
            return;
        }
    }
}

long mul_vec(long fact[], long size) {
    int gcd = 1;
    for (long i=1; i<size; i++) {
        if (fact[i]>0) {
            gcd *= pow(i+1, fact[i]);
        }
    }
    return gcd;
}

int main() {
    cin >> N >> P;
    if (N==1) {
        cout << P << endl;
        return 0;
    }

    long n = ceil(pow(P, 1.0/N));

    long primes[n]; // Binary for the prime indices
    primes[0] = 0;
    for (long i=1; i<n; i++) {
        primes[i] = 1;
    }
    eratos(primes, n);

    long fact[n]; // Prime factorization of P^(1/N)
    for (long i=0; i<n; i++) {
        fact[i] = 0;
    }
    prime_factorization(fact, primes, n);

    long gcd = mul_vec(fact, n);
    cout << gcd << endl;
    return 0;
}

Measured memory_bytes: 13952
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	vector<int> H(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i];
	}
	vector<int> dp(N);
	for (int i = 1; i < N; ++i) {
		dp[i] = dp[i - 1] + abs(H[i - 1] - H[i]);
		for (int j = i - 2; j >= i - K && j >= 0; --j) {
			dp[i] = min(dp[i], dp[j] + abs(H[j] - H[i]));
		}
	}
	cout << dp[N - 1] << '\n';
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	
	int year = 2004;
	int month = sc.nextInt();
	int day = sc.nextInt();
	while(month!=0){
	    year = 2004;
	    if(month==1 || month==2){
		year--;
		month += 13;
	    }else{month += 1;}
	    
	    int a = (int)(year*365.25);
	    int b = (int)(month*30.6);
	    int c = year/400;
	    int d = year/100;
	    int e = a+b+c+day-d-429;
	    int f = (int)(e/7)*7;
	    int ans = e-f;
	    
	    String today = "";
	    if(ans==0){today = "Monday";}
	    if(ans==1){today = "Tuesday";}
	    if(ans==2){today = "Wednesday";}
	    if(ans==3){today = "Thursday";}
	    if(ans==4){today = "Friday";}
	    if(ans==5){today = "Saturday";}
	    if(ans==6){today = "Sunday";}
	    
	    System.out.println(today);

	    month = sc.nextInt();
	    day = sc.nextInt();
	}
    }
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}/*swap 交換*/
ll max2(ll a,ll b){return a>=b?a:b;}/*2つのうち大きい数を返す*/ 
ll min2(ll a,ll b){return a>=b?b:a;}/*2つのうち小さい数を返す*/ 
ll ABS(ll a){return a>=0?a:(-a);}/*絶対値*/ 
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;
/*aのb進数時の桁数*/
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
/*nを2進数にしたときの、i桁目の数*/
ll placen2i(ll n, ll i){return i==1?n%2:placen2i(n/2,i-1);}
// ll xor(ll a, ll b){
//     ll d=digits(max2(a,b),2),i,x=0;
//     rep(i,1,d){
//         x+=
//     }
// }
int main(void){
    ll n;
    scanf("%lld",&n);
    ll a[n],d[n],md=0,b=0,s=0;
    rep(i,0,n){
        scanf("%lld",&a[i]);
        d[i]=digits(a[i],2);
        md=max2(md,d[i]);
        s+=a[i];
    }
    rep(i,0,n){
        if(d[i]==md) b++;
    }
    if(md==1){
        if(s==0 || (n%3==0&&s==n/3*2)){
            printf("Yes\n");
            return 0;
        }else{
            printf("No\n");
            return 0;
        }
    }
    // rep(i,0,n){
    //     printf("%lld ",d[i]);
    // }
    if(b!=n/3*2 || n%3!=0){
        printf("No\n");
        return 0;
    }
    sortup(a,n);
    rep(i,1,md){
        if( ABS(placen2i(a[0],i)-placen2i(a[n/3],i))  != placen2i(a[n/3*2],i)){
            printf("No\n");
            return 0;
        }
    }
    rep(i,0,n/3-1){
        if(a[0+i]!=a[0+i+1]){
            printf("No\n");
            return 0;
        }
        if(a[n/3+i]!=a[n/3+i+1]){
            printf("No\n");
            return 0;
        }
        if(a[n/3*2+i]!=a[n/3*2+i+1]){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 2428
from collections import deque
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
edge = [[] for _ in range(n)]
mat = [[1000] * n for _ in range(n)]
for i in range(n):
    s = input().rstrip()
    for j, ch in enumerate(s):
        if ch == "1":
            mat[i][j] = 1
            if j > i:
                edge[i].append(j)
                edge[j].append(i)
for i in range(n):
    mat[i][i] = 0
for k in range(n):
    for i in range(n):
        for j in range(n):
            mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j])

ans = 0
dq = deque()
dist = [-1] * n
dq.append((0, 0))
ok = True
while dq:
    v, d = dq.popleft()
    if dist[v] == d:
        continue
    if dist[v] == -1:
        dist[v] = d
    else:
        ok = False
        break
    for item in edge[v]:
        if dist[item] == -1:
            dq.append((item, d+1))

if ok:
    ans = 0
    for line in mat:
        ans = max(ans, max(line))
    print(ans + 1)
else:
    print(-1)

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

int main(){
  int N;
  cin >> N ;
  
  for (int i=0;i<=N;i++){
    if (floor(i*1.08) == N){
      cout << i << endl;
      break;
    }
    else if(i==N){
      cout << ":(" << endl;
    }
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    string a[16] = {"AKIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR", "AKIHBRA", "AKIHBAR", "AKIHBR", "AKIHABR", "KIHBR", "KIHBRA", "KIHBAR", "KIHBARA", "KIHABR", "KIHABRA", "KIHABAR", "KIHABARA"};
 
    for (int i = 0; i < 16; i++) {
        if (S == a[i]) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)

S = 1000 # satsu

def 関数(n):
    res = n % S
    if res == 0:
        return res
    else: 
        res = S - res
        return res

def çözmek():
    N = int(input())
    res = []
    res.append(関数(N))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


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

class DisjointSet {
	public:
		vector<int> rank, p;
		DisjointSet() {};
		DisjointSet(int size) {
			rank.resize(size, 0);
			p.resize(size, 0);
			for (int i = 0; i < size; i++) makeSet(i);
		}

		void makeSet(int x) {
			p[x] = x;
			rank[x] = 0;
		}

		bool same(int x, int y) {
			return findSet(x) == findSet(y);
		}

		void unite(int x, int y) {
			link(findSet(x), findSet(y));
		}

		void link(int x, int y) {
			if (rank[x] > rank[y]) {
				p[y] = x;
			}
			else {
				p[x] = y;
				if (rank[x] == rank[y]) rank[y]++;
			}
		}

		int findSet(int x) {
			if (x != p[x]) {
				p[x] = findSet(p[x]);
			}
			return p[x];
		}
};

class Edge {
	public:
		int source, target, cost;
		Edge(int source = 0, int target = 0, int cost = 0) :
			source(source), target(target), cost(cost) {}
		bool operator < (const Edge &e) const {
			return cost < e.cost;
		}
};

int kruskal(int N, vector<Edge> edges) {
	int totalCost = 0;
	sort(edges.begin(), edges.end());
	DisjointSet dset = DisjointSet(N + 1);
	for (int i = 0; i < N; i++) dset.makeSet(i);
	int source, target;
	for (int i = 0; i < edges.size(); i++) {
		Edge e = edges[i];
		if (!dset.same(e.source, e.target)) {
			totalCost += e.cost;
			dset.unite(e.source, e.target);
		}
	}
	return totalCost;
}

int main(void) {
	int N, M, cost;
	int source, target;
	cin >> N >> M;
	vector<Edge> edges;
	for (int i = 0; i < M; i++) {
		cin >> source >> target >> cost;
		edges.push_back(Edge(source, target, cost));
	}
	cout << kruskal(N, edges) << endl;
	return 0;
}


Measured memory_bytes: 5432
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int dp[105][105][2];int k;
int calc(int pos,int cnt,int flag,vi num)
{
    if(pos == num.size())
    {
        if(cnt == k)
            return 1;
        else
            return 0;
    }
    if(dp[pos][cnt][flag]!=-1)return dp[pos][cnt][flag];
    int limit=(flag? 9 : num[pos]);
    int ans=0;
    for(int i=0;i<=limit;i++)
    {
        int currcnt=cnt;
        if(i!=0)currcnt++;
        int currflag=flag;
        if(i < num[pos])
            currflag=1;
        ans+=calc(pos + 1,currcnt,currflag,num);
    }
    return dp[pos][cnt][flag]=ans;
}
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   string s;
   cin>>s;
   cin>>k;
   memset(dp,-1,sizeof(dp));
   vi num;
   for(int i=0;i<s.length();i++)
   {
       int x = s[i] - '0';
       num.pb(x);
   }
   cout<<calc(0,0,0,num)<<endl;

}



Measured memory_bytes: 512
#include <iostream>
#include <queue>

using namespace std;
#define out(v) cout<<v<<"\n"
#define rep(i,n) for(int i=0;i<(n);++i)

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

  int P[N], Q[N];
  rep(i, N) cin >> P[i];
  rep(i, N) Q[P[i]-1] = i;

  int tmp = 0, count = 1;
  rep(i, N-1) {
    if (Q[i] < Q[i+1]) {
      ++count;
    } else {
      tmp = max(tmp, count);
      count = 1;
    }
  }
  tmp = max(tmp, count);
  out(N - tmp);
  return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
#include <iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
typedef pair<string,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
const ll MODatc = 1000000007;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
bool pairCompare2(P firstElof,P secondElof){
    return (firstElof.second)%1000>(secondElof.second)%1000;
}
bool less_mod1000(int lhs, int rhs) {
  if ((lhs - rhs) % 1000 != 0)
    return lhs % 1000 < rhs % 1000;
  else // 5で割った余りが等しいなら普通に大小比較する
    return lhs < rhs;
}
string A="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string a="abcdefghijklmnopqrstuvwxyz";
ll dp[107000];
ll jump(ll start,ll goal){
  if(dp[start]>=0)return dp[start];
  if(start==goal){
    return 1;
  }elif(start>goal){
    return 0;
  }
  return dp[start]=(jump(start+1,goal)+jump(start+2,goal))%MODatc;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll l,r;cin>>l>>r;
    ll dst=r-l;
    if(dst>=2019){
      cout<<0<<endl;
      return 0;
    }
    ll ans=INF;
    rep(i,l,r+1){
      rep(j,l,i){
        ans=min(i*j%2019,ans);
      }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 2000000;
const int inf = 1000000007;
const ll mod = 1000000007;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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



ll n, ans;

int main() {

	cin >> n;

	rrep(i, n) {
		if (i % 3 != 0 && i % 5 != 0)ans += i;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
    

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

  bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
  {

    if(a.s==b.s)
    {
      return a.f<b.f;
    }
    return a.s<b.s;
  }

  map<int,int> mp;
  int32_t main()
  {         
    

      IOS

        
       int n;
       cin>>n;
       int arr[n];
       for(int i=0;i<n;i++)
       {
        cin>>arr[i];
        mp[arr[i]]++;
       }


       int ans=0;

       for(auto i:mp)
       {
        if(i.s>=i.f)
        {
          ans+=i.s-i.f;
        }
        else
        {
          ans+=i.s;
        }
       }

       cout<<ans;

      return 0;
  }           

Measured memory_bytes: 7040
// Shift-JIS（シフトジス）

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

int gcd(int a, int b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    if (A <= 8 && B <= 8)
    {
        cout << "Yay!" << endl;
    }
    else
    {
        cout << ":(" << endl;
    }   
}

Measured memory_bytes: 256
////////////////////////////////////////////    _LeMur_
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 200005;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;

int n , q;
vector <int> g[N];

int cnt[N];

void dfs(int v,int p){
    for(int i=0;i<(int)g[v].size();i++){
        int to = g[v][i];
        if(to == p)continue;
        cnt[to] += cnt[v];
        dfs(to , v);
    }
}

int main(){
	mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
	cin >> n >> q;
	for(int i=1;i<n;i++){
        int a , b;
        scanf("%d%d",&a,&b);
        g[a].push_back(b);
        g[b].push_back(a);
	}
	for(int i=1;i<=q;i++){
        int v , x;
        scanf("%d%d",&v,&x);
        cnt[v] += x;
	}
	dfs(1 , -1);
	for(int i=1;i<=n;i++){
        printf("%d ",cnt[i]);
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 23552
S = input()
T = input()

trans_dict = {}

for i in range(len(S)):
    s = S[i]
    t = T[i]

    if s in trans_dict:
        if not trans_dict[s] == t:
            print('No')
            exit()
    else:
        trans_dict[s] = t

if len(trans_dict.values()) == len(set(trans_dict.values())):
    print('Yes')
else:
    print('No')


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n,m;
    cin >> n >> m;

    vector<vector<int>> edge(n + 1);

    rep(i, m){
        int a, b;
        cin >> a >> b;

        edge[a].pback(b);
        edge[b].pback(a);
    }

    typedef pair<int, pair<int,int>> state;

    priority_queue<state, vector<state>, greater<state>> pq;
    vector<int> prev(n + 1, -1);

    pq.push(mpair(0, mpair(0, 1)));

    while(!pq.empty()){
        int step = pq.top().first;
        int from = pq.top().second.first;
        int node = pq.top().second.second;

        if(prev[node] == -1){
            prev[node] = from;

            rep(i, edge[node].size()){
                pq.push(mpair(step + 1, mpair(node, edge[node][i])));
            }
        }

        pq.pop();
    }

    cout << "Yes" << endl;

    rep(i, n - 1){
        cout << prev[i + 2] << endl;
    }
    return 0;
}


Measured memory_bytes: 16260
/*
螺旋本 p371

circumcenter:
    https://ja.wikipedia.org/wiki/%E5%A4%96%E6%8E%A5%E5%86%86#%E5%A4%96%E5%BF%83%E3%81%AE%E4%BD%8D%E7%BD%AE
    https://mathtrain.jp/goshin
*/
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 55
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

//http://drken1215.hatenablog.com/entry/2020/01/26/164200

int N,M;
vector<P> V[55];
vector<int> us,vs;

bool rec(int v,int p,int target,ll &path){
    if(v==target){
        path=0;
        return true;
    }
    for(auto e:V[v]){
        if(e.first==p) continue;
        if(rec(e.first,v,target,path)){
            path|=(1LL<<e.second);
            return true;
        }
    }
    return false;
}

signed main(){
    cin>>N;
    for(int i=0;i<N-1;i++){
        int x,y;
        cin>>x>>y;
        x--; y--;
        V[x].emplace_back(y,i);
        V[y].emplace_back(x,i);
    }
    cin>>M;
    us.resize(M),vs.resize(M);
    for(int i=0;i<M;i++){
        cin>>us[i]>>vs[i];
        us[i]--; vs[i]--;
    }
    vector<ll> paths(M,0);
    for(int i=0;i<M;i++){
        rec(us[i],-1,vs[i],paths[i]);
    }
    ll res=0;
    for(ll S=0;S<(1<<M);S++){
        ll val=0;
        for(int i=0;i<M;i++){
            if(bit(S,i)) val|=paths[i];
        }
        ll nokori=N-1-__builtin_popcountll(val);
        if(__builtin_popcountll(S)%2==0){
            res+=1LL<<nokori;
        }else res-=1LL<<nokori;
    }
    cout<<res<<endl;
}

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

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n, int g) {
    for(int i = g; i < n; i++) {
        int t = A[i];
        int j = i - g;
        while(j >= 0 && t < A[j]) {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = t;
    }
}

void shellSort(int A[], int n)  {
    for(int h = 1; ; ) {
        if(h > n) break;
        G.push_back(h);
        h = h * 3 + 1;
    }

    for(int i = G.size() - 1; i >= 0; i--) {
        insertionSort(A, n, G[i]);
    }
}

int main() {
    cin >> n;
    for(int i = 0; i < n; i++) scanf("%d", &A[i]);
    cnt = 0;

    shellSort(A, n);

    cout << G.size() << endl;
    for(int i = G.size() - 1; i >= 0; i--) {
        cout << G[i];
        if(i) cout << " ";
    }
    cout << endl;
    cout << cnt << endl;
    for(int i = 0; i < n; i++) {
        cout << A[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 7112