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

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long a = nextInt(scanner);
        long b = nextInt(scanner);
        long c = nextInt(scanner);
        long d = nextInt(scanner);
        System.out.println(Math.max(a * c, Math.max(a * d, Math.max(b * c, b * d))));
    }

    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }

    private static long nextLong(Scanner scanner) {
        return Long.parseLong(scanner.next());
    }

    private static float nextFloat(Scanner scanner) {
        return Float.parseFloat(scanner.next());
    }

    private static double nextDouble(Scanner scanner) {
        return Double.parseDouble(scanner.next());
    }


}


class UnionFind {
    int[] parent;

    UnionFind(int n) {
        parent = new int[n];
        Arrays.fill(parent, -1);
    }

    int find(int x) {
        if (parent[x] < 0) {
            return x;
        } else {
            parent[x] = find(parent[x]);
            return parent[x];
        }
    }

    void unite(int x, int y) {
        int rootX = find(x);
        int rootY = find(y);
        if (rootX == rootY) {
            return;
        }

        if (parent[rootX] > parent[rootY]) {
            int temp = rootX;
            rootX = rootY;
            rootY = temp;
        }
        parent[rootX] += parent[rootY];
        parent[rootY] = rootX;
    }

}


Measured memory_bytes: 35556
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	auto check = [&](int mid) {
		ll req = 0;
		for (int i = 0; i < n; i++) {
			int val = (A[i] + mid - 1) / mid;
			req += (val - 1);
		}
		return (req <= k);
	};
	int lo = 1, hi = 1e9, ans = -1;
	while (lo <= hi) {
		int mid = (lo + hi) / 2;
		if (check(mid)) {
			hi = mid - 1;
			ans = mid;
		}
		else {
			lo = mid + 1;
		}
	}
	cout << ans;
}


Measured memory_bytes: 3972
use std::io::{stdout, Write, BufWriter};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        h: usize,
        w: usize,
        ab: [(usize, usize); n],
    }

    let ans: Vec<(usize, usize)> = ab.into_iter().filter(|&ab_i| ab_i.0 >= h && ab_i.1 >= w).collect();

    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    writeln!(out, "{}", ans.len()).unwrap();
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97 '0'=0x30=48
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef string str;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int n,k;cin>>n>>k;veci v(n,0);
  int q;cin>>q;  
  rep(i,q){
    int cur;
    cin>>cur;
    cur--;
    v[cur]++;
  }
  rep(j,n){v[j]-=q;v[j]+=k;}
  rep(k,n){
    if(v[k]>0)cout<<"Yes"<<endl;else cout<<"No"<<endl;}
}

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

int main(){
  int n=0,d=0,s=0;
  cin >> n;
  for(int i = 0; i < 3; i++){
    d = n % 10;
    s += d;
    n /= 10;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

int a,b,c,d;

int main()
{
    scanf("%d%d%d%d",&a,&b,&c,&d);
    while(1)
    {
        c-=b;
        if(c<=0) break;
        a-=d;
        if(a<=0) break;
    }
    if(c<=0) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3156
using System;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
      int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
      Array.Sort(input);
      
      int output = 0;
      for(int i = 2; i > 0; i--)
      {
        output += Math.Abs(input[i] - input[i-1]);
      }
      
      Console.WriteLine(output.ToString());
      
    }
}

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

int main(){
	int a;
	int b;
	int c;
	int y = 0;
	cin >> a >> b >> c;

	for (int x = a; x <= b; x++) {
		if (c%x == 0) {
			y++;
		}
	}
	cout << y << endl;

	return 0;
}

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

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

bool is_small(vector<long long>& a){
    int N = a.size();
    REP(i, N){
        if(a[i] >= N) return false;
    }
    return true;
}


int main()
{
    int N;
    cin >> N;
    vector<long long> a(N);
    REP(i, N) cin >> a[i];

    long long ans = 0;
    while(!is_small(a)){
        long long S = 0;
        REP(i, N) S += a[i]/N;
        REP(i, N) a[i] = a[i] - (a[i]/N)*N + (S-a[i]/N);
        ans += S;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
Y = [[] for _ in range(n)]
for i in range(m):
    p,yi = map(int, input().split())
    Y[p-1].append((yi,i))
ans = [-1 for _ in range(m)]
for i,d in enumerate(Y):
    d.sort()
    for k,(a,b) in enumerate(d):
        ans[b] = str(i+1).rjust(6,"0") + str(k+1).rjust(6,"0")
for i in range(m):
    print(ans[i])

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

int main() {
  	ll N, D;
  	cin >> N >> D;
  
  	vector<ll> X(N), Y(N);
  	for (ll i=0; i<N; ++i) {
      cin >> X.at(i) >> Y.at(i);
    }
  
  	ll cnt=0;
  	for (long i=0; i<N; ++i) {
      if (D*D>=(X.at(i)*X.at(i)+Y.at(i)*Y.at(i))) {
        cnt++;
      }
    }
  
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6436
#include "bits/stdc++.h"
using namespace std;

int main() {
    string O, E;
    cin >> O >> E;

    for (int i = 0; i < E.size(); i++) {
        cout << O[i] << E[i];
    }
    if (O.size() > E.size()) {
        cout << O[O.size() - 1];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a,b,c,k;
	int i, j = 0, m;
	long sum = 0;
	scanf("%d%d%d%d", &a, &b, &c, &k);
	
	for (i = 0; i < k; i++) {
		while (a > 0) {
			if (i > k - 1)
				break;
			sum++;
			a--;
			i++;
		}
		while (b > 0) {
			if (i > k - 1)
				break;
			b--;
			i++;
		}
		while (c > 0) {
			if (i > k - 1)
				break;
			sum--;
			c--;
			i++;
		}

	}
	printf("%ld", sum);
	return 0;
}

Measured memory_bytes: 2148
//In the name of God!
#include <bits/stdc++.h>

const int maxn = 2e5 + 12;
using namespace std;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    long long n;
    cin >> n;
    cout << n * (n - 1) / 2;
}

Measured memory_bytes: 256
class UnionFind
  def initialize(n)
    @root = Array.new(n)
    @rank = Array.new(n)
    @size = Array.new(n)
    (0...n).each do |i|
      @root[i] = i
      @rank[i] = 0
      @size[i] = 1
    end
  end

  def find(x)
    if @root[x] == x
      x
    else
      @root[x] = find(@root[x])
    end
  end

  def unite(x, y)
    x_root = find(x)
    y_root = find(y)
    return if x_root == y_root

    if @rank[x_root] < @rank[y_root]
      @root[x_root] = y_root
      @size[y_root] += @size[x_root]
    else
      @root[y_root] = x_root
      @size[x_root] += @size[y_root]
      if @rank[x_root] == @rank[y_root]
        @rank[x_root] += 1
      end
    end
    nil
  end

  def size(x)
    x_root = find(x)
    @size[x_root]
  end

  def same?(x, y)
    find(x) == find(y)
  end
end

N, M = gets.split.map(&:to_i)
ps = gets.split.map(&:to_i)
xys = M.times.map { gets.split.map(&:to_i) }

uf = UnionFind.new(N + 1)
xys.each do |(x, y)|
  uf.unite(x, y)
end
ans = 0
ps.each.with_index do |n, i|
  i += 1
  if n == i || uf.same?(i, n)
    ans += 1
  end
end
puts ans


Measured memory_bytes: 17980
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

int main()
{
    string a, b;
    cin >> a >> b;
    int num = atoi((a + b).c_str());
    bool ok = false;
    for (int i = 1; i <= (int)pow(100100, 0.5); i++)
    {
        if (i *i == num)
        {
            ok = true;
            break;
        }
    }
    if (ok)
        puts("Yes");
    else
        puts("No");
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repm(i, m, n) for (int i = m; i < (n); i++)
#define eps (1e-7)
#define inf (1e9)
#define pi (acos(-1))
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll a, b, c, m, n, ans;

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

    int x;
    cin >> n >> m >> x;
    vi A(m);
    rep(i, m) cin >> A[i];

    ans = 0;
    rep(i, x)
    {
        rep(j, m)
        {
            if (i == A[j])
            {
                //cout << "i : " << i << " , Aj : " << A[j] << endl;
                ans++;
                break;
            }
        }
    }
    cout << min(ans, m - ans) << endl;
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
	
	ll n; cin >> n;
	ll ans = 0;
	ll N = n;
	for (int i = 2; 1LL*i*i <= n; ++i) {
		if (N%i) continue;
		int ct = 0;
		int x = 1;
		while (N%i == 0) {
			++ct;
			if (ct == x) {
				++ans;
				ct = 0;
				++x;
			}
			N /= i;
		}
	}
	if (N > 1) ++ans;
	cout << ans;
}

Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
max_value = 0
ans_p = 0

s = [0]*(n+1)
for i, _p in enumerate(p):
    s[i+1] = s[i] + _p

for i in range(n-k+1):
    sum_ = s[i+k] - s[i]
    if (max_value < sum_):
        max_value = sum_

print((max_value+k)/2)


Measured memory_bytes: 33968
import java.io.IOException;

public class Main {

	public static void main(String[] args) {
		boolean first = true;
		while (true) {
			int N = nextInt();
			if (N == 0) {
				break;
			}
			if (first) {
				first = false;
			} else {
				System.out.print("\n");
			}

			int[] coins = new int[4];
			int allCoins = 0;
			for (int i = 0; i < coins.length; i++) {
				coins[i] = nextInt();
				allCoins += coins[i];
			}

			int[] answer = new int[4];
			int min = Integer.MAX_VALUE;
			for (int i0 = 0; i0 <= coins[0]; i0++) {
				for (int i1 = 0; i1 <= coins[1]; i1++) {
					for (int i2 = 0; i2 <= coins[2]; i2++) {
						for (int i3 = 0; i3 <= coins[3]; i3++) {
							int change = i0 * 10 + i1 * 50 + i2 * 100 + i3
									* 500;
							if (change - N >= 0) {
								int rest = allCoins - i0 - i1 - i2 - i3;
								change -= N;
								int change500 = change / 500;
								change -= change500 * 500;
								rest += change500;
								int change100 = change / 100;
								change -= change100 * 100;
								rest += change100;
								int change50 = change / 50;
								change -= change50 * 50;
								rest += change50;
								int change10 = change / 10;
								rest += change10;
								if (rest < min) {
									min = rest;
									answer[0] = i0;
									answer[1] = i1;
									answer[2] = i2;
									answer[3] = i3;
								}
							}
						}
					}
				}
			}

			if (answer[0] > 0) {
				System.out.println("10 " + answer[0]);
			}
			if (answer[1] > 0) {
				System.out.println("50 " + answer[1]);
			}
			if (answer[2] > 0) {
				System.out.println("100 " + answer[2]);
			}
			if (answer[3] > 0) {
				System.out.println("500 " + answer[3]);
			}
		}

	}

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

}

Measured memory_bytes: 25768
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;

int main() {
   int n; scanf("%d", &n);
   vector<int> a(n);
   for (int &i : a)
      scanf("%d", &i);
   int sum = 0;
   for (int i = 0; i < n; ++i)
      sum += a[i];
   int ans = sum;
   for (int i = 0; i < n / 2; ++i)
      ans -= 2 * a[2 * i + 1];
   printf("%d ", ans);
   for (int i = 0; i < n - 1; ++i) {
      ans = 2 * a[i] - ans; printf("%d ", ans);
   }
   
   return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
 
    int n, m, x, y, a, b, mxx, mny;
    cin >> n >> m >> x >> y;
    mxx = x;
    for (int i = 0; i < n; i++) {
        cin >> a;
        mxx = max(mxx, a);
    }
    mny = y;
    for (int i = 0; i < m; i++) {
        cin >> b;
        mny = min(mny, b);
    }
    cout << (mny - mxx < 1 ? "War" : "No War");
}

Measured memory_bytes: 3564
#!/usr/bin/env python3
import sys


def sqrt5(n):
    negative = True if n < 0 else False
    for i in range(1000):
        if i ** 5 == abs(n):
            if negative:
                return -i
            return i


def solve(X: int):
    pos = {x ** 5 for x in range(1000) if x ** 5 <= int(1e15)}
    neg = {-x for x in pos}
    nums = pos.union(neg)
    for a in nums:
        # b = a - x
        if a - X in nums:
            b = a - X
            print(sqrt5(a), sqrt5(b))
            return
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9332
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int flag=0;
	while(n){
		if(n%10==7) flag=1;
		n/=10;
	}
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long ll;

int n ,k;
ll T[MAX];

/*最大積載量Pのｋ台のトラックで何個の荷物を積めるか？*/
int check(ll P) {
    int i = 0;

    for (int j = 0; j < k; j++) {

        ll s = 0;

        while (s + T[i] <= P) {

            s += T[i];
            i++;
            if (i == n) return n;   
        }   
    }

    return i;   
}


int solve() {

    ll left = 0;
    ll right = 100000 * 10000; /*荷物の個数＊最大重量*/
    ll mid;

    while ( right - left > 1 ) {
        
        mid = (left + right) / 2;

        int v = check(mid);  /*mid == P で何個積めるかチェック*/
        if (v >= n) {
            right = mid;
        } else {
            left = mid;
        }
    }

    return right;
}

int main() {

    cin >> n;
    cin >> k;

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

    ll res = solve();

    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  ll ans = 0;
  rep(i, n - 2) rep2(j, i + 1, n - 1) {
    ll mn = a[j] - a[i];
    ll mx = a[j] + a[i];
    ll imn = upper_bound(all(a), mn) - a.begin();
    ll imx = lower_bound(all(a), mx) - a.begin();
    ll now = max(imx, j + 1) - max(imn, j + 1);
    ans += now;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k, q; cin >> n >> k >> q;
	vector<int> pts(n, k - q);
	for(int i = 0; i < q; i++){
		int x; cin >> x;
		pts[x - 1]++;
	}
	for(int i = 0; i < n; i++){
		if(pts[i] > 0) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 1024
s = input().split()
intN = int(s[0])
intK = int(s[1])

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

#print(inList)
inList.sort()

#print(inList)

idx = 0
intCnt = 0

for wInt in inList:
    if (idx < intK) :
        intCnt += wInt
        #print(wInt) 
        #print(intCnt) 
    idx += 1

print(intCnt) 

Measured memory_bytes: 8928
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;
  string s,t;

  cin >> s >> t;

  int sum = 0;

  for(ii=0;ii<s.size();ii++){
    if(s[ii] != t[ii]){
      sum++;
    }
  }

  cout << sum << endl;
  
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int a[n], b[n], c[n], dp1[n], dp2[n], dp3[n];
  
  for(int i = 0;i<n;i++){
  	cin >> a[i] >> b[i] >> c[i];
  }
  
  dp1[0] = a[0];
  dp2[0] = b[0];
  dp3[0] = c[0];
  
  for(int i = 1;i<n;i++){
  	dp1[i] = max(dp2[i-1], dp3[i-1])+a[i];
    dp2[i] = max(dp1[i-1], dp3[i-1])+b[i];
    dp3[i] = max(dp1[i-1], dp2[i-1])+c[i];
  }
  
  cout <<  max(dp1[n-1], max(dp2[n-1], dp3[n-1])) << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>                                                                 
#include <vector>                                                                   
#include <array>                                                                    
#include <set>                                                                      
#include <cmath>                                                                    
#include <string>                                                                   
#include <queue>                                                                    
#include <list>                                                                     
#include <stack>                                                                    
#include <unordered_map>                                                            
#include <algorithm>                                                                
#include <functional>                                                               
#include <iomanip> // std::std::setprecision(X)                                     
#include <limits>  //std::numeric_limits<int>::max(), min()                         
                                                                                    
typedef long long ll;                                                               
                                                                                    
int main (void) {                                                                   
  int N, M; std::cin >> N >> M;                                                     
  std::vector<int> t(M);                                                            
                                                                                    
  for(int i=0; i<N; i++) {                                                          
    int K; std::cin >> K;                                                           
    for(int j=0; j<K; j++) {                                                        
      int A; std::cin >> A; t[A-1]++;                                               
    }                                                                               
  }                                                                                 
                                                                                    
  int ans = 0;                                                                      
  for(auto&& v : t ) if ( v == N ) ans++;                                           
  std::cout << ans << std::endl;                                                    
                                                                                    
  return 0;                                                                         
}                                                                                   

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

const string YES = "Yes";
const string NO = "No";

void solve(long long K, long long X) {
  if( K * 500 >= X ){
    cout << YES << endl;
  }else{
    cout << NO << endl;
  }

}

int main() {
  long long K;
  scanf("%lld", &K);
  long long X;
  scanf("%lld", &X);
  solve(K, X);
  return 0;
}


Measured memory_bytes: 256
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=1000000, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }


int32_t main()
{
    IOS;
    lld n;
    cin>>n;
    n/=3.0;
    cout<<n*n*n;
}

Measured memory_bytes: 3700
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
// #include <algorithm>
#define pb push_back
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define f first
#define s second
// #define cerr if(0)cerr
using namespace std;
typedef long long LL;
typedef pair<int,LL> PILL;

const int N=1010;
const LL  I=1e9+7;

int h,w;
char c;
bool T[N][N];
LL DP[N][N];

LL maxi(LL x, LL y){if(y>x)return y;return x;}

int main()
{
  boost;
  cin>>h>>w;
  for(int i=1; i<=h; i++)
  {
    for(int j=1; j<=w; j++)
    {
      cin>>c;
      if(c=='.')T[i][j]=1;
    }
  }
  DP[0][1]=1;
  for(int i=1; i<=h; i++)
    for(int j=1; j<=w; j++)
      if(T[i][j])DP[i][j]=(DP[i-1][j]+DP[i][j-1])%I;

  cout<<DP[h][w];

  return 0;
}


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

using namespace std;

typedef long long ll;

ll foo(int x){
	if(x == 1) return 300000ll;
	if(x == 2) return 200000ll;
	if(x == 3) return 100000ll;
	return 0ll;
}
int main(){
	int x,y;
	cin >> x >> y;

	ll ans = 0;
	ans += foo(x);
	ans += foo(y);
	if(x == 1 && y == 1){
		ans += 400000ll;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANNOT ASSIGN A VALUE OF 10^18 IT WILL ASSIGN A LOWER VALUE THAN THAT!!!
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 2000000000000000005
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795

 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
#define MAXN 402
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}



ll n,m;
string s[103];
ll dp[103][104];
 
void solve()
{
    cin>>n>>m;
    string d;
    
    for(ll i=1;i<=n;i++)cin>>d,s[i]='@'+d;
    dp[1][1] = s[1][1]=='#';
    for(ll i=2;i<=n;i++)for(ll j=2;j<=m;j++)dp[i][j] = INF;
    for(ll i=2;i<=n;i++)
    {
        if(s[i][1]=='.')dp[i][1]=dp[i-1][1];
        else
        {
            if(s[i-1][1]=='.')dp[i][1]++;
            dp[i][1]+=dp[i-1][1];
        }
        
    }
    for(ll j=2;j<=m;j++)
    {
        if(s[1][j]=='.')dp[1][j]+=dp[1][j-1];
        else
        {
            if(s[1][j-1]=='.')dp[1][j]++;
            dp[1][j]+=dp[1][j-1];
        }
    }
    for(ll i=2;i<=n;i++)
    {
        for(ll j=2;j<=m;j++)
        {
            if(s[i][j]=='.')dp[i][j] =min(dp[i][j-1],dp[i-1][j]);
            else
            {
                if(s[i-1][j]=='.')dp[i][j] =min(dp[i][j],dp[i-1][j]+1);
                
                else {dp[i][j]=min(dp[i][j],dp[i-1][j]);}
                
                if(s[i][j-1] == '.' )dp[i][j] = min(dp[i][j],dp[i][j-1]+1);
                else dp[i][j] =min(dp[i][j],dp[i][j-1]);

            }
        }
    }
   
    
    
    cout<<dp[n][m]<<endl;
}
signed main()
{
 
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//   }

    solve();
    return 0;
}


Measured memory_bytes: 384
import std.stdio, std.string, std.conv;

void main() {
    auto input = getStdin!(string[]);
    foreach (line; input) {
    	auto num = line.split(" ").to!(int[]);
    	int width = num[1];
    	int height = num[0];
    	if (width == 0 && height == 0) break;

    	for (int i_h = 0; i_h < height; i_h++) {
    		for (int j_w = 0; j_w < width; j_w++) {
    			if (i_h == 0 || i_h == height - 1) {
    				"#".write;
    			}
    			else {
    				if (j_w == 0 || j_w == width - 1) {
    					"#".write;
    				}
    				else {
    					".".write;
    				}
    			}
    			
    			if (j_w == width - 1) {
    				"".writeln;
    			}
    		}
    	}
    	
    	"".writeln;
    }
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

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

using namespace std;

int main(){

	string s,t;

	cin >> s >> t;

	int ans = 0;
	for(int i=0;i<s.length();i++){
		if(s[i] != t[i])
			ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3840
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		
		int n = sc.nextInt();
		
		int[] view = new int[n];
		int cnt = n;
		
		for(int i = 0 ; i < n; i++) {
			view[i] = sc.nextInt();	
		}
		
		for(int k = 0; k < n; k++) {		
			for(int l = 1; l <= k; l++) {
				if(view[k] < view[k - l]) {
					cnt = cnt - 1;
					break;
				}
			}
		}

		System.out.println(cnt);
	}
}

Measured memory_bytes: 23764
def resolve():
    d, g = map(int, input().split())
    lp, lc = [], []
    while True:
        try:
            p, c = map(int, input().split())
            lp.append(p)
            lc.append(c)
        except EOFError:
            break

    num = sum(lp)
    for i in range(2**d):
        cnt = 0
        scr = 0
        lcn = [0]*d
        for j in range(d):
            if (i // 2**j)%2 == 1:
                cnt += lp[j]
                scr += 100*(j+1)*lp[j]+lc[j]
                lcn[j] += 1
        for j in range(d-1, -1, -1):
            if cnt < num and scr >= g:
                num = cnt
                break
            if lcn[j] == 0:
                for k in range(lp[j]):
                    cnt += 1
                    scr += 100*(j+1)
                    if cnt < num and scr >= g:
                        num = cnt
                        break
                break
    print(num)
resolve()

Measured memory_bytes: 3064
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn solve1(s: &[i64], t: i64) -> bool {
    let mut map: BTreeSet<i64> = BTreeSet::new();
    let mut next = map.clone();
    map.insert(0);

    for d in s {
        next.clear();
        for &x in &map {
            next.insert(x + d);
            next.insert(x - d);
        }
        swap(&mut next, &mut map);
    }

    map.contains(&t)
}

fn main() {
    let s = rl();
    let (mut x, y) = read!(i64, i64);

    let mut first = true;

    // 0: x, 1: y
    let mut d = 0;
    let mut rep = 0;

    let mut xs = vec![];
    let mut ys = vec![];

    for c in s.chars() {
        match c {
            'F' => {
                if first {
                    x -= 1;
                    continue;
                }

                rep += 1;
            }
            'T' => {
                if d == 0 {
                    xs.push(rep);
                } else {
                    ys.push(rep);
                }
                d = 1 - d;
                rep = 0;
                first = false;
            }
            _ => unreachable!(),
        }
    }

    if d == 0 {
        xs.push(rep);
    } else {
        ys.push(rep);
    }

    let ok = solve1(&xs, x) && solve1(&ys, y);

    println!("{}", if ok { "Yes" } else { "No" })
}


Measured memory_bytes: 4352
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(){
	
	int N;
	long long int A[210000] = {};
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	
	for(int i = 0; i < N; i++){
		if(A[i + 1] - A[i] > 1){
			cout << "-1" << endl;
			return 0;
		}
	}
	
	if(A[0] != 0){
		cout << "-1" << endl;
		return 0;
	}
	
	long long int ans = 0;
	for(int i = 0; i < N; i++){
		if(A[i + 1] - A[i] <= 0){
			ans += A[i];
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1920
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
Sum = []
key = 0
for i in range(n):
    Sum_s = []
    for j in range(l):
        key = 0
        for k in range(m):
            key += A[i][k] * B[k][j]
        Sum_s.append(key)
    Sum.append(Sum_s)
for i in range(n):
    for j in range(l - 1):
        print(Sum[i][j], end = ' ')
    print(Sum[i][l - 1])



Measured memory_bytes: 7060
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		sc.close();
		int mx=(int)pow(1000000000,0.5)+1;
		for(i=1; i <=mx; i++) {
			if(i*i>n)break;
		}
		out.println((i-1)*(i-1));
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


vll divisor(ll n) {
    vll ans;
    for (ll i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ans.push_back(i);
            if (i*i != n) ans.push_back(n/i);
        }
    }
    sort(all(ans));
    return ans;
}

bool calc(ll n, ll k) {
    while(n%k==0) {
        n = n/k;
    }
    if (n%k == 1) return true;
    return false;
}

int main() {
    ll n;
    cin >> n;

    set<ll> st;
    auto d1 = divisor(n);
    auto d2 = divisor(n-1);
    for (ll di : d1) st.insert(di);
    for (ll di : d2) st.insert(di);
    int ans = 0;
    for (ll num : st) {
        if (num == 1) continue;
        if (calc(n, num)) ans++;
    }

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

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

string lcs(string S, string T) {
  int s = S.size();
  int t = T.size();
  int sz = max(s, t) + 1;
  vector<vector<int>> X(sz, vector<int>(sz));
  vector<vector<int>> Y(sz, vector<int>(sz));
  for (int i = 0; i < s; i++) {
    for (int j = 0; j < t; j++) {
      if (S.at(i) == T.at(j)) {
        X.at(i + 1).at(j + 1) = X.at(i).at(j) + 1;
        Y.at(i + 1).at(j + 1) = 0;
      } else if (X.at(i + 1).at(j) < X.at(i).at(j + 1)) {
        X.at(i + 1).at(j + 1) = X.at(i).at(j + 1);
        Y.at(i + 1).at(j + 1) = 1;
      } else {
        X.at(i + 1).at(j + 1) = X.at(i + 1).at(j);
        Y.at(i + 1).at(j + 1) = -1;
      }
    }
  }
  string res;
  for (int i = s, j = t; i > 0 && j > 0;) {
    if (Y.at(i).at(j) > 0) {
      i--;
    } else if (Y.at(i).at(j) < 0) {
      j--;
    } else {
      res.push_back(S.at(i - 1));
      i--;
      j--;
    }
  }
  reverse(res.begin(), res.end());
  return res;
}

int main() {
  string S, T;
  cin >> S >> T;
  cout << lcs(S, T) << "\n";
}

Measured memory_bytes: 70912
#include <iostream>
#include <vector>
#include <algorithm>  // std::sort, std::unique
using namespace std; 

int main() {
    int n,x;
    int i,j,k;
    int c;
    while(1){
        c=0;
        vector<int> sums;
        cin >> n >> x;
        if(n==0) break;
        for(i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                for(k=j+1;k<=n;k++){
                    sums.push_back(i+j+k);
                }
            }
        }
        for(auto sum : sums){
            if(sum == x){
                c ++;
            }
        }
        cout << c <<endl;
    }
    return 0;
}


Measured memory_bytes: 4476
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        for (int i = 0; i < s.length; i++) {
            if(i % 2 == 0) System.out.print(s[i]);
        }
    }
}

Measured memory_bytes: 47384
def main

  _ = ARGF.gets.chomp.to_i
  nums = ARGF.gets.split.map(&:to_i)

  cnt = 0
  nums.each do |n|
    while n.even?
      cnt += 1
      n /= 2
    end
  end

  puts cnt
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 4348
#include <iostream>

using namespace std;

int main(){
    int n, i, a, b, asum, bsum;
    while(cin >> n){
        if(n == 0){
            break;
        }
        asum = 0;
        bsum = 0;
        for(i = 0; i < n; ++i){
            cin >> a >> b;
            if(a > b){
                asum += a + b;
            }else if(a < b){
                bsum += a + b;
            }else{
                asum += a;
                bsum += b;
            }
        }
        cout << asum << " " << bsum << endl;
    }
}

Measured memory_bytes: 0
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    while (true) {
        int n,q;
        scan(n,q);

        if (!n && !q) return;

        auto a = iota(n).map!(i => readln.split.to!(int[])).array;
        solve(n, q, a);
    }
}

void solve(int n, int q, int[][] a) {
    auto b = new int[](200);
    foreach (ai ; a) {
        foreach (d ; ai[1 .. $]) {
            b[d]++;
        }
    }

    int mx = b.reduce!max;

    if (mx >= q) {
        writeln(b.countUntil(mx));
    }
    else {
        writeln(0);
    }
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll q,h,s,d;
  double n;
  cin>>q>>h>>s>>d>>n;
  vector<tuple<double,ll,double>> vec;
  vec.push_back(make_tuple(4*q,4*q,1));
  vec.push_back(make_tuple(2*h,2*h,1));
  vec.push_back(make_tuple(s,s,1));
  vec.push_back(make_tuple(d/2,d,2));
  sort(vec.begin(),vec.end());
  ll cost=0;
  while(true){
    ll f=get<1>(vec[0]);
    double s=get<2>(vec[0]);
    if(n<s) {
      vec.erase(vec.begin());
      continue;
    }
    n-=s;
    cost+=f;
    if(n==0) {
      cout<<cost;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int tmp = 0, cost = 1001001001;

  for (int i = -100; i <= 100; i++){
    tmp = 0;
    for (int j = 0; j < n; j++){
      tmp += (a[j] - i) * (a[j] - i);
    }
    cost = min(cost, tmp);
  }
  cout << cost << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<bits/stdc++.h>
 
using namespace std;
int main()
{
  string S,T,C;
  int A,B;
  cin>>S>>T;
  cin>>A>>B;
  cin>>C;
  if(S.compare(C)==0)
    cout<<A-1<<" "<<B;
  else
    cout<<A<<" "<<B-1;
  return 0;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,j,k,N,M,ans=0,move[3]={3,5,7};
  vec v,ch(3);
  For(i,3,10){
    N=pow(3,i);
    rep(j,N){
      M=j;
      ans=ch[0]=ch[1]=ch[2]=0;
      rep(k,i){
        ch[M%3]++;
        ans=ans*10+move[M%3];
        M/=3;
      }
      if(!(ch[0]*ch[1]*ch[2]))continue;
      v.push_back(ans);
    }
  }
  vsort(v);
  cin>>N;
  ans=upper_bound(all(v),N)-v.begin();
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 896
import java.util.*;
import java.io.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      
      	for (int i = 1; i < 10; i++) {
        	for (int j = 1; j < 10; j++) {
            	if (i * j == n) { System.out.println("Yes"); return; }
            }
        }
      
      	System.out.println("No");
    }
}


Measured memory_bytes: 21844