akhauriyash/Code-Regression huggingface dataset:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def solve(N, X, cities):
    dists = [abs(city - X) for city in cities]
    ans = min(dists)
    for d in dists:
        if d % ans == 0:
            continue
        else:
            ans = gcd(ans, d % ans)
    return ans

if __name__ == "__main__":
    l = input()
    N, X = int(l.split()[0]),int(l.split()[1])
    cities = [int(c) for c in input().split()]
    print(solve(N, X, cities))

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int N = read();
  set<pi> st;
  vector<pi> xy;
  REP(i, N) {
    int x = read(), y = read();
    st.insert(MP(x, y));
    xy.PB(MP(x, y));
  }
  int ans = N;
  REP(i, N) {
    REP(j, N) {
      if (i == j) continue;
      int p = xy[i].first - xy[j].first, q = xy[i].second - xy[j].second;
      int cost = N;
      REP(k, N) {
        pi tmp(xy[k].first - p, xy[k].second - q);
        if (st.count(tmp)) cost--;
      }
      chmin(ans, cost);
    }
  }
  print(ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner sn = new Scanner(System.in);
        String HW = sn.nextLine();
        long H = Integer.valueOf(HW.split(" ")[0]);
        long W = Integer.valueOf(HW.split(" ")[1]);
        sn.close();
        long D = 0;


        if((H == 1) || (W == 1)){
            D = 1;
        }else {
            if((H % 2 == 1) && (W % 2 == 1)) {
                D = H * W / 2 + 1;
            }else {
                D = H * W / 2;
            }
        }

        System.out.println(D);
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    cout << ((B - A) % 2 ? "Borys" : "Alice") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll n, m;

	std::cin >> n >> m;
	if (n == m) {
		outn("Yes");
	}
	else {
		outn("No");
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int NUM = 2e5 + 5;

int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
        int n,m; cin>>n>>m;
        vector<pair<int,int>> a;
        for(int i=0;i<n;i++){
            int x,y; cin>>x>>y;
            a.pb({x,y});
        }
        sort(a.begin(),a.end());
        priority_queue<int> pq;
        int nxt = 0,ans=0;
        for(int i=1;i<=m;i++){
            while(nxt<n and a[nxt].F==i){
               // cout<<i<<" "<<a[nxt].F<<" "<<a[nxt].S<<endl;
                pq.push(a[nxt].S);
                nxt++;
            }
            if(!pq.empty()) {
                ans+=pq.top();
                pq.pop();
            }
        }
        cout<<ans;
    }
}


Measured memory_bytes: 1908
import itertools

N, M, X = map(int, input().split())

C = []
A = []

for _ in range(N):
    T = list(map(int, input().split()))
    C.append(T[0])
    A.append(T[1:])

ans = -1

queue = [[0, 0, [0] * M]]
while queue:
    index, price, study_list = queue.pop(0)

    if index < N:
        queue.append([index + 1, price, study_list])

        price_2 = price + C[index]
        study_list_2 = study_list[:]
        for i in range(M):
            study_list_2[i] += A[index][i]

        queue.append([index + 1, price_2, study_list_2])
    else:
        flag = True
        for s in study_list:
            if s < X:
                flag = False
                break
        if flag:
            if ans == -1:
                ans = price
            else:
                ans = min(ans, price)
print(ans)


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

#define pb push_back
#define fst first
#define snd second
#define ALL(s) s.begin(),s.end()
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define SZ(x) ((int)(x).size())
#define PI 3.1415926535897932384626433832795
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

const int MAXN = 51;
vector<pair<ll,ll>> v(MAXN);
vector<ll> len(MAXN);

ll solve(int n, ll x){
    ll idx = 0;
    if(x > 1){
        idx++;
        if(idx+len[n-1]<x){
            idx += len[n-1];
            if(idx+1<x){
                idx++;
                if(idx+len[n-1]<=x){
                    return v[n].fst;
                }else{
                    return v[n-1].fst+1+solve(n-1,x-idx);
                }
            }else{
                return v[n-1].fst+1;
            }
        }else if(idx+len[n-1]==x){
            return v[n-1].fst;
        }else{
            return solve(n-1,x-idx);
        }
    }else{
        return 0;
    }
}

int main() {FIN;

    v[0] = {1,0};
    len[0] = 1;
    fore(i,1,51){
        v[i].fst = v[i-1].fst*2+1;
        v[i].snd = v[i-1].snd*2+2;
        len[i] = v[i].fst+v[i].snd;
    }
    int n; ll x; cin>>n>>x;
    cout<<solve(n,x);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if (b+c-a < 0){
        cout << 0 << endl;
    }
    else {
        cout << b + c - a << endl;
    }
}


Measured memory_bytes: 256
n=int(input())
s=int(input())

def f(b,n):
	if b < 2:
		return 0
	if n < b:
		return n
	else:
		return f(b,n//b)+n%b

ans=-1
if s==n:
	ans=n+1
else:
	for _b in range(2,int(n**0.5)+1):
		if f(_b,n)==s:
			ans=_b
			break
	if ans==-1:
		for _p in range(int(n**0.5),0,-1):
			_b = (n-s)//_p+1
			if f(_b,n)==s:
				ans=_b
				break
print(ans)

Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s;cin>>s;
  if(s=="ABC")cout<<"ARC"<<ENDL;
  else cout<<"ABC"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

from collections import Counter

N = int(input())
a = [int(i) for i in input().split()]
c = Counter(a)
cnt = 0
for i, j in c.items():
    if i < j:
        cnt += (j-i)
    elif i == j:
        continue
    elif i > j:
        cnt += j
    else:
        continue
print(cnt)

Measured memory_bytes: 18676
#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL 
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<n+n*n+n*n*n;


    
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
 
/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
*/
using namespace std;
 
#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const LL MOD = 1000000000 + 7;
const LD EPS = 0.0000001 ;
#define MPP(a, b, c) MP(MP(a, b), c)
#define PII pair<pair<LL,LL>, LL>
 
LL pows(LL a, LL b)
{
	if (b == 0) return 1LL;
	LL temp = pows(a, b / 2);
	temp = (temp * temp) % MOD;
	if (b % 2) temp = (temp * a) % MOD;
	return temp;
}

const int N = 300000;

LL fact[N];
LL invfact[N];

LL nCr(int n, int m)
{
	if (n < m) return 0;
	LL num = fact[n];
	num = (num * invfact[n - m]) % MOD;
	num = (num * invfact[m]) % MOD;
	return num;
}

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    fact[0] = fact[1] = 1LL;

    for (LL i = 2; i < N; i++) fact[i] = (fact[i - 1] * i) % MOD;

    invfact[0] = invfact[1] = 1;
	for (LL i = 2; i < N; i++) invfact[i] = (invfact[i - 1] * pows(i, MOD - 2)) % MOD;

    LL h, w, n; cin >> h >> w >> n;
    pair<LL,LL> arr[n + 1];

    for (int i = 0; i < n; i++){
    	cin >> arr[i].fi >> arr[i].se;
    } 
    arr[n].fi = h;
    arr[n].se = w;
    sort(arr, arr + n + 1);

    LL dp[n + 1];
    memset(dp, 0, sizeof(dp));

    for (int i = 0; i <= n; i++){
    	dp[i] = nCr(arr[i].fi + arr[i].se - 2, arr[i].fi - 1);
    	for (int j = 0; j < i; j++){
    		if (arr[j].se > arr[i].se) continue;
    		LL temp = dp[j] * nCr(arr[i].fi - arr[j].fi + arr[i].se - arr[j].se, arr[i].fi - arr[j].fi);
    		temp %= MOD;
    		dp[i] = (dp[i] + MOD - temp) % MOD;
    	}
    }

    cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;

namespace sol
{
	int fac[2000005], ifac[2000005];
	
	int x1, x2, x3, x4, x5, x6;
	int y1, y2, y3, y4, y5, y6;
	
	int comb(int n, int m)
	{
		if(m < 0 || n < m) return 0;
		return 1LL * fac[n] * ifac[n - m] % MOD * ifac[m] % MOD;
	}
	
	int calc(int bx, int by, int ex, int ey)
	{
		return comb(ex + ey - bx - by, ex - bx);
	}
	
	int solve(int bx, int by, int ex, int ey)
	{
		int ans = 0;
		for(int i = x3; i <= x4; i ++)
		ans = (ans + 1LL * calc(bx, by, i, y3 - 1) * calc(i, y3, ex, ey) % MOD * (MOD - i - y3 + 1)) % MOD;
		for(int i = x3; i <= x4; i ++)
		ans = (ans + 1LL * calc(bx, by, i, y4) * calc(i, y4 + 1, ex, ey) % MOD * (i + y4)) % MOD;
		for(int i = y3; i <= y4; i ++)
		ans = (ans + 1LL * calc(bx, by, x3 - 1, i) * calc(x3, i, ex, ey) % MOD * (MOD - i - x3 + 1)) % MOD;
		for(int i = y3; i <= y4; i ++)
		ans = (ans + 1LL * calc(bx, by, x4, i) * calc(x4 + 1, i, ex, ey) % MOD * (i + x4)) % MOD;
		return ans;
	}
	
	void init()
	{
		fac[0] = 1;
		rep1(i, 2000000) fac[i] = 1LL * fac[i - 1] * i % MOD;
		rep1(i, 2000000) ifac[i] = i == 1 ? 1 : MOD - 1LL * ifac[MOD % i] * (MOD / i) % MOD;
		ifac[0] = 1;
		rep1(i, 2000000) ifac[i] = 1LL * ifac[i - 1] * ifac[i] % MOD;
	}
	
	void solve()
	{
		scanf("%d%d%d%d%d%d", &x1, &x2, &x3, &x4, &x5, &x6);
		scanf("%d%d%d%d%d%d", &y1, &y2, &y3, &y4, &y5, &y6);
		int ans = 0;
		ans = (ans + solve(x1 - 1, y1 - 1, x6 + 1, y6 + 1)) % MOD;
		ans = (ans - solve(x2, y1 - 1, x6 + 1, y6 + 1) + MOD) % MOD;
		ans = (ans - solve(x1 - 1, y2, x6 + 1, y6 + 1) + MOD) % MOD;
		ans = (ans + solve(x2, y2, x6 + 1, y6 + 1)) % MOD;
		ans = (ans - solve(x1 - 1, y1 - 1, x6 + 1, y5) + MOD) % MOD;
		ans = (ans + solve(x2, y1 - 1, x6 + 1, y5)) % MOD;
		ans = (ans + solve(x1 - 1, y2, x6 + 1, y5)) % MOD;
		ans = (ans - solve(x2, y2, x6 + 1, y5) + MOD) % MOD;
		ans = (ans - solve(x1 - 1, y1 - 1, x5, y6 + 1) + MOD) % MOD;
		ans = (ans + solve(x2, y1 - 1, x5, y6 + 1)) % MOD;
		ans = (ans + solve(x1 - 1, y2, x5, y6 + 1)) % MOD;
		ans = (ans - solve(x2, y2, x5, y6 + 1) + MOD) % MOD;
		ans = (ans + solve(x1 - 1, y1 - 1, x5, y5)) % MOD;
		ans = (ans - solve(x2, y1 - 1, x5, y5) + MOD) % MOD;
		ans = (ans - solve(x1 - 1, y2, x5, y5) + MOD) % MOD;
		ans = (ans + solve(x2, y2, x5, y5)) % MOD;
		printf("%d\n", ans);
	}
}

int main()
{
	sol::init();
	sol::solve();
	return 0;
}

Measured memory_bytes: 15872
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)

int main(){
    //input
    int x, y;
    scanf("%d%d", &x, &y);

    //solve
    ll ans = 0;
    if(x >= 0){
        if(y >= x) ans = - x + y;
        else if(y > 0) ans = x - y + 2;
        else if(y >= -x) ans = x + y + 1;
        else ans = - y - x + 1;
    }else{
        if(y >= -x) ans = x + y + 1;
        else if(y > 0) ans = - x - y + 1;
        else if(y >= x) ans = - x + y;
        else ans = x - y + 2;
    }

    //output
    printf("%lld", ans);
}

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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
    int res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
int mul_mod(int a, int b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((int)res);
}
int pow_mod(int a, int b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (int)res;
}
int inv_mod(int a)
{
    return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 200001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(int a, int b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, ans = 0;
    cin >> n;
    vector<int> a(n);
    rep (i, n) cin >> a[i];
    sort(all(a), [](int a, int b) {return a > b;});
    int multi = pow_mod(2, n - 1);
    rep (i, n) {
        ans += mul_mod(mod(multi + mul_mod(i, pow_mod(2, n - 2))), a[i]);
        ans = mod(ans);
    }
    eprintf("%d\n", ans);
    cout << mul_mod(pow_mod(2, n), ans) << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>	// upper_bound(A, A+N, num), lower_bound(A, A+N, num)
#include <functional>
#include <string>
#include <sstream>
#include <complex>
#include <vector>		// V[i],  push_back(x), pop_back(), insert(index, x), erase(index), sort(v.begin(), v.end(), greater<int>())
#include <list>			// push_front(x), push_back(x), pop_front(), pop_back(), insert(index, x)
#include <queue>		// push(x), front(), pop()
#include <deque>
#include <stack>		// push(x), top(), pop()
#include <map>			// M[key],  insert(key, val), erase(key), find(key), 
#include <set>			// insert(key), erase(key), find(key)

using namespace std;
typedef long long ll;
// typedef pair<int, int> P;

#define PI 3.141592653589793)
#define MOD 1000000007
#define REP(i, n) for(int i = 0; i < n; i++)

int a, b;

void solve() {
	cin >> a >> b;
	string ans;
	if (a >= 0 && b <= 0) ans = "Zero";
	if (a <= 0 && b >= 0) ans = "Zero";
	if (a > 0 && b > 0) ans = "Positive";
	if (a < 0 && b < 0) {
		if ((int)abs(a - b) % 2 == 1)ans = "Positive";
		else ans = "Negative";
	}
	cout << ans << endl;

}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int a, b, c;
	cin >> a >> b >> c;

	cout << ((a == b) + (b == c) + (a == c) == 1?"Yes":"No") << endl;



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int n;
	cin >> n;

	vector<Int> time(5);
	Int mint = INF;//最小運搬人数
	Int minc = 0;//最小の都市番号
	Int res = 0;
	for (Int i = 0; i < 5; i++) {
		cin >> res;
		if (res <= mint) {
			mint = res;
			minc = i;
		}

	}

	Int ans = 5;
	if (mint < n) {
		//ans = (n + (mint - 1)) / mint + (4 - minc + 1);
		ans += (n + (mint - 1)) / mint-1;
	}

	printf("%lld\n", ans);
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	int fx = n;
	int sum = 0;
	while (fx != 0) {
		sum += fx % 10;
		fx /= 10;
	}
	cout << (n % sum == 0 ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  char a;
  cin >> a;

  if('a'<=a && a<='z')  cout << "a" << endl;
  else  cout << "A" << endl;

  return 0;
}

Measured memory_bytes: 3604
H, W = map(int, input().split())
if W % 2 == 0: a = W // 2
else: a = W//2 + 1

if H == 1 and W >= 1: print(1)
elif W == 1 and W >= 1: print(1)
else: print(W *(H//2) if H % 2 == 0 else W *(H//2) + a)

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

struct UnionFind {
  vector< int > data;
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
  int Size(int x) {
    return(-data[Find(x)]);
  }
  int Find(int k) {
    return(data[k] < 0 ? k : data[k] = Find(data[k]));
  }
  void Unite(int a, int b) {
    a = Find(a), b = Find(b);
    if(a == b) return;
    data[a] += data[b];
    data[b] = a;
  }
};

int main() {
  int W, H;
  while(cin >> W >> H, W) {
    string mas[50];
    for(int i = 0; i < H; i++) cin >> mas[i];
    UnionFind uf(W * H);
    for(int i = 0; i < H; i++) {
      for(int j = 1; j < W; j++) {
        if(mas[i][j - 1] != '#' && mas[i][j] != '#') uf.Unite(i * W + j - 1, i * W + j);
      }
    }
    for(int i = 1; i < H; i++) {
      for(int j = 0; j < W; j++) {
        if(mas[i - 1][j] != '#' && mas[i][j] != '#') uf.Unite(i * W - W + j, i * W + j);
      }
    }
    for(int i = 0; i < H; i++) {
      for(int j = 0; j < W; j++) {
        if(mas[i][j] == '@') cout << uf.Size(i * W + j) << endl;
      }
    }
  }
}

  

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  cin>>s;
  int num=1000000000;
  int size=s.size()-1;
  for(int i=0;i<size;i++){
    if(s[i+1]!=s[i]){
      num=min(num,max(i+1,size-i));
    }
  }
  cout<<((num==1000000000)?(size+1):(num))<<endl;
  return 0;
}

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

int main() {
    int n;
    map<string, int> m;
    cin >> n;

    for(int i = 0; i < n; i++) {
        string tmp;
        cin >> tmp;
        m.insert(make_pair(tmp, 1));
    }

    cout << m.size() << endl;
    return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
  cin.tie(NULL); cout.tie(NULL); 

  string s; int k, n;
  cin >> n >> k >> s;

  vector < int > cnt(n, 0);
  char best = *min_element(s.begin(), s.end());



  if(k > 15) {
    for(int i = 0; i < n; ++i) cout << best;
  }
  else {
    if(k == 1) {
      string t = s, ans = s; reverse(t.begin(), t.end()); 
      s += t;
      for(int i = 0; i < n + 1; ++i) {
        if(ans > s.substr(i, n)) ans = s.substr(i, n);
      }
      cout << ans;
      return 0;
    }

    string t = s;
    reverse(t.begin(), t.end());
    
    string ans = s;

    s += t;

    k -= 1;

    int cnt = 0;
    for(int i = s.size() - 1; i >= 0; --i) {
      if(s[i] == best) cnt++;
      else {
        cnt = 0;
      } 

      int get = min(n, cnt << k);
  //    cout << cnt << endl;
      if(i < n - cnt) {
    //    cout << "bug" << endl;
        continue;
      }

      string tmp = s.substr(i - n + get, n - get);
      reverse(tmp.begin(), tmp.end());

      ans = min(ans, string(get, best) + tmp);
    }

    cout << ans;
  }


  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[200010],vis[200010];
vector<int>v;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>b)
    {
        for(int i=0;i<a;i++)
            cout<<b;
    }
    else
    {
        for(int i=0;i<b;i++)
            cout<<a;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N,K,Q;
	cin >> N >> K >> Q;
	vector<int> A(Q);
	for(int i = 0; i < Q; i++)
		cin >> A.at(i);

	vector<int> point(N,K-Q);
	for(int i = 0; i < Q; i++)
		point.at(A.at(i)-1)++;

	for(int i = 0; i < N; i++)
		cout << (point.at(i)>0?"Yes":"No") << endl;
}

Measured memory_bytes: 1408
from scipy.sparse.csgraph import floyd_warshall

h,w=map(int,input().split(' '))
cost=[list(map(int,input().split(' '))) for _ in range(10)]
dist=floyd_warshall(cost)
cost=[dist[i][1] for i in range(10)]

total=0
for _ in range(h):
    wall=list(map(int,input().split(' ')))
    for num in wall:
        if num==-1 or num==1:
            continue
        total+=cost[num]
print(int(total))

Measured memory_bytes: 13680
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e2 + 5;
const int INF = 1e9 + 7;

int x, n;
vector<int> a(N);

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x >> n;
	a.resize(n);
	map<int, int> mp;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		++mp[a[i]];
	}
	for (int i = 0; i <= n; i++)
	{
		if (!mp[x - i])
		{
			cout << x - i;
			return 0;
		}
		if (!mp[x + i])
		{
			cout << x + i;
			return 0;
		}
	}
	return 0;
}
//10-09-2020 17:58:39

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	double a,b,s;
	cin>>a>>b;
	s=a*b/3.305785;
	printf("%.6lf\n",s);
}

Measured memory_bytes: 1236
#2問目
import heapq
N, K = map(int, input().split())
array = [0] * N
count = 0
A = list(map(int, input().split()))
for i in A:
    array[i-1] += 1
if(array.count(0) >= N - K):
    print(0)
else:
    array_plus = [i for i in array if i > 0]
    array_plus = sorted(array_plus)
    l = array_plus[:len(array_plus)-K]
    print(sum(l))

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int c[9] = {0};
	
	int N, a;
	cin >> N;
	REP(i, 0, N){
		cin >> a;
		if(a < 400) ++c[0];
		else if(a < 400) ++c[0];
		else if(a < 800) ++c[1];
		else if(a < 1200) ++c[2];
		else if(a < 1600) ++c[3];
		else if(a < 2000) ++c[4];
		else if(a < 2400) ++c[5];
		else if(a < 2800) ++c[6];
		else if(a < 3200) ++c[7];
		else ++c[8];
	}
	
	int ans = 0;
	REP(i, 0, 8){
		if(c[i] > 0) ++ans;
	}
	if(ans == 0) cout << 1 << " " << c[8];
	else cout << ans << " " << ans + c[8];
	

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
const ll LINF = 1001001001001001001;
int main(){
    vector<ll> a(2), c(2);
    rep(i,2)cin>>a[i];
    rep(i,2)cin>>c[i];
    ll ans = -LINF;
    rep(i,2)rep(j,2)ans=max(ans, a[i]*c[j]);
    cout << ans << endl;
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N+2, 0), C(N+2, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i+1];
    C[i+1] = C[i] + abs(A[i+1] - A[i]);
  }
  C[N+1] = C[N] + abs(A[N+1] - A[N]);
  for (int i = 1; i <= N; i++) {
    int ans = C[N+1] - (C[i+1] - C[i-1]) + abs(A[i+1] - A[i-1]);
    cout << ans << endl;
  }
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int n, k; cin >> n >> k;
    vll a(n + 1);
    FOR(i, 1, n) cin >> a[i];
    int l = 1, r = 1e9;
    while (l < r) {
        int mid = l + (r - l) / 2;
        int cnt = 0;
        FOR(i, 1, n)
            cnt += (a[i] - 1) / mid;
        if (cnt <= k) r = mid;
        else l = mid + 1;
    }
    cout << l << endl;
}

Measured memory_bytes: 4744
fun main(args: Array<String>) { 
    readLine()!!.toInt()
    val sList = readLine()!!.split(" ").map { it.toInt() } as MutableList
    readLine()!!.toInt()
    val tList = readLine()!!.split(" ").map { it.toInt() }

    var total = 0
    for (number in tList) {
        if (linearSearch(number, sList)) total ++
    }
    println(total)
}

fun linearSearch(target: Int, list: MutableList<Int>) : Boolean {
    for (number in list)  {
        if (number == target) return true
    }
    return false
}



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

using namespace std;

const int md = 998244353;
const int N = 300010;

int add(int a, int b) {
  return (a += b - md) < 0 ? a + md : a;
}

int mul(int a, int b) {
  return (long long) a * b % md;
}

int inv(int a) {
  int b = md;
  int s = 1, t = 0;
  while (b) {
    int q = a / b;
    swap(a -= q * b, b);
    swap(s -= q * t, t);
  }
  return s < 0 ? s + md : s;
}

int c[N];

int main() {
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  c[0] = 1;
  for (int i = 1; i <= n; i++) {
    c[i] = mul(c[i - 1], mul(inv(i), n - i + 1));
  }
  int ans = 0;
  for (long long i = 0; i <= n; i++) {
    long long r = k - (long long) i * a;
    if (r < 0 || r % b != 0) {
      continue;
    }
    long long j = r / b;
    if (j <= n && j >= 0) {
      ans = add(ans, mul(c[i], c[j]));
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1408
def define_group(s)
  case s
  when 1, 3, 5, 7, 8, 10, 12 then
    'a'
  when 4, 6, 9, 11 then
    'b'
  else
    'c'
  end
end  

x, y = gets.chomp.split(' ').map(&:to_i)
x_g = define_group(x)
y_g = define_group(y)
puts x_g == y_g ? 'Yes':'No'

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
double x,ans;
int n;
typedef long long ll;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin >> n;
    for(int i = 0;i < n; ++i){
        cin >> x;
        x = 1.0 / x;
        ans += x;
    }
    cout << 1.0/ans ;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;


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

void solve(long long A, long long B, long long C, long long D){
    bool flag = true;
    while(flag) {
        C -= B;
        if(C <= 0) {
            cout << YES << endl;
            flag = false;
            break;
        }
        
        A -= D;
        if(A <= 0) {
            cout << NO << endl;
            flag = false;
            break;
        }
    }
    return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


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

const int MAX_K = 105;

int l[2 * MAX_K];

int main() {
	int k;
	scanf("%d", &k);

	for(int i = 0; i < 2 * k; i++) {
		scanf("%d", &l[i]);
	}

	sort(l, l + 2 * k);

	int ans = 0;
	for(int i = 2 * k - 2; i >= 0; i -= 2) {
		ans += l[i];
	}

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    while(N){
        if(N%10 == 7){
            cout << "Yes";
            return 0;
        }
        else N /= 10;
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int a,b,c;
    cin >> a >> b >> c;
    if( max({a,b,c}) == (a+b+c - max({a,b,c})))cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
//#define scanf scanf_s
typedef long long int lli;

// 入力XをCase i: Xの形式で出力
// X=0なら終了
int main()
{
	int iInputX;
	int iCnt = 1;
	scanf("%d", &iInputX);

	while (iInputX != 0)
	{
		printf("Case %d: %d\n", iCnt, iInputX);
		iCnt++;
		scanf("%d", &iInputX);
	}

	return 0;
}


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

using namespace std;
int main(){
  int n, min_a=1000000, max_a=0, a[100002]={0};
  cin >> n;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    a[x]++;
    if(x<min_a)min_a=x;
    if(max_a<x)max_a=x;
  }

  //cout << min_a << ":" << max_a << endl;
  int ans=0;
  for(int i=max(min_a,1);i<=100000;i++){
    int tmp_sum = a[i-1]+a[i]+a[i+1];
    //cout << i << ":" << tmp_sum << endl;
    if(tmp_sum > ans)ans = tmp_sum;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a-b==b-c) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 23892
#include <iostream>
using namespace std;
int main() {
	int N; string S; cin>>N>>S; 
	long long r=0, g=0, b=0;
	for (int i=0; i<N; i++) {
		if (S.at(i)=='R') r++;
		if (S.at(i)=='G') g++;
		if (S.at(i)=='B') b++;
	}
	long long ans=r*g*b;
	for (int i=0; i<N; i++) {
		for (int j=1; (i-j>=0 && i+j < N); j++) {
			if (S.at(i)!=S.at(i-j) && S.at(i)!=S.at(i+j) && S.at(i-j)!=S.at(i+j))
                ans--;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.InputStreamReader;

//public class Problem0006_ReverseSequence {
public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line;
			
			while((line = reader.readLine()) != null) {
				char[] sequence = line.toCharArray();
				if(sequence.length == 0) {
					break;
				}
				for(int i = sequence.length -1; i > -1; i--) {
					System.out.print(sequence[i]);
				}
				System.out.println();
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 9364
# -*- coding: utf-8 -*-
import numpy as np
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  plist=list(map(int,input().split()))
  newplist=sorted(plist)
#リストからｘの値を引いて絶対値をとったものをリスト化する
  p_list=[]
  for i in newplist:
    k=abs(i-x)
    p_list.append(k)
#最小値となるときのインデックスを探す
  ind=np.argmin(p_list)
  moto=newplist[ind]
  gap=0
  while True:
    gap+=1
    if (moto-gap) in newplist:
      pass
    else:
      print(moto-gap)
      break
    if (moto+gap) in newplist:
      pass
    else:
      print(moto+gap)
      break    

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	#define mp make_pair
	#define ll long long
	#define pb push_back
	#define mp make_pair
	#define M LONG_LONG_MAX
	#define IM INT_MAX
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int32_t main()
    {
		IOS;
		ll n,m,i,j,k;
      cin>>n;
      ll a[n];
      for(i=0;i<n;i++)
      cin>>a[i];
        sort(a,a+n);
        reverse(a,a+n);
        ll x=a[n/2];
        ll y=a[n/2-1];
        cout<<y-x;
	}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
  int res = 1;
  x = x % p;
  while (y > 0)
  {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
int lcm(int a, int b)
{
  return a / __gcd(a, b) * b;
}
int spf[1000001];
void sieve(int n)
{
  for (int i = 0; i <= n; i++)
  {
    spf[i] = i;
  }
  for (int i = 2; i * i <= n; i++)
  {
    if (spf[i] == i)
    {
      for (int j = i * i; j < n; j += i)
      {
        if (spf[j] == j)
        {
          spf[j] = i;
        }
      }
    }
  }
}
int mp[1000001];
void solve()
{
  sieve(1000000);
  int n;
  cin >> n;
  int a[n];
  int f = 1;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++)
  {
    int j = a[i];

    while (j != 1)
    {
      if (mp[spf[j]] == 1)
      {
        f = 0;
      }
      mp[spf[j]] = 1;
      int c = spf[j];
      while (j != 1 && j %c == 0)
      {
        j /= spf[j];
      }
    }
  }
  if (f)
  {
    cout << "pairwise coprime" << endl;
    return;
  }
  int g = a[0];
  for (int i = 1; i < n; i++)
  {
    g = __gcd(g, a[i]);
  }
  if (g == 1)
  {
    cout << "setwise coprime" << endl;
    return;
  }
  cout << "not coprime" << endl;
  return;
}
int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc;
  tc = 1;
  //cin >> tc;
  while (tc--)
  {
    solve();
  }

  return 0;
}


Measured memory_bytes: 26936
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
##############################

S = list(input().rstrip())
odd = S[::2]
even = S[1::2]

for c in odd:
    if c == 'R' or c == 'U' or c == 'D':
        pass
    else:
        print('No')
        exit()

for c in even:
    if c == 'L' or c == 'U' or c == 'D':
        pass
    else:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 3064
from bisect import bisect_left
import sys
s = input()
t = input()

d = {char:[] for char in 'abcdefghijklmnopqrstuvwxyz'}
for i in range(len(s)):
    d[s[i]].append(i)

cnt = 0
index = 0
for char in t:
    if not d[char]:
        print(-1)
        sys.exit()
    i = bisect_left(d[char], index)
    if i == len(d[char]):
        cnt += 1
        index = d[char][0]
    else:
        index = d[char][i]
    index += 1

ans = cnt * len(s) + index
print(ans)

Measured memory_bytes: 45808
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

bool sub(int k) {
  if (k >= 18) return true;
  vector<int> v = {4, 7, 8, 11, 12, 14, 15, 16};
  for(int c : v) {
    if (c == k) return true;
  }
  return false;
}

int main() {
  int n;
  cin >> n;
  cout << (sub(n) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(raw_input())
A = map(str, raw_input().split())
B = A[:]
for i in range(N):
    for j in range(N-1, i, -1):
        if int(A[j][1]) < int(A[j-1][1]):
            A[j], A[j-1] = A[j-1], A[j]
bubble = " ".join(A)
for i in range(N):
    minj = i
    for j in range(i, N):
        if int(B[j][1]) < int(B[minj][1]):
            minj = j
    B[i], B[minj] = B[minj], B[i]
select = " ".join(B)
print bubble
print "Stable"
print select
if bubble == select:
    print "Stable"
else:
    print "Not stable"

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

ll a[16][16];
ll score[1<<16];
ll dp[1<<16];

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      cin >> a[i][j];

  for (int i = 0; i < 1<<n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < j; k++)
	if ((i>>j&1) && (i>>k&1))
	  score[i] += a[j][k];

  for (int i = 0; i < 1<<n; i++) {
    for (int j = 0; j < i; j = (j|~i)+1&i) {
      dp[i] = max(dp[i], dp[j]+score[i^j]);
    }
  }
  cout << dp[(1<<n)-1] << endl;
}


Measured memory_bytes: 1280
# author:  Taichicchi
# created: 26.09.2020 14:35:45

import sys

N = int(input())

S = input()

ls_l = [0]
ls_r = [0]

for i in range(N):
    if S[i] == "#":
        ls_l.append(ls_l[-1] + 1)
    else:
        ls_l.append(ls_l[-1])

for i in range(N)[::-1]:
    if S[i] == ".":
        ls_r.append(ls_r[-1] + 1)
    else:
        ls_r.append(ls_r[-1])

ls_r.reverse()

# print(ls_l)
# print(ls_r)

ans = 10 ** 6

for i in range(N + 1):
    ans = min(ans, ls_l[i] + ls_r[i])

print(ans)


Measured memory_bytes: 18528
#!/usr/bin/env python3
#ABC80 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
f = [LI() for _ in range(n)]
p = [LI() for _ in range(n)]
ans = -inf
for i in range(1,2**10):
    b = [0]*10
    for j in range(10):
        if (i >> j) & 1:
            b[j] = 1
    tmp = 0
    for i in range(n):
        cnt = 0
        for j in range(10):
            if b[j] == 1 and f[i][j] == 1:
                cnt += 1
        tmp += p[i][cnt]
    ans = max(ans,tmp)
print(ans)


Measured memory_bytes: 42988
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

int main() {
    int K, X;
    cin>>K>>X;
    if(500*K >= X){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import bisect

s = input()
t = input()
n = len(s)
s0 = {}
for i in range(n):
    s0.setdefault(s[i], [])
    s0[s[i]].append(i)
num1 = 0
num2 = -1
flag = True
for i in t:
    if i not in s:
        flag = False
        break
    num = bisect.bisect_right(s0[i], num2)
    if num == len(s0[i]):
        num1 += 1
        num2 = s0[i][0]
    else:
        num2 = s0[i][num]
if flag == True:
    print(num1 * n + num2 + 1)
else:
    print(-1)

Measured memory_bytes: 13460
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int arr[100];
    for (int i = 0; i < n; i++)
        arr[i] = i+1;
    do {
        for (int i = 0; i < n; i++) {
            if (i == n - 1)
                cout << arr[i] << endl;
            else cout << arr[i] << " ";
        }
    } while (next_permutation(arr, arr + n));
}


Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int result = 0;
		for(int i=1;i<x+1;i++){
			result += 800;
			if(i % 15 == 0){
				result -= 200;
			}
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 22740
#include<stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void){
 int n,i,k=1;/*,j;*/
    scanf("%d",&n);
    char s[n][11];/*,tmp[20];*/
    for(i=0; i<n; i++){
        scanf("%s",s[i]);
    }
    qsort(s,n,11,strcmp);
    /*for(i=1;i<n;i++){
    for(j=1;j<n;j++){
      if(strcmp(s[j-1],s[j])>0){
        strcpy(tmp,s[j-1]);
        strcpy(s[j-1],s[j]);
        strcpy(s[j], tmp);
      }
    }
  }*/
   for(i=0; i<n-1; i++){
        if(strcmp(s[i],s[i+1])!=0)k++;
    }
    printf("%d",k);
return 0;
}

Measured memory_bytes: 5720
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <unordered_set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
int a,b;
ll c;
ll d[1001][1001];
int main(){
    scanf("%d %d",&n,&m);
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(i==j)continue;
            d[i][j]= 1e18;
        }
    }
    rep(i,m){
        scanf("%d %d %lld",&a,&b,&c);
        d[a][b] = -c;
    }
    for(int k = 1; k <= n; k++){
        for(int i = 1; i <= n ; i++){
            for(int j = 1; j<= n; j++){
                d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    if(d[n][n]<0){
        printf("inf\n");
        return 0;
    }

    printf("%lld\n",-d[1][n]);
}

Measured memory_bytes: 8064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
int a[200010];
int main()
{
	int n,m,p;
	long long ans;
	
	scanf("%d",&n);
	
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&p);
		p=p-i;
		a[i]=p;
	}
	
	sort(a+1,a+1+n);
	m=a[(n+1)/2];
	
	ans=0;
	for (int i=1;i<=n;i++)
	{
		if ((a[i]-m)>0) ans=ans+a[i]-m;
		else ans=ans-a[i]+m;
	}
	
	printf("%lld",ans);
	
	return 0;
}


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

if a.count(0)==n:
  print('Yes')
  exit()

if n%3!=0:
  print('No')
  exit()


x=list(set(a))

z=[]

if len(x)>3:
  print('No')
  exit()

for i in x:
  if a.count(i)==n//3:
    z+=[i]
  
  elif a.count(i)==(n//3)*2:
    z+=[i]
    z+=[i]

  elif a.count(i)==n:
    z+=[i]
    z+=[i]
    z+=[i]

  else:
    print('No')
    exit()


ans=0

for i in z:
  ans^=i

if ans==0:
  print('Yes')

else:
  print('No')


Measured memory_bytes: 94012