akhauriyash/Code-Regression huggingface dataset:
import Data.List

main = do
    _ <- getLine
    as <- map read . words <$> getLine
    print $ solve as

solve :: [Int] -> Int
solve = sum . map (length . filter (==2) . primeFactors)

-- Prime.hs
type Pairs a = [(a, Int)]

primes :: Integral a => [a]
primes = 2 : filter ((==1) . length . primeFactors) [3,5..]

primeFactors :: Integral a => a -> [a]
primeFactors n = factor n primes where
    factor m (p:ps)
        | m < 0          = -1 : factor (abs m) (p:ps)
        | p*p > m        = [m]
        | m `mod` p == 0 = p : factor (m `div` p) (p:ps)
        | otherwise      = factor m ps

isPrime :: Integral a => a -> Bool
isPrime 1 = False
isPrime n = case (primeFactors n) of
    (_:_:_)     -> False
    _           -> True

isOddComposit :: Integral a => a -> Bool
isOddComposit n = case (primeFactors n) of
    (2:_:_)     -> False
    (_:_:_)     -> True
    _           -> False

factorize :: Integral a => a -> [a]
factorize 1 = []
factorize n = v : factorize (n `div` v)
    where v = head . primeFactors $ n

primeVectors :: Integral a => a -> Pairs a
primeVectors = count . primeFactors
    where count = map (\xs@(x:_) -> (x, length xs)) . group

combExp :: Integral a => a -> [Pairs a]
combExp n = map (zip primes') . combs $ exps
    where
        pvs = primeVectors n
        primes' = fst . unzip $ pvs
        exps   = snd . unzip $ pvs
        combs [] = [[]]
        combs (x:xs) = [a:as| a <- [0..x], as <- combs xs]

divisors :: Integral a => a -> [a]
divisors n = init . sort . map pvsToNum . combExp $ n
    where pvsToNum = product . map (uncurry (^))


Measured memory_bytes: 7548
#include <iostream>
#include <cassert>

template<int Modulus>
struct modint {
	using value_type = int;

	static constexpr int mod = Modulus;
	static_assert(mod > 1, "Modulus must be greater than 1");

private :
	value_type x;

	template<class T>
	static constexpr value_type normalize (T value) noexcept {
		if (value < 0) {
			value = (-value) % mod;
			return (value ? value : mod - value);
		}
		return (value % mod);
	}

public :
	explicit constexpr modint () noexcept : x(0) { }

	template<class T>
	constexpr modint (T value) noexcept : x(normalize(value)) { }

	constexpr modint operator+ () const noexcept {
		return modint(*this);
	}

	constexpr modint operator- () noexcept {
		if (x != 0) x = mod - x;
		return modint(*this);
	}

	constexpr modint &operator+= (const modint &p) noexcept {
		if ((x += p.x) >= mod) x -= mod;
		return (*this);
	}

	constexpr modint &operator-= (const modint &p) noexcept {
		if ((x += mod - p.x) >= mod) x -= mod;
		return (*this);
	}

	constexpr modint &operator*= (const modint &p) noexcept {
		x = (int)(1LL * x * p.x % mod);
		return (*this);
	}

	constexpr modint &operator/= (const modint &p) noexcept {
		return ((*this) *= p.inverse());
	}

	constexpr modint operator+ (const modint &p) const noexcept {
		return (modint(*this) += p);
	}

	constexpr modint operator- (const modint &p) const noexcept {
		return (modint(*this) -= p);
	}

	constexpr modint operator* (const modint &p) const noexcept {
		return (modint(*this) *= p);
	}

	constexpr modint operator/ (const modint &p) const noexcept {
		return (modint(*this) /= p);
	}

	constexpr modint pow (long long exp) const noexcept {
		modint value(1), buff(x);
		while (exp) {
			if (exp & 1) value *= buff;
			buff *= buff;
			exp >>= 1;
		}
		return value;
	}

	constexpr modint inverse () const noexcept {
		return pow(Modulus - 2);
	}

	friend std::ostream &operator<< (std::ostream &os, const modint &p) {
		return (os << p.x);
	}

	friend std::istream &operator>> (std::istream &is, modint &p) {
		long long v;
		is >> v;
		p = modint(v);
		return (is);
	}

};


#include <iostream>
constexpr int MOD = 1'000'000'007;

modint<MOD> binom (int n, int r) {
	if (n < r or n < 0 or r < 0) return modint<MOD>(0);
	r = std::min(r, n - r);
	modint<MOD> ans = 1;
	for (int i = n; i > n - r; i--) ans *= i;
	for (int i = 2; i <= r; i++) ans /= i;
	return ans;
}

int main() {
	int n, a, b;
	std::cin >> n >> a >> b;
	
	modint<MOD> ans = modint<MOD>(2).pow(n) - 1;
	ans -= (binom(n, a) + binom(n, b));
	
	std::cout << ans << '\n';
	
	return 0;
	
}

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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool good(int x){
    int div = 0;
    for(int a = 1; a <= x; a++){
        div += (x % a == 0);
    }
    return div == 8;
}

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

    int N;
    cin >> N;

    int ans = 0;
    for(int a = 1; a <= N; a += 2){
        ans += good(a);
    }

    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
 
bool g(string a,string b){
    rep(i,0,a.size()){
        if(a[i]==b[i]||a[i]=='?'||b[i]=='?')continue;
        return false;
    }
    return true;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    string S,T;cin>>S>>T;
    bool f(false);
    for(int i=S.size()-T.size();i>=0;i--){
        if(g(T,S.substr(i,T.size()))){

            f=true;
            rep(j,0,T.size())S[i+j]=T[j];
            break;
        }
    }
    if(!f){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }

    rep(i,0,S.size())if(S[i]=='?')S[i]='a';
    cout<<S<<endl;

        
    
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

input = lambda: sys.stdin.readline().rstrip()


def bfs(H, W, start, s):

    q = deque()
    q.append(start)
    d = [[-1 for _ in range(W)] for _ in range(H)]
    d[start[1]][start[0]] = 0
    move = [(-1, 0), (1, 0), (0, -1), (0, 1)]

    while q:
        now = q.popleft()
        x, y = now
        for m in move:
            n_x, n_y = x + m[0], y + m[1]
            if (0 <= n_x and n_x < W) and (0 <= n_y and n_y < H):
                if d[n_y][n_x] == -1 and s[n_y][n_x] == '.':
                    d[n_y][n_x] = d[y][x] + 1
                    q.append((n_x, n_y))

    r = 0
    for t in d:
        r = max(r, max(t))

    return r


def solve():
    H, W = map(int, input().split())
    s = [list(input()) for _ in range(H)]

    ans = 0
    for x in range(W):
        for y in range(H):
            if s[y][x] == '.':
                start = (x, y)
                d = bfs(H, W, start, s)
                ans = max(ans, d)

    print(ans)


if __name__ == '__main__':
    solve()


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 3e3 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dp[MAXN][MAXN][2];
ll a[MAXN];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0;i<=n;i++) {
		dp[i][i][0] = 0; dp[i][i][1] = 0;
	}
	for(int l = 1; l<=n;l++){
		for(int i = 0;i < n; i++){
			ll j = i + l;
			if(j > n) break;
			
			dp[i][j][0] = max(a[i] + dp[i + 1][j][1], a[j-1] + dp[i][j-1][1]);
			dp[i][j][1] = min(dp[i + 1][j][0] - a[i], dp[i][j-1][0] - a[j-1]);
		}
	}
	cout << dp[0][n][0];
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


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

#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++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll n, m;
  cin >> n >> m;
  map<ll, ll> mp;
  vector<bool> ok(n, false);
  ll ac = 0, wa = 0;
  REP(i, m) {
    ll p;
    string s;
    cin >> p >> s;
    --p;
    if (s == "WA") {
      mp[p]++;
    } else {
      if (!ok[p]) {
        ++ac;
        wa += mp[p];
        ok[p] = true;
      }
    }
  }
  cout << ac << " " << wa << endl;
  return 0;
}

Measured memory_bytes: 6528
N = gets.to_i
count = Hash.new{0}
valid = true
gets.split.each{|i|
    i = i.to_i
    count[i] += 1
    if count[i] > 2 || (i == 0 && count[i] > 1)
        valid = false
        break
    end
}
M = 10 ** 9 + 7
if valid
    n = N / 2
    r = 1
    m = 2
    while n > 0
        if n & 1 == 1
            r = r * m % M
        end
        n >>= 1
        m = m * m % M
    end
    puts r
else
    puts 0
end


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

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};



int main() {
  ll n;
  cin>>n;
  Sieve sv(55555);
  vector<int> v;
  v=sv.primes;
  ll now=0;
  vector<ll>A;
  rep(i,v.size()){
    if (v[i]%10==1) {
      now++;
      A.push_back(v[i]);
    }
  }
  rep(i,n){
    cout<<A[i]<<' ';
  }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int k;
  cin >> k;
  char s[101];
  cin >> s;
  int n=strlen(s);
  if(n<=k) {
    cout << s << endl;
  } else {
    REP(i,k) {
      cout << s[i];
    }
    cout << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3556
public class Main {
 
  private static void solve() {
    int a = ni();
    int b = ni();

    System.out.println(a * b % 2 == 0 ? "No" : "Yes");
  }
 
  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }
 
  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;
 
  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
 
  private static double nd() {
    return Double.parseDouble(next());
  }
 
  private static long nl() {
    return Long.parseLong(next());
  }
 
  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }
 
  private static char[] ns() {
    return next().toCharArray();
  }
 
  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }
 
  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }
 
  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }
 
  private static int ni() {
    return Integer.parseInt(next());
  }
 
  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
 }

Measured memory_bytes: 21200
N, W = map(int, input().split())

items = []
for _ in range(N):
    w, v = map(int, input().split())
    items.append((v, w))

w0 = items[0][1]
itemGrp = [[] for _ in range(4)]
for v, w in items:
    itemGrp[w - w0].append(v)

for i in range(4):
    itemGrp[i].sort(reverse=True)

accItemGrp = []
for i in range(4):
    item = itemGrp[i]
    accValue = [0] * (len(item) + 1)
    for i in range(1, len(item) + 1):
        accValue[i] = accValue[i - 1] + item[i - 1]
    accItemGrp.append(accValue)

ans = 0
for n0 in range(len(itemGrp[0]) + 1):
    for n1 in range(len(itemGrp[1]) + 1):
        for n2 in range(len(itemGrp[2]) + 1):
            for n3 in range(len(itemGrp[3]) + 1):
                weight = (n0 + n1 + n2 + n3) * w0 + n1 + 2 * n2 + 3 * n3
                if weight <= W:
                    value = 0
                    for i, n in enumerate([n0, n1, n2, n3]):
                        value += accItemGrp[i][n]
                    ans = max(ans, value)

print(ans)


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

void main(){
    int n = readln.chomp.to!int;
    foreach(i; 0..n){
        auto res = (readln.chomp.BigInt + readln.chomp.BigInt).to!string;
        if(res.length > 80)
            "overflow".writeln;
        else
            res.writeln;
    }
}

Measured memory_bytes: 1040
#include<stdio.h>
#include<string.h>
int main()
{
    char s[8];
    scanf("%s",s);
    if(s[0]=='S')
      printf("Cloudy\n");
    else if(s[0]=='C')
        printf("Rainy\n");
    else
        printf("Sunny\n");
}


Measured memory_bytes: 128
def resolve():
    n=int(input())
    abcd = 'abcdefghijklmnopqrstuvwxyz'
    s=""
    while True:
        a=n%26
        if a==0:
            a=26
        s=abcd[a-1]+s
        n=int((n-a)/26)
        if n==0:
            break
    print(s)
resolve()

Measured memory_bytes: 61776
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long K = sc.nextLong();
    sc.close();

    long q = N / K; // 0方向に丸め込む
    long ans = Math.min(Math.abs(N - (K * (q + 1))), Math.abs(N - (K * q)));
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
import collections
INF = 10**10
N,C=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(C)]
c=[list(map(int,input().split())) for _ in range(N)]
lc= [[],[],[]]
for i in range(N):
    for j in range(N):
        lc[(i+j) % 3].append(c[i][j])
clc = [collections.Counter(lc[i]) for i in range(3)]

def iwakan(clist,color):
    global C
    ret = 0
    for i in range(C):
        ret += clist[i+1] * d[i][color]
    return ret

res = INF
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i == j or i == k or j == k:
                continue
            res = min(res,iwakan(clc[0],i)+iwakan(clc[1],j)+iwakan(clc[2],k))

print(res)

Measured memory_bytes: 9780
#include <iostream>
#include <vector>
#include <utility>
#include <bitset>

using namespace std;

int n, m;
bool edge[50][50];
vector<pair<int, int>> input;
bitset<50> b;
bool dfs(int x){
    b[x] = true;
    if(b.count() == n) return true;
    for(int i = 0; i < n; i++){
        if(edge[x][i] && !b[i]){
            if(dfs(i)) return true;
        }
    }
    return false;
}

int main(){
    cin >> n >> m;
    input.resize(m);
    for(auto&& i : input){
        cin >> i.first >> i.second;
        i.first--;
        i.second--;
        edge[i.first][i.second] = edge[i.second][i.first] = true;
    }
    int ans = 0;
    for(auto&& i : input){
        edge[i.first][i.second] = edge[i.second][i.first] = false;
        b.reset();
        ans += !dfs(0);
        edge[i.first][i.second] = edge[i.second][i.first] = true;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))
color=[]
count,free=0,0

for i in range(n):
    c=a[i]//400
    if a[i]<3200 and c not in color:
        color.append(c)
        count+=1
    elif a[i]>=3200:
        free+=1
      
min,max=0,0
if count==0:
    max=free
    min=1
else:
    max=count+free
    min=count
    
print(min,max)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
int main(){
    long x;
    cin >> x;
    //cout << "x " << x << endl;
    long current = 100;
    long years = 0;
    while(current < x){
        years++;
        current += (double)0.01*(double)current;
    }
    cout << years << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
#define mod 1000000007
#define int long long
int f[2010][2010],fac[4000100],inv[4000100],n,k;
int quickpow(int x,int y){
	if(y==0)return 1;
	if(y%2==0)return quickpow(x*x%mod,y/2);
	if(y%2==1)return quickpow(x*x%mod,y/2)*x%mod;
}
int C(int x,int y){
	if(x<y||y<0)return 0;
	if(x==y||y==0)return 1;
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
signed main(){
	scanf("%lld%lld",&n,&k);
	if(k==1){
		puts("1");
		return 0;
	}
	fac[0]=1;
	for(int i=1;i<=n*k;i++)
		fac[i]=fac[i-1]*i%mod;
	inv[n*k]=quickpow(fac[n*k],mod-2);
	for(int i=n*k-1;i>=0;i--)
		inv[i]=inv[i+1]*(i+1)%mod;
	f[0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=i;j>=0;j--){
            if(j)(f[i][j]+=f[i-1][j-1]*C(k*i-j-1,k-2)%mod)%=mod;
            f[i][j]=(f[i][j]+f[i][j+1])%mod;	
		}
	printf("%lld\n",fac[n]*f[n][0]%mod);
}

Measured memory_bytes: 94080
#include <cstdlib>
#include <string>
#include <ctime>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
using namespace std;

int n;
int a, b;

int main(){
	scanf("%d%d%d", &n, &a, &b);
	int ans = 0;
	for(int i = 0; i < n; i++){
		int t;
		scanf("%d", &t);
		if(t < a || b <= t){
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
    long int a,b;
    long int c;
    int i;
    scanf("%ld%ld",&a,&b);
    for(i=1;i<100001;i++){
        c=a*i;
        if(c%b==0){
            break;
        }
    }
    printf("%ld",c);
    return 0;
}

Measured memory_bytes: 128
answer = {
    "1":[1,2,3,4,5,6,7,8,9],
    "2":[2,4,6,8,10,12,14,16,18],
    "3":[3,6,9,12,15,18,21,24,27],
    "4":[4,8,12,16,20,24,28,32,36],
    "5":[5,10,15,20,25,30,35,40,45],
    "6":[6,12,18,24,30,36,42,48,54],
    "7":[7,14,21,28,35,42,49,56,63],
    "8":[8,16,24,32,40,48,56,64,72],
    "9":[9,18,27,36,45,54,63,72,81]
}

N = int(input())
a = 0
for value in answer.values():
  if N in value:
    a = 1

if a == 1:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll f[10][10];
void solve(){
    cin>>n;
    for(int i=1,j,k,_10=1;i<=n;++i){
        if(i>_10*10)_10*=10;
        ++f[i/_10][i%10];
    }
    ll ans=0;
    for(int i=1;i<10;++i)
        for(int j=1;j<10;++j)
            ans+=1ll*f[i][j]*f[j][i];
    cout<<ans<<endl;
}
int main(){
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

#define INF 1000000;
/*
n 10^5
 */

int dig_sum(int x){
  int ret=0;
  while(x>0){
    ret+=x%10;
    x /= 10;
  }

  return ret;
}

int n;

int main(){
  cin>>n;

  int ans=INF;
  FOR_IN(a,1,n){
    int b=n-a;
    ans = min(ans, dig_sum(a) + dig_sum(b));
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! (
        N: i64,
        A: i64,
        B: i64,
    );

    let mut ans = N/(A+B)*A;
    if N % (A+B) > A {
        ans += A;
    } else {
        ans += N % (A+B);
    }
    println!("{}", ans);
}


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

int n;
int a[110];
int main(void){
	cin >> n;
	rep(i,n){
		int idx,num;
		cin >> idx >> num;
		a[idx-1]=num;
	}
	int ans=max_element(a,a+n)-a;
	cout << ans+1 << " " << a[ans] << endl;
	return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<queue>
#include<bitset>
#include<algorithm>
#include<climits>
#include<vector>
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define dump(a) rep(i,a.size()){ cout<<a[i]<<" "; } cout<<endl;
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define INF INT_MAX/3
#define EPS 1e-7

/*
 *
 */

int main(){
  ll n,m;
  ll x[100001];
  ll y[100001];
  cin>>n>>m;
  const ll B = 1e9+7;

  ll s=0,t=0;
  rep(i,n){
    cin>>x[i];
    s = (s + x[i]*(2*i-n+1))%B;
  }
  rep(i,m){
    cin>>y[i];
    t = (t + y[i]*(2*i-m+1))%B;
  }
  cout<<(s*t)%B<<endl;
  return 0;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<stack>
#include<queue>
#include<sstream>
#include<bitset>
#include<cstdio>
#include<stdio.h>
#include<cstring>
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <unordered_map>
using namespace std;
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
}
int main()
{
	//in_out_txt();
	fast();
	int a,b,k;
	cin>>a>>b>>k;
	int t=k;
	set<int>s;
	/*if(k>b)
	{
		for(int i=a;i<=b;i++)
			cout<<i<<'\n';
		return 0;
	}*/
	int i=a;
	while(k-- && i<=b)
	{
		s.insert(i);
		i++;
	}
	i=b;
	while(t-- && i>=a)
	{
		s.insert(i);
		i--;
	}
	set<int>::iterator it;
	for(it=s.begin();it!=s.end();it++)
		cout<<*it<<'\n';
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
// this program is not accepted (26/29 ) //
#include<iostream>
#include<stdlib.h>
using namespace std;
 
int main(){
    int64_t n,a,b,counta,countsum;
    cin >> n >> a >> b;
    if (a+b == 0) {
        cout << 0 << endl; 
        return 0;
    }
    if (n < a) {
        cout << n << endl; 
        return 0;
    }
    else if (n <= a+b) {
        cout << a << endl; 
        return 0;
    }
    counta = n/(a+b)*a;
    countsum = n/(a+b)*(a+b);
 
    if (n <= countsum + a) {
        cout << counta + n - countsum << endl;
        return 0;
    }
    else if (n <= countsum + a + b ) {
        cout << counta + a << endl; 
        return 0;
    }
    return 0;
 
 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    string S; cin >> S;
    int K; cin >> K;
    int N = S.size();
    int cnt1 = 0;
    string T = S+S+S;
    repr(i,1,N){
        if(S[i] == S[i-1]){
            S[i] = '1';
            cnt1++;
        }
    }
    int cnt2 = 0;
    repr(i,1,3*N){
        if(T[i] == T[i-1]){
            T[i] = '1';
            cnt2++;
        }
    }
    ll ans = 0;
    int m = cnt2-cnt1*3;
    if(m <= 1) ans = (ll)cnt1*K + (ll)m*(K/2);
    else ans = (ll)cnt1*K + K-1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  ll sum = 0;
  for(ll i = 1; i <= N; i++){
    if(i % 3 == 0 || i % 5 == 0) continue;
    sum += i;
  }
  cout  << sum << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    vector<int> a(3);
    in_arr(int, a, 3);
    sort(a.begin(), a.end());
    cout << a[2] * 10 + a[1] + a[0] << endl;
    return 0;
}


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

int main() {
  int64_t k;
  cin >> k;
  int32_t n = 50;

  cout << n << endl;
  int64_t gochi = k / n;
  int32_t usa = k % n;
  for (int32_t i = 0; i <= n; i++) {
    if (i + usa != n) {
      cout << i + gochi << ' ';
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
/*
	*	Created By: 'Present_Sir'
	*	Created On: Wednesday 05 August 2020 11:17:55 AM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    
    sort(a, a+3);
    if(a[0] != 5 || a[1] !=5 || a[2] != 7){
        cout<<"NO"<<endl;
        return;
    }
    cout<<"YES"<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int a[100000];
int main(){
	int n;
	scanf("%d",&n);
	memset(a,0x3f,sizeof(a));
	for(int i=0,x;i<n;i++){
		scanf("%d",&x);
		*lower_bound(a,a+n,x)=x;
	}
	printf("%d\n",lower_bound(a,a+n,0x3f3f3f3f)-a);
	return 0;
}

Measured memory_bytes: 1588
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
fn main() {
  fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
  }
  let ue: Vec<char> = read::<String>().chars().collect();
  let mut shita: Vec<char> = read::<String>().chars().collect();
  shita.reverse();

  if ue == shita {
    println!("YES")
  } else {
    println!("NO")
  }
}


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

using namespace std;
using ll = long long;

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(m),b(m);
  REP(i,m)cin>>a[i]>>b[i];
  int k=200;
  vector<vector<ll>> cnt(k);
  REP(i,k)cnt[i].resize(i);
  vector<ll> sum(n);
  REP(i,m){
      if(b[i]>=k){
          int pos=b[i]-a[i]-1;
          while(pos<n){
              sum[pos]+=b[i];
              pos+=b[i];
          }
      }else{
          cnt[b[i]][(b[i]-a[i]%b[i])%b[i]]+=b[i];
      }
  }
  ll ans=0;
  REP(i,m)ans+=(a[i]+1)%b[i];
  cout<<ans<<endl;
  for(int j=1;j<n;++j){
      ans+=m;
      for(int i=1;i<k;++i){
          ans-=cnt[i][(j+1)%i];
      }
      ans-=sum[j];
      cout<<ans<<endl;
  }
}



Measured memory_bytes: 4432
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>

//Some constants don't work
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN -2147483648
#endif
//short hand tricks
typedef long long ll;

using namespace std;

//idea if you xor all the input xors
//you get result of each number xor'd odd number of times which is the same as each number xor'd once
int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> scarfs(n);
    ll allxor = 0;
    for(int i=0; i<n; i++) {
        cin >> scarfs[i];
        allxor ^= scarfs[i];
    }
    //get back the original numbers
    for(int i=0; i<n; i++) {
        ll original = allxor^scarfs[i];
        cout << original << " ";
    }
    
    return 0;
}


Measured memory_bytes: 4744
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int s;
  cin >> s;
int a[1000010];
  for(int i = 0;i < 1000010;i++){
  a[i] = 2;
  }
  
  for(int i = 0; i < 1000010;i++){
  a[s -1]--;  
  if(a[s - 1] == 0){
  cout << i + 1 << endl;
    break;
  }
 
  else if(s % 2 == 0){
    s /= 2;
  }
  else if(s % 2 == 1){
  s = s * 3 + 1;
    } 
  }    
  
  return 0;
  
}

Measured memory_bytes: 4096
#include <iostream>

using namespace std;

int main(void)
{
	char str[50]= {};
	char res[50]= {};
	cin>>str;

	for(int i= 0; i<4; i++)
		res[i]= str[i];
	res[4]= ' ';

	for(int i= 4; i<=12; i++)
		res[i+1]= str[i];
	cout<<res<<endl;
	return 0;
}

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

int main() {
  int a,b,h,m; cin>>a>>b>>h>>m;
  //double ra = h*30 + (m/60.)*30;
  double ra = h*30 + (m/2.);
  double rb = m*6;
  double rc = abs(ra-rb);
  double radc = M_PI * rc / 180.;
  double c = sqrt((a*a) + (b*b) - (2*a*b*cos(radc)));
  cout << fixed << setprecision(20);
  cout << c << endl;
}

Measured memory_bytes: 4160
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

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

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

    int n;
    cin >> n;
    vector<Ld> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    Ld avl = accumulate(all(a), (Ld)0) / n;
    Ld dif = 210;
    rep(i, n) {
        chmin(dif, abs(avl - a[i]));
    }

    rep(i, n) {
        if (dif == abs(avl - a[i])) {
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3820
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll N, M;
  cin >> N >> M;
  priority_queue<ll> que;
  ll a=0;
  ll sum=0;
  REP(i,N){
    IN(a);
    que.push(a);
    sum += a;
  }
  REP(i,M){
    a = que.top()/2;
    sum -= (que.top()-a);
    que.pop();
    que.push(a);
  }
  OUT(sum);
}

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

signed main() {
	vector<string> week = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	string s;
	cin >> s;
	cout << distance(find(week.begin(), week.end(), s), week.end());
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2000+10;
string s1,s2,s3;
int main(){
    cin>>s1>>s2>>s3;
    printf("%c%c%c",s1[0],s2[1],s3[2]);
    return 0;
}


Measured memory_bytes: 764
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

void reader(int &a) { scanf("%d", &a); }
void reader(double &a) { scanf("%lf", &a); }
void reader(char a[]) { scanf("%s", a); }
void reader(char &a) { scanf(" %c", &a); }
void reader(ll &a) { scanf("%lld", &a); }
void reader(ull &a) { scanf("%llu", &a); }
// void reader(string& a){cin >> a;};
template<class T, class U> void reader(T& t, U& u) { reader(t); reader(u); }
template<class T, class U, class V> void reader(T& t, U& u, V& v) { reader(t); reader(u); reader(v); }

void writer(const int a, char c) { printf("%d", a); putchar(c); }
void writer(const ll a, char c) { printf("%lld", a); putchar(c); }
void writer(const ull a, char c) { printf("%llu", a); putchar(c); }
void writer(const double a, char c) { printf("%.20lf", a); putchar(c); }
void writer(const char a[]) { printf("%s", a); };
void writer(const char a[], char c) { printf("%s", a); putchar(c); };
void writer(const char a, char c) { putchar(a); putchar(c); };
template<class T> void writerLn(T t) { writer(t, '\n'); }
template<class T, class U> void writerLn(T t, U u) { writer(t, ' '); writer(u, '\n'); }
template<class T, class U, class V> void writerLn(T t, U u, V v) { writer(t, ' '); writer(u, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerVec(vector<T> x) { int n = x.size(); int i; if (!n) { putchar('\n'); return; }rep(i, n - 1) writer(x[i], ' '); writer(x[n - 1], '\n'); }

vector<string> split(const string &str, char sep) { vector<string> v; stringstream ss(str); string buffer; while (getline(ss, buffer, sep)) { v.push_back(buffer); }return v; }
// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

signed main(void)
{
	int i, j, k, l;

	while (1) {
		int n, w;
		vector<int> v(100);
		vector<int> a(15);
		int max_v = 0;
		cin >> n >> w;
		if (n == 0) break;
		rep(i, n) {
			cin >> v[i];
			max_v = max(max_v, v[i]);
			a[v[i] / w]++;
		}
		double ans = 0;
		int c = max_v / w;
		int d = a[0];
		rep(i, c+1) {
			d = max(d, a[i]);
		}
		int start = 0;
		rep(i, c) {
			if (a[i]) {
				start = i;
				break;
			}
		}
		REP(i, start, c) {
			ans += (double)a[i] / d * (c - i) / c;
		}
		ans += 0.01;
		writerLn(ans);
	}

	return 0;
}

Measured memory_bytes: 3120
package main
import (
	"fmt"
)


func main(){
    // Your code here!
    var n, now, nxt int
    fmt.Scan(&n, &now)
    
    for i:=1;i<n;i++ {
        fmt.Scan(&nxt)
        if now <= (nxt-1) {
            nxt--
        }
        if now > nxt {
            fmt.Println("No")
            return
        }
        now = nxt
    }
    fmt.Println("Yes")
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<math.h>


int main() {



	int i, j, N, K, count;
	double kakuritu = 0.0;
	char S[4];

	scanf("%s", S);

	if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
		printf("Bad\n");
	}
	else {
		printf("Good\n");
	}
		

	return 0;

}

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

int main(){
  int  a, b;
  cin>>a>>b;

  double f1;
  f1=(double)a / b;
  
  cout<<a / b<<" "<<a % b<<" "<<fixed<<setprecision(5)<<f1<<endl;

  return 0;
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    //int sum = 0;
    //int sum2 = 0;
    rep(i, n) {
        cin >> x[i];
        //sum += x[i];
        //sum2 += x[i]*x[i];
    }
    int min = 100000000;
    int ans;
    rep(i, 100) {
        int sum = 0;
        rep(j, n) {
            sum += (i-x[j])*(i-x[j]);
        }
        if (sum<min) {
            min = sum;
            ans = i;
        }
    }
    
    
    
    
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def mat_mul_opt(_mat_info):
    rc_info = list(map(int, _mat_info[0]))
    rc_info.extend(list(map(lambda x: int(x[1]), _mat_info[1:])))

    for l in range(2, mat_num + 1):
        for i in range(1, mat_num - l + 2):
            j = i + l - 1
            ans[i][j] = 1e7
            for k in range(i, j):
                ans[i][j] = min(ans[i][j], ans[i][k] + ans[k + 1][j] +
                                rc_info[i - 1] * rc_info[k] * rc_info[j])

    return ans[1][mat_num]


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    mat_num = int(_input[0])
    mat_info = tuple(map(lambda x: x.split(), _input[1:]))
    # assert len(mat_info) == mat_num

    ans = [[0] * (mat_num + 1) for _ in range(mat_num + 1)]
    print(mat_mul_opt(mat_info))

Measured memory_bytes: 7832
# include <iostream>
# include <map>
using namespace std;
map <int,int> a;
int n,m;
void work (void)
{
	int i,j,f;
	f=1;
	for (i=1;i<=m;i++)
	{
		cin>>j;
		if (a[j]>0)
		a[j]--;
   else
        {
        	f=0;
        	break;
        }
	}
	if (f==1)
	cout<<"YES";
else cout<<"NO";
}
int main (void)
{
	int i,j;
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>j;
		if (a.find (j)==a.end ())
		a[j]=1;
   else a[j]++;
	}
	cin>>m;
	work ();
	return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;

int main(){
    string s; cin>>s;
    vector<int> a(s.length()+1,0);

    for(int i=0;i<s.length();i++){
        if(s[i]=='<'){
            a[i+1]=max(a[i+1],a[i]+1);
        }
    }

    for(int i=s.length()-1;i>=0;i--){
        if(s[i]=='>'){
            a[i]=max(a[i],a[i+1]+1);
        }
    }

    cout<<accumulate(a.begin(),a.end(),0LL)<<endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n, m; cin>>n>>m;
	vll table(n+2, 0);
	rep(i, m){
		ll l, r; cin>>l>>r;
		table[l]++;
		table[r+1]--;
	}

	rep(i, table.size()-1){
		table[i+1] += table[i];
	}

	ll ans=0;
	rep(i, table.size()){
		if (table[i] == m) ans++;
	}

	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ts to_string
#define ub upper_bound
#define lb lower_bound
const char nl = '\n';
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using str = string;
//The following debugging code was taken from Benjamin Qi's template :) 
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) { 
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) { 
    str res = "{"; for(int i = 0;i < (int)v.size(); i++) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; for(int i = 0; i < b.size(); i++) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { 
    bool fst = 1; str res = "{";
    for (const auto& x: v) {
        if (!fst) res += ", ";
        fst = 0; res += ts(x);
    }
    res += "}"; return res;
}
template<class A, class B> str ts(pair<A,B> p) {
    return "("+ts(p.f)+", "+ts(p.s)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#ifdef LOCAL 
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif
//CODE STARTS HERE-----------------------------------------------------------------------------------------// 
const int N = 350;
double dp[N][N][N];
int n;
double solve(int a, int b, int c){
    dbg(a, b, c);
    if(dp[a][b][c] != -1){
        return dp[a][b][c];
    }
    if(a==0&&b==0&&c==0){
        return 0;
    } 
    double ret = 0;
    if(a) ret+=solve(a-1, b, c)*a;
    if(b) ret+=solve(a+1, b-1, c)*b;
    if(c) ret+=solve(a, b+1, c-1)*c;
    ret+=n;
    ret*=(1.0/(a+b+c));
    dp[a][b][c] = ret;
    return ret;
}
signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    for(int i = 0; i < 350; i++){
        for(int j =0 ; j < 350; j++){
            for(int k = 0; k < 350; k++){
                dp[i][j][k] = -1;
            }
        }
    }
    cin >> n;
    int cnt[4] = {0,0,0,0};
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        cnt[x]++;
    }
    dbg(cnt[1], cnt[2], cnt[3]);
    cout << fixed << setprecision(12) << solve(cnt[1], cnt[2], cnt[3]) << endl;
}

Measured memory_bytes: 338868
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int K;
  cin>>K;
  int cnt=0;
  for(int i=1;i<K;i++){
    for(int j=i+1;j<=K;j++){
      if(i%2==0){
        if(j%2==1)cnt++;
      }else {
        if(j%2==0)cnt++;
      }
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;

template <class T>
ostream& operator <<(ostream& os, vector<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    V<ll> A_list;
    int num_negatives = 0;
    ll min_abs_item = (1 << 29);

    for (int i = 0; i < N; i++) {
        ll tmp;
        cin >> tmp;
        if (tmp < 0) num_negatives += 1;
        min_abs_item = min(min_abs_item, abs(tmp));
        A_list.emplace_back(tmp);
    }

    ll max_sum = 0;
    for (ll A : A_list) max_sum += abs(A);
    if (num_negatives % 2 == 1) {
        max_sum -= min_abs_item * 2;
    }
    cout << max_sum << "\n";
}


Measured memory_bytes: 1400