akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
typedef long long ll;
int main(){
    ll a,b,c;
    cin>>a>>b>>c;

    if(c-a-b<0){
        cout<<"No"<<endl;
    }else if(4*a*b<(c-a-b)*(c-a-b)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    


    return 0;
}

Measured memory_bytes: 256
public class Main {
	MyScanner sc = new MyScanner();
	int N, M, a, b, w;
	int[] parent;
	Node[] node;

	void run() {
		for (;;) {
			N = sc.nextInt(); // 荷物数
			M = sc.nextInt(); // クエリ数
			if ((N | M) == 0) {
				return;
			}
			parent = new int[N + 1];
			node = new Node[N + 1];
			init();

			for (int i = 0; i < M; i++) {
				String query = sc.next();
				a = sc.nextInt();
				b = sc.nextInt();
				if (query.equals("!")) {
					w = sc.nextInt();
					union(a, b, w);
				} else if (query.equals("?")) {
					System.out.println(same(a, b) ? node[b].weight
							- node[a].weight : "UNKNOWN");
				}
			}
		}
	}

	void init() {
		for (int i = 0; i <= N; i++) {
			parent[i] = i;
			node[i] = new Node(0, 0);
		}
	}

	void union(int x, int y, int w) {
		int rootX = find(x);
		int rootY = find(y);
		if (rootX == rootY) {
			return;
		}
		if (node[rootX].rank < node[rootY].rank) {
			node[rootX].weight = -w - node[x].weight + node[y].weight;
			parent[rootX] = rootY;
		} else {
			node[rootY].weight = w - node[y].weight + node[x].weight;
			parent[rootY] = rootX;

			if (node[rootX].rank == node[rootY].rank) {
				node[rootX].rank++;
			}
		}
	}

	int find(int target) {
		if (parent[target] == target) {
			return target;
		} else {
			int tmp = find(parent[target]);
			node[target].weight += node[parent[target]].weight;
			return parent[target] = tmp;
		}
	}

	boolean same(int x, int y) {
		return find(x) == find(y);
	}

	class Node {
		int weight;
		int rank;

		/**
		 * @param weight
		 * @param rank
		 */
		public Node(int weight, int rank) {
			super();
			this.weight = weight;
			this.rank = rank;
		}
	}

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

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

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

const ll MOD = 1e9+7;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  int cnt = 0;
  rep(i, n) {
    int a, b, c;
    rep(j, n) {
      if(j <= i) continue;
      rep(k, n) {
        if(k <= j) continue;  
        if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
          a = l[i];
          b = l[j];
          c = l[k];
          if(a+b > c && b+c > a && a+c > b) ++cnt;
        }
      }
    }
  }
  
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3620
//c++

#include <iostream>
#include <string>

using namespace std;

#define REP(i,n) for(int i = 0;i < n;i++)

int main(){
	int a,b;
	cin >> a >> b;
	if(a % b == 0)cout << 0  <<endl;
	else cout << 1 <<endl;
}

Measured memory_bytes: 256
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=4005;
const int mod=998244353;
int n,cnt1,cnt2;
string s;
char c[maxn];
int dp[maxn][maxn],id1[maxn],id2[maxn];

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	c[0]='a';scanf("%s",c+1);n=strlen(c)-1;
	REP(i,n){
		if(c[i]=='0')id1[++cnt1]=i,id1[++cnt1]=i;
		else if(c[i]=='1')id1[++cnt1]=i,id2[++cnt2]=i;
		else id2[++cnt2]=i,id2[++cnt2]=i;
	}
	dp[0][0]=1;
	rep(i,2*n)rep(j,min(i,cnt1)+1){
		int cur=dp[i][j],k=i-j;
		if(j+1<=cnt1&&id1[j+1]<=i+1)dp[i+1][j+1]=(dp[i+1][j+1]+cur)%mod;
		if(k+1<=cnt2&&id2[k+1]<=i+1)dp[i+1][j]=(dp[i+1][j]+cur)%mod;
	}
	printf("%d\n",dp[2*n][cnt1]);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 61440
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int arr[] = {s.nextInt(),s.nextInt(),s.nextInt()};
        Arrays.sort(arr);
        System.out.println(arr[0]+arr[1]);
    }


}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25352
K=int(input())

num=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(num[K-1])

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

void DBG() { cerr << endl; }
template<typename Head, typename... Tail>
void DBG(Head H, Tail... T) { cerr << ' ' << H; DBG(T...); }
#ifdef NAIM
#define dbg(...) cerr << "(" << (#__VA_ARGS__) << "):", DBG(__VA_ARGS__)
#else 
#define dbg(...)
#endif

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ll long long
#define ints(a...) int a; read(a)
#define IN(a) for (auto &it : a) cin >> it

void solve() {
    ints(n, m, x);
    vector<int> v[n], c(n);
    for (int i = 0; i < n; i++) { // books
        ints(in);
        c[i] = in;
        for (int j = 0; j < m; j++) { // algos
            ints(in);
            v[i].emplace_back(in);
        }
    }

    int ans = 1e9;
    for (int maskx = 0; maskx < 1 << n; maskx++) { // selecting books
        vector<int> cnt(m);
        int cost = 0;
        for (int i = 0; i < n; i++) {
            if (!(maskx & (1 << i))) continue;
            for (int j = 0; j < m; j++) cnt[j] += v[i][j];
            cost += c[i];
        }

        bool f = 1;
        for (int i = 0; i < m; i++) if (cnt[i] < x) f = 0;
        if (f) ans = min(ans, cost);
    }

    cout << (ans == 1e9 ? -1 : ans);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1; 
    // cin >> T;
    while (T--) solve();
    return 0;
}

Measured memory_bytes: 3664
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

    queries.sort(key=lambda x:x[0])

    temp_que = []
    for num, val in queries:
        temp_que = num
        K -= val
        if K <= 0:
            break

    print(temp_que)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 26968
from collections import Counter


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


n = int(input())
p = prime_factorize(n)
c = Counter(p)

ans = 0
for key, value in c.most_common():
    x = 1
    while x <= c[key]:
        ans += 1
        c[key] -= x
        x += 1

print(ans)


Measured memory_bytes: 9464
#include<bits/stdc++.h>
using namespace std;
const int u=100010;
char s[u],a[u];
int main()
{
	int l,i;
	cin>>s;
	l=strlen(s);
	for(i=0;i<l;++i)
	{
		a[l-i-1]=s[i];
		if(a[l-i-1]=='b')
			a[l-i-1]='d';
		else if(a[l-i-1]=='d')
			a[l-i-1]='b';
		else if(a[l-i-1]=='p')
			a[l-i-1]='q';
		else if(a[l-i-1]=='q')
			a[l-i-1]='p';
	}

	if(strcmp(s,a)==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000
 
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
 
int main() {
    int n,m;
    cin>>n>>m;
    vint ps(m),pe(m);
    vector<vector<int>> root(n);
    vector<vector<int>> true_root(n);
    vint minans0(n),minans1(n),minans2(n);

    rep(i,m){
        int x,y;
        cin>>x>>y;
        root[x-1].pb(y-1);
        //root[y-1].pb(x-1);
    }
    int s,t;
    cin>>s>>t;
    s--;
    t--;
    rep(i,n){
        minans0[i]=inf;
        minans1[i]=inf;
        minans2[i]=inf;
    }


    priority_queue<pii,vector<pii>,greater<pii>> que;
    que.push(mp(0,s));
    while(!que.empty()){
        pii q=que.top();
        que.pop(); 
        if(q.first%3==0){
            if(minans0[q.second]<=q.first){
                continue;
            }
            minans0[q.second]=q.first;
        } 
        if(q.first%3==1){
            if(minans1[q.second]<=q.first){
                continue;
            }
            minans1[q.second]=q.first;
        } 
        if(q.first%3==2){
            if(minans2[q.second]<=q.first){
                continue;
            }
            minans2[q.second]=q.first;
        } 

        
        
        for(auto x:root[q.second]){
            que.push(mp(q.first+1,x));
        }   
    }     

    if(minans0[t]==inf){
        cout<<-1<<endl;
    }
    else{
        cout<<minans0[t]/3<<endl;
    }


}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
struct segtree{
    static const int SEG=1<<18;
    vint dat;
    segtree():dat(SEG*2){}
    void update(int k,int x){
        k+=SEG-1;
        chmax(dat[k],x);
        while(k){
            k=(k-1)/2;
            dat[k]=max(dat[k*2+1],dat[k*2+2]);
        }
    }
    int query(int a,int b,int k=0,int l=0,int r=SEG){
        if(r<=a||b<=l)return 0;
        if(a<=l&&r<=b)return dat[k];
        return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
    }
};
 
 
int N;
int A[111111],B[111111];
 
vint x[222222];
vint y[222222];
 
signed main(){
    scanf("%lld",&N);
 
    vint vs;
    rep(i,N){
        scanf("%lld%lld",&A[i],&B[i]);
        vs.pb(A[i]);
        vs.pb(B[i]);
    }
 
    sort(all(vs));vs.erase(unique(all(vs)),vs.end());
    rep(i,N){
        A[i]=lower_bound(all(vs),A[i])-vs.begin();
        B[i]=lower_bound(all(vs),B[i])-vs.begin();
        x[A[i]].pb(B[i]);
        y[B[i]].pb(A[i]);
    }
 
    segtree latte,malta;
    for(int i=0;i<222222;i++){
        vpint c,d;
        for(auto w:x[i]){
            c.pb({w,malta.query(0,w)+1});
        }
        for(auto w:y[i]){
            d.pb({w,latte.query(0,w)+1});
        }
        for(auto p:c)latte.update(p.fi,p.se);
        for(auto p:d)malta.update(p.fi,p.se);
    }
 
    cout<<max(latte.query(0,vs.size()),malta.query(0,vs.size()))<<endl;
    return 0;
}

Measured memory_bytes: 31696
#include<bits/stdc++.h>
using namespace std;
int arr[100001];
int n,dp[100001],k;
int main()
{
    cin >> n >>k;
    for(int i = 1; i <= n; i++)
        cin >> arr[i];
    for(int i = 2; i <= n; i++)
    {
        dp[i] = 1e9;
        for(int j = 1; j <= k; j++)
        {
            if(i - j <= 0) break;
            dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
        }
    }
    cout << dp[n];
}







Measured memory_bytes: 4400
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
W = rl()

ans = float('inf')
for i in range(N-1):
	d = abs(sum(W[:i+1])-sum(W[i+1:]))
	ans = min(ans, d)
print(ans)


Measured memory_bytes: 69176
# abc128 b
N = gets.strip.to_i

a = []
h = {}

N.times do 
  s, p = gets.strip.split
  a << [s, p.to_i]
  h[s] = [] if h[s].nil?
  h[s] << p.to_i
end

h.sort.each do |k, v|
  v.sort.reverse.each { |p| puts a.index([k, p]) + 1 }
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int w,h;
int fie[2][5][5];
vector<P> G[6*6*6*6*6];
int valid[61];
int ok[6];
int curfie[5][5];
int id[10005];

void init(int v,int a,int b,int col){
	memset(curfie,-1,sizeof(curfie));
	for(int i=0;i<w;i++){
		for(int j=ok[i];j<h;j++){
			curfie[j][i]=fie[1][j][i];
		}
	}
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			curfie[i][j]=col;
		}
	}
	int nok[6];
	for(int i=w-1;i>=0;i--){
		nok[i]=h;
		for(int j=h-1;j>=0;j--){
			if(i<w-1 && nok[i+1]==nok[i])break;
			if(curfie[j][i]!=fie[1][j][i])break;
			nok[i]--;
		}
	}
	int nxt=0;
	for(int i=w-1;i>=0;i--){
		nxt*=h+1;
		nxt+=nok[i];
	}
	G[v].push_back(P(nxt,(a+1)*(b+1)));
}


typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(const mat &A,const vec& b){
	int N=A.size();
	mat B(N,vec(N+1));
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			B[i][j]=A[i][j];
		}
	}
	for(int i=0;i<N;i++){
		B[i][N]=b[i];
	}
	for(int i=0;i<N;i++){
		int pivot=i;
		for(int j=i;j<N;j++){
			if(fabs(B[j][i])>fabs(B[pivot][i]))pivot=j;
		}
		swap(B[i],B[pivot]);
		if(fabs(B[i][i])<EPS)continue;
		for(int j=i+1;j<=N;j++){
			B[i][j]/=B[i][i];
		}
		for(int j=0;j<N;j++){
			if(i!=j){
				for(int k=i+1;k<=N;k++){
					B[j][k]-=B[j][i]*B[i][k];
				}
			}
		}
	}
	vec x(N);
	for(int i=0;i<N;i++){
		x[i]=B[i][N];
	}
	return x;
}


void solve(){
	for(int i=0;i<6*6*6*6*6;i++){
		G[i].clear();
	}
	int siz=1;
	for(int i=0;i<w;i++){
		siz*=(h+1);
	}
	int siz2=0;
	memset(id,-1,sizeof(id));
	for(int i=0;i<siz;i++){
		int v=i;
		bool flag=false;
		for(int j=0;j<w;j++){
			ok[j]=v%(h+1);
			if(j>0 && ok[j-1]<ok[j])flag=true;
			v/=h+1;
		}
		if(flag)continue;
		id[i]=siz2;
		siz2++;
		for(int a=0;a<h;a++){
			for(int b=0;b<w;b++){
				for(int c=0;c<2;c++){
					init(i,a,b,c);
				}
			}
		}
	}
	mat eff(siz2,vec(siz2,0.0));
	for(int i=0;i<siz;i++){
		if(id[i]==-1)continue;
		int v=id[i];
		if(v==0){
			eff[v][0]=1.0;
		}else{
			for(int k=0;k<G[i].size();k++){
				eff[v][id[G[i][k].first]]+=(double)1.0/G[i].size();
			}
		}
	}
	double ads=0.0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			ads+=(i+1.0)*(j+1.0);
		}
	}
	ads/=h*w;
	vec vo(siz2,0.0);
	for(int i=1;i<siz2;i++){
		for(int j=0;j<siz2;j++){
			eff[i][j]=-eff[i][j];
		}
		eff[i][i]+=1.0;
		vo[i]=ads;
	}
	vec res=gauss_jordan(eff,vo);
	int nok[6];
	for(int i=w-1;i>=0;i--){
		nok[i]=h;
		for(int j=h-1;j>=0;j--){
			if(i<w-1 && nok[i+1]==nok[i])break;
			if(fie[1][j][i]!=fie[0][j][i])break;
			nok[i]--;
		}
	}
	int resid=0;
	for(int i=w-1;i>=0;i--){
		resid*=h+1;
		resid+=nok[i];
	}
	printf("%.10f\n",res[id[resid]]);
}

int main(void){
	while(1){
		scanf("%d%d",&h,&w);
		if(h==0 && w==0)break;
		for(int k=0;k<2;k++){
			for(int i=0;i<h;i++){
				string str;
				cin >> str;
				for(int j=0;j<w;j++){
					if(str[j]=='W'){
						fie[k][i][j]=0;
					}else{
						fie[k][i][j]=1;
					}
				}
			}
		}
		solve();
	}
	return 0;
}


Measured memory_bytes: 4492
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  while(cin>>n,n){
    Int x=0,y=0;
    for(Int i=0;i<n;i++){
      Int a,b;
      cin>>a>>b;
      if(a>b) x+=a+b;
      if(a<b) y+=a+b;
      if(a==b) x+=a,y+=b;
    }
    cout<<x<<" "<<y<<endl;
  }
  return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <functional>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;

int main() {
  // 6 5 6 5 6 5
  ll x; cin>>x;
  ll y = x / 11;
  ll an = y * 2;
  x = x - y * 11;
  if (0 < x && x <= 6) an++;
  if (7 <= x && x < 11) an+=2;
  cout<<an<<endl;
}
// Thank you for making problems and running the contest

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

int main() {
    long long int n,sum;

    cin>>n;
    sum=999999999999;
    for(long long int i=1;i*i<=n;i++){
        if(n%i==0){
            long long int minsum=i+n/i-2;
            if(sum>minsum)
                sum=minsum;
        }
    }
    cout<<sum;



    return 0;
}

Measured memory_bytes: 3636
import math
a,b = map(int,input().split())
ans = 0
a_min = math.ceil(12.5 * a)
a_max = 12.5 * (a + 1)
b_min = math.ceil(10 * b)
b_max = 10 * (b + 1)
min = max(a_min,b_min)
if min < a_max and min < b_max:
    ans = min
else:
    ans = -1
print(int(ans))


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

using namespace std;
vector<vector<bool> > a;
vector<vector<bool> > b;
int main()
{
    int N,M;
    cin>>N>>M;
    a.assign(N+2,vector<bool>(M+2,false));
    for(int i = 0;i<N;i++){
        string str;
        cin>>str;
        for(int j = 0;j<M;j++)
        {
            if(str[j]=='.')a[i+1][j+1]=true;
        }
    }
    b=a;
    priority_queue<pair<int,pair<int,int> >,vector<pair<int,pair<int,int> > >,greater<pair<int,pair<int,int> > > > q;
    int odleglosc=0;
    for(int i = 1;i<=N;i++)
    {
        for(int j = 1;j<=M;j++)
        {
            if(a[i][j])
            {
                b=a;
                b[i][j]=false;
                if(b[i][j+1])q.push(make_pair(1,make_pair(i,j+1)));
                if(b[i+1][j])q.push(make_pair(1,make_pair(i+1,j)));
                if(b[i][j-1])q.push(make_pair(1,make_pair(i,j-1)));
                if(b[i-1][j])q.push(make_pair(1,make_pair(i-1,j)));
                while(!q.empty())
                {
                    int odl=q.top().first;
                    int x=q.top().second.first;
                    int y=q.top().second.second;
                    q.pop();
                    if(!b[x][y])continue;
                    b[x][y]=false;
                    odleglosc=max(odleglosc,odl);
                    if(b[x][y+1])q.push(make_pair(odl+1,make_pair(x,y+1)));
                    if(b[x+1][y])q.push(make_pair(odl+1,make_pair(x+1,y)));
                    if(b[x][y-1])q.push(make_pair(odl+1,make_pair(x,y-1)));
                    if(b[x-1][y])q.push(make_pair(odl+1,make_pair(x-1,y)));
                }
            }
        }
    }
    cout<<odleglosc;
}


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

typedef long long ll;

void solve() {
    int H, W, c[26];
    rep(i, 26) c[i] = 0;
    cin >> H >> W;
    string s;
    rep(i, H) {
        cin >> s;
        rep(j, s.size()) c[s[j] - 'a']++;
    }
    int a = 0, b = 0;
    rep(i, 26) {
        a += c[i] % 4 / 2;
        b += c[i] % 2;
    }
    if ((H % 2) * (W % 2) < b) cout << "No" << endl;
    else if ((H % 2) * (W / 2) + (H / 2) * (W % 2) < a) cout << "No" << endl;
    else cout << "Yes" << endl;
    return;
}

int main() {
    solve();
}

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

lli a, b, c;

int main(void){
	cin >> a >> b >> c;
	if(a %2 == 0 || b %2 == 0 || c%2 == 0) cout << 0 << endl;
	else{
		cout << min({a*b, b*c, c*a}) << endl;
	}
	return 0;
}


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

typedef long long ll;

int main(){
	int a,b,c,x,ans=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=x/500&&i<=a;i++)
		for(int j=0;j<=x/100&&j<=b;j++)
			for(int k=0;k<=x/50&&k<=c;k++)
				if(i*500+j*100+k*50==x)
					ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}


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



const LL maxn = 1e5+10;
LL n,w;
LL dp[105][maxn];
int val[105];
int wet[105];


int32_t main()
{
    cin >> n >> w;
    for(int i = 1;i<=n;i++){
        cin >> wet[i] >> val[i];
    }
    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=w;j++)
        {
            if(wet[i] > j){
                dp[i][j] = dp[i-1][j];
            }
            else{
                dp[i][j] = max(dp[i-1][j] ,dp[i-1][j-wet[i]]+val[i]);
            }
        }
    }


    cout << dp[n][w] << endl;

}


Measured memory_bytes: 81728
import java.util.*;
import java.util.regex.*;

public class Main {
	
	public static void main(String... args) {
		System.out.println(canDraw(scanInt(), scanInt()) ? "Yes" : "No");
	}
	
	private static boolean canDraw(int H, int W) {
		ArrayList<Point> pList = new ArrayList<Point>();
		for (int i = 0; i < H; ++i) {
			String line = scanString();
			for (int j = 0; j < W; ++j) {
				char c = line.charAt(j);
				if (c == '#') {
					pList.add(new Point(i, j));
				}
			}
		}
		for (Point p : pList) {
			if (!hasRelation(p, pList)) {
				return false;
			}
		}
		return true;
	}
	
	private static boolean hasRelation(Point p, ArrayList<Point> pList) {
		for (Point p2 : pList) {
			if (p.isRelation(p2)) {
				return true;
			}
		}
		return false;
	}
	
	private static class Point {
		private final int i;
		private final int j;
		
		private Point(int i, int j) {
			this.i = i;
			this.j = j;
		}
		
		private boolean isRelation(Point p) {
			if ((i == p.i && (j == p.j - 1 || j == p.j + 1))
					|| ((i == p.i - 1 || i == p.i + 1) && j == p.j)) {
				return true;
				
			}
			return false;
		}
	}
	
	private static final Scanner SC = new Scanner(System.in);

	private static int scanInt() {
		return SC.nextInt();
	}

	private static  String scanString() {
		return SC.next();
	}
}

Measured memory_bytes: 24148
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  [m, n] <- f
  unless (m == 0 && n == 0) $ do
    solve m <$> replicateM n getLine >>= putStrLn
    main
  where
    f = map read <$> words <$> getLine

solve :: Int -> [String] -> String
solve m ss = unwords . map show  $ f 1 ss ([1..m],[])
  where
    f :: Int -> [String] -> ([Int], [Int]) -> [Int]
    f _ _ ([u],[]) = [u]
    f _ [] (us, vs) = sort $ us ++ vs
    f x ss ([], vs) = f x ss (reverse vs, [])
    f x (s:ss) (u:us, vs)
      | fizzbuzz x == s = f (x + 1) ss (us, u:vs)
      | otherwise = f (x + 1) ss (us, vs)

fizzbuzz :: Int -> String
fizzbuzz x = case (x `mod` 3, x `mod` 5) of
  (0, 0) -> "FizzBuzz"
  (0, _) -> "Fizz"
  (_, 0) -> "Buzz"
  (_, _) -> show x



Measured memory_bytes: 7508
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n,ar[N];
long long S[N];
vector<long long> V;
long long ans1[N],ans2[N];
long long mx,mn;
long long ans;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>ar[i];
		S[i]=S[i-1]+ar[i];
	}

	int ptr=1;
	for (int i=2;i<=n;i++){

		while (ptr+1<i&&S[i]-S[ptr+1]>S[ptr+1])
			++ptr;
		ans1[i]=min(S[i]-S[ptr],S[ptr]);
		if (ptr+1<i)
			ans1[i]=max(ans1[i],min(S[i]-S[ptr+1],S[ptr+1]));
	}

	ptr=n;
	for (int i=n-1;i>=1;--i){
		while (ptr-1>i&&S[n]-S[ptr-2]<S[ptr-2]-S[i-1])
			--ptr;
		ans2[i]=min(S[n]-S[ptr-1],S[ptr-1]-S[i-1]);
		if (ptr-1>i)
			ans2[i]=max(ans2[i],min(S[n]-S[ptr-2],S[ptr-2]-S[i-1]));
	}

	ans=1e18;

	//cout<<ans1[4]<<" "<<ans2[5]<<endl;

	/*for (int i=1;i<=4;i++){
		cout<<ans1[i]<<" "<<ans2[i+1]<<endl;
	}*/

	for (int i=2;i+2<=n;i++){
		mx=-1e18;
		mn=1e18;
		V.clear();
		V.push_back(ans1[i]);
		V.push_back(S[i]-ans1[i]);
		V.push_back(ans2[i+1]);
		V.push_back(S[n]-ans2[i+1]-S[i]);
		sort(V.begin(),V.end());
		ans=min(ans,V[3]-V[0]);
	}
	cout<<ans<<endl;

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 14080
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;

int main(void){
  ll n,m;
  cin>>n>>m;
  ll res=0;
  if(m<n*2) cout<<m/2<<endl;
  else cout<<n+(m-n*2)/4<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	int x;
	cin >> x;
	int n = sqrt(x);
	int ans = -INF;
	rep2(i, 2, n + 1) {
		int now = i;
		while (true) {
			if (now * i > x) break;
			now *= i;
		}
		cerr << now << endl;
		ans = max(ans, now);
	}
	if (ans == -INF) cout << 1 << endl;
	else cout << ans << endl;
}

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

	solve();
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int H,W,i,j;
	for(;;){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0) break;
		if(H>=1&&H<=300&&W>=1&&W<=300){
			for(i=0;i<H;i++){
				for(j=0;j<W;j++){
					printf("#");
				}
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}



Measured memory_bytes: 2072
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  int A,B;
  in(A,B);
  out((B+A-3)/(A-1));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.LinkedList;

public class Main {

    int INF = 100000000;
    char maze[][] = new char[5000][5001];
    int R, C;
    int sx, sy;
    int gx, gy;
    int d[][] = new int[5000][5001];
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};
    boolean ch=true;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        R = sc.nextInt();
        C = sc.nextInt();
        sx = 0;
        sy = 0;
        gx = R-1;
        gy = C-1;
        int black=0;
        String a[] = new String[R];
        for (int i = 0; i < R; i++) {
            a[i] = sc.next();
        }
        for (int i = 0; i < R; i++) {
            maze[i] = a[i].toCharArray();
        }
        for (int i = 0; i < R; i++) {
            for (int j = 0; j < C; j++) {
                if(maze[i][j]=='#')black++;
                d[i][j] = INF;
            }
        }
        int ans = bfs();
        int A=R*C-ans-black-1;
        if(ch==true){
            System.out.println(A);
        }else{
            System.out.println("-1");
        }
    }

    int bfs() {
        Queue<Pair> queue = new ArrayDeque<Pair>();
        queue.add(new Pair(sx, sy));
        d[sx][sy] = 0;
        while (queue.size() >= 1) {
            Pair p = queue.poll();
            if (p.x == gx && p.y == gy) {
                break;
            }
            for (int i = 0; i < 4; i++) {
                int nx = p.x + dx[i], ny = p.y + dy[i];
                if (0 <= nx && nx < R && 0 <= ny && ny < C && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                    queue.add(new Pair(nx, ny));
                    d[nx][ny] = d[p.x][p.y] + 1;
                }
            }
        }
        if(d[gx][gy]==INF){
            ch=false;
        }
        return d[gx][gy];
    }

    class Pair {

        int x, y;

        Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)2e6;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int n;
vector<vector<int>>v;
ll dp[N][4];
ll solve(int idx,int f){
    ll &ret = dp[idx][f];
    if(idx==n)return 0;
    if(~ret)
        return ret;
    ret = 0;
    for(int i=0;i<SZ(v[idx]);i++){
        if(i!=f||idx==0)
        ret = max(ret,solve(idx+1,i)+v[idx][i]);
        
    }
    
    return ret;
}
int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    
    ll a;
    scanf("%d",&n);
    v=vector<vector<int>>(n+1);
    lp(i,n){
        lp(j,3){
             scanf("%lld",&a);
            v[i].push_back(a);
        }
    }
    memset(dp,-1,sizeof(dp));
    printf("%lld",solve(0,0));
    return 0;
}

Measured memory_bytes: 76032
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};



int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    priority_queue<int> an;
    rep(i,n) cin >> a[i], an.push(a[i]);
    rep(i,m){
      ll t = an.top();
      an.pop();
      t /= 2;
      an.push(t);
    }
    ll ans = 0;
    while(!an.empty()){
      ans += an.top();
      an.pop();
    }
    print(ans);
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { string s;
  cin >> s;
  for(char c : s){
    if(c==','){
      cout << ' ';
      continue;
    }
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int f(int k)
{
    if (k==1) return 0;
    if (k&1) return 1+f(3*k+1);
    else return 1+f(k/2);
}
int main()
{
    int n;
    scanf("%d",&n);
    int ans=f(n);
    if (n==1) printf("4");
    else if (n==2) printf("4");
    else printf("%d",ans+2);
}


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

typedef long long ll;
const ll mod = 1E9 + 7;

int main() {
	int n;
	while ( cin >> n ) {
		int color[ n+5 ];
		
		for (int i = 1; i <= n; ++i) cin >> color[i];
		
		pair<int,int> seg[ n+5 ];
		
		int tok = 0, spec[ (int)2E5 + 5 ] = {0};
		
		for (int i = 1; i <= n; ++i) {
			if ( spec[ color[i] ] and ( i == 1 or spec[ color[i] ] != i-1 ) ) {
				seg[ tok++ ] = make_pair( spec[ color[i] ], i );
			}
			spec[ color[i] ] = i;
		}
		
//		for (int i = 0; i < tok; ++i) cout << seg[i].first << '~' << seg[i].second << '\n';
		
		ll dp[ n+5 ], tok2 = 0; dp[0] = 1;
		
		for (int i = 1; i <= n; ++i) {
			dp[i] = dp[ i-1 ];
			
			while ( seg[tok2].second == i ) {
				dp[i] += dp[ seg[tok2].first ];
				tok2++ ;
			}
			
			dp[i] %= mod;
		}
		
		cout << dp[n] << '\n';
	}
	return 0;
}

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

int main() {
  long A,B,K;
  cin >> A >> B >> K;

  if ( A < K ) { K -= A; A=0; } else { A-=K; K=0; }
  if ( B < K ) { K -= B; B=0; } else { B-=K; K=0; }
 cout << A << " " << B << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int c = sc.nextInt();
    int ans = 0;
    int[] b = new int[m];
    for(int i=0; i<m; i++)
      b[i] = sc.nextInt();
    for(int i=0; i<n; i++){
      int calc = 0;
      for(int j=0; j<m; j++)
        calc += b[j]*sc.nextInt();
      if(calc + c > 0) ++ans;
    }
    System.out.println(ans);
  }
 }

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

int main() {
    int c[3][3];
    bool iscorrect=true;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        cin >> c[i][j];
      }
    }
    int a[3],b[3];
    a[0] = 0;
    for(int i=0;i<3;i++) b[i] = c[0][i];
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];

    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(c[i][j] != a[i] + b[j] ) iscorrect=false;
      }
    }
    if(iscorrect) cout << "Yes" << endl;
    else cout << "No" << endl;
  
}

Measured memory_bytes: 256
N = int(input())

H = list(map(int, input().split()))

now_h = H[0]
for i in range(1, N):
    if H[i] > now_h:
        now_h = H[i]-1
        continue
    elif H[i] == now_h:
        now_h = H[i]
        continue
    else:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 14228
use std::collections::HashMap;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn get_primes(n: usize) -> Vec<usize> {
    let mut is_prime = vec![true; n as usize];
    let mut primes = Vec::new();
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n {
        if is_prime[i] {
            primes.push(i);
            let mut j = 2 * i;
            while j < n {
                is_prime[j] = false;
                j += i;
            }
        }
    }
    // println!("{:?}", primes);
    primes
}

fn main() {
    let v = read_vec::<usize>();
    let (n, p) = (v[0], v[1]);
    if p == 1 {
        println!("1");
        return;
    }
    if n == 1 {
        println!("{}", p);
        return;
    }
    let search_max = (p as f64).sqrt() as usize + 1;
    let primes = get_primes(search_max);
    let mut p = p;
    let mut factors = HashMap::new();
    for prime in primes {
        while p % prime == 0 {
            *factors.entry(prime).or_insert(0) += 1;
            p /= prime;
        }
    }
    let mut ans = 1;
    for prime in factors.keys() {
        let mut residual_num = factors[prime];
        while residual_num >= n {
            ans *= *prime;
            residual_num -= n;
        }
    }
    println!("{:?}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int d,x;
    cin>>d>>x;
    int ans=x;
    int t;
    for(int i=1;i<=n;i++) {
        cin>>t;
        ans += (1 + (d - 1) /t);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
use whiteread::parse_line;

fn main() {
    let mut digits: String = parse_line().unwrap();
    while digits.len() > 2 {
        digits = shrink(&digits);
        // eprintln!("{:?}", 1);
    }
    println!(
        "{}",
        if (digits.parse::<u32>().unwrap() % 9) == 0 {
            "Yes"
        } else {
            "No"
        }
    );
}

fn shrink(s: &str) -> String {
    let res: u64 = s
        .chars()
        .map(|c| c.to_digit(10).unwrap())
        .fold(0, |acc, x| acc + x as u64);
    res.to_string()
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n;
	cin >> n;
	cout << n * n * n;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

int main(){
    int x;
    cin >> x;
    int max = 1;
    int sum;
    int route_x = (int)sqrt((double)x);

    for(int i = 2; i <= route_x; i++){
        for(int j = 2; ; j++){
            sum = (int)pow((double)i, (double)j);
            if(sum <= x){
                if(sum > max)max = sum;
            }
            else break;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	n := nextInt()
	t := nextInts(n)
	m := nextInt()
	p := make([]int, m)
	x := make([]int, m)
	tsum := sum(t)
	for i := 0; i < m; i++ {
		p[i] = nextInt()
		x[i] = nextInt()
	}
	for i := 0; i < m; i++ {
		rtn := tsum + x[i] - t[p[i]-1]
		fmt.Println(rtn)
	}
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640