akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
const double EPS =  1e-10;
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point{
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y){}

    Point operator + (Point p){
        return Point(x + p.x, y + p.y);
    }
    Point operator - (Point p){
        return Point(x - p.x, y - p.y);
    }
    Point operator * (Point p){
        return Point(x * p.x, y * p.y);
    }
    Point operator * (double r){
        return Point(x * r, y * r);
    }
    Point operator / (Point p){
        return Point(x / p.x, y / p.y);
    }

    double abs(){
        return sqrt(norm());
    }
    double norm(){
        return x * x + y * y;
    }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }
    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
    
    
};



typedef Point Vector;

class Segment : public Point{
    public:
    Point p1, p2;
    Segment(Point p1_, Point p2_){
        p1 = p1_;
        p2 = p2_;
    }
    Segment(double a, double b, double c, double d){
        Point(a, b);
        Point(c, d);
    }
    
};

typedef Segment Line;

double dot(Point a, Point b){
    return a.x * b.x + a.y * b.y;
}
double cross(Point a, Point b){
    return a.x * b.y - a.y * b.x;
}
bool isOrthogonal(Point a, Point b){
    return equals(dot(a, b), 0.0);
}
bool isParallel(Point a, Point b){
    return equals(cross(a, b), 0.0);
}
bool isOrthogonal(Segment s1, Segment s2){
    return equals(dot(s1.p2 - s1.p1, s2.p2 - s1.p1), 0.0);
}
bool isParallel(Segment s1, Segment s2){
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s1.p1), 0.0);
}

Point project(Segment s, Point p){
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    //Vector tmp = s.p1 + base * r;
    Vector tmp = base * r;
    return s.p1 + base * r;
}

int main(void){
    Point p, p1, p2;
    
    std::cin >> p1.x >> p1.y >> p2.x >> p2.y;
    Segment s = Segment(p1, p2);
    int q;
    std::cin >> q;
    Point ans;
    for(int i = 0; i < q; i++){
        std::cin >> p.x >> p.y;
        ans = project(s, p);
        std::cout << std::fixed << std::setprecision(10) << ans.x << " " << ans.y << std::endl;
    }
}



Measured memory_bytes: 3288
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] heights = new int[10];

            for (int i = 0; i < 10; i++)
            {
                string input = Console.ReadLine();

                heights[i] = int.Parse(input);
            }

            var query = heights.OrderByDescending(a => a).Take(3);

            foreach (var q in query) Console.WriteLine(q);
        }
    }
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e3 + 10;
string s[N];
int dp[N][N];
struct point {
    int x, y, d;
    bool operator<(const point& p) const {
        return d > p.d;
    }
};
int main() {
    priority_queue<point> q;
    int n, m;
    cin >> n >> m;
    memset(dp, 0x3f, sizeof dp);
    for(int i = 0; i < n; i++) {
        cin >> s[i];
        for(int j = 0; j < m; j++) {
            if(s[i][j] == '#') {
                dp[i][j] = 0;
                q.push(point{i, j, 0});
            }
        }
    }
    while(!q.empty()) {
        point now = q.top(); q.pop();
        if(dp[now.x][now.y] < now.d) {
            continue;
        }
        int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
        for(int i = 0; i < 4; i++) {
            int dx = now.x + dir[i][0], dy = now.y + dir[i][1];
            if(dx >= 0 && dx < n && dy >= 0 && dy < m && dp[dx][dy] > 1e9) {
                dp[dx][dy] = now.d + 1;
                q.push(point{dx, dy, now.d+1});
            }
        }
    }
    int mx = 0;
    for(int i = 0 ; i < n; i++) {
        for(int j = 0; j < m; j++) {
            mx = max(mx, dp[i][j]);
        }
    }
    cout << mx << endl;
    return 0;
}

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

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n), b(n), vs(2*n);
    for(int i=0; i<n; ++i) {
        cin >> a[i] >> b[i];
        vs[i*2] = a[i];
        vs[i*2+1] = b[i];
    }

    sort(vs.begin(), vs.end());
    ll idx = 0;
    map<ll, ll> compress;
    vector<ll> unzip(2*n);
    for(auto i: vs) {
        if(compress.find(i) == compress.end()) {
            compress[i] = idx;
            unzip[idx] = i;
            idx++;
        }
    }

    vector<vector<ll>> v(idx+1);
    vector<ll> vec(idx+1);
    for(int i=0; i<n; ++i) {
        // cout << compress[a[i]] << " " << compress[b[i]] << endl;
        vec[compress[a[i]]]++;
        vec[compress[b[i]]+1]--;
        // cout << "vec: ";
        // for(auto i: vec) cout << i << " ";
        // cout << endl;
    }

    ll ma = 0;
    for(int i=1; i<=idx; ++i) {
        vec[i] += vec[i-1];
        ma = max(ma, vec[i]);
    }

    // cout << "vec: ";
    // for(auto i: vec) cout << i << " ";
    // cout << endl;


    if(ma%2 == 1) {
        for(int i=idx; i>=0; --i) {
            if(ma == vec[i]) {
                // ここに含まれる区間のうち終端がもっとも早いものを残す
                ll mi = 1LL<<60;
                for(int j=0; j<n; ++j) {
                    if(a[j] <= unzip[i] && unzip[i] <= b[j]) {
                        mi = min(mi, b[j]);
                    }
                }
                cout << (ma-1) * m + mi << endl;
                break;
            }
        }
    } else {
        for(int i=0; i<=idx; ++i) {
            if(ma == vec[i]) {
                // 始点がもっとも大きいもの
                ll ma2 = 0;
                for(int j=0; j<n; ++j) {
                    if(a[j] <= unzip[i] && unzip[i] <= b[j]) {
                        ma2 = max(ma2, a[j]);
                    }
                }
                cout << (ma-1)*m + (m-ma2) << endl;
                break;
            }
        }
    }

    return 0;
}


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

from collections import Counter
a=Counter(a)
a=a.most_common()

if len(a)<=k:
  print(0)
else:
  ans=0
  for i in range(len(a)-k):
    ans+=a[-(i+1)][1]
  print(ans)

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
 
    vector<int> a(n + 2, 0);
    int s;
    REP(i, n) {
        cin >> a[i + 1];
        s += abs(a[i + 1] - a[i]);
    }
    // back to the beginning
    s += abs(a[n + 1] - a[n]);

    FOR(i, 1, n + 1) {
        cout << s - (abs(a[i] - a[i -1]) + abs(a[i + 1] - a[i])) + abs(a[i + 1] - a[i - 1]) << endl;
    }
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using pii = pair<int, int>;

constexpr int mod = 998244353;
int deg10[300300];
int sumdeg10[300300];
int p[1 << 20];
int t[1 << 20];
int a[300300];

void build(int v, int tl, int tr) {
    if (tl != tr) {
        int tm = (tl + tr) >> 1;
        build(v * 2, tl, tm);
        build(v * 2 + 1, tm + 1, tr);
    }
    t[v] = sumdeg10[tr - tl];
}

inline void push(int v, int tl, int tr) {
    if (p[v]) {
        t[v] = sumdeg10[tr - tl] * (ll)p[v] % mod;
        if (tl != tr) {
            p[v * 2] = p[v];
            p[v * 2 + 1] = p[v];
        }
        p[v] = 0;
    }
}

void update(int v, int tl, int tr, int l, int r, int val) {
    push(v, tl, tr);
    if (l > r) return;
    if (tl == l && tr == r) {
        p[v] = val;
        push(v, tl, tr);
        return;
    }
    int tm = (tl + tr) >> 1;
    update(v * 2, tl, tm, l, min(r, tm), val);
    update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
    t[v] = (t[v * 2] * (ll)deg10[tr - tm] + t[v * 2 + 1]) % mod;
}

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

    deg10[0] = sumdeg10[0] = 1;
    for (int i = 1; i < 300300; ++i) {
        deg10[i] = deg10[i - 1] * 10LL % mod;
        sumdeg10[i] = (sumdeg10[i - 1] + deg10[i]) % mod;
    }

    int n, q;
    cin >> n >> q;
    fill_n(a, n, 1);
    build(1, 1, n);
    while (q--) {
        int l, r, d;
        cin >> l >> r >> d;
        update(1, 1, n, l, r, d);
        push(1, 1, n);
        int ans = t[1];
        cout << ans << '\n';
    }
}


Measured memory_bytes: 10904
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
const int mn[10]={0,2,5,5,4,5,6,3,7,6};
int n,m,cnt[10101],a[11];
int main()
{
	for(int i=0;i<10050;i++)
	{
		cnt[i]=-1;
	}
	cin>>n>>m;
	cnt[0]=0;
	for(int i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+m);
	reverse(a+1,a+1+m);
	for(int i=1;i<=m;i++)
	{
		for(int j=mn[a[i]];j<=n;j++)
		{
			if(cnt[j-mn[a[i]]]!=-1)
			{
				cnt[j]=max(cnt[j],cnt[j-mn[a[i]]]+1);
			}
		}
	}
	while(n)
	{
		for(int i=1;i<=m;i++)
		{
			if(n-mn[a[i]]>=0 && cnt[n]-cnt[n-mn[a[i]]]==1)
			{
				n-=mn[a[i]];
				cout<<a[i];
				break;
			}
		}
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
N,W=map(int,input().split())
inf=float("inf")
DP=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):DP[0][i]=0
for i in range(N):
    wi,v=map(int,input().split())
    for w in range(W+1):
        if wi<=w:DP[i+1][w]=max(DP[i][w-wi]+v,DP[i][w])
        else:
            DP[i+1][w]=DP[i][w]
print(DP[N][W])

Measured memory_bytes: 313272
#include<iostream>
#include<algorithm>
#include<deque>
#include<climits>
#include<vector>
#include<cassert>

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

using namespace std;

typedef pair<int,int> ii;

int M,a[7],s,g,N[310];
vector<ii> G[310];
int mini[310];
ii pre[310];

void compute() {
  rep(i,M) {
    rep(j,6) {
      for(int coef=-1;coef<=1;coef+=2) {
	int nex = i + a[j] * coef;
	if( !( 0 <= nex && nex < M ) ) continue;
	nex += N[nex];
	if( !( 0 <= nex && nex < M ) ) continue;
	if( i == nex ) continue;
	G[i].push_back(ii(nex,(j+1) * coef));
      }
    }
  }
  rep(i,M) mini[i] = INT_MAX, pre[i] = ii(INT_MAX,INT_MAX);
  mini[s] = 0;
  deque<int> deq;
  deq.push_back(s);
  while( !deq.empty() ) {
    int cur = deq.front(); deq.pop_front();
    if( cur == g ) break;
    rep(i,(int)G[cur].size()) {
      int nex = G[cur][i].first;
      if( cur == nex ) continue;
      if( mini[nex] > mini[cur] + 1 ) {
	mini[nex] = mini[cur] + 1;
	deq.push_back(nex);
	pre[nex] = ii(cur,G[cur][i].second);
      }
    }
  }
  assert( pre[g].first != INT_MAX );
  vector<int> path;
  int cur = g;
  while( pre[cur].second != INT_MAX ) {
    path.push_back(pre[cur].second);
    cur = pre[cur].first;
  }
  reverse(path.begin(),path.end());
  //cout << "path.size() = " << path.size() << endl;
  //rep(i,(int)path.size()) cout << path[i] << endl;
  int v,ptr = 0;
  while( ptr < (int)path.size() ) {
    cin >> v;
    if( v == abs(path[ptr]) ) {
      if( path[ptr] < 0 ) cout << -1 << endl;
      else                cout <<  1 << endl;
      ++ptr;
    } else {
      cout << 0 << endl;
    }
  }
}

int main() {
  cin >> M;
  rep(i,6) cin >> a[i];
  cin >> s >> g;
  --s, --g;
  rep(i,M) cin >> N[i];
  compute();
  return 0;
}

Measured memory_bytes: 3280
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b;
    //*/
    
    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    /*
    if( ( vec.at(0) == vec.at(1) && vec.at(1) == vec.at(2) ) || ( vec.at(3) == vec.at(2) && vec.at(1) == vec.at(2) ) ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    */
    
    cout << ( a + b ) / 2 + ( a + b ) % 2 << endl;

    return 0; 
}


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

int main()
{
    while(true){
        int i=0;
        string map[8];
        while(cin>>map[i],!cin.eof()){
            i++;
            if(i==8){
                break;
            }
        }
        if(cin.eof()){
            break;
        }
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(i<7 && j<7){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1'){
                        cout<<'A'<<endl;
                    }
                }
                if(i<5){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+2][j]=='1' && map[i+3][j]=='1'){
                        cout<<'B'<<endl;
                    }
                }
                if(j<5){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i][j+2]=='1' && map[i][j+3]=='1'){
                        cout<<'C'<<endl;
                    }
                }
                if(j>0 && i<6){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+1][j-1]=='1' && map[i+2][j-1]=='1'){
                        cout<<'D'<<endl;
                    }
                }
                if(i<7 && j<6){
                    if(map[i][j]=='1' && map[i][j+1]=='1' && map[i+1][j+1]=='1' && map[i+1][j+2]=='1'){
                        cout<<'E'<<endl;
                    }
                }
                if(i<6 && j<7){
                    if(map[i][j]=='1' && map[i+1][j]=='1' && map[i+1][j+1]=='1' && map[i+2][j+1]=='1'){
                        cout<<'F'<<endl;
                    }
                }
                if(i<7 && j>1){
                    if(map[i][j]=='1' && map[i][j-1]=='1' && map[i+1][j-1]=='1' && map[i+1][j-2]=='1'){
                        cout<<'G'<<endl;
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
	cin>>a>>b;
	if(a>0&&b>0)
	{
		printf("Positive\n");
		return 0;
	}
	if(a==0||b==0||(a>0&&b<0)||(a<0&&b>0))
	{
		printf("Zero\n");
		return 0;
	}
	if((a<0&&b>0)||(a>0&&b<0))
	{
		printf("Negative\n");
		return 0;
	}
	if(a<0&&b<0)
	{
		if((abs(a-b)+1)%2==0)
		{
			printf("Positive\n");
			return 0;
		}
		else
		{
			printf("Negative\n");
		    return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Tue Apr  3 01:05:17 2018
//
package main

import (
	"fmt"
)

var H, W int

func main() {
	fmt.Scan(&H, &W)

	graph := make([][]string, H)
	for i := range graph {
		graph[i] = make([]string, W)
		for j := range graph[i] {
			fmt.Scan(&graph[i][j])
		}
	}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if graph[i][j] == "snuke" {
				fmt.Printf("%s%d\n", string(j+'A'), i+1)
				return
			}
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e3 + 211;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int a, b;
	

main () {
	cin >> a >> b;
	cout << a * b;
}





Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}
#define yes(f){cout<<(f?"yes":"no")<<endl;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  set<string> set;
  while(n--){
    string t,s;
    cin>>t>>s;
    if(t[0]=='i') set.insert(s);
    else{
      yes(set.find(s)!=set.end());
    }
  }


}


Measured memory_bytes: 29036
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int M;
  cin >> M;
  cout << 24 + 24 - M << endl;
  return 0;
}


Measured memory_bytes: 3620
def main():
    n = int(input())
    a = list(map(int,input().split()))
    listcost = []
  
    for i in range(min(a),max(a)+1):
        cost = 0
        for j in a:
            if i != j:
                cost += (i - j) ** 2
        listcost.append(cost)
    print(min(listcost))
  
  
if __name__=='__main__':
  main()

Measured memory_bytes: 9144
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 10:36-

            int n = sc.nextInt();
            int[] ws = new int[n];
            for (int i = 0; i < ws.length; i++) ws[i] = sc.nextInt();

            int[] p1 = new int[n];
            int[] p2 = new int[n];
            for (int i = 0; i < ws.length; i++) {
                p1[i] += ws[i];
                if (i > 0) p1[i] += p1[i - 1];
            }

            for (int i = ws.length - 1; i >= 0; i--) {
                p2[i] += ws[i];
                if (i < ws.length - 1) p2[i] += p2[i + 1];
            }

            int min = Integer.MAX_VALUE;
            for (int i = 0; i < ws.length - 1; i++) {
                min = Math.min(min, Math.abs(p1[i] - p2[i + 1]));
            }

            out.println(min);
        }
    }
}


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

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


//約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
	vector<int> ret;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ret.push_back(i);
			if (i*i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return ret;
}

int main() {

	int ans=0;

	int N, K;
	vector <int> p;
	int tmp;

	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		cin >> tmp;
		p.push_back(tmp);
	}


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

	for (int i = 0; i < K; i++) {
		ans += p[i];
	}


	cout << ans << endl;

	cin >> ans;

	return 0;


}

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

#include <iostream>
#include <vector>
#include <math.h>

std::unordered_map<long, int> mp;
std::vector<int> v;

int main(void) {
  long long dd;
  char s;
  int lenn;
  double left = 0, right = 0;
  char name[128];
  char name2[128];

  scanf("%lld", &dd);

  
  for(long i = 0;;i++){
    dd -= 1;
    s = (dd % 26);
    dd = (dd / 26);
    name[i] = 'a' + (s);
    if(dd == 0){
      for(int j = 0; j <= i; j++){
        name2[j] = name[i - j];
      }
      name2[i + 1] = '\0';
      printf("%s", name2);
      return 0;
    }
  }
    return 0;
  }

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll a,b;
    cin>>a>>b;
    //a　白 b 黒
    VV g(100,Vec(100,0));

    rep(i,50){
        rep(j,100){
            g[i][j] = 1;
        }
    }
    a--;b--;
    REP(i,0,a){
        ll h = i/50;
        ll w = i%50;
        g[h*2][w*2] = 0;
    }

    REP(i,0,b){
        ll h = i/50;
        ll w = i%50;
        g[99-h*2][w*2] = 1;
    }

    cout<<100<<" "<<100<<endl;
    rep(i,100){
        string s;
        rep(j,100){
            s += g[i][j]==1?'#':'.';
        }
        cout<<s<<endl;
    }

    return  0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n,k;
    cin>>n>>k;
    int ans=INF;
    REP(i,n+1) {
        int cur=1;
        REP(j,i) {
            cur<<=1;
        }
        cur+=(n-i)*k;
        chmin(ans,cur);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

vector<vector<ll>> edge;
vector<ll> depth;
vector<ll> parent;

void dfs(ll where){
    for(int i=0;i<edge[where].size();i++){
        const ll &to=edge[where][i];
        depth[to]=depth[where]+1;
        dfs(to);
    }
}


int main(){
    ll n;
    cin>>n;
    edge.resize(n);
    parent.resize(n,-1);
    depth.resize(n,0);
    for(int i=0;i<n;i++){
        ll id,k;
        cin>>id>>k;
        edge[id].resize(k);
        for(int t=0;t<k;t++){
            cin>>edge[id][t];
            parent[edge[id][t]]=id;
        }
    }
    for(int i=0;i<n;i++){
        if(parent[i]==-1){dfs(i); break;}
    }
    for(int i=0;i<n;i++){
        cout<<"node "<<i<<": parent = "<<parent[i]<<", depth = "<<depth[i]<<", ";
        if(parent[i]==-1){cout<<"root";}
        else if(edge[i].size()==0){cout<<"leaf";}
        else{cout<<"internal node";}
        cout<<", [";
        for(int t=0;t<edge[i].size();t++){
            cout<<edge[i][t];
            if(t!=edge[i].size()-1){
                cout<<", ";
            }
        }
        cout<<"]"<<endl;
    }
    
    
    return 0;
}



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

int main(void)
{
    int n, ans = 0;
    cin >> n;

    vector<ll> a(n);

    rep(i, n)
    {
        cin >> a.at(i);
    }

    rep(i, n - 2)
    {
        for (int j = i + 1; j < n; ++j)
        {
            for (int k = j + 1; k < n; ++k)
            {
                ll x = a.at(i), y = a.at(j), z = a.at(k);
                if (x == y || y == z || z == x)
                    continue;
                if (x + y > z && y + z > x && z + x > y)
                    ans++;
            }
        }
    }

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


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for(int i=0; i < N; i++){
    cin >> H.at(i);
  }
  int64_t ans = 0;
  if(N > K){
    sort(H.begin(), H.end());
    for(int i = 0; i < N - K; i++){
      ans += H.at(i);
    }
  }
  cout << ans << endl;
}

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

int main() {
	int N, A, B, C;
	cin >> N;
	vector<int> vec(N);
	vector<int> plus(N - 1);
	int total = 0;
	for (int i = 0; i < N; i++) {
		cin >> A;
		vec.at(i) = A;
	}
	for (int j = 0; j < N; j++) {
		cin >> B;
		total += B;
	}
	for (int k = 0; k < N - 1; k++) {
		cin >> C;
		plus.at(k) = C;
	}
	for (int l = 0; l < N - 1; l++) {
		if (vec.at(l) + 1 == vec.at(l + 1)) {
			total += plus.at(vec.at(l) - 1);
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 3600
def ask(i):
    print(i)
    return input()

def solve(l, r):
    m = (l + r) // 2
    res = ask(m)
    if res == "Vacant":
        quit()
    if (m % 2 == 0 and a0 == res) or (m % 2 == 1 and a0 != res):
        solve(m + 1, r)
    else:
        solve(l, m)

N = int(input())
a0 = ask(0)
if a0 == "Vacant":
    quit()
solve(1, N)


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;;
#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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> v(n);
  rep(i,n){
    cin >> v[i];
  }
  vector<ll> num(3,-1);
  ll ans = 1;
  rep(i,n){
    ll x = v[i];
    ll tmp = 0;
    rep(j,3){
      if(num[j] == x-1)tmp++;
    }
    ans *= tmp;
    ans %= MOD;
    rep(j,3){
      if(num[j]==x-1){
        num[j] = x;
        break;
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> ls(m), rs(m);
  rep(i, m) cin >> ls[i] >> rs[i];
  int l = *max_element(ls.begin(), ls.end());
  int r = *min_element(rs.begin(), rs.end());
  if (r < l) {
    cout << 0 << endl;
  } else {
    cout << r - l + 1 << endl;
  }
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#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(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#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 Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int H, W, K; cin >> H >> W >> K;
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    vector<string> c(H); cin >> c;

    mat dp(H, vec(W, -1));
    queue<Pii> que;
    dp[x1][y1] = 0;
    que.push(Pii(x1, y1));
    while(!que.empty()){
        Pii p = que.front(); que.pop();
        int x = p.fi, y = p.se;
        REP(k, 4){
            FOR(l, 1, K + 1){
                int i = x + dx[k] * l, j = y + dy[k] * l;
                if(!(0 <= i && i < H && 0 <= j && j < W)) break;
                if(c[i][j] == '@') break;
                if(dp[i][j] >= 0 && dp[i][j] <= dp[x][y]) break;
                if(dp[i][j] == -1){
                    dp[i][j] = dp[x][y] + 1;
                    que.push(Pii(i, j));
                }
            }
        }
    }

    Out(dp[x2][y2]);

    return 0;
}


Measured memory_bytes: 19824
# 2 "1115.cpp"
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>


namespace solution {
    using namespace std;

    typedef istringstream ISS;
    typedef ostringstream OSS;
    typedef vector<string> VS;
    typedef long long LL;
    typedef int INT;
    typedef vector<INT> VI;
    typedef vector<VI> VVI;
    typedef pair<INT, INT> II;

    const int SIZE = 101;
    const int WORD_MAX = 1001;
    int n;
    int m;
    int w;
    int p;
    string S[WORD_MAX];
    int si;
    string T[SIZE][SIZE];
    int pi;
    int ti;

    class Solution {
    private:
        void init() {
        }

        int get_number() {
            string line;
            getline( cin, line );
            ISS iss( line );
            int res;
            iss >> res;
            return res;
        }

        bool input() {
            n = get_number();
            if ( n == 0 ) return false;
            m = get_number();
            w = get_number();
            p = get_number();

            string line;
            si = 0;
            while ( getline( cin, line ) ) {
                if ( line == "?" ) break;
                S[si ++] = line;
            }
            return true;
        }

        void add_item( string s ) {
            int len = s.size();
            if ( len > w ) {
                for ( int i = 0; i < len; ) {
                    string t = s.substr( i, w );
                    add_item(t);
                    i += w;
                }
            } else {
                int r = ti % n;
                int c = ti / n;

                for ( int i = 0; i < len; ++ i ) {
                    T[pi][r][i+w*c+p*c] = s[i];
                }

                ti ++;
                if ( ti >= n * m ) {
                    ti = 0;
                    pi ++;
                }
            }
        }

        void solve() {
            pi = 0;
            ti = 0;
            for ( int i = 0; i < SIZE; ++ i ) {
                for ( int j = 0; j < n; ++ j ) {
                    T[i][j] = string( m * w + p * ( m - 1 ), '.' );
                }
            }

            for ( int i = 0; i < si; ++ i ) {
                string word = S[i];
                add_item(word);
            }
        }

        void output() {
            for ( int i = 0; i <= pi; ++ i ) {
                if ( i == pi && ti == 0 ) {
                    continue;
                }
                for ( int j = 0; j < n; ++ j ) {
                    cout << T[i][j] << endl;
                }
                cout << "#" << endl;
            }
            cout << "?" << endl;
        }

    public:
        int run() {
            while ( init(), input() ) {
                solve();
                output();
            }
            return 0;
        }
    };
}

int main() {
    using namespace solution;
    Solution s;
    return s.run();
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (a <= b) {
    if (a + t * v >= b + t * w)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  } else {
    if (a - t * v <= b - t * w)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  return 0;
}

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

class Main {
	int N;
	int C;
	int[] L;

	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		C = sc.nextInt();
		L = new int[N];
		for (int i = 0; i < N; ++i) {
			L[i] = sc.nextInt();
		}
		Arrays.sort(L);
		int[] ord = new int[N - 1];
		for (int i = 0; i < ord.length; ++i)
			ord[i] = i;

		double ans = 0;
		long[][] dp = new long[N * C + 1][1 << N - 1];
		do {
			for (int i = 0; i < dp.length; ++i)
				for (int j = 0; j < dp[i].length; ++j)
					dp[i][j] = 0;
			dp[L[N - 1] * N - 1][0] = 1;
			for (int i = 0; i < N * C; ++i) {
				if (i % N == 0)
					continue;
				for (int j = i - 1; j <= N * C; ++j) {
					for (int s = 0; s < 1 << N - 1; ++s) {
						if ((s >> i % N - 1) % 2 == 0) {
							dp[Math.min(N * C, Math.max(j, L[ord[i % N - 1]] * N + i - 1))][s
									^ (1 << i % N - 1)] += dp[j][s];
						}
					}
				}
			}
			ans += dp[N * C][(1 << N - 1) - 1];
		} while (nextPermutation(ord));

		for (int i = 2; i <= N - 1; ++i) {
			ans /= i;
		}

		for (int i = 0; i < N - 1; ++i) {
			ans /= C;
		}

		System.out.printf("%.40f", ans);
	}

	boolean nextPermutation(int[] ord) {
		int n = ord.length;
		int i = n - 1;
		while (i > 0 && ord[i - 1] > ord[i])
			--i;
		if (i == 0)
			return false;
		int j = i;
		while (j + 1 < n && ord[i - 1] < ord[j + 1])
			++j;
		{
			ord[i - 1] ^= ord[j];
			ord[j] ^= ord[i - 1];
			ord[i - 1] ^= ord[j];
		}
		int s = i;
		int t = n - 1;
		while (s < t) {
			ord[s] ^= ord[t];
			ord[t] ^= ord[s];
			ord[s] ^= ord[t];
			++s;
			--t;
		}
		return true;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

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


Measured memory_bytes: 25108
use proconio::{fastout, input};
use std::collections::BTreeMap;

fn main() {
    input! {
        n: usize,
        a_vec: [i64; n],
        q: usize,
        b_c_vec: [(i64, i64); q],
    }
    let mut map: BTreeMap<i64, usize> = BTreeMap::new();
    a_vec.iter().for_each(|a| *map.entry(*a).or_insert(0) += 1);
    let mut ans: i64 = map.iter().fold(0, |acc, (a, &num)| a * num as i64 + acc);

    b_c_vec.iter().for_each(|(b, c)| {
        if let Some(num) = map.remove(b) {
            ans -= b * num as i64;
            *map.entry(*c).or_insert(0) += num;
            ans += c * num as i64;
        }
        println!("{}", ans);
    })
}


Measured memory_bytes: 7876
N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()
B.sort()

if N % 2 == 1:
    mid = N // 2
    print(B[mid] - A[mid] +1)
else:
    mid1 = N // 2
    mid2 = mid1 -1
    smallest = A[mid1] + A[mid2]
    largest = B[mid1] + B[mid2]
    print(largest - smallest + 1)


Measured memory_bytes: 25348
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    maxnum = max(a, b, c)
    if maxnum == a:
        a *= 2
    elif maxnum == b:
        b *= 2
    elif maxnum == c:
        c *= 2
print(a + b + c)

Measured memory_bytes: 3060
N = int(input())
b = list(map(int, input().split()))

tot = b[0]  #A[0]

#A[1] ~ A[-2]
for i in range(N-2):
  if b[i + 1] >= b[i]:
    tot += b[i]
  else:
    tot += b[i + 1]

#A[-1]
tot += b[-1]

print(tot)

Measured memory_bytes: 3060
def minus2(K):
    if K==1:
        return "1"
    if K==0:
        return "0"
    S=""
    if K%2==1:
        S="1"
    else:
        S="0"
    K-=K%2
    return minus2(-K//2)+S

print(minus2(int(input())))


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{
    int N, R;
    cin >> N >> R;
    
    int A;
    if (N < 10) {
        A = 100 * (10 - N);
    }
    
    
    cout << R + A << endl;

    return 0;   
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int x, y, z, ocupado, m=0;

	scanf("%d%d%d", &x, &y, &z);

	ocupado = z+y+z;

	do {
		ocupado += y+z;
		m++;
	} while (ocupado <= x);

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

	return 0;
}


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

int main() {
  long long K, A, B; cin >> K >> A >> B;
  if (B - A <= 2 || K < A) {
    cout << 1 + K << endl;
  }
  else {
    long long ans = A + ((K - A + 1) / 2) * (B - A);
    if ((K - A + 1) % 2 == 1) ans++;
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> A(N), C(N+1);
    REP(i, N){
        cin >> A[i];
        C[i+1] = C[i] + A[i];
    }
    ll res = INF;
    for(int i=0; i<N-1; i++){
        res = min(res, abs(2*C[i+1] - C[N]));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3456
#include<stdio.h>
 
int main()
{
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    if(x==y && y==z)
        printf("No\n");
    else if(x==y || y==z || z==x)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
  int64_t x,ans=0; cin>>x;
  ans+=(x/500)*1000; x%=500;
  ans+=(x/5)*5;
  cout<<ans<<endl;
}

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

ll gcd(ll x, ll y){
  	if(y>x) std::swap(x,y);
    if(x%y==0){
        return y;
    }else{
        return gcd(y, x%y);
    }
}

int main(){
    ll x, y;
    std::cin >> x >> y;
    std::cout << gcd(x,y) << std::endl;
}


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

using namespace std;

int main(){
	int n, l;
	cin >> n >> l;
	
	int sum = 0;
	
	for (int i=l;i<l+n;++i){
		sum += i;
	}
	
	if(l>0) {
		cout << sum - l << endl;
	} else if (l + n -1 < 0) {
		cout << sum - (l + n - 1) << endl;
	} else {
		cout << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;


int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll n, k;
    cin >> n >> k;
	while (k --) {
		ll x;
		cin >> x;
		n -= x;
	}
	if (n < 0) n = -1;
	cout << n;
    return (0);
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	map<string, int> M;
	int q;
	cin >> q;
	int query, x;
	string key;
	map<string, int>::iterator itr;

	for (int i = 0; i < q; i++) {
		cin >> query >> key;
		if (query == 0) {
			cin >> x;
			itr = M.find(key);

			if (itr == M.end())
				M.insert(make_pair(key, x));
			else
				M[key] = x;
		}
		else if(query == 1){
			cout << M[key] << endl;
		}	
		else {
			M.erase(key);
		}
	}
}


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

using namespace std;

void Run() {
  int n;
  cin >> n;
  vector<vector<int> > cnt(19, vector<int>(19));
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    string x;
    cin >> x;
    long long v = 0;
    int flag = 0;
    int mult = 0;
    for (int j = 0; j < x.size(); ++j) {
      if (x[j] == '.') {
        flag = 1;
        continue;
      }
      v *= 10;
      mult += flag;
      v += x[j] - '0';
    }
    while (mult < 9) {
      ++mult;
      v *= 10;
    }
    int five = 0;
    int two = 0;
    while (v % 5 == 0) {
      ++five;
      v /= 5;
    }
    while (v % 2 == 0) {
      ++two;
      v /= 2;
    }
    five = min(five, 18);
    two = min(two, 18);
    for (int k = 18 - five; k <= 18; ++k) {
      for (int m = 18 - two; m <= 18; ++m) {
        ans += cnt[k][m];
      }
    }
    ++cnt[five][two];
  }
  cout << ans << '\n';
}

int main() {
  srand(time(0));
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  Run();
  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.length()-1]==b[0] && b[b.length()-1]==c[0]){
        cout<<"YES"<<endl;
    }
    else
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(){

  int i;
  int n, a[N], tmp;
  int sum = 0, flag = 1;

  scanf("%d",&n);

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

  while(flag){
    flag = 0;

    for(i = n - 1; i > 0; i--){
      if(a[i] < a[i - 1]){
	tmp = a[i];
	a[i] = a[i - 1];
	a[i - 1] = tmp;
	flag = 1;
	sum++;
      }

    }

  }

  for(i = 0; i < n; i++){
    printf("%d",a[i]);
    if(i < n - 1) printf(" ");
  }

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

  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a=0;
  for(int i=0;i<4;i++){
    if(s.at(i)=='+'){
      a++;
    }else{
      a--;
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
import numpy as np
import sys

n,k,q=map(int, input().split())
p = np.full(n,k-q)

for i in range(q):
    a=int(sys.stdin.readline())
    p[a-1]+=1
    
for i in range(n):
    if(p[i]>0):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 13976