akhauriyash/Code-Regression huggingface dataset:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, K = getNM()
A = getList()

# 単純に大きいのを1 / 2していては
# 3.5, 3.5, 4.5, 2.25, 2.25ができるのでダメ

# Kがばか大きい

def f(target):
    cnt = 0
    for i in range(N):
        cnt += math.ceil(A[i] / target) - 1
    if cnt <= K:
        return True
    else:
        return False

ng = 0
ok = 10 ** 9 + 1
for i in range(100):
    mid = (ng + ok) / 2
    # midがでかすぎるなら上限を下げる
    if f(mid):
        ok = mid
    # midが小さすぎるなら下限を上げる
    else:
        ng = mid
print(math.ceil(ok))

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


using namespace std;
using ll = long long;

int main() {
	int n, k;
	cin >> n >> k;
	int* p = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> p[i];
	}
	sort(p, p + n);
	int ans = 0;
	for (int i = 0;i < k;i++) {
		ans += p[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 3524
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();

        long ans = lcm(A, B);

        os.println(ans);
    }

    static public long lcm(long a, long b) {
        if(a == b)
            return a;

        if(a > b) {
            long tmp = a;
            a = b;
            b = tmp;
        }

        long answer =  a*(b/(gcd(a, b)));
        return answer;
    }

    static public long gcd(long a, long b) {
        while(a > 0) {
            long tmpa = a;
            a = b % a;
            b = tmpa;
        }
        return b;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int h,w;
  cin >> h>> w;
  vector<vector<int> > table(h,vector<int>(w));
  rep(i,h)rep(j,w){
    char buf;
    cin>>buf;
    table[i][j] = (buf == '#') ?  0 : -1;
  }
  vector<pair<int,int> > dd;
  dd.push_back(make_pair(1,0));
  dd.push_back(make_pair(-1,0));
  dd.push_back(make_pair(0,1));
  dd.push_back(make_pair(0,-1));
  queue<pair<int,int> > q;
  rep(i,h) rep(j,w) if(table[i][j] == 0) q.push(make_pair(i,j));
  while(!q.empty()){
    pair<int,int> p = q.front();
    q.pop();
    int x = p.second;
    int y = p.first;
    for(d:dd){
      int x_ = x + d.second;
      int y_ = y + d.first;
      if(0<=x_&&x_<w&&0<=y_&&y_<h&&table[y_][x_]<0){
        table[y_][x_] =table[y][x] + 1;
        q.push(make_pair(y_,x_));
      }
    }
  }
  int ans = 0;
  rep(i,h) rep(j,w) ans = max(ans,table[i][j]);
  cout << ans << endl;
}



Measured memory_bytes: 12432
n = int(input())
weight = list(map(int,input().split()))
min = 99999
for i in range(n-1):
  sum1 = 0
  sum2 = 0
  for j in range(i+1):
    sum1 += weight[j]
  for k in range(n-i-1):
    sum2 += weight[n-k-1]
  sub = sum1 - sum2
  if sub < 0:
    sub = 0 - sub
  if sub < min:
    min = sub
print(min)

Measured memory_bytes: 3064
import sys
def main():
    n = int(input())

    mi = sys.maxsize
    for x in range(1, n + 1):
        if x > int(n / x):
            break
        if n % x == 0:
            mi = min(mi, max(len(str(x)), len(str(int(n / x)))))
    print(mi)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int hako;
        for(int i = 0; i <= n; i++){
            hako = i;
            if(i % 3 == 0 && i > 0){
                System.out.print(" "+i);
            }else{
            	while(hako != 0){
                	if(hako%10 == 3){
                    	System.out.print(" "+i); break;
                	}else{
                    	hako /= 10;
                	}
                }
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 28732
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        int n = sc.nextInt();
        long[] a = new long[3 * n];
        for (int i = 0; i < 3 * n; i++) {
            a[i] = sc.nextInt();
        }

        long[] left = new long[n + 1];
        long[] right = new long[n + 1];

        PriorityQueue<Long> lq = new PriorityQueue<>();
        PriorityQueue<Long> rq = new PriorityQueue<>(Comparator.reverseOrder());

        long suml = 0, sumr = 0;
        for (int i = 0; i < n; i++) {
            suml += a[i];
            lq.add(a[i]);
            sumr += a[3 * n - i - 1];
            rq.add(a[3 * n - i - 1]);
        }

        left[0] = suml;
        right[n] = sumr;

        for (int i = 0; i < n; i++) {
            lq.add(a[n + i]);
            left[i + 1] = left[i] + a[n + i] - lq.remove();

            rq.add(a[2 * n - i - 1]);
            right[n - i - 1] = right[n - i] + a[2 * n - i - 1] - rq.remove();
        }

//        debug(left);
//        debug(right);

        long ans = - (1L << 60);
        for (int i = 0; i <= n; i++) {
            ans = Math.max(ans, left[i] - right[i]);
        }

        out.println(ans);

        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Measured memory_bytes: 106104
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int V[] = new int[n];
        int C[] = new int[n];
        int ans=0;
        for(int i=0;i<n;i++)V[i] = sc.nextInt();
        for(int i=0;i<n;i++){
            C[i] = sc.nextInt();
            if((V[i]-C[i]) > 0){
                ans += (V[i]-C[i]);
            }
        }
        System.out.println(ans);
    }
}

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


int main() {
  int H, W;
  cin >> H >> W;
  while (H != 0 || W != 0) {
    rep(i,H) {
      rep(j,W) {
        if ((i + j) % 2 == 0) cout << '#';
        else cout << '.';
      }
      cout << endl;
    }

    cout << endl;
    cin >> H >> W;
  }

  return 0;
}


Measured memory_bytes: 3088
//I am so vegetable
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
//#define _LOCAL_
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll N = 1e5 + 5;
const int MOD = 1e9 + 7;
const double exps = 1e-8;
int main() {
#ifdef _LOCAL_
	ifstream cin("E:\\acm dream\\in.txt");
	ofstream cout("E:\\acm dream\\out.txt");
#endif
	//srand((unsigned)time(nullptr));
	FIO;
	ll h, w, ans; cin >> h >> w;
	if (h == 1 || w == 1)cout << 1;
	else {
		ans = w * (h / 2);
		if (h % 2)ans += ceil(w / 2.0);
		cout << ans;
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
package main

import (
	. "fmt"
	"bufio"
	"os"
	"strconv"
)

type SegmentTree struct {
	sz int
	seg []int64
}

func NewSegmentTree(N int) *SegmentTree {
	sz := 1
	for sz < N {
		sz *= 2
	}

	return &SegmentTree {
		sz : sz,
		seg : make([]int64, 2 * sz - 1),
	}
}

func (seg *SegmentTree) update(k int, x int64) {
	k += seg.sz - 1
	seg.seg[k] = x

	for k > 0 {
		k = (k - 1) / 2
		seg.seg[k] = seg.seg[2 * k + 1] + seg.seg[2 * k + 2]
	}
}

func (seg *SegmentTree) add(k int, x int64) {
	k += seg.sz - 1
	seg.seg[k] += x

	for k > 0 {
		k = (k - 1) / 2
		seg.seg[k] = seg.seg[2 * k + 1] + seg.seg[2 * k + 2]
	}
}

func (seg SegmentTree) _get(a, b, k, l, r int) int64 {
	if (b <= l) || (r <= a) {
		return 0
	} else if (a <= l) && (r <= b) {
		return seg.seg[k]
	}

	return seg._get(a, b, 2 * k + 1, l, (l + r) / 2) + seg._get(a, b, 2 * k + 2, (l + r) / 2, r)
}

func (seg SegmentTree) get(a, b int) int64 {
	return seg._get(a, b, 0, 0, seg.sz)
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())

	if e != nil {
		panic(e)
	}

	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n, q := nextInt(), nextInt()

	seg := NewSegmentTree(n)
	for i := 0; i < q; i++ {
		f, x, y := nextInt(), nextInt(), nextInt()

		if f == 0 {
			seg.add(x - 1, int64(y))
		} else {
			Println(seg.get(x - 1, y))
		}
	}
}


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

#define x first
#define y second
#define int64 long long
#define debug(x) cerr << #x << " is " << x << endl;
#define MaxN 100

int a[MaxN+1][MaxN+1];
int N;

int main(){
    

    int i, j;

    scanf("%d", &N);

    if(N % 2 == 0){
        for(i = 1; i <= N; ++i)
            for(j = 1; j <= N; ++j)
            if(i != j) a[i][j] = 1;

        for(i = 1; i <= N; ++i) a[i][N - i + 1] = 0;
    } else {
        for(i = 1; i <= N; ++i)
            for(j = 1; j <= N; ++j)
            if(i != j) a[i][j] = 1;

        for(i = 1; i < N; ++i) a[i][N - i] = 0;
    }

    int cnt = 0;
    for(i = 1; i < N; ++i)
        for(j = i + 1; j <= N; ++j)
        if(a[i][j]) ++cnt;

    printf("%d\n", cnt);
    for(i = 1; i < N; ++i)
        for(j = i + 1; j <= N; ++j)
        if(a[i][j]) printf("%d %d\n", i, j);



return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define f(i,j) f[i+2000][j+2000]
#define mod 1000000007
using namespace std;
int f[4003][4003], C[8003][4003], a[200005], b[200005];
int read(){
    int cnt = 0;
    char ch = getchar();
    while (ch < '0' || '9' < ch)
        ch = getchar();
    while ('0' <= ch && ch <= '9'){
        cnt = cnt * 10 + ch - '0';
        ch = getchar();
    }
    return cnt;
}
int main(){
    for (int i = 0; i <= 8000; ++ i){
        C[i][0] = 1;
        for (int j = 1; j <= min(i, 4000); ++ j){
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
            if (C[i][j] >= mod)
                C[i][j] -= mod;
        }
    }
    int n = read();
    for (int i = 1; i <= n; ++ i){
        a[i] = read(), b[i] = read();
        f(a[i], b[i]) ++;
    }
    for (int i = 2000; i >= -2000; -- i)
        for (int j = 2000; j >= -2000; -- j)
            (f(i, j) += f(i + 1, j) + f(i, j + 1)) %= mod;
    int ans = 0;
    for (int i = 1; i <= n; ++ i)
        (ans += f(-a[i], -b[i])) %= mod;
    for (int i = 1; i <= n; ++ i)
        (ans += mod - C[2 * a[i] + 2 * b[i]][2 * a[i]]) %= mod;
    cout << 1LL * ans * 500000004 % mod << endl;
}


Measured memory_bytes: 189184
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	if (N <= 500) {
		cout << N << endl;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				cout << (i + j) % N + 1 << " ";
			}
			cout << endl;
		}
		return 0;
	}
	M = 500;
	vector<vector<int>>ans(M, vector<int>(M));
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < M; j++)ans[i][j] = (i + j) % M + 1;
	}
	for (int i = 0; i < M; i += 2) {
		for (int j = 0; j < M; j++) {
			if (ans[i][j] <= (N-1) % M+1)ans[i][j] += M;
		}
	}
	cout << M << endl;
	for (auto i : ans) {
		for (auto j : i)cout << j << " ";
		cout << endl;
	}
	return 0;
}

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

#define ll long long int
#define pf push_front
#define mod  1000000007
#define inf  1000000000000000000
#define pi  acos(-1.0)
#define maxn  1000009
#define endl '\n'
#define sorted(s)  sort(s.begin(),s.end())
#define reversed(s) reverse(s.begin(),s.end())
#define sortarr(a) sort(a,a+n)
#define slc(n) scanf("%I64d", &n)
#define sl(n)  scanf("%lld", &n)
#define sf(n)  scanf("%lf", &n)
#define si(n)  scanf("%d", &n)
#define sch(n)  scanf(" %c", &n)
#define ss(n)  scanf("%s", n)
#define prf printf
#define pb  push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define forl(n) for(i=0;i<n;i++)
#define ison(n,j) (n&(1LL<<j))
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
bool check[1000007]={false};
ll fact[109];
vector<ll>prime;
void sieve(ll n)
{
    ll i,j;
    check[0]=true,check[1]=true,check[2]=false;
    for(i=4;i<=n;i+=2)
        check[i]=true;
    for(i=3;i*i<=n;i+=2)
    {
        if(!check[i])
        for(j=i*i;j<=n;j+=2*i)
        {
            check[j]=true;
        }
    }
   prime.pb(2);
   for(i=3;i<=n;i+=2)
   {
       if(!check[i])
        prime.pb(i);
   }
}

int main()
{
    sieve(1000001);
    ll x;
    cin>>x;
    cout<<*lower_bound(prime.begin(),prime.end(),x)<<endl;

    return 0;
}





Measured memory_bytes: 2424
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}


#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...)
#endif


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N, M, Q;
    cin >> N >> M >> Q;

    int m[N][N];
    REP(i, N) REP(j, N) m[i][j] = 0;
    REP(i, M) {
        int l, r;
        cin >> l >> r;
        --l; --r;
        m[l][r] += 1;
    }

    int s[N][N];
    REP(i, N) REP(j, N) s[i][j] = 0;
    REP(i, N) REP(j, N) {
        if (m[i][j] == 0) continue;

        for(int k=i; k >= 0; --k) {
            for (int l=j; l < N; ++l) {
                s[k][l] += m[i][j];
            }
        }
    }

    REP(i, Q) {
        int p, q;
        cin >> p >> q;
        --p; --q;
        cout << s[p][q] << endl;
    }

}


Measured memory_bytes: 2944
main = do
  n <- readLn
  putStrLn . show $ solved n 1 1

solved:: Int -> Int -> Int -> Int
solved n k kk
  | kk2 > n = kk
  | otherwise = solved n k2 kk2
  where
    k2 = k + 1
    kk2 = k2 * k2
  

Measured memory_bytes: 892
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o A.exe A.cpp 
Execute: ./A
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;

int main() { 	
	int n;
	cin >> n;
	
	if(n % 1000 == 0) {
		cout << 0 << endl; 
	} else {
		cout << (((n/1000)+1)*1000) - n << endl; 
	}
	
	return 0; 
} 


Measured memory_bytes: 3624
N = int(input())
A = list(map(int, input().split()))

D = [0] * (N+1)
D[0] = 0

for i in range (1, N+1):
    D[i] = A[i-1] - D[i-1]
for i in range(1, N+1):
    if i % 2 == 0:
        print(2*(D[i-1] - D[N]//2),end=" ")
    else:
        print(2*(D[i-1] + D[N]//2),end=" ")
print("")


Measured memory_bytes: 14028
#include <iostream>
#define N 101
using namespace std;
int main(){
	int n,w[N]={};
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> w[i];
	}
	int sum1=0,sum2=0;
	int min=10000;
	for(int i=0;i<n;i++){
		for(int j=0;j<i;j++){
			sum1+=w[j];
		}
		for(int j=i;j<n;j++){
			sum2+=w[j];
		}
		int abs= sum1<sum2 ? sum2-sum1:sum1-sum2;
		if(abs<min){
			min=abs;
		}
		sum1=0;
		sum2=0;
	}
	cout << min << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
using namespace std;



int main(){
ll N;
cin>>N;
vector<ll> a(N+1);
vector<ll> b(N);
for(ll i=0;i<N+1;i++){
  cin>>a[i];
}
for(ll i=0;i<N;i++){
  cin>>b[i];
}

ll tmp=0;
ll ans=0;
for(ll i=0;i<N;i++){
if(a[i]>=b[i]+tmp){
ans+=b[i]+tmp;
tmp=0;
}
else{
  ans += a[i];
  if((tmp-a[i])>=0){
    tmp=b[i];

  }
  else{
    tmp = b[i]-(a[i]-tmp);
  }


}


}

if(a[N]>=tmp){
  ans += tmp;
}
else{
  ans += a[N];
}

cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
    int a,n,i,min=1000000,max=-1000000;
    long int sum=0;
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%d",&a);
        sum += a;
        if(min > a)
        min = a;
        if(max < a)
        max = a;
    }
    printf("%d %d %ld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 2100
package main

import (
        "fmt"
)

func solution(s string) int {

        c := 0
        for i := range s {
                if i&1 == 0 {
                        if s[i] == '0' {
                                c++
                        }
                } else {
                        if s[i] == '1' {
                                c++
                        }
                }
        }

        out := c
        c = 0
        for i := range s {
                if i&1 == 1 {
                        if s[i] == '0' {
                                c++
                        }
                } else {
                        if s[i] == '1' {
                                c++
                        }
                }
        }

        out = min(out, c)
        return out
}

func min(x, y int) int {
        if x < y {
                return x
        }
        return y
}

func main() {
        var s string
        fmt.Scan(&s)
        fmt.Println(solution(s))
}

Measured memory_bytes: 1280
#include<stdio.h>

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n;
  scanf("%d",&n);
  if(n==1){
    printf("Hello World\n");
    return;
  }
  int a,b;
  scanf("%d%d",&a,&b);
  printf("%d\n",a+b);
}

int main(void){
  run();
  return 0;
}


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

int f(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
int main()
{
    int N;
    cin >> N;

    if (N % f(N) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * @author wuyue
 *
 */
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();
		
//		int nn = (int) Math.sqrt(n);
//		int mm = (int) Math.sqrt(m);
//		int kk = (int) Math.sqrt(k);
//		if (nn + mm < kk) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}
		if (k - m- n>0) {
			if ((k-m-n) *(k-m-n) - 4*n*m > 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else {
				System.out.println("No");
		}
		
		
		
	}

}


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

int main(void){
  char s[100000];
  int l, i;
  scanf("%s",s);
  l = strlen(s);
  for(i=0;i<(double)l/2;i++) printf("%c",s[i*2]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($N,$K) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
$hh = explode(" ",trim(fgets(STDIN)));
foreach($hh as $v) {
  $h[]=(int)$v;
}

$dp[0]=0;
for($i=1;$i<$N;++$i) {
  $dp[$i]=PHP_INT_MAX;
  $limit = min($i,$K);
  for($j=1;$j<=$limit;++$j) {
    $dp[$i]=min($dp[$i],$dp[$i-$j]+abs($h[$i]-$h[$i-$j]));
  }
}
printf("%d\n",$dp[$N-1]);


Measured memory_bytes: 23024
//#pragma GCC optimize("O3,unroll-loops")
//#pragma loop_opt(on)
#include <bits/stdc++.h>
//#include <bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MAX = 1e6+5;
constexpr ll INF = 2134567890;
constexpr ll MOD = 998244353;

ll fpow(ll b, ll a, ll MOD = MOD) {
    b %= MOD;
    ll r = 1;
    for(; a; b=b*b%MOD, a>>=1)
        a&1 && (r = r*b%MOD);
    return r;
}

struct DSU {
    int *ary, sz;
    DSU(int _sz): sz(_sz), ary(new int[_sz]()) { memset(ary, -1, sizeof(int)*sz); }
    int find(int x) { return ary[x] < 0 ? x : ary[x] = find(ary[x]); }
    void merge(int u, int v) {
        u = find(u);
        v = find(v);
        if (u == v) return;
        ary[u] += ary[v];
        ary[v] = u;
    }
    bool same(int u, int v) { return find(u) == find(v); }
    int size(int x) { return -ary[find(x)]; }
};

signed main() {
    FAST;

    int n, m, k;
    cin >> n >> m >> k;
    vector<int> cnt(n, 0);
    DSU dsu(n);
    Fr(i, 0, m) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        dsu.merge(u, v);
        cnt[u]--;
        cnt[v]--;
    }
    Fr(i, 0, n) cnt[i] += dsu.size(i)-1;
    Fr(i, 0, k) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        if (dsu.same(u, v)) {
            cnt[u]--;
            cnt[v]--;
        }
    }
    Fr(i, 0, n) cout << cnt[i] << " \n"[i+1==n];

}


Measured memory_bytes: 2048
N = int(input())
S = input()
left = 0
right = S[1:].count('E')
result = left + right
for i in range(1, N):
  if S[i-1] == "W":
    left += 1
  if S[i] == "E":
    right -= 1
  result = min(result, left + right)
print(result)

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <string>
#include <numeric>

using namespace std;

#define ll long long int

#define SAY_YES cout << "YES" << endl
#define SAY_NO cout << "NO" << endl
#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)

#define vec vector

int main() {
  int n;
  cin >> n;
  vector<int> h;
  rep(i, n){
    int a;
    cin >> a;
    h.push_back(a);
  }
  vector<int> dp(n, 0);
  rep(i, dp.size()) {
    if(i == 0) {
      dp[i] = 0;
      continue;
    } else if (i == 1) {
      dp[i] = abs(h[i]-h[i-1]);
      continue;
    }
    int a = dp[i-2] + abs(h[i-2]-h[i]);
    int b = dp[i-1] + abs(h[i-1]-h[i]);
    dp[i] = min(a, b);
  }
  say(dp[n-1]);
  return 0;
}


Measured memory_bytes: 1144
#include <stdio.h>
#include <math.h>
int main(void){
    double x1,y1,x2,y2;
    scanf("%lf",&x1);
    scanf("%lf",&y1);
    scanf("%lf",&x2);
    scanf("%lf",&y2);
    printf("%.8lf\n",pow((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1),0.5));
    return 0;
}


Measured memory_bytes: 2900
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int w, h;
	if (cin >> h >> w, !(h | w)) {
		return 0;
	}
	int x = h * h + w * w;
	int m[] = {150, 150, 150 * 150 + 150 * 150};
	for (int i = 150; --i;) {
		for (int j = i; --j;) {
			int y = i * i + j * j;
			if (y > x || (x == y && j > h)) {
				if (y < m[2] || (j < m[0])) {
					m[0] = j;
					m[1] = i;
					m[2] = y;
				}
			} else {
				break;
			}
		}
	}
	printf("%d %d\n", m[0], m[1]);
	return main();
}

Measured memory_bytes: 1144
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val B = in.head
  
  val t = B.map{ e =>
    e match {
      case 'A' => '1'
      case 'T' => '1'
      case 'C' => '1'
      case 'G' => '1'
      case _ => '0'
    }
  }
  val h = t.split('0').toSeq.sorted.reverse
  val ret = if(h.isEmpty) 0 else h.head.size
  println(ret)
}


Measured memory_bytes: 25508
/*
      author : nishi5451
      created: 11.08.2020 21:37:51
*/

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


int main(){
    char c;
    cin >> c;
    if(c == 'A') cout << "T" << endl;
    else if(c == 'C') cout << "G" << endl;
    else if(c == 'G') cout << "C" << endl;
    else if(c == 'T') cout << "A" << endl;
    return 0;
}

Measured memory_bytes: 3552
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<vector<char>> grid(h+2, vector<char>(w+2, '.'));
    rep(i,h)rep(j,w) cin >> grid[i+1][j+1];
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(grid[i][j] == '.') continue;
            if(grid[i+1][j] == '#') continue;
            if(grid[i-1][j] == '#') continue;
            if(grid[i][j+1] == '#') continue;
            if(grid[i][j-1] == '#') continue;
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

main(){
  int s,d,m;
  while(cin>>s>>d>>m){

    int dp[5001][301]={},pp=0,ppp=100000000,k,w,p,cc;

    vector<pair<int,int> >a[101],c;

    for(int i=0;i<s;i++){
      cin>>k;

      for(int j=0;j<k;j++){
        cin>>w>>p;
        a[i].push_back(mk(p,w));

      }
    }
    for(int i=0;i<d;i++){
      cin>>cc;

      for(int j=0;j<a[cc].size();j++)
        c.push_back(a[cc][j]);
    }
    for(int i=1;i<=c.size();i++)
     for(int j=0;j<=m;j++){

      if(j<c[i-1].first)
        dp[i][j]=dp[i-1][j];
      else
         dp[i][j]=max(dp[i-1][j-c[i-1].first]+c[i-1].second,dp[i-1][j]);

      pp=max(pp,dp[i][j]);
     }

    for(int i=0;i<=c.size();i++)
      for(int j=0;j<=m;j++)
        if(pp==dp[i][j])ppp=min(ppp,j);

    cout<<pp<<' '<<ppp<<endl;
  }
}

Measured memory_bytes: 9044
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

vector<pair<ll,ll>> prime_fact(ll x){
    ll i = 2; 
    vector<pair<ll,ll>> ans;
    while(i*i <= x){
        ll tmp = 0;
        while(x%i == 0){
            tmp++;
            x/=i;
        }
        if(tmp != 0){
            ans.push_back(make_pair(i,tmp));
        }
        i++;
    }
    if(x != 1)ans.push_back(make_pair(x,1));

    return ans;
}


ll gcd(ll x,ll y){
    while(y > 0){
        ll tmp = y;
        y = x % y;
        x = tmp;
    }
    return x;
}

int main(){
    ll N;
    cin>>N;
    v A(N);
    rep(i,0,N)cin>>A[i];
    v used(1000001,0);
    bool p_ans = true;

    rep(i,0,N){
        vector<pair<ll,ll>> now;
        now = prime_fact(A[i]);
        rep(j,0,now.size()){
            if(used[now[j].first] >= 1)p_ans = false;
            else used[now[j].first]++;
            //cout<<now[j].first<<endl;
        }
        if(p_ans == false)break;
    }
    ll now = A[0];
    rep(i,1,N){
        now = gcd(now,A[i]);
    }

    ll s_ans = false;
    if(now == 1)s_ans = true;

    if(p_ans)cout<<"pairwise coprime";
    else if(s_ans)cout<<"setwise coprime";
    else cout<<"not coprime";
    return 0;
}

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

public class Main {
	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	int n = sca.nextInt();
	long[] ai = new long[n];
	for(int i = 0; i < n; i++) {
		ai[i] = sca.nextLong();
	}
	boolean flg = true;
	Arrays.sort(ai);
	for(int i = 0; i < n-1; i++) {
		if(ai[i] == ai[i+1]) {
			System.out.println("NO");
			flg = false;
			break;
		}
	}
	if(flg == true) {
		System.out.println("YES");
	}

	// 後始末
	sca.close();
	}
}

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

int main(){
  string w;
  cin>>w;
  int sz=w.size();
  for(int i=0;i<sz;i++){
    int cnt=0;
    for(int j=0;j<sz;j++){
      if(w[i]==w[j]){
        cnt++;
      }
    }
    if(cnt%2!=0){ cout<<"No"; return 0;}
  }
  cout<<"Yes";
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  LL a, b, c;
  Solver(LL a) : a(a){};

  void solve() {
    cin >> b >> c;
    cout << b + min((a + b + 1), c) << endl;
  }
};
class Solver2 {
 public:
  int n, m;
  Solver2(LL n, LL m) : n(n), m(m){};

  void solve() {
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

ll pow[19];

ll dfs(int k, int i, ll dif, ll dif_org){
    // if(k == 4) cout << dif << endl;
    if(i < k-i+1) return dif == 0 ? 1:0;
    if(i == k-i+1){
        if(dif == 0){
            if(k != i){
                return 10;
            }else{
                return 9;
            }
        }else{
            return 0;
        }
    }
    ll d = pow[i-1]-pow[k-i];
    ll r = dif%d;
    ll m = dif/d;
    ll sum = 0;
    if(r == 0){
        if(abs(m) < 10) {
            if(k != i){
                sum += (10-abs(m))*dfs(k, i-1, r, dif_org);
            }else{
                sum += (10-abs(m)-1)*dfs(k, i-1, r, dif_org);
            }
        }
    }else{
        if(abs(m) < 10) {
            if(k != i){
                sum += (10-abs(m))*dfs(k, i-1, r, dif_org);
            }else{
                sum += (10-abs(m)-1)*dfs(k, i-1, r, dif_org);
            }
        }
        if(dif > 0){
            if(abs(m)+1 < 10) {
                if(k != i){
                    sum += (10-abs(m)-1)*dfs(k, i-1, r-d, dif_org);
                }else{
                    sum += (10-abs(m)-2)*dfs(k, i-1, r-d, dif_org);
                }
            }
        }else if(dif < 0){
            if(abs(m)+1 < 10) {
                if(k != i){
                    sum += (10-abs(m)-1)*dfs(k, i-1, r+d, dif_org);
                }else{
                    sum += (10-abs(m)-2)*dfs(k, i-1, r+d, dif_org);
                }
            }
        }
    }
    return sum;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    pow[0] = 1;
    for(int i = 1; i < 19; i++) pow[i] = pow[i-1]*10; 
    ll D;
    cin >> D;
    ll ans = 0;
    for(int i = 1; i <= 19; i++){
        ans += dfs(i, i, D, D);
        // cout << i << ' ' << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class332
    {
        static int[] jump = new int[2] { 1, 2 };
        static void Main()
        {
            var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = h[0], A = h[1]-1, B = h[2]-1, C = h[3]-1, D = h[4]-1;
            string S = Console.ReadLine();
            bool[] ta = new bool[N];
            bool[] tb = new bool[N];

            var que = new Queue<int>();
            que.Enqueue(A);
            while (que.Count > 0)
            {
                var t = que.Dequeue();
                ta[t] = true;
                for(int i = 0; i < 2; i++)
                {
                    int nx = t + jump[i];
                    if (nx <=C)
                    {
                        if (S[nx] == '.'&&ta[nx] == false)
                        {
                            que.Enqueue(nx);
                        }
                    }
                }
            }
            que = new Queue<int>();
            que.Enqueue(B);
            while (que.Count > 0)
            {
                var t = que.Dequeue();
                tb[t] = true;
                for(int i = 0; i < 2; i++)
                {
                    int nx = t + jump[i];
                    if (nx <=D)
                    {
                        if (S[nx] == '.'&&tb[nx] == false)
                        {
                            que.Enqueue(nx);
                        }
                    }
                }
            }

            if ((A < B && D < C) || (B < A && C < D))
            {
                bool c = false;
                for (int i = 0; i < N - 2; i++)
                {
                    if ((ta[i] && ta[i + 1] && ta[i + 2]&&tb[i+1])||(tb[i]&&tb[i+1]&&tb[i+2]&&ta[i+1]))
                    {
                        c = true;
                    }
                }
                Console.WriteLine((ta[C] && tb[D] && c) ? "Yes" : "No");
            }
            else
            {
                Console.WriteLine((ta[C] && tb[D]) ? "Yes" : "No");
            }
        }
    }
}


Measured memory_bytes: 14304
fn main() {
    macro_rules! input {
        (source = $s:expr, $($r:tt)*) => {
            let mut iter = $s.split_whitespace();
            input_inner!{iter, $($r)*}
        };
        ($($r:tt)*) => {
            let mut s = {
                use std::io::Read;
                let mut s = String::new();
                std::io::stdin().read_to_string(&mut s).unwrap();
                s
            };
            let mut iter = s.split_whitespace();
            input_inner!{iter, $($r)*}
        };
    }


    macro_rules! input_inner {
        ($iter:expr) => {};
        ($iter:expr, ) => {};

        ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($iter, $t);
            input_inner!{$iter $($r)*}
        };
    }

    macro_rules! read_value {
        ($iter:expr, ( $($t:tt),* )) => {
            ( $(read_value!($iter, $t)),* )
        };

        ($iter:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        };

        ($iter:expr, chars) => {
            read_value!($iter, String).chars().collect::<Vec<char>>()
        };

        ($iter:expr, usize1) => {
            read_value!($iter, usize) - 1
        };

        ($iter:expr, $t:ty) => {
            $iter.next().unwrap().parse::<$t>().expect("Parse error")
        };
    }

    input!(a: i32, b: i32, c:i32, d: i32);

    let mut turn = false;

    let mut a = a;
    let mut c = c;

    while a > 0 && c > 0 {
        if turn == true {
            a -= d;
        } else {
            c -= b;
        }

        turn = !turn;
    }

    if a <= 0 {
        println!("No");
        return
    }

    println!("Yes");
}



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

int main() {
    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC" << endl;
    }
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3600
package main

import (
    "fmt"
)

func main() {
    var N, A, B int
    fmt.Scanf("%d %d %d", &N, &A, &B)
    if A == 0 {
        fmt.Println(0)
        return
    }

    i := N/(A+B)
    j := N%(A+B)
    var res int

    if j < A {
        res = i * A + j
    } else {
        res = i * A + A
    }

    fmt.Println(res)
}

Measured memory_bytes: 512
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
print(n**2)

Measured memory_bytes: 38384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        // process: 「光が届く電球の数を光の強さにする」をk回繰り返す
        // ex. 1,0,0,1,0
        // *-
        //  *
        //   *
        //   -*-
        //     -    => 1,2,2,1,2 (k = 1)
        // *-
        // -*--
        // --*--
        //   -*-
        //   --*    => 3,3,4,4,3 (k = 2)
        
        while (k-- > 0) {
            int[] start = new int[n];
            int[] end = new int[n];
            for(int i = 0; i < n; i++) {
                start[i] = Math.max(0, i-array[i]);
                end[i] = Math.min(n-1, i+array[i]);
            }
            
            // imos法: 累積和の区間版
            // sum[i]: 時刻iで放送中の番組数
            int[] sum = new int[n+1];
            for (int i = 0; i < n; i++) {
                // 時刻start[i]で放送番組が1増える
                // 時刻end[i]+1で放送番組が1減る
                sum[start[i]]++;
                sum[end[i] + 1]--;
            }
            for (int i = 0; i < n; i++) {
                sum[i + 1] += sum[i];
            }
            
            long now = 0;
            for (int i = 0; i < n; i++) {
                array[i] = sum[i];
                now += array[i];
            }
            long max = (long)n * n;
            if (now == max) {
                for (int i = 0; i < n; i++) {
                    System.out.print(array[i]);
                    if (i != n - 1) {
                        System.out.print(" ");
                    } else {
                        System.out.println();
                    }
                }
                // System.out.println(k);
                return;
            }
            
            // System.out.println(Arrays.toString(sum));
        }
        
        for (int i = 0; i < n; i++) {
            System.out.print(array[i]);
            if (i != n - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
        }
    }
}

Measured memory_bytes: 63108
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
  ll i,j,k,l,n,m;
  cin>>n>>m;
  
  vector< pair<ll,ll> > vc;
  for(i=0;i<n;i++){
      cin>>k>>l;
      vc.ps({k,l});
  }
  sort(all(vc));
  ll c=0;
  for(i=0;i<n;i++){
      if(vc[i].sc>m){
          c=c+(m)*vc[i].fs;
          m=0;
      }
      else {
          c=c+(vc[i].sc)*(vc[i].fs);
          m=m-vc[i].sc;
      }
      if(m==0) break;
  }
  cout<<c;
  return 0;
}

Measured memory_bytes: 2420
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>

using std::list;
using std::max;
using std::min;
using std::vector;

static const int kMaxWeight = 10000;
static const int kMaxNItem = 100;

int result[kMaxWeight+1][kMaxNItem+1];

class Item {
  public:
    int value;
    int weight;
    void print() const;
};

void Item::print() const
{
  printf("%d, %d\n", this->value, this->weight);
}

bool gt_value(const Item& a, const Item& b)
{
  return a.value > b.value;
}

bool lt_weight(const Item& a, const Item& b)
{
  return a.weight < b.weight;
}

int solve(const vector<Item>& items, int weight, int index)
{
  if(index < 0 || items.size() <= index || weight < 0) {
    return 0;
  }
  if(result[weight][index] != -1) {
    return result[weight][index];
  }
  int tmp = 0;
  for(int i = 0; 0 <= weight-items.at(index).weight*i; i++) {
    tmp = max(tmp, solve(items, weight-items.at(index).weight*i, index-1) + items.at(index).value*i);
  }
  result[weight][index] = tmp;
  return result[weight][index];
}

void init_result()
{
  memset(result, -1, sizeof(result));
}

void remove_not_unique(vector<Item>& items)
{
  std::sort(items.begin(), items.end(), gt_value);
  std::stable_sort(items.begin(), items.end(), lt_weight);
  int weight = 0;
  for(auto& item : items) {
    if(weight == item.weight) {
      item.weight = INT_MAX;
    } else {
      weight = item.weight;
    }
  }
}

int main()
{
  init_result();
  int nitem, max_weight;
  scanf("%d%d", &nitem, &max_weight);
  vector<Item> items(nitem);
  for(auto& item : items) {
    scanf("%d%d", &item.value, &item.weight);
  }
  remove_not_unique(items);
  //for(const auto& item : items) {
    //item.print();
  //}
  solve(items, max_weight, items.size()-1);
  printf("%d\n", result[max_weight][items.size()-1]);
  return 0;
}



Measured memory_bytes: 6764
#include <stdio.h>

int main() {
	char ca, cb;
	int a, b;
	int array[3] = {1, 0, 0};
	int i;

	while(scanf("%c,%c", &ca, &cb) != EOF) {
		int temp;
		while(getchar() != '\n');

		a = ca - 'A';
		b = cb - 'A';
		
		temp = array[a];
		array[a] = array[b];
		array[b] = temp;
	}

	for(i = 0; !array[i]; i++);

	printf("%c\n", (char)(i + 'A'));

	return 0;
}

Measured memory_bytes: 548
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        double n = Double.parseDouble(sc.next());

        n /= 1.08;
        int nInt = (int) n;
        double ans = Math.ceil(n);

        if ((n - nInt) + (1/1.08) <= 1 && (n - nInt) > 0 ) {
            System.out.println(":(");
        } else {
            System.out.print((int)ans);
        }
    }
}

Measured memory_bytes: 23764
/*
      author : nishi5451
      created: 11.08.2020 19:47:12
*/

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


int main(){
    string s;
    cin >> s;
    s[3]='8';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define LL long long
#define L(x) x<<1    //左儿子 x*2
#define R(x) x<<1|1 //右儿子  x*2+1
using namespace std;
typedef long long ll;
int a[100005];
int use[100005];

int dfs(int now,int step)
{
    if(now==2)
        return step;
    if(use[now])
        return -1;
    use[now]=1;
    dfs(a[now],step+1);
}

int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int ans=dfs(1,0);
    cout<<ans<<endl;
    return 0;
}


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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

using namespace std;

int main() {
	SINT32 N,M,ANS,BUF;
	cin >> N >> M;

	vector<int> DATA(M);
	vector<int> SA(M);


	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA[i];
	}

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

	for (SINT32 i = 1; i < M; i++) {
		SA[i] = DATA[i] - DATA[i-1];
	}

	sort(SA.begin(),SA.end(),std::greater<int>());

	for (SINT32 i = N-1; i < M; i++) {
		ANS = SA[i] + ANS;
	}
	
	cout << ANS << endl;
	return 0;
}

Measured memory_bytes: 1024