akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

int main(void)
{
    int N,K;
    cin >> N >> K;
    deque<int> D;
    rep(i,N){
        int v;
        cin >> v;
        D.push_back(v);
    }

    ll max_c = 0;
    rep(t,K){
        rep(i,K-t){
            deque<int> _D = D;
            int bk = i;
            int fr = (K-t)-i;

            deque<int> vec;
            rep(j,bk){
                if(!_D.empty()){
                    vec.push_back(_D.back());_D.pop_back();
                }
            }
            rep(j,fr){
                if(!_D.empty()){
                    vec.push_back(_D.front());_D.pop_front();
                }
            }

            //dump(vec);

            sort(vec.begin(), vec.end());
            rep(j,t){
                if (!vec.empty() && vec.front() < 0) {
                    vec.pop_front();
                }
            }
            ll c = 0;
            for(int j = 0; j < vec.size(); j++){
                c += vec.at(j);
            }
            if (c > max_c) {
                max_c = c;
            }
        }
    }

    cout << max_c << endl;

    return 0;
}


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

using namespace std;

int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>> a(13, vector<int>(13));
	vector<int> c(13);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int mn = 1010101010;
	for (int i = 0; i < (1 << n); i++) {
		vector<int> p(m);
		int cost = 0;
		for (int j = 0; j < n; j++) {
			if (((i >> j) & 1) == 1) {
				cost += c[j];
				for (int k = 0; k < m; k++) {
					p[k] += a[j][k];
				}
			}
		}

		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (p[j] < x) {
				ok = false;
			}
		}

		if (ok) {
			mn = min(mn, cost);
		}
	}
	cout << (mn == 1010101010 ? -1 : mn) << endl;

	return 0;
}

Measured memory_bytes: 3632
S = str(input())
ans = 0
count =0
i = 0
j = 1
#print ('len(S)', len(S))
while i <= len(S):
    j = i + 1
    while j <= (len(S)+1):
#        print ('(i, j-1, j)=', i, j-1, j)
        s = S[j-1:j]
#        print ('S:', S)
#        print ('s:', s)
        if j == len(S) + 1:
            if s == 'A' or s == 'C' or s == 'G' or s == 'T':
                count += 1
                ans = max(ans, count)
#                print (ans)
                count = 0
#                print ('V')
            else:
                ans = max(ans, count)
#                print (ans)
                count = 0
#                print ('W')
        else:
            if s == 'A' or s == 'C' or s == 'G' or s == 'T':
                count += 1
#                print (count)
#                print ('X')
            else:
                ans = max(ans, count)
                count = 0
                j = len(S) + 2
#                print ('Y')
                
        j += 1
    i += 1
print (ans)

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

int main(){
	int a, b;

	while(1){
		cin >> a >> b;

		if(a == 0 && b == 0) break;

		if(a < b){
			cout << a << " " << b << endl;
		}else{
			cout << b << " " << a << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3000
#include<stdio.h>
#include<string.h>
#define MAX 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[MAX+1];
int head, tail, n;

void enqueue(P);
P dequeue();
int min(int, int);

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head=1;
  tail=n+1;

  while(head != tail){
    u=dequeue();
    c=min(q,u.t);
    u.t-=c;
    elaps+=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

void enqueue(P x){
  Q[tail]=x;
  if(tail+1==MAX) tail=0;
  else tail++;
}

int min(int a, int b){
  return a<b?a:b;
}

P dequeue(){
  P x = Q[head];
  if(head+1==MAX) head=0;
  else head++;
  return x;
}

Measured memory_bytes: 10756
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i++) cin >> S[i];
    long long ans= 0;
    long long cntab = 0, cnta = 0, cntb = 0;
    for(int i = 0; i < N; i++){
        if(S[i][0] == 'B' && S[i][S[i].size() - 1] == 'A') cntab++;
        else if(S[i][0] == 'B') cntb++;
        else if(S[i][S[i].size() - 1] == 'A') cnta++;
        for(int j = 0; j < S[i].size(); j++){
            if(j < S[i].size() - 1 && S[i][j] == 'A' && S[i][j + 1] == 'B') ans++;
        }
    }
    if(cntab == 0) ans += min(cnta, cntb);
    else if(cnta == 0 && cntb == 0) ans += cntab - 1;
    else if(cnta == 0 || cntb == 0) ans += cntab;
    else ans += cntab + min(cnta, cntb);
    cout << ans << endl; 
}


Measured memory_bytes: 768
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end
  # [2,4,6].each_with_index.sort

s = gets.chomp
sa = s.split("")
if sa[-1] == "s"
  s = s + "es"
else
  s = s + "s"
end

puts s


Measured memory_bytes: 14356
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long int ll;
static const ll MOD = 1000000007LL;

int N, M;
int A[1111], B[1111];

int main(){
	scanf("%d %d", &N, &M);
	for(int i = 0; i < N; i++) scanf("%d", &A[i]);
	for(int i = 0; i < M; i++) scanf("%d", &B[i]);
	
	sort(A, A + N);
	sort(B, B + M);
	ll res = 1LL;
	for(int i = N * M; i >= 1; i--){
		int cnt;
		bool flag = true;
		if(upper_bound(A, A + N, i) - lower_bound(A, A + N, i) > 1){
			printf("0\n");
			return 0;
		}
		if(upper_bound(B, B + M, i) - lower_bound(B, B + M, i) > 1){
			printf("0\n");
			return 0;
		}
		if(binary_search(A, A + N, i) && binary_search(B, B + M, i)) cnt = 1;	// B + Nになってました
		else if(binary_search(A, A + N, i)) cnt = M + (B - lower_bound(B, B + M, i));	//M - ()だったのをM + ()にしました
		else if(binary_search(B, B + M, i)) cnt = N + (A - lower_bound(A, A + N, i));	//N - ()だったのをN + ()にしました
		else{
			cnt = (M + (B - lower_bound(B, B + M, i))) * (N + (A - lower_bound(A, A + N, i)));//↑と同じ
			flag = false;
		}
		if(!flag && cnt < (M * N - i)){
			printf("0\n");
			return 0;
		}
		if(flag) res *= (ll)cnt;
		else res *= (ll)(cnt - (M * N - i));
		res %= MOD;
	}
	printf("%lld\n", res);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld; 
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << ", ";
	err(++it, args...);
	cout<<"\n";
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

ll powm(ll a, ll b, ll mod) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

const ll mod = 1e9 + 7;
const ll N = 1000005;
const ll inf = 1e9;

void solve()
{
	int n, m;
	cin>>n>>m;
	vi adj[n];
	rep(i, m){
		int x, y;
		cin>>x>>y;
		x--, y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	vector<bool> vis(n, 0);
	int cnt = 0;
	function<void(int, int)> dfs = [&](int src, int par){
		for(int v : adj[src]){
			if(par != v and vis[v] == 0){
				cnt++;
				vis[v] = 1;
				dfs(v, src);
			}
		}
	};
	int ans = 0;
	rep(i, n){
		if(vis[i] == 0){
			vis[i] = 1;
			cnt = 1;
			dfs(i, -1);
			ans = max(ans, cnt);
		}
	}
	cout<<ans<<endl;
}

// #define _DEBUG 
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	
	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	while(tc--)
	{
#ifdef _DEBUG
	int tt = clock();
#endif
		solve();
		
#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}




Measured memory_bytes: 30144
from collections import defaultdict
import itertools

n, c = list(map(int, input().split()))

D = [list(map(int, input().split())) for _ in range(c)]
C = [list(map(int, input().split())) for _ in range(n)]

d = [defaultdict(int), defaultdict(int), defaultdict(int)]

for i in range(n):
    for j in range(n):
        r = (i + j) % 3
        d[r][C[i][j]] += 1

cost = [[0] * c for _ in range(3)]

for i in range(3):
    dic = d[i]
    for j in range(c):
        for k, v in dic.items():
            cost[i][j-1] += v * D[k-1][j-1]

ans = 1e9

for i, j, k in itertools.permutations(range(c), 3):
    ans = min(cost[0][i] + cost[1][j] + cost[2][k], ans)

print(ans)




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

using namespace std;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in" , "r" , stdin);
#endif
    int n;
    cin >> n;

    map<string , int> cnt;

    long long ans = 0;
    for (int i = 1 ;i <= n ;i++) {
        string num = to_string(i);
        ans += cnt[string(1 , num.back()) + num.front()];
        cnt[string(1 , num.front()) + num.back()]++;
        ans += cnt[string(1 , num.back()) + num.front()];
    }

    cout << ans;
}

Measured memory_bytes: 3680
#include <cstdio>

using namespace std;

int t, r;

int gcd( int x, int y )
{
    if( x == 0 ) return y;
    if( y == 0 )return x; t++;
    if( y < x ) return gcd( y, x % y );
    return gcd( x, y % x );
}

int main()
{
    while( 1 )
    {
        int num1 = 0, num2 = 0;
        scanf( "%d %d\n", &num1, &num2 );
        if( num1 == 0 && num2 == 0 )break;
        t = 0;
        r = gcd( num1, num2 );
        printf( "%d %d\n", r, t );
    }
    return 0;
}


Measured memory_bytes: 2596
#include <bits/stdc++.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)
typedef long long int ll;
using namespace std;

struct edge {
    int src, dest, cost; 
    edge(int s, int t, int c): src(s), dest(t), cost(c) {}
};
const int INF = 1e8;

void warshall_floyd(vector<vector<int> > &d, vector<edge> &edges) {
    for(size_t i=0; i<d.size(); ++i) {
        d[i].assign(d[i].size(), INF);
        d[i][i] = 0;
    }
    for(size_t i=0; i<edges.size(); ++i) {
        edge e = edges[i];
        d[e.src][e.dest] = e.cost;
    }
    for(size_t j=0; j<d.size(); ++j) {
        for(size_t i=0; i<d.size(); ++i) {
            for(size_t k=0; k<d.size(); ++k) {
                d[i][k] = min(d[i][k], d[i][j] + d[j][k]);
            }
        }
    }
}

int main(void) {
    int n, m, s, g1, g2;
    while(cin >> n >> m >> s >> g1 >> g2 && n) {
        vector<edge> edges;
        vector<vector<int> > d(n, vector<int>(n, INF));
        --s; --g1; --g2;
        REP(i, m) {
            int b1, b2, c;
            cin >> b1 >> b2 >> c;
            edges.push_back(edge(b1-1, b2-1, c));
        }
        warshall_floyd(d, edges);
        int cost = numeric_limits<int>::max();
        REP(i, n) {
            cost = min(cost, d[s][i] + d[i][g1] + d[i][g2]);
        }
        cout << cost << endl;
    }
    return 0;
}

Measured memory_bytes: 3048
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        int sum = 0;
        for (int i = 0; i <= N; i++) {
            int digit_sum = 0;
            int n = i;
            while (n>0) {
                digit_sum += n % 10;
                n /= 10;
            }
            if (A <= digit_sum && digit_sum <= B) {
                sum += i;
            }
        }

        System.out.printf("%d\n", sum);
        sc.close();
    }
}

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

int main()

{
    int n,count=0;
    cin>>n;

    for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
        {
            if(i*j==n)
            {
                count=1;
                break;
            }
        }
    }

    if(count==0)
        cout<<"No"<<endl;
    else if(count==1)
        cout<<"Yes"<<endl;

    return 0;
}


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

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int n = min(a, b);
    vector<int> c;
    for (int i = 1; i <= n; i++)
    {
        if (a % i == 0 && b % i == 0) 
        {
            c.push_back(i);
        }
    }
    /* for (int i = 0; i < c.size(); i++)
    {
        cout << c[i] << endl;
    }
    cout << endl; */
    int d = c.size() - k;
    cout << c[d] << endl;
}

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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

vector<int> a, b;

int getXor(vector<int> c){
	int ret = 0;
	for(int x : c)
		ret ^= x;
	return ret;
}

vector<int> A, B;
unordered_map<int, vector<int> > inds;
set<int> seen;

void dfs(int node){
	if(seen.count(node))
		return;
	seen.insert(node);
	for(auto x : inds[node]){
		dfs(x);
	}
}

int main(){
	ios::sync_with_stdio(0);
	int N;
	cin >> N;
	a.resize(N);
	b.resize(N);
	rep(i,0,N)
		cin >> a[i];
	rep(i,0,N)
		cin >> b[i];
	a.push_back(getXor(a));
	b.push_back(getXor(b));
	A = a;
	B = b;
	sort(all(A));
	sort(all(B));
	if(A != B){
		cout << "-1" << endl;
		//assert(0);
		return 0;
	}
	if(a == b){
		cout << "0" << endl;
		return 0;
	}
	int ans = -1;
	bool canGo = false;
	rep(i,0,sz(b)){
		if(a[i] != b[i]){
			if(b[i] == a.back())
				canGo = true;
			if(i+1 != sz(b))
				++ans;
			inds[b[i]].push_back(a[i]);
		}
	}
	rep(i,0,sz(b)){
		if(a[i] == b[i] && i+1 != sz(b))
			continue;
		int x = b[i];
		if(seen.count(x))
			continue;
		++ans;
		dfs(x);
	}
	/*if(ans && a.back() == b.back() && !canGo)
		++ans;*/
	/*int ans = 0;
	while(!inds.empty()){
		++ans;
		if(!inds.count(a.back())){
			assert(a.back() == b.back());
			vector<int>* v = &(inds.begin()->second);
			if(b.back() == a[v->back()]){
				swap((*v)[0], (*v)[sz(*v)-1]);
			}
			int ind = v->back();
			swap(a[sz(a)-1], a[ind]);
		}
		else{
			vector<int>* v = &(inds[a.back()]);
			if(b.back() == a[v->back()]){
				swap((*v)[0], (*v)[sz(*v)-1]);
			}
			int ind = v->back();
			swap(a[sz(a)-1], a[ind]);
			inds[a[ind]].pop_back();
			if(inds[a[ind]].empty())
				inds.erase(a[ind]);
		}
	}*/
	cout << ans << endl;
}

Measured memory_bytes: 19968
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
struct edge {
    ll to, cost;

};
typedef vector<vector<edge> > AdjList;  // 隣接リストの型
AdjList graph;

vector<ll> dist;
typedef pair<int, int> P;
void dijkstra(int n, int s){
    dist = vector<ll>(n,INF64);
    dist[s] = 0;
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        if(dist[v] < p.first){
            continue;
        }
        for(int i=0;i < graph[v].size();i++){
            edge e = graph[v][i];
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                que.push(P(dist[e.to],e.to));
            }
        }
    }
}


int main(){
    int n;
    std::cin >> n;
    graph = AdjList(n);
    rep(i,n-1){
        ll from,to,cost;
        std::cin >> from>>to>>cost;
        from--;to--;
      //  std::cout << 123 << std::endl;
        graph[from].push_back((edge){to,cost});
        graph[to].push_back((edge){from,cost});
    }
    int q,k;
    std::cin >> q>>k;
    dijkstra(n,k-1);
    rep(i,q){
        int x,y;
        std::cin >> x>>y;
        x--;y--;
        std::cout << dist[x]+dist[y] << std::endl;
    }
}

Measured memory_bytes: 9984
#include<stdio.h>
#define MAX 2000
int n;
int A[MAX];
int solve(int,int);

int main(){
  int i;
  int q;
  int m[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
    if(solve(0,m[i])==1) printf("yes\n");
    else printf("no\n");
  }

  
  return 0;
}

int solve(int i,int m){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}




Measured memory_bytes: 2104
use std::str::FromStr;
use std::cmp::max;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}


fn main() {
    let nk : Vec<i64> = get_vec();
    let n = nk[0];
    let k = nk[1];
    let mut v : Vec<u64> = get_vec();
    v.sort();
    let mut ans = 0;
    //println!("{}", max(n-k,0));
    for i in 0..(max(n-k,0) as usize) {
        //println!("{}", i);
        ans += v[i];
    }
    println!("{}", ans);
}


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

int main() {
  int a,b; cin >> a >> b;
  
  if(a==1&&b==2||a==2&&b==1){
    cout << 3 << endl;
  }
  else if(a==1&&b==3||a==3&&b==1){
    cout << 2 << endl;
  }
  else {
    cout << 1 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;

int main() {
    string n;
    cin>>n;
    rep(i,n.size()) {
        if (n[i]=='1') n[i]='9';
        else n[i]='1';
    }
    cout<<n<<endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<double> t(N), v(N);
    double sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> t[i];
        sum += t[i];
    }
    t.push_back(0);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    //番兵
    v.push_back(0);

    double now_time = 0, now_speed = 0;
    double ans = 0;
    for (int i = 0; i < N; i++) {
        //printf("i = %d\n", i);
        //now_timeからnow_time + t[i]までの時間を走る
        //t[i]は3つに分けられる
        //速度を上げている時間,そのままの時間,下げる時間
        double up_time, keep_time, down_time;

        //次の時間が始まるときの制限速度
        double next_start_limit = INT_MAX;
        double tmp = 0;
        for (int j = i + 1; j <= N; j++) {
            next_start_limit = min(next_start_limit, v[j] + tmp);
            tmp += t[j];
        }

        //速度を上げる時間は今の制限速度までを考慮したものと、次の制限速度を考慮したものの小さい方
        up_time = min(v[i] - now_speed, (next_start_limit + t[i] - now_speed) / 2);
        up_time = min(up_time, t[i]);

        down_time = max(0.0, now_speed + up_time - next_start_limit);

        keep_time = t[i] - up_time - down_time;

        assert(0 <= up_time && up_time <= t[i]);
        assert(0 <= keep_time && keep_time <= t[i]);
        assert(0 <= down_time && down_time <= t[i]);

        ans += 0.5 * (now_speed + now_speed + up_time) * up_time;
        ans += (now_speed + up_time) * keep_time;
        ans += 0.5 * (now_speed + up_time + now_speed + up_time - down_time) * down_time;

        now_time += t[i];
        now_speed += up_time;
        now_speed -= down_time;
        //printf("%f, %f, %f\n", up_time, keep_time, down_time);
        //printf("ans = %.4f\n", ans);
    }
    printf("%.6f\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}

struct edge{int to, cost;};

class Graph
{
public:
    int V;
    vector<vector<edge>> G;

    Graph(int V): V(V){
        G = vector<vector<edge>>(V, vector<edge>(0));
    }

    void add_edge(int from, int to, int cost){
        G[from].push_back(edge({to, cost}));
    }

    void add_edge2(int v1, int v2, int cost){
        add_edge(v1, v2, cost);
        add_edge(v2, v1, cost);
    }

    vec dijkstra(int s, int t){
        vec d(V);
        priority_queue<Pii, vector<Pii>, greater<Pii>> que;
        fill(d.begin(), d.end(), INF);
        d[s] = 0;
        que.push(Pii(0, s));

        while(!que.empty()){
            Pii p = que.top(); que.pop();
            int v = p.second;
            if(v == t) return d;
            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;
                    que.push(Pii(d[e.to], e.to));
                }
            }
        }
        return d;
    }

};

signed main(){

    int n, m, s, t; cin >> n >> m >> s >> t;
    Graph Y(n), S(n);
    int u, v, a, b;
    REP(i, m){
        cin >> u >> v >> a >> b;
        Y.add_edge2(u - 1, v - 1, a);
        S.add_edge2(u - 1, v - 1, b);
    }
    vec dY = Y.dijkstra(s - 1, -1);
    vec dS = S.dijkstra(t - 1, -1);

    vec ans(n);
    int M = INF;
    IREP(i, n){
        M = min(M, dY[i] + dS[i]);
        ans[i] = M;
    }
    REP(i, n) cout << 1000000000000000 - ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 19012
/// u ? wara

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define X first
#define Y second

#define all(v) (v).begin(), (v).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,b) FOR(i,0,b)
#define reps FOR
#define eb emplace_back
#define pb eb

template<class T> inline bool MX(T &l, const T &r) { return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l, const T &r) { return l>r?l=r,1:0;}

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

const int INF = 0x3fffffff;
const int B = 3145;

int N;
int K;
int a[70];
int r[70];
int b[70];
int dp[70][70][B];

signed main() {
  int asum = 0;
  int bsum = 0;
  int rsum = 0;
  cin >> N >> K;
  reps(i, 1, N+1) {
    cin >> a[i];
    asum += a[i];
  }
  sort(a+1, a+N+1, greater<int>());
  reps(i, 1, K+1) {
    cin >> r[i];
    rsum += r[i];
  }
  sort(r+1, r+K+1, greater<int>());
  reps(i, 1, K+1) {
    cin >> b[i];
    bsum += b[i];
  }
  sort(b+1, b+K+1, greater<int>());

  fill(dp[0][0], dp[N+1][0], INF);
  dp[0][0][0] = 0;
  rep(i, N) {
    int lim = min(i, K);
    rep(j, lim+1) {
      int k = i - j;
      if (k > K) continue;
      assert(k >= 0 && k <= K);
      rep(l, B) {
        int cost = dp[i][j][l];
        if (cost == INF) continue;
        //cout << i << ", " << j << ", " << l << endl;
        // ai+1 rj+1
        if (j < K && l+a[i+1] < B) {
          int d = r[j+1] - a[i+1];
          int nl = l+a[i+1];
          //cout <<"upd"<< i+1 << ", " << j+1 << ", " << nl << endl;
          if (d >= 0) {
            MN(dp[i+1][j+1][nl], cost);
          } else {
            MN(dp[i+1][j+1][nl], cost + abs(d));
          }
        }

        if (k < K) {
          int d = b[k+1] - a[i+1];
          //cout <<"upd"<< i+1 << ", " << j << ", " << l << endl;
          if (d >= 0) {
            MN(dp[i+1][j][l], cost);
          } else {
            MN(dp[i+1][j][l], cost + abs(d));
          }
        }
      }
    }
  }

  int ans = INF;
  rep(j, K+1) {
    int k = N - j;
    if (k > K) continue;
    if (k < 0) continue;
    rep(l, B) {
      assert(k >= 0 && k <= K);
      int rsup = rsum - l;
      int bsup = bsum - (asum - l);
      if (rsup < 0 || bsup < 0) continue;
      MN(ans, dp[N][j][l]);
    }
  }
  if (ans == INF) cout << "-1" << endl;
  else cout << ans << endl;
}



Measured memory_bytes: 108068
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

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

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 long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[20][20];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}
ll dp[20500];
int main() {
	cin >> n;
	vector<ll> p(n);
	vector<ll> q(n);
	ll res = 0;
	rep(i, n) {
		cin >> p[i];
	}
	ll tmp = p[0];
	q[0] = p[0];
	rep(i, n) {
		chmin(tmp, p[i]);
		q[i] = tmp;
	}
	rep(i, n) {
		if (p[i] <= q[i]) {
			++res;
		}
	}
	cout << res << endl;
}



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

const ll MAX_BIT = 60;
const ll MOD = 1e9 + 7;
int main() {
    int N; cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll ans = 0;
    for(ll k = 0; k < MAX_BIT; ++k) {
        ll ones = 0;
        rep(i, N) {
            if(A[i] & (1LL << k)) ones++;
        }
        ans = (ans + ones * (N - ones) % MOD * ((1LL << k) % MOD) % MOD) % MOD;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    int N, L; cin >> N >> L;
    vector<int> A(N); for (auto &a : A) cin >> a;
    int lasttwo = -1;
    for (int i = 0; i < N-1; i++) {
        if (A[i] + A[i+1] >= L) lasttwo = i;
    }
    if (lasttwo == -1) {
        cout << "Impossible" << endl;
    } else {
        cout << "Possible" << endl;
        for (int i = 0; i < lasttwo; i++) {
            cout << i+1 << ' ';
        }
        for (int i = N-2; i >= lasttwo; i--) {
            cout << i+1 << ' ';
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
//#include <random>
#include <map>
//#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <time.h>
//#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
//#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
double pi = 3.141592653589793;
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

int main() {
	int k, n;
	cin >> n >> k;
	vector<int> p(n);
	rep(i, n) {
		cin >> p[i];
	}
	SORT(p);
	int ans = 0;
	rep(i, k) {
		ans += p[i];
	}
	cout << ans << endl;
}






Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i;
  int N,A;
  int count=0;
  int first;
  cin >> N;
  for(i=0; i<N; i++){
    cin >> A;
    while(A%2==0){
      A/=2;
      count++;
    }
    if(i==0)
      first=count;
    if(count<first)
      first=count;
    count=0;
  }
  cout << first << endl;
}

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


void invalid(){
	cout << "INVALID" << endl;
}

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

	if (s.length() < 6){
		invalid();
		return 0;
	}

	bool checkUpper = false, checkLower = false, checkDigit = false;

	for (int i = 0; i < s.length(); ++i){
		if ((int)s.at(i) >= 65 && (int)s.at(i) <= 90){
			checkUpper = true;
		}
		if ((int)s.at(i) >= 97 && (int)s.at(i) <= 122){
			checkLower = true;
		}

		if ((int)s.at(i) >= 48 && (int)s.at(i) <= 57){
			checkDigit = true;
		}
	}

	if ((checkUpper + checkLower + checkDigit) == 3){
		cout << "VALID" << endl;
		return 0;
	}

	invalid();

	

	return 0;
}

Measured memory_bytes: 1184
#include <stdio.h> 
#include <string.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#define n_max 10000000
#define c_max 20000000
 
char muki_bestuff_10_x[1001],muki_bestuff_10_y[1001]; 
int k_LO_stuff_10o_10(void);
void k_hep();
void ck();
 
int main(){ 
  int i,n,ko[n_max],hu[c_max];
  long long ji[n_max*56];
  for(long long g=0;g<n_max*32;g++){
  k_hep();
  ck();
  }
  scanf("%d",&n); 
  for(i=0 ; i<n ; i++){ 
    scanf("%s%s",muki_bestuff_10_x,muki_bestuff_10_y); 
    printf("%d\n",k_LO_stuff_10o_10()); 
  } 
  return 0; 
}


int k_LO_stuff_10o_10(void){ 
  int i,j; 
  int m = strlen(muki_bestuff_10_x); 
  int n = strlen(muki_bestuff_10_y); 
  int stuff_10[m+1][n+1]; 
 
  for(i=1 ; i<=m ; i++) stuff_10[i][0] = 0; 
  for(j=0 ; j<=n ; j++) stuff_10[0][j] = 0; 
   
  for(i=1 ; i<=m ; i++){ 
    for(j=1 ; j<=n ; j++){ 
      if(muki_bestuff_10_x[i-1] == muki_bestuff_10_y[j-1]) stuff_10[i][j] = stuff_10[i-1][j-1] + 1; 
      else if(stuff_10[i-1][j] >= stuff_10[i][j-1]) stuff_10[i][j] = stuff_10[i-1][j]; 
      else stuff_10[i][j] = stuff_10[i][j-1]; 
    } 
  } 
  return stuff_10[m][n];  
}


void k_hep(){
  int i=100;
  int size=1000*1000*100;
  char *chek;
  for(int j=0;j<n_max;j++){
    chek=(char *)malloc(sizeof(long)*size);
    chek[j]='y';
  }
  
}

void ck(){
  char gg[n_max],js[n_max];
  for(int i=0;i<n_max;i++){
    k_hep();
  }
}



Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 long long int gcd(long long int m,long long int n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
long long int lcm(long long int number1,long long int number2){
	return number1 * number2 / gcd(number1,number2);	

}
int main(){
  ll A,B,C,D,E,F;
  cin>>A>>B>>C>>D>>E>>F;
  
  double max2=0;
  ll sugar=0;
  ll water=0;
  
  for(ll i=0;i*100*A<F;i++){//A
    for(ll j=0;j*100*B<F;j++){//B
      for(ll k=0;k*C<F;k++){//C
        for(ll m=0;m*D<F;m++){//D
          if(k*C+m*D+A*100*i+B*100*j>F){
            continue;
          }
          
          if(i==0&&j==0){
            continue;
          }
          
        double unko=double(double(k*C+m*D)/double(A*100*i+B*100*j+k*C+m*D));
          
          if(max2<=unko&&(k*C+m*D)<=E*(A*i+B*j)){
            max2=double(double(k*C+m*D)/double(A*100*i+B*100*j+k*C+m*D));
          sugar=(k*C+m*D);
            water=(A*100*i+B*100*j);
          }
          }
        }
      }
    }
  
  
  cout<<water+sugar<<" "<<sugar<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 57;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;

lli z[N], ans = 0, n;

void calz(string x)
{
    lli l, r;
    l = r = 0;
    for(int  i = 0; i < n; i ++)
        z[i] = 0;
    for(int i = 1; i < n; i ++)
    {
        if(i < r)
            z[i] = min(r - i, z[i - l]);
        while(i + z[i] < n && x[z[i]] == x[i + z[i]])
            z[i] ++;
        if(i + z[i] > r)
        {
            l = i;
            r = i + z[i];
        }
    }
    for(int i = 1; i < n; i ++)
    {
        ans = max(ans, min((lli)i, z[i]));
    }
    return ;
}

void solve()
{
    cin>>n;
    string s;
    cin>>s;
    while(n > 0)
    {
        calz(s);
        n --;
        for(int i = 0; i < n; i ++)
            s[i] = s[i + 1];
    }
    cout<<ans;
    return ;
}
/*
7
6 7 4 1 2 11 6
5
1 2 10 4 5
*/

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

    lli t;
    t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

using i64 = long long;
using u64 = unsigned long long;

const int mod = 998244353;

void __print() {cerr << "]\n";}

template<typename T, typename... V>
void __print(T t, V... v)
{ cerr << t; if(sizeof...(v)) cerr << ", "; __print(v...);}

#define dbg(x...) cerr << "[" << #x << "] = [", __print(x)
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(NULL)

i64 dp[300000];
i64 q_sum[1000000];

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    vector<pair<int, int>> v;
    while(k--) {
        int l, r;
        scanf("%d%d", &l, &r);
        v.push_back({l, r});
    }
    dp[1] = 1;
    for(int i = 1; i <= n; i++) {
        q_sum[i] += q_sum[i-1];
        q_sum[i] %= mod;
        dp[i] += q_sum[i];
        dp[i] %= mod;
        for(auto p : v) {
            int x, y;
            tie(x, y) = p;
            q_sum[i+x] += dp[i];
            q_sum[i+x] %= mod;
            q_sum[i+y+1] -= dp[i];
            q_sum[i+y+1] %= mod;
        }
    }
    // for(int i = 1; i <= n; i++) dbg(dp[i]);
    // for(int i = 1; i <= n; i++) dbg(q_sum[i]);
    dp[n] %= mod;
    dp[n] += mod;
    dp[n] %= mod;
    printf("%lld\n", dp[n]);
}


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

int main()
{
    ios::sync_with_stdio(false);
    int a, b,cont=0; 
    double t;

    cin >> a >> b;
    cin >> t;
    
    for(int i = 1;i<t+0.5;i++){
        if(i%(a)==0 or i%(2*a)==0 or i%(3*a)==0){
            cont+=b;
        }
    }

    cout<< cont <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef double db;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int N = 2e5 + 5;
int n, m, k;
struct node{
    db x,y;
}a[11];
db sum;
int cnt;
void solve(node a[],int k,int m){
    if(k == m){
       // rep(i,0,m-1) printf("(%.2f,%.2f) ",a[i].x,a[i].y); puts("");
        rep(i,1,m-1) sum += sqrt((a[i].x-a[i-1].x)*(a[i].x-a[i-1].x) + (a[i].y-a[i-1].y)*(a[i].y-a[i-1].y));
        cnt++;
    }
    else{
        for(int j=k;j<m;j++){
            swap(a[j],a[k]);
            solve(a,k+1,m);
            swap(a[j],a[k]);
        }
    }
}

int main(){
    sum = 0;
    cnt = 0;
    scanf("%d", &n);
    rep(i,0,n-1){
        scanf("%lf%lf",&a[i].x,&a[i].y);
    }
    solve(a,0,n);
    printf("%.10f\n", sum / cnt);
    return 0;
}



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

#define ARRAY_SIZE 1

int main()
{
	int inputA[ARRAY_SIZE];
	int inputB[ARRAY_SIZE];
	int valueN, valueM;

	scanf("%d""%d", &inputA, &inputB);

	valueM = inputA[0];
	valueN = inputB[0];

	if (valueM == valueN)
	{
		printf("Yes \n");
	}
	else
	{
		printf("No \n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ret = "";
  for (int i = 0; i < n; ++i) {
    ret += s[i];
    ret += t[i];
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------

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

  ll a,b; int k; cin >> a >> b >> k;
  rep(i,k){
    if(i%2==0){
      if(a%2==1){
         a--;
      }else{}
      b+=a/2;
      a/=2;
    }
    if(i%2==1){
      if(b%2==1){
         b--;
       }else{}
       a+=b/2;
       b/=2;
    }
  }

  cout << a << " " << b << endl;


  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i=0;i<N;i++){
        cin >> v.at(i);
    }

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

    cout << v.at(N-1) - v.at(0) << endl;
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace abc119_d
{
  class Program
  {
    private static int a, b, q;
    private static long[] s, t, x;

    static void Main(string[] args)
    {
      a = ConsoleInput.ReadAsInt();
      b = ConsoleInput.ReadAsInt();
      q = ConsoleInput.ReadAsInt();

      s = ConsoleInput.ReadAsLongArray(a);
      t = ConsoleInput.ReadAsLongArray(b);
      x = ConsoleInput.ReadAsLongArray(q);

      for (int i = 0; i < q; i++)
      {
        long ans = -1;

        var sEast = ~Array.BinarySearch<long>(s, x[i]);
        var tEast = ~Array.BinarySearch<long>(t, x[i]);

        foreach (int sIndex in new int[] { sEast - 1, sEast })
        {
          foreach (int tIndex in new int[] { tEast - 1, tEast })
          {
            if (sIndex >= 0 && sIndex < a && tIndex >= 0 && tIndex < b)
            {
              var distance = Math.Min(Math.Abs(s[sIndex] - x[i]) + Math.Abs(t[tIndex] - s[sIndex]), Math.Abs(t[tIndex] - x[i]) + Math.Abs(s[sIndex] - t[tIndex]));

              if (ans == -1 || distance < ans)
              {
                ans = distance;
              }
            }
          }
        }

        Console.WriteLine(ans);
      }
    }
  }

  class ConsoleInput
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }

      return fieldBuffer.Dequeue();
    }

    public static int ReadAsInt() => int.Parse(Read());
    public static long ReadAsLong() => long.Parse(Read());
    public static double ReadAsDouble() => double.Parse(Read());

    public static string[] ReadAsStringArray(long n)
    {
      var array = new string[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }

      return array;
    }

    public static int[] ReadAsIntArray(long n)
    {
      var array = new int[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsInt();
      }

      return array;
    }

    public static long[] ReadAsLongArray(long n)
    {
      var array = new long[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsLong();
      }

      return array;
    }
    public static double[] ReadAsDoubleArray(long n)
    {
      var array = new double[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsDouble();
      }

      return array;
    }
  }
}


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

int main()
{
	int month,day,tooshi;
	while(true)
	{
	cin >> month;
	cin >> day;
	if(month==0&&day==0)break;
	switch (month)
	{
		case 1:
		tooshi = day;
		break;
		case 2:
		tooshi = day+31;
		break;
		case 3:
		tooshi = day+60;
		break;
		case 4:
		tooshi = day+91;
		break;
		case 5:
		tooshi = day+121;
		break;
		case 6:
		tooshi = day+152;
		break;
		case 7:
		tooshi = day+182;
		break;
		case 8:
		tooshi = day+213;
		break;
		case 9:
		tooshi = day+244;
		break;
		case 10:
		tooshi = day+274;
		break;
		case 11:
		tooshi = day+305;
		break;
		case 12:
		tooshi = day+335;
		break;
	}

	switch (tooshi % 7)
	{
		case 0:
		cout << "Wednesday" << endl;
		break;
		case 1:
		cout << "Thursday" << endl;
		break;
		case 2:
		cout << "Friday" << endl;
		break;
		case 3:
		cout << "Saturday" << endl;
		break;
		case 4:
		cout << "Sunday" << endl;
		break;
		case 5:
		cout << "Monday" << endl;
		break;
		case 6:
		cout << "Tuesday" << endl;
		break;
	}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()

int keta (int a){
    int res=0;
    while(a){
        res++;
        a/=10;
    }
    return res;
}


int main(){
    int a,b; cin>>a>>b;
    int c=a*pow(10,keta(b))+b;
    int res=sqrt(c);
    if(res*res==c){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3948
//                          VIVEK UPADHYAY
//                          MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D

// g++ -std=c++11 file_name.cpp
// ./file_name.out
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
#define fill(A, VAL) memset(A, VAL, sizeof(A))
#define sz(a) ((int) a.size())
typedef long long ll ;
const int MAXN = 5*1e5 + 10;

int main () {
    
    int A , B ;
    cin >> A >> B ;
    if(A <= 5) cout<<0<<endl;
    else if(A > 5 && A <= 12) cout<<B/2<<endl;
    else cout<<B<<endl;
    
    
    return 0 ;
}


Measured memory_bytes: 256