akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <string>
#include <tuple>
using namespace std;

int solve(string& X, string& Y){
  int x_size = X.size();
  int y_size = Y.size();
  
  vector<vector<int>> dp(y_size+1);
  for(int i=0;i<=y_size;i++){
    for(int j=0;j<=x_size;j++){
      dp[i].push_back(0);
    }
  }
  
  for(int i=1;i<=y_size;i++){
    for(int j=1;j<=x_size;j++){
      if(Y[i-1]==X[j-1]){
        dp[i][j] = dp[i-1][j-1]+1;
      } else {
        dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
      }
    }
  }
  
  /*
  for(int i=0;i<=y_size;i++){
    for(int j=0;j<=x_size;j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }
  */
  
  return dp[y_size][x_size];
}

int main(void){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    string X,Y;
    cin >> X >> Y;
    
    int lcs = solve(X,Y);
  
    cout << lcs << endl;
  }
}



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

vector<int> bfs(int N, vector<vector<int>>& edges, vector<int> starts)
{
    auto distances = vector<int>(N, numeric_limits<int>::max());
    auto queue = std::queue<int>();
    for (auto v : starts)
    {
        distances[v] = 0;
        queue.push(v);
    }

    while (!queue.empty())
    {
        auto v = queue.front(); queue.pop();
        for (auto w : edges[v]) if (distances[w] == numeric_limits<int>::max())
        {
            distances[w] = distances[v]+1;
            queue.push(w);
        }
    }
    return distances;
}

int solve(int N, int K, vector<vector<int>> edges)
{
    auto result = numeric_limits<int>::max();
    for (auto center = 0; center < N; center++)
    {
        auto distances = bfs(N, edges, {center});
        auto option = static_cast<int>(count_if(begin(distances), end(distances), [K](int d) { return d > K/2; }));
        result = min(result, option);
    }
    for (auto center1 = 0; center1 < N; center1++) for (auto center2 : edges[center1])
    {
        auto distances = bfs(N, edges, {center1, center2});
        auto option = static_cast<int>(count_if(begin(distances), end(distances), [K](int d) { return d > (K-1)/2; }));
        result = min(result, option);
    }
    return result;
}

int main()
{
    int N, K; cin >> N >> K;

    auto edges = vector<vector<int>>(N);
    for (auto i = 0; i < N-1; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    cout << solve(N, K, edges) << endl;
}


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

int main(){
  long long a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k<=a){
    cout << k << endl;
  }else if(k<=a+b){
    cout << a << endl;
  }else{
    cout << a-(k-a-b) << endl;
  }
}

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

using namespace std;

int main(void){
    int N=0;
    string ans="No";

    cin >> N;
    if((N / 10 % 111) == 0 || (N % 1000 % 111 ==0))
      ans="Yes";
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;  
// Important header files   
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
using namespace std;  
  
// Declaring ordered_set 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set; 
#define rep(i,n) for(li i=0;i<n;i++)
#define li long long int
#define ll long long int
#define pb push_back
#define all(v) sort(v.begin(),v.end())
const int N = 40043;
const ll mod = 1e9 + 7;
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define s2 second
const ll INF=(1LL<<60)-1;


li gcd(li a,li b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
li lcm(li a,li b)
{
    return (a*b)/gcd(a,b);
}
li power(li a,li b)
{
    li res=1;
    while(b)
    {
        if(b&1)
        res=(res*a);
        a=((a)*(a));
        b>>=1;
    }
    return res;
}
 
li xx,yy,dd;
void equation(li a,li b)
{
    if(b==0)
    {
        xx=1;
        yy=0;
        dd=a;
    }
    else
    {
        equation(b,a%b);
        li temp=xx;
        xx=yy;
        yy=temp-(a/b)*yy;
    }
}
li inverse(li a,li m)
{
    equation(a,m);
    return(xx%m+m)%m;
}
bool compare(const pair<li,li> &i, pair<li,li> &j)
{
    if(i.f==j.f)
    return i.s2 > j.s2;
    else
    return i.f<j.f;
    
}


void solve()
{
    li n,d;
    cin>>n>>d;
    d=d*d;
    li x,y;
    li ans=0;
    rep(i,n)
    {
        cin>>x>>y;
        x=x*x+y*y;
        
        if(x<=d)
        ans++;
    }
    cout<<ans;
}
signed main()
{
   //seive();
   //cout<<prime.size();
   FAST_IO;
   int t;
   t=1;
   while(t--)
   {
       solve();
       cout<<endl;
      
   }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll a,b,c,d,e,f;

int main(){
	cin.sync_with_stdio(false);
  cin>>a>>b>>c>>d>>e>>f;
  a*=100;
  b*=100;
  double maxr=-1;
  ll resa=-1,resb=-1;
  rep(i,33)rep(j,33){
    if(a*i+b*j>f)continue;
    double w=(a*i+b*j);
    ll rest=f-(a*i+b*j);
    ll s=(a*i/100+b*j/100)*e;
    rep(k,3030){
      if(c*k>s||c*k>rest)continue;
      ll l=min(((s-c*k)/d),((rest-c*k)/d));
      double ss=d*l+c*k;
      if(maxr<ss/(ss+w)){
        maxr=ss/(ss+w);
        resa=ss+w;
        resb=ss;
      }
    }
  }
  cout<<resa<<" "<<resb<<endl;
	return 0;
}


Measured memory_bytes: 256
<?php

//標準入力
class Scanner {
  private $arr = [];
  private $count = 0;
  private $pointer = 0;
  public function next() {
      if($this->pointer >= $this->count) {
          $str = trim(fgets(STDIN));
          $this->arr = explode(' ', $str);
          $this->count = count($this->arr);
          $this->pointer = 0;
      }
      $result = $this->arr[$this->pointer];
      $this->pointer++;
      return $result;
  }
  public function hasNext() {
      return $this->pointer < $this->count;
  }
  public function nextInt() {
      return (int)$this->next();
  }
  public function nextDouble() {
      return (double)$this->next();
  }
}

//標準出力
class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}


$sc = new Scanner();
$N = $sc->nextInt();

$array = array();
$cnt = 1;

while($N > 0){
  $S = $sc->next();
  $P = $sc->nextInt();
  $array []= array('cnt'=>$cnt,'city'=>$S,'point'=>$P);
  $cnt++;
  $N--;
}

foreach($array as $value){
  $city_array[] = $value['city'];
  $point_array[] = $value['point'];
}

array_multisort($city_array,SORT_ASC, SORT_STRING, $point_array,SORT_DESC, SORT_NUMERIC, $array);

foreach($array as $array){
  echo($array['cnt'].PHP_EOL);
}


?>


Measured memory_bytes: 4728
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()

  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    println(-1)
    return
  }


  val letters = Array(26) { 0 }
  for ((i, c) in s.withIndex()) {
    val a = c - 'a'
    letters[a] = i + 1
  }

  // println(letters.joinToString(" "))

  if (letters.contains(0)) {
    var tmp = 0
    for ((i, li) in letters.withIndex()) {
      if (li == 0) {
        tmp = i
        break
      }
    }
    val c = 'a' + tmp
    println(s + c.toString())
  } else {
    var pre = s.last()
    var index = 0
    val list = mutableListOf<Char>()
    list.add(pre)
    for (i in 24 downTo 0) {
      val now = s[i]
      if (now.toInt() < pre.toInt()) {
        index = i
        break
      }
      list.add(now)
      pre = now
    }
    val sub = s.substring(0, index)
    // println(list.joinToString(""))
    val last = list.filter { it.toInt() > s[index].toInt() }.sorted().first()
    println(sub + last)
  }



}


Measured memory_bytes: 41704
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  int n;
  cin >> s >> t;
  n = s.size();
  int count = 0;
  for(int i=0;i<n;i++){
    if(s.at(i) != t.at(i)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3860
using System;
        using System.Linq;
        using static System.Math;

        public class Program
        {
            public static void Main(string[] args)
            {
            int input = int.Parse(Console.ReadLine());
            int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int answer = 0;

            foreach(int i in arr.Where(x => x % 2 == 0))
            {
                int j = i;
                while(j % 2 < 1)
                {
                    j = j / 2;
                    answer++;
                }
            }

            Console.WriteLine(answer);
            }
        }

Measured memory_bytes: 14176
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a,b;cin>>a>>b;
  int n=a.size();
  int c=0;
  for(int i=0;i<n;i++){
    int f=0;
    for(int j=0;j<n;j++){
      if(a[(i+j)%n]!=b[j])f++;
    }
    if(f==0)c=1;
  }
  if(c==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 888
s = int(input())

a = [-1]*(s+10)
mod = 10**9 + 7

a[0] = 1
a[1] = 0
a[2] = 0
a[3] = 1
if s > 3:
    for i in range (4,s+1):
        a[i] = (a[i-1]+a[i-3])%mod

print(a[s])


Measured memory_bytes: 9152
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

s = input().strip()
n = len(s)
acc = 0
for i in range(n//2):
    if s[i]!=s[n-1-i]:
        acc += 1
print(acc)


Measured memory_bytes: 3060
#include <cstdio>
#include <ctype.h>
using namespace std;
int main(){
  char a[10],b[10],c[10];
  scanf("%s %s %s",a,b,c);
  printf("%c%c%c",toupper(a[0]),toupper(b[0]),toupper(c[0]));
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean[] b = new boolean[n];
        int k = sc.nextInt();
        for(int i=0; i<k; i++) {
            int d = sc.nextInt();
            for(int j=0; j<d; j++) {
                int l = sc.nextInt() -1;
                b[l] = true;
            }
        }
        int res = 0;
        for(int i=0; i<n; i++) {
            if(!b[i]) res++;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 46108
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

const int INF = 1 << 30;

int main() {
	cout << fixed << setprecision(15);
	int N;
	cin >> N;
	vector<double> x(N), y(N);
	for (int i = 0; i < N; i++) cin >> x[i] >> y[i];

	vector<vector<double>> dist(N, vector<double>(N));
	for (int i = 0; i < N; i++) {
		for (int j = i+1; j < N; j++) {
			dist[i][j] = sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
			dist[j][i] = dist[i][j];
		}
	}

	vector<int> perm(N);
	int div = 1;
	for (int i = 0; i < N; i++) {
		perm[i] = i;
		if (i > 0) div *= i+1;
	}
	double ans = 0;
	do {
		for (int i = 0; i < N-1; i++) {
			ans += dist[perm[i]][perm[i+1]]/div;
		}
	} while (next_permutation(perm.begin(), perm.end()));
	cout << ans << endl;
}


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

bool compare_by_second(pair<int, int> a, pair<int, int> b){
  return a.second > b.second;
}

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<int> A;
  vector<pair<int, int>> BC;
  int a, b, c;
  for (int i = 0; i < N; i++){
    cin >> a;
    A.push_back(a);
  }
  
  for(int i = 0; i < M; i++){
    cin >> b >> c;
    BC.push_back(make_pair(b, c));
  }
  
  sort(A.begin(), A.end());
  sort(BC.begin(), BC.end(), compare_by_second);
  
  long long int num = N;
  long long int sum = 0;
  for(int i = 0; num > 0;){
    long long int addnum;
    long long int usenum;
    if( BC[i].second > A.back() ){
      addnum = BC[i].second;
      usenum = BC[i].first;
      i++;
    }else{
      addnum = A.back();
      usenum = 1;
      A.pop_back();
    }
    
    if(num <= usenum){
        // 終わり
      sum += num*addnum;
      num = 0;
    }else{
      sum += usenum * addnum;
      num -= usenum;
    }
  }
  cout << sum << endl;
 
  return 0;
}

Measured memory_bytes: 1784
from operator import itemgetter
from collections import defaultdict
import sys
input = sys.stdin.readline

# Union-Findデータ構造
class UnionFind:
    def __init__(self, numV):
        self.pars = list(range(numV))
        self.ranks = [0] * numV
    def find(self, x):
        if self.pars[x] == x: return x
        else:
            self.pars[x] = self.find(self.pars[x])
            return self.pars[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return
        if self.ranks[x] < self.ranks[y]:
            self.pars[x] = y
        else:
            self.pars[y] = x
            if self.ranks[x] == self.ranks[y]:
                self.ranks[x] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
xys = []
for i in range(N):
    x, y = map(int, input().split())
    xys.append((x, y, i))

UF = UnionFind(N)
for k in range(2):
    xys.sort(key=itemgetter(k))
    for i in range(N-1):
        if xys[i][k] == xys[i+1][k]:
            UF.union(xys[i][2], xys[i+1][2])

Xs = defaultdict(set)
Ys = defaultdict(set)
for x, y, i in xys:
    no = UF.find(i)
    Xs[no].add(x)
    Ys[no].add(y)

ans = 0
for no in Xs.keys():
    ans += len(Xs[no]) * len(Ys[no])

print(ans - N)


Measured memory_bytes: 30848
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<=n;i++)
using namespace std;
int main(){
    long long N,Y;cin>>N>>Y;
    REP(i,N){
        REP(y,N-i){
            long long m=(i*10000)+(y*5000)+((N-i-y)*1000);
            if(m==Y){
                printf("%d %d %d\n",i,y,(N-i-y));
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace _067
{
    class Program
    {
        static void Main(string[] args)
        {
            // A
            var ab = Console.ReadLine().Split(' ').ToArray();
            var a = int.Parse(ab[0]);
            var b = int.Parse(ab[1]);

            if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
            {
                Console.WriteLine("Possible");
            }
            else
            {
                Console.WriteLine("Impossible");
            }
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int prime(int x){
  int i;
  if(x < 2) return 0;
  if (x == 2) return 1;
  if(x%2 == 0) return 0;
  for(i=3; i*i<=x; i+=2){
    if(x%i == 0) return 0;
  }
  return 1;
}

int main(void){
  int n,x,i;
  int cnt = 0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&x);
    if(prime(x)) cnt++;
  }
  printf("%d\n",cnt);
  return 0;
}


Measured memory_bytes: 2112
import sys

input = sys.stdin.readline
N, Q = map(int, input().split())
Qs = [list(map(int, input().split())) for _ in range(Q)]


class SegmentTree:
    def __init__(self, n, segfunc=min, ele=10**10):
        self.ide_ele = ele
        self.num = pow(2, (n-1).bit_length())
        self.seg = [self.ide_ele] * 2 * self.num
        self.segfunc = segfunc

    def init(self, init_val):
        #set_val
        for i in range(len(init_val)):
            self.seg[i+self.num-1] = init_val[i]
        #built
        for i in range(self.num-2, -1, -1):
            self.seg[i] = self.segfunc(self.seg[2*i+1], self.seg[2*i+2])

    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1], self.seg[k*2+2])

    def query(self, p, q):
        if q <= p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res = self.ide_ele
        while q-p > 1:
            if p & 1 == 0:
                res = self.segfunc(res, self.seg[p])
            if q & 1 == 1:
                res = self.segfunc(res, self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res, self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
        return res


cols = SegmentTree(N, ele=N - 1)
raws = SegmentTree(N, ele=N - 1)
ans = (N-2)*(N-2)
for q, x in Qs:
    x -= 1
    if q == 1:
        i = cols.query(x, N)
        raws.update(i, min(x, raws.seg[raws.num-1+i]))
        ans -= i - 1
    if q == 2:
        i = raws.query(x, N)
        cols.update(i, min(x, cols.seg[cols.num-1+i]))
        ans -= i - 1

print(ans)


Measured memory_bytes: 115580
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		try {
			while ((buffer = reader.readLine())  != null) {
				int n = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));

				for (int i = 1; i <= n; i++) {
					int x = i;
					if (x % 3 == 0) {
						System.out.print(" " + i);
					}
					else {
						if (x % 10 == 3) {
							System.out.print(" " + i);
						}
						else {
							x /= 10;
							if (x % 10 == 3) {
								System.out.print(" " + i);
							}
							else {
								x /= 10;
								if (x % 10 == 3) {
									System.out.print(" " + i);
								}
								else {
									x /= 10;
									if (x % 10 == 3) {
										System.out.print(" " + i);
									}
									else {
										x /= 10;
										if (x % 10 == 3) {
											System.out.print(" " + i);
										}
										else {
											x /= 10;
											if (x % 10 == 3) {
												System.out.print(" " + i);
											}
										}
									}
								}
							}
						}
					}
				}
				System.out.println();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

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

typedef struct shop_str{
    char name[11];
    int pnt;
    int rank;
    int in;
}shop;

void swap(shop *r1, shop *r2);
void swapnum(int *num1, int *num2);
void swappnt(shop* r1, shop* r2);
void set(shop* r);

int main(void){
    int N = 0, i = 0, j = 0, k = 0;
    shop rst[100];

    scanf("%d", &N);

    for(i = 0; i < N; i++){
        for(k = 0; k < 11; k++){
            rst[i].name[k] = 'a';
        }
        rst[i].pnt = 0;
        rst[i].in = 0;
        rst[i].rank = 0;
    }

    for(i = 0; i < N; i++){
        scanf("%s", rst[i].name);
        scanf("%d", &(rst[i].pnt));
        rst[i].in = i;
        rst[i].rank = i;
    }

    for(i = 0; i < N; i++){
        for(j = i+1; j < N; j++){
            swap(&rst[i], &rst[j]);
        }
    }

    for(i = 0; i < N; i++){
        for(j = i+1; j < N; j++){
            swappnt(&rst[i], &rst[j]);
        }
    }

    for(i = 0; i < N; i++){
        printf("%d\n", rst[i].in+1);
    }

    return 0;
}

void swappnt(shop* r1, shop* r2){
    char tmp[11];
    int i = 0;

    for(i = 0; i < 11; i++){
        tmp[i] = 'a';
    }

    for(i = 0; i < 11; i++){
        if(r1->name[i] == '\000' && r2->name[i] == '\000'){
            break;
        }
        if(r1->name[i] != r2->name[i]){
            return;
        }
    }
    if(r1->pnt < r2->pnt){
        strcpy(tmp, r1->name);
        strcpy(r1->name, r2->name);
        strcpy(r2->name, tmp);
        swapnum(&r1->pnt, &r2->pnt);
        swapnum(&r1->in, &r2->in);
        set(r1);
        set(r2);
    }
}

void swap(shop* r1, shop* r2){
    char tmp[11];
    int i = 0;

    for(i = 0; i < 11; i++){
        tmp[i] = 'a';
    }

    for(i = 0; i < 11; i++){
        if(r1->name[i] > r2->name[i]){
            strcpy(tmp, r1->name);
            strcpy(r1->name, r2->name);
            strcpy(r2->name, tmp);
            swapnum(&r1->pnt, &r2->pnt);
            swapnum(&r1->in, &r2->in);
            set(r1);
            set(r2);
            break;
        }
        if(r1->name[i] < r2->name[i]){
            break;
        }
    }
}

void swapnum(int *num1, int *num2){
    int temp = 0;
    temp = *num1;
    *num1 = *num2;
    *num2 = temp;
}

void set(shop* r){
    int flg = 0;
    int i = 0;
    for(i = 0; i < 11; i++){
        if(flg == 1){
            r->name[i] = 'a';
        }
        if(r->name[i] == '\000'){
            flg = 1;
        }
        
    }
}

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

int main() {
    int N; cin >> N;
    int ans = 0;
    int V[N], C[N];
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> C[i];
    }
    for (int i = 0; i < N; i++){
        int diff = V[i] - C[i];
        if (diff > 0) {
            ans += diff;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#include <sstream>
#define ll long long
using namespace std;
// ver..(1.1)
string ent="\n";
string space=" ";
int main(){
   ios_base::sync_with_stdio(false);
   int n;
   string s,t;

   cin >> n >> s >> t;
   for(int i=0;i<n;i++){
      cout << s[i] << t[i];
   }   
   cout << ent;
}
/*


*/

Measured memory_bytes: 256
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

vector<ll> dp;
vector<ll> h;
ll N;
ll res(ll i)
{
    if (dp[i] != -1)
    {
        return dp[i];
    }

    ll ret;
    if (i >= 2)
    {
        ret = min(res(i - 1) + abs(h[i - 1] - h[i]), res(i - 2) + abs(h[i - 2] - h[i]));
    }
    else if (i >= 1)
    {
        ret = res(i - 1) + abs(h[i - 1] - h[i]);
    }
    else
    {
        ret = 0;
    }

    return dp[i] = ret;
}

void solve()
{
    cin >> N;
    h = vector<ll>(N);
    dp = vector<ll>(N, -1);
    for (ll i = 0; i < N; i++)
        cin >> h[i];

    cout << res(N - 1) << endl;
    return;
}

int main()
{
    solve();
    return 0;
}


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

using namespace std;

bool dp[100010][2];

int main()
{
    int n, k, a[100010];

    cin >> n >> k;

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

    sort(a, a+n);

    dp[0][0] = false;
    dp[0][1] = true;

    for (int i = 1; i <= k; i++)
    {
        dp[i][0] = false;
        dp[i][1] = true;
    }

    for (int i = 1; i <= k; i++)
    {
        bool x = false;
        bool y = true;

        for (int j = 0; j < n; j++)
        {
            if (a[j] > i)
                continue;

            x = x || dp[i-a[j]][1];
            y = y && dp[i-a[j]][0];
        }

        dp[i][0] = x;
        dp[i][1] = y;
    }

    // for (int i = 0; i <= k; i++)
    // {
    //     cout << dp[i][0] << " " << dp[i][1] << "\n";
    // }

    if (dp[k][0])
        cout << "First" << "\n";
    else
        cout << "Second" << "\n";

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void){
	int N,temp,count,ans=1;
	int maxcount = 0;
	int i;
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		temp = i;
		count = 0;
		while(temp%2==0){
			temp /=2;
			count ++;
		}
		if(maxcount<count){
			maxcount = count;
			ans = i;
		}
	}
	printf("%d",ans);
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int>a(n);

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

    sort(a.begin(), a.end());
    int alice, bob;
    alice = 0;
    bob = 0;

    for(int i = n-1; i >= 0; i-=2) {
        alice += a[i];
        if(i-1 < 0){
            break;
        }
        else{
             bob += a[i-1];
        }
    }
    cout << alice - bob << endl;

    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
//cin.tie(0);
//ios::sync_with_stdio(false);
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	//andが0
	llint i,j,n,ans=0;cin>>n;
	vector<int>a(n);
	for(i=0;i<n;i++){cin>>a[i];}
	int sya[20]={0};
	int hi=0;
	for(i=0;i<n;i++){
		for(j=0;j<20;j++){
			if(a[i]&(1<<j)){sya[j]++;}
		}
		
		while(-1){
			bool ok=true;
			for(j=0;j<20;j++){
				if(sya[j]>1){ok=false;break;}
			}
			if(ok){break;}
			for(j=0;j<20;j++){
				if(a[hi]&(1<<j)){sya[j]--;}
			}
			hi++;
		}
		ans+=i+1-hi;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int h, w;
    cin >> h >> w;
    char field[h+2][w+2];
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w + 2; j++){
            if(i == 0 || i == (h+1) || j == 0 || j == (w + 1)){
                field[i][j] = '#';
            } else {
                char c;
                cin >> c;
                field[i][j] = c;
            }
        }
    }
    for(int i = 0; i < h+2; i++){
        for(int j = 0; j < w + 2; j++){
            cout << field[i][j];
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  cout<<a.at(n/2)-a.at(n/2-1)<<endl;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	static int max=100001;	//nCr の n の最大値?
	static long MOD=1000000007;
	static long[] fac=new long[max];
	static long[] finv=new long[max];
	static long[] inv=new long[max];
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		COMinit();
		int N=sc.nextInt();
		int K=sc.nextInt();
		for(int i=1; i<=K; i++) {
			long sentaku=COM(N-K+1,i);//赤を固定して考える
			long ao=COM(K-1,i-1);
			pl(sentaku*ao%MOD);
		}

	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static void COMinit() {		//テーブルを作るみたい nCrの　または　階乗の？
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < max; i++){
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[(int)(MOD%i)] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}
	static long COM(int n, int k){			//二項係数の計算
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}
}

Measured memory_bytes: 23508
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define FORR(i,a,b) for (int i = a; i > b; i--)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
    int w, h, n;
    bool area[100][100];
    REP(i,100){
        REP(j,100){
            area[i][j] = false;//白
        }
    }
    cin >> w >> h >> n;
    
    REP(k,n){
        int x, y, a;
        cin >> x >> y >> a;
        switch(a){
            case 1:
                for(int i = 0; i < x; i++){
                    for(int j = 0; j < h; j++){
                        area[i][j] = true;
                    }
                }
                break;
            case 2:
                for(int i = x; i < w; i++){
                    for(int j = 0; j < h; j++){
                        area[i][j] = true;
                    }
                }
                break;
            case 3:
                for(int i = 0; i < w; i++){
                    for(int j = 0; j < y; j++){
                        area[i][j] = true;
                    }
                }
                break;
            case 4:
                for(int i = 0; i < w; i++){
                    for(int j = y; j < h; j++){
                        area[i][j] = true;
                    }
                }
                break;
        }
    }
    
    
    int ans = 0;
    REP(i,w){
        REP(j,h){
            if(!area[i][j]) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}










Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
signed main(){
    int N; std::cin >> N;
    std::vector<std::vector<int>>edge(N);
    for(int i = 0; i < N - 1; ++i){
        int a,b; std::cin >> a >> b;
        --a,--b;
        edge[b].push_back(a); edge[a].push_back(b);
    }
    std::vector<ll>c(N);
    std::priority_queue<ll,std::vector<ll>>que;
    std::vector<bool>used(N,false);
    std::vector<ll>ans(N,0LL);
    for(auto & e : c) std::cin >> e;
    for(auto e : c) que.push(e);
    std::function<void(int)> dfs = [&](int v){
        used[v] = true;
        for(auto nv : edge[v]){
            if(used[nv]) continue;
            ans[nv] = que.top();
            que.pop();
            dfs(nv);
        }
        return;
    };
    ans[0] = que.top(); que.pop();
    dfs(0);
    int sum = 0;
    for(int from = 0; from < N; ++from){
        for(auto to : edge[from]){
            if(from < to) continue;
            sum += std::min(ans[from],ans[to]);
        }
    }
    std::cout << sum << std::endl;
    for(int i = 0; i < ans.size(); ++i){
        if(i) std::cout << " ";
        std::cout << ans[i];
    }
    std::cout << std::endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#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()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<ll>> v(N, vector<ll>(3));
    rep(i, N) {
        rep(j, 3) { cin >> v[i][j]; }
    }

    ll ans = 0;

    for (int bit = 0; bit < (1 << 3); bit++) {
        vector<int> a;
        for (int j = 0; j < 3; j++) {
            if (bit & (1 << j))
                a.push_back(j);
        }

        vector<vector<ll>> copy = v;
        vector<ll> can;
        ll tmp = 0;

        rep(i, N) {
            ll c = 0;
            rep(j, 3) {
                if (count(all(a), j) == 0)
                    c += v[i][j];
                else
                    c -= v[i][j];
            }
            can.push_back(c);
        }

        sort(all(can), greater<ll>());
        for (int i = 0; i < M; i++) {
            tmp += can[i];
        }

        ans = max(ans, tmp);
    }

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

Measured memory_bytes: 3736
let x = read_int ()
let f n = if n <= 1 then false else let rec f i = if i * i > n then true else if n mod i = 0 then false else f @@ i + 1 in f 2
let _ = for i = x to 100003 do if f i then (Printf.printf "%d\n" i; exit 0) done

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, t) for(int i = 0; i < t; i++)

bool jdg(bool i)
{
    if (i) return true;
    else return false;
}

int x[110], y[110], a[110];
bool db[110][110] = {0};
int main()
{
    int W, H, N;
    cin >> W >> H >> N;
    REP(i, N) cin >> x[i] >> y[i] >> a[i];
    REP(h, H) fill(&db[h][0], &db[h][W], 1);

    int pos[4];
    REP(i, N)
    {
        switch(a[i])
        {
            case 1:
                pos[0] = 0, pos[1] = 0;
                pos[2] = H, pos[3] = x[i];
                break;
            case 2:
                pos[0] = 0, pos[1] = x[i];
                pos[2] = H, pos[3] = W;
                break;
            case 3:
                pos[0] = 0, pos[1] = 0;
                pos[2] = y[i], pos[3] = W;
                break;
            case 4:
                pos[0] = y[i], pos[1] = 0;
                pos[2] = H, pos[3] = W;
                break;
        }
    
        for(int i = pos[0]; i < pos[2]; i++) fill(&db[i][pos[1]], &db[i][pos[3]], 0);
    }

    cout << count_if(&db[0][0], &db[H][W], jdg) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,r;
	int ans=0;
	cin >>n>>r;
	if(n <=10){
		ans=r+100*(10-n);
		//r=100*(10-k)
		//
	}else{
		ans=r;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
S = input()
p = int(S[0:2])
s = int(S[2:4])

if 1 <= p and p <= 12:#?
    if 1<= s and s<=12:#??
        print("AMBIGUOUS")
    else:#?Y
        print("MMYY")

else:
    if 1<= s and s<=12:#Y?
        print("YYMM")
    else:#YY
        print("NA")


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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof (a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 100005;

int n, m;
int dat[N], pos[N];
int par[N], setsize[N];
vi members[N];

int findset(int x) {
	return (par[x] == x ? x : par[x] = findset(par[x]));
}

void uni(int a, int b) {
	int x = findset(a), y = findset(b);
	if (x == y) return;
	if (setsize[x] < setsize[y]) swap(x, y);
	par[y] = x;
	setsize[x] += setsize[y];
	for (int z : members[y]) members[x].push_back(z);
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &dat[i]);
		pos[dat[i]] = i;
		par[i] = i;
		setsize[i] = 1;
		members[i].push_back(i);
	}

	for (int i = 1; i <= m; ++i) {
		int u, v; scanf("%d %d", &u, &v);
		uni(u, v);
	}

	for (int i = 1; i <= n; ++i) {
		if (findset(i) != i) continue;
		sort(all(members[i]));
	}

	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		int root = findset(i);
		if (binary_search(all(members[root]), pos[i])) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 11000
#include "bits/stdc++.h"

using namespace std;
using ll=long long;
using ull=unsigned long long;

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

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define double long double

int n,a,b,c;

void input(){
	cin>>n>>a>>b>>c;
	return;
}

void solve(){
	cout<<n-(a+b-c)<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}


Measured memory_bytes: 3096
import math

a,b,x = input().split()
a = int(a)
b = int(b)
x = int(x)

def main(a,b,x):
    if ((a**2*b)-x) != 0:
        if x > a**2*b/2:
            y = (a ** 3)/(2*((a**2*b)-x))
            θ = math.atan(y)
            result = math.degrees(math.pi/2-θ)

        else:
            y = 2*x/(a*b**2)
            θ = math.atan(y)
            result = math.degrees(math.pi/2-θ)

        return result    
    else:
        return 0

print(main(a,b,x))


Measured memory_bytes: 3316
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length()
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
    def lower_bound(self, x):
        """ 累積和がx以上になる最小のindexと、その直前までの累積和 """
        sum_ = 0
        pos = 0
        for i in range(self.depth, -1, -1):
            k = pos + (1 << i)
            if k <= self.size and sum_ + self.tree[k] < x:
                sum_ += self.tree[k]
                pos += 1 << i
        return pos + 1
  
def compress(list1):
    list2 = sorted(set(list1))
    memo = {value : index for index, value in enumerate(list2)}
    return memo, len(list2)

q = int(readline())
L = [list(map(int,readline().split())) for i in range(q)]
 
#座圧する
chk = []
for i in range(q):
    if L[i][0] == 1:
        chk.append(L[i][1])
        
memo, len_memo = compress(chk)
memo_inv = dict([(v,k) for k,v in memo.items()])

#値を管理するBIT
bit = Bit(len_memo)
#要素数を管理するBIT
num = Bit(len_memo)
  
s = 0
cnt = 0
for i in range(q):
  que = L[i]
  if que[0] == 1:
    a,b,c = que
    s += c
    cnt += 1
    bit.add(memo[b]+1,b)
    num.add(memo[b]+1,1)
  else:
    d = num.lower_bound((cnt+1)//2)
    m = memo_inv[d-1]
    sum1 = bit.sum(d)
    num1 = num.sum(d)
    sum2 = bit.sum(len_memo)-bit.sum(d)
    num2 = num.sum(len_memo)-num.sum(d)
    print(m,abs(num1*m-sum1)+abs(num2*m-sum2)+s)

Measured memory_bytes: 109140
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	h, w, a, b := io.NextInt(), io.NextInt(), io.NextInt(), io.NextInt()
	for dh := 0; dh < h; dh++ {
		line := ""
		for dw := 0; dw < w; dw++ {
			if dw < a {
				if dh < b {
					line += "1"
				} else {
					line += "0"
				}
			} else {
				if dh < b {
					line += "0"
				} else {
					line += "1"
				}
			}
		}
		fmt.Println(line)
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 14080
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const int mod=1e9+7;
//LL powmod(LL a,LL b) {LL res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
LL a[55];
int main(){
//    freopen("out.txt","r",stdin);
//    freopen("outt.txt","w",stdout);
    LL k;
    cin>>k;
    LL n=k/50;
    k%=50;
    a[1]=49+n+k*50;
    for(int i=1;i<=50;i++) a[i]=49+n;
    for(int j=1;j<=k;j++){
        for(int i=1;i<=50;i++){
            if(i==j) a[i]+=50;
            else a[i]--;
        }
    }
    puts("50");
    for(int i=1;i<=50;i++) cout<<a[i]<<" ";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t;scanf("%d%d",&n,&t);
    vector<pair<int,int>> a(n);
    for(int i=0;i<n;i++)scanf("%d%d",&a[i].first,&a[i].second);
    sort(a.begin(),a.end());
    vector<vector<int>> dp(n,vector<int>(t));
    for(int i=0;i<n-1;i++){
        for(int j=0;j<t;j++){
            if(j<a[i].first)dp[i+1][j]=dp[i][j];
            else dp[i+1][j]=max(dp[i][j],dp[i][j-a[i].first]+a[i].second);
        }
    }
    int ans=0;
    for(int i=0;i<n;i++)ans=max(ans,dp[i][t-1]+a[i].second);
    printf("%d\n",ans);
}

Measured memory_bytes: 35584
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();
        int all = 0;
        for (int i = 0; i < n; i++) all += sc.nextInt();
        if (h <= all) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 49164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double PI=3.14159265358979323846;

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

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

int main(){
  int n; cin >> n;
  int val[n];
  for(int i = 0; i < n; i++) cin >> val[i];
  sort(val, val+n);
  double ans = val[0];
  for(int i = 0; i < n-1; i++){
    ans = (double)(ans + val[i+1]) / 2;
  }
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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);

    ll x, y; cin >> x >> y;
    ll ans = 1e18;
    for(int i = 0; i < 4; i++) {
        ll tmp = 1e18;
        int cnt = 0;
        ll nx = x;
        ll ny = y;
        if(i & 2) {nx *= -1; cnt++;}
        if(i & 1) {ny *= -1; cnt++;}
        if(nx <= ny) tmp = ny - nx;
        ans = min(ans, tmp + cnt);
    }
    cout << ans << endl;
}


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

int main(){
    int N;
    cin >> N;
    long long temp = 0;
    long long ans = 0;
    for(int i = 0; i < N; i++){ 
        long long a;
        cin >> a;
        if(a >= temp) temp = a;
        else ans += temp - a;
    }
    cout << ans << endl;   
}

Measured memory_bytes: 3600
N,K=map(int,input().split())
point=[tuple(map(int,input().split())) for i in range(N)]
point.sort(key=lambda x:x[0])
ans=float('inf')
for i in range(1+N-K):
    for j in range(i+K,N+1):
        x=point[j-1][0]-point[i][0]
        now=point[i:j]
        now.sort(key=lambda x:x[1])
        for k in range(j-i-K+1):
            ans=min(x*(now[k+K-1][1]-now[k][1]),ans)
print(ans)

Measured memory_bytes: 3064
import math
s = int(input())
n = 1
ans = 0
while s - (n * 3) >= 0:
    val = s - n * 3
    bar = n - 1
    ans +=math.factorial(val + bar) // (math.factorial(val) * math.factorial(bar))
    n +=1
print(ans % (10 ** 9 + 7))

Measured memory_bytes: 79616