akhauriyash/Code-Regression huggingface dataset:
//Author:- S_Aditya

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const ll mod=1e9+7;         
const int N=1e5+4;

int main()                  
{
    int n;
    
    scn(n);
    
    int dp[n][3];
    
    memset(dp,0,sizeof(dp));
    
    rep(i,0,n)
    {
        rep(j,0,3)
        {
            int val;
            
            scn(val);
            
            if(i==0)
            dp[i][j]=val;
            else
            {
                rep(k,0,3)
                if(k!=j)
                dp[i][j]=max(dp[i][j],dp[i-1][k]);
                
                dp[i][j]+=val;
            }
        }
    }
    
    int ans=max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
    
    pri(ans);
    
} 

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

int main(){
    int X;
    int result = 0;
    cin >> X;

    while(true){
        if(X/500 != 0){
            X -= 500;
            result += 1000;
        }
        else if(X/5 != 0){
            X -= 5;
            result += 5;
        }
        else{
            break;
        }
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

int main() {
  int N;cin >> N;
  vll A(N),B(N);
  ll minB=INF;
  ll sum = 0;
  repeat(i,N){
    cin >> A[i] >> B[i];
    if(A[i]>B[i]){
      if(minB>B[i]){
        minB = B[i];
      }
    }
    sum += A[i];
  }
  ll ans = minB==INF? 0:sum - minB;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    vector<pii> v(m);
    REP(i,m) cin >> v[i].second >> v[i].first;
    
    sort(RALL(v));
    deque<int> bs,be;
    REP(i,m) {
        auto it = lower_bound(ALL(be),v[i].first);
        int d = distance(be.begin(),it);
        if (it == be.end() || bs[d] >= v[i].first) {
            //cerr << v[i].second << " " << v[i].first << endl;
            be.push_front(v[i].first);
            bs.push_front(v[i].second);
        } else {
            if (be[d] > v[i].first) be[d] = v[i].first;
            if (bs[d] < v[i].second) bs[d] = v[i].second;
        }
        //cerr << be.size() << endl;
    }

    OUT(be.size())

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
int main(){
int n,m;
cin>>n>>m;
priority_queue<P,vector<P>,greater<P>> pq;
for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    pq.push(P(a,b));
}
int l=0,r=0,cnt=0;
while(!pq.empty()){
    P p=pq.top();
    pq.pop();
    if(l==0&&r==0){l=p.fi;r=p.se;}
    else if(r<=p.fi){
          cnt++;l=p.fi;r=p.se;
    }
    else if(l<p.fi||p.se<r){
        if(l<p.fi)l=p.fi;
        if(p.se<r)r=p.se;
      }
    while(!pq.empty()){
       P q=pq.top();
       if(q.fi==l)pq.pop();
       else break;
    }
    // if(r-l==1){cnt++;l=0;r=0;}
}
cnt++;
cout<<cnt<<endl;
}




Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#define ll long long
using namespace std;
struct dog {
	string a;
	int b;
};
int main()
{
	int n, m;
	cin >> n >> m;
	if (n == m)cout << "Yes";
	else cout << "No";

}


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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define bil ((ll)1e9)
#define mod ((ll)1e9+7)

int main(int argc,char* argv[]){
    int n,m;
    cin >> n;

    vector<int> plb(n);
    for(auto &x:plb)
        cin >> x;
    
    cin >> m;
    for(int i=0;i<m;i++){
        int p,x,sum=0;
        cin >> p >> x;
        for(int j=0;j<n;j++){
            if(j+1==p)
                sum+=x;
            else
                sum+=plb[j];
        }
        cout << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 3592
import sys
from math import sqrt

input = sys.stdin.readline

N, D = map(int, input().strip().split(' '))
points = [list(map(int, input().strip().split(' '))) for _ in range(N)]

count = 0
for i in range(N - 1):
    for j in range(i+1, N):
        p1 = points[i]
        p2 = points[j]
        dist = sqrt(sum((x - y) ** 2 for x, y in zip(p1, p2)))
        if int(dist) == dist:
            count += 1

print(count)

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

const int MAXN = 200010;
typedef long long ll;

int n, a[MAXN];
ll sum[MAXN];

inline ll ask(int l, int r) {return sum[r] - sum[l - 1];}

pair<int, int> div(int mid)
{
	pair<int, int> ans;
	ll res = 1e18;
	int l = 1, r = mid - 1, pos = 0;
	while(l <= r)
	{
		int i = (l + r) >> 1;
		ll num = abs(ask(1, i) - ask(i + 1, mid));
		if(num < res) res = num, pos = i;
		if(ask(1, i) < ask(i + 1, mid)) l = i + 1;
		else r = i - 1;
	}
	ans.first = pos;
	res = 1e18;
	l = mid + 1, r = n - 1, pos = 0;
	while(l <= r)
	{
		int i = (l + r) >> 1;
		ll num = abs(ask(mid + 1, i) - ask(i + 1, n));
		if(num < res) res = num, pos = i;
		if(ask(mid + 1, i) < ask(i + 1, n)) l = i + 1;
		else r = i - 1;
	}
	ans.second = pos;
	return ans;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]), sum[i] = sum[i - 1] + a[i];
	ll ans = 1e18;
	for(int i = 2; i <= n - 2; ++i)
	{
		pair<int, int> now = div(i);
		ll A = ask(1, now.first);
		ll B = ask(now.first + 1, i);
		ll C = ask(i + 1, now.second);
		ll D = ask(now.second + 1, n);
		ans = min(ans, max(max(A, B), max(C, D)) - min(min(A, B), min(C, D)));
	}
	printf("%lld\n", ans);
	return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
const ll INF = 9e18;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> val;
    for (ll i=1;i*i<=N;i++){
        if (N%i == 0) {
            val.push_back(N/i);
        }
    }
    ll ans = INF;
    for (ll i=0;i<val.size();i++){
        ll keta = 0;
        while (val[i] >0){
            val[i]/=10;
            keta++;
        }
        ans = min(ans, keta);
    }
    cout << ans << "\n";
}

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

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

    int nexon = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        nexon ^= a[i];
    }

    for (int i = 0; i < n; i++)
    {
        cout << (a[i] ^ nexon) << " ";
    }

    return 0;
}


Measured memory_bytes: 4036
# 190915 C
if __name__ == "__main__":
    N = list(map(int,input().split()))
    K = N[1]
    Q = N[2]
    N = N[0]
    A = [0] * N
    maxp = 0
    for i in range(Q):
        tmpi = int(input())
        A[tmpi-1] += 1
    
    for i in range(N):
        if K - (Q - A[i]) <= 0:
            print("No")
        else:
            print("Yes")

    

Measured memory_bytes: 4680
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]
ans = -1
for i in range(1000):
  s = str(i)
  if len(s) == n:
    ok = True
    for j, k in sc:
      if int(s[j-1]) != k:
        ok = False
    if ok:
      ans=i
      break
print(ans)

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

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

int main() {
  int x, y;
  cin >> x >> y;
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> p(a), q(b), r(c);
  rep(i,a) cin >> p[i];
  rep(i,b) cin >> q[i];
  rep(i,c) cin >> r[i];
  sort(p.rbegin(), p.rend());
  sort(q.rbegin(), q.rend());
  vector<int> d;
  rep(i,x) d.push_back(p[i]);
  rep(i,y) d.push_back(q[i]);
  rep(i,c) d.push_back(r[i]);
  sort(d.rbegin(), d.rend());
  ll ans = 0;
  rep(i,x+y) ans += d[i];
  cout << ans <<endl;
}
  
  
  
  
  
  
  
  
  
  


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

#define pb push_back
#define int ll

using ll=long long;
using pii=pair<int,int>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;
using vi=vector<int>;
using vvi=vector<vi>;

signed main() {
    ios_base::sync_with_stdio(false);

  int x, y, z;
  cin >> x >> y >> z;
  swap(x,y);
  swap(x,z);
  cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <climits>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int N;
    cin >> N;
    while(!(N == (int)sqrt(N) * (int)sqrt(N))){
        N--;
    }
    cout << N << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    priority_queue<Int, vector<Int>, greater<Int>> q;
    for (Int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        q.push(a);
    }
    vector<pair<Int, Int>> v(m);
    for (Int i = 0; i < m; i++) {
        Int b, c;
        cin >> b >> c;
        v[i] = {c, b};
    }
    sort(v.begin(), v.end(), greater<pair<Int, Int>>());
    Int x = 0;
    bool update = true;
    while (update && x < (Int)v.size()) {
        update = false;
        for (Int i = 0; i < v[x].second; i++) {
            if (q.top() >= v[x].first) {
                update = false;
                break;
            }
            else {
                q.pop();
                q.push(v[x].first);
                update = true;
            }
        }
        x++;
    }
    Int res = 0;
    while (!q.empty()) {
        res += q.top();
        q.pop();
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 2676
import sys
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())

Q, H, S, D = MAP()
N = INT()

l = [(Decimal(0.25), Q, 0.25/Q), (Decimal(0.5), H, 0.5/H), (1, S, 1/S), (2, D, 2/D)]
l.sort(key=lambda x:x[2], reverse=True)
ans = 0
idx = 0
while N != 0:
	n = N//l[idx][0]
	ans += l[idx][1]*n
	N -= l[idx][0]*n

	idx += 1

print(ans)


Measured memory_bytes: 5072
N, K = map(int, input().split())
S = input()

L=[0]
for i in range(N-1):
    if(S[i]!=S[i+1]):
        L.append(i+1)
L.append(N)

if S[0]=='0':
    L.insert(0,0)
if S[-1]=='0':
    L.append(N)

max_r = 0
step = K*2+1
if len(L)-step<1:
    step=len(L)-1
for i in range(0, len(L)-step,2):
    max_r = max(max_r, L[i+step]-L[i])

print(max_r)


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, N;
	cin >> H >> N;
	vector<int> A(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
	}
	if (sum >= H) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 65
#define LL long long
int a[MAXN],ra,b[MAXN],rb,flag;
LL ans,A,B;
LL Count(int i)
{
	LL ret=0;
	for(;i>0;i--)
		ret=ret*2+a[i];
	return ret;
}
int main()
{
	scanf("%lld%lld",&A,&B);
	ans=B-A+1;
	while(B)
	{
		b[++rb]=B&1;
		B>>=1;
	}
	while(A)
	{
		a[++ra]=A&1;
		A>>=1;
	}
	while(b[rb]==a[rb]&&rb>0) rb--,ra--;
	for(int i=rb-1;i>0;i--)
		if(b[i]==0&&a[i]==0)
		{
			ans+=1LL<<(i-1);
		}
		else if(b[i]==0&&a[i]==1)
		{
			if(flag) ans+=1LL<<(i-1);
			else
			{
				ans+=(1LL<<(i-1))-Count(i-1);
				while(b[i]==0&&i>0) i--;
				for(int j=i;j;j--)
					if(b[j]==0)
					{
						ans+=1LL<<(j-1);
					}
				break;
			}
		}
		else flag=1;
	printf("%lld\n",ans);
}


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

using namespace std;
typedef long long ll;

ll n, a, b;
vector<ll> h;

bool check(ll m) {
  ll cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += max(0LL, (h[i] - m * b + (a - b) - 1) / (a - b));
  }
  return cnt <= m;
}

int main(void) {
  cin >> n >> a >> b;

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

  ll ng = -1, ok = 1e9;
  while (ok - ng > 1) {
    ll m = (ng + ok) / 2;
    if (check(m)) ok = m;
    else ng = m;
  }

  cout << ok << endl;

  return 0;
}

Measured memory_bytes: 1024
// code written by kshitij_coder
#include<bits/stdc++.h>
using namespace std;
 
#define ll int64_t
#define pii pair<ll,ll>
#define psi pair<string,ll> 
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pb push_back
#define lim 100000
#define f(k) k.first
#define s(k) k.second
#define bcnt __builtin_popcount
#define endl "\n"
#define PI 3.1415926535

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const{ 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

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

// ll ncr(ll n,ll r,ll*arr){
//     if(r==0) return 1;
//     ll res = 1;
//     return (arr[n]*(power(arr[n-r],MOD-2))%MOD*(power(arr[r],MOD-2))%MOD)%MOD;
// }

ll gcd(ll a,ll b){ if(a == 0) return b; if(b == 0) return a; return gcd(b,a%b); }
ll add_mod(ll a,ll b,ll m){return ((a%m) + (b%m))%m;}
ll sub_mod(ll a,ll b,ll m){return ((a%m) - (b%m) + m)%m;}
ll mul_mod(ll a,ll b,ll m){return ((a%m)*(b%m))%m;}
void print(double val,int k){ cout<<fixed<<setprecision(k)<<val<<endl;}
ll toint(string s) {stringstream ss; ss << s; ll x; ss >> x; return x;}

void solve(){
    int n,w;
    cin >> n >> w;
    
    ll **dp = new ll*[n + 1];
    for(int i = 0;i <= n;i++) dp[i] = new ll[w+1];
    
    for(int i = 0;i <= n;i++) dp[i][0] = 0;
    for(int i = 0;i <= w;i++) dp[0][i] = 0;
    
    for(int i = 1;i<=n;i++){
        int u,v;
        cin >> u >> v;
        
        for(int j = 1; j <= w;j++){
            ll a = ((j - u) >= 0) ? (dp[i-1][j-u] + v) : 0;
            ll b = dp[i-1][j];
            dp[i][j] = max(a,b);
        }
    }
    
    
    cout<<dp[n][w]<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
    return 0;
}

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

int main() {
 int N;
 cin >> N;
  if (N/1000 == N/100-10*(N/1000) && N/100-10*(N/1000) == N/10-10*(N/100))
    cout << "Yes" << endl;
  else if (N/100-10*(N/1000) == N/10-10*(N/100) && N/10-10*(N/100) == N-10*(N/10))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
const int N = 5e5 + 5;
typedef long long ll; 
using namespace std;

int n, pa[N], cnt; 
struct node { int x, y, id; } p[N]; 
struct edge { int u, v, w; } e[N];
ll ans; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int getf(int x) { return pa[x] ^ x ? pa[x] = getf(pa[x]) : x; }

bool cmp1(node a, node b) { return a.x < b.x; }

bool cmp2(node a, node b) { return a.y < b.y; }

bool cmp3(edge a, edge b) { return a.w < b.w; }

void kruscal()
{
	for(int i = 1; i <= n; i++) pa[i] = i;
	sort(e + 1, e + cnt + 1, cmp3);
	for(int u, v, i = 1; i <= cnt; i++)
	{
		u = e[i].u, v = e[i].v, u = getf(u), v = getf(v);
		if(u == v) continue;
		pa[u] = v, ans += e[i].w; 
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> ();
	for(int i = 1; i <= n; i++) p[i].x = read <int> (), p[i].y = read <int> (), p[i].id = i;
	sort(p + 1, p + n + 1, cmp1);
	for(int i = 1; i < n; i++) e[++cnt] = (edge) { p[i].id, p[i + 1].id, p[i + 1].x - p[i].x };
	sort(p + 1, p + n + 1, cmp2);
	for(int i = 1; i < n; i++) e[++cnt] = (edge) { p[i].id, p[i + 1].id, p[i + 1].y - p[i].y };
	kruscal();
	printf("%lld\n", ans); 
	return 0; 
}


Measured memory_bytes: 8612
import java.io.*;
import java.util.*;

public class Main {
    void run() {
        int N = readInt();
        int M = readInt();
        int L = readInt();
        int[][] A = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = readInt();
            }
        }
        int[][] B = new int[M][L];
        for (int i = 0; i < M; i++) {
            for (int j = 0; j < L; j++) {
                B[i][j] = readInt();
            }
        }
        long[][] C = new long[N][L];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < L; j++) {
                for (int k = 0; k < M; k++) {
                    C[i][j] += A[i][k] * B[k][j];
                }
            }
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < L; j++) {
                if (j > 0) sysout.print(' ');
                sysout.print(C[i][j]);
            }
            sysout.println();
        }
    }

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

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = null;

    String readLine() {
        buffer = null;
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    String read() {
        if (buffer == null || !buffer.hasMoreTokens()) {
            buffer = new StringTokenizer(readLine());
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }
}

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

bool isPrime(int arr) {
    int result=0;
    if (arr == 2) return true;
    if (arr < 2 || arr%2 == 0) return false;

    int x = arr;
    int j = 3;
    while (j <= sqrt(x)) {
        if (x%j == 0) return false;
        j += 2;
    }
    return true;
}

int main ()
{
    int n, arr, result=0;
    cin >> n;

    for (int i=0; i<n; ++i) {
        cin >> arr;
        if (isPrime(arr)) result++;
    }
    cout << result << endl;
    return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int l,r,d;
   cin>>l>>r>>d;
   int ans=0;
   for(int i=l;i<=r;i++)
   {
       if(i%d==0)
        ans++;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3632
N = int(input())
L = []
for i in range(N):
  L.append(list(input().split()))
S = input()
ans = 0
f = 0
for i in range(N):
  if f == 1:
    ans += int(L[i][1])
  if L[i][0] == S:
    f = 1
print(ans)

Measured memory_bytes: 61804
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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



int main()
{
        //input->compute->output//
        int A, B;
        cin >> A >> B;
        cout << (A - 1) * (B - 1) << endl;

        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    string qw, er;
    cin >> qw >> er;
    int y=0;
    for (int i=0; i<qw.size(); ++i)
        if (qw[i]!=er[i])
            y+=1;
    cout << y << endl;
}



Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int c=0;
  for(int i=a/100;i<=b/100;i++){
    string ri=to_string(i);
    reverse(ri.begin(),ri.end());
    int x=stoi(to_string(i/10)+ri);
    if(a<=x&&x<=b)
      c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main()
{
  int n;
  cin >> n;
  set<string> s;
  for(int i=0; i<n; i++){
    string str;
    cin >> str;
    s.insert(str);
  }
  int m;
  cin >> m;
  bool bOpen = false;
  for(int i=0; i<m; i++){
    string str;
    cin >> str;
    if(s.find(str) == s.end()){
      cout << "Unknown " << str << endl;
    }else{
      if(bOpen){
        cout << "Closed by " << str << endl;
      }else{
        cout << "Opened by " << str << endl;
      }
      bOpen = !bOpen;
    }
  }
  return 0;
}

Measured memory_bytes: 1232
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <string>
#include <vector>
#include <utility>
using namespace std;

int main()
{
    int n;
    cin >> n;
    cout << ((n - 1) / 111 + 1) * 111;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
    int i,j,k,l,ans=0;
    int N; 
    int A[5];

    l=0;
    k=9;
    for(i=0;i<5;i++){
        scanf("%d",&A[i]);
        if(A[i]%10!=0 && 10-A[i]%10 > l){k=i;l=(10-A[i]%10);}
    }
    
    for(i=0;i<5;i++){
        j=0;
        while(A[i]>j){
            j = j+10;
        }
        ans += j;
    }

    if(k!=9){ans = ans - (10-A[k]%10);}

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

    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define if_range(x, w, h) if (w <= x && x <= h)
#define BitCheck(a,b)   (a >> b) & 1
#define BitSet(a,b)       a |= (1 << b)
#define BitunSet(a,b)    a &= ~(1 << b)
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))

int compare_int(const void* a, const void* b) { return *(int*) a - *(int*) b; }

double mincos(int n, double* x, double* y, double p) {//?????????-1
	double a = 0;
	if (p == -1) {
		for (int i = 0; n > i; i++)
			if (a <= fabs(x[i] - y[i])) {
				a = fabs(x[i] - y[i]);
			}
		return a;
	}
	for (int i = 0; n > i; i++) {
		a += pow(fabs(x[i] - y[i]), p);
	}
	return pow(a, 1 / p);
}

int main() {
	int n;
	double pos[2][100];
	scanf("%d", &n);
	for (int j = 0; 2 > j; j++) for (int i = 0; n > i; i++) 
		scanf("%lf", &pos[j][i]);

	double a = 0, b = 0, c = 0, d = 0, e = 0;
	for (int i = 1; 3 >= i; i++) printf("%lf\n", mincos(n, pos[0], pos[1], i));
	printf("%lf\n", mincos(n, pos[0], pos[1], -1));
	return 0;
}

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

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

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    if(a<b) swap(a, b);
    printf("%d\n", gcd(a, b));
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const ll LINF = 1e11;

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

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

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

    int a, b, t;
    cin >> a >> b >> t;
    int ans = b *(t / a);
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int N, A[200000];

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

    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    int res = 0, sum = 0, r = 0;
    for(int i = 0; i < N; ++i) {
        while(r < N && (sum ^ A[r]) == (sum + A[r])) {
            sum += A[r];
            ++r;
        }
        sum -= A[i];
        res += r - i;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;

int main() {

	int n;
	cin >> n;

	int ans = n;
	eFOR(i, n) {
		int six = i, nine = n - i ,cnt = 0;
		while (six > 0) {
			cnt += six % 6;
			six /= 6;
		}
		while (nine > 0) {
			cnt += nine % 9;
			nine /= 9;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;

	return 0;
}


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N; cin >> N;
	const LL mod = 1e9+7;
	vector<LL> dp(N+1,1);
	dp[1] = N;
	LL s = N+1;
	repp(i,1,N){
		dp[i+1] = ((LL)(N-1)*(N-1)+s-dp[i-1]+N-i)%mod;
		s = (s+dp[i+1])%mod;
	}
	cout << (dp[N]+mod)%mod << endl;
	return 0;
}


Measured memory_bytes: 8064
//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
#include <unordered_map>
#include <math.h>
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const int MXN = 2e5 + 1;
const long long MNN = 1e6 + 200;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

#define PI 3.14159265358979323846

void istxt(bool yes){
    freopen("/Users/mac/Desktop/input.txt", "r", stdin);
    freopen("/Users/mac/Desktop/output.txt", "w", stdout);
}

int main () {
//    ios;
//    istxt(0);
//
//    int t;
    
//    cin >> t;
    
    int k;
    string s;
    
    cin >> k;
    cin >> s;
    
    if (k < s.length()) {
        string str = s.substr(0, k);
        str += "...";
        cout << str << endl;
    } else {
        cout << s << endl;
    }
    
    return 0;
}



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

//リュカ数

int main() {
int N;
cin >> N;
vector<int64_t> a(87);

a.at(0) = 2; a.at(1) = 1;

for (int i = 2;i <= N;i++) {
a.at(i) = a.at(i-1) + a.at(i-2);

}

printf("%lld",a.at(N));
cout << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

int main(int argc, char const *argv[]) {
  int x=0,y=0;
  double d;

  std::cin >> x >> y;
  d = (double)x/y;
  std::cout << (x/y) << " " << (x%y) << " " << std::fixed << std::setprecision(5) << d << std::endl;
  return 0;
}

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

int main(){
    int k,a,b;
    scanf("%d %d %d",&k,&a,&b);
    if((b-(b%k))>=a){
        printf("OK\n");
    }else{
        printf("NG\n");
    }

    return 0;
}

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

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

int main(){
  ll a, b; cin >> a >> b;
  
  // LCM
  ll g = gcd(a,b);
  ll aa = a/g, bb = b/g;
  cout << g*aa*bb << endl;
  return 0;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<b) swap(a,b);
    int x=16-2*b;
    int y=a-b;
    int h=(y+1)/2;
    if(h>=y) printf("Yay!\n");
    else printf(":(\n");

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string S;
	int K;
	long long ans, ans2;
	cin >> S >> K;
	for (int i = 1; i < S.length(); ++i) {
		if (S[i] != S[i - 1]) goto hell;
	}
	ans = (long long) S.length() * (long long) K;
	printf("%lld", ans / 2);
	return 0;
	hell:;
	ans = ans2 = 0;
	string S2 = S + S;
	for (int i = 1; i < S.length(); ++i) {
		if (S[i] == S[i - 1]) {
			S[i] = ' ';
			ans += 1;
		}
	}
	for (int i = 1; i < S2.length(); ++i) {
		if (S2[i] == S2[i - 1]) {
			S2[i] = ' ';
			ans2 += 1;
		}
	}
	ans = ans * K + (ans2 - 2 * ans) * (K - 1);
	cout << ans;
	return 0;
}

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

int main(){
    int k, n, ans = 1e+6;
    cin >> k >> n;
    vector<int> a(n * 2);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i + n] = a[i] + k;
    }

    for(int i = 0; i < n; i++){
        ans = min(ans, a[i + n - 1] - a[i]);
    }

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

Measured memory_bytes: 1792
#include <stdio.h>

typedef struct List {
	struct List *next;
	int v, id;
} list;

int main()
{
	int m, N, M, u, w, deg[100001] = {};
	list *adj[100001] = {}, e[400003], *p, *q;
	scanf("%d %d", &N, &M);
	for (m = 1; m <= M; m++) {
		scanf("%d %d", &u, &w);
		e[m*2].v = w;
		e[m*2+1].v = u;
		e[m*2].id = m * 2;
		e[m*2+1].id = m * 2 + 1;
		e[m*2].next = adj[u];
		e[m*2+1].next = adj[w];
		adj[u] = &(e[m*2]);
		adj[w] = &(e[m*2+1]);
		deg[u]++;
		deg[w]++;
	}
	
	int i, n = N;
	for (i = 1; i <= n; i++) {
		if (deg[i] % 2 != 0) break;
		else if (deg[i] > 2) continue;
		else if (N == 1) {
			printf("No\n");
			fflush(stdout);
			return 0;
		}
		
		for (p = adj[i]; p->id < 0; p = p->next);
		for (q = p->next; q->id < 0; q = q->next);
		u = p->v;
		w = q->v;
		e[m*2].v = w;
		e[m*2+1].v = u;
		e[m*2].id = m * 2;
		e[m*2+1].id = m * 2 + 1;
		e[m*2].next = adj[u];
		e[m*2+1].next = adj[w];
		adj[u] = &(e[m*2]);
		adj[w] = &(e[m*2+1]);
		m++;
		
		e[(p->id)^1].id *= -1;
		e[(q->id)^1].id *= -1;
		M--;
		N--;
		deg[i] = 0;
	}
	
	if (i <= n) printf("No\n");
	else if (N == 1) {
		if (M >= 3) printf("Yes\n");
		else printf("No\n");
	} else if (N == 2) {
		for (i = 1; i <= n; i++) {
			if (deg[i] == 0) continue;
			else if (deg[i] >= 6) break;
			for (p = adj[i]; p != NULL; p = p->next) if (p->v == i) break;
			if (p != NULL) break;
		}
		if (i <= n) printf("Yes\n");
		else printf("No\n");
	} else printf("Yes\n");
	fflush(stdout);
	return 0;
}

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

using namespace std;
const int _max = 2e6 + 10;
const int mod = 1e9 + 7;
typedef unsigned long long ll;

ll a[200010];
queue<ll>q;

bool cmp(ll a,ll b){
    return a>b;
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll he=0;
    sort(a,a+n,cmp);
    q.push(a[0]);
    for(int i=1;i<n;i++){
        ll qian=q.front();
        q.pop();
        he+=qian;
        q.push(a[i]);
        q.push(a[i]);
    }
    cout<<he;
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, m, k;
    cin >> n >> m >> k;
    vl a(n);
    cin >> a;
    vl b(m);
    cin >> b;
    vl ad(n + 1);
    rep(i, n) ad[i + 1] = ad[i] + a[i];
    vl bd(m + 1);
    rep(i, m) bd[i + 1] = bd[i] + b[i];

    ll ans = 0;
    rep(i, n + 1) {
        if (ad[i] > k) continue;
        auto itr = upper_bound(all(bd), k - ad[i]);
        if (itr == bd.begin()) {
            ans = max(ans, i);
        } else {
            ans = max(ans, prev(itr) - bd.begin() + i);
        }
    }

    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


Measured memory_bytes: 9528
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     998244353
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b)
{
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,x1,x2,y1,y2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>n;
map<string,ll>m1;
for(i=0;i<n;i++)
{
  cin>>s;
  m1[s]++;
}
cout<<m1.size();
}


Measured memory_bytes: 19136
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 A,B,C;
	cin >> A >> B >> C;

	i64 max_p = max({ A,B,C });
	if (A == max_p)
		cout << A*10+B+C << endl;
	else if (B == max_p)
		cout << B * 10 + A + C << endl;
	else
		cout << C * 10 + A + B << endl;
	return 0;
}


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

int main() {
  int K;
  string S;
  cin >> K >> S;
  if(S.size() <= K) cout << S << endl;
  else {
    for(int i = 0; i < K; i++) {
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
 
int N;
int K;
long long ans[100001];
long long sum;
long long be[1001];
int cnt = 1;

 
long long beki(int n,int k){
    long long ans = 1;
    be[0] = n;
    for(int i = 1;i<1000;i++){
        be[i] = (be[i-1]*be[i-1]) % 1000000007;
    }
    int w = 0;
    while(k > 0){
        if (k%2==1){
            ans = (ans * be[w])% 1000000007;
        }
        w += 1;
        k /= 2;
       
    }
    return ans;
}
 
int main() {
    cin >> N >> K;
    for (int i = K-1;i>=0;i--){
        sum = beki(K/(i+1),N)% 1000000007;
        for (int j = 2;j<=K/(i+1);j++){
            sum -= ans[j*(i+1)];
        }
        ans[i+1] = sum;
    }
    long long sumi = 0;
    for (int i = 0;i<K;i++){
        sumi = (sumi + ans[i+1]*(i+1))% 1000000007;
    }
    cout <<sumi<< endl;
    
}


Measured memory_bytes: 4380
//0:実行モード
//1:開発モード
//2:最終テストモード
const sys_debugMode : number = 0;

function chk(in_data1 : any, in_data2? : any) : void{
	if (sys_debugMode == 0 || sys_debugMode == 2){
		return;
	}
	else if (in_data2 === undefined){
		console.log(in_data1);
	}
	else{
		console.log(in_data1 + "[" + typeof(in_data2) + "] =", in_data2);
	}
}

function prt(in_data : any) : void{
	console.log(in_data);
}

class ParamManager {

	private a_s_inputLines : string[];
	private n_maxLine : number;
	private n_nowLineCnt : number;

	constructor(){
		this.a_s_inputLines = this.inputLines();
		this.n_maxLine = this.a_s_inputLines.length;
		this.descLines();
		this.n_nowLineCnt = 1;
	}
	inputLines(){
		const fs = require('fs');

		let text;
		if(sys_debugMode == 0){
			text = fs.readFileSync("/dev/stdin", 'utf8');
		}
		else{
			text = fs.readFileSync("input.txt", 'utf8');
		}

		const line:string[] = text.toString().replace(/\r/g, "").split('\n');

		return line;
	}
	descLines(){
		chk("ParamManager.a_s_inputLines", this.a_s_inputLines);
	}
	getNextLine(in_s_type?):any{
		if (this.n_nowLineCnt > this.n_maxLine){
			chk("ParamManager.getNextLine","No Next Line!");
			return;
		}
		const s_returnLine:string = this.a_s_inputLines[this.n_nowLineCnt - 1];

		this.n_nowLineCnt++;
		
		if (in_s_type == "n"){
			return parseInt(s_returnLine);
		}
		else if (in_s_type == "a"){
			return s_returnLine.split(" ");
		}
		else if (in_s_type == "an"){
			const a_s_temp = s_returnLine.split(" ");
			const a_n_temp = a_s_temp.map(function(str){return Number(str)});
			return a_n_temp;
		}
		else if(in_s_type == "s"){
			const aMoji:string[] = s_returnLine.split("");
			return aMoji;
		}
		else if(in_s_type == "sn"){
			const aMoji:string[] = s_returnLine.split("");
			const aNum:number[] = aMoji.map(function(str){return Number(str)});
			return aNum;
		}
		else{
			return s_returnLine;
		}
	}
}
const paramManager = new ParamManager();
//==================================================
//https://atcoder.jp/contests/abc164/tasks/abc164_a
//A - Sheep and Wolves / 
//==================================================
class Param{
	sheepNum:number;
	wolfNum:number;

	constructor(){
		chk("--------------------------------------------------");
		chk("パラメータ");
		//羊がS匹、狼がW匹います。
		const aTemp = paramManager.getNextLine("an");
		this.sheepNum = aTemp[1-1];
		this.wolfNum  = aTemp[2-1];

		chk(this);
	}
}
const param = new Param();
//==================================================
class Manager{

	constructor(){

		this.main();
	}

	main():void{
		chk("--------------------------------------------------");
		chk("main");

		this.resultOutput();
	}

	resultOutput():void{
		chk("--------------------------------------------------");
		chk("resultOutput");
		//狼の数が羊の数以上のとき、羊は狼に襲われてしまいます。
		//羊が狼に襲われるなら unsafe、襲われないなら safe を出力してください。
		if(param.wolfNum >= param.sheepNum){
			prt("unsafe");
		}
		else{
			prt("safe");
		}
	}

}
const manager = new Manager();
//==================================================

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

struct node {
  llong place;
  llong cost;
  llong before;

  node() {};
  node(llong place, llong cost, llong before) :
    place(place),
    cost(cost),
    before(before)
  {}

  bool operator<(const node &ri) const {
    return cost < ri.cost;
  }
  bool operator<=(const node &ri) const {
    return cost <= ri.cost;
  }
  bool operator>(const node &ri) const {
    return cost > ri.cost;
  }
};

vector<vector<node> > edges;

vector<node> dijkstra(int start) {
  priority_queue<node, vector<node>, greater<node> > que;
  vector<node> dis(edges.size(), node(-1, inf<llong>, -1));
  dis[start] = node(start, 0, -1);

  que.push(dis[start]);
  while (que.size()) {
    node now = que.top();
    que.pop();
    if (dis[now.place] < now) continue;
    now = dis[now.place];

    for (auto &edge: edges[now.place]) {
      node next(edge.place, now.cost + edge.cost, now.place);
      if(dis[next.place] <= next) continue;
      dis[next.place] = next;
      que.push(next);
    }
  }

  return dis;
}

int main() {
  llong N, M;
  cin >> N >> M;

  edges.resize(N + 1);
  for (int i = 0; i < M; ++i) {
    llong A, B;
    cin >> A >> B;
    edges[A].push_back(node(B, 1, A));
    edges[B].push_back(node(A, 1, B));
  }

  auto ans = dijkstra(1);
  cout << "Yes" << endl;
  for (int i = 2; i <= N; ++i) {
    cout << ans[i].before << endl;
  }


  return 0;
}

Measured memory_bytes: 25584