akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastt ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main()
{
	fastt

	ll n;
	cin>>n;
	cout<<(n*(n+1))/2<<endl;

	return 0;
}



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

int main(){
    using namespace std;
    size_t N, K;
    cin >> N >> K;
    vector<size_t> p(N + 1), n(N + 1);
    for(size_t i = 1; i <= N; ++i){
        long a;
        cin >> a;
        (a > 0 ? p : n)[i] = abs(a);
    }
    partial_sum(p.begin(), p.end(), p.begin());
    partial_sum(n.begin(), n.end(), n.begin());
    size_t ans{numeric_limits<size_t>::max()};
    for(size_t i = K; i <= N; ++i)ans = min(ans, p[i] - p[i - K]);
    for(size_t i = K; i <= N; ++i)ans = min(ans, n[i] - n[i - K]);
    cout << p.back() - ans << endl;
    return 0;
}

Measured memory_bytes: 1792
/*
                   _ooOoo_
                  o8888888o
                  88" . "88　AC!AC!
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
int main(){
    ll n;cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    sort(all(vec));
    ll res=1;
    ll sum=vec[0];
    rep3(i,1,n){
        if(sum*2>=vec[i]){
            res++;
            sum+=vec[i];
        }else{
            res=1;
            sum+=vec[i];
        }
       // cout<<res<<" "<<sum<<endl;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);

		int i = 0;
		int min = 0;
		int max = 0;

		while(true){	
		int x = scan.nextInt();
		int y = scan.nextInt();
		if(x>y || x==y){
			min = y;
			max = x;
		}else{
			min = x;
			max = y;
		}
		if(x==0 && y==0) break;
		System.out.println(min + " " + max);
		}
	}
} 

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

double INF = 1e18;

vector<double> dijkstra(int s, int n, vector<double> cost[]){
    vector<double> dist(n, INF);
    vector<bool> used(n, false);
    dist[s] = 0;
    while(true){
        int v = -1;
        for(int u=0; u<n; u++){
            if(!used[u] && (v == -1 || dist[u] < dist[v])) v = u;
        }
        if(v == -1) break;
        used[v] = true;
        for(int u=0; u<n; u++){
            dist[u] = min(dist[u], dist[v] + cost[v][u]);
        }
    }
    return dist;
}

int main(){
    int X[1002], Y[1002], R[1002] = {0};
    for(int i=0; i<2; i++) cin >> X[i] >> Y[i];
    int N;
    cin >> N;
    for(int i=2; i<N+2; i++) cin >> X[i] >> Y[i] >> R[i];
    N += 2;
    vector<double> cost[1002];
    for(int i=0; i<N; i++) for(int j=0; j<N; j++){
        double x = X[i] - X[j];
        double y = Y[i] - Y[j];
        cost[i].push_back(max(0.0, sqrt(x*x + y*y) - R[i] - R[j]));
    }
    auto dist = dijkstra(0, N, cost);
    cout << fixed << setprecision(10) << dist[1] << endl;
}


Measured memory_bytes: 8320
n = int(input())
a = list(map(int,input().split()))
tmp = [0] * (max(a) +1)
for i in a:
    tmp[i] += 1
ans = [0] * (max(a) +1)
for i in range(len(tmp)):
    ans[i] = tmp[i] * (tmp[i]-1) // 2

sumans = sum(ans)
for i in a:
    print(sumans - ans[i] + (tmp[i]-1)*(tmp[i]-2)//2)

Measured memory_bytes: 26268
def insert(l,x)
  return l.unshift(x)
end

def delete(l,x)
  for i in 0..l.size-1 do
    if l[i]==x
      return l.delete_at(i)
    end
  end
end

def deleteFirst(l)
  return l.shift
end

def deleteLast(l)
  return l.pop
end

n = gets.chomp.to_i
l = []
for i in 1..n do
  c = gets.chomp.split(" ")
  case c[0]
  when "insert" then
    insert(l,c[1])
  when "delete" then
    delete(l,c[1])
  when "deleteFirst" then
    deleteFirst(l)
  when "deleteLast" then
    deleteLast(l)
  end
end
printf("%s\n",l.join(" "))


Measured memory_bytes: 76084
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int a,c,b;
   // string s,ss;
    cin>>a>>b>>c;
    if((b-a)==(c-b))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}








Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main() {
	string str;
	int n = 0, x = 0;
	cin >> str;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'A' || str[i] == 'C' || str[i] == 'G' || str[i] == 'T') 
			n++;
		else if (x < n) {
			x = n;
			n = 0;
		}
	}
	if (x < n)
		x = n;
	cout << x << endl;
}

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

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

  int ans = 0;
  for (int i = 0; i <= n; i++) {
    int cnt = 0;
    int num = i;
    while (num > 0) {
      cnt++;
      num /= 10;
    }
    if (cnt % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;


int main() {
	int n, k; cin >> n >> k;
	cout << n - k + 1 << endl;
	return 0;
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

// 繰り返し二乗法
ll power(ll a, ll b){
    if(a==1)return a;
    // if(a==0)re
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}

const int MAX=2100000;

ll fact[MAX], fact_inv[MAX];

void init_fact(ll n){
    fact[0]=1;
    // 階乗の計算
    for(ll i=0; i<n; i++) fact[i+1]=fact[i]*(i+1)%MOD;
    fact_inv[n]=power(fact[n], MOD-2);
    // 逆元の計算
    for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}

ll comb(ll n, ll r){
    return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll perm(ll n, ll r){
    return (fact[n]*fact_inv[n-r])%MOD;
}

int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint a(n); rep(i,n) cin>>a[i];
    sort(ALL(a), greater<ll>());

    auto isOK = [&](ll k){

        vint delta(n,0);
        ll cnt = 0;
        while(true){
            bool ok = true;
            rep(i,a.size()){
                ll diff = ( a[i] - delta[i] + cnt ) - (n-1);
                if(diff <= 0) continue;
                ll tmpcnt = diff/n + min(1ll, diff%n);
                delta[i] += tmpcnt*n;
                delta[i] += tmpcnt;
                cnt += tmpcnt;
                ok = false;
            }
            if(ok) break;
        }
        return cnt <= k;

    };

    ll left, right;
    left = -1; right = 1e18;
    while(right - left > 1){
        ll mid = (left + right)/2;
        if(isOK(mid)) right = mid;
        else left = mid;
    }
    cout<<right<<endl;

    return 0;

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
int main(){
  vector<ll> vec;
  vec.push_back(0);
  ll n,k;
  cin>>n>>k;
  ll dp[305][305]={0};
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }
  for(int i=0;i<305;i++){
    for(int j=0;j<305;j++) dp[i][j]=174417441744;
  }
  dp[0][0]=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n-k;j++){
      for(int k=0;k<i;k++){
        dp[i][j]=min(dp[i][j],dp[k][j-1]+max((ll)0,(vec[i]-vec[k])));
      }
    }
  }
  ll ans=174417441744;
  for(int i=0;i<=n;i++) ans=min(ans,dp[i][n-k]);
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

def main(): 
    N,M=map(int,input().split())
    a=[int(input()) for _ in range(M)]
    a.sort(reverse=True)
    ans=[0]*(N+1)
    ans[0]=1
    if not(len(a) != 0 and a[-1] == 1):
        ans[1]=1
    else:
        a.pop()
    for i in range(2,N+1):
        if len(a) != 0 and a[-1] == i:
            a.pop()
        else:
            ans[i] = ans[i-1]+ans[i-2]
            #ans[i]%=1000000007
    print(ans[N]%1000000007)
if __name__ == "__main__":
    main()
    

Measured memory_bytes: 460020
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    int A[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    if(A[x] == A[y]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
import math
n, p = list(map(int, input().split()))
li = []
box = []
m = 1
k = 1
q = p

while True:
    for i in range(2,int(math.sqrt(q)) + 1):
        if p % i == 0:
            p = p // i
            li.append(i)
            k = i
            break
        else:
            continue
    else:
        break

for i in range(2,k+1):
    if i in li:
        box.append(i)

if n > len(li):
    print(m)
elif n == 1:
    print(q)
else:
    for j in box:
        if li.count(j) // n > 0:
            m *= j ** (li.count(j) // n)
    print(m)

Measured memory_bytes: 3064
MOD=10**9+7
n, k=gets.split.map &:to_i
a=gets.split.map(&:to_i).sort_by(&:abs).reverse

res=1
nc=0
neg=[]
pos=[]
(0...k).each{|i|
    res=res*a[i].abs%MOD
    if a[i]<0
        neg << a[i].abs
        nc+=1
    else
        pos << a[i]
    end
}

if nc.even? || n==k
    res=-res%MOD if nc.odd?
    puts res
    exit
end

x, y=a[k...n].minmax

if x>=0
    res=res*neg[-1].pow(MOD-2, MOD)*y%MOD
    puts res
    exit
end

if y<=0
    if pos.size>0
        res=res*pos[-1].pow(MOD-2, MOD)*x.abs%MOD
    else
        res=1
        (1..k).each{|i| res=res*a[-i].abs%MOD }
        res=-res%MOD
    end
    puts res
    exit
end

if pos.size>0 && neg[-1]*x.abs>pos[-1]*y
    res=res*pos[-1].pow(MOD-2, MOD)*-x%MOD
else
    res=res*neg[-1].pow(MOD-2, MOD)*y%MOD
end
puts res




Measured memory_bytes: 34348
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const int MOD = 1e9+7;

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

    vector <ll> cnt(26, 1);
    for (int i = 0; i < n; i++) {
        cnt[s[i] - 'a']++;
    }

    ll ans = 1LL;
    for (int i = 0; i < 26; i++) {
        if (cnt[i] > 1) ans = (ans * cnt[i]) % MOD;
    }

    cout << (ans + MOD - 1) % MOD << "\n";
    return 0;
}

Measured memory_bytes: 1144
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(llint i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define Pll pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
const ll mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
const ll INF = 1000000000;


int main() {
	int n, m, r;
	cin >> n >> m >> r;
	whei(llint) dist(200, hei(llint)(200, 10000000));
	rep(i, 0, 200)dist[i][i] = 0;
	int a[8];
	rep(i, 0, r) {
		cin >> a[i];
		a[i]--;
	}
	rep(i, 0, m) {
		int A, B; 
		llint C;
		cin >> A >> B >> C;
		A--;
		B--;
		dist[A][B] = min(dist[A][B], C);
		dist[B][A] = min(dist[B][A], C);
	}
		rep(k, 0, n) {
			rep(i, 0, n) {
				rep(j,0,n){
					dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			    }
		    }
	    }
	llint ans = INF;
	sort(a, a + r);
	do {
		llint sum = 0;
		rep(i, 0, r - 1)sum += dist[a[i]][a[i + 1]];
		ans = min(ans, sum);

	} while (next_permutation(a, a + r));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3956
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        int c[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
        }

        Arrays.sort(a);
        Arrays.sort(b);
        Arrays.sort(c);

        int ci = 0;
        long bn[] = new long[n];
        boolean end = false;
        for (int i = 0; i < n; i++) {
            while (c[ci] <= b[i]) {
                ci++;
                if (ci >= n) {
                    end = true;
                    break;
                }
            }
            if (end) {
                for (int j = i + 1; j < n; j++) {
                    bn[i] = 0;
                }
                break;
            } else {
                bn[i] = n;
                bn[i] -= ci;
            }
        }

        for (int i = n - 2; i >= 0; i--) {
            bn[i] += bn[i + 1];
        }

        long total = 0;
        int bi = 0;
        for (int i = 0; i < n; i++) {
            while (b[bi] <= a[i]) {
                bi++;
                if (bi >= n) {
                    System.out.println(total);
                    return;
                }
            }
            total += bn[bi];
        }

        System.out.println(total);
    }
}

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

int main(){
    string s,t;
    cin >> s;
    t="CODEFESTIVAL2016";
    int ans=0;
    
    for(int i=0;i<t.length();i++){
        if(s[i]!=t[i]) ans++;
    }
    
    cout << ans << endl;

    return 0;
}







Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<map>
#include<vector>
#include<climits>
using namespace std;
struct edge{int to, cost;};
typedef pair<int, int> P;

int V, E, r;
vector<edge> G[100000];
int d[100000];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INT_MAX);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i=0; i<G[v].size(); ++i){
            edge e = G[v][i];
            if(d[e.to] > d[v]+e.cost){
                d[e.to] = d[v]+e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
int main(){
    cin >> V >> E >> r;
    for(int i=0; i<E; ++i){
        int s, t, d;
        cin >> s >> t >> d;
        edge e;
        e.to = t;
        e.cost = d;
        G[s].push_back(e);
    }
    dijkstra(r);
    for(int i=0; i<V; ++i){
       if(d[i]==INT_MAX) cout << "INF" << endl;
       else cout << d[i] << endl;
    }
}

Measured memory_bytes: 11304
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main() {
    int n;cin>>n;
    int ans=INF;
    for(int i=1;i*i<=n;i++){
        if(n%i==0)ans=min(ans,i+n/i);
    }
    cout<<ans-2<<endl;
}

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

int main()
{
        int array[100], array_num = 0, count = 0, count_in = 0;
        int key, output_count = 0;

        scanf("%d", &array_num);
        while ( count < array_num )
        {
                scanf("%d", &array[count]);
                count = count + 1;
        }

        for ( count = 1 ; count < array_num ; count = count + 1 )
        {
                key = array[count];
                while ( output_count < array_num )
                {
                        if ( output_count == array_num - 1 )
                        {
                                printf("%d\n", array[output_count]);
                        }
                        else
                        {
                                printf("%d ", array[output_count]);
                        }
                        output_count = output_count + 1;
                }

                count_in = count - 1;
                while (( count_in >= 0 ) && ( array[count_in] > key ))
                {
                        array[count_in + 1] = array[count_in];
                        count_in = count_in - 1;
                }
                array[count_in + 1] = key;

                output_count = 0;
        }

        while ( output_count < array_num )
        {
                if ( output_count == array_num - 1 )
                {
                        printf("%d\n", array[output_count]);
                }
                else
                {
                        printf("%d ", array[output_count]);
                }
                output_count = output_count + 1;
        }

        return 0;
}

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

int main(int argc, void **arg)
{
    long long n;
    long long a[100000+1];
    long long b[100000];
    long long i, j;
    long long monster = 0;
    long long x, y;

    scanf("%lld", &n);

    for (i = 0; i < n + 1; i++)
    {
        scanf("%lld", &a[i]);
    }
    for (i = 0; i < n; i++)
    {
        scanf("%lld", &b[i]);
    }

    for (i = 0; i < n; i++)
    {
        if( a[i] > 0 ) {
            x = a[i];
            y = b[i];

            a[i] -= b[i];
            b[i] -= x;

            if( a[i] > 0 ) {
                monster += y;
            } else {
                monster += x;
            }
        }

        if( a[i+1] > 0 && b[i] > 0 ) {
            x = a[i+1];
            y = b[i];

            a[i+1] -= b[i];
            b[i] -= x;

            if( a[i+1] > 0 ) {
                monster += y;
            } else {
                monster += x;
            }
        }
    }

    printf("%lld\n", monster);

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,x=0,xx=0,xxx=0;
	cin>>a>>b;
	x=1900*b;xx=10*10*(a-b);
	xxx=pow(2,b);
	cout<<(x+xx)*xxx;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner stdin=new Scanner(System.in);
		int n=stdin.nextInt();
		int t[]=new int[n];
		int x[]=new int[n];
		int y[]=new int [n];
		for(int i=0;i<n;i++){
			int f=stdin.nextInt();
			int g=stdin.nextInt();
			int h=stdin.nextInt();
			t[i]=f;
			x[i]=g;
			y[i]=h;
		}
		//		int j=0,k=0,l=0;
		int flag=0;
		for(int u=0;u<n;u++){
			if(t[u]%2==((x[u]+y[u])%2) && t[u]>=(x[u]+y[u]))
				//			System.out.println("Yes");
				flag=1;
			else{
				//			System.out.println("No");
				flag=0; break;
			}
		}
		if(flag==1)
			System.out.println("Yes");
		else if(flag==0)
			System.out.println("No");
	}
}

Measured memory_bytes: 91060
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string in;
	int count = 0;
	cin >> in;
	for (int i = 0; i < in.length(); i++) {
		if (in[i] == '2') {
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int x,y,d,e,a;
  scanf("%d",&x);
  scanf("%d",&y);
  if(x<y){
    d=x;
    e=y;
  }if(x>y){
    d=y;
    e=x;
  }
  a=e%d;
  while(a!=0){
    e=d;
    d=a;
    a=e%d;
  }
  printf("%d\n",d);
  return 0;
}



Measured memory_bytes: 2128
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <utility>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef pair<ll, double> PD;
//ll mod = 1000000007;
//ll mod = 998244353;

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<string>> a(h, vector<string>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
			if (a[i][j] == "snuke") {
				cout << (char)('A' + j) << i + 1 << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
import bisect

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

answer = 0
for b in B:
    ai = bisect.bisect_left(A, b)
    ci = bisect.bisect_right(C, b)
    answer += ai * (N - ci)

print(answer)


Measured memory_bytes: 23092
#include<iostream>
#include<string>
//using namespace std;

int main(){
    while(1){
        int x[4];
        std::string num;
        std::cin>>num;
        
        if(num[0] == '0'){
            break;
        }
        
    int sum=0;
    for(int i=0; i< (int)num.size(); i++){
        x[i] = (int)(num[i] - '0');
        sum+= x[i];
    }
    std::cout<<sum<<std::endl;

    }
    return 0;
}


Measured memory_bytes: 3192
import java.util.*;
public class Main {
	public static class bitset {
		long[] a=new long[8];
		public void set(long v,int id) {
			a[id/50]|=v<<(id%50);
		}
		public int get(int id) {
			return (int)((a[id/50]>>(id%50))&1);
		}
		public void xor(bitset rhs) {
			for (int i=0;i<8;++i) a[i]^=rhs.a[i];
		}
	}
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int m=in.nextInt();
		bitset[] bit=new bitset[n];
		for (int i=0;i<n;++i) {
			bit[i]=new bitset();
			for (int j=0;j<m;++j) {
				int x=in.nextInt();
				bit[i].set(x,j);
			}
		}
		long mod=998244353;
		long[] p=new long[n+m];
		p[0]=1;
		for (int i=1;i<n+m;++i) p[i]=(p[i-1]+p[i-1])%mod;
		int rk=0;
		for (int i=0;i<m;++i) {
			boolean flag=false;
			for (int j=rk;j<n;++j) if (bit[j].get(i)==1) {
				bitset tmp=bit[j];
				bit[j]=bit[rk];
				bit[rk]=tmp;
				flag=true;
				break;
			}
			if (!flag) continue;
			++rk;
			for (int j=rk;j<n;++j) if (bit[j].get(i)==1)
				bit[j].xor(bit[rk-1]);
		}
		System.out.println((p[n+m-1]-p[n+m-1-rk]+mod)%mod);
	}
}

Measured memory_bytes: 51760
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i, n) {
        cin >> h[i];        
    }
    sort(h.begin(), h.end());
    ll ans = LINF;
    rep(i, n - k + 1){
        ll tmp = h[i + k - 1] - h[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
<?php
list($X, $Y, $Z, $K) = explode(" ", trim(fgets(STDIN)));
$a = explode(" ", trim(fgets(STDIN)));
$b = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
rsort($a);
rsort($b);
rsort($c);
foreach($a as $_a){
    foreach($b as $_b){
        $ab[] = $_a + $_b;
    }
}
rsort($ab);
foreach($ab as $i => $_ab){
    if($i == 3000)break;
    foreach($c as $_c){
        $abc[] = $_ab + $_c;
    }
}
rsort($abc);
for($i = 0; $i < $K;$i++){
    echo $abc[$i],"\n";
}


Measured memory_bytes: 170460
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
typedef long long ll;

int main(void){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    ll mx = a.back();
    int pos = lb(a,mx/2);
    if(pos==0){
        cout<<mx<<" "<<a[0]<<endl;
    }else if(pos == n-1){
        cout<<mx<<" "<<a[pos-1]<<endl;
    }else{
        ll l = a[pos-1], r = a[pos];
        if(abs(mx/2-l) < abs(mx/2-r)){
            cout<<mx<<" "<<l<<endl;
        }else{
            cout<<mx<<" "<<r<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <bitset>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;



int main()
{
  int N, Y;
  cin >> N >> Y;
  int ans=0;

  //1000x+5000y+10000z=Yかつx+y+z=N
  for (int x = 0; x <= N; x++)
  {
    for (int y = 0; y <= N;y++){
      int z = N - x - y;
      if (0 <= z && 1000*x + 5000*y + 10000*z == Y){
        cout << z << " " << y
             << " " << x<<endl;
      return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;

}

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

int main() {
  int a,b,big,small;
  cin >> a >> b;
  if (a>b) {big = a; small = b;}
  else {small = a; big = b;}
  for (int i = 0; big > i; i++) cout << small;
  cout << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int d[100010];
vector<int> val,qzh;
int n,k;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>k;
	for(int i=0;i<n;i++){
		scanf("%1d",&d[i]);
	}
	if(d[0]==0)
		val.push_back(0);
	int len=0;
	for(int i=0;i<n;i++){
		if(i>0&&d[i]!=d[i-1])
		{
			val.push_back(len);
			len=0;
		}
		len++;
	}
	val.push_back(len);
	qzh.resize(val.size()+1);
	qzh[0]=0;
	for(int i=0;i<val.size();i++){
		qzh[i+1]=qzh[i]+val[i];
	}
	int res=0;
	for(int i=0;i<qzh.size();i+=2){
		res=max(res,qzh[min((int)val.size(),i+k*2+1)]-qzh[i]);
	}
	cout<<res<<endl;
	return 0;
}


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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("C.in", "r", stdin);
	freopen ("C.out", "w", stdout);
#endif
}

using ll = long long;

int main () {

	File();

	ll k = read() + 1, a = read(), b = read();

	if (k <= a || b <= a + 1) return printf ("%lld\n", k), 0;

	k -= a;
	if (k & 1) {
		printf ("%lld\n", a + k / 2 * (b - a) + 1);
	} else {
		printf ("%lld\n", a + k / 2 * (b - a));
	}

    return 0;

}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 1005
#define MAXV 2025
#define OFF 2000000000LL
#define INF 1000000000000LL
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
struct edge{ll to,cap,cost,rev;};
ll dist[MAXV],h[MAXV],prevv[MAXV],preve[MAXV];
ll V;
vector<edge> G[MAXV];
ll offset=OFF;
ll N,st,ed;
ll RX[MAXN],RY[MAXN],BX[MAXN],BY[MAXN],RC[MAXN],BC[MAXN];
void add_edge(ll from,ll to,ll cap,ll cost)
{
    G[from].push_back((edge){to,cap,cost,(int)G[to].size()});
    G[to].push_back((edge){from,0,-cost,(int)G[from].size()-1});
}
ll min_cost_flow(ll s,ll t,ll f)
{
    ll res=0;
    fill(h+1,h+V+1,0);
    while(f>0)
    {
        priority_queue<P,vector<P>,greater<P> >que;
        fill(dist+1,dist+V+1,INF);
        dist[s]=0;
        que.push(P(0,s));
        while(!que.empty())
        {
            P p=que.top(); que.pop();
            ll v=p.second;
            if(dist[v]<p.first) continue;
            for(ll i=0;i<(int)G[v].size();i++)
            {
                edge &e=G[v][i];
                if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to])
                {
                    dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
                    prevv[e.to]=v;
                    preve[e.to]=i;
                    que.push(P(dist[e.to],e.to));
                }
            }
        }
        if(dist[t]==INF)
        {
            return -1;
        }
        for(ll v=1;v<=V;v++) h[v]+=dist[v];
        ll d=f;
        for(ll v=t;v!=s;v=prevv[v])
        {
            d=min(d,G[prevv[v]][preve[v]].cap);
        }
        f-=d;
        res+=d*h[t];
        for(ll v=t;v!=s;v=prevv[v])
        {
            edge &e=G[prevv[v]][preve[v]];
            e.cap-=d;
            G[v][e.rev].cap+=d;
        }
    }
    return res;
}
// 1.. N 
// N+1.. 2N
// 2N+1.. 2N+4
// S=2N+5
// T=2N+6
int main()
{
    ll s=0;
    scanf("%lld",&N);
    for(ll i=1;i<=N;i++) scanf("%lld%lld%lld",&RX[i],&RY[i],&RC[i]);
    for(ll i=1;i<=N;i++) scanf("%lld%lld%lld",&BX[i],&BY[i],&BC[i]);
    for(ll i=1;i<=N;i++) s+=RC[i];
    ll tp1=2*N+1,tp2=2*N+2,tp3=2*N+3,tp4=2*N+4,src=2*N+5,dest=2*N+6;
    V=2*N+6;
    for(ll i=1;i<=N;i++)
    {
        add_edge(i,tp1,RC[i],offset-(RX[i]+RY[i]));
        add_edge(i,tp2,RC[i],offset-(-RX[i]+RY[i]));
        add_edge(i,tp3,RC[i],offset-(RX[i]-RY[i]));
        add_edge(i,tp4,RC[i],offset-(-RX[i]-RY[i]));
    }
    for(ll i=1;i<=N;i++)
    {
        add_edge(tp1,N+i,BC[i],offset-(-BX[i]-BY[i]));
        add_edge(tp2,N+i,BC[i],offset-(BX[i]-BY[i]));
        add_edge(tp3,N+i,BC[i],offset-(-BX[i]+BY[i]));
        add_edge(tp4,N+i,BC[i],offset-(BX[i]+BY[i]));
    }
    for(ll i=1;i<=N;i++) add_edge(src,i,RC[i],0);
    for(ll i=1;i<=N;i++) add_edge(N+i,dest,BC[i],0);
    ll ans=min_cost_flow(src,dest,s);
    ans=2LL*s*offset-ans;
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 1528
a, b, c, d, e, f = map(int, input().split())

s = set()
t = set()
for i in range(0, f+1,  100 * a):
    for j in range(0, f + 1 - a, 100 * b):
        s.add(i + j)


for k in range(0, f + 1, c):
    for l in range(0, f + 1, d):
            t.add(k + l)
mi = -1
ans = [str(0), str(0)]
for n in s:
    for m in t:
        if 0 < n + m <= f and m <= n * e // 100:
            if m /(n + m) > mi:
                mi = m / (n + m)
                ans = [str(n + m), str(m)]

print(" ".join(ans))


Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //int n = int.Parse(Console.ReadLine());
            //int[] A = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
            char a = Console.ReadLine()[0];
            if (char.IsUpper(a))
            {
                Console.WriteLine("A");
            }
            else
            {
                Console.WriteLine("a");
            }
        }
    }
}

Measured memory_bytes: 25880
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

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

typedef long long int ll;

int SURP = 1000000007;

int main(){
	int N,A,B;
	ll ret2 = 0;

	cin >> N >> A >> B;

	ll v[N];
	REP(i,N) cin >> v[i];
	sort(v,v+N,greater<ll>());

	ll comp[N+1][N+1];
	REP(i,N+1){
		REP(j,N+1){
			if(i == 0) comp[i][j] = 0;
			else if(i < j) comp[i][j] = 0;
			else if(j == 0) comp[i][j] = 0;
			else if(j == 1) comp[i][j] = i;
			else if(i == j) comp[i][j] = 1;
			else comp[i][j] = comp[i-1][j-1] + comp[i-1][j];

		}
	}

	double ret = 0.0;
	REP(i,A){
		ret += (double)v[i];
	}
	ret /= (double)A;

	if(v[0] != v[A-1]){
		int tmp1 = 0;
		int tmp2 = N - A;
		REP(i,A){
			if(v[i] == v[A-1]){
				tmp1 = A - i;
				break;
			}
		}
		REPI(i,A,N){
			if(v[A-1] != v[i]){
				tmp2 = i - A;
				break;
			}
		}
		ret2 = comp[tmp1+tmp2][tmp1];
	}else{
		int tmp = N;
		REPI(i,A,N){
			if(v[0] != v[i]){
				tmp = i;
				break;
			}
		}
		REPI(i,A,B+1){
			ret2 += comp[tmp][i];
		}
	}

	cout << fixed << setprecision(6) << ret << endl;
	cout << ret2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<list>
#include<iostream>
#include<map>
#include<set>

using namespace std;

int n,m;
set<string> str;
int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		str.insert(s);
	}
	scanf("%d",&m);
	int flag=1;
	for(int i=0;i<m;i++){
		string s;
		cin >> s;
		if(str.find(s)!=str.end()){
			printf("%s by ",flag?"Opened":"Closed");
			cout << s << endl;
			flag=1-flag;
		}else{
			cout << "Unknown " << s << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1284
#include <stdio.h>

int
main(void)
{
	char line[80];
	int w;
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &w) != 1) {
		return 1;
	}

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	int a[n];
	int b[n];

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d,%d", &(a[i]), &(b[i])) != 2) {
			return 1;
		}
	}

	int r[w];
	for (int i = 1; i <= w; i++) {
		int k = i;
		for (int j = 0; j < n; j++) {
			if (a[j] == k) {
				k = b[j];
			} else if (b[j] == k) {
				k = a[j];
			}
		}
		r[k-1] = i;
	}

	for (int i = 0; i < w; i++) {
		printf("%d\n", r[i]);
	}

	return 0;
}

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

using ll = long long;

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

    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    sort(ALL(p));
    ll sum=0;
    rep(i, k) sum+=p[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n;
  int ans = 0;

  cin >> n;
  string s = to_string(n);

  cout << (s[0] == '7' || s[1] == '7' || s[2] == '7' ? "Yes" : "No") << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 3708
a, b, c, d, e, k = map(int, [input() for i in range(6)])
antena = [a,b,c,d,e,k]
# print(antena[0])
for i in range(0, 4):
    for j in range(i+1, 5):
        if int(antena[j])-int(antena[i])> int(antena[5]):
            print(":(")
            exit()
        else:
            flag = False
            continue

print("Yay!")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>

int main() {
    int h, w; std::cin >> h >> w;
    std::vector<std::vector<char>> m(h, std::vector<char>(w, ' '));

    int b = 0;

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            std::cin >> m[i][j];
            if (m[i][j] == '#') {
                b++;
            }
        }
    }

    if (m[0][0] == '#' || m[h-1][w-1] == '#') {
        std::cout << -1 << std::endl;
        return 0;
    }

    m[0][0] = '#';

    int path;
    std::pair<int, int> c {0, 0};
    std::queue<std::pair<decltype(c), int>> s;
    s.push(std::make_pair(c, 1));

    const std::vector<decltype(c)> dd {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

    while (true) {
        if (s.empty()) {
            std::cout << -1 << std::endl;
            return 0;
        }

        c = s.front().first; path = s.front().second; s.pop();
        // std::cout << path << ": " << c.first << ", " << c.second << std::endl;
        if (c.first == h-1 && c.second == w-1) {
            break;
        }

        for (const auto& d: dd) {
            decltype(c) cc {c.first + d.first, c.second + d.second};
            if (cc.first < 0 || h <= cc.first || cc.second < 0 || w <= cc.second) {
                continue;
            }

            if (m[cc.first][cc.second] == '.') {
                s.push(std::make_pair(cc, path+1));
                m[cc.first][cc.second] = '#';
            }
        }
    }

    // std::cout << b << " " << path << std::endl;

    std::cout << (h * w - b - path) << std::endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int d;cin>>d;
    if(d==25)cout<<"Christmas";
    if(d == 24)cout<<"Christmas Eve";
    if(d == 23)cout<<"Christmas Eve Eve";
    if(d == 22)cout<<"Christmas Eve Eve Eve";
    return 0;
}

Measured memory_bytes: 3616
use proconio::input;
use proconio::marker::{Bytes, Chars};
use std::cmp::{max, min};

fn main() {
    input! {
        k: i8,
    }
    let mut ans = String::new();
    for _ in 0..k {
        ans = format!("{}{}", ans, "ACL");
    }
    println!("{}", ans);
}


Measured memory_bytes: 2032
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#include <set>
#pragma GCC optimize(3 , "Ofast" , "inline")
using namespace std ;
#define ios ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define x first
#define y second
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e6 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
ll in()
{
  ll x = 0 , f = 1 ;
  char ch = getchar() ;
  while(!isdigit(ch)) {if(ch == '-') f = -1 ; ch = getchar() ;}
  while(isdigit(ch)) x = x * 10 + ch - 48 , ch = getchar() ;
  return x * f ;
}
int a[N] ;
int main()
{
  int n = in() ;
  for(int i = 1; i <= n ;i ++ ) a[i]= in() ;
  sort(a + 1 , a + n + 1)  ;
  reverse(a + 1 , a + n + 1) ;
  ll ans = 0 ;
  int j = 1 ;
  for(int i = 2 ; i <= n ;i ++ )
   {
     ans += 1ll * a[j] ;
     j += i % 2 == 0 ;
   }
  puts("") ;
  cout << ans << endl ;
  return 0 ;
}
/*
*/


Measured memory_bytes: 3948
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
int main(){
    int k;
    cin>>n>>k;
    if(n<k){
        cout<<0<<endl;
        return 0;
    }
    vector<int> h(n);
    rep(i,n)cin>>h[i];
    sort(h.begin(),h.end(),greater<int>());
    rep(i,k)h[i]=0;
    ll ans=0;
    rep(i,n)ans+=h[i];
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  int n;
  cin >> n;
  vi vec(n);
  for (int i=0; i<n; i++){
    cin >> vec.at(i);
  }

  int min = 4000000;
  for (int i=-100; i<=100; i++){
    int sum=0;
    for (int j=0; j<n; j++){
      sum += (i - vec.at(j)) * (i - vec.at(j));
    }
    if (sum<min){
      min = sum;
    }
  }

  cout << min << endl;
}


Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 505

int main(){

    ll n;
    cin >> n;
    map<char,ll> mp;

    REP(i,n){
        string tmp;
        cin >> tmp;
        if(tmp[0] != 'M' && tmp[0] != 'A' && tmp[0] != 'R' && tmp[0] != 'C' && tmp[0] != 'H'){
        
        }else{
            mp[tmp[0]-'A']++;
        }
    }

    vector<ll> arr;

    for(auto itr:mp){
        arr.push_back(itr.second);
    }
    /*REP(i,arr.size()){
        cout << arr[i] << endl;
    }*/

    ll ans = 0;
    if(arr.size() < 3){
        ans = 0;
    }else{

        for(int i = 0;i < 5;i++){
            for(int j = i+1;j < 5;j++){
                for(int k = j+1;k < 5;k++){
                    ans += arr[i]*arr[j]*arr[k];
                }
            }
        }
    }
    cout << ans << endl;
    




    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int n,t,a;
  cin >>n >>t >>a;
  int y=10000001;
  int x,number;
  
  for(int i=1; i<=n; i++){
    int h;
    cin >>h;
    x =((t*1000)-(h*6))-a*1000;
    if(x<0){
      x=x*-1;
    }
    if(y>x){
      y=x;
      number = i;
    }
  }
  cout <<number <<endl;
}

Measured memory_bytes: 256
N = int(input())
boolean = False
while True:
  isAccept =True
  N_str = list(map(int, str(N)))
  first = N_str.pop()
  for n in N_str:
    if n != first:
      N += 1
      isAccept = False
      break
  if isAccept:
    break
print(N)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int d;
  cin >> d;
  
  if (d == 25){
    cout << "Christmas" << endl;
  }else if (d == 24){
    cout << "Christmas Eve" << endl;
  }else if (d == 23){
    cout << "Christmas Eve Eve" << endl;
  }else if (d == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

Measured memory_bytes: 256
N=input()

if N==3:
	print "2 5 63"
	quit()
elif N==4:
	print "2 5 20 63"
	quit()

#N>=5
#For 2 and 3
S=[2,3,4]
N-=3


x=N/4	# N=4x+b
b=N%4

for i in range(1,x+1):
	S.append(6*i)
	S.append(6*i+2)
	S.append(6*i+3)
	S.append(6*i+4)


if x%2==0:
	if b==0:
		S.remove(6*x+3)
		S.append(6*x+6)
	elif b==1:
		S.append(6*(x+1)+3)
	elif b==2:
		S.append(6*(x+1))
		S.append(6*(x+1)+3)
	elif b==3:
		S.append(6*(x+1))
		S.append(6*(x+1)+3)
		S.append(6*(x+1)+6)
else:
	if b==0:
		pass
	elif b==1:
		S.append(6*(x+1))
	elif b==2:
		S.append(6*(x+1)+2)
		S.append(6*(x+1)+4)
	elif b==3:
		S.append(6*(x+1))
		S.append(6*(x+1)+2)
		S.append(6*(x+1)+4)	

for i in S:
	print i,


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

int main() {
    ll n;
    cin >> n;
    queue<string> q;
    q.push("a");
    while (q.front().length() < n) {
        string now = q.front();
        q.pop();
        char biggest = now[0];
        rep(i, now.length()) { biggest = max(biggest, now[i]); }
        for (char next = 'a'; next <= biggest + 1; next++) {
            q.push(now + next);
        }
    }

    while (!q.empty()) {
        cout << q.front() << endl;
        q.pop();
    }
    return 0;
}



Measured memory_bytes: 7204