akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String[] s = new String[n];
		for(int i=0; i<n; i++) {
			s[i] = sc.next();
		}

		int m = sc.nextInt();
		String[] t = new String[m];
		for(int i=0; i<m; i++) {
			t[i] = sc.next();
		}

		int max=0;

		for (int i = 0; i < n; i++) {
			int count =0;
			for(int j = 0; j<n; j++) {
				if(s[i].equals(s[j])) {
					count++;
				}
			}

			for(int j = 0; j<m; j++) {
				if(s[i].equals(t[j])) {
					count--;
				}
			}

			if(count >= max) {
				max = count;
			}
		}

		System.out.println(Math.max(0, max));

	}
}

Measured memory_bytes: 21844
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

set<string> c(string a)
{
	set<string>aa;
	for(int i=0;i<a.length();i++)
		aa.insert(a.substr(i,1));
	return aa;
}


int ch(string a,string b)
{
	int r=0;
	set<string>aa,bb;
	aa=c(a);
	bb=c(b);
	for(auto i=aa.begin();i!=aa.end();i++)
	{
		if(bb.find(*i)!=bb.end())
			r++;
	}
	return r;
}

int main()
{
	int N,r=0;
	string S;
	cin>>N>>S;

	for(int i=1;i<N;i++)
	{
		int p=ch(S.substr(0,i),S.substr(i,N-i));
		r=max(r,p);
	}
	cout<<r<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int h, a;
  cin >> h >> a;
  int ans = h / a;
  if(h%a != 0) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3576
""" AtCoder """

N = int(input())

ans = 0

for i in range(1, N+1):
    if i%2 == 1:
        count = 0
        for j in range(1, i+1):
            if i%j == 0:
                count += 1
        if count == 8:
            ans += 1

print(ans)


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
  
  
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] data = in.readLine().split(" ");
        int[] num = new int[6];
        for(int i=0; i<6; i++){
            num[i] = Integer.parseInt(data[i]);
        }
        Dices dice = new Dices(num[0],num[1],num[2],num[3],num[4],num[5]);
        String order = in.readLine();
        char[] chOrder = order.toCharArray();
        for(int j=0; j<order.length(); j++){
            if(chOrder[j]=='N'){
                dice.north();
            } else if(chOrder[j]=='E'){
                dice.east();
            } else if(chOrder[j]=='W'){
                dice.west();
            } else if(chOrder[j]=='S'){
                dice.south();
            }
        }
        System.out.println(dice.on);
    }
}
  
class Dices{
    public int on, tw, th, fo, fi, si;
    public Dices(int on, int tw, int th, int fo, int fi, int si){
        this.on = on;
        this.tw = tw;
        this.th = th;
        this.fo = fo;
        this.fi = fi;
        this.si = si;
    }
    void north(){
        int temp = on;
        on = tw;
        tw = si;
        si = fi;
        fi = temp;
    }
    void east(){
        int temp = on;
        on = fo;
        fo = si;
        si = th;
        th = temp;
    }
    void west(){
        int temp = on;
        on = th;
        th = si;
        si = fo;
        fo = temp;
    }
    void south(){
        int temp = on;
        on = fi;
        fi = si;
        si = tw;
        tw = temp;
    }
}

Measured memory_bytes: 24384
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var X = int.Parse(input[0]);
        var Y = int.Parse(input[1]);

        var result = "No";
        for(int i = 0; i <= X; i++)
        {
            var turu = i;
            var kame = X - i;

            if ((turu * 2 + kame * 4) == Y)
            {
                result = "Yes";
                break;
            }
        }

        Console.WriteLine(result);

    }
}


Measured memory_bytes: 27512
#include<bits/stdc++.h>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
  int N; cin>>N;
  vector<int> vec (N,0);
  int flg = 0;
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
     if(vec[i] < 0)flg ^= 1;
     vec[i] = abs(vec[i]);
  }
  sort(ALL(vec));
  if(flg == 1)
  vec[0] *= -1;
  int res = 0;
  for (int i = 0; i < N; i++)
  {
    res += vec[i];
  }
  cout<<res<<endl;
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
ll N,M,sum,ans;
vector<P> V;

void init(){
  V.clear();
  sum = ans = 0;
}

int main(){

  while(cin >> N >> M && N+M){
    init();

    for(int i = 0; i < N; i++){
      P p;
      cin >> p.second >> p.first;
      V.push_back(p);
      sum += p.second;
    }

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

    sum = max(0LL,sum-M);

    for(int i = 0; i < V.size(); i++){
      if(V[i].second > sum){
	ans += sum*V[i].first;
	break;
      }else{
	ans += V[i].first*V[i].second;
	sum -= V[i].second;
      }
    }

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

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

vector< int64_t > divisor(int64_t n) {
    vector< int64_t > ret;
    for(int64_t i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
sort(begin(ret), end(ret));
return (ret);
}

int main() {
    int n;
    cin>>n;
    int ans=0;
    rep(i,n){
        if ((i+1)%2==0){
            continue;
        }
        auto d=divisor(i+1);
        if (d.size()==8){
            ans+=1;
        }

    }
    cout<<ans<<endl;

    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
using namespace std;
int main()
{
    string s;
    cin >> s;
    s[0] = '2';
    s[1] = '0';
    s[2] = '1';
    s[3] = '8';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

vector<int> graph[200001];

int main()
{
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i)
  {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  for (int i = 0; i < graph[1].size(); ++i)
  {
    int itr = graph[1][i];
    for (int j = 0; j < graph[itr].size(); ++j)
    {
      if (graph[itr][j] == n)
      {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 12016
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a-1)/b+1;}
//Read:
//Use __builtin_popcountll for ll

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

Measured memory_bytes: 3648
import fractions;
n = int(input());
a = input().split(" ");
for i in range(n) :
	a[i] = int(a[i]);

a.insert(0,0);
l = [0]*(n+1);	
r = [0]*(n+2);

l[0] = a[0];
r[n] = a[n];
for i in range(1,n+1) :
	l[i] = fractions.gcd(a[i],l[i-1]);
	r[n-i] = fractions.gcd(a[n-i],r[n-i+1]);


mxgcd = 0;
for i in range(1,n+1) :
	gcd_now = fractions.gcd(l[i-1],r[i+1]);
	if gcd_now > mxgcd :
		mxgcd = gcd_now;
	
print(mxgcd);

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

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) { // n が 0 になるまで
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N;
    cin >> N;
    if(N % findSumOfDigits(N) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end(),greater<int>())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007 //1000000000000000003
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int N,K;
  cin>>N>>K;

  vector<int> a;

  rep(i,N){
    int aa;
    cin>>aa;
    a.emplace_back(aa);
  }

  SORT(a);

  int ans=0;
  rep(i,K){
    ans+=a[i];
  }

  cout<< ans<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
N, L = map(int, input().split())

m = abs(L)+abs(N)
j = 0
for i in range(N):
    if abs(L+i) < m:
        m = min(abs(L+i), m)
        j = i

t = 0
for i in range(N):
    if i != j:
        t += L+i

print(t)


Measured memory_bytes: 3060
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        
        int[][][] room = new int[5][4][11];
        
        //初期化
        for(int b1=0; b1<5; b1++){
            for(int f1=0; f1<4; f1++){
                for(int r1=0; r1<11; r1++){
                    room[b1][f1][r1] = 0;
                }
            }
        }
        
        //b f r v
        //b棟f階のr番目の部屋にv人が追加で入居
        for(int i = 0; i < n; i++){
            int b = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int v = sc.nextInt();
            
            room[b][f][r] += v;
        }
        
        for(int b1=1; b1<5; b1++){
            for(int f1=1; f1<4; f1++){
                for(int r1=1; r1<11; r1++){
                    System.out.printf(" " + room[b1][f1][r1]);
                }
                System.out.printf("\n");
            }
            if(b1 != 4){
        		System.out.println("####################");
        	}
        }
    }
}


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

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

    map<char,char> m;
    m['A'] = 'T';
    m['T'] = 'A';
    m['C'] = 'G';
    m['G'] = 'C';

    char b;
    cin >> b;
    cout << m[b] << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
//#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll& a, const pll& b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i * i <= n; ++i)
	{
		if (n % i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i * i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}
ll nCr(ll n, ll r);//コンビネーション
int permutation(int n, int r);//nPk パーミュテーション
int factorial(int k);//階乗

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	//priority_queue<int> q;
	string s = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	ll x[100005] = {};
	ll y[100005] = {};
	//ll z[302][302] = {};
	cin >> a;
	cin >> b;
	cin >> c;
	if ((a==b&&b==c)||(a!=b&&b!=c&&a!=c))
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;

	}


	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}

int permutation(int n, int r) {
	int n_sum, r_sum;
	int i;
	r = n - r;
	n_sum = factorial(n);
	r_sum = factorial(r);
	return n_sum / r_sum;
}

ll nCr(ll n, ll r) {
	ll ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int factorial(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

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

int main() {
  vector<bool> primes;
  vector<int> primes2;
  int n, count;
  cin >> n;
  for (int i=0; i<=55555; i++) primes.push_back(true);
  primes[0] = false;
  primes[1] = false;
  for (int i=2; i<=55555; i++) {
    if (!primes[i]) continue;
    primes2.push_back(i);
    for (int j=i+i; j<=55555; j+=i) primes[j] = false;
  }
  for (auto i : primes2) {
    if (i%5==1) {
      cout << i << ' ';
      count++;
    }
    if (count==n) break;
  }
  return 0;
}

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

using namespace  std;

typedef long long ll;

const int mx = 100000+5;
ll dp[mx];
int w[mx], v[mx];
int main() {
    int N, W;
    int V = 0 ;
    scanf("%d%d",&N, &W);
    for(int i = 0 ;i < N; ++i){
        scanf("%d%d",&w[i],&v[i]);
        V += v[i];
    }

    memset(dp,0x3f3f3f3f, sizeof(dp));
    dp[0] = 0;

    for(int i = 0; i < N; ++i){
        for(int j = V; j >= v[i]; --j){
            dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
        }
    }
    for(int i = V; i >= 0 ; --i)
        if(dp[i] <= W){
            printf("%d\n",i);
            break;
        }
    return 0;
}

Measured memory_bytes: 4596
#include<iostream>

using namespace std;

//８００円のランチ
//１５食ごとに２００円のキャッシュバック
//食べた数 N が与えられる
//払った金額 x ともらった金額 y の差 x-y を求める

int calcReCush(int N){

    int hoge = 15;
    int reCush = 200;
    
    return (N / hoge) * reCush;
}

int main(void){

    int N;
    cin >> N;

    int LunchPrice = 800;
    int x = LunchPrice * N;
    int y = calcReCush(N);

    cout << x - y << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((int)(a).size())
 
template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcountll(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-6
typedef pair<int, int> II;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI 2 * acos(0)
#define maxn 100005

int n,k,s;

void sol(){
  cin >> n >> k >> s;
  For(i, 1, k) cout << s << " ";
  For(i, k + 1, n){
    if(s > 1000000) cout << s - 1;
    else cout << s + 1;
    if(i == n) cout << endl;
    else cout << " ";
  }

}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  sol();
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (ll i = 0; i < n; i++)
#define forr(i,a,b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const ll MX = 150005;
const ll inf = 2e18;
ll f(ll valor,vector<ll> &v1)
{

    ll tot=0;
    
    forr(i,0,v1.size())
    {
        ll aval=abs(v1[i]);
        auto it=upper_bound(v1.begin(),v1.end(),valor/aval);
        if (it!=v1.begin())it--;
        if (aval*(*it)>valor)continue;
        ll pos=it-v1.begin();
        //cout<<i<<" "<<aval<<" "<<pos<<" "<<aval*(*it)<<endl ;
        if (pos<=i)
            continue;
        tot+=pos-i;
    }   
    
    return tot;
}
void go(vector<ll> neg,vector<ll> pos,ll k)
{
    forr(i,0,neg.size())
    neg[i]=-neg[i];
    sort(all(neg));
    ll iz=0,der=2e18,mid;
    /*cout<<k<<endl;
    cout<<f(der,neg)+f(der,pos)<<" "<<f(448283280358331000,neg)+f(448283280358331000,pos)<<' '<<endl;*/
    //return ;
    while(iz+1<der)
    {
        mid=(iz+der)/2;
        if (f(mid,neg)+f(mid,pos)>=k)
            der=mid;
        else
            iz=mid;
    }

    cout<<der<<endl;
}
ll ceil(ll a,ll b)
{
    return (abs(a)+abs(b)-1)/(abs(b));
}
ll f2(ll valor,vector<ll> &neg,vector<ll> &pos)
{
    ll tot=0;
    forr(i,0,neg.size())
    {
        ll aval=neg[i];
        auto it=lower_bound(pos.begin(),pos.end(),ceil(valor,aval));
        tot+=pos.end()-it;
    }
    return tot;
}
void go2(vector<ll> neg,vector<ll> pos,ll k)
{
    ll iz=-inf,der=0,mid;
    /*cout<<k<<endl;
    cout<<f(der,neg)+f(der,pos)<<" "<<f(448283280358331000,neg)+f(448283280358331000,pos)<<' '<<endl;*/
    //return ;
    //cout<<f2(-21,neg,pos)<<' '<<f2(-22,neg,pos)<<endl;
    while(iz+1<der)
    {
        mid=(iz+der)/2;
        if (f2(mid,neg,pos)>=k)
            der=mid;
        else
            iz=mid;
    }
    cout<<der<<endl;
}
int main () 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    bool no=0;
    ll n,k;
    cin>>n>>k;
    ll num,ceros=0;
    vector<ll> pos,neg;
    forr(i,0,n)
    {
        cin>>num;
        if (num==0)
            ceros++;
        else
        {
            if (num>0)
                pos.pb(num);
            else
                neg.pb(num);
        }
    }
    sort(neg.begin(),neg.end());
    sort(pos.begin(),pos.end());
    ll N=neg.size(),M=pos.size();
    if (k<=N*M)
    {
        go2(neg,pos,k);
        return 0;
    }
    k-=N*M;
    //cout<<neg.size()<<' '<<pos.size()<<" "<<k<<' '<<ceros<<endl;
    forr(i,0,ceros)
    {
        k-=(n-1-i);
    }
    if (k<=0)
    {
        cout<<0<<endl;
        return 0;
    }
    //cout<<k<<endl;
    go(neg,pos,k);
}


Measured memory_bytes: 3308
function Main(input) {
  input = input.trim().split('\n');
  H = Number(input[0].split(' ')[0]);
  M = input.slice(1).map(v => v.split(' ').map(Number));

  dp = Array(H + 1).fill(Infinity);
  dp[0] = 0;
  M.forEach(item => {
    for (i = 0; i <= H; i++) {
      targetPointIndex = Math.min(i + item[0], H);
      dp[targetPointIndex] = Math.min(dp[targetPointIndex], dp[i] + item[1]);
    }
  });
  console.log(dp[H]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

typedef pair<long,long> P;
int main(){
  long h,w,n;
  cin >> h >> w >> n;
  map<P,bool> used;
  map<P,int> num;
  long a[n],b[n];
  for(long i = 0;i < n;i++){
    cin >> a[i] >> b[i];
  }
  vector<long> kekka(10);
  for(long i = 0;i < n;i++){
    for(long j = -1;j <= 1;j++){
      for(long k = -1;k <= 1;k++){
        if(a[i]+j > 1 && a[i]+j < h && b[i]+k > 1 && b[i]+k < w){ 
          num[P(a[i]+j,b[i]+k)]++;
        }
      }
    }
  }
  for(long i = 0;i < n;i++){
    for(long j = -1;j <= 1;j++){
      for(long k = -1;k <= 1;k++){
        if(a[i]+j > 1 && a[i]+j < h && b[i]+k > 1 && b[i]+k < w && used[{a[i]+j,b[i]+k}] == false){
          kekka.at(num[P(a[i]+j,b[i]+k)])++;
          used[{a[i]+j,b[i]+k}] = true;
          //cout << a[i]+j << ' ' << b[i]+k << endl;
          //cout << num[P(a[i]+j,b[i]+k)] << endl;
        }
      }
    }
  }
  long x = 0;
  for(int i = 1;i <= 9;i++){
    x += kekka.at(i);
  }
  kekka.at(0) = (h-2)*(w-2) - x;
  for(int i = 0;i <= 9;i++){
    cout << kekka.at(i) << endl;
  }
}

Measured memory_bytes: 114304
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){

	float a,b,c,d,e,f,g;
	while(cin>> a>> b>> c>> d>> e>> f){
		float x = (1.0/(a*e-b*d)) * (e*c - b*f);
		float y = (1.0/(a*e-b*d)) * (-c*d + a*f);
		if(-0.001<x && x<=0) x = 0;
		if(-0.001<y && y<=0) y = 0;
		printf("%.3f %.3f",x, y);
		printf("\n");
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

 

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll A;
  ll B;
  ll Q;
	cin >> A;
  cin >> B;
 	cin >> Q;
  


  vector <ll> shrines(A);
  vector <ll> temples(B);
  
	for ( int x=0; x<A;x++) {
    cin >> shrines[x];
  }

	for ( int x=0; x<B;x++) {
    cin >> temples[x];
  }
 
  for (int z=0;z<Q;z++) {
    ll answer = LLONG_MAX;
    ll distance1 = 0;
    ll distance2 = 0;
    ll distance3 = 0;
    ll distance4 = 0;
    ll a;
    cin >> a;
    auto shr1 = lower_bound(shrines.begin() , shrines.end(), a);
    auto temp1 = lower_bound(temples.begin() , temples.end(), a);
    if (shr1 != shrines.end() && temp1 != temples.end()){
      if(*(shr1)<*(temp1)) {
        distance1+= *(shr1)-a;
        distance1+= *(temp1)-*(shr1);
        answer = min(answer,distance1);
      }
      else {
        distance1+= *(temp1)-a;
        distance1+= *(shr1)-*(temp1);
        answer = min(answer,distance1);
      } 
    }
    
    auto shr2 = lower_bound(shrines.begin() , shrines.end(), a);
    auto temp2 = lower_bound(temples.begin() , temples.end(), a);
    
    if (shr2 != shrines.end() && temp2 != temples.begin()){
      distance2+= *(shr2)-a;
      distance2+= *(shr2)-*(temp2-1);
      answer = min(answer,distance2);
    }
    distance2 = 0;

    if (temp2 != temples.end() && shr2 != shrines.begin()){
      distance2+= *(temp2)-a;
      distance2+= *(temp2)-*(shr2-1);
      answer = min(answer,distance2);
    }
    auto shr3 = lower_bound(shrines.begin() , shrines.end(), a);
    auto temp3 = lower_bound(temples.begin() , temples.end(), a);
    if (shr3 != shrines.begin() && temp3 != temples.begin()){
      if(*(shr3-1)>*(temp3-1)){
        distance3+= a-*(shr3-1);
        distance3+= *(shr3-1)-*(temp3-1);
        answer = min(answer,distance3);
      }
      else {
        distance3+= a-*(temp3-1);
        distance3+= *(temp3-1)-*(shr3-1);
        answer = min(answer,distance3);
      }  
    }

    auto shr4 = lower_bound(shrines.begin() , shrines.end(), a);
    auto temp4 = lower_bound(temples.begin() , temples.end(), a);
    if (shr4 != shrines.begin() && temp4 != temples.end()){
      distance4+= a-*(shr4-1);
      distance4+= *(temp4)-*(shr4-1);
      answer = min(answer,distance4);
    }
    distance4 = 0;

    if (temp4 != temples.begin() && shr4 != shrines.end()){
      distance4+= a-*(temp4-1);
      distance4+= *(shr4)-*(temp4-1);
      answer = min(answer,distance4);
    }
    cout << answer << endl;
  }
 cin >> A;
}


Measured memory_bytes: 2944
N = int(input())
nt, nx, ny = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-nx) + abs(y-ny) > t - nt or (t - nt) % 2 != (x-nx + y-ny) % 2:
        print('No')
        exit()
    nt, nx, ny = t, x, y
print('Yes')

Measured memory_bytes: 3064
#include <iostream>

int main() {
    int N, K;
    std::cin >> N >> K;
    int has_food[N], d, idx, total = 0;

    for (int i = 0; i < N; i++) {
        has_food[i] = 0;
    }

    for (int i = 0; i < K; i++) {
        std::cin >> d;
        
        for (int j = 0; j < d; j++) {
            std::cin >> idx;
            has_food[idx-1] = 1;
        }
    }

    for (int i = 0; i < N; i++) {
        if (!has_food[i]) total++;
    }

    std::cout << total << std::endl;
    return 0;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, M;
  
  cin >> N >> M;
  
  vector<int> vec(N);
  int all = 0;
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    all += vec.at(i);
  }
  
  sort(vec.begin(), vec.end(), greater<int>());
  int cnt = 0;
  float a = (float)all/(4*M);
  for(int i = 0; i < N; i++){
    if(vec.at(i) < a){
      cout << "No" << "\n";
      break;
    } else {
      cnt++;
      if(cnt == M) {
        cout << "Yes" << "\n";
        break;
      }
    }
  }
}

Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			Point ps[] = new Point[n];
			sc.useDelimiter(",|\\s+");
			for (int i = 0; i < n; i++) {
				ps[i] = new Point(sc.nextDouble(), sc.nextDouble());
			}
			Point[] qs = convexHull(ps);
			System.out.println(n - qs.length);
		}
	}

	static double cross(Point a, Point b) {
		return a.y * b.x - a.x * b.y;
	}

	static double dot(Point a, Point b) {
		return a.x * b.x + a.y * b.y;
	}

	static Point[] convexHull(Point[] V) {
		int n = V.length;
		Arrays.sort(V); // x, yのプライオリティで昇順ソート
		int k = 0; // resのindex
		Point[] res = new Point[2 * n];
		/* lower-hull */
		for (int i = 0; i < n; res[k++] = V[i++])
			while (k >= 2 && ccw(res[k - 2], res[k - 1], V[i]) <= 0)
				--k;
		/* upper-hull */
		// t=|lower-hull|+1
		for (int i = n - 2, t = k + 1; i >= 0; res[k++] = V[i--])
			while (k >= t && ccw(res[k - 2], res[k - 1], V[i]) <= 0)
				--k;

		return Arrays.copyOf(res, k - 1); // 最後の点res[k-1]はlower-hullの始点なのでいらない
	}

	static int ccw(Point a, Point b, Point c) {
		Point tempb = b.sub(a);
		Point tempc = c.sub(a);
		if (cross(tempb, tempc) > 0)
			return +1; // counter clockwise
		if (cross(tempb, tempc) < 0)
			return -1; // clockwise
		if (dot(tempb, tempc) < 0)
			return +2; // (c--a--b or b--a--c) on line
		if (tempb.normsq() < tempc.normsq())
			return -2; // (a--b--c or c--b--a) on line (a=b≠c)
		return 0; // (a--c--b or b--c--a) on line (c=b, a=c, a=b=cも含む)
	}
}

class Point extends Point2D.Double implements Comparable<Point> {
	static final double EPS = 1e-10;

	static boolean EQ(double a, double b) {
		return Math.abs(a - b) < EPS;
	}

	private static final long serialVersionUID = -1781994971111328877L;

	// constructor
	public Point() {
		super();
	}

	public Point(double x, double y) {
		super(x, y);
	}

	public Point(Point p) {
		super(p.x, p.y);
	}

	// setter
	public void set(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public void set(Point p) {
		this.x = p.x;
		this.y = p.y;
	}

	// norm
	public double norm() {
		return Math.sqrt(normsq());
	}

	public double normsq() {
		return x * x + y * y;
	}

	// addition, subtraction, multiplication, division
	public Point add(Point p) {
		return new Point(x + p.x, y + p.y);
	}

	public Point sub(Point p) {
		return new Point(x - p.x, y - p.y);
	}

	public Point mul(double k) {
		return new Point(k * x, k * y);
	}

	public Point div(double k) {
		return new Point(x / k, y / k);
	}

	// 単位法線ベクトル(の一つ)
	public Point normalVector() {
		double d = this.norm();
		return new Point(-y / d, x / d);
	}

	// compareTo x座標優先比較
	public int compareTo(Point o) {
		return (this.x != o.x) ? ((this.x < o.x) ? -1 : 1)
				: ((this.y < o.y) ? -1 : (this.y > o.y) ? 1 : 0);
	}
	// ........................................
} // class Point

Measured memory_bytes: 12000
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;

void main() {
	while(1) {
		long N, M;
		long [] P;
		string [] s;
		s = split(readln());
		N = to!int(s[0]);
		M = to!int(s[1]);
		if(N+M==0) break;
		P ~= 0;
		for(int i = 0; i < N; i++) {
			P ~= to!int(chomp(readln()));
		}
		long [] a;
		for(int i = 0; i < P.length; i++) {
			for(int j = 0; j < P.length; j++) {
				a ~= P[i] + P[j];
			}
		}

		sort(a);

		int j = to!int(a.length)-1;
		long res = 0;
		for(int i = 0; i < a.length; i++) {
			while(j >= 0 && a[i] + a[j] > M) j--;
			if(j >= 0 && a[i]+a[j] <= M && a[i]+a[j] > res)
				res = a[i] + a[j];
		}
		writeln(res);
	}
}

Measured memory_bytes: 26404
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    lli a,b,n;
    cin >> a >> b >> n;
    lli f1=(a*(b-1))/b,f2=(a*n)/b;
    if(n<b) cout << f2;
    else cout << f1;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";

int main(){
  ll a,b; cin >> a >> b;
  if(b==1){cout << 0; return 0;}
  ll ans =1;
  while((ans-1)*(a-1)+a<b){
    ans++;
  }
  cout << ans;
  return 0;
}

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

class Program
{
	static void Main(string[] args)
	{
		//読み込む
		string[] line = Console.ReadLine().Split(' ');
		long H = long.Parse(line[0]);
		long W = long.Parse(line[1]);

		long prod = H * W;
		long answer = prod / 2;

		if(prod % 2 == 1){
				answer ++;
		}

		if(H == 1 || W == 1){
				answer = 1;
		}

		//出力
		Console.WriteLine(answer);
	}
}


Measured memory_bytes: 11092
N, M = map(int, input().split())
LRD = [tuple(map(int, input().split())) for i in range(M)]


class unionFind:
    parent = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.weight = [0]*N

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            p = self.root(self.parent[x])
            self.weight[x] += self.weight[self.parent[x]]
            self.parent[x] = p
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y, w):
        w -= self.getWeight(x)
        w += self.getWeight(y)
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.weight[x] = self.weight[y]+w
            return

    def getWeight(self, x):
        x -= 1
        self.root(x)
        return(self.weight[x])


G = unionFind(N)
flag = True

for l, r, d in LRD:
    if G.same(l, r) == False:
        G.unite(l, r, d)
    else:
        if G.getWeight(l) - G.getWeight(r) == d:
            continue
        else:
            flag = False
            break

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 40052
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <complex>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template<typename T>
#define _HT template<typename H,typename... T>
_T _DEF(T,in,int c){T n{};int m{1};while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c{gcu()};return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, int &c){c=gcu();gcu();return c!=EOF;}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p{b};T m=n<0?pcu('-'),-1:1;if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{int e,b{0},s{1};range(int _b,int _e,int _s):e(_e),b(_b),s(_s){}range(int _b,int _e):e(_e),b(_b){}range(int _e):e(_e){}
	struct it{int v,s;it(int _v,int _s):v(_v),s(_s){}operator int()const{return v;}operator int&(){return v;}int operator*()const{return v;}it& operator++(){v+=s;return *this;}};
	it begin(){return{b, s};}it end(){return{e,s};}};

using P = complex<double>;
P read() {
	int x {in()};
	return P(x, in());
}

double cross(const P &a, const P &b) {
	return imag(conj(a) * b);
}

int main() {
	int t {1};
	for (int n; (n = in());) {
		vector<P> p(n - 1);
		P f {read()};
		for (auto &i: p)
			i = read() - f;
		gcu();
		double A {};
		for (int i: range(n - 2))
			A += cross(p[i], p[i + 1]);
		printf("%d %.1lf\n", t++, abs(A/2));
	}
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define UNIQ(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }


void func(long long N, long long X, long long T){
    ll q = N / X;
    if (N % X != 0) {
        q++;
    }
    cout << q * T << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long T;
    scanf("%lld",&T);
    func(N, X, T);
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
#include <vector>
#include <tuple>
#include <algorithm>

#include <iomanip>
#include <cmath>

#include <limits>

using namespace std;

typedef long long ll;

double DP[309][309][309];

int main() {
  // https://atcoder.jp/contests/dp/tasks/dp_j
  ll N;

  cin >> N;

  vector<int> A(N);
  vector<int> C(4, 0);
  for (auto i =0; i< N; i++) {
    cin >> A[i];
    C[ A[i] ]++;
  }


  ll tt = N; // C[1] + C[2] + C[3];

  // cout << N << endl;
  // i = 1, j=2, k=3
  for (int k = 0; k <= C[3]; k++ ) {
  for (int j = 0; j <= N-k; j++ ) {
  for (int i = 0 ; i <= N-k-j; i++ ) {
        // [i, j, k] ->  1+ [i+1, j-1, k ] * (j / N)
        //              1+ [i-1, j  , k ] * (i / N)
        //           -> 1+ [i  , j+1, k-1] *(k/N)
        //           -> (1. + [i  , j,   k  ]) * (N-i-j-k)/N
        double f =  0.0;
        if (j > 0) f += (1.+ DP[i+1][j-1][k]) * j * 1.0 / N;
        if (i > 0) f += (1. + DP[i-1][j][k]) * i * 1.0 / N;
        if (k > 0) f += (1. + DP[i][j+1][k-1]) * k/N;
        if ( i + j + k < N) 
        {
          f +=  (N-i-j-k)*1.0/N;
          if (i+k+j != 0) DP[i][j][k] = f / ( 1.0 - (N-i-j-k)*1.0/N );
        } else {
          DP[i][j][k] = f;
        }

      // cout << i << " " << j << " " << k << " " << DP[i][j][k] << endl;
      }
    }
  }

  cout << setprecision(17) << DP[C[1]][C[2]] [C[3]] << endl;


  return 0;
}



Measured memory_bytes: 225536
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+50;
int a[maxn];
int cnt[maxn];
int n,k;
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    cin>>n>>k;
    memset(cnt,0,sizeof(cnt));
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
    }
    sort(cnt,cnt+maxn,cmp);
    int all=0;
    for(int i=0;i<k;i++)
    {
        all+=cnt[i];
    }
    int ans=n-all;
    cout << ans << endl;
    //cout << "Hello world!" << endl;
    return 0;
}
/*
10 3
5 1 3 2 4 1 1 2 3 4
*/


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define long long int
int32_t main()
{
	int n,sum=0;
	cin>>n;
	int *b=new int[n-1];
	int *a=new int[n];
	for(int i=0;i<n-1;i++)
	{
		cin>>b[i];
	}
	a[n-1]=b[n-2];
	sum+=b[n-2];
	for(int i=n-2;i>=0;i--)
	{
		a[i]=min(b[i-1],b[i]);
		sum+=min(b[i],b[i-1]);
	}
	cout<<sum+b[0]<<endl;

	return 0;
}

Measured memory_bytes: 256
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


x, t = MI()
print(max(0, x-t))


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

namespace ConsoleApp11
{
    class Class47
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int count = 0;
            int min = a[0];
            for(int i = 0; i < N; i++)
            {
                if (min >= a[i])
                {
                    count++;
                    min = a[i];
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 31580
import java.io.IOException;
import java.util.Scanner;

//??§?°????????????????????????°??????
public class Main{

	public static void main(String[] args) throws IOException{

		Scanner in = new Scanner(System.in);
		int x=in.nextInt();
		int y=in.nextInt();
		evaluation(x,y);
		in.close();

	}

	public static void evaluation(int a, int b){
		if(a<b){
			System.out.println("a < b");
		}else if(a>b){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}

	}

}

Measured memory_bytes: 26016
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



n=int(input())
#n,m=input_list()
#a=input_list()
#a=input().split()
#n=int(a[0])
#m=float(a[1])
#print(math.floor(n*m))
s=[]
e=[]
for _ in range(n):
    tmp=input_list()
    s.append(tmp[0])
    e.append(tmp[1])

s.sort()
e.sort()
if n%2==1:
    num=(n-1)//2
    ans=e[num]-s[num]+1
else:
    num=n//2
    st=s[num]+s[num-1]
    en=e[num]+e[num-1]
    ans=en-st+1
print(ans)


Measured memory_bytes: 43444
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
using namespace std;

int main() {
	int q = 0;
	while (1) {
		double n;
		double date[1000];
		double sum = 0;
		double var = 0;
		string haki;
		cin >> n;
		getline(cin, haki);
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> date[i];
			sum += date[i];
		}
		double ave = sum / n;
		for (int i = 0; i < n; i++) {
			var += pow(date[i] - ave, 2);
		}
		cout << fixed << pow(var / n,0.5) << endl;
		q++;
		if (q > 10)break;

	}
	return 0;
}


Measured memory_bytes: 3416
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		long[]stuX = new long[n];
		long[]stuY = new long[n];
		long[]pntX = new long[m];
		long[]pntY = new long[m];
		for(int i=0;i<n;i++) {
			stuX[i]=scan.nextLong();
			stuY[i] = scan.nextLong();
		}
		for(int i=0;i<m;i++) {
			pntX[i]=scan.nextLong();
			pntY[i] = scan.nextLong();
		}
		long[][] zettai = new long[n][m];//学生からポイントまでのマンハ距離

		int[] saitanP = new int[n];//いちばん近いポイントのポイント番号を記録する
		for(int i=0;i<n;i++) {
			//（ある学生から見て）一番近いポイントまでの距離。iが動いたら初期化する
			long saitanL = 4*(long)Math.pow(10, 8)+1;
			//System.out.println(saitanL);
			for(int l=0;l<m;l++) {
				zettai[i][l]=Math.abs(stuX[i]-pntX[l])+Math.abs(stuY[i]-pntY[l]);
				//i番目の学生のポイント0～ｌに対する距離
				//System.out.println("マンハッタン="+zettai[i][l]);

//その距離が最短だったらそのポイントの番号を記録
					if(saitanL>zettai[i][l]) {
						saitanL = zettai[i][l];
						saitanP[i]=l+1;
						//System.out.println(saitanP[i]);

					}

				}
			}
		for(int i=0;i<n;i++) {
			System.out.println(saitanP[i]);
		}


		}



	}




Measured memory_bytes: 21844
n = int(input())
*A, = map(int, input().split())

ans = 0
for i in range(n):
    for j in range(n-1):
        if A[j+1] < A[j]:
            A[j], A[j+1] = A[j+1], A[j]
            ans += 1
print(*A)
print(ans)



Measured memory_bytes: 5604
N,M = map(int, input().split())
S = list(input())

S.reverse()
ans = []
i = 0
while i < N:
    num = 0
    for j in range(min(N, i+M), i, -1):
        if S[j] == "0":
            num = j-i
            i = j
            break
    if num == 0:
        ans = -1
        break
    ans.append(num)

if ans == -1:
    print(ans)
else:
    ans.reverse()
    print(*ans)

Measured memory_bytes: 87784
import heapq

def dijkstra(graph, node, start):
    dist = [float("inf") for _ in range(node)]

    dist[start] = 0
    q = []
    heapq.heappush(q, (0, start))

    while q:
        cost, cur_node = heapq.heappop(q)

        if dist[cur_node] < cost:
            continue

        for nex_cost, nex_node in graph[cur_node]:
            dist_cand = dist[cur_node] + nex_cost
            if dist_cand < dist[nex_node]:
                dist[nex_node] = dist_cand
                heapq.heappush(q, (dist[nex_node], nex_node))

    return dist


n = int(input())
adj = [[] for _ in range(n)]
for i in range(n - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    adj[a].append((c, b))
    adj[b].append((c, a))
shortest = dijkstra(adj, n, 0)
for i in shortest:
    print(i % 2)

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

int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> G(N);
    for (int i = 0; i < M; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        if(a!=0 && b!=0 && a!=N-1 && b!=N-1) continue;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    bool flag = false;
    for(int i : G[0]){
        for (int j: G[i])
        {
            if(j==N-1) flag = true;
        }
    }    
    
    if(flag) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 12016
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int m,n;
    cin>>n>>m;
    int x=100*(n-m)+1900*m;
    int count=0;
    double prob=pow(0.5,m);
    int ans;
    ans=x/prob;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256