akhauriyash/Code-Regression huggingface dataset:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
ans = 10**10
mean = 10**10
for i in range(len(H)):
    ans = i if abs(A-(T-H[i]*0.006)) < mean else ans
    mean = abs(A-(T-H[i]*0.006)) if abs(A-(T-H[i]*0.006)) < mean else mean
print(int(ans)+1)

Measured memory_bytes: 3064
import std.algorithm, std.conv, std.range, std.stdio, std.string;

const mod = 10 ^^ 9 + 7;
alias mint = FactorRing!(mod, true);

void main()
{
  auto n = readln.chomp.to!int;

  int[int] ft;
  auto p = primes(n.nsqrt);

  foreach (i; 2..n+1) {
    while (i > 1) {
      auto f = factor(i, p);
      ++ft[f];
      i /= f;
    }
  }

  auto ans = mint(1);
  foreach (fti; ft.byValue)
    ans *= fti + 1;

  writeln(ans);
}

pure T[] primes(T)(T n)
{
  import std.algorithm, std.bitmanip, std.conv, std.range;

  auto sieve = BitArray();
  sieve.length((n + 1) / 2);
  sieve = ~sieve;

  foreach (p; 1..((nsqrt(n) - 1) / 2 + 1))
    if (sieve[p])
      for (auto q = p * 3 + 1; q < (n + 1) / 2; q += p * 2 + 1)
        sieve[q] = false;

  auto r = sieve.bitsSet.map!(to!T).map!("a * 2 + 1").array;
  r[0] = 2;

  return r;
}

pure T factor(T)(T n, const T[] pi)
{
  auto ma = nsqrt(n) + 1;
  foreach (p; pi)
    if (p > ma) return n;
    else if (n % p == 0) return p;
  return n;
}

pure T nsqrt(T)(T n)
{
  import std.algorithm, std.conv, std.range, core.bitop;
  if (n <= 1) return n;
  T m = 1 << (n.bsr / 2 + 1);
  return iota(1, m).map!"a * a".assumeSorted!"a <= b".lowerBound(n).length.to!T;
}

struct FactorRing(int m, bool pos = false)
{
  version(BigEndian) {
    union { long vl; struct { int vi2; int vi; } }
  } else {
    union { long vl; int vi; }
  }

  @property int toInt() { return vi; }
  alias toInt this;

  this(int v) { vi = v; }
  this(int v, bool runMod) { vi = runMod ? mod(v) : v; }
  this(long v) { vi = mod(v); }

  ref FactorRing!(m, pos) opAssign(int v) { vi = v; return this; }

  pure auto mod(int v) const
  {
    static if (pos) return v % m;
    else return (v % m + m) % m;
  }

  pure auto mod(long v) const
  {
    static if (pos) return cast(int)(v % m);
    else return cast(int)((v % m + m) % m);
  }

  static if (m < int.max / 2) {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vi + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vi - rhs)); }
  } else {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vl + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vl - rhs)); }
  }
  pure auto opBinary(string op: "*")(int rhs) const { return FactorRing!(m, pos)(mod(vl * rhs)); }

  pure auto opBinary(string op)(FactorRing!(m, pos) rhs) const
    if (op == "+" || op == "-" || op == "*") { return opBinary!op(rhs.vi); }

  static if (m < int.max / 2) {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vi + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vi - rhs); }
  } else {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vl + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vl - rhs); }
  }
  auto opOpAssign(string op: "*")(int rhs) { vi = mod(vl * rhs); }

  auto opOpAssign(string op)(FactorRing!(m, pos) rhs)
    if (op == "+" || op == "-" || op == "*") { return opOpAssign!op(rhs.vi); }
}


Measured memory_bytes: 256
/* ALDS1_1_B */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String[] str = br.readLine().split(" ");
      int x = Integer.parseInt(str[0]);
      int y = Integer.parseInt(str[1]);

      System.out.println(GCD(x, y));

    }catch(Exception e){
      System.out.println(e);
    }
  }

  public static int GCD(int x, int y)
  {
    int gcd;
    if(x % y == 0){
      gcd = y;
    }else {
      gcd = GCD(y, (x % y));
    }

    return gcd;
  }
}

Measured memory_bytes: 24200
import sys
from operator import itemgetter
from collections import deque
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [i for i in range(1, 10)]
C = [2, 5, 5, 4, 5, 6, 3, 7, 6]
inf = float('inf')
costs = {m: C[m-1] for m in A}
dp = deque([0])

for i in range(1, N+1):
        dp.append(max([dp[i-c] if i - c >= 0 else -inf for c in costs.values()])+1)

digits = list(costs.keys())
digits.sort(reverse=True)
result = deque()
num = N
for _ in range(dp[N]):
        for i in digits:
                if num >= costs[i] and dp[num-costs[i]] != -inf and dp[num-costs[i]] == dp[num]-1:
                        result.append(str(i))
                        num -= costs[i]
                        break

print(''.join(result))

Measured memory_bytes: 4060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b,m; cin>>a>>b>>m;
	vi va(a),vb(b);
	rep(i,0,a) cin>>va[i];
	rep(i,0,b) cin>>vb[i];
	ll ans=MOD;
	rep(i,0,m){
		int x,y,c; cin>>x>>y>>c;
		--x; --y;
		ll v=va[x]+vb[y]-c;
		ans=min(ans,v);
	}
	sort(all(va));
	sort(all(vb));
	ll d=va[0]+vb[0];
	ans=min(ans,d);
	cout<<ans;
	
	
	return 0;
}

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

#define int long long

int binpow(int a,int b)
{
    int res = 1;
    while(b>0)
    {
        if(b&1)
        {
            res = res*a;
        }
        a = a*a;
        b>>=1;
    }
    return res;
}

signed main()
{
    int n,d;
    cin >> n >> d;
    vector<vector<int>> a(n,vector<int>(d));
    for(int i = 0; i < n; ++i)
    {
        for(int j = 0; j < d; ++j)
        {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; ++i)
    {
        for(int j = i + 1; j < n; ++j)
        {
            int x = 0;
            for(int z = 0;  z < d; ++z)
            {
              x += binpow(abs(a[i][z] - a[j][z]),2);  
            }
            int t = pow(x,0.5);
            t = binpow(t,2);
            if(t == x) ans++;
        }
    }

    cout << ans;
}

Measured memory_bytes: 640
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	forever{
		bool White = false;
		int n,m;
		cin >> n >> m;
		if (n == 0 && m == 0) { break; }
		vector<int>a;
		rep(i, m) {
			int contents;
			cin >> contents;
			if (contents == 0) { White = true; }
			else {
				a.push_back(contents);
			}

		}
		Sort(a);
		int max = 0;
		vector <int>length_mem;
		if (!White) {
			int length = 0;
			rep(i, a.size()) {
				if (i != 0) {
					if (a[i] == a[i - 1] + 1) {
						length++;
					}
					else {
						length_mem.push_back(length);
						length = 0;
					}
				}
			}
			length_mem.push_back(length);
			Sort(length_mem);
			}
		else {
			vector<int>starts;
			vector<int>ends;
			int length = 0;
			rep(i, a.size()) {
				if (i != 0) {
					if (a[i] == a[i - 1] + 1) {
						length++;

					}
					else {
						length_mem.push_back(length);
						length = 1;
						ends.push_back(a[i - 1]);
						starts.push_back(a[i]);
					}
				}
			}
			length_mem.push_back(length);
			//if (starts.size() != 0) { ends.push_back(); }
			for (int i = 0; i < starts.size(); i++) {
				if (ends[i] + 2 == starts[i]) {
					length_mem.push_back(length_mem[i] + length_mem[i + 1] + 1);
				}
			}
			Sort(length_mem);
		}
		max = length_mem[length_mem.size() - 1] ;
		if (!White) { max++; }
		cout << max << endl;
	}
	return 0;
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
	int x=0,p=1;char c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}
using namespace std;
//ruogu_alter
const int N=5e5+5;
int n,pre[N],suf[N];
char s[N];
//
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	//n=getint();
	scanf("%s",s);n=strlen(s)+1;
	for(int i=1;i<n;i++){
		if(s[i-1]=='>')pre[i]=0;
		else pre[i]=pre[i-1]+1;
	}
	for(int i=n-2;i>=0;i--){
		if(s[i]=='<')suf[i]=0;
		else suf[i]=suf[i+1]+1;
	}
	ll res=0;
	rep(i,n)res+=max(pre[i],suf[i]);
	cout<<res;
	return 0;
}


Measured memory_bytes: 4608
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cassert>
#include <tuple>
#include <cmath>

using namespace std;

using ll = long long;

int main() {
    string s;
    cin >> s;
    
    int ans = 10000000;
    
    for (int i = 0; i + 2 < s.size(); i++) {
        ans = min(ans, abs(753 - stoi(s.substr(i, 3))));
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int n,x,i,I,j,a;
	
	while(100){
a=0;
	scanf("%d %d",&n,&x);
	if(n==0&&x==0)break;
	for(i=0;i<n-2;i++){
		for(I=0;I<n-1;I++){
			for(j=0;j<n;j++){
				if(i<I&&I<j){
				if(i+I+j+3==x){
				a++;
				}
			}
		}
	}	
}
	printf("%d\n",a);
	}

	return 0;
}




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

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long

const int N = 1e5 + 5;
	
void solve(){
	int n, w;
	cin >> n >> w;
	int wt[n], v[n];
	for(int i = 0 ; i < n ; i++){
		cin >> wt[i] >> v[i] ;	
	}
	int dp[N];// dp[i] repersents the minimum weight required for getting value equls to i;
	memset(dp, 0x3f, sizeof dp);
	dp[0] = 0;
	for(int i = 0 ; i < n ; i++){
		for(int j = 100000 ; j >= 0 ; j--){
			if(j + v[i] < N)
				dp[j + v[i]] = min(dp[j + v[i]], dp[j] + wt[i]);
		}
	}
	for(int i = 100000 ; i >= 0 ; i--){
		if(dp[i] <= w){
			cout << i;
			return;
		}
	}
}

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    X, N = [int(i) for i in input().strip().split()]
    p_list = [int(i) for i in input().strip().split()]

    base = list()
    for i in range(-110, 110):
        if i not in p_list:
            base.append(i)

    dif = float("inf")
    ans = None
    for j in base:
        if abs(j - X) < dif:
            dif = abs(j-X)
            ans = j

    return ans


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9204
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), K = sc.nextInt();
		sc.close();
		for (int i = 0; i < K; ++i) {
			if (i % 2 == 0) {
				B += A / 2;
				A /= 2;
			}
			else {
				A += B / 2;
				B /= 2;
			}
		}
		System.out.print(A + " " + B);
	}
}

Measured memory_bytes: 23892
import java.util.*;
import java.awt.geom.*;

public class Main{
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			char [] c= sc.next().toCharArray();
			if(c.length <= 1 && c[0] == '0'){
				break;
			}
			int [][] dp = new int[2][11];
			if(c[0] != '0'){
				dp[0][c[0] - '0'] = 1;
			}
			int count = 0;
			for(int i = 1; i < c.length; i++){
				
				int prev = (i + 1) % 2;
				int num = c[i] - '0';
				Arrays.fill(dp[i % 2], 0);
				if(i % 2 == 1) num *= -1;
				for(int j = 0; j < 11; j++){
					if(dp[prev][j] == 0) continue;
					int nextJ = (num + j + 11) % 11;
					dp[i % 2][nextJ] += dp[prev][j];
					if(nextJ == 0) count += dp[i % 2][nextJ];
				}
				if(num == 0) continue;
				dp[i % 2][(num + 11) % 11] += 1;
			}
			System.out.println(count);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

Measured memory_bytes: 30524
#pragma GCC optimize("Ofast")
#include<iostream>
#include<string>

using namespace std;

int a[200000],n,b;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)b^=a[i];
    for(int i=0;i<n;i++)cout<<(a[i]^b)<<"\n";
    return 0;
}

Measured memory_bytes: 4448
import math

A = []
while True:
    a, b ,c = map(str, input().split())
    if b == "?":
        break
    else:
        B = [a,b,c]
        A.append(B)

for i in A:
    if i[1] == "+":
        print(int(i[0]) + int(i[2]))
    elif i[1] == "-":
        print(int(i[0]) - int(i[2]))
    elif i[1] == "*":
        print(int(i[0]) * int(i[2]))
    elif i[1] == "/":
        print(math.floor(int(i[0]) / int(i[2])))
        


Measured memory_bytes: 5668
O = input()
E = input()
n1 = len(O)
n2 = len(E)
L =[]
if n1 > n2:
    for i in range(n2):
        L.append(O[i]+E[i])
    L.append(O[-1])
    print(''.join(L))
elif n1 == n2:
    for i in range(n1):
        L.append(O[i]+E[i])
    print(''.join(L))

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

int main(void) {
    string s,t;

    map<int,int> mps;
    map<int,int> mpt;
    cin >> s >> t;
    for(int i=0;i<s.size();i++) {
        mps[s[i]-'a']++;
    }
    for(int i=0;i<t.size();i++) {
        mpt[t[i]-'a']++;
    }
    // 文字列中に無い文字に入れ替えるパターンは考慮不要

    vector<int> sv;
    vector<int> tv;
    for(auto m:mps) {
        sv.push_back(m.second);
    }
    for(auto m:mpt) {
        tv.push_back(m.second);
    }

    sort(sv.begin(), sv.end());
    sort(tv.begin(), tv.end());

    if(sv == tv) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;

}


Measured memory_bytes: 776
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int a = scan.nextInt();
        String s = scan.next();
        if(a >= 3200){
            System.out.println(s);
        }else{
            System.out.println("red");
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e12;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 998244353;


int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    if(n % 2)
        cout << 0;
    else
    {
        int k = n / 2;
        int twos = k;
        int fives = 0;
        int a = k, p = 2;
        while(a >= p)
        {
            twos += a / p;
            p *= 2;
        }
        p = 5;
        a = k;
        while(a >= p)
        {
            fives += a / p;
            p *= 5;
        }
        cout << min(twos, fives);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
    long k;
    cin >> k;
    if (k%2==0)
    {
        cout << -1 << endl;
        return 0;
    }
    long M[10000000];
    M[0] = 7%k;
    if (M[0]==0)
    {
        cout << 1 << endl;
        return 0;
    }
    
    for (int i = 1; i < 10000000; i++)
    {
        M[i] = (( (M[i-1]%k)*(10%k) )%k + 7%k)%k;
        if (M[i]==0)
        {
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 81648
import sys
input = lambda: sys.stdin.readline().rstrip()

k, n = map(int, input().split())
A = list(map(int, input().split()))
A.append(A[0]+k)

l = 0
for i in range(n):
    l = max(l, A[i+1]-A[i])
ans = k - l
print(ans)

Measured memory_bytes: 26444
//Template
 
// By LD :)
//Includes
#include <vector> 
#include <queue>
#include <map> 
#include <set>
#include <utility> //Pair
#include <algorithm>
#include <sstream> // istringstream>> ostring stream<<
#include <iostream> 
#include <iomanip> 
#include <unordered_map>
//setbase - cout << setbase (16); cout << 100 << endl; Prlls 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prlls xxx77
//setprecision - cout << setprecision (4) << f << endl; Prlls x.xxxx
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
 
//I want to code the solutions as fast as possible)
typedef long long ll;
typedef vector <ll> vi;
typedef vector <vi> vvi;
typedef vector <string> vs;
typedef pair<ll, ll > pii;
typedef vector <ll> vll;
typedef stringstream ss;
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define sc(n) scanf("%d", &n)
#define fast ios_base:: sync_with_stdio(false)
#define llt(arr, x) memset(arr, x, sizeof(arr))
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, a, b) for(ll i = a; i <= b; i++)
#define revrep(n, i) for(ll i = n - 1; i >= 0; i--)
#define revrepp(i, b, a) for(ll i = b; i >= a; i--)
#define all(a)  a.begin(), a.end() 
#define rall(a)  a.rbegin(), a.rend() 
#define ESP (1e-9)
 
//String Utilities 
bool isl(char c){ 
  return (c >= 'a' && c <= 'z'); 
}
bool isu(char c){ 
  return (c >= 'A' && c <= 'Z'); 
}
bool isa(char c){ 
  return (isl(c) || isu(c)); 
}
bool isn(char c){ 
  return (c >= '0' && c <= '9'); 
}
bool isan(char c){ 
  return (isa(c) || isn(c)); 
}
bool isv(char c){ 
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); 
}
string tolow(string s){ 
  rep(i, s.sz) if(isu(s[i])) s[i] = s[i] -'A' + 'a'; return s; 
}
string toup(string s){ 
  rep(i, s.sz) if(isl(s[i])) s[i] = s[i] - 'a' + 'A'; return s;
}
 
//It all starts here ;)
 
//End Template
const ll N = 2e5 + 7;
const ll mod = 1e9 + 7;
const int logN = 20;
//Frequently used functions
ll gcd(ll a,ll b){
  if(a == 0){
    return b;
  }
  return gcd(b % a, a);
}
ll mpow(ll a, ll b){
  ll res = 1;
  while(b > 0){
    if(b & 1){
      res = (res * a) % mod;
    }
    b = b >> 1;
    a = (a * a) % mod;
  }
  return res % mod;
}
bool co(pair<int,pair<int,int>> &a, pair<int,pair<int,int>> &b){
  return a.ff < b.ff;
}
vs tokens(string s){
  stringstream ss;
  vs tt;
  ss.clear();
  ss << s;
  char str[s.sz + 10];
  strcpy(str, s.c_str()); 
  char *token = strtok(str, " -,/");
  while(token != NULL){
    string xy(token);
    tt.pb(xy);
    token = strtok(NULL, " -,/");
  }
  return tt;
}
ll modular_inv(ll a, ll b){
  ll b0 = b, t, q;
  ll x0 = 0, x1 = 1;
  if (b == 1) return 1;
  while (a > 1) {
    q = a / b;
    t = b, b = a % b, a = t;
    t = x0, x0 = x1 - q * x0, x1 = t;
  }
  if (x1 < 0) x1 += b0;
  return x1;
}
//Main program 
int main(){
  /*#ifndef ONLINE_JUDGE
  freopen("k1in.txt","r",stdin);
  freopen("k1out.txt","w",stdout);
  #endif*/
  cout << fixed << showpoint << setprecision(16); fast;
  int a, b;
  cin >> a >> b;
  int ans = max(a + b, max(a - b, a * b));
  cout << ans;
} 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
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> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	ll n, k;
	cin >> n;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			k = i;
		}
	}
	cout << (k - 1) + (n / k - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean[] isNotPrimes = new boolean[123456 * 2 + 1];
        isNotPrimes[0] = true;
        isNotPrimes[1] = true;
        for (int i = 2; i < isNotPrimes.length; i++) {
            if (isNotPrimes[i]) {
                continue;
            }
            for (int j = 2; i * j < isNotPrimes.length; j++) {
                isNotPrimes[i * j] = true;
            }
        }
        int[] counts = new int[isNotPrimes.length];
        for (int i = 1; i < counts.length; i++) {
            counts[i] = counts[i - 1];
            if (!isNotPrimes[i]) {
                counts[i]++;
            }
        }
        StringBuilder sb = new StringBuilder();
        while (true) {
            int x = sc.nextInt();
            if (x == 0) {
                break;
            }
            sb.append(counts[2 * x] - counts[x]).append("\n");
        }
        System.out.print(sb);
    }
}



Measured memory_bytes: 28504
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

int main(){
    string a, b;
    cin >> a >> b;
    if(std::stoi(a) >= stoi(b)){
        for(int i = 0; i < stoi(a); i++){
            cout << b;
        }
    }
    else{
        for(int i = 0; i < stoi(b); i++){
            cout << a;
        }
    }
    cout << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
ll sum(ll n)
{
    ll ans=n*(n+1)/2;
    return ans;
}
void solve()
{
    ll n;
    cin>>n;
    VL prime;
    ll p=0;
    while(n%2==0)
    {
        n/=2;
        p++;
    }
    prime.pb(p);
    for(int i=3;i<=sqrt(n);i+=2)
    {
        ll ct=0;
        while(n%i==0)
        {
            n/=i;
            ct++;
        }
        if(ct!=0)
            prime.pb(ct);
    }
    if(n>2)
    {
        prime.pb(1);
    }
    ll fct=0;
    fr(i,0,SZ(prime))
    {
        ll x=prime[i];
        if(x==0)
            continue;
        ll low=1,high=100;
        ll ans=-1;
        while(low<=high)
        {
            ll mid=(low+high)/2;
            if(sum(mid)>x)
            {
                high=mid-1;
            }
            else
            {
                ans=mid;
                low=mid+1;
            }
        }
        if(ans!=-1)
            fct+=ans;

    }
    cout<<fct<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3676
#include <cmath>
#include <iostream>
using namespace std;
int_fast32_t nn, n, sqrtN;
int_fast64_t ans, d;
main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> nn;
    const int_least32_t n = nn;
    if(n == 1) {
        putc_unlocked(49, stdout);
    } else {
        const int_fast32_t sqrtN = sqrt(n);
        ans = -(int_fast64_t)(sqrtN) * (sqrtN + 1) * (2 * sqrtN + 1) / 6;
        for(int i = 1; i <= sqrtN; ++i) {
            const int_fast32_t a = n / i;
            ans += ((int_fast64_t)i * (i + a) * (a + 1 - i));
        }
        cout << ans;
    }
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>

int main()
{
  int N;
  std::vector<int> list;
  std::cin >> N;
  for(int i = 0; i < N; ++i)
  {
    int x;
    std::cin >> x;
    list.push_back(x);
  }
  
  int count = 0, min = N;
  for(int a = 0; a < N; ++a)
  {
    if(list[a] <= min)
    {
      count++;
      min = list[a];
    }
  }
  
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 1400
#include<stdio.h>

int num[200002];

int main()
{
	int ans, n, i, a, b, c, temp;
	scanf("%d", &n);
	for(i=1 ; i<=n ; i++)
	{
		scanf("%d", &temp);
		num[temp] = i;
	}
	ans = 0;
	a = n;
	b = n-1;
	while(num[b] < num[a] && b)
	{
		a--;
		b--;
	}
	if(b == 0) ;
	else
	{
		c = b-1;
		ans++;
		while(c)
		{
			if(num[a] < num[b])
			{
				if(num[c]<num[a] || num[c]>num[b])
				{
					ans++;
					a = b;
					b = c;
					c--;
				}
				else
				{
					b = c;
					c--;
				}
			}
			else
			{
				if(num[c]<num[b] || num[c]>num[a])
				{
					b = c;
					c--;
				}
				else
				{
					ans++;
					a = b;
					b = c;
					c--;
				}
			}
		}
	}
	printf("%d", ans);
}

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

int main(){
    int n;
    cin >> n;
    int value[n], cost[n];
    for(int i=0;i<n;i++){
        cin >> value[i];
    }
    for(int i=0;i<n;i++){
        cin >> cost[i];
    }

    int different[n], ans = 0;
    for(int i=0;i<n;i++){
        different[i] = value[i] - cost[i];
        if(different[i] >= 0) ans += different[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	static ll L,N;
	static ll X[200010];
	scanf("%lld%lld",&L,&N);
	for(int i = 1 ; i <= N ; i ++){
		scanf("%d",&X[i]);
	}
	
	ll ret = 0;
	ll ans = X[N];
	ll l = 0;
	while(1){
		ret = max( ret , ans );
		if(2*(l+1) >= N)break;
		ans -= X[N-l]+X[N-(l+1)];
		ans += 2*(X[N-(2*l+1)]+X[N-(2*l+2)]);
		ans += 2*(L-X[N-l]);
		ret = max ( ret , ans+X[N-(l+1)]-(L-X[N-l])-2*X[N-(2*l+2)] );
		l ++;
	}
	for(int i = 1 ; i <= N ; i ++){
		X[i] = L-X[i];
	}
	reverse(X+1,X+N+1);
	ans = X[N];
	l = 0;
	while(1){
		ret = max( ret , ans );
		if(2*(l+1) >= N)break;
		ans -= X[N-l]+X[N-(l+1)];
		ans += 2*(X[N-(2*l+1)]+X[N-(2*l+2)]);
		ans += 2*(L-X[N-l]);
		ret = max ( ret , ans+X[N-(l+1)]-(L-X[N-l])-2*X[N-(2*l+2)] );
		l ++;
	}
	if(N%2 == 0){
		ans = 0;
		for(int i = 1 ; i <= N/2 ; i ++){
			ans += 2*X[i];
		}
		for(int i = N/2+1 ; i <= N ; i ++){
			ans += 2*(L-X[i]);
		}
		ans -= min( X[N/2] , L-X[N/2+1] );
		ret = max ( ret , ans );
	}
	cout << ret << endl;
}



Measured memory_bytes: 1792
import java.util.Scanner;

public class Main{

	public static void main(String args[]) {

		//
		String sentence = "";
		int shuffle_times = 0;
		int shuffle_number = 0;
		StringBuffer input_sentence = null;
		String out = "";
		StringBuffer out_all = new StringBuffer(out);

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

		while (sc.hasNext()) {

			// 入力文字列
			sentence = sc.next();
			//入力文字列が_の場合は
			if(sentence.equals("-"))
			break;
			
			//
			input_sentence = new StringBuffer(sentence);
			// シャッフルする回数
			shuffle_times = sc.nextInt();

			while (sc.hasNext()) {
				// シャッフル枚数
				for (int i = 0; i < shuffle_times; i++) {

					//
					shuffle_number = sc.nextInt();
					// シャッフルしてカードの上に移動するものを、取ってくる
					StringBuffer add_sentence = new StringBuffer(
							input_sentence.substring(0, (shuffle_number)));
					// 上に移動するカードを元のカード列から削除
					input_sentence = input_sentence.delete(0,(shuffle_number));
					//シャッフルしたあとカード列
					input_sentence = add_sentence.insert(0, input_sentence);

				}
				out_all = out_all.append(input_sentence+"\n");
				break;
			}

		}
		System.out.print(out_all);
	}

}

Measured memory_bytes: 18884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll MOD = 1e9+7;
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; }
#define print(x) cerr << #x << " is " << x << endl;


#define MAX_V 200005
int N;

vector<int> G[MAX_V];
int A[MAX_V], ans[MAX_V];
int dp[MAX_V + 1];
void add_edge(int from, int to){
    G[from].push_back(to);
    G[to].push_back(from);
}

int dfs(int p, int n, int d){
    int *pp = lower_bound(dp, dp + N, A[n]);
    int keep = *pp;
    *pp = A[n];
    ans[n] = lower_bound(dp, dp + N, INF) - dp;
    for (auto c: G[n]){
        if (p != c){
            dfs(n, c, d + 1);
        }
    }
    *pp = keep;
    return 0;
}
int main() {
    cin >> N;
    rep(i, N)cin >> A[i];
    rep(i, N - 1){
        int u, v;
        cin >> u >> v;
        add_edge(u - 1, v - 1);
    }
    fill(dp, dp + N, INF);
    dfs(-1, 0, 0);
    rep(i, N)cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 31076
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    const char B = '#';
    const char W = '.';

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var h = int.Parse(spl[0]);
        var w = int.Parse(spl[1]);

        var tbl = new char[h][];
        for (int i = 0; i < h; i++) {
            tbl[i] = input.ReadLine().ToCharArray();
        }

        for(int i=0; i<h; i++) {
            for (int j = 0; j < w; j++) {
                if (tbl[i][j] == W) continue;
                var ok = false;
                ok |= i - 1 >= 0 && tbl[i - 1][j] == B;
                ok |= i + 1 <  h && tbl[i + 1][j] == B;
                ok |= j - 1 >= 0 && tbl[i][j - 1] == B;
                ok |= j + 1 <  w && tbl[i][j + 1] == B;

                if (!ok) return No;
            }
        }
        return Yes;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }

    static long Pow(long x, long n) {
        long ans = 1;
        while (n > 0) {
            if (n % 2 == 1) {
                ans = ans * x;
            }
            x = x * x;
            n /= 2;
        }
        return ans;
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
    int main(void){
        // Your code here!
        string T;
            cin >> T;
        int max = 0;
        int maxx = 0;
            for(int i; i < T.size(); i++){
                if(T.at(i) == 'A' || T.at(i) == 'T' || T.at(i) == 'C' || T.at(i) == 'G'){
                    max += 1;
                }else{
                    if(maxx < max){
                        maxx = max;
                        max = 0;
                    }
                }
                    //cout << maxx << " " << max << endl;
            }
            
                if(maxx < max){
                        maxx = max;
                        max = 0;
                    }
            
                cout << maxx << endl;
    return 0;}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		List<Double> listX = new ArrayList<Double>();
		List<Double> listY = new ArrayList<Double>();
		while(scan.hasNext()){
			double a = scan.nextDouble();
			double b = scan.nextDouble();
			double c = scan.nextDouble();
			double d = scan.nextDouble();
			double e = scan.nextDouble();
			double f = scan.nextDouble();
			double y = (f * a - d * c)/(-d * b + e * a);
			double x = (f * b - e * c)/(b * d - e * a);
			if(x == 0)x = 0.; // 0????°???°?????\?????¨???????????????
			if(y == 0)y = 0.;
			listX.add(x);
			listY.add(y);
		}
		Iterator<Double> itX = listX.iterator();
		Iterator<Double> itY = listY.iterator();
		while(itX.hasNext()){
			double x = itX.next();
			double y = itY.next();
			System.out.printf("%.3f %.3f\n", x, y);
		}
	}
}

Measured memory_bytes: 28432
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

//n : 頂点数
class topological_sort{
    public:
        int n;
        vector<vector<int>> edge;
        vector<int> sorted;
        vector<int> mark;

        topological_sort(int n, vector<vector<int>>edge)
            : n(n), edge(edge), sorted(), mark(n) {}

        bool sort(){
            rep(i, n+1){
                if(mark[i] != 0){
                    continue;
                }
                if(not dfs(i)){
                    return false;
                }
            }
            return true;
        }

    private:
        bool dfs(int v){
            if(mark[v] == -1){
                return false;
            }
            if(mark[v] == 1){
                return true;
            }
            mark[v] = -1;

            for(int u : edge[v]){
                if(not dfs(u)){
                    return false;
                }
            }

            mark[v] = 1;
            sorted.push_back(v);
            return true;
        }
};


signed main(){
    int n, m;
    string s;
    cin >> n >> m >> s;

    vector<vector<int>> edge(2*n+1, vector<int>());
    rep(i, m){
        int a, b;
        cin >> a >> b;

        if(s[a-1] == s[b-1]){
            edge[a].push_back(b+n);
            if(a != b){
                edge[b].push_back(a+n);
            }
        }else{
            edge[a+n].push_back(b);
            edge[b+n].push_back(a);
        }
    }

    topological_sort ts(2*n+1, edge);

    cout << (ts.sort() ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 53440
#include <stdio.h>

#define WIDTH 6
#define HEIGHT 12

enum { YET, ALREADY };

int del( void );
int search( int, int );
int search_body( int, int, char );
void fall( void );

typedef struct {
	char color;
	int state;
} FIELD;

FIELD field[ WIDTH + 2 ][ HEIGHT + 2 ];
const int dx[ 4 ] = { -1, 0, 1, 0 }, dy[ 4 ] = { 0, -1, 0, 1 };

int stack[ WIDTH * HEIGHT ];
int sp;

int main( void ) {
	int n, x, y, chain;

	scanf( "%d", &n );
	while ( n-- ) {
		for ( y = 1; y <= HEIGHT; y++ )
			for ( x = 1; x <= WIDTH; x++ ) {
				scanf( " %c", &field[ x ][ y ].color );
				field[ x ][ y ].state = YET;
			}

		for ( chain = 0; del(); chain++ )
			fall();

		printf( "%d\n", chain );
	}

	return 0;
}

int del( void ) {
	int x, y, del = 0;

	for ( y = 1; y <= HEIGHT; y++ )
		for ( x = 1; x <= WIDTH; x++ )
			if ( field[ x ][ y ].color != '.' && field[ x ][ y ].color != 'O' && field[ x ][ y ].state == YET ) {
				sp = 0;
				if ( search( x, y ) >= 4 ) {
					while ( sp-- )
						field[ stack[ sp ] / ( HEIGHT + 2 ) ][ stack[ sp ] % ( HEIGHT + 2 ) ].color = '.';

					del = 1;
				}
			}

	return del;
}

int search( int x, int y ) {
	return search_body( x, y, field[ x ][ y ].color );
}

int search_body( int x, int y, char color ) {
	int i, sum;

	stack[ sp++ ] = x * ( HEIGHT + 2 ) + y;
	field[ x ][ y ].state = ALREADY;

	sum = 0;
	for ( i = 0; i < 4; i++ ) {
		int nx = x + dx[ i ], ny = y + dy[ i ];

		if ( field[ nx ][ ny ].state == YET && ( field[ nx ][ ny ].color == color || field[ nx ][ ny ].color == 'O' ) )
			if ( field[ nx ][ ny ].color == 'O' )
				stack[ sp++ ] = nx * ( HEIGHT + 2 ) + ny;
			else
				sum += search_body( nx, ny, color );
	}

	return sum + 1;
}

void fall( void ) {
	int x, y;

	for ( x = 1; x <= WIDTH; x++ ) {
		int cnt = 0;

		for ( y = HEIGHT; y > 0; y-- )
			if ( field[ x ][ y ].color == '.' )
				cnt++;
			else {
				field[ x ][ y + cnt ].color = field[ x ][ y ].color;
				field[ x ][ y + cnt ].state = YET;
			}

		for ( y = cnt; y > 0; y-- )
			field[ x ][ y ].color = '.';
	}
}

Measured memory_bytes: 596
// itne me hi thakk gaye?
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")
#define ll long long 
#define ull unsigned long long
using ld = long double;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll rk = 256;
const ll mod2 = 998244353;
const ld PI = 3.141592653589793;
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define print(a) for(auto j:a) {cout<<j<<",";} cout << "\n";
#define endl '\n'
#define whatis(x) cout << "> "<<#x << " ==> " << x << endl;
#define lwi(x) cout << " your " << #x << " is ---> " << x << " ";
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
// // Printing pair
ostream & operator << (ostream & os, pair <ll, ll> const& x) {
    os << x.first << "," << x.second;
    return os;
}
 
// printing vector
template <class T>
ostream & operator << (ostream & os, vector <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
// printing set
template <class T>
ostream & operator << (ostream & os, set <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
const int mxn = 1e6+5;
vc <int> divs(int n) {
    vc <int> d;
    for(int i=1; i<=sqrt(n); i++) {
        if(n%i == 0) {
            if(n/i == i) {
                d.pb(i);
            } else {
                d.pb(i);
                d.pb(n/i);
            }
        }
    }
    return d;
}
int32_t main(){
    FastIO;
    int n;
    cin >> n;
    vc <int> arr(n, 0);
    map<int, int> f;
    for(int i=0; i<n; i++) {
        cin >> arr[i];
        f[arr[i]]++;
    }    
   ll ans=0;
   for(int i:arr)
   {
       auto d= divs(i);
       bool ok = true;
       if(f[i]>1)
        ok=false;
        else
        {
            for(auto p:d)
            {
                if(f.find(p)!=f.end() && p!=i) ok = false;
            }
        }

        if(ok) ans++;
   }
   cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 13480
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=a;s>0?i<n:i>n;i+=s)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>inline bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10, mod = 1e9+7; const long long llinf = 1e18;
// head

int main(){
  int n,k;
  cin >> n >> k ;
  vector<int>data(k,0);
  for range(i,k){
    data[i] += 1;
  }
  n -= k;
  data[0] += n;
  cout << *max_element(all(data))-*min_element(all(data)) << endl;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

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

    rep(i,n/4+1){
        rep(j,n/7+1){
            if(4*i+7*j==n){
                cout << "Yes" << endl;
                return (0);
            }
        }
    }

    cout << "No" << endl;
    return (0);
}


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

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

using ll = long long;
#define INF 1e9

int N;
string s;
vector<int> ans;

bool solve(){
  FOR(i, 1, N-1){
    if(ans[i] == 0){
      if(s[i] == 'o'){
        ans[i+1] = (ans[i-1] + 1) % 2;
      }
      else{
        ans[i+1] = ans[i-1];
      }
    }
    else{
      if(s[i] == 'o'){
        ans[i+1] = ans[i-1];
      }
      else{
        ans[i+1] = (ans[i-1] + 1) % 2;
      }
    }
  }
  if((ans[N-1] == 0 && s[N-1] == 'o') || (ans[N-1] == 1 && s[N-1] == 'x')){
    if(ans[N-2] != ans[0]){
      if(ans[0] == 0 && s[0] == 'o' || ans[0] == 1 && s[0] == 'x'){
        return ans[N-1] != ans[1];
      }
      else{
        return ans[N-1] == ans[1];
      }
    }
    else{
      return false;
    }
  }
  else{
    if(ans[N-2] == ans[0]){
      if(ans[0] == 0 && s[0] == 'o' || ans[0] == 1 && s[0] == 'x'){
        return ans[N-1] != ans[1];
      }
      else{
        return ans[N-1] == ans[1];
      }
    }
    else{
      return false;
    }
  }
}

int main(){
  cin >> N;
  cin >> s;
  ans.resize(N, 0);
  
  REP(i, 2){
    REP(j, 2){
      ans[0] = i, ans[1] = j;
      if(solve()){
        REP(i, N){
          cout << (ans[i] ? 'S': 'W');
        }
        cout << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
	int a,b,laji;
	cin>>a>>b;
	if(a<=0&&b>=0)
	{
		cout<<"Zero";
		return 0;		
	} 
	if(a>0)
	{
		cout<<"Positive";
		return 0;
	}
	if(b<0)
	{
		laji=b-a;
		if(laji%2==0)
		{
			cout<<"Negative";
			return 0;			
		}
		else
		{
			cout<<"Positive";
			return 0;
		}
	}
	return 0;
}

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

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

  string s;
  cin >> s;
  if  (s[0] == '7' || s[1] == '7' || s[2] == '7') {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3652
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }
long N,i,B,ans,n;
vector<long> A;
bool use2,use4;

inline void solve(){
  IN(N);
  A.resize(N);
  INS(i,N,A);
  sort(ALL(A));
  REP(i,N){
    n=upper_bound(ALL(A),A[i])-lower_bound(ALL(A),A[i]);
    if(n>=4){
      chmax(ans,A[i]*A[i]);
      B=A[i];
      use4=true;
    }else if(use2&&n>=2){
      chmax(ans,B*A[i]);
      B=A[i];
    }else if(n>=2){
      if(use4)chmax(ans,B*A[i]);
      B=A[i];
      use2=true;
    }
    i+=n;
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 1024