akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define M   1000000007 // 1e9 + 7
#define MAXN 100100
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,double> pdd;
inline int mod(int n, int m){int ret = n%m; if(ret < 0) ret += m; return ret;}
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }    else return mod(k*k,m);
}

int A[20];
vector<pii> v[20];

int32_t main(){
	fastio;
   	int n;
   	cin>>n;
   	for(int i=0;i<n;i++){
		   cin>>A[i];
		   for(int j=0;j<A[i];j++){
			   int x,y;
			   cin>>x>>y;
			   v[i].pb(pii(x,y));
		   }
   }
   int r=0;
   for(int mask=1;mask<=(1<<n) - 1;mask++){
	   int flag = true;
	   int cur=0;
	   for(int j=0;j<n;j++){
   		   
		   if((mask&(1<<j))>=1){
			   cur++;
		   	
			   for(int k=0;k<A[j];k++){
				   int x = v[j][k].ff -1;
				   int y = v[j][k].ss;
				   if(y==0 && (mask&(1<<x))>=1){
					   flag = false;
					 //  cout<<mask<<" "<<j<<" "<<x<<" "<<y<<endl;
					   break;
				   }
				   if(y==1 && (mask&(1<<x))==0){
					   flag = false;
					  // cout<<mask<<" "<<j<<" "<<x<<" "<<y<<endl;
					   break;
				   }
			   }
			   
			   
		   }
	   }
	   
	   if(flag) r = max(r,cur);
   }	
   	cout<<r<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
import math

def main():
	N = int(input())
	A = list(map(int, input().split(" ")))
	
	A_tmp = []
	for i, val in enumerate(A):
		A_tmp.append(val - (i+1))
		
	hey = np.median(A_tmp)
	ans = 0
	for i, val in enumerate(A):
		ans += abs(val-(hey+(i+1)))
		
	#print(A_tmp)
	print(int(ans))
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 35384
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
ll N,M;
ll A[1010],B[1010];

ll inf = 1e9+7;


int main(){
	cin >> N >> M;
	set<ll> sa,sb;
	for(int i=1;i<=N;i++){
		cin >> A[i];
		sa.insert(A[i]);
	}
	for(int i=1;i<=M;i++){
		cin >> B[i];
		sb.insert(B[i]);
	}
	if(sa.size()!=N || sb.size()!=M){
		cout << 0 << endl;
		return 0;
	}
	sort(A+1,A+N+1);
	sort(B+1,B+M+1);
	ll ans = 1,aid = N,bid = M;
	for(ll i=N*M;i>=1;i--){
		bool a = sa.count(i),b = sb.count(i);
		if(a && !b){
			while(B[bid]>=i) bid--;
			(ans *= M-bid)%=inf;
		}else if(!a && b){
			while(A[aid]>=i) aid--;
			(ans *= N-aid)%=inf;
		}else if(!a && !b){
			while(B[bid]>=i) bid--;
			while(A[aid]>=i) aid--;
			(ans *= ((M-bid)*(N-aid)-(M*N-i)+inf)%inf)%=inf;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main() {
  int s;
  cin >> s;

  int a = s/1000;
  int b = (s%1000)/100;
  int c = (s%1000%100)/10;
  int d = (s%1000%100%10)/1;

  char op1, op2, op3;
  int ans;
  for(int i = 0; i <= 1; i++) {
    for(int j = 0; j <= 1; j++) {
      for(int k = 0; k <= 1; k++) {
        if(i == 0) {
          op1 = '+';
          ans = a + b;
        }else {
          op1 = '-';
          ans = a - b;
        }
        if(j == 0) {
          op2 = '+';
          ans += c;
        }else {
          op2 = '-';
          ans -= c;
        }
        if(k == 0) {
          op3 = '+';
          ans += d;
        }else {
          op3 = '-';
          ans -= d;
        }

        if(ans == 7) {
          cout << a << op1 << b << op2 << c << op3 << d << "=" << 7;
          return 0;
        } else {
          ans = 0;
        }
      }
    }
  }
}


Measured memory_bytes: 256
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let k: usize = s.next().unwrap().parse().unwrap();
	for _ in 0..k {
		print!("ACL");
	}
	println!();
}


Measured memory_bytes: 2124
#include <iostream>

using namespace std;

int main()
{
	int but[100001];
	int n;
	int ans = 0;
	int cnt = 0;
	int sub = 0;
	
	cin >> n;
	
	for (int i = 0; i < n; i++) cin >> but[i];
	
	while (cnt <= n && sub != 1) {
		sub = but[sub] - 1;
		cnt++;
	}
	
	if (cnt > n) {
		cout << -1 << endl;
	}
	else {
		cout << cnt << endl;
	}
	
	return (0);
}

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

char ma[101][101];
int dp[101][101];
int h, w;

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    cin >> h >> w;
    memset(dp, 0x3f, sizeof(dp));
    for (int i = 1; i <= h; i++) {
        cin >> (ma[i] + 1);
    }

    dp[1][1] = (ma[1][1] == '#');
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + (ma[i][j] == '.' && ma[i + 1][j] == '#'));
            dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + (ma[i][j] == '.' && ma[i][j + 1] == '#'));
        }
    }

    cout << dp[h][w] << '\n';

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    while (true) {
        val (n, x) = readLine()!!.split(" ").map(String::toInt)

        if ((n == 0) and (x == 0)) {
            break
        }

        var combinationNum = 0

        for (a in (1..n)) {
            for (b in (1 until a)) {
                if (x <= a + b) {
                    break
                }
                val c = x - (a + b)
                if (c < b) {
                    combinationNum += 1
                } else {
                    continue
                }
            }
        }

        println("$combinationNum")
    }
}


Measured memory_bytes: 32068
a, b, c, d = gets.chomp.split("")
ok = false
["+", "-"].each do |op1|
  ["+", "-"].each do |op2|
    ["+", "-"].each do |op3|
      expr = a + op1 + b + op2 + c + op3 + d
      if eval(expr) == 7
        puts expr + "=7"
        ok = true
        break
      end
    end
    break if ok
  end
  break if ok
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B,count=0,countB=0;cin>>N>>A>>B;
  string S;cin>>S;
  for(int i=0;i<N;i++){
    if(S.at(i)=='a' && count<A+B){
      cout<<"Yes"<<endl;
      count++;
    }
    else if(S.at(i)=='a')cout<<"No"<<endl;
    else if(S.at(i)=='c')cout<<"No"<<endl;
    else if(count<A+B && countB<B){
      cout<<"Yes"<<endl;
      count++;countB++;
    }
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 896
using System;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    { 
        int[] l = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int sx = l[0];
        int sy = l[1];
        int tx = l[2];
        int ty = l[3];

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < ty - sy; i++)
        {
            sb.Append("U");
        }

        for (int i = 0; i < tx - sx; i++)
        {
            sb.Append("R");
        }

        for (int i = 0; i < ty - sy; i++)
        {
            sb.Append("D");
        }

        for (int i = 0; i < tx - sx + 1; i++)
        {
            sb.Append("L");
        }

        for (int i = 0; i < ty - sy + 1; i++)
        {
            sb.Append("U");
        }

        for (int i = 0; i < tx - sx + 1; i++)
        {
            sb.Append("R");
        }

        sb.Append("D");
        sb.Append("R");

        for (int i = 0; i < ty - sy + 1; i++)
        {
            sb.Append("D");
        }

        for (int i = 0; i < tx - sx + 1; i++)
        {
            sb.Append("L");
        }

        sb.Append("U");

        Console.WriteLine(sb.ToString());
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
int read(){
	int x=0,fh=1; char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') fh=-1;
	for (;isdigit(ch);ch=getchar()) x=x*10+(ch^48);
	return x*fh;
}
int main(){
	int n=read(),x,y,mi=2e9; bool ff=0; long long ans=0;
	For(i,1,n) x=read(),y=read(),ff=(x==y)?ff:1,ans+=x,mi=(x>y)?min(mi,y):mi;
	if (ff) printf("%lld\n",ans-mi); else printf("0\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 100050;
int N;
long long A[MAX_N];
long long dp[MAX_N][2];

int main(int argc, char **argv) {
    std::cin >> N;
    
    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }

    dp[1][0] = A[1] + A[2];
    dp[1][1] = -dp[1][0];

    for (int i = 2; i <= N - 1; i++) {
        dp[i][0] = std::max(dp[i-1][0] + A[i+1], dp[i-1][1] + A[i+1]);
        dp[i][1] = std::max(dp[i-1][0] - A[i] * 2 - A[i+1], + dp[i-1][1] + A[i] * 2 - A[i+1]);
    }

    std::cout << std::max(dp[N-1][0], dp[N-1][1]) << std::endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A)
{
  if (A.size() == n + 1)
  {
    int now = 0;
    for (int i = 0; i < q; i++)
    {
      if (A[b[i]] - A[a[i]] == c[i])
      {
        now += d[i];
      }
    }
    ans = max(now, ans);
    return ;
  }
  
  A.push_back(A.back());
  while (A.back() <= m)
  {
    dfs(A);
    A.back()++;
  }
}
  

int main()
{
  cin >> n >> m >> q;
  a = b = c = d = vector<int> (q);
  for (int i = 0; i < q; i++)
  {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int> (1, 1));
  cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;
public class Main 
{
    public static void main(String[] args) 
    {
        Scanner input = new Scanner(System.in);
        String record = input.nextLine();
        int len = record.length(),
            losses = 0;
        for(int i = 0; i < len; i++)
        {
            if(record.charAt(i) == 'x')
                losses++;
        }
        
        if(losses > 7)
            System.out.println("NO");
        else
            System.out.println("YES");
    }
    
}

Measured memory_bytes: 21588
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef std::vector<int> VI;
typedef std::pair<int,int> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

int main()
{
    int n=read(),x=read(),t=read();
    if(n%x==0) cout<<n/x*t;
    else cout<<(n/x+1)*t;

    return 0;
}


Measured memory_bytes: 3564
import bisect

N = int(input())
A = [int(input()) for _ in range(N)]


colors = []
for i in reversed(range(N)):
    if i == N-1:
        colors.append(A[i])
    else:
        if A[i] >= colors[-1]:
            colors.append(A[i])
        # 積む色がある場合
        else:
            idx = bisect.bisect_right(colors, A[i])
            colors[idx] = A[i]


print(len(colors))

Measured memory_bytes: 7836
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
using namespace std;
const int maxn = 20;
const int inf = 0x3f3f3f3f;
char str[maxn][50];
int  G[maxn][maxn];
int  dp[1<<15][15];
bool ok[maxn];
int  n;

int cal(int x, int y) {
    int len1 = strlen(str[x]);
    int len2 = strlen(str[y]);
    int i, j, k;
    int ans = 0, tmp;
    for(i = 0; i < len1; ++i) {
        tmp = 0;
        for(j = i, k = 0; j < len1 && k < len2; ++j, ++k) {
            if(str[x][j] == str[y][k]) {
                tmp++;
            } else {
                break;
            }
        }
        if(k == len2) {
            ans = max(ans, tmp);
        } else if(j == len1) {
            ans = max(ans, tmp);
        }
    }
    return len2 - ans;
}

void bulid() {
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(i == j) G[i][j] = 0;
            else {
                G[i][j] = cal(i, j);
            }
        }
    }
    memset(ok, false, sizeof(ok));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(i == j) continue;
            if(strstr(str[i], str[j])) {
                ok[j] = true;
            }
        }
    }
}

void solve() {
    memset(dp, inf, sizeof(dp));
    for(int i = 0; i < n; ++i) {
        dp[1<<i][i] = strlen(str[i]);
    }
    for(int i = 0; i < (1<<n); ++i) {
        for(int j = 0; j < n; ++j) {
            if(dp[i][j] == inf || ok[j]) {
                continue;
            }
            for(int k = 0; k < n; ++k) {
                if(ok[k]) continue;
                if((i&(1<<k)) == 0) {
                    dp[i|(1<<k)][k] = min(dp[i|(1<<k)][k], dp[i][j] + G[j][k]);
                }
            }
        }
    }
}


int main() {

    //freopen("aa.in", "r", stdin);

    while(scanf("%d", &n) && n) {
        for(int i = 0; i < n; ++i) {
            scanf("%s", str[i]);
        }
        bulid();
        solve();
        int ans = inf;
        int x = (1<<n) - 1;
        for(int i = 0; i < n; ++i) {
            if(ok[i]) {
                x &= (~(1<<i));
            }
        }
        for(int i = 0; i < n; ++i) {
            ans = min(ans, dp[x][i]);
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3132
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String str[] = br.readLine().split(" ");
            int n = Integer.parseInt(str[0]);
            int k = Integer.parseInt(str[1]);
            str = br.readLine().split(" ");
            int lArr[] = new int[n];
            for (int i = 0; i < str.length; i++) {
                lArr[i] = Integer.parseInt(str[i]);
            }
            Arrays.sort(lArr);
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += lArr[n - 1 - i];
                if (i == k - 1) {
                    break;
                }
            }
            System.out.println(sum);
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}

Measured memory_bytes: 21460
import collections
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


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

c=collections.Counter(A)
list=c.values()
result=0

for x in list:
    if x>1:
        result+=cmb(x,2)
for y in c.keys():
    c[y]=result-(c[y]-1)

for z in A:
    print(c[z])



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

int main()
{
    int a,b,k;
    cin >> a >> b >> k;
    int count = 1;
    for(int i = a; i <= b; i++){
        if(count <= k || b-a+1-count+1 <= k){
            cout << i << endl;
        }
        count++;
    }
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

x, y = x2-x1, y2-y1

if x>0 and y>=0:
    x4, y4 = -y, x
elif x<=0 and y>=0:
    x4, y4 = -y, x
elif x<=0 and y<=0:
    x4, y4 = -y, x
elif x>=0 and y<=0:
    x4, y4 = -y, x
x3, y3 = x+x4, y+y4

print(x3+x1, y3+y1, x4+x1, y4+y1)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#define inf 1000000

using namespace std;

#define LL long long

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

int n, m, nn;
bool **a;
int **f;

char getcc() {
	char c = getchar();
	while (c != '.' && c != '#') {
		c = getchar();
	}
	return c;
}
bool valid(int x, int y) {
	return (x >= 0 && x < n && y >= 0 && y < m);
}

int getn(int x, int y) {
	return (x * m + y);
}

int main() {
	cin >> n >> m;
	a = new bool*[n];
	nn = n * m;
	for (int i = 0; i < n; ++i) {
		a[i] = new bool[m];
		for (int j = 0; j < m; ++j) {
			char c = getcc();
			if (c == '.') {
				a[i][j] = true;
			}
			else {
				a[i][j] = false;
			}
		}
	}
	f = new int*[nn];
	for (int i = 0; i < nn; ++i) {
		f[i] = new int[nn];
		for (int j = 0; j < nn; ++j) {
			if (i == j) {
				f[i][j] = 0;
			}
			else {
				f[i][j] = inf;
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (!a[i][j]) {
				continue;
			}
			for (int d = 0; d < 4; ++d) {
				int x = i + dx[d], y = j + dy[d];
				if (!valid(x, y)) {
					continue;
				}
				if (!a[x][y]) {
					continue;
				}
				f[getn(i, j)][getn(x, y)] = 1;
			}
		}
	}
	for (int k = 0; k < nn; ++k) {
		for (int i = 0; i < nn; ++i) {
			for (int j = 0; j < nn; ++j) {
				if (f[i][k] + f[k][j] < f[i][j]) {
					f[i][j] = f[i][k] + f[k][j];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < nn; ++i) {
		for (int j = 0; j < nn; ++j) {
			if (f[i][j] < inf && f[i][j] > ans) {
				ans = f[i][j];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 896
import static java.lang.Math.*;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            double[] x = new double[100];
            double[] y = new double[100];
            double[] px = new double[10000];
            double[] py = new double[10000];
            for (int i = 0; i < n; i++) {
                String[] s = sc.next().split(",");
                x[i] = Double.parseDouble(s[0]);
                y[i] = Double.parseDouble(s[1]);
            }
            int now = 0;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if ((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) < 4.0000001) {
                        double d = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
                        double mx = (x[i] + x[j]) / 2;
                        double my = (y[i] + y[j]) / 2;
                        double s = sqrt(1 - d * d / 4);
                        double theta = atan((y[i] - y[j]) / (x[i] - x[j]));
                        px[now] = mx - sin(theta) * s;
                        py[now++] = my + cos(theta) * s;
                        px[now] = mx + sin(theta) * s;
                        py[now++] = my - cos(theta) * s;
                    }
                }
            }
            int ret = 1;
            for (int i = 0; i < now; i++) {
                int k = 0;
                for (int j = 0; j < n; j++)
                    if ((px[i] - x[j]) * (px[i] - x[j]) + (py[i] - y[j]) * (py[i] - y[j]) < 1.0000001)
                        k++;
                ret = max(ret, k);
            }
            System.out.println(ret);
        }
    }
}


Measured memory_bytes: 31568
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
  j = i
  su = 0
  while(j > 0):
    k = j % 10
    su += k
    j = j // 10
  if(su >= a and su <= b):
    ans += i
print(ans)

Measured memory_bytes: 2940
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 10000007;
long long large = 1000000000000000000LL;





int main(){
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;

	vector<int> water;
	for(int i=0;i*100*a<=f;i++){
		for(int j=0;j*100*b<=f;j++){
			if(i*100*a+j*100*b<=f) water.push_back(i*100*a+j*100*b);
		}
	}
	sort(water.begin(),water.end());
	water.erase(unique(water.begin(),water.end()),water.end());
	vector<int> sugar;
	for(int i=0;i*c<=f;i++){
		for(int j=0;j*d<=f;j++){
			if(i*c+j*d<=f) sugar.push_back(i*c+j*d);
		}
	}
	sort(sugar.begin(),sugar.end());
	sugar.erase(unique(sugar.begin(),sugar.end()),sugar.end());
	int a1=water[1],a2=0;
	for(int i=1;i<(int)water.size();i++){
		for(int j=1;j<(int)sugar.size();j++){
			int w = water[i]+sugar[j];
			if(w>f) continue;
			if(water[i]*e<sugar[j]*100) continue;
			if(a2*w<a1*sugar[j]){
				a1 = w;
				a2 = sugar[j];
			}
		}
	}
	cout<<a1<<" "<<a2<<endl;

	return 0;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  int m; cin >> m;
  vector<string> t(m);
  rep(i, m) cin >> t[i];

  map<string, int> mp;
  rep(i, n) ++mp[s[i]];
  rep(i, m) --mp[t[i]];
  int ans = 0;
  for(auto x : mp) chmax(ans, x.second);
  cout << ans << endl;
}


Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int x[] = new int[10000];
        int i=0;
        try{
            while(!(str = br.readLine()).equals("0")){
                x[i] = Integer.parseInt(str);
                i++;
            }
        }catch(IOException e){
            
        }
        for(int j=0;j<i;j++){
            System.out.println("Case "+(j+1)+": "+x[j]);
        }
    }
}

Measured memory_bytes: 32552
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vec vector
#define pb push_back
#define pop pop_back
#define all(x) x.begin(),x.end()
#define testcases ll t;cin>>t;while(t--)
#define mem(a,k) memset(a,k,sizeof(a))
#define FF first
#define SS second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<ll,ll>
#define vecin(a,n,index) for(int i=index;i<n;i++)cin>>a[i]
#define vecout(a,n,index) for(int i=index;i<n;i++)cout<<a[i]<<" ";cout<<endl;
#define FASTio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod = 1000000007;
ll power(ll a, ll b) {
	if (b < 0)rt 0;
	ll res = 1;
	while (b != 0) {
		if (b % 2) {res = (res % mod * a % mod) % mod; b--;}
		else {a = (a % mod * a % mod) % mod; b /= 2;}
	}
	rt res % mod;
}
void solve() {
	ll n;
	cin >> n;
	ll ans = 1;
	ans = (power(10, n) % mod - ((2 * power(9, n )) % mod - power(8, n) % mod + mod) % mod + mod) % mod;
	cout << ans << endl;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	FASTio
	// START FROM HERE :)
	solve();
}

Measured memory_bytes: 3636
// お互いの場所を目指して幅優先探索
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;

#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i=0;(i)<(n);(i)++)
#define repi(i, n) for (int i=0;(i)<=(n);(i)++)
#define repr(i, n) for (int i=n;(i)>=0;(i)--)
#define print(x) (cout<<(x)<<"\n")
#define MAX 100000
#define INF (1<<29)
vvi edge(MAX, vi(0));
vector<bool> visited(MAX);

void bfs(int start, vi &d) {
    queue<P> q;
    q.push(P(start, 0));
    while (q.size()) {
        P p = q.front(); q.pop();
        visited[p.first] = true;
        d[p.first] = p.second;
        for (int next: edge[p.first]) {
            if (next==p.first) continue;
            if (visited[next]) continue;
            q.push(P(next, p.second+1));
        }
    }
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n; cin>>n;
    vi black(n);
    vi white(n);
    rep(i, n-1) {
        int a, b; cin>>a>>b;
        a--; b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    rep(i, n) visited[i] = false;
    bfs(0, black);
    rep(i, n) visited[i] = false;
    bfs(n-1, white);
    int f=0, s=0;
    rep(i, n) {
        if (black[i]<=white[i]) f++;
        else s++;
    }
    if (f>s) print("Fennec");
    else print("Snuke");
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.rbegin(), a.rend());
	int ans = 0;
	rep(i, n) {
		if(i % 2 == 0) ans += a[i];
		else ans -= a[i];
	}
	cout << ans << endl;

	return 0;
}


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

void solution(int a, int b) {
    // first of all, determine if both a and b
    // are even or both a and b are odd
    bool both_even = a % 2 == 0 && b % 2 == 0;
    bool both_odd = a % 2 != 0 && b % 2 != 0;
    if (!both_even && !both_odd) {
        cout << "IMPOSSIBLE\n";
        return;
    }
    // iterate from a to b, trying to find
    // the right number
    for (int i = 0; i <= 10e9; ++i) {
        if (abs(a - i) == abs(b - i)) {
            cout << i << '\n';
            return;
        }
    }
    cout << "IMPOSSIBLE\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> a >> b;
    solution(a, b);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N,M;
  int hw[10000];
  int sum = 0;
  
  cin >> N >> M;
  
  for(int i = 0;i < M;i++){
    cin >> hw[i];
    sum += hw[i];
  }
  
  if(sum > N){
    cout << -1;
  }else{
    cout << N - sum;
  }
  
}

Measured memory_bytes: 3632
#include <iostream>
#include<cstdlib>
using namespace std;
int main(){
	int n, k, x[100], ans = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++){
		cin >> x[i];
	}

	for (int i = 0; i < n; i++){
		if (x[i] < abs(k - x[i]))
			ans += x[i] * 2;
		else
			ans += abs(k - x[i]) * 2;
	}
	cout << ans << endl;

	return 0;
}

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

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			int M = sc.nextInt();
			if (N == 0) break;
			int[][] x = new int[N + 2][];
			x[0] = new int[] { 0 };
			x[N + 1] = new int[] { 0 };
			int[][] d = new int[N + 2][];
			d[0] = new int[] { 0 };
			d[N + 1] = new int[] { 0 };
			for (int i = 0; i < N; ++i) {
				int k = sc.nextInt();
				x[i + 1] = new int[k];
				d[i + 1] = new int[k];
				for (int j = 0; j < k; ++j) {
					x[i + 1][j] = sc.nextInt();
					d[i + 1][j] = sc.nextInt();
				}
			}
			int[][][] dp = new int[N + 2][M + 1][];
			for (int i = 0; i < N + 2; ++i) {
				for (int j = 0; j < M + 1; ++j) {
					dp[i][j] = new int[x[i].length];
					Arrays.fill(dp[i][j], Integer.MAX_VALUE);
				}
			}
			dp[0][0][0] = 0;
			for (int i = 0; i < N + 1; ++i) {
				for (int j = 0; j <= M; ++j) {
					for (int k = 0; k < dp[i][j].length; ++k) {
						if (dp[i][j][k] == Integer.MAX_VALUE) continue;
						for (int l = 0; l < dp[i + 1][j].length; ++l) {
							int nv = dp[i][j][k];
							if (i != 0 && i != N) nv += (d[i][k] + d[i + 1][l]) * Math.abs(x[i][k] - x[i + 1][l]);
							dp[i + 1][j][l] = Math.min(dp[i + 1][j][l], nv);
						}
						if (i < N && j < M) {
							for (int l = 0; l < dp[i + 2][j + 1].length; ++l) {
								int nv = dp[i][j][k];
								if (i != 0 && i != N - 1) nv += (d[i][k] + d[i + 2][l]) * Math.abs(x[i][k] - x[i + 2][l]);
								dp[i + 2][j + 1][l] = Math.min(dp[i + 2][j + 1][l], nv);
							}
						}
					}
				}
			}
			int ans = Integer.MAX_VALUE;
			for (int i = 0; i <= M; ++i) {
				ans = Math.min(dp[N + 1][i][0], ans);
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 13000
#include <iostream>


using namespace std;


int main()
{
	int m, f, r;
	int mf;	// m + f

	while(1){
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1)
			break;

		mf = m + f;
		if(m == -1 || f == -1)
			cout << "F" << endl;
		else if(80 <= mf)
			cout << "A" << endl;
		else if(65 <= mf)
			cout << "B" << endl;
		else if(50 <= mf)
			cout << "C" << endl;
		else if(30 <= mf && 50 <= r)
			cout << "C" << endl;
		else if(30 <= mf)
			cout << "D" << endl;
		else
			cout << "F" << endl;
	}

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (mp.count(a)) {
      mp.at(a)++;
    }
    else {
      mp[a]++;
    }
    ans += a;
  }
  
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int b, c;
    cin >> b >> c;
    
    if (mp.count(b)) {
      int size = mp.at(b);
      int t = (c - b) * size;
      ans += t;

      mp.at(b) -= size;
      
      if (mp.count(c)) {
        mp.at(c) += size;
      }
      else {
        mp[c];
        mp.at(c) += size;
      }
    }
    

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


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

int main()
{
  string N;
  cin >> N;
  if (N[0] == N[1] && N[1] == N[2])
  {
    cout << "Yes" << endl;
  }
  else if (N[2] == N[1] && N[2] == N[3])
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
/*#define F second
#define S first*/
using namespace std;
const int N=1e5+1;
int dp[101][N];
pair<int ,int> a[N];
main()
{
    int n,m;
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld",&a[i].S,&a[i].F);
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(j<a[i].S){
                dp[i][j]=dp[i-1][j];
            }
            else{
                dp[i][j]=max(a[i].F+dp[i-1][j-a[i].S],dp[i-1][j]);
            }
        }
    }
    printf("%lld",dp[n][m]);
}


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

int main(void){
  ll n, ans = 0;
  scanf("%lld", &n);
  // Sa - Sb
  // 0 - Sb
  // +a +b
  map<ll, vector<int>> vs;
  vector<ll> ns;
  rep(i, n){
    int a, b;
    scanf("%d %d", &a, &b);
    if (!vs.count(a + b)) ns.push_back(a + b);
    vs[a + b].push_back(a);
  }

  sort(ns.rbegin(), ns.rend());
  int cur = 0, id = 0;
  rep(i, n){
    if (i % 2 == 0)
      ans += vs[ns[cur]][id++];
    else
      ans -= ns[cur] - vs[ns[cur]][id++];
    if (id == vs[ns[cur]].size()) ++cur, id = 0;
  }

  std::printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 15072
h,w,k = list(map(int, input().split() ) )
c = [ list(input()) for i in range(h) ]
#len h , elem len w

newc = [[ 1 if ee == '#' else 0 for ee in e ] for e in c] #黒を1
#print(newc)
newc_t = list(map(list, zip(*newc)))

blackcnt = sum( [sum(i) for i in newc] )
need_del = blackcnt - k
#print(need_del)
cnt = 0

for hh in range(2 ** h):
  #print(list(format(hh,'0{}b'.format(h)) ))
  hh_del = list( map( int, list(format(hh,'0{}b'.format(h)) ) ))
  for ww in range(2 ** w):
    ww_del = list( map( int, list(format(ww,'0{}b'.format(w)) ) ))
    
    row_del_cnt = sum( [sum(row) for row,check in zip(newc,   hh_del) if check ==1] )
    col_del_cnt = sum( [sum(col) for col,check in zip(newc_t, ww_del) if check ==1] )
    
    #diagonal
    d_cnt = 0
    for ri,rc in enumerate(hh_del):
      for ci,cc in enumerate(ww_del):
        d_cnt += newc[ri][ci] * rc * cc
    
    if need_del == row_del_cnt + col_del_cnt - d_cnt:
      cnt += 1
      #print(hh,hh_del,ww, ww_del)
print(cnt)

Measured memory_bytes: 72676
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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

int abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int abs_B(long long num, long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

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



const long long MOD = 1000000007;

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> retu(N);
    vector<int> sa(N);
    int ans = 0;
    for (int i = 0; i < N; i ++ ) {
        cin >> retu.at(i);
        sa.at(i) = abs_A(retu.at(i) - X);
        ans = gcd(ans, sa.at(i));
    }
    cout << ans << endl;


}



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

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define string str
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foreq(i,s,e) for (ll i=(s); i<=(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()
#define vll vector<ll>
#define vs vector<string>

#define mapll map<ll,ll>
#define mapss map<string,string>
#define mapsl map<string,ll>
#define mapls map<ll,string>

#define pll pair<ll,ll>
#define pss pair<string,string>
#define psl pair<ll,string>
#define pls pair<string,ll>

#define minheap priority_queue<ll>
#define maxheap priority_queue<ll,vector<ll> ,greater<ll>>

#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
const ll mod=1e9 + 7;


ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

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

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}


signed main() 
{
    fast_cin();
    ll a,b,c,n;
    cin>>a>>b>>c>>n;
    ll ans=0;
    For(i,0,n/a+1)
    {
        For(j,0,n-(a*i)+1)
        {
            if((n-(a*i)-(b*j))%c==0 and (n-(a*i)-(b*j))>=0)
                ans++;
        }
    }
    cout<<ans<<endl;
    
    
    return 0;    
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void){
  struct cell *mklist, *p;
  int n,m,i,a,mix;
  scanf("%d%d",&n,&m);
  for(i=0,mix=0;i<m;i++){
    scanf("%d",&a);
    mix += a;
  }
  n-=mix;
  if(n<0)printf("-1");
  else printf("%d",n);
  return 0;
}


Measured memory_bytes: 1732
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001



class Stack:
    def __init__(self,arg_size):
        self.size = arg_size
        self.stack = [None] * self.size
        self.head = 0
        self.tail = 0

    def is_empty(self):
        return self.tail == self.head

    def push(self,arg_object):
        self.stack[self.tail] = arg_object
        self.tail += 1

    def pop(self):
        self.tail -= 1
        return self.stack[self.tail]

    def top(self):
        return self.stack[self.head]


SIZE = 105
NUM = Stack(SIZE)

input_str = list(map(str,input().split()))

for i in range(len(input_str)):
    ch = input_str[i]
    if ch in ['+','-','*']:
        num_2 = NUM.pop()
        num_1 = NUM.pop()
        num = 0
        if ch == '+':
            num = num_1+num_2
        elif ch == '-':
            num = num_1-num_2
        else:
            num = num_1*num_2
        NUM.push(num)
    else:
        NUM.push(int(ch))

print("%d"%(NUM.top()))




Measured memory_bytes: 6372
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#include<functional>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

const ll INF=1e15;
int main()
{
    int n;
    cin>>n;
    vector<ll> a(n);
    ll sum=0;
    rep(i,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    ll ans=INF;
    ll pickup=0;
    rep(i,n-1)
    {
        pickup+=a[i];
        ll remainmean=sum-pickup;
        ans=min(ans,abs(remainmean-pickup));

    }
    cout<<ans;

}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    LL a,b,c,k;
    cin>>a>>b>>c>>k;
    LL ans=0;
    ans=min(a,k);
    k-=min(k,a);
    k-=min(k,b);

    ans-=min(k,c);
    cout<<ans;


}


Measured memory_bytes: 3600
#include<stdio.h>
int main(){
  int a,b,c,d[10000],e=0,f;
  scanf("%d %d",&a,&b);
    for(c=1;c<=b;c++){
      scanf("%d",&f);
      e=e+f;
    }
  if(a-e<=0)printf("Yes");
  else printf("No");
  return 0;
}
       

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

int main()
{
	long long int n, k;
	cin >> n >> k;
	long long int a = n / k;
	long long int b = (n + k / 2) / k;
	cout << a * a * a + (k % 2 == 0 ? b * b * b : 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define hoise cerr<<"hoise - "<<__LINE__<<"\n";
#define tham getchar();
#define FASTIO ios::sync_with_stdio(false);cin.tie(nullptr);

using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;
using vl = vector <ll>;

const int MXN = (int)2e5+6;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }


template <typename T> using orderedSet = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using orderedSet1 = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*--------------------------------------------------------------------------------------------------------------------------*/




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

/*

*/


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

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

    ll X, Y;
    cin >> X >> Y;

    int i;
    for (i = 0; X <= Y; i++) {
        X*=2;
    }

    cout << i << endl;
    
    return 0;
}

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

namespace PrimeNumber
{
    class Program
    {
        private static bool IsPrime(int n)
        {
            if (n < 2) return false;
            if (n == 2) return true;
            if (n % 2 == 0) return false;

            double l = Math.Sqrt(n);

            for (var i = 3; i <= l; i += 2)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            
            return true;
        }

        static void Main(string[] args)
        {
            int num;
            while (int.TryParse(Console.ReadLine(), out num))
                Console.WriteLine(Enumerable.Range(2, num - 1)
                .Where(i => IsPrime(i))
                .Count());
        }
    }
}


Measured memory_bytes: 9424
using System;
   namespace test{
      class program{
        static void Main()
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            if (a < b) Console.WriteLine("a < b");
            if (a > b) Console.WriteLine("a > b");
            if (a == b) Console.WriteLine("a == b");
        }
    }
}

Measured memory_bytes: 8844