akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
int a, b, c, d, n, ans;
int ar[234567];
string s;
bool b1, b2;
signed main() {
	cin >> n >> a >> b;
	switch (n % 12)
	{
	case 0:cout << a << ' ' << b << endl; break;
	case 1:cout << a - b << ' ' << b << endl; break;
	case 2:cout << a - b << ' ' << a << endl; break;
	case 3:cout << -b << ' ' << a << endl; break;
	case 4:cout << -b << ' ' << a - b << endl; break;
	case 5:cout << -a << ' ' << a - b << endl; break;
	case 6:cout << -a << ' ' << -b << endl; break;
	case 7:cout << -a + b << ' ' << -b << endl; break;
	case 8:cout << -a + b << ' ' << -a << endl; break;
	case 9:cout << b << ' ' << -a << endl; break;
	case 10:cout << b << ' ' << -a + b << endl; break;
	case 11:cout << a << ' ' << -a + b << endl; break;
	default:
		break;
	}
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a,b;
    cin>>a>>b;
    int count=0;
    for(int i=0;i<a.size();i++){
    if(a.at(i)==b.at(i))count++;
    }

    cout << a.size()-count<< endl;
}
 

Measured memory_bytes: 3916
#include<bits/stdc++.h>
#define pii pair<int, int>
#define LL long long
#define mp make_pair
#define pb push_back
using namespace std;
const int lim = 1e6;
const int maxn = 1e6 + 10;
int n, a[maxn], num[maxn];
int cnt, pri[maxn], vis[maxn];

void pre(int mx) {
	for (int i = 2; i <= mx; ++i) {
		if (!vis[i]) pri[++cnt] = i;
		for (int j = 1; j <= cnt && i * pri[j] <= mx; ++j) {
			vis[i * pri[j]] = 1;
			if (i % pri[j] == 0) break;
		}
	}
}

int main() {
	#ifdef DEBUG
	freopen("text.in", "r", stdin);
	#endif
	pre(lim);
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		++num[a[i]];
	}
	int ans = 1;
	for (int i = 1, p, c; i <= cnt; ++i) {
		p = pri[i]; c = 0;
		for (int j = p; j <= lim; j += p)
			c += num[j];
		if (c == n) { ans = 0; break; }
		if (c > 1) { ans = 2; }
	}
	if (!ans) puts("not coprime");
	else if (ans == 1) puts("pairwise coprime");
	else puts("setwise coprime");
	return 0;
}

Measured memory_bytes: 15788
#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;

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

	int A,B,C;
	cin >> A >> B >> C;

	if (A==B && B==C && C==A) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

bool TEST=false;

void show(){
  if (TEST){cout << endl;}
}

void show(string x){
  if (TEST){cout << x;}
}

void show(string x,bool enter){
  if (TEST){
    if (enter) cout << "<#> " << x << endl;
    else cout << x;
  }
}

void show(ll x){
  if (TEST){cout << x;}
}

void show(ll x,bool enter){
  if (TEST){
    if (enter) cout << "<#> " << x << endl;
    else cout << x;
  }
}


void show(p_ll p){
  if (TEST){
    cout << "{ ";
    show(p.first);
    cout << " ";
    show(p.second);
    cout << " }";
  }
}

void show(v_ll v){
  if (TEST){
    cout << "<begin> ";
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << " ";
    }cout <<"<end>"<< endl;
  }
}

void show(vv_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
    }
  }
}

void show(vp_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
    }
  }
}

ll N;
int main(){
  cin >> N;
  cout << (N-2)*180 << endl;

}


Measured memory_bytes: 888
import math
from typing import List, Counter, Tuple
from collections import Counter
from itertools import permutations


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> int:
    N, M, R = read_ints()
    r = [a-1 for a in read_ints()]
    inf = 10**10
    D = [
        [inf for _ in range(N)] for _ in range(N)
    ]
    for i in range(N):
        D[i][i] = 0
    for _ in range(M):
        a, b, c = read_ints()
        D[a-1][b-1] = D[b-1][a-1] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                D[i][j] = min(D[i][j], D[i][k]+D[k][j])
    min_cost: int = inf
    for path in permutations(r):
        cost: int = 0
        for i in range(1, len(path)):
            cost += D[path[i-1]][path[i]]
        min_cost = min(min_cost, cost)
    return min_cost


if __name__ == '__main__':
    print(solve())


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

bool comp(tuple<string, int, int> &a, tuple<string, int, int> &b) {
  if (get<0>(a) == get<0>(b)) return get<1>(a) >= get<1>(b);
  else return get<0>(a) < get<0>(b);
}

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

  int n;
  cin >> n;
  vector<tuple<string, int, int>> res(n);
  for (int i = 0; i < n; i++) {
    string s;
    int p;
    cin >> s >> p;
    res[i] = make_tuple(s, p, i + 1);
  }
  sort(res.begin(), res.end(), comp);
  for (int i = 0; i < n; i++) {cout << get<2>(res[i]) << '\n';}
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int dx[3][8] = {{2,2,2,1,1,1,0,0},{1,1,1,-1,-1,-1,0,0},{-2,-2,-2,-1,-1,-1,0,0}};
int dy[3][8] = {{0,1,2,0,1,2,1,2},{1,0,-1,1,0,-1,1,-1},{-2,-1,0,-2,-1,0,-2,-1}};
main(){
    int h,w,n;
    scanf("%lld%lld%lld",&h,&w,&n);
    int ct[10]; memset(ct,0,sizeof(ct));
    ct[0] = (h-2)*(w-2);
    unordered_map<int,int> m;
    for (int i = 0; i < n; i++){
        int x,y;
        scanf("%lld%lld",&x,&y);
        x--; y--;
        for (int p = 0; p < 9; p++){
            int row = p/3;
            int column = p%3;
            int r = 0;
            bool valid = true;
            for (int k = 0; k < 8; k++){
                int nx = x + dx[row][k], ny = y+ dy[column][k];
                if (nx >= 0 && nx < h && ny >= 0 && ny < w){
                    r += m[nx*w+ny];
                }
                else{
                    valid = false;
                    break;
                }
            }
            if (valid){
                //printf("valid %lld\n",r);
                ct[r]--;
                ct[r+1]++;
            }
        }
        m[x*w+y] = 1;
    }
    for (int i = 0; i < 10; i++){
        printf("%lld\n",ct[i]);
    }
}


Measured memory_bytes: 118096
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;

int main() {
    int a, b, c, ans = 0, k;
    cin >> a >> b >> c >> k;
    while(b<=a) {
        b*=2; 
        ans++;
    }
    while(c<=b) {
        c*=2; 
        ans++;
    }
    if (ans > k) printf("No");
    else printf("Yes");
    return 0;
}


Measured memory_bytes: 3756
def solve
  n = gets.to_i
  arr = []
  cnt = 1
  (0..n - 1).each do |i|
    arr.push(gets.chomp)
  end

  sorted_arr = arr.sort!
  (1..n - 1).each do |j|
    if sorted_arr[j - 1] != sorted_arr[j]
      cnt += 1
    end
  end

  p cnt
end
solve

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

int main() {
    char x, y; cin >> x >> y;
    if (x < y)
        puts("<");
    else if (x > y)
        puts(">");
    else
        puts("=");
}

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

int main () {
  int D, G;
  cin >> D >> G;
  G /= 100;
  vector<int> p(D), c(D);
  rep(i,D) {
    cin >> p[i] >> c[i];
    c[i] /= 100;
  }

  int ans = 1000;

  for(int i = 0; i < (1<<D); i++) {
    int s = 0;
    int cnt = 0;
    for(int j = 0; j < D; j++) {
      if((i >> j) & 1) {
        s += (j+1)*p[j] + c[j];
        cnt += p[j];
      }
    }
    for(int j = D - 1; s < G && j >= 0; j--){
      if((i >> j) & 1) continue;
      int k = (G - s + (j+1) - 1) / (j+1);
      k = min(k, p[j]);
      s += k * (j+1);
      cnt += k;
    }

    if(s >= G) ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2);
  return x*POW(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,a,b;
  cin >> n >> a >> b;
  if(abs(a-b)%2==0)printf("Alice");
  else printf("Borys");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> l(n + 1);
  vector<int> r(n);
  l[0] = 0;
  repz(i, 1, n + 1) l[i] = max(l[i - 1], a[i - 1]);
  r[n] = 0;
  for (int i = n - 2; i >= 0; i--) r[i] = max(a[i + 1], r[i + 1]);
  repz(i, 0, n) cout << max(l[i], r[i]) << endl;
  return 0;
}


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

long long dp[100000][3];

long long max3(long long a, long long b, long long c) {
	if (a > b) {
		if (c > a) {
			return c;
		}
		return a;
	}

	if (c > b) {
		return c;
	}
	return b;
}

long long max2(long long a, long long b) {
	return a > b ? a : b;
}

long long ans(int prev, int index, int a[], int b[], int c[], int n) {
	if (index >= n) {
		return 0;
	}

	if (prev == -1) {
		dp[index][0] = a[index] + ans(0, index + 1, a, b, c, n);
		dp[index][1] = b[index] + ans(1, index + 1, a, b, c, n);
		dp[index][2] = c[index] + ans(2, index + 1, a, b, c, n);

		return max3(dp[index][0], dp[index][1], dp[index][2]);
	}

	if (prev == 0) {
		if (dp[index][1] == -1) {
			dp[index][1] = b[index] + ans(1, index + 1, a, b, c, n);
		}

		if (dp[index][2] == -1) {
			dp[index][2] = c[index] + ans(2, index + 1, a, b, c, n);
		}

		return max2(dp[index][1], dp[index][2]);
	}

	if (prev == 1) {
		if (dp[index][0] == -1) {
			dp[index][0] = a[index] + ans(0, index + 1, a, b, c, n);
		}

		if (dp[index][2] == -1) {
			dp[index][2] = c[index] + ans(2, index + 1, a, b, c, n);
		}

		return max2(dp[index][0], dp[index][2]);
	} else {
		if (dp[index][0] == -1) {
			dp[index][0] = a[index] + ans(0, index + 1, a, b, c, n);
		}

		if (dp[index][1] == -1) {
			dp[index][1] = b[index] + ans(1, index + 1, a, b, c, n);
		}

		return max2(dp[index][0], dp[index][1]);
	}

}

int main()
{
	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int a[n];
	int b[n];
	int c[n];

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

	memset(dp, -1, sizeof(dp));

	long long out = ans(-1, 0, a, b, c, n);

	cout << out << endl;

	return 0;
}










Measured memory_bytes: 13184
n, k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
        continue
    cnt = 0
    now = i
    while now < k:
        cnt += 1
        now *= 2
    ans += (1/n)*(1/2)**cnt
print(ans)
    

Measured memory_bytes: 65160
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
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(a > b){a = b; return 1;}return 0;}
typedef long long ll;

ll INF = 1e16;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll A, B, Q; cin >> A >> B >> Q;
  vector<ll> a(A), b(B), q(Q);
  REPLL(i, A) cin >> a[i];
  REPLL(i, B) cin >> b[i];
  REPLL(i, Q) cin >> q[i];
  REPLL(i, Q){
    ll ans = INF;
    ll x = q[i];
    ll AF, AB, BF, BB;
    auto itrA = lower_bound(a.begin(), a.end(), x);
    if(itrA == a.end()){
      AF = INF;
    }else{
      AF = *itrA - x;
    }
    if(itrA-a.begin() == 0){
      AB = INF;
    }else{
      itrA--;
      AB = x - *itrA;
    }
    
    auto itrB = lower_bound(b.begin(), b.end(), x);
    if(itrB == b.end()){
      BF = INF;
    }else{
      BF = *itrB - x;
    }
    if(itrB-b.begin() == 0){
      BB = INF;
    }else{
      itrB--;
      BB = x - *itrB;
    }
    
    ans = min(ans, max(AF, BF));
    ans = min(ans, max(AB, BB));
    ans = min(ans, 2*AF+BB);
    ans = min(ans, 2*BB+AF);
    ans = min(ans, 2*AB+BF);
    ans = min(ans, 2*BF+AB);
    
    cout << ans <<endl;
  }
}


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

using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/

#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second

#define what_is(x)     cerr << #x << " is " << x << endl;

///*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout << endl ;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
int ini()
{
    int x;
    scanf("%d",&x);
    return x;
}
long long inl()
{
    long long x;
    scanf("%lld",&x);
    return x;
}

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
int a[109];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n=ini();
    int g=0;
    ll r=1ll;
    ll lcm;
    for(int i=1;i<=n;i++){
        a[i]=ini();

        if(i>1){
            lcm=(lcm*(ll)a[i])/(__gcd(lcm,(ll)a[i]));
        }
        else{
            lcm=(ll)a[i];
        }
    }
   
    ll sum=0;
    for(int i=1;i<=n;i++){
        sum+= lcm/(ll)a[i];
    }

    double res=(double)lcm/(double)sum;

    printf("%.10f\n", res);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int sum = 0;
        int[] a = new int[n+2];
        int[] b = new int[n+1];
        
        for(int i = 1; i <= n; i++){
            a[i] = Integer.parseInt(sc.next());
            sum += Math.abs(a[i-1] - a[i]);
        }
        sum += Math.abs(a[n]);
        
        for(int i = 1; i <= n; i++){
            if(a[i-1] < a[i]){
                if(a[i+1] < a[i]){
                    if(a[i-1] < a[i+1]){
                        b[i] = Math.abs(a[i] - a[i+1]) *2;
                    }else{
                        b[i] = Math.abs(a[i-1] - a[i]) *2;
                    }
                }
            }else if(a[i] < a[i-1]){
                if(a[i] < a[i+1]){
                    if(a[i+1] < a[i-1]){
                        b[i] = Math.abs(a[i] - a[i+1]) *2;
                    }else{
                        b[i] = Math.abs(a[i-1] - a[i]) *2;
                    }
                }
            }
        }
        
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i <= n; i++){
            sb.append(sum - b[i]).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 49460
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <random>
#include <queue>
#include <deque>
#include <iterator>
#include <map>
#include <functional>
#include <numeric>
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++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define pb(a) push_back(a)
#define llong long long
#define INF 1145141919
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }


int main() {
	int a[2];
	cin >> a[0] >> a[1];
	// 0はa[0] 1はa[1]
	int A = a[0];
	int B = a[1];

	int ret = -1;
	int cnt = 0;
	// 0 0
	// 0 1
	// 1 0
	// 1 1
	for (int i = 0; i < 2; i++) {
		cnt += a[i];
		a[i]--;
		for (int j = 0; j < 2; j++) {
			cnt += a[j];
			ret = max(ret, cnt);
			cnt -= a[j];
		}
		a[0] = A;
		a[1] = B;
		cnt = 0;
	}
	cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
  int n,m,sum=0,count=0;
  cin >> n >> m;
  vector<int> v;
  for(int i=0; i<n; i++){
    int k;
    cin >> k;
    v.push_back(k);
    sum += k;
  }
  for(int i=0; i<n; i++){
    float test = (float)v.at(i);
    float border = (float)sum/((float)m*4.0);
    if(test >= border){
      count++;
    }
  }
  if(count >= m){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    ll n;
    cin >> n;

    ll i = 1;
    ll ans;
    while(i*i <= n){
        ans = i*i;
        i++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;


#define INF (1ll<<60)

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

vector<vector<int>> G;

vector<int> match;
vector<bool> seen0;

bool dfs(int u){
  // cout<<Gl.size()<<endl;
  for(int v:G[u]){
    // cout<<"!"<<endl;
    if(!seen0[v]){
      seen0[v]=true;
      if(match[v]==-1||dfs(match[v])){
        match[v]=u;
        return true;
      }
    }
  }
  return false;
}

int main(int argc, char const *argv[]) {
  int n;cin>>n;
  G=vector<vector<int>>(n);
  for(int i=0;i<n-1;++i){
    int u,v;cin>>u>>v;
    u--;v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  queue<int> que;
  vector<int> seen(n);
  que.push(0);
  int res=0;
  seen[0]=1;
  res+=seen[0];
  while(!que.empty()){
    int u=que.front();
    que.pop();
    for(int v:G[u]){
      if(seen[v]==0){
        seen[v]=-seen[u];
        res+=seen[v];
        que.push(v);
      }
    }
  }
  if(res!=0){
    cout<<"First"<<endl;
    return 0;
  }
  match=vector<int>(n,-1);
  int numm=0;
  for(int i=0;i<n;++i){
    seen0=vector<bool>(n,false);
    if(seen[i]==1)numm+=dfs(i);
  }
  if(numm*2==n)cout<<"Second"<<endl;
  else cout<<"First"<<endl;
  return 0;
}


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


int main(){
  int n ;
  cin >>n;
  vector<int> a(n);
  rep(i,n)cin>>a.at(i);

  rep(i,n){
    if(a.at(i)%2==0){
      if(a.at(i)%3==0)continue;
      if(a.at(i)%5==0)continue;
      cout<<"DENIED"<<endl;
      return 0;
    }
  }
  cout <<"APPROVED"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	vector<int> in(2 * n + 1);
	for (int i = 0, a, b; i < q; ++i) {
		scanf("%d%d", &a, &b);
		--a; --b;
		if (a > b)
			swap(a, b);
		a *= 2;
		b *= 2;
		++in[a];
		--in[b + 1];
	}
	int cnt = 0;
	for (int i = 0; i < 2 * n; ++i) {
		cnt += in[i];
		if ((i&1) && (cnt & 1)) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e6+5;
int n,m,k,top,cnt,foo[N],bar[N];pair<int,int>stk[N],tmp[N];
char s[N],t[N];
void output(int *arr){
	int p=max(n,m)+k;
	while(!arr[p])--p;
	while(p)putchar(arr[p--]+'0');
	puts("");
}
int main(){
	scanf("%d%d%d%s%s",&n,&m,&k,s+1,t+1);
	reverse(s+1,s+n+1);reverse(t+1,t+m+1);
	for(int i=max(n,m);i;--i)
		if(s[i]=='1'&&t[i]=='1'){
			int now=3,tim=k,pos=i;
			while(top&&now)
				if(now==3)
					if(tim>=stk[top].first-pos){
						tim-=stk[top].first-pos;pos=stk[top].first;
						if(now^stk[top].second)tmp[++cnt]={pos,now^stk[top].second};
						now=stk[top--].second;
					}
					else break;
				else
					if(stk[top].first==pos+1){
						++pos;
						if(now^stk[top].second)now=3;
						--top;
					}
					else break;
			if(now==3)pos+=tim,foo[pos]=bar[pos]=1;
			else if(now)tmp[++cnt]={pos+1,now};
			while(cnt)stk[++top]=tmp[cnt--];
		}
		else if(s[i]=='1'||t[i]=='1')
			stk[++top]={i,(s[i]=='1')<<1|(t[i]=='1')};
	for(int i=1;i<=top;++i){
		foo[stk[i].first]=stk[i].second>>1;
		bar[stk[i].first]=stk[i].second&1;
	}
	output(foo);output(bar);return 0;
}


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

int main(){
	int i, a, n, maks=0, maks2=0, catat;
	bool sama=false;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a;
//		if(a==maks){
//			sama=true;
//		}
		if(a>=maks){
			maks2=maks;
			maks=a;
			catat=i;
			sama=false;
		}
		else if((a>maks2)&&(a<maks)){
			maks2=a;
		}
//		if(sama){
//			maks2=a;
//		}
	}
	for(i=0;i<n;i++){
		if(i==catat){
			cout<<maks2<<endl;
			continue;
		}
		cout<<maks<<endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';
const int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };

int H, W, dist[20][20], res;
string S[20];

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '.') {
				queue<pair<int, int>>que;
				int d = 0;
				for (int k = 0; k < H; k++) {
					for (int l = 0; l < W; l++) {
						dist[k][l] = -1;
					}
				}
				que.push({ i,j });
				que.push({ -869120,-869120 });
				while (true) {
					auto p = que.front();
					que.pop();
					if (p.first == -869120) {
						d++;
						if (que.empty())break;
						que.push({ -869120,-869120 });
						continue;
					}
					if (p.first == -1 || p.first == H || p.second == -1 || p.second == W || S[p.first][p.second] == '#' || dist[p.first][p.second] != -1)continue;
					dist[p.first][p.second] = d;
					res = max(res, d);
					for (int i = 0; i < 4; i++) {
						que.push({ p.first + dx[i],p.second + dy[i] });
					}
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second 
//#define int   long long
#define ll   long long
#define pii pair<int, int>
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main(){
    FAST
    int x;
    cin>>x;
    cout<<(x/500)*1000 +((x%500)/5)*5<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a[n];
	for (int i = 0 ; i < n ; i++) cin >> a[i];
	int x = 1, y = 0;
	for (int i = 0 ; i < n ; i++) {
		y++;
		if (a[x - 1] == 2) {
			cout << y;
			return 0;
		}
		else x = a[x - 1];
	} 
	cout << -1;
}

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

int main() {
  int N;
  cin >> N;
  
  int existY = 0;
  
  for(int i = 0; i < N; i++) {
    string c;
    cin >> c;
    if (c == "Y") {
      existY = 1;
      break;
    }
  }
  
  if (existY == 1)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
  typedef long long int ll;
  #define mod 1000000007
  #define all(v)  v.begin(),v.end()
  #define pb push_back
  #define size(v)  (int) v.size()
  #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
  ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
  ll inv(ll a){return power_mod(a,mod-2);}
  ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}

  int main()
  {
     
          
        string s;
        cin>>s;

        for(int i=0;i<3;i++)
        {
            if(s[i]==s[i+1])
            {
               cout<<"Bad"<<endl;
               return 0;
            }
        }

        cout<<"Good"<<endl;
  }



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int max=0;
	for(int i=0;i<a;i++) {
		int b=scan.nextInt();
		ans+=b;
		if(max<b) {
			max=b;
		}
	}
	System.out.println(ans-max/2);
	scan.close();
	}
}


Measured memory_bytes: 22740
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

ll a[100000];

int cnt[100001];

int main()
{
	int n;
	int ans=0;
	
	cin>>n;
	for(int i=0;i<100001;i++)
	{
		cnt[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]>n)
		{
			ans++;
			i--;
			n--;
		}else{
			cnt[a[i]]++;
		}
	}

	for(int i=1;i<100001;i++)
	{
		if(cnt[i]==0)
		{
			continue;
		}
		if(cnt[i]>i)
		{
			ans += cnt[i]-i;
		}else if(cnt[i]!=i){
			ans += cnt[i];
		}
	}

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

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  string S; cin >> S;
  string Rev_S = S;
  reverse( Rev_S.begin(), Rev_S.end() );

  int S_len = S.size();
  int Ans = 0;
  rep( i, 0, S_len/2 ) {
    if ( S.at(i)!=Rev_S.at(i) ) Ans++;
  }
  cout << Ans << endl;
}


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

using namespace std;
int main(int argv,char** argc)
{
	long long a, b,tmp;
	cin >> a >> b;

	if (a % b == 0)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << a << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    string s;
    cin >> s;

    int ans = 0;
    int cnt = 0;
    rep(i, s.size()){
        if(s[i] != 'A' && s[i] != 'C' && s[i] != 'G' && s[i] != 'T')cnt = 0;
        else cnt++;

        ans = max(ans, cnt);
    }

    cout << ans << endl;
}

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

using namespace std;



int main() {
	
	long long X;
	cin >> X;

	long long cur = 100, steps = 0;

	while(cur < X) {
		cur += cur / 100;
		++steps;
	}

	cout << steps << '\n';

	return 0;	
}

Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    struct Shop{
        public double price;
        public double num;
        public Shop(double price,double num)
        {
            this.price = price;
            this.num = num;
        }
    }
    static void Main(string[] args)
    {
        string[] temp = Console.ReadLine().Split(' ');
        double N = double.Parse(temp[0]);
        double M = double.Parse(temp[1]);

        var list = new List<Shop>();
        for (int i = 0; i < N; i++)
        {
            temp = Console.ReadLine().Split(' ');
            double price = double.Parse(temp[0]);
            double num = double.Parse(temp[1]);
            list.Add(new Shop(price, num));
        }
        list.Sort((a, b) => a.price.CompareTo(b.price));
        double ans = 0;
        for(int i = 0; i < N; i++)
        {
            if (M >= list[i].num)
            {
                ans += list[i].price * list[i].num;
                M -= list[i].num;
            }
            else
            {
                ans += M * list[i].price;
                break;
            }
        }
        Console.WriteLine(ans);
    }

}


Measured memory_bytes: 19136
A = gets.chomp
N = A.size

counter = Hash.new(0)

A.each_char do |a|
  counter[a] += 1
end

sub = 0

counter.each do |k, v|
  sub += (v * (v - 1)) / 2
end

puts (N * (N - 1)) / 2 - sub + 1


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=5005,INF=1<<30;

int to[MAX];

struct UF{
    int n;
    vector<int> par,size;
    vector<int> flag;
    
    void init(int n_){
        n=n_;
        par.assign(n,-1);
        size.assign(n,1);
        flag.assign(n,0);
        
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int root(int a){
        if(par[a]==a) return a;
        else return par[a]=root(par[a]);
    }
    
    void unite(int a,int b){
        if(root(a)!=root(b)){
            size[root(a)]+=size[root(b)];
            flag[root(a)]|=flag[root(b)];
            par[root(b)]=root(a);
        }
    }
    
    bool check(int a,int b){
        return root(a)==root(b);
    }
};

ll rui(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans;
}

ll dp[MAX][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    UF uf;
    uf.init(N);
    
    int k=0;
    
    for(int i=0;i<N;i++){
        int a;cin>>a;
        if(a==-1){
            uf.flag[i]=1;
            k++;
        }else{
            a--;
        }
        to[i]=a;
    }
    
    for(int i=0;i<N;i++){
        if(to[i]!=-1) uf.unite(i,to[i]);
    }
    
    ll ans=0;
    
    for(int i=0;i<N;i++){
        if(!uf.flag[i]&&i==uf.root(i)){
            ans+=rui(N-1,k);
            ans%=mod;
        }
    }
    
    vector<int> S;
    
    for(int i=0;i<N;i++){
        if(uf.flag[i]&&i==uf.root(i)){
            S.push_back(uf.size[i]);
        }
    }
    
    dp[0][0]=1;
    
    for(int i=0;i<si(S);i++){
        for(int j=0;j<=si(S);j++){
            dp[i+1][j+1]+=dp[i][j]*S[i]%mod;
            dp[i+1][j]+=dp[i][j];
            
            dp[i+1][j+1]%=mod;
            dp[i+1][j]%=mod;
        }
    }
    
    ll no=1;
    
    for(int a:S){
        ans+=rui(N-1,k-1)*(a-1)%mod;
        ans%=mod;
    }
    
    for(int j=2;j<=si(S);j++){
        ans+=dp[si(S)][j]*no%mod*rui(N-1,k-j)%mod;
        ans%=mod;
        
        no*=(j);
        no%=mod;
    }
    
    cout<<(mod+rui(N-1,k)*N%mod-ans)%mod<<endl;
}



Measured memory_bytes: 199280
s = int(input())
a = []
a.append(s)
if(a[0]%2 == 0):
    a.append(int(a[0]/2))
else:
    a.append(3*a[0]+1)
#print(a)
i = 1
while True:
    if(a[i]%2 == 0):
        a.append(int(a[i]/2))
    else:
        a.append(3*a[i]+1)
    #print(a)
    if(a[i] in a[0:i-1]):
      print(i+1)
      exit()
    i = i + 1


Measured memory_bytes: 38256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int N, C;
vvi D;
vvi c;

vvi memo;

int main()
{
    cin >> N >> C;
    rep(i, C){
        vi in; in.resize(C);
        rep(j, C) cin >> in[j];
        D.pb(in);
    }
    rep(i, N){
        vi in; in.resize(N);
        rep(j, N) cin >> in[j];
        rep(j, N) in[j]--;
        c.pb(in);
    }

    vi zero, one, two;
    rep(i, N) rep(j, N){
        if((i + j) % 3 == 0) zero.pb(c[i][j]);
        else if((i + j) % 3 == 1) one.pb(c[i][j]);
        else two.pb(c[i][j]);
    }

    // initialize
    rep(color, C){
        int val0 = 0;
        rep(i, zero.size()) val0 += D[zero[i]][color];

        int val1 = 0;
        rep(i, one.size()) val1 += D[one[i]][color];

        int val2 = 0;
        rep(i, two.size()) val2 += D[two[i]][color];

        vi in{val0, val1, val2};
        memo.pb(in);
    }

    int ans = INF;
    rep(c1, C) rep(c2, C) rep(c3, C){
        if(c1 == c2 || c2 == c3 || c3 == c1) continue;
        int cnt = 0;
        cnt += memo[c1][0];
        cnt += memo[c2][1];
        cnt += memo[c3][2];
        ans = min(ans, cnt);
    }
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 2552
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,n,d;
cin>>n>>d;
a=(2*d)+1;
if(a>=n)
cout<<1<<endl;
else
{
if(n%a==0)
cout<<n/a<<endl;
else
cout<<(n/a)+1<<endl;
}

return 0;
}

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

int main()
{
 int n;
 int m=1000005;
 cin>>n;
vector<int> hash(m,0);
 
 vector<int> arr(n);
 for(int i=0;i<n;i++)
 {
     cin>>arr[i];
     if(hash[arr[i]]>1)
     continue;
     else
     {
         for(int j=arr[i];j<=m;j+=arr[i])
         {
             hash[j]++;
         }
     }
}
 int count=0;
 for(int i =0;i<n;i++)
 {
     if(hash[arr[i]]==1)
     count++;
 }
 
 
 cout<<count<<endl;
 
 
}


Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

int main() {
  int k, x;
  cin >> k >> x;
  for (int y = x - k + 1; y <= x + k - 1; y++) printf("%d%c", y, " \n"[y == x + k - 1]);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0xff,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int m;
int d1[100010];
int d2[100010];
vector<int> v[100010];
void dfs1(int n,int p){
	if(p==-1){
		d1[n]=0;
	}
	else{
		d1[n]=d1[p]+1;
	}
	rep(i,v[n].size()){
		if(v[n][i]!=p){
			dfs1(v[n][i],n);
		}
	}
}
void dfs2(int n,int p){
	if(p==-1){
		d2[n]=0;
	}
	else{
		d2[n]=d2[p]+1;
	}
	rep(i,v[n].size()){
		if(v[n][i]!=p){
			dfs2(v[n][i],n);
		}
	}
}
int main(){
	cin>>m;
	rep(i,m-1){
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	dfs1(1,-1);dfs2(m,-1);
	int f=0,s=0;
	forn(i,m){
		if(d1[i]<=d2[i]){
			f++;
		}
		else{
			s++;
		}
	}
	if(f>s){
		puts("Fennec");
	}
	else{
		puts("Snuke");
	}
    return 0;
}

Measured memory_bytes: 11136
from collections import Counter

N = int(input())
S = input()
count = Counter(S)

# print(count)
ans = 0
R = count["R"]
G = count["G"]
B = count["B"]
ans = R * G * B

# for i in range(N - 2):
#     if S[i] == "R":
#         for j in range(i + 1, N - 1):
#             if S[j] == "G":
#                 b_count = Counter(S[j:])["B"]
#                 ans += b_count

# print(R, G, B, ans)

for i in range(N):
    for j in range(N):
        if i + j * 2 < N and S[i] == "R" and S[i + j] == "G" and S[i + j * 2] == "B":
            ans -= 1
        if i + j * 2 < N and S[i] == "R" and S[i + j] == "B" and S[i + j * 2] == "G":
            ans -= 1
        if i + j * 2 < N and S[i] == "G" and S[i + j] == "R" and S[i + j * 2] == "B":
            ans -= 1
        if i + j * 2 < N and S[i] == "G" and S[i + j] == "B" and S[i + j * 2] == "R":
            ans -= 1
        if i + j * 2 < N and S[i] == "B" and S[i + j] == "G" and S[i + j * 2] == "R":
            ans -= 1
        if i + j * 2 < N and S[i] == "B" and S[i + j] == "R" and S[i + j * 2] == "G":
            ans -= 1
print(ans)


Measured memory_bytes: 82000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 P = pair<int, int>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;


int main(){
    int d, n;
    cin >> d >> n;
    int ans = 1;
    rep(i, d) ans *= 100;
    if (n==100) ans *= 101;
    else ans *= n;
    
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100005;
int N,M,Tim;
long long Ans;
struct node{
	int A,B;
	bool operator <(const node &a)const{
		return B>a.B;
	}
}s[MAXN];
priority_queue<node>Q;
bool cmp(node x,node y){
	return x.A>y.A||(x.A==y.A&&x.B>y.B);
}
int main(){
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N;i++)
		scanf("%d%d",&s[i].A,&s[i].B);
	sort(s+1,s+N+1,cmp);
	for(int i=1;i<=N;i++){
		if(s[i].A>M)continue;
		if(s[i].A+Tim<=M){
			Tim++;
			Ans+=s[i].B;
			Q.push(s[i]);
		}
		else{
			node u=Q.top();
			if(s[i].B>u.B){
				Ans-=u.B;
				Ans+=s[i].B;
				Q.pop();
				Q.push(s[i]);
			}
		}
	}
	printf("%lld\n",Ans);
}

Measured memory_bytes: 2168
#include <stdio.h>

int main(void){
  int W, H, x, y, r;

  scanf("%d %d %d %d %d\n", &W, &H, &x, &y, &r);

  if(x >= r && x <= (W - r))
    if(y >= r && y <= (H - r))
      printf("Yes\n");
    else
      printf("No\n");
  else
    printf("No\n");

  return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h>
#define input_vector(v,n) for(long long i=0;i<n;i++){cin>>v[i];}
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
 ll n;
 cin>>n;
 vector<ll> v(n);
 input_vector(v,n);
 vector<ll> dp(n);
 dp[0]=0;
 for(ll i=1;i<n;i++){
 	dp[i]=dp[i-1]+abs(v[i-1]-v[i]);
 	if(i>=2){
 		dp[i]=min(dp[i-2]+abs(v[i-2]-v[i]),dp[i]);	
	}
 }
 cout<<dp[n-1]<<endl;
 return 0;
}



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

typedef long long ll;

int main(void){
    ll n;
    cin >> n;
    vector<ll> v1(n);
    for(ll i=0; i<n; i++){
        cin >> v1.at(i);
    }
    sort(v1.begin(), v1.end());
    vector<ll> v2;
    ll i = 0;
    for(ll i=0; i<n; i++){
        if(v1.size() > 1){
            switch(i%4){
                case 0:
                    v2.insert(v2.begin(), v1.front());
                    v1.erase(v1.begin());
                    break;
                case 1:
                    v2.push_back(v1.back());
                    v1.pop_back();
                    break;
                case 2:
                    v2.push_back(v1.front());
                    v1.erase(v1.begin());
                    break;
                case 3:
                    v2.insert(v2.begin(), v1.back());
                    v1.pop_back();
                    break;
            }
        }else{
            if(abs(v1.at(0) - v2.front()) > abs(v1.at(0) - v2.back())){
                v2.insert(v2.begin(), v1.at(0));
            }else{
                v2.push_back(v1.at(0));
            }
        }
    }

    ll ans = 0;
    for(ll i=1; i<n; i++){
        ans += abs(v2.at(i) - v2.at(i-1));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2168
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
}


Measured memory_bytes: 35976
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;

int32_t main(){
	ios::sync_with_stdio(0);	
	map<string, int> mp;
	string a, b;
	int ai, bi;
	cin >> a >> b >> ai >> bi;
	mp[a] = ai;
	mp[b] = bi;
	string st;
	cin >> st;
	--mp[st];
	cout << mp[a] << " " << mp[b] << endl;
}


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

int main() {
  int n;
  //string op,ans;
  cin >> n;
  
  int num[200];
  for(int i=0;i<n;i++)
    cin >> num[i];
  
  int ct = 0;
  
  int d=2;
  while (true){
    bool comp = true;
    for(int i=0;i<n;i++)
      if (num[i] % d != 0){
        comp = false;
        break;
      }
    if (!comp) break;
    ct++;
    d *= 2;
  }
  cout << ct << endl;

}

Measured memory_bytes: 256