akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CMultiplication3 solver = new CMultiplication3();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMultiplication3 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = Math.round(in.nextDouble() * 100);

            long answer = a * b;
            answer /= 100;

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }
}



Measured memory_bytes: 25692
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;



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


  int N;
  int count[100001] = {};
  cin >> N;

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

  int mx = 0;
  for (int i = 0; i < 100001 - 2; i++) {
    mx = max(mx, count[i] + count[i + 1] + count[i + 2]);
  }

  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
    int H, W, N, max, ans;
    cin >> H >> W >> N;
    if(H > W){
        max = H;
    }else{
        max = W;
    }
    if(N%max == 0){
        ans = N/max;
    }else{
        ans = N/max+1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N = int(readline())
graph = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, readline().split())
    graph[a].append(b)
    graph[b].append(a)

parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

MOD = 10**9 + 7
half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):
    p = parent[v]
    x = size[v]
    size[p] += x
    power_inv[i] = power_inv[i - 1] * half % MOD

ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) % MOD for i in size[2:])
ans -= N * power_inv[1] + power_inv[N] - 1
ans %= MOD

print(ans)

Measured memory_bytes: 59304
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
 
int main()
{
	int a, b;

	cin >> a >> b;

	if(a <= 0 && 0 <= b){
		cout << "Zero" << endl;
	}
	else if(a >= 1){
		cout << "Positive" << endl;
	}
	else{
		if((-a + b + 1) % 2 == 0){
			cout << "Positive" << endl;
		}
		else{
			cout << "Negative" << endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=2e5+10,MAXM=2e6+10;
const int INF=INT_MAX,MOD=1e9+7;
const ll llINF=~(1ll<<63);


int main()
{
    int n,ans;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i*108/100==n)ans=i;
    }
    if(ans*108/100==n)cout<<ans;
    else cout<<":(";
    return 0;
}


Measured memory_bytes: 256
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#a = list(map(int, input().split()))


n = int(input())
a = list(map(int, input().split()))

total=sum(a)

mindif=1e30
leftbest=-1

l=0
r=total

for i in range(n):
    l+=a[i]
    r-=a[i]
    if(abs(l-r)<mindif):
        mindif=abs(l-r)
        
print(mindif)

Measured memory_bytes: 89168
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int l=s.size();
    bool ok=false;
    for(int i=0;i<l;i++)
    {
        if(s[i]=='7')
        {
            ok=true;
            break;
        }
    }
    if(ok)  cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	ll x; cin>>x;
	ll p=x/11, q=x%11;
	ll ans=p*2;
	if(q>=7) ans+=2;
	else if(q>0) ans++;
	cout<<ans<<endl;

	return 0;
}


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

void quit(string s) {
    cout<<s<<endl;
    exit(0);
}

const int N = 1e5+7;
vector<pair<int, int>> edges;
vector<int> adj[N];

bool dfs(int u, int pe, int s, int t) {
    for (int e: adj[u]) {
        if (e == pe)    continue;
        int v = edges[e].first^edges[e].second^u;
        if (v == t) continue;
        if (v == s || dfs(v, e, s, t))    return true;
    }
    return false;
}

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

    int n, m;
    cin>>n>>m;

    for (int i=1; i<=m; i++) {
        int u, v;
        cin>>u>>v;
        edges.push_back({u, v});
        adj[u].push_back(edges.size()-1);
        adj[v].push_back(edges.size()-1);
    }

    for (int i=1; i<=n; i++) {
        int deg = adj[i].size();
        if (deg%2)  quit("No");
    }

    vector<int> fours;
    for (int i=1; i<=n; i++) {
        int deg = adj[i].size();
        if (deg>4)  quit("Yes");
        else if (deg == 4)  fours.push_back(i);
    }

    if (fours.size()>2) quit("Yes");
    if (fours.size()<2) quit("No");

    int a = fours[0], b = fours[1];
    cerr<<a<<" "<<b<<endl;
    if (dfs(a, -1, a, b))   quit("Yes");
    else                quit("No");
}


Measured memory_bytes: 8436
/*author @sushil*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sushil ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test() long long t;cin>>t;while(t--)
using namespace std;
int main()
{
    ll n,sum=0,i;
  cin>>n;
  for(i=1;i<=n;i++)
  {
      if((i%3!=0)&&(i%5!=0))
      {
          sum=sum+i;
      }
     
  }
  cout<<sum;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
*/

int main(){
    ll N,M;
    while(true){
        cin >> N >> M;
        if(N == 0 && M == 0)break;
        vector<vector<ll>> cost(M + 1,vector<ll>(M + 1,INF));
        vector<vector<ll>> time(M + 1,vector<ll>(M + 1,INF));
        ll p,q,c,t;
        rep(i,N){
            cin >> p >> q >> c >> t;
            cost[p][q] = c;
            cost[q][p] = c;
            time[p][q] = t;
            time[q][p] = t;
        }
        rep(k,M + 1){
            rep(i,M + 1){
                rep(j,M + 1){
                    cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
                    time[i][j] = min(time[i][j],time[i][k] + time[k][j]);
                }
            }
        }
        ll K;
        cin >> K;
        vector<ll> fr(K);
        vector<ll> to(K);
        vector<ll> ti(K);
        rep(i,K)cin >> fr[i] >> to[i] >> ti[i];
        rep(i,K){
            if(ti[i] == 1){
                cout << time[fr[i]][to[i]] << "\n";
            }
            else{
                cout << cost[fr[i]][to[i]] << "\n";
            }
        }
    }
}



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

using namespace std;

int calc(string a) {
    int res = 0;
    for (int i = 1; i < (int)a.length(); ++i) {
        if (a[i] == 'B' && a[i - 1] == 'A') ++res;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);    
    int n;
    cin >> n;
    vector<string> s(n);
    int ans = 0;
    int x = 0, y = 0, z = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        ans += calc(s[i]);
        if (s[i][0] == 'B') {
            if (s[i][s[i].length() - 1] == 'A') {
                ++y;
            } else {
                ++z;
            }
        } else {
            if (s[i][s[i].length() - 1] == 'A') {
                ++x;
            }
        }
    }
    if (x > 0 && z > 0) {
        --x;
        --z;
        ans += y + 1;
        y = 0;
        ans += min(x, z);
    } else {
        if (x == 0 && z == 0) {
            if (y > 0) {
                ans += y - 1;
            }
        } else {
            ans += y;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 768
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef complex<double> P;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n;
P p[50];

int main(){
	cin >> n;
	rep(i, n) cin >> p[i].real() >> p[i].imag();
	if(n % 2){
		cout << "NA" << endl;
		return 0;
	}
	rep(i, n) if(p[i] - p[(i + 1) % n] != p[(i + n / 2 + 1) % n] - p[(i + n / 2) % n]){
		cout << "NA" << endl;
		return 0;
	}
	P g;
	rep(i, n) g += p[i];
	printf("%.9f %.9f\n", g.real() / n, g.imag() / n);
	return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <ctime>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 1LL << 62
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> F[i];
    
    sort(all(A));
    sort(all(F));
    reverse(all(F));
    ll l = -1, r = inf;
    while(r - l > 1) {
        ll m = (l + r) / 2;
        ll k = 0;
        rep(i, N) {
            if(A[i] * F[i] > m) k += A[i] - m / F[i];
        }
        if(k <= K) r = m;
        else l = m;
    }
    output(r);
    
    
    return 0;
}



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

ll ceil(ll a, ll b){
    if(a >= 0){
        return (a+b-1)/b;
    }else{
        return a/b;
    }
}

ll floor(ll a, ll b){
    if(a < 0){
        return (a-b+1)/b;
    }else{
        return a/b;
    }
}

int main(){
    ll N, K;  cin >> N >> K;
    vector<ll> A(N);
    for(ll i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    ll low = -1e18-1, high = 1e18;
    while(high - low > 1){
        ll mid = (high + low) / 2;
        ll cnt = 0;
        for(ll i=0; i<N; i++){
            ll a = A[i];
            if(a == 0){
                if(mid >= 0) cnt += N - i - 1;
            }else if(a > 0){
                ll t = floor(mid, a);
                cnt += upper_bound(A.begin() + i + 1, A.end(), t) - (A.begin() + i + 1);
            }else{
                ll t = ceil(-mid, -a);
                cnt += A.end() - lower_bound(A.begin() + i + 1, A.end(), t);
            }
        }

        if(cnt >= K){
            high = mid;
        }else{
            low = mid;
        }
    }
    cout << high << endl;
}


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

using namespace std;

void solve(void)
{
	double w, h, x, y, eps = 1e-9;
	cin >> w >> h >> x >> y;
	cout << fixed << setprecision(12) << w * h / 2 << endl;
	if (fabs(x * 2 - w) < eps && fabs(y * 2 - h) < eps)
	{
		cout << 1 << endl;
	}
	else
	{
		cout << 0 << endl;
	}
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.StreamTokenizer;
import java.util.InputMismatchException;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in); 
		Printer pr = new Printer(System.out); 

		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		
		int[][] a = new int[n][m];
		int[][] b = new int[m][l];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < l; j++) {
				b[i][j] = sc.nextInt();
			}
		}

//		int[][] c = new int[n][l];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				long c = 0;
				for (int k = 0; k < m; k++) {
//					c[i][j] += a[i][k] * b[k][j];
					c += a[i][k] * b[k][j];
				}
				if (j != 0) {
					pr.print(" ");
				}
				pr.print(c);
			}
			pr.println("");
		}

		pr.close();
		sc.close();
	}

	@SuppressWarnings("unused")
	private static class Scanner {
		InputStreamReader isr;
		BufferedReader br;
		StreamTokenizer st;

		private Scanner() {
		}

		Scanner (InputStream in) {
			isr = new InputStreamReader(in);
			br = new BufferedReader(isr);
			st = new StreamTokenizer(br);
		}

		String next() throws RuntimeException  {
			try {
				if (st.nextToken() != StreamTokenizer.TT_WORD) {
				}
			} catch (IOException e) {
				throw new IllegalStateException();
			}

			return st.sval;
		}

		int nextInt() throws RuntimeException {
			try {
				if (st.nextToken() != StreamTokenizer.TT_NUMBER) {
					throw new InputMismatchException();
				}
			} catch (IOException e) {
				throw new IllegalStateException();
			}

			return (int)st.nval;
		}

		void close() {
		}
	}

	@SuppressWarnings("unused")
	private static class Printer {
		PrintStream out;
		StringBuffer strbuf;
		int bufSize;
		final String CR;

		Printer(PrintStream out) {
			this.out = out;
			strbuf = new StringBuffer();
			bufSize = 64 * 1024;
			CR = System.getProperty("line.separator");
		}

		void println(String str) {
			strbuf.append(str);
			strbuf.append(CR);
			checkStringBuffer();
		}

		void print(String str) {
			strbuf.append(str);
			checkStringBuffer();
		}

		void println(int n) {
			strbuf.append(n);
			strbuf.append(CR);
			checkStringBuffer();
		}

		void print(int n) {
			strbuf.append(n);
			checkStringBuffer();
		}

		void print(long n) {
			strbuf.append(n);
			checkStringBuffer();
		}

		void print(char c) {
			strbuf.append(c);
			checkStringBuffer();
		}

		void printArray(int[] array) {
			for (int i = 0; i < array.length; i++) {
				checkStringBuffer();
				strbuf.append(array[i]);
				strbuf.append(" ");
			}
			strbuf.delete(strbuf.length() - 1, strbuf.length());
			strbuf.append(CR);
		}

		void close() {
			flashStringBuffer();
		}

		private void flashStringBuffer() {
			if (strbuf.length() > 0) {
				out.print(strbuf);
				strbuf.setLength(0);
			}
		}

		private void checkStringBuffer() {
			if (strbuf.length() > bufSize) {
				out.print(strbuf);
				strbuf.setLength(0);
			}
		}
	}
}

Measured memory_bytes: 27116
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>
 
using namespace std;
 
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define INFL 2000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;

int main(void){
	int N,M;
	cin>>N>>M;
	vi a(N),b(N),c(M),d(M);
	rep(i,N){
		cin>>a[i]>>b[i];
	}
	rep(i,M){
		cin>>c[i]>>d[i];
	}
	rep(i,N){
		int min = INF;
		int ans;
		rep(j,M){
			int dist = abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(dist<min){
				min=dist;
				ans = j;
			}
		}
		cout<<ans+1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 222222;
pair<int, int> a[N];
int ans[N];
int n;

int main() {
    ios::sync_with_stdio(false);
    cout.precision(10);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    for(int i = 1; i <= n; i++) {
        if(i <= n / 2) {
            ans[a[i].second] = a[n / 2 + 1].first;
        } else {
            ans[a[i].second] = a[n / 2].first;
        }
    }
    for(int i = 1; i <= n; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;
bool debug = true;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  ll ans = B - A + 1;
  ans -= (B / C - (A - 1) / C);
  ans -= (B / D - (A - 1) / D);
  ll lcm = C * D / __gcd(C, D);
  ans += (B / lcm - (A - 1) / lcm);
  cout << ans << "\n";
}


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

int mod = 1000000007;
int64_t large = 9223372036854775807;

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

    vector<vector<int>> list(N, vector<int>(D));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            cin >> list[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int distance = 0;
            for (int k = 0; k < D; k++)
            {
                distance += (pow(list[i][k] - list[j][k], 2));
            }
            for (int l = 0; l * l <= distance; l++) 
                if (l * l == distance)
                    ans++;
            
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
main(){
  int a,b[3],c,i,j,k,n;
  char s[8];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<3;j++)
      b[j]=0;
    c=0;
    for(a=0;a!=3;){
      scanf(" %s",s);
      if(strcmp(s,"OUT")==0)
	a++;
      else if(strcmp(s,"HIT")==0)
	if(b[2])
	  c++;
	else if(b[1])
	  b[2]=1;
	else if(b[0])
	  b[1]=1;
	else
	  b[0]=1;
      else if(strcmp(s,"HOMERUN")==0){
	for(j=0;j<3;j++)
	  if(b[2-j]){
	    c+=4-j;
	    break;
	  }
	if(j==3)
	  c++;
	for(j=0;j<3;j++)
	  b[j]=0;
      }
    }
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
# A=500,B=100,C=50

a = int(input())
b = int(input())
c = int(input())
x = int(input())
cou = 0

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            s = ia * 500 + ib * 100 + ic * 50
            if s == x:
                cou += 1
print(cou)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,k;
  cin>>n>>k;
  vll a(n),f(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>f[i];
  sort(all(a));
  sort(rall(f));
  ll l=-1;
  ll r=1e12;
  while(l+1<r){
    ll cu=0;
    ll mid=(l+r)/2;
    rep(i,n){
      if(a[i]*f[i]>mid){
        cu+=a[i]-mid/f[i];
      }
    }
    if(cu<=k){
      r=mid;
    }
    else l=mid;
  }
  COUT(r);
}


Measured memory_bytes: 6428
open Printf
open Scanf

let () =
  let h, w = scanf "%d %d " (fun x y -> (x, y)) in
  let ar = Array.make_matrix h w 0 in
  let rec read i =
    if i = h then () else
      let s = scanf "%s " (fun x -> x) in
      String.iteri (fun j c -> if c = '#' then ar.(i).(j) <- (-1) else ()) s;
      read (i + 1) in
  read 0;
  let idx i j = [(i+1, j);(i-1, j);(i, j+1);(i, j-1);(i-1, j-1);(i-1, j+1);(i+1, j-1);(i+1, j+1)] |>
                   List.filter (fun (x, y) -> x >= 0 && x < h && y >= 0 && y < w) in
  Array.iteri (fun i a ->
               Array.iteri (fun j v ->
                            if v = (-1) then
                              List.iter (fun (x, y) ->
                                         if ar.(x).(y) >= 0 then
                                           ar.(x).(y) <- ar.(x).(y) + 1 else ()) (idx i j) else ()) a) ar;
  Array.iter (fun a -> Array.iter (fun v -> if v = (-1) then printf "#" else printf "%d" v) a; printf "\n") ar


Measured memory_bytes: 2560
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
typedef pair<int,PP> PPP;
struct edge { int to;  int cost; };

int t[100005], a[100005], h[100005],h2[100005];

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> t[i];
	rep(i, n)cin >> a[i];

	h[0] = t[0];
	h2[n - 1] = a[n - 1];
	rep(i, n - 1) {
		if (t[i] < t[i + 1]) {
			h[i+1] = t[i + 1];
		}
	}

	for (int i = n - 1; i >= 1; i--) {
		if (a[i - 1] > a[i]) {
			h2[i - 1] = a[i - 1];
		}
	}
	int ans = 1;
	rep(i, n) {
		if (!h[i] && !h2[i]) {
			ans *= min(a[i], t[i]);
			ans %= mod;
		}
		else if (h[i] && h2[i] && h[i] != h2[i])ans *= 0;
		else if (h[i] && !h2[i] && a[i] < t[i])ans *= 0;
		else if (!h[i] && h2[i] && a[i] > t[i])ans *= 0;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();

		sc.close();
		int ans = 0;
		if((A+B) <= 2*C){
			ans = A*X + B*Y;
		}
		else{
			ans = Math.min(X, Y) * 2 * C;
			if(X-Y == 0){

			}
			else if(X-Y>0){
				if(A/2 > C){
					ans += (X-Y)*C*2;
				}
				else{
					ans += (X-Y)*A;
				}
			}
			else{
				if(B/2 > C){
					ans += (Y-X)*C*2;
				}
				else{
					ans += (Y-X)*B;
				}
			}
		}
		System.out.println(ans);
	}

}

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


int main(){
	int n,d,x;
	int a[110];


	cin>>n;
	cin>>d>>x;

	int res = x+n;

	for(int i = 1; i <= n; i++) cin>>a[i];

	for(int i = 1; i <= n;i++){
		for(int j = 1; j <= d;j++){
			int day = (j*a[i])  + 1;
			if(day <= d) res++;
		}

	}

	cout<<res<<"\n";

}


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

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  int counter = 0;
  int s_lenght = s.length();
  
  for (int i = 0; i < s_lenght; i++) {
    if (s[i] != t[i]) {
      counter++;
    }
  }

  printf("%d", counter);
  return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll h,w,d;cin>>h>>w>>d;
    ll a[h][w];for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)cin>>a[i][j],a[i][j]--;
    vector< pair<ll , pair<ll,ll> > >pos[d];
    for(ll i=0;i<h;i++)for(ll j=0;j<w;j++)pos[a[i][j]%d].push_back({a[i][j] , {i,j} });
    vector< ll > prfx[d];
    for(ll i=0;i<d;i++){
        sort(pos[i].begin(),pos[i].end());
       // cout<<"I: "<<i<<"-->";
        //for(auto &ele:pos[i])cout<<ele.first<<"-{"<<ele.second.first<<" "<<ele.second.second<<"} ";cout<<endl;
        prfx[i].push_back(0);
        for(ll j=1;j<pos[i].size();j++)
            prfx[i].push_back( abs(pos[i][j].second.first-pos[i][j-1].second.first) + abs(pos[i][j].second.second - pos[i][j-1].second.second));
        for(ll j=1;j<prfx[i].size();j++)prfx[i][j]+=prfx[i][j-1];
       // for(auto &ele:prfx[i])cout<<ele<<" ";cout<<endl;
    }
    ll q;cin>>q;
    while(q--){
        ll l,r;cin>>l>>r;
        l--;r--;
        ll idx = l%d;
        ll s = l/d , e = r/d;
        ll ans = prfx[idx][e]  - prfx[idx][s];
        cout<<ans<<"\n";
    }
}


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

#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define mod 1000000007

ll a[100005];
ll solve(ll n, ll k){

	ll dp[n+2][k+2];

	for(ll j = 0 ; j <= k ; j++)
		dp[1][j] = ((j>a[1])?0:1);

	for(ll i = 2 ; i <= n ; i++){
		for(ll j = 0 ; j <= k ; j++){
			if(j == 0)
				dp[i][j] = dp[i-1][j];
			else{
				ll x = (((j-a[i]-1)>=0)?dp[i-1][j-a[i]-1]:0);
				dp[i][j] = (dp[i][j-1] + dp[i-1][j] - x + mod)%mod;
			}
		}
	}
	return dp[n][k];
}

int main(){
	fastIO

	ll n,k;
	cin>>n>>k;
	F1(a,n);
	cout<<solve(n,k)<<endl;

	return 0;
}

Measured memory_bytes: 78464
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c[4] = {},i;cin >> n;
  string s;
  for(i=0;i<n;i++){
    cin >> s;
    if(s == "AC") c[0]++;
    else if(s == "WA") c[1]++;
    else if(s == "TLE") c[2]++;
    else c[3]++;
  }
  cout << "AC x " << c[0] << "\nWA x " << c[1] << "\nTLE x " << c[2] << "\nRE x " << c[3] << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
typedef long long ll;
typedef long double ld;

using namespace std;
int inf=1e9;
vector<ll> a;
vector<ll> b;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(100);
  //  freopen("input.txt","r",stdin);
    int n;
    cin>>n;
    ll ans=0;
    ll tek=0;
    a.resize(n+1);
    b.resize(n+1);
    for(int i=0;i<n+1;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    b[n]=0;
    for(int i=0;i<n;i++){
        if(a[i]>b[i]){
            ans+=b[i];
        }
        else{
            ans+=a[i];
            b[i]-=a[i];
            ans+=min(a[i+1],b[i]);
            a[i+1]-=min(a[i+1],b[i]);
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>
//#include <functional>
//#include <cmath>

int main(){
    int32_t N;
    std::cin >> N;
    //brute force: sort O(NlogN) and if the max val is Ai, take the next O(N). looks fine.
    std::vector<int32_t> orig(N);
    std::vector<int32_t> sorted(N);
    for(int32_t i = 0; i < N; i++){
        std::cin >> orig[i];
        sorted[i] = orig[i];
    }
    std::sort(sorted.begin(), sorted.end());
    for(int32_t i = 0; i < N; i++){
        if(orig[i] == sorted[N-1]){
            std::cout << sorted[N-2] << std::endl;
        }
        else{
            std::cout << sorted[N-1] << std::endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3200
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*(N+1)
B[0]=1;c=0;d=0
if B[0] in A:c=B[0]
for i in range(1,N+1):
  B[i]=A[B[i-1]-1]
#  if c==B[i]:break
#  if A.count(B[i])>1 and d==0:c=B[i];d+=1

d=B.index(B[-1])+1
#print(B.index(B[N-1]))

#print(B,d)
#print(d+1+(K-d-1)%(N-d-1))
#print(B[K],K,d,(K+1-d),(N+1-d))
if K<=N:print(B[K]);exit()
if (K+1-d)%(N+1-d)==0:print(B[-1])
else:print(B[d-1+(K+1-d)%(N+1-d)])
#print(B[d+1+(K-d-1)%(N-d-1)]-1)

Measured memory_bytes: 32248
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int b = sc.nextInt(); 
        int a = sc.nextInt();
		int [] in = new int [a];
        int [] in2 = new int [a];
        int c = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
		for(int i=0;i<a-1;i++){
                               in2[i] = in[i+1]-in[i];
                              }
		in2[a-1] = b+in[0]-in[a-1];
        Arrays.sort(in2);
		System.out.println(b-in2[a-1]);
	}
}


Measured memory_bytes: 83660
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000000000000;
//input
string S,T;

//processing



//dpTable
//int dp[100050];

int main(){
    cin >> S >> T;
    sort(S.begin(),S.end());
    sort(T.begin(),T.end());
    reverse(T.begin(),T.end());
    if (S < T) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3572
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define y1 hogwhoasjfd

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

int w, h;
int n;
int x1[1005], x2[1005];
int y1[1005], y2[1005];

bool fld[1005*6+2][1005*6+2];

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

int compress(int *x1, int *x2, int w)
{
    vi xs;

    rep(i, n) {
        for (int d = -1; d <= 1; ++d) {
            int tx1 = x1[i] + d, tx2 = x2[i] + d;

            if (0 <= tx1 && tx1 <= w) xs.PB(tx1);
            if (0 <= tx2 && tx2 <= w) xs.PB(tx2);
        }
    }

    sort(all(xs));
    xs.erase(unique(all(xs)), end(xs));

    rep(i, n) {
        x1[i] = lower_bound(all(xs), x1[i]) - begin(xs);
        x2[i] = lower_bound(all(xs), x2[i]) - begin(xs);
    }

    return xs.size();
}

int main()
{
    while (cin >> w >> h, w) {
        cin >> n;

        memset(fld, 0, sizeof fld);

        rep(i, n) {
            cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
        }

        w = compress(x1, x2, w);
        h = compress(y1, y2, h);

        rep(i, n) {
            for (int y = y1[i]; y <= y2[i]-1; ++y) {
                for (int x = x1[i]; x <= x2[i]-1; ++x) {
                    fld[y][x] = true;
                }
            }
        }

        int ans = 0;

        rep(y, h-1) rep(x, w-1) {
            if (fld[y][x]) continue;

            ans++;

            queue<pii> q;
            q.push(pii(y, x));

            while (q.size()) {
                pii p = q.front(); q.pop();
                rep(i, 4) {
                    int ny = p.fst + dy[i], nx = p.scd + dx[i];

                    if (ny < 0 || ny >= h-1 || nx < 0 || nx >= w-1 || fld[ny][nx]) continue;

                    fld[ny][nx] = true;
                    q.push(pii(ny, nx));
                }
            }
        }

        cout << ans << endl;
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int minimum;
  
  for (int A = 0; A < N; A++) {
    // 操作Aの回数がAの時の数を計算
    int x = 1;
    for (int i = 0; i < A; i++)
      x *= 2;  
    for (int i = 0; i < N - A; i++)
      x += K;
    // 操作Aの回数がAの時の数を計算
    
    int y = (x - K * (N - A)) * 2 + K * (N - A - 1); // AがA+1回の時の数
    
    int smaller = min(x, y); //x,yの小さい方をsmallerとする
    
    // これまでの最小値とsmallerを比べてminimumを更新
    if (A == 0)
      minimum = smaller;
    else
      minimum = min(minimum, smaller);
    // これまでの最小値とsmallerを比べてminimumを更新
  }
  
  cout << minimum << endl;
}

Measured memory_bytes: 256
N,K=input().split()
nums = input().split()
cand = list(map(str,list(x for x in range(10))))
for num in nums:
  if num in cand:
    cand.remove(num)
work = []
if int(N) <= int(cand[-1]*len(N)):
  for i in range(len(N)):
    for c in cand:
      if int(N[i]) == int(c):
        work.append(c)
        break
      elif int(N[i]) < int(c):
        work.append(c)
        for j in range(i+1,len(N)):
          work.append(cand[0])
        print(''.join(work))
        exit()
else:
  if cand[0] != '0':
    work.append(cand[0])
  else:
    work.append(cand[1])
  for i in range(len(N)):
    work.append(cand[0])
print(''.join(work))

Measured memory_bytes: 3064
import itertools as itr

n = int(input())

march = [0,0,0,0,0]
tops = list(range(5))

for i in range(n):
    name = input()
    if name[0] == 'M':
        march[0] += 1
    elif name[0] == 'A':
        march[1] += 1
    elif name[0] == 'R':
        march[2] += 1
    elif name[0] == 'C':
        march[3] += 1
    elif name[0] == 'H':
        march[4] += 1

total = 0

for kumiawase in itr.combinations(tops,3):
    total += march[kumiawase[0]]*march[kumiawase[1]]*march[kumiawase[2]]

print(total)

Measured memory_bytes: 3188
K = int(input())
ans = '-1'
mod = 7%K
path = [mod]
for i in range(1,K+1):
  if mod == 0:
    ans = i
    break
  mod = (mod*10 + 7)%K
  path.append(mod)
  if mod == path[0]:
    ans = '-1'
    break
print(ans)


Measured memory_bytes: 48640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
signed main(){
  int k,a,b;
  cin>>k>>a>>b;
  FOR(i,a,b){
    if(i%k==0) {
      cout<<"OK"<<endl;
      return 0;
    }
  }

  cout<<"NG"<<endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long h,n,ans=0;
    cin>>h>>n;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
        ans+=arr[i];
    }
    if(ans>=h)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;

    return  0;
}


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

int A, B, M;
int main() {
  cin >> A >> B >> M;
  int a[A], b[B];
  int minA = 1e9;
  int minB = 1e9;
  for (int i = 0; i < A; i++) {
    cin >> a[i];
    minA = min(minA, a[i]);
  }
  for (int i = 0; i < B; i++) {
    cin >> b[i];
    minB = min(minB, b[i]);
  }
  int ans = minA + minB;

  int x, y, c;
  for (int i = 0; i < M; i++) {
    cin >> x >> y >> c;
    x--;
    y--;
    ans = min(ans, a[x] + b[y] - c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        n--;
        int ans = 0;
        for (int i=1;i<=n;i++) {
           ans += n/i;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <deque>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

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

int main() {
    int A, B; cin >> A >> B;
    int res = A + B;
    res = max(res, A-B);
    cout << max(res, A * B) << endl;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func scan() string {
	var n string
	fmt.Scan(&n)
	return n
}

func scanInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func scanMutliInt() (int, int) {
	var n, m int
	fmt.Scan(&n, &m)
	return n, m
}
func main() {
	a := scan()
	// days := []string{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}
	days := []string{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}
	for i, j := range days {
		if a == j {
			fmt.Println(7 - i)
		}
	}

	// a, b := scanMutliInt()

	// fmt.Println(a, b)
	// first := scan()
	// second := scanInt()
	// fmt.Println(first)
	// fmt.Println(second)
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    int N; cin >> N;
    vector<ll> leaf(N+2);
    vector<ll> unleaf(N+2);
    ll leafall = 0;

    REP(i,N + 1){
        cin >> leaf[i];
        leafall += leaf[i];
    }


    if (N == 0){
        if (leaf[0] == 1) cout << 1 << endl;
        else cout << -1 << endl;
        return 0;
    }

    
    ll ans = 0;
    ll all = 1;
    ll allp = 0;
    REP(i,N + 1){
        leafall -= leaf[i];
        if (i == 0) unleaf[i] = all - leaf[i];
        else unleaf[i] = min(leafall, unleaf[i - 1] * 2 - leaf[i]);
        if (unleaf[i] < 0){
            cout << -1 << endl;
            return 0;
        }
    }

    REP(i,N+1){
        //DB2(leaf[i],unleaf[i]);
        ans += leaf[i] + unleaf[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define prt_cs                  printf("Case %lld: ",cs)
#define sqr(x)                  (x)*(x)
#define ms(a,b)                 memset(a, b, sizeof(a))
#define db                      double
#define ll                      long long int
#define MOD                     1000000007
#define PI                      2*acos(0.0)
#define pii                     pair< int, int >
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
#define gcd(a, b)               __gcd(a, b)
#define lcm(a, b)               (((a)*(b))/gcd(a,b))
#define MAX                     100005

using namespace std;

char grid[1001][1001];
ll dp[1001][1001][2];
int r,c;

ll solve(int i,int j,int rm)
{
    if(i==r-1 && j==c-1)
    {
//        cerr<<">> "<<i<<" "<<j<<endl;
        return 1;
    }
    if(dp[i][j][rm]!=-1)return dp[i][j][rm];
    ll ans=0;
    if(grid[i][j+1]!='#' && i<r && j+1<c)
    ans+=solve(i,j+1,1);
    if(ans>=MOD)ans%=MOD;
    if(grid[i+1][j]!='#' && i+1<r && j<c)
    ans+=solve(i+1,j,0);
    if(ans>=MOD)ans%=MOD;
    return dp[i][j][rm]=ans%MOD;
}

int main()
{
//    READ;
//    WRITE;
    scanf("%d %d",&r,&c);
    getchar();
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++)
        {
//            scanf("%c",&grid[i][j]);
            grid[i][j]=getchar();
        }
        getchar();
    }
//    for(int i=0;i<r;i++)
//    {
//        for(int j=0;j<c;j++)
//        {
//            printf("%c",grid[i][j]);
//        }
//        printf("\n");
//    }

    ms(dp,-1);
    ll ans=solve(0,0,0);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 17152
N = int(input())
BAs = {}
for i in range(N):
    A, B = map(int, input().split())
    if not B in BAs:
        BAs[B] = A
    else:
        BAs[B] += A
BAs = sorted(BAs.items())
Bs, As = map(list, zip(*BAs))
for i in range(len(BAs) - 1):
    if As[i] > Bs[i]:
        print('No')
        exit()
    As[i + 1] += As[i]
if As[len(BAs) - 1] > Bs[len(BAs) - 1]:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 47300
n, m = map(int, input().split())
roads = dict([(i,0) for i in range(n+1)])
#print(roads)
for i in range(m):
  a, b = map(int, input().split())
  roads[a] += 1
  roads[b] += 1
#print(roads)
for i in range(1, n+1):
  print(roads[i])

Measured memory_bytes: 3060