akhauriyash/Code-Regression huggingface dataset:
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    int a, b;
    std::cin >> a >> b;
    rep(i, 100000) {
        if(i * 8 / 100 == a and i * 10 / 100 == b) {
            std::cout << i << std::endl;
            return;
        }
    }
    std::cout << -1 << std::endl;
    return;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
class dsu
{
	public:
	vector<int> p;
	int n;
	dsu(int _n):n( _n)
	{
		p.resize(n);
		iota(p.begin(),p.end(),0);
	}
	inline int get(int x)
	{
		return (x==p[x]?x:(p[x]=get(p[x])));
	}
	inline bool unite(int x,int y)
	{
		x=get(x);
		y=get(y);
		if(x!=y)
		{
			p[x]=y;
			return true;
		}
		return false;
	}
};
int main()
{
	int n,m;
	cin>>n>>m;
	vector<int> a(n);
	for (int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	dsu d(n);
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		d.unite(x,y);
	}
	vector< vector<int> > comp(n);
	for(int i=0;i<n;i++)
	{
		comp[d.get(i)].push_back(a[i]);
	}
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(!comp[i].empty())
		{
			cnt++;
		}
	}
	if(cnt==1)
	{
		cout<<"0";
		return 0;
	}
	int choose=2*cnt-2;
	long long ans=0;
	vector<int> other;
	for(int i=0;i<n;i++)
	if(!comp[i].empty()) 
	{
		sort(comp[i].begin(),comp[i].end());
		ans+=comp[i][0];
		choose--;
		for(int j=1;j<(int) comp[i].size();j++)
		{
			other.push_back(comp[i][j]);
		}
	}
	if(choose>(int) other.size())
	{
		puts("Impossible");
		return 0;
	}
	sort(other.begin(),other.end());
	for(int i=0;i<choose;i++)
	{
		ans+=other[i];
	} 
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
ll A,B;
  cin>>A>>B;
  ll ans=1;
  for(ll i=2;i<=sqrt(min(A,B));i++) {
if(A%i==0&&B%i==0) {
ans++;
}
    if(A%i==0) {
while(A%i==0) {
A/=i;
}
    }
    
    if(B%i==0) {
while(B%i==0) {
B/=i;
}
    }
  }
  
  
  if(A>1&&B>1) {
if(A%B==0||B%A==0) {
ans++;
}
  }
  
  
  cout<<ans<<endl;
}
  
  
  
  
  
  
  
  
  
  
  
  

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
 
int main() {
    int a[10];
    while(~scanf("%1d", &a[0])) {
        rep(i,1,10) scanf("%1d", &a[i]);
        repr(i,9,1) {
            rep(j,0,i) {
                a[j] = (a[j] + a[j+1]) % 10;
            }
        }
        cout << a[0] << endl;
    }
    return 0;
}

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

int main() {
    ll N,K;
    cin >> N >>K;
    string S;
    cin >> S;
    vector<P> position0;
    for(int i=0;i<N;i++){
        int t= S[i]-'0';
        if(t==0){
            ll s = i;
            while(i<N-1 &&S[i+1]-'0' ==0){
                i++;
            }
            position0.push_back(P(s,i));
        }
    }
    if(position0.size()<=K){
        cout << N <<endl;
        return 0;
    }
    ll ans =0;
    for(int i=0;i<position0.size()-K+1;i++){
        ll temp =0;
        if(i == 0){
            temp = position0[i+K].first;
        }else if( i==position0.size()-K){
            temp = (N-1-position0[i-1].second);
        }
        else{
            temp = (position0[i+K].first - position0[i-1].second-1);
        }
        // cerr << "temp=" << temp<<", i="<<i <<endl;

        ans = max(ans,temp);

    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1528
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i, j, k;
        for(i = 0; ; i++) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 || W == 0) break;
            for(j = 0; j < H; j++) {
                for(k = 0; k < W; k++) {
                    System.out.print("#");
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 35060
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}
ll s[10];
int main()
{
    ll i,j,k;
    for(i = 0;i < 3;i++)
        sl(s[i]);
    sort(s,s+3);
    printf("%lld\n",s[0]*s[1]/2);
    return 0;
}

Measured memory_bytes: 256
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()
# i を選んで ai と ai+1の符号を入れ替える は
# x, y (x < y) を選んでax と ay の符号を入れ替える ことと同値(y - x 回 上の操作を行えばそうなる事がわかる)
cnt = [0, 0, 0]  # 正, 負, 0 の個数
for i in a:
    if i < 0:
        cnt[1] += 1
    elif i > 0:
        cnt[0] += 1
    else:
        cnt[2] += 1
if cnt[1] % 2 == 0 or cnt[2] > 0:
    ans = 0
    for i in a:
        ans += abs(i)
else:
    # 絶対値が最小の要素だけ負にする
    ans = 0
    for i in a:
        ans += abs(i)
    ans += -2 * min(abs(i) for i in a)
print(ans)


Measured memory_bytes: 20448
#ifdef FAIRLY_LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <vector>
using namespace std;

int main() {
#ifdef FAIRLY_LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n, k;

    cin >> n >> k;
    int cnt = 0;
    while (n) {
        n /= k;
        ++cnt;
    }

    cout << cnt << '\n';
    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
using Graph = vector<vector<int>>;
queue<int> quex,quey;
const int MOD = 1000000007;




int main(){
    int A,B,M;  cin >> A >> B >> M;
    vector<int> a(A),b(B),x(M),y(M),c(M);

    for(int i=0;i<A;i++)    cin >> a.at(i);
    for(int i=0;i<B;i++)    cin >> b.at(i);

    rep(i,M)    cin >> x[i] >> y[i] >> c[i];

    int min;
    min=INF;

    for(int i=0;i<M;i++){
        int tmp;
        tmp=a.at(x.at(i)-1)+b.at(y.at(i)-1)-c.at(i);
        if(min>tmp) min=tmp;
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int tmp;
    tmp=a.at(0)+b.at(0);
    if(min>tmp) min=tmp;


cout << min << endl;
}

Measured memory_bytes: 2176
dxys = [(-1,0), (1,0), (0,-1), (0,1)]

H, W = map(int, input().split())
Sss = ['#'*(W+2)] + ['#'+input()+'#' for _ in range(H)] + ['#'*(W+2)]

N = H*W
adjL = [[] for _ in range(N)]
for x in range(1, H+1):
    for y in range(1, W+1):
        if Sss[x][y] != '.': continue
        for dx, dy in dxys:
            x2, y2 = x+dx, y+dy
            if Sss[x2][y2] != '.': continue
            z = (x-1)*W + y-1
            z2 = (x2-1)*W + y2-1
            adjL[z].append(z2)

# 重みなしグラフの直径を求める
def getDiameterOfUnweightedGraph(adjList):
    numV = len(adjList)
    def bfs(vSt):
        costs = [-1] * numV
        costs[vSt] = cost = 0
        vs = [vSt]
        while vs:
            cost += 1
            v2s = []
            for v in vs:
                for v2 in adjList[v]:
                    if costs[v2] == -1:
                        costs[v2] = cost
                        v2s.append(v2)
            vs = v2s
        return cost - 1
    return max([bfs(vSt) for vSt in range(numV)])

maxDist = getDiameterOfUnweightedGraph(adjL)
print(maxDist)


Measured memory_bytes: 40688
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
int main()
{   int a,b,x,y,i,j,n,m,k;
    scanf("%d%d",&n,&k);
    if(n>=2*k||(n%2==1&&n+1>=2*k)){
    printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>

#define   WEATHER_SIZE	3
#define	  WEATHER_STR_LEN  8
void main(void)
{
  int i = 0;
  char weather[WEATHER_SIZE][WEATHER_STR_LEN] = {"Sunny", "Cloudy", "Rainy"};
  char input[16] = {'\0'};
  
  scanf("%s", &input);
  
  for(i=0; i<WEATHER_SIZE; i++)
  {
    if (strcmp(input, weather[i]) == 0)
    {
      printf("%s", weather[(i+1)%WEATHER_SIZE]);
      break;
    }
  }
  if (i==WEATHER_SIZE)
  {
    printf("unknown");
  }
  
  return;
}


Measured memory_bytes: 128
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for a_tmp in range(a+1):
    for b_tmp in range(b+1):
        for c_tmp in range(c+1):
            total = 500*a_tmp + 100*b_tmp + 50*c_tmp
            if total == x:
                count += 1
print(count)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    private static int minDistance = Integer.MAX_VALUE;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        for (int i = 0; i <= n - k; i++) {
            checkMinDistance(array[i], array[i + k - 1]);
        }
        if(minDistance == Integer.MAX_VALUE) minDistance = 0;
        System.out.println(minDistance);
    }
    private static void checkMinDistance(int min, int max) {
        if(max < 0) {
            minDistance = Math.min(minDistance, -min);
        } else if(min >= 0) {
            minDistance = Math.min(minDistance, max);
        } else {
            minDistance = Math.min(minDistance, -min + Math.abs(min - max));
            minDistance = Math.min(minDistance, max + Math.abs(max - min));
        }
    }
}

Measured memory_bytes: 50184
#include<stdio.h>

int main(void){
    int tmp=0;
    char tmp_c;
    while(1){
        scanf("%c", &tmp_c);
        if(tmp_c=='\n'){
            printf("%d\n", tmp);
            tmp = 0;
            scanf("%c", &tmp_c);
            if(tmp_c=='0') break;
        }
        tmp += tmp_c - '0';
    }
    return 0;
}


Measured memory_bytes: 2076
#include<bits/stdc++.h>
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vpii         vector<pair<int,int>>
#define gph          map<int, vector<int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define FORS(i, n) for(; i < (int)(n); i++)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define printArr(A,n) { cout << #A << " = "; FOR(i,n) cout << A[i] << ' '; cout << endl; }
using namespace std;
#define int long long int
#define double long double
vector<pair<char, pair<double, double>>> pts;
double f(double move){
    double xMax, xMin, yMax, yMin;
    xMax = yMax = INT_MIN;
    xMin = yMin = INT_MAX;
    for(auto p: pts){
        if(p.first == 'U')p.second.second += move;
        else if(p.first == 'D')p.second.second -= move;
        else if(p.first == 'L')p.second.first -= move;
        else if(p.first == 'R')p.second.first += move;
        xMax = max(xMax, p.second.first);
        xMin = min(xMin, p.second.first);
        yMax = max(yMax, p.second.second);
        yMin = min(yMin, p.second.second);
    }
//    cout << move << " " << (yMax - yMin)*(xMax - xMin) <<endl;
    return (yMax - yMin)*(xMax - xMin);
}
double ternary_search(double l, double r) {
    int iter = 0;
    double eps = 1e-14;              //set the error limit here
    while (r - l > eps) {
        double m1 = l + (r - l) / 3;
        double m2 = r - (r - l) / 3;
        double f1 = f(m1);      //evaluates the function at m1
        double f2 = f(m2);      //evaluates the function at m2
        if (f1 > f2)
            l = m1;
        else
            r = m2;
        iter++;
//        debug(iter);
        if(iter == 200)break;
    }
    return min(f(r), f(r));                    //return the maximum of f(x) in [l, r]
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    int n;cin >> n;
    pts.resize(n);
    FOR(i, n){
        cin >> pts[i].second.first >> pts[i].second.second >> pts[i].first;
    }
    double ans = ternary_search(0, 1e9);
    printf("%0.20Lf\n", ans);
//    cout << setprecision(20) << ternary_search(0, 1e9) <<endl;
}




Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  long long A, B, C, K;
  cin >> A >> B >> C >> K;

  long long ret = min(A, K);
  K -= ret;
  K -= min(B, K);
  ret += - 1 * min(C, K);

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 	
 	int n; cin >> n;
 	long double ans = 1;

 	bool ok = true;

 	FOR(i, n){
 		ll x; cin >> x;
 		if(ok)
 			ans *= x;
 		if(ans > 1000000000000000000){
 			ok = false;
 		}
 		if(x == 0){
 			cout << "0\n";
 			return 0;
 		}
 	}

 	if(!ok){
 		cout << "-1\n";
 		return 0;
 	}

 	cout << setprecision(0) << fixed << ans << '\n';

	return 0;
}

Measured memory_bytes: 3804
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef long double ld;



int main() {
    string S;
    cin >> S;
    ll N = S.size();
    ll answer = 0;
    ll temp = 0;
    for (ll i=N-1;i>=0;i--){
        if (S[i] == 'B'){
            answer += N-1-i-temp;
            temp++;
        }
    }
    
    cout << answer << endl;
    
   
    return 0;
}


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

int main(){
  string s;
  cin>>s;
  char c[10];
  int a=0;
  int cnt=0;
  for(int i=s.size()-1;i>=0;i--){
    if(s[i]!='B'&&cnt==0){
      c[a]=s[i];
      a++;
    }else if(s[i]=='B') cnt++;
    else cnt--;
  }
  for(int i=0;i<a;i++) cout<<c[a-i-1];
  cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <queue>
#include <unordered_map>
#include <string.h>

using namespace std;

const int maxn=2e5, maxm=20;

bool bio[maxn];
int n;


vector < int > rek(int m, int a, int b, vector < bool > fiksirano){
	vector < int > l;
/*	cout << a << " " << b << endl;
	for(int i=0; i<n; i++){
		cout << fiksirano[i] << " ";
	}
	cout << endl;*/
	if(m==2){
		l.push_back(a);
		l.push_back(b);
		return l;
	}
	vector < int > v1, v2;
	int c, d;
	int ind;
	for(int i=0; i<n; i++){
//		cout << ((1<<i)&a) << " " << ((1<<i)&b) << endl;
		if(((1<<i)&a)!=((1<<i)&b) && !fiksirano[i]){
//			cout << "ok " << i << endl;
			fiksirano[i]=1;
			ind=i;
			break;
		}
	}
	bool p;
	int br;
	for(int i=0; i<n; i++){
		if(!fiksirano[i]){
			c=a^(1<<i);
			d=c^(1<<ind);
			break;
		}
	}
//	cout << c << " " << d << endl;
	v1=rek(m/2, a, c, fiksirano);
	v2=rek(m/2, d, b, fiksirano);
	for(int i=0; i<v2.size(); i++){
		v1.push_back(v2[i]);
	}
	return v1;
}
//5 26 24

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	int a, b;
	cin >> a >> b;
	int br=0;
	for(int i=0; i<n; i++){
		if((a&(1<<i))!=(b&(1<<i))){
			br++;
		}
	}
	if(br%2==0){
		cout << "NO\n";
		return 0;
	}
	vector < bool > x(maxm, 0);
	cout << "YES\n";
	vector < int >  s=rek((1<<n), a, b, x);
//	cout << s.size() << endl;
	for(int i=0; i<(1<<n); i++){
		cout << s[i] << " ";
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 1648
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int md=1000000007;
struct node
{
	int a[4][4];
}g,h;
int n,m,i,j,lst;
void Mult(node &a,node &b)
{
	node c;
	for(int i=0;i<4;++i)
		for(int j=0;j<4;++j)
			c.a[i][j]=0;
	for(int i=0;i<4;++i)
		for(int j=0;j<4;++j)
			for(int k=0;k<4;++k)
				c.a[i][j]=(c.a[i][j]+1ll*a.a[i][k]*b.a[k][j])%md;
	for(int i=0;i<4;++i)
		for(int j=0;j<4;++j)
			a.a[i][j]=c.a[i][j];
}
int main()
{
	scanf("%d%d",&n,&m);
	h.a[0][0]=h.a[0][1]=h.a[0][2]=h.a[0][3]=1;
	lst=1;
	while(m--)
	{
		scanf("%d",&i);
		j=i-lst;
		g.a[0][0]=g.a[0][1]=g.a[0][2]=g.a[0][3]=g.a[1][1]=g.a[1][3]=g.a[2][2]=g.a[2][3]=g.a[3][0]=g.a[3][1]=g.a[3][2]=1;
		g.a[1][0]=g.a[1][2]=g.a[2][0]=g.a[2][1]=0;
		g.a[3][3]=2;
		while(j)
		{
			if(j&1)
				Mult(h,g);
			Mult(g,g);
			j>>=1;
		}
		h.a[0][3]=(1ll*h.a[0][0]+h.a[0][1]+h.a[0][2]+h.a[0][3])%md;
		h.a[0][1]=(h.a[0][1]+h.a[0][0])%md,h.a[0][2]=(h.a[0][2]+h.a[0][0])%md;
		h.a[0][0]=h.a[0][0];
		lst=i+1;
	}
	j=n-lst;
	g.a[0][0]=g.a[0][1]=g.a[0][2]=g.a[0][3]=g.a[1][1]=g.a[1][3]=g.a[2][2]=g.a[2][3]=g.a[3][0]=g.a[3][1]=g.a[3][2]=1;
	g.a[1][0]=g.a[1][2]=g.a[2][0]=g.a[2][1]=0;
	g.a[3][3]=2;
	while(j)
	{
		if(j&1)
			Mult(h,g);
		Mult(g,g);
		j>>=1;
	}
	printf("%d",h.a[0][3]);
	return 0;
}


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

int main() {
    long long int n;
    cin >> n;
    int a = 1;
    for (int i=1; i<=sqrt(n); i++) {
        if (n % i == 0) a = max(a, i);
    }
    
    int b = n / a;
    int ans = 0;
    int x = max(a, b);
    while(x > 0) {
        ans++;
        x/=10;
        }
   cout << ans << endl; 
    
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (C >= A && C <= B ) {
    cout << "Yes" << endl;
  }

  if (!( C >= A && C <= B )) {
    cout << "No" << endl;
  }

}


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

int main(){
	int n;	cin>>n;
	vector<int> A(n);	for(int i=0;i<n;i++)cin>>A[i];
	sort(A.begin(), A.end());
	for(int i=0;i+1<n;i++){
		if(A[i]==A[i+1]){
			cout<<"NO"<<endl;
			return 0;
		}
	}


	cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>

#define repd(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
	int a;
	cin >> a;
	return a;
}

void inputArray(int *p,int a){
	rep(i,a){
		cin >> p[i];
	}
}

void inputVector(vector<int> *p,int a){
	rep(i,a){
		int input;
		cin >> input;
		p -> push_back(input);
	}
}

template <typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int main(){
	//source
	int n,t;
	cin >> n >> t ;
	int inf=pow(10,9);
	int c_min,t_min;
	c_min=inf;
	t_min=inf;
	rep(i,n){
		int c_temp,t_temp;
		cin>>c_temp>>t_temp;

		if(t_temp<=t){
			if(c_temp<c_min){
				c_min=c_temp;
				t_min=t_temp;
			}
		}
	}
	if(c_min!=inf){
		cout<<c_min<<endl;
	}else{
		cout<<"TLE" << endl;
	}
	return 0;
}


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

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 1e9+7;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

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

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;
const int MAX_N = 10010;


int main() {
    int n;
    cin >> n;
    vl A(n);
    ll ans = 1;
    REP(i, n) {
        cin >> A[i];
        if (A[i] == 0) ans = 0;
    }
    if (ans == 0) cout << 0 << endl;
    else {
        REP(i, n) {
            if (ans*A[i] < ans || ans*A[i] > 1000000000000000000) {
                ans = -1;
                break;
            } else {
                ans *= A[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3996
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)
#define fi first
#define se second

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

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

vector<int>v;
class DHandstand {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, k;
        cin >> n >> k;
        string s;
        cin >> s;
        v.clear();
        int now = 1;
        int time = 0;
        for(int i = 0; i < n; ++i){
            if(now + '0' == s[i])time++;
            else {
                v.push_back(time);
                now = 1 - now;
                time = 1;
            }
        }
        if(time)v.push_back(time);
        // for(int i = 0; i < v.size(); ++i)cout << v[i] << " ";
        // cout << endl;
        int len = 2*k + 1;
        int res = 0;
        bool flag = s[0] == '1' ? 1 : 0; // if first element is 0, flag is true
        for(int i = 0; i < v.size(); i+=2){
            int tmp = 0;
            int r = i + len;
            for(int j = i; j < v.size() && j < r; ++j){
                tmp += v[j];
            }
            res = max(res, tmp);
        }
        out << res << '\n';
    }
};



int main() {
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    DHandstand solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, a[N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
			scanf("%d",&n);
		for(int i = 1; i <= n; i++){
			scanf("%d",a + i);
			a[i] -= i;
		}
		sort(a + 1, a + n + 1);
		long long med = a[(n + 1)/2], ans = 0;;
		for(int i = 1; i <= n; i++)
			ans += abs(1ll*a[i] - med);
		printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  return 0;
}

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;

const int MAX_N = 200000;
int par[MAX_N];
int rnk[MAX_N];
int siz[MAX_N];

void init(int n) {
    rep(i,n) {
        par[i] = i;
        rnk[i] = 0;
        siz[i] = 1;
    }
}

int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    int s = siz[x] + siz[y];
    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
    siz[find(x)] = s;
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int size(int x) {
    return siz[find(x)];
}

int main() {
    int N, M, K, L;
    cin >> N >> M;
    init(N + M);
    rep(i, N) {
        cin >> K;
        rep(j, K) {
            cin >> L;
            unite(i, N + L - 1);
        }
    }
    rep(i, N) {
        if (!same(0, i)) {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
}

Measured memory_bytes: 2560
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::collections::VecDeque;

fn main() {
    let nda: Vec<u64> = read_vec();
    let n = nda[0] as usize;
    let d = nda[1];
    let a = nda[2];
    let mut xhv: Vec<Vec<u64>> = read_vec2(n);
    xhv.sort_by(|a, b| a[0].partial_cmp(&b[0]).unwrap());

    let mut ans = 0;
    let mut damage = 0;
    let mut vd: VecDeque<(u64, u64)> = VecDeque::new();

    for i in 0..n {
        while !vd.is_empty() {
            if vd[0].0 < xhv[i][0] {
                damage -= vd[0].1;
                vd.pop_front();
            } else {
                break;
            }
        }

        if xhv[i][1] <= damage {
            continue;
        }

        let cnt = (xhv[i][1] - damage - 1) / a + 1;

        ans += cnt;
        damage += a * cnt;

        vd.push_back((xhv[i][0] + 2 * d, a * cnt));
    }

    println!("{}", ans);
}


Measured memory_bytes: 16636
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = 998244353;

long long k, n, dat[5000], inv[5000];
vector<long long> ans;

long long quickpow(long long b, long long e)
{
	return e ? ((e & 1 ? b : 1)*quickpow((b*b) % MOD, e >> 1)) % MOD : 1;
}

long long combi(int a, int b)
{
	if (a < 0 || b < 0 || a < b) return 0;
	long long retval = dat[a];
	retval = retval * inv[a - b];
	retval %= MOD;
	retval = retval * inv[b];
	retval %= MOD;
	return retval;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> k >> n;
	dat[0] = 1;
	for (int i = 1; i < n + k; i++) {
		dat[i] = dat[i - 1] * i;
		dat[i] %= MOD;
	}
	for (int i = 0; i < n + k; i++) {
		inv[i] = quickpow(dat[i], MOD - 2);
	}
	for (int i = 2; i <= k + k; i++) {
		int tmp = 0;
		for (int j = 1; j <= k; j++) {
			if (i - j <= j) break;
			if (i - j <= k)
				tmp++;
		}
		long long cur, tt;
		if (i % 2 == 0) {
			cur = 0;
			for (int i = 0; i <= tmp; i++) {
				tt = combi(n + k - 2 - tmp - (tmp - i) - i, k - 2 - tmp - (tmp - i));
				tt = tt * combi(tmp, i);
				tt %= MOD;
				cur += tt * quickpow(2, i);
				cur %= MOD;
			}
			for (int i = 0; i <= tmp; i++) {
				tt = combi(n + k - 3 - tmp - (tmp - i) - i, k - 2 - tmp - (tmp - i));
				tt = tt * combi(tmp, i);
				tt %= MOD;
				cur += tt * quickpow(2, i);
				cur %= MOD;
			}
			ans.pb(cur);
		}
		else {
			cur = 0;
			for (int i = 0; i <= tmp; i++) {
				tt = combi(n + k - 1 - tmp - (tmp - i) - i, k - 1 - tmp - (tmp - i));
				tt = tt * combi(tmp, i);
				tt %= MOD;
				cur += tt * quickpow(2, i);
				cur %= MOD;
			}
			ans.pb(cur);
		}
	}
	for (int i = 0; i < (int)ans.size(); i++) {
		cout << ans[i] << E;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 384
H,N = map(int,input().split())
Alist = []
Blist = []
for _ in range(N):
    A,B = map(int,input().split())
    Alist.append(A)
    Blist.append(B)

dp = [float('inf')]*(H+1)
dp[0] = 0
for h in range(H+1):
    for n in range(N):
        damage = Alist[n]
        cost = Blist[n]
        first_index = min(h + damage, H)
        dp[first_index] = min(dp[h] + cost, dp[first_index])
        
print(dp[-1])

Measured memory_bytes: 45676
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;

#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif

int main(){

        double r;

        scanf("%lf\n",&r);

        printf("%f %f\n",r*r*M_PI,2*r*M_PI);

        return 0;
}


Measured memory_bytes: 3212
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		//????????£????????????
		Scanner sc = new Scanner(System.in);
		//??????????????°?????????
		int n = sc.nextInt();
		//???????????£?¨?
		int [] list = new int[n];
		//n ?????°???????´???????
		for(int i =0; i < n; i++){
			list [i] = sc.nextInt();
			//System.out.print(list[i] + " ");
		}
		//??????????????????????????????
		for(int i = n-1 ; i >= 0; i--){
			//??°???????????????0????????§????????? 0????????????
			if( i > 0){
				//???????????¨???
				System.out.print(list[i] + " ");
			}else{
				//??????????????????
				System.out.print(list[i]);
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 26292
import bisect
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = factorization(n) 
t = [1]
ans = 0
if N == [[1,1]]:
  print(ans)
else:
  for i in range(2,10**5):
    t.append(t[i-2]+i)
  for j in range(len(N)):
    s = bisect.bisect_right(t, N[j][1])
    ans += s
  print(ans)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;
const llint INF = 1e9;
const llint llINF = 1e18;

int main () {
    int y, m, d;
    char a, b;
    cin >> y >> a >> m >> b >> d;
    cout << (m <= 4 ? "Heisei" : "TBD") << endl;
    return 0;
}

Measured memory_bytes: 256
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P) :
 P = sorted(P)
 phU = []
 phU.append(P[0])
 phU.append(P[1])
 for p in P[2:] :
  phU.append(p)
  if isCLKWISE(phU) : continue
  while(True) :
   del phU[-2]
   try :
    if isCLKWISE(phU) : break
   except IndexError : break
 phL = []
 phL.append(P[-1])
 phL.append(P[-2])
 for p in P[-3::-1] :
  phL.append(p)
  if isCLKWISE(phL) : continue
  while(True) :
   del phL[-2]
   try:
    if isCLKWISE(phL) : break
   except IndexError : break
 del phL[0]
 del phL[-1]
 ph = phU + phL
 return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33196
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
#define repr(i, N) for(int i=N-1; i>=0; --i)
#define all(v) v.begin(),v.end() 
using namespace std;
//using pr = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言
//int myfunc(int, vvec);

//グローバル変数
//int N, M;
//vvec data(N, vec(M));

//関数：
int gcd(int mx, int mn) {
	if(mn == 0) return(mx);
	else gcd(mn, mx%mn);
}

bool has_divisor(int n, int i) {
	//base case 1:
	if (i == n) return false;
	//base case 2:
	if (n % i == 0) return true;
	return has_divisor(n, i+1);
}

bool is_prime(int n) {
	if (n == 1) return false;
	else if (n == 2) return true;
	else {
		return !has_divisor(n, 2);
	}
}

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

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

	if(A <= 9 && B <= 9) cout << A*B << endl;
	else cout << -1 << endl;

	return 0;
}
//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);
//int ans = (char)grid - '0';

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var ans = Math.Ceiling(ab.Sum()/2.0);

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,o,result=0;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
    o=i+1;
    if(a.at(i)%2!=0&&o%2!=0){
    	result++;
    }
  }
  cout<<result<<endl;
}

Measured memory_bytes: 3576
#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() {
    ll n; cin >> n;
    string s;
    do {
        n--;
        s.push_back('a'+(n%26));
        n /= 26;
    }while(n > 0);
    reverse(s.begin(), s.end());
    cout << s << endl;
}


Measured memory_bytes: 3584
#include <cmath>
#include <cstdint>
#include <exception>
#include <iostream>
#include <stdexcept>
#include <vector>

class ModComb {
public:
  /**
   * \param p prime number
   * \param k max number for table
   */
  ModComb(uint64_t p, uint64_t k);

  uint64_t factorial(uint64_t n) const;
  uint64_t inverse(uint64_t n) const;
  uint64_t factorial_inverse(uint64_t n) const;

  uint64_t combination(uint64_t n, uint64_t k) const;

private:
  const uint64_t p_, k_;
  // table for n!
  std::vector<uint64_t> factorial_;
  // table for n^(-1)
  std::vector<uint64_t> inverse_;
  // table for (n!)^(-1)
  std::vector<uint64_t> factorial_inverse_;
};

ModComb::ModComb(uint64_t p, uint64_t k)
    : p_(p), k_(k)
{
  if(p < k) {
    throw std::runtime_error("p < k (must k <= p");
  }

  factorial_.resize(k_ + 1);
  inverse_.resize(k_ + 1);
  factorial_inverse_.resize(k_ + 1);

  factorial_[0] = factorial_[1] = 1;
  inverse_[0] = inverse_[1] = 1;
  factorial_inverse_[0] = factorial_inverse_[1] = 1;
  for(uint64_t i=2; i<=k_; i++) {
    factorial_[i] = (i * factorial_[i-1]) % p_;
    int64_t a = - (p_/i) * inverse_[p_ % i];
    while(a<0) {
      a += p_;
    }
    inverse_[i] = a % p_;
    factorial_inverse_[i] = (inverse_[i] * factorial_inverse_[i-1]) % p_;
  }
}

uint64_t ModComb::factorial(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("too large n (must n <= k)");
  }
  return factorial_[n];
}

uint64_t ModComb::inverse(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("too large n (must n <= k)");
  }
  return inverse_[n];
}

uint64_t ModComb::factorial_inverse(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("too large n (must n <= k)");
  }
  return factorial_inverse_[n];
}

uint64_t ModComb::combination(uint64_t n, uint64_t k) const
{
  if(n < k) {
    throw std::runtime_error("error: n < k (must k < n)");
  }
  if(k_ < n) {
    throw std::runtime_error("too large n (must n < p_)");
  }

  return (((factorial_[n] * factorial_inverse_[n-k]) % p_) * factorial_inverse_[k]) % p_;
}

int main()
{
  int64_t H, W, A, B;

  std::cin >> H >> W >> A >> B;

  int64_t n_loop = std::min(H - A, W - B);
  constexpr uint64_t mod = std::pow(10, 9) + 7;

  ModComb mc(mod, std::max(H-A+B-1, W+A-B-1));

  uint64_t sum = 0;
  for(int64_t i = 1; i <= n_loop; i++) {
    auto frm = mc.combination(H-A+B-1, H - A - i);
    auto to = mc.combination(W+A-B-1, W-B-i);

    sum += (frm * to) % mod;
  }
  sum %= mod;

  std::cout << std::fixed << sum << std::endl;

  return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s1,s2;
    cin>>s1;
    cin>>s2;
    reverse(s1.begin(), s1.end()); 
    if(s1.compare(s2)==0)
	cout<<"YES";
    else
	cout<<"NO";

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<pair<int,int>> A(N);
    rep(i,N) cin >> A[i].second >> A[i].first;
    sort(A.begin(), A.end());
    rep(i,N) swap(A[i].first, A[i].second);
    ll sum =0;
    rep(i,N){
        sum += A[i].first;
        if(A[i].second < sum){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
#include <tuple>

using namespace std;

typedef vector<vector<char> > Field;
typedef vector<vector<bool> > LocationMap;
typedef pair<int, int> Location;
typedef pair<Location, int> LocationLevel;
typedef queue<LocationLevel> LocationQueue;

inline int solve(int h, int w, Field &field, LocationQueue &que, LocationMap& visited) {
  /*
  cout << h << " " <<  w << " " << endl;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << field[i][j];
    }
    cout << endl;
  }
  */
  LocationLevel loc_lev;
  Location loc;
  Location nloc;
  int i, j, level;
  int max_level = 0;
  int dx[4] = {-1, 1, 0, 0};
  int dy[4] = { 0, 0, 1,-1};

  while(que.size()){
    loc_lev = que.front(); que.pop();
    loc = loc_lev.first;
    level = loc_lev.second;

    for(int n = 0; n < 4; n++){
        i = loc.first  + dx[n];
        j = loc.second + dy[n];

        if (i >= 0 && i <= h - 1 && j >= 0 && j <= w -1 && !visited[i][j] && (field[i][j] == '.')) {
          nloc = make_pair(i,j);
          field[i][j] = '#';
          visited[i][j] = true;
          que.push(make_pair(nloc, level + 1));
          if( level + 1 > max_level ){ max_level = level + 1; }
        }
    }
  }

  return max_level;
}

int main(int argc, char const *argv[]) {
  int h, w;
  char c;
  Field field;
  LocationQueue que;
  LocationMap visited;

  cin >> h;
  cin >> w;

  for (int i = 0; i < h; i++) {
    vector<char> row;
    vector<bool> brow;
    for (int j = 0; j < w; j++) {
      cin >> c;
      row.push_back(c);
      if (c == '#') {
        que.push(make_pair(make_pair(i, j), 0));
        brow.push_back(true);
      } else {
        brow.push_back(false);
      }
    }
    field.push_back(row);
    visited.push_back(brow);
  }

  cout << solve(h, w, field, que, visited);

  return 0;
}


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

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

    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }

    sort(v.begin(), v.end());

    cout << v.back() - v[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <algorithm>    
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cmath>
#include <bitset>
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;

typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef unsigned long long ull; 
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int M = 1e9 + 7;
//__int128


signed main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int A, B;
  cin >> A >> B;
  int x = __gcd(A, B);
  std::vector<int> a;
  int t = x;
  for(int i = 2; i * i <= x; ++i) {
  	if(t % i == 0) {
  		int cnt = 0;
  		while(t % i == 0) {
  			t /= i;
  			++cnt;
  		}
  		a.eb(cnt);
  	}
  }
  if(t > 1) {
  	a.eb(1);
  }
  cout << (int)a.size() + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m, q = map(int, input().split())
abcd = [0] * q
for i in range(q):
    abcd[i] = list(map(int, input().split()))

def dfs(seq):
    if len(seq) == n:
        yield seq
        return

    if len(seq) == 0:
        _max = 1
    else:
        _max = seq[-1]
    for i in range(_max, m+1):
        new_seq = seq.copy()
        new_seq.append(i)
        yield from dfs(new_seq)

ans = 0
for s in dfs([]):
    tmp = 0
    for a, b, c, d in abcd:
        if c == s[b-1] - s[a-1]:
            tmp += d
    ans = max(ans, tmp)

print(ans)


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

int main(){
    set<int> st;
    for(int i=0;i<3;i++){
        int a;
        cin>>a;
        st.insert(a);
    }
    cout<<st.size()<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=2005;
//i_am_noob
int n,a[maxn],id[maxn],dp[maxn][maxn],ans=-4e18;

bool comp(int i, int j){return a[i]>a[j];}

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	rep(n) id[i]=i;
	sort(id,id+n,comp);
	sort(a,a+n);
	reverse(a,a+n);
	dp[0][0]=0;
	rep2(i,1,n+1) rep1(j,i+1){
		dp[j][i-j]=-4e18;
		if(j>0) dp[j][i-j]=max(dp[j][i-j],dp[j-1][i-j]+abs(id[i-1]-(j-1))*a[i-1]);
		if(i-j>0) dp[j][i-j]=max(dp[j][i-j],dp[j][i-j-1]+abs(id[i-1]-(n-i+j))*a[i-1]);
	}
	rep1(j,n+1) ans=max(ans,dp[j][n-j]);
	print1(ans);
	return 0;
}

Measured memory_bytes: 26312
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n<105) cout<<0<<endl;
  else{
    int ans=0;
    for(int i=105;i<=n;i+=2){
      int tmp=1;
      int cnt=0;
      while(tmp<=n){
        if(!(i%tmp)) ++cnt;
        tmp++;
      }
      if(cnt==8) ++ans;
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 1e5 + 5;
int N, Ans;
char S[MAXN];
int main()
{
	scanf("%s", S + 1);
	N = strlen(S + 1);
	Ans = N;
	for(int I = 2; I <= N; ++I)
		if(S[I] != S[I - 1])Ans = min(Ans, max(I - 1, N - I + 1));
	cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 384
//aea ctmr
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846
 
typedef long double ld;
typedef long long ll;
const ll N = 400500;
const ll mod = 1e9 + 7;
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif

map <ll, ll> m;
vector <ll> xd;

int main(){
    fastio;
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
    	ll a;
    	cin >> a;
    	m[a]++;
    	xd.push_back(a);
    }

    for(auto x: m){
    	ll w = x.ss;
    	ans += ((w * w - w) / 2);
    }

    for(ll i = 0; i < n; i++){
    	ll a = m[xd[i]];

    	cout << ans - a + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 11120
l = [int(x) for x in input().split()]
total, ashi = l[0], l[1]

if ashi/2 != int(ashi/2):
    print('No')
else:
    if total <= ashi/2:
        if 2*total >= ashi/2:
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 9116
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N;
	cin >> N;
	if (N == 1) cout << "Hello World" << endl;
	else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
}

Measured memory_bytes: 256