akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout << d << endl;
#define coutd(d) cout << std::setprecision(10) << d << endl;
#define cinline(n) getline(cin, n);
#define replace_all(s, b, a) replace(s.begin(), s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }

const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(int y, int x, int H, int W)
{
  return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll n,k;
vector<ll> a;

bool isOK(ll x){
  ll cnt=0;
  rep(i,n-1){
    if(a[i]<0){
      if(a[i]*a[n-1]>x) continue;
      ll ok=n-1, ng=i;
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(a[i]*a[mid]<=x) ok=mid;
        else ng=mid;
      }
      cnt+=n-ok;
    }else if(a[i]>0){
      if(a[i]*a[i+1]>x) continue;
      ll ok=i+1, ng=n;
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(a[i]*a[mid]<=x) ok=mid;
        else ng=mid;
      }
      cnt+=ok-i;
    }else{
      if(x>=0) cnt+=n-i-1;
    }
  }
  return cnt>=k;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>k;
  a.resize(n);
  rep(i,n) cin>>a[i];
  vsort(a);
  
  ll ok=1e18, ng=-1e18;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    if(isOK(mid)) ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;
ll h, w, k;
vector<string> c;
vector<string> t;

ll solve(int a, int b, int na, int nb){
  if (na == h && nb == w){
    for (int i = 0; i < h; i++){
      if ((a >> i) & 1){
        for (int j = 0; j < w; j++){
          t[i][j] = '.';
        }
      }
    }
    for (int j = 0; j < w; j++){
      if ((b >> j) & 1){
        for (int i = 0; i < h; i++){
          t[i][j] = '.';
        }
      }
    }
    ll num = 0;
    for (int i = 0; i < h; i++){
      for (int j = 0; j < w; j++){
        if (t[i][j] == '#')
          num++;
      }
    }
    for (int i = 0; i < h; i++){
      t[i] = c[i];
    }
    if (num == k)
      return 1;
    else
      return 0;
  }
  else if (na == h){
    return solve(a, b | (1 << nb), na, nb+1)
        + solve(a, b, na, nb+1);
  }
  else {
    return solve(a | (1 << na), b, na+1, nb)
        + solve(a, b, na+1, nb);
  }
}

int main(void){
  cin >> h >> w >> k;
  c = vector<string>(h);
  t = vector<string>(h);
  for (int i = 0; i < h; i++){
    cin >> c[i];
    t[i] = c[i];
  }

  cout << solve(0, 0, 0, 0) << endl;;

  return 0;
}


Measured memory_bytes: 3640
a, b, k = map(int, input().split())
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        b += a// 2
        a //= 2
    else:
        if b % 2 == 1:
            b -= 1
        a += b// 2
        b //= 2
print(a,b)

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

using namespace std;

#define LL long long
#define N 200005

int n, i, a[N], j;
LL ans;
map<int,int> S;

int main (void)
{
	scanf("%d",&n);
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	ans=0;
	for (i=1; i<=n; i++) S[i-a[i]]++;
	for (i=1; i<=n; i++) {
	    S[i-a[i]]--;
		ans+=S[a[i]+i];
	} 
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 21564
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

//#include<bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 3e5 + 123;                                          
const int PRI = 555557;
const int pri = 997;
const int Magic = 2101;

//const int dx[] = {2, 2, 1, 1, -1, -1, -2, -2};
//const int dy[] = {1, -1, 2, -2, 2, -2, 1, -1};

int n, m, k;
int a[N];

string s;
int cnt[31];
int cur, res;
int ans;

int sums (int x) {
	int res = 0;
	while (x) {
		res += x % 10;
		x /= 10;
	}
	return res;
}

inline void Solve () {
	cin >> n;

	ans = inf;
	for (int a = 1, b; a < n; a ++) {
		b = n - a;
		ans = min(ans, (sums(a) + sums(b)));
	}

	cout << ans;
}

int main () {
	int tests = 1;
	SpeedForce;
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);	
	//cin >> tests;
	while(tests --) {
		Solve ();
		// TooSimple ? True : False
	}
	// Accepted ? True : True
	return Accepted; 
}


// Coded by Al... Bat...

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		// 文字列の入力
		int diff = b-a;
		int sum = 0;
		for(int i=1;i<=diff;i++){
			sum = sum + i;
		}
      System.out.println(sum - b);
	}
}

Measured memory_bytes: 21844
n=int(input())
mark=dict()
for i in range(n):
    A=int(input())
    temp_list=[tuple(map(int,input().split())) for i in range(A)]
    mark[i+1]=temp_list
#正直者を仮定する
#正直者の証言を集める（L）
#Lに矛盾がないか調べる
#print(mark)
ans=0
for i in range(2**n):
    honest_remark=[]
    mujun=[]
    cnt=0
    for j in range(n):
        #j桁目が1の時
        if (i>>j)&1:
            cnt+=1
            for k in mark[j+1]:
                honest_remark.append(k)
            mujun.append((j+1,0))
        else:
            mujun.append((j+1,1))

    #if not honest_remark:continue
    #print(honest_remark,mujun)
    honest_remark=set(honest_remark)
    mujun=set(mujun)
    temp=honest_remark&mujun
    if len(temp)==0:
        ans=max(ans,cnt)

print(ans)

Measured memory_bytes: 3064
x=int(input())
list=list(map(int,input().split()))

if x==1:
    print(0)
else:
    a=sorted(list)
    b=a[0]
    c=a[-1]
    if c-b==1:
        print(1)
    elif b==0:
        if c%2!=0:
            print(c//2+1)
        else:
            print(c//2)
    elif (c-b)%2!=0:
        print((c-b)//2+1)
    else:
        print((c-b)//2)
                


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


using namespace std;
//dp[i] first player winns if its true stones left

int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	vector<bool> dp(k+1);
	for(int stones=0;stones<=k;stones++){
		for(int i:a){
			if(stones>=i && !dp[stones-i]){
				dp[stones]=true;
			}
		}
	}
	dp[k]?cout<<"First":cout<<"Second";
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> p;
    for (int i = 0; i < n; i++) {
        int pi;
        cin >> pi;
        p.push_back(pi);
    }

    long long ans = 0;
    int mn = INT_MAX;
    for (int i = 0; i < n; i++) {
        int pi = p.at(i);
        mn = min(pi, mn);
        if (pi == mn) {
            ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

const vector<int> dx = {1, 0}, dy = {0, 1};

template <std::uint_fast64_t Modulus> class ModInt {
  using u64 = std::uint_fast64_t;

public:
  u64 x;

  constexpr ModInt(const u64 x = 0) noexcept : x(x % Modulus){};

  constexpr ModInt operator+(const ModInt rhs) const noexcept {
    return ModInt(*this) += rhs;
  }
  constexpr ModInt operator-(const ModInt rhs) const noexcept {
    return ModInt(*this) -= rhs;
  }
  constexpr ModInt operator*(const ModInt rhs) const noexcept {
    return ModInt(*this) *= rhs;
  }
  constexpr ModInt operator/(const ModInt rhs) const noexcept {
    return ModInt(*this) /= rhs;
  }
  constexpr ModInt &operator+=(const ModInt rhs) noexcept {
    x += rhs.x;
    if (x >= Modulus) {
      x -= Modulus;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) noexcept {
    if (x < rhs.x) {
      x += Modulus;
    }
    x -= rhs.x;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) noexcept {
    x = x * rhs.x % Modulus;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) noexcept {
    u64 n = Modulus - 2;
    while (n) {
      if (n & 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      n /= 2;
    }
    return *this;
  }
  constexpr bool operator==(const ModInt rhs) noexcept {
    return x == rhs.x;
  }
  constexpr bool operator!=(const ModInt rhs) noexcept {
    return x != rhs.x;
  }

  friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
    is >> rhs.x;
    return is;
  }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) {
    os << rhs.x;
    return os;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  using mint = ModInt<1000000007>;
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  vector<vector<mint>> grid(H, vector<mint>(W, 0));
  grid[0][0] = 1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i == 0 && j == 0) continue;
      if (S[i][j] == '#') continue;
      if (i > 0) grid[i][j] += grid[i - 1][j];
      if (j > 0) grid[i][j] += grid[i][j - 1];
    }
  }
  cout << grid[H - 1][W - 1] << '\n';
  return 0;
}


Measured memory_bytes: 9216
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(4, n + 1, 2):
        sieve[i] = 2
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i * 2):
            if sieve[j] == j:
                sieve[j] = i
    return sieve

X = int(input())

N = 10 ** 6
prime_table = make_prime_table(N)
for i in range(X, N + 1):
    if prime_table[i] == i:
        print(i)
        break


Measured memory_bytes: 48572
n = int(input())
a = list(map(int, input().split()))

prev = a[0]
mon = 1000
stc = 0

for i in range(1, n):
    #print(prev)
    if prev < a[i]:
        stc = mon // prev
        mon = mon - stc * prev
        mon = stc * a[i] + mon
        #print("stc = {} mon = {}" .format(stc, mon))
    elif prev >= a [i]:
        pass
        #print("stc = {} mon = {}" .format(stc, mon))
    prev = a[i]

#mon = mon + stc * a[n - 1]

print(mon)

Measured memory_bytes: 9072
import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
	static HashMap<String,String> map = new HashMap<String,String>();
	static ArrayList<String> list = new ArrayList<String>();

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int[] c = new int[a];
		int[] d = new int[b];
		for(int i = 0; i < a; i++) {
			c[i] = sc.nextInt();
		}
		for(int i = 0; i < b; i++) {
			d[i] = sc.nextInt();
		}
		int min = 0;
		for(int i = 0; i < b; i++) {
			int count = 0;
			int id    = 0;
			int j     = i;
			for(j = i ; j < b; j++) {
				if(id == a) break;
				if(d[j] != c[id]) {
					id++;
					j--;
				}
				else {
					id++;
					count++;
				}
			}
			//count += b - j ;
			min = Math.max(min, count);
		}
		System.out.println(min);
		
		
	}

}

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

#define fi first
#define se second
#define pb push_back
#define ii pair<int, int>
#define mp make_pair
#define iii pair< int, pair<int, ii> >
#define int long long
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
const int N = 1e5 + 10;
const int oo = 1e8;
const int mod = 1e9 + 7;
const double PI = acos(-1);
int n;
int res[N], la[N], pr[N];
vector<int> dsu[N];
struct book{
	int u, v, val;
} eg[N];
bool cmp(const book x, const book y)	{
	return x.val < y.val;
}
void join(int u, int v, int val)	{
	int pru = pr[u], prv = pr[v];
	if(dsu[pru].size() < dsu[prv].size()) swap(pru, prv);
	int tmp = dsu[pru].size();
	la[pru] += dsu[prv].size()*val;
	for(int j = 0; j < dsu[prv].size(); ++j)	{
		int cur = dsu[prv][j];
		pr[cur] = pru; dsu[pru].pb(cur);
		res[cur] += tmp*val; res[cur] += la[prv];
		res[cur] -= la[pru];
	}
	dsu[prv].clear();
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
    	pr[i] = i;
    	dsu[i].pb(i);
	}
    for(int i = 1; i < n; ++i)	{
    	cin >> eg[i].u >> eg[i].v >> eg[i].val;
	}
	sort(eg + 1, eg + n, cmp);
	for(int i = n - 1; i >= 1; --i)	{
		int u1 = eg[i].u, v1 = eg[i].v, val1 = eg[i].val;
		join(u1, v1, val1);
	}
	for(int i = 1; i <= n; ++i) cout << res[i] + la[pr[i]] << '\n';
}

Measured memory_bytes: 18804
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    x, y = i_map()

    if x == 2 or y == 2:
        print('No')
        exit()

    al = [1, 3, 5, 7, 8, 10, 12]
    bl = [4, 6, 9, 11]

    if x in al and y in al:
        print('Yes')
    elif x in bl and y in bl:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 95792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
  int n,k;cin>>n>>k;
  vector<int> v(n);
  rep(i,n)cin>>v[i];
  sort(v.begin(),v.end());
  int sum=0;
  for(int i=n-1;i>=n-k;i--)sum+=v[i];
  cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fs first
#define se second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef double db;

const int maxn=1e3+5;
const ll inf=0x3f3f3f3f;
const ll mod=1e9+7;

char s[maxn];

int main(){
	int n;
	scanf("%d",&n);
	int p=0,mx=0;int se=0;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(x>mx){
			p=i;
			se=mx;mx=x;
		}
		else se=max(se,x);
	}
	for(int i=1;i<=n;i++){
		if(i!=p) printf("%d\n",mx);
		else printf("%d\n",se);
	}
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int main(){
  int64_t N,K;cin>>N>>K;
  vector<int64_t>A;
  int64_t n=pow(N,0.5);
  for(int i=0;i<n;i++)
    A.push_back(1);if(n<N/n)A.push_back(N/n-n);
  for(int64_t i=n;2<=i;i--){
  int64_t a=(N/(i-1))-(N/i);
    A.push_back(a);
  }int M=A.size();
  vector<vector<int64_t>>dp(M,vector<int64_t>(K));
  for(int i=0;i<M;i++)dp[i][0]=A[i];
  for(int j=1;j<K;j++){
  int64_t a=0;
    for(int i=0;i<M;i++){
    a=(a+dp[i][j-1])%mod;
      dp[M-1-i][j]=(a*A[M-1-i])%mod;
    }
        }int64_t ans=0;
  for(int i=0;i<M;i++)
    ans=(ans+dp[i][K-1])%mod;
  cout<<ans<<endl;
  return 0;
}

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

int main() {

  int N;
  cin >> N;
  string S;
  int X=1;
  for(int i=0; i<N; i++ ){
    cin >> S ;
    if(S=="Y"){
      X=0;
    }
  }
  if(X){
    cout << "Three" ;
  }
  else {
    cout << "Four" ;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define getMat(x, n, m, val) vector<vector<ll>> x(n, vector<ll> (m, val))
#define setp fixed<<setprecision
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll M=1000000000+7;
 
ll power(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

ll MAXN = 1000005;
unordered_map<ll,ll>spf;
  
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (ll i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (ll j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
 
map<ll,ll>mp;
bool f=0;
// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
void getFactorization(ll x) 
{ 
    // vector<ll> ret; 
    map<ll,ll>tmp;
    while (x != 1) 
    { 
        // ret.push_back(spf[x]); 
        if(mp[spf[x]]==0){
            mp[spf[x]]=1;
            tmp[spf[x]]=1;
        }
        else if(tmp[spf[x]]==0){
            f=1;
            return;
        }
        // if(mp[spf[x]]>1){
        //     f=1;
        //     return;
        // }
        x = x / spf[x]; 
    } 
} 

int main(){
    fastio;
    sieve();
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        if(!f)getFactorization(a[i]);
    }
    ll g=a[0];
    if(f){
        for(ll i=1;i<n;i++){
            g=__gcd(g,a[i]);
        }
        if(g==1)cout<<"setwise coprime\n";
        else cout<<"not coprime\n";
    }
    else cout<<"pairwise coprime\n";
    return 0;
}

Measured memory_bytes: 50564
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    double x;
    cin >> x;
    double cur = 100;
    ll res = 0;
    while (1) {
        res++;
        cur *= 1.01;
        cur = floor(cur);
        if (cur >= x) {
            cout << res << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3740
def solve(N, vals):
    result = float("inf")
    for i in range(-100, 101):
        curCost = 0
        for val in vals:
            curCost += (i - val) ** 2
        result = min(result, curCost)
    print(result)


N = int(input())
a = list(map(int, input().split()))
solve(N, a)





Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	long long a,b,c,d,n,x,y;
	cin>>a>>b>>c>>d>>n;
	n=n*4;
	if(2*a<b)
	b=2*a;
	if(2*b<c)
	c=2*b;
	if(c*2<d)
	d=c*2;
	if(n==1)
	cout<<a<<endl;
	if(n>=2&&n<4)
	cout<<n%2*a+n/2*b<<endl;
	if(n>=4&&n<8)
	{
		x=n%4;
		cout<<n/4*c+x/2*b+x%2*a<<endl;
	}
	if(n>=8)
	{
		x=n%8;
		y=x%4;
		cout<<n/8*d+x/4*c+y/2*b+y%2*a<<endl;
	}
} 

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, k;
  cin >> n >> k;
  cout << to_string((ll)(k * pow((k-1), n-1))) << endl;
}

Measured memory_bytes: 384
fun main(args: Array<String>) {
    // Your code here!
    var s = readLine().toString()
    var th = s.substring(2,3)
    var fo = s.substring(3,4)
    var fi = s.substring(4,5)
    var si = s.substring(5,6)
    if(th == fo && fi == si){
        println("Yes")        
    }else{
        println("No")                
    }

}


Measured memory_bytes: 31844
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void){

    int ans = 0;
    string str; cin >> str;

    for(int i = 0;str[i] != '\0';i++){
        if(str[i] == '+') ans++;
        else if(str[i] == '-') ans--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#define MAX_N 110
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int cost[MAX_N][MAX_N];
int d[MAX_N];
bool used[MAX_N];
int n;
void dijkstra()
{
    fill(d, d + n, INF);
    fill(used, used + n, false);
    d[0] = 0;
    while(1)
    {
        int v = -1;
        for(int u = 0; u < n; u++)
        {
            if(!used[u] && (v == -1 || d[u] < d[v])) v = u;
        }
        if(v == -1) break;
        used[v] = true;
        for(int u = 0; u < n; u++) d[u] = min(d[u], d[v] + cost[v][u]);
    }
    for(int i = 0; i < n; i++) cout << i << " " << d[i] << endl;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            cost[i][j] = INF;
        }
    }
    for(int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for(int i = 0; i < k; i++)
        {
            int v, c;
            cin >> v >> c;
            cost[u][v] = c;
        }
    }
    dijkstra();
    return 0;
}




Measured memory_bytes: 3164
<?php
//入力値ASSA
$a = trim(fgets(STDIN));//入力値STDINから空白文字を取り除いてtrim取得fgets
$input = str_split($a);//取得した文字列を一文字づつ区切って配列に格納
$result = "No";//常に結果がNoと出力されるように変数に格納。該当処理の場合のみYes
sort($input);//配列を並べ替えキーと値の関係は保持されない([0]=>A,[1]=>S,[2]=>S,[3]=>A) → ([0]=>A,[1]=>A,[2]=>S,[3]=>S)
if (($input[0] == $input[1] && $input[2] == $input[3]) and ($input[2] != $input[1])) {
    //([0]=>A,[1]=>A,[2]=>S,[3]=>S)で且つ([0]=>A,[1]=>A,[2]=>A,[3]=>S)でないとき
    $result = "Yes";
}
echo $result;//常にNo
?>

Measured memory_bytes: 4604
#include<iostream>

using namespace std;

int main() {
	int n,tmp;
	cin >> n;
	int* buka = new int[n];
	for (int i = 0;i < n;i++) {
		buka[i] = 0;
	}
	for (int i = 1;i < n;i++) {
		cin >> tmp;
		buka[tmp - 1]++;
	}
	for (int i = 0;i < n;i++) {
		cout << buka[i] << endl;
	}
}

Measured memory_bytes: 3968
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* Zalgorithm */

// A[i] := S と S[i:|S|-1] の最長共通接頭辞の長さ

void Zalgorithm(const char *S, int *A) {
  int i = 1, j = 0, k, n = strlen(S);
  A[0] = n;
  while (i < n) {
    while (i + j < n && S[j] == S[i + j]) j++;
    A[i] = j;
    if (j == 0) {
      i++;
      continue;
    }
    for (k = 1; i + k < n && k + A[k] < j; k++) A[i + k] = A[k];
    i += k;
    j -= k;
  }
}


int N, A[SIZE], B[SIZE];
int z[30][SIZE*5];
char S[30][SIZE*5];

int main() {

  scanf("%d", &N);

  for (int i=0; i<N; i++) scanf("%d", A+i);
  for (int i=0; i<N; i++) scanf("%d", B+i);

  for (int i=0; i<N*5; i++) {
    int tmp;
    if (i < N)
      tmp = B[i];
    else if (i < N*3)
      tmp = A[i%N];
    else
      tmp = A[i%N] ^ ((1 << 30) - 1);

    for (int j=0; j<30; j++) {
      S[j][i] = tmp % 2 + 1;
      tmp /= 2;
    }
  }

  for (int i=0; i<30; i++)
    Zalgorithm(S[i], z[i]);

  for (int i=0; i<N; i++) {
    int b = A[i] ^ B[0];
    bool ok = true;

    for (int j=0; j<30; j++) {
      if (b & (1 << j)) {
        ok &= z[j][i+N*3] >= N;
      } else {
        ok &= z[j][i+N] >= N;
      }
    }

    if (ok) {
      printf("%d %d\n", i, b);
    }
  }


  return 0;
}


Measured memory_bytes: 151552
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

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

	int a,b;
	cin>>a>>b;
	if(b-a>5000)cout<<0<<endl;
	else{
		int m=inf;
		loop(i,a,b+1)loop(j,i+1,b+1)
			cmin(m,(i*j)%2019);
		cout<<m<<endl;
	}
}


Measured memory_bytes: 256
N, Q = gets.split.map(&:to_i)
S = gets.chomp
ls = Array.new(Q)
rs = Array.new(Q)

ac_rui = [0]
ac_n = 0

(S.length-1).times do |i|
  if(S[i] == "A" && S[i+1] == "C")
    ac_n += 1
  end
  ac_rui[i+1] = (ac_n)
end

Q.times do |i|
  ls[i], rs[i] = gets.split.map(&:to_i)
  puts ac_rui[ rs[i] -1 ] - ac_rui[ ls[i] -1 ]
end



Measured memory_bytes: 4988
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N, K, X, Y;
	std::cin >> N >> K >> X >> Y;
	if (N <= K)
		std::cout << (N * X) << "\n";
	else
		std::cout << ((K * X) + ((N - K) * Y)) << "\n";
}


Measured memory_bytes: 384
N = int(input())
X = list(map(int, input().split()))
mod = 10**9+7
ans = 0

# ある区間X[3] - X[2]をあるスライムが通過する確率
# 3番目のスライムが通過する確率:1 (必ず通過する。3!=6通り。123, 132, 231, 213, 312, 321)
# 2番目のスライムが通過する確率:1/2 (先に3が選ばれる必要がある。3/6=1/2)
# 1番目のスライムが通過する確率:1/3 (先に3,2が選ばれる必要がある。2/6=1/3)
# ある区間X[i+1] - X[i]についてあるスライムi-jが通過する確率は 1/(j+1)

# 1 = 1
# 2 = 1 + 1/2 = 3/2
# 3 = 1 + 1/2 + 1/3 = 11/6
# 4 = 1 + 1/2 + 1/3 + 1/4 = 25/12
# 5 = 1 + 1/2 + 1/3 + 1/4 + 1/5 = 137/60

# 各区間の確率係数を求めてかけた場合
# for i in range(N-1):
#     d = X[i+1]-X[i]
#     p = 1
#     for j in range(1, i+1):
#         p += 1/(j+1)
#     ans += d * p % mod

# あるスライムから最後までの総距離ごとの確率
# ここがよくわからん。前計算を理解できてない
for i in range(N-1):
    d = X[N-1]-X[i]
    ans += d * pow(i+1, mod-2, mod)

# (N-1)!
a = 1
for i in range(1, N):
    a *= i
    a %= mod

ans *= a
ans %= mod
print(int(ans))

Measured memory_bytes: 62576
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int a, b, c, d; cin >> a >> b >> c >> d;
    int t = min(b, d) - max(a, c);
    cout << max(t, 0) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include <stack>
using namespace std;

int main() {
    int N, W;
    int v[110], w[110];
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> v[i] >> w[i];

    int dp[110][10010];
    for (int i = 0; i <= W; ++i) dp[0][i] = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= W; ++j) {
            if (j >= w[i]) dp[i+1][j] = max(dp[i][j-w[i]] + v[i], dp[i][j]);
            else dp[i+1][j] = dp[i][j];
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 7056
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	puts(n <= 999 ? "ABC" : "ABD");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
 
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)
 
int main() {
  ll N, X;
  cin >> N >> X;
  
  if(X>=N){
    cout << "unsafe" << endl;
  }else{
    cout << "safe" << endl;
  }
  
}

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

using namespace std;
typedef long long ll;

#define MOD 1000000007

int main(void)
{
  int h, w;
  char str[100][100];
  string temp = "";

  cin >> h >> w;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> str[i][j];
    }
  }

  for(int i=0; i<2*h; i++) {
    for(int j=0; j<w; j++) {
      temp += str[((i+2)/2)-1][j];
    }
    cout << temp << endl;
    temp = "";
  }



  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {

    int a,b,h,w;
    while(1){

    scanf("%d %d",&h,&w);

    if(h == 0 && w == 0){

        break;    }

    for(a=0;a<h;a++){

        for(b=0;b<w;b++){

            printf("#",h);

        }

        printf("\n");

    }
    printf("\n");}

return 0;}

Measured memory_bytes: 588
N,M=map(int,input().split())
H=list(map(int,input().split()))

flag=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    ha=H[a-1]
    hb=H[b-1]
    if ha==hb:
        flag[a-1]=False
        flag[b-1]=False
    elif ha<hb:
        flag[a-1]=False
    else:
        flag[b-1]=False
cnt=0
for f in flag:    
    if f:
        cnt+=1

print(cnt)

Measured memory_bytes: 20120
// ------------------------------------
// Date:2018/ 4/ 4
// Problem:otoshidama _ _ re_c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N, Y);
  REP(xi, N + 1) {
    int z = 5000 * (N + xi) - Y;
    if (z % 4000 == 0) {
      z /= 4000;
      int y = N - xi - z;
      if (y >= 0 && z >= 0) {
	printf("%d %d %d\n", xi, y, z);
	return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);


int main(){
  int n;
  cin >> n;
  vector<pair<string, int>> rest(n);
  vector<pair<string, int>> rest_s(n);
  REP(i,n){
    string s;
    int p;
    cin >> s >> p;
    rest[i].first = s;
    rest[i].second = -p;
    rest_s[i].first = s;
    rest_s[i].second = -p;
  }

  sort(ALL(rest_s));

  //REP(j,n) cout <<j + 1<< ": "<< rest_s[j].first << rest_s[j].second  << endl;


  REP(i,n){
    REP(j,n){
      if(rest[j] == rest_s[i]){
        cout << j + 1 << endl;
        //break;
      }
    }
  }

  //mapの内部ではKEYが昇順になるようにsortされている

  return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
		if(a<b){
			printf("a < b\n");
		}else{
		if(a>b){
			printf("a > b\n",a,b);
		}else{
		if(a = b){
			printf("a == b\n",a,b);
return 0;
		}}}
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            if (N < 105)
            {
                Console.WriteLine(0);
                return;
            }

            var total = 0;
            for (int i = 105; i <= N; i += 2)
            {
                var count = 0;
                for (int j = 1; j <= i; j++)
                {
                    if (i % j == 0)
                        count++;
                }
                if (count == 8)
                    total++;
            }

            Console.WriteLine(total);
        }
    }
}

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

int main() {
    long long k, n;
    cin >> k >> n;
    
    long long a[n];
    rep(i, n){
        cin >> a[i];
    }
    
    long long d[n];
    rep(i, n-1){
        d[i] = a[i+1] - a[i];
    }
    d[n-1] = k - a[n-1] + a[0];
    
    long long m = 0;
    rep(i, n){
        m = max(m, d[i]);
    }
    
    long long res = k - m;
    
    cout << res << endl;
    return 0;
}

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

struct Human{
  bool a,b,c;
  Human(){
    a = b = c = false;
  }
};

int main(){

    int n,x,y,z,tmp,count=0;

    cin >> n;

    Human hu[n+1];

    cin >> x;

    for(int i=0;i<x;i++){
      cin >> tmp;
      hu[tmp].a = true;
    }

    cin >> y;

    for(int i=0;i<y;i++){
      cin >> tmp;
      hu[tmp].b = true;
    }

    cin >> z;

    for(int i=0;i<z;i++){
      cin >> tmp;
      hu[tmp].c = true;
    }

    for(int i=1;i<n+1;i++){
      if(!hu[i].c || (hu[i].a && !hu[i].b) ){
        continue;
      }
      count++;
    }

    cout << count << endl;




    return 0;
}

Measured memory_bytes: 3068
n = int(input())
a = [int(x) for x in input().split(' ')]

a.sort()
s = [a[0]]
for i in range(1, n):
  s.append(s[i - 1] + a[i])

res = 1
for i in reversed(range(0, n - 1)):
  if s[i] * 2 >= a[i + 1]:
    res += 1
  else:
    break

print(res)


Measured memory_bytes: 14308
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
	
	
}
int main(){
	long long a,b;
	cin>>a>>b;
	long long t=gcd(a,b);
	cout<<a*b/t;
	return 0;
}

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

typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

	ll h, w;
	cin >> h >> w;
	if(h == 1 || w == 1){
        cout << 1 << endl;
        return 0;
    }
	ll res = (h/2)*w;
	if(h%2) res += (w+1)/2;
	cout << res;
    return 0;
}


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

vector <int> G[2505], W[2505], R[2505];
int osiagalne_z_1[2505], osiagalne_z_n[2505];

int drogi[2505];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, m, p;
	cin >> n >> m >> p;
	for (int i = 1; i <= m; ++i){
		int a, b, w;
		cin >> a >> b >> w;
		w -= p;
		G[a].push_back(b);
		W[a].push_back(w);
		R[b].push_back(a);
	}
	queue <int> Q;
	Q.push(1);
	while (! Q.empty()){
		int v = Q.front();
		Q.pop();
		if (osiagalne_z_1[v])
			continue;
		osiagalne_z_1[v] = true;
		for (auto u: G[v])
			if (! osiagalne_z_1[u])
				Q.push(u);
	}

	Q.push(n);
	while (! Q.empty()){
		int v = Q.front();
		Q.pop();
		if (osiagalne_z_n[v])
			continue;
		osiagalne_z_n[v] = true;
		for (auto u: R[v])
			if (! osiagalne_z_n[u])
				Q.push(u);
	}
	for (int i = 2; i <= n; ++i)
		drogi[i] = -2e9;
	for (int I = 1; I < n; ++I){
		for (int i = 1; i <= n; ++i){
			for (int j = 0; j < G[i].size(); ++j)
				if (drogi[i] + W[i][j] > drogi[G[i][j]])
					drogi[G[i][j]] = drogi[i] + W[i][j];
		}
	}
	bool inf = false;
	for (int i = 1; i <= n; ++i){
		for (int j = 0; j < G[i].size(); ++j){
			if (drogi[i] + W[i][j] > drogi[G[i][j]]){
				if (osiagalne_z_1[G[i][j]] && osiagalne_z_n[G[i][j]])
					inf = true;
			}
		}
	}
	if (inf)
		cout << "-1\n";
	else
		cout << max(0,drogi[n]) << "\n";
}

Measured memory_bytes: 768
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Long h = sc.nextLong(), w = sc.nextLong();
        if(h==1||w==1){
            System.out.println(1);
        } else if(h*w%2==0){
            System.out.println(h*w/2);
        } else {
            System.out.println(h*w/2+1);
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
int n,q,v[500001],w[500001];
int f[512][100001];
int getf(int V,int L)
{
	if(V<512)return f[V][L];
	if(L>=w[V])return max(getf(V>>1,L),getf(V>>1,L-w[V])+v[V]);
	else return getf(V>>1,L);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",v+i,w+i);
	scanf("%d",&q);
	for(int i=1;i<512;i++){
		memcpy(f[i],f[i>>1],sizeof f[i>>1]);
		for(int j=100000;j>=w[i];--j)
			f[i][j]=std::max(f[i][j],f[i][j-w[i]]+v[i]);
	}
	for(int i=1,v,L;i<=q;i++)
	{
		scanf("%d%d",&v,&L);
		printf("%d\n",getf(v,L));
	}
}

Measured memory_bytes: 205488
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#define N 200020
using namespace std;

int n, a[N];
vector<int> e[N];
int o[N];
multiset<int> f[N << 2];
int g[N << 2], d[N];

void SetSegment(int x, int l, int r, int p, int v, bool k)
{
    int m;

    if(l > p || r < p)
        return;
    if(l == r)
    {
        if(k)
            f[x].insert(v);
        else
            f[x].erase(f[x].find(v));
        g[x] = f[x].empty() ? 0 : *f[x].rbegin();

        return;
    }

    m = (l + r) >> 1;
    SetSegment(x << 1    , l    , m, p, v, k);
    SetSegment(x << 1 | 1, m + 1, r, p, v, k);
    g[x] = max(g[x << 1], g[x << 1 | 1]);

    return;
}

int MaxSegment(int x, int l, int r, int s, int t)
{
    int m;

    if(l > t || r < s)
        return 0;
    if(l >= s && r <= t)
        return g[x];

    m = (l + r) >> 1;

    return max(MaxSegment(x << 1, l, m, s, t), MaxSegment(x << 1 | 1, m + 1, r, s, t));
}

void DFS(int x, int p)
{
    int i;

    d[x] = MaxSegment(1, 1, n, 1, a[x] - 1) + 1;
    // printf("to %d, max is %d(%d-%d)\n", x, d[x], 1, a[x] - 1);
    o[x] = max(d[x], g[1]);
    SetSegment(1, 1, n, a[x], d[x], true);
    for(i = 0; i < (signed)e[x].size(); i ++)
        if(e[x][i] != p)
            DFS(e[x][i], x);
    SetSegment(1, 1, n, a[x], d[x], false);

    return;
}

int main(void)
{
    int u, v;
    int i;
    vector<int> t;

    scanf("%d", &n);
    for(i = 1; i <= n; i ++)
    {
        scanf("%d", &a[i]);
        t.push_back(a[i]);
    }
    sort(t.begin(), t.end());
    t.erase(unique(t.begin(), t.end()), t.end());
    for(i = 1; i <= n; i ++)
        a[i] = (int)(lower_bound(t.begin(), t.end(), a[i]) - t.begin()) + 1;
    for(i = 1; i < n; i ++)
    {
        scanf("%d %d", &u, &v);
        e[u].push_back(v);
        e[v].push_back(u);
    }

    DFS(1, 1);
    for(i = 1; i <= n; i ++)
        printf("%d\n", o[i]);

    return 0;
}


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

if N == 0:
    print('0')
    exit()


ans_arr = []

while 1:
    if N == 1:
        ans_arr.append('1')
        break
    if N % 2:
        ans_arr.append('1')
        N -= 1
    else:
        ans_arr.append('0')
    N /= -2
print("".join(reversed(ans_arr)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

vector<ll> X(100010), Y(100010);

int main() {
	ll N, M;
	cin >> N >> M;

	ll xal = 0, yal = 0;
	for (ll i = 0;i < N;i++) {
		cin >> X[i];
		if (i) {
			xal += (X[i] - X[i - 1])*(i*(N - i) % MOD);
			xal %= MOD;
		}
	}
	for (ll i = 0;i < M;i++) {
		cin >> Y[i];
		if (i) {
			yal += ((Y[i] - Y[i - 1])*xal%MOD)*(i*(M - i) % MOD);
			yal %= MOD;
		}
	}
	cout << yal << endl;
}

Measured memory_bytes: 1792