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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}

ll subsolve(vector<pii> v){
    //(delta, pos)
    ll ans = 0;
    sort(all(v), [](pii p1, pii p2) -> bool {
        if(p1.first > p2.first) return true;
        if(p1.first == p2.first && p1.second < p2.second) return true;
        return false;
    });
    set<int> free;
    int n = v.size(), i;
    for(i=1;i<=n;i++) free.insert(i);
    for(auto pp : v){
        int delta, pos;
        tie(delta, pos) = pp;
        if(pos > n){
            ans += delta;
            continue;
        }
        //max x | x <= pos
        auto it = free.upper_bound(pos);
        if(it == free.begin()){
            continue;
        }
        it--;
        //*it <= pos
        ans += delta;
        free.erase(it);
    }
    return ans;
}

void solve(){
    int n, i;
    ll ans = 0;
    cin >> n;
    vector<pii> vl, vr;
    for(i=0;i<n;i++){
        int pos, ls, rs;
        cin >> pos >> ls >> rs;
        ans += min(ls,rs);
        int delta = max(ls,rs) - min(ls,rs);
        if(delta == 0) continue;
        if(ls > rs){
            vl.push_back({delta, pos});
        }else{
            vr.push_back({delta, n - pos});
        }
    }
    ans += subsolve(vl);
    ans += subsolve(vr);
    cout << ans << "\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int nt;
    cin >> nt;
    for(int tt=1;tt<=nt;tt++){
        solve();
    }
    return 0;
}

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

int main()
{
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;

#define TOINT(z) (z - '0')

    std::set<int> a;
    std::set<int> aa;
    std::set<int> aaa;

    for (int i = 0; i < n-2; i++) {
        if (a.count(TOINT(s[i])*100))
            continue;
        a.insert(TOINT(s[i])*100);
        for (int j = i + 1; j < n-1; j++) {
            if (aa.count(TOINT(s[i])*100 + TOINT(s[j])*10))
                continue;
            aa.insert(TOINT(s[i])*100 + TOINT(s[j])*10);
            for (int k = j + 1; k < n; k++) {
                aaa.insert(TOINT(s[i])*100 + TOINT(s[j])*10 + TOINT(s[k]));
            }
        }
    }

    std::cout << aaa.size() << std::endl;

    return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	while(~scanf("%d",&n)){
		int x1=0,y1=0,t1=0,x2,y2,t2;
		int flag=1;
		for(int i=1;i<=n;i++){
			scanf("%d%d%d",&t2,&x2,&y2);
			int s=abs(x2-x1)+abs(y2-y1);
			if(abs(s)>abs(t2-t1)) flag=0;
			s=abs(abs(s)-abs(t1-t2));
			if(s%2!=0){
				flag=0;
			}
			t1=t2;
			x1=x2;
			y1=y2;
			
		}
		if(flag==0){
			printf("No\n");
		}else{
			printf("Yes\n");
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <bitset>
 
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    
    int N, M, X;
    cin >> N >> M >> X;
    
    vector<int> c(N, 0);
    vector<int> money;
    int** A = new int*[N];
    
    for(int i=0; i<N; i++){
        cin >> c[i];
        A[i] = new int[M];
        for(int j=0; j<M; j++){
            cin >> A[i][j];
        }
    }
    
    
    for(int tmp=0; tmp < (1 << 12); tmp++){
        bitset<12> s(tmp);
    
        int m=0;
        vector<int> skill(M,0);
        for(int i=0; i<12; i++){
            if(i>=N) continue;
            if(s.test(i)==1){
                for(int j=0; j<M; j++){
                    skill[j]+=A[i][j];
                }
                m += c[i];
            }
        }
        
        int count=0;
        for(int i=0; i<M; i++){
            if(skill[i]>=X){
                count+=1;
            }
        }
        
        if(count>=M){
            money.push_back(m);
        }
    }
    
    if(money.size() > 0){
        int ans=money[0];
        for(int i=1; i<money.size(); i++){
            ans=min(ans, money[i]);
        }
        cout << ans << endl;
    }else{
        cout << "-1" << endl;
    }
    
    for(int i=0; i<N; i++){
        delete A[i];
    }
    delete[] A;
    
    return 0;
}


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int A, B, C, ans = 0;

        void solve(InputReader in, PrintWriter out) {
            A = in.nextInt();
            B = in.nextInt();
            C = in.nextInt();

            while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
                if (A == B & B == C) {
                    ans = -1;
                    break;
                }
                ans++;
                int newA = B/2 + C/2;
                int newB = C/2 + A/2;
                int newC = A/2 + B/2;
                A = newA;
                B = newB;
                C = newC;
            }

            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        long nextLong() { return Long.parseLong(next()); }

        int[] nextIntArray(int n) {
        	int[] arr = new int[n];
        	for (int i = 0; i < n; ++i) {
        		arr[i] = nextInt();
        	}
        	return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 23380
n = int(input())
arr = list(map(int, input().split(' ')))
ans = 0
for i in range(1, len(arr) - 1):
    p2 = arr[i]
    p1 = arr[i-1]
    p3 = arr[i+1]

    x = [p1, p2, p3]
    x = sorted(x)
    if x[1] == p2:
        ans += 1

print(ans)

Measured memory_bytes: 38384
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

twice n = n * n

cost :: [Int] -> Int -> Int
cost xs pos = sum . map (twice . (pos -)) $ xs

main :: IO ()
main = do
	n <- readLn
	xs <- readToListN n <$> BS.getLine :: IO [Int]
	print $ minimum $ map (cost xs) [1..100]


Measured memory_bytes: 1020
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
 int a,b;
  cin >>a >> b;
  int ans=0;
  if(a==b){
    ans=2*a;
  }
  else{
    ans=max(a,b)*2-1;
  }
  cout << ans << endl;
}
  

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

using namespace std;

int main() {

	int n,m;
	cin >> n >> m;

	vector<int> k(11, 0);
	vector<vector<int>> s(11,vector<int>(11, 0));

	for (int i = 0; i < m; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			cin >> s[i][j];

		}
	}
	vector<int> p(11, 0);

	for (int i = 0; i < m; i++) {
		cin >> p[i];
	}

	/*全種類のオンオフ試す*/
	int totalcounter = 0;
	for (int i = 0; i < pow(2, n); i++) {

		int b = i;
		vector<int> bb(11,0);
		int kk = 0;
		/*立っているビット番号調べる*/
		while (b!=0) {
			bb[kk] = b%2;
			kk++;
			b = int(b / 2);
		}

		int ccounter = 0;
		/*j番目の電球*/
		for (int j = 0; j < m; j++) {
			int counter = 0;
			/*k番目のスイッチ選択*/
			for (int l = 0; l < k[j]; l++) {
				/*各スイッチの照合*/
//				for (int mm = 0; mm < kk; mm++) {
					if (bb[s[j][l]-1] == 1) {
						counter++;
					}
//				}

			}
			if (counter % 2 == p[j]) {
				ccounter++;
			}
			else {
				break; /*一こでも条件合わなかったら次行く*/
			}
		}
		if (ccounter == m) {
			totalcounter++;
		}
	}
	cout << totalcounter << endl;
}

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

class Progaram
{
    static void Main(string[] args)
    {
        var l = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var n = l[0]; var k = l[1];
        var hights = new List<Int64>();
        for (var i = 0; n > i; i++)
        {
            hights.Add(Int64.Parse(Console.ReadLine()));
        }
        hights = hights.OrderBy(x => x).ToList();
        var kuks = new List<Int64>();
        for (var i = 0; n > i + k - 1; i++)
        {
            var hmax = hights[i + k - 1];
            var hmin = hights[i];
            kuks.Add(hmax - hmin);
        }
        kuks = kuks.OrderBy(x => x).ToList();
        Console.WriteLine(kuks[0]);
    }
}


Measured memory_bytes: 26716
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
 
#define rep(i,x) for(int i=0;i<x;++i)
 
struct edge{
    int from, to, cost;
    edge(int from, int to, int cost) : from(from), to(to), cost(cost) {};
};
 
vector<edge> edges;
 
const int MAX_N = 100000;
 
int N, M;
int dist[MAX_N];
 
bool bf(int s)
{
    rep(i, N) dist[i] = LLONG_MAX / 2;
    dist[s] = 0;
 
    rep(i, N-1) {
        for (edge& e : edges) {
            if (dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }
    
    for (edge& e : edges) {
        if (dist[e.to] > dist[e.from] + e.cost) {
            dist[e.to] = dist[e.from] + e.cost;
            if (e.to == N - 1) return true;
        }
    }
    
    return false;
}
 
signed main()
{
    cin >> N >> M;
 
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        edges.emplace_back(edge(a, b, -c));
    }
 
    if (bf(0)) {
        cout << "inf" << endl;
        return 0;
    }
 
    cout << -dist[N - 1] << endl;
}
 
 
 
 
 
 
 

Measured memory_bytes: 384
#include<iostream>
#include<string>
#define INF 500050
using namespace std;
int a[INF],b[INF],c[INF];
int n,k,ans=0;
int main()
{
	cin >> n;
	
	for(int i=1; i<=n; i++) {
		cin >> a[i];
	}
	for(int i=1; i<=n; i++) {
		cin >> b[i];
	}
	for(int i=2; i<=n; i++) {
		cin >> c[i];
	}
	
	for(int i=1; i<=n; i++) {
		ans += b[a[i]];
		if(a[i]+1 == a[i+1])	ans += c[a[i+1]];
	}
	
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 2304
#include <iostream>

using namespace std;

int main() {
	string day[7] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	string S;
	cin >> S;

	int day_index = 0;
	for (int i = 0; i < 7; i++) {
		if (day[i] == S) {
			day_index = i;
		}
	}

	cout << 7 - day_index << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
if K == 0:
    print(N * N)
    exit()
cnt = 0
for b in range(K + 1, N + 1):
    p, r = divmod(N, b)
    cnt += p * (b - K)
    if r >= K:
        cnt += r - K + 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n,m; cin >> n >> m;
  vector<vector<int>> G(n,vector<int>(n,0));
  rep(i,m){
    int a,b; cin >> a >> b;
    a--,b--;
    G[a][b] = 1;
    G[b][a] = 1;
  }
  vector<int> v;
  for(int i = 1; i < n; i++){
    v.push_back(i);
  }
  int ans = 0;
  do{
    int from = 0;
    bool flag = true;
    for(int i = 0; i < v.size();i++){
      int to = v[i];
      if(G[from][to] == 0) flag = false;
      from = to;
    }
    if(flag) ans++;
  }while(next_permutation(v.begin(), v.end()));// 次の順列を生成
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
class ChessBoard
  attr_reader :queens

  def initialize
    @queens = []
  end

  def put_queen(queen)
    @queens << queen
  end

  def search_answer
    candidate_rows = (0..7).to_a - @queens.map(&:row)
    candidate_cols = (0..7).to_a - @queens.map(&:col)
    candidate_queens = candidate_rows.product(candidate_cols).map{|row, col| Queen.new(row, col)}
    @queens = calculate(@queens, candidate_queens)
  end

  def calculate(placed_queens, candidate_queens)
    if placed_queens.length == 8
      return placed_queens
    end
    while !candidate_queens.empty?
      current_queen = candidate_queens.shift
      if placed_queens.all?{|queen| queen.independent(current_queen)}
        answer = calculate(placed_queens + [current_queen], candidate_queens.select{|queen| queen.independent(current_queen)})
        if answer
          return answer
        end
      end
    end
  end

  def print
    (0..7).each do |row|
      queen = @queens.find{|q| q.row == row}
      if !queen
        puts ("." * 8)
      else
        puts ("." * 8).tap{|line| line[queen.col] = "Q"}
      end
    end
  end
end

class Queen
  attr_reader :row, :col

  def initialize(row, col)
    @row = row
    @col = col
  end

  def independent(other)
    (@row != other.row) && (@col != other.col) && ((@row - other.row).abs != (@col - other.col).abs)
  end
end

board = ChessBoard.new

k = gets.to_i
k.times do
  r, c = gets.split(" ").map(&:to_i)
  queen = Queen.new(r, c)
  board.put_queen(queen)
end

board.search_answer
board.print


Measured memory_bytes: 8920
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N,M;

struct edge{
  int to;
  i64 s;
};

vector<edge> G[101010];

int main(){
  cin >> N >> M;
  rep(i,0,M - 1){
    int u,v;
    i64 s;
    cin >> u >> v;
    cin >> s;
    G[u].push_back({v,s});
    G[v].push_back({u,s});
  }

  queue<int> que;
  que.push(1);

  vector<i64> op(101010,0);
  vector<i64> C(101010,0);

  i64 bottom = 0;
  i64 up = 1e18;

  i64 A;
  bool defined = false;

  op[1] = 1;

  while(!que.empty()){
    int v = que.front();
    que.pop();
    for(auto e : G[v]){
      if(op[e.to] == 0){
        op[e.to] = op[v] * -1;
        C[e.to] = e.s - C[v];
        if(op[e.to] == 1){
          bottom = max(bottom , -C[e.to]);
        }
        else{
          up = min(up , C[e.to]);
        }
        que.push(e.to);
      }
      else if(op[e.to] == op[v]){
        i64 c = C[e.to] + C[v];
        if(abs(e.s - c) % 2 == 1){
          cout << 0 << endl;
          return 0;
        }

        i64 a = op[v] * (e.s - c) / 2;
        if(a <= 0){
          cout << 0 << endl;
          return 0;
        }
        if(!defined){
          A = a;
          defined = true;
        }
        else if(A != a){
          cout << 0 << endl;
          return 0;
        }
      }
      else if(C[e.to] + C[v] != e.s){
        cout << 0 << endl;
        return 0;
      }
    }
  }
  if(defined){
    cout << ((bottom < A) && (A < up)) << endl;
  }
  else{
    cout << max(0LL,up - bottom - 1) << endl;
  }
}


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

int H, W, D, Q;

struct Point {
  int x, y;
};

map<int, Point> m;

int main () {
  cin >> H >> W >> D;

  rep(i,H) rep(j,W) {
    int A;
    cin >> A;
    A--;
    m[A] = Point{i,j};
  }

  vector<vector<int>> S(D, vector<int>((H*W)/D + 1, 0));
  rep(r,D) {
    for(int i = 0; r + (i+1)*D < H*W; i++) {
      int x = r + i*D;
      S[r][i+1] = S[r][i] + abs(m[x+D].x - m[x].x) + abs(m[x+D].y - m[x].y);
    }
  }

  cin >> Q;
  rep(i,Q) {
    int L, R;
    cin >> L >> R;
    L--, R--;
    int r = L % D;
    cout << S[r][R/D] - S[r][L/D] << endl;
  }

  return 0;
}


Measured memory_bytes: 11008
a, b, k = list(map(int, input().split()))

if (b - a) <= k:
    for i in range(a, b + 1):
        print(i)
    exit()

ans = set()
for i in range(k):
    ans.add(a + i)
for i in range(k):
    ans.add(b - i)

ans = sorted(ans)

for a in ans:
    print(a)


Measured memory_bytes: 3060
import java.util.*; 
import java.io.*;

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        int X = nextInt();

        if( X>= 30) {
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        };

        

    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

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


int main()

{
    int i,j,k,l,m,n;
    cin>>n;
    i=n%10;
    n=n/100;
    if(i==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}
ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;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(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    ll n,k;
    
    cin>>n>>k;
    ll num=n-k+1;
    for(int i=1;i<=k;i++){
        cout <<(com(num,i)*com(k-1,i-1))%mod<<endl;
    }
    return 0;
}



Measured memory_bytes: 4992
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

int mod = 1e9 + 7;

int n, m, ans, mi1[1000010], mi2[1000010], ny[1000010];
char s[1000010];

inline int ksm (int a, int p) { int ans = 1; for (; p; p >>= 1, a = 1ll * a * a % mod) if (p & 1) ans = 1ll * ans * a % mod; return ans; }

int main () {
	scanf ("%d%s", &n, s);
	m = strlen (s);
	mi1[0] = mi2[0] = 1;
	for (int i = 1; i <= 1000000; ++i) mi1[i] = 1ll * mi1[i - 1] * 25 % mod, mi2[i] = 1ll * mi2[i - 1] * 26 % mod;
	ny[1] = 1; for (int i = 2; i <= 1000000; ++i) ny[i] = 1ll * (mod - mod / i) * ny[mod % i] % mod;
	for (int i = m, c = 1; i <= n + m; ++i) {
		ans = (ans + 1ll * c * mi1[i - m] % mod * mi2[n + m - i] % mod) % mod;
		c = 1ll * c * i % mod * ny[i - m + 1] % mod;
	}
	printf ("%d\n", ans);
	return 0;
}

Measured memory_bytes: 16492
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>ans(N + 1, 0);
  for (int x = 1; x * x < N; x ++) {
    int X = x * x;
    for (int y = 1; y * y + X < N; y ++) {
      int Y = y * y;
      for (int z = 1; z * z + X + Y < N; z ++) {
        int Z = z * z;
        int kj = X + Y + Z + x * y + y * z + z * x;
        if (kj <= N) {
          ans[kj] ++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i ++) cout << ans[i] << endl;
}

Measured memory_bytes: 3640
from collections import deque

def get_input():
  return list(map(int, input().split(' ')))

n = get_input()[0]
d = deque()
for _ in range(n):
  c = get_input()
  if c[0] == 0: # push(x)
    if c[1] == 0:
      d.appendleft(c[2])
    else:
      d.append(c[2])
  elif c[0] == 1: # randomAccess(p)
    print(d[c[1]])
  elif c[0] == 2: # pop()
    if c[1] == 0:
      d.popleft()
    else:
      d.pop()



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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

bool f[22222];

signed main(){
    for(int i=0;i*i<=20000;i++){
        for(int j=0;i*i+j*j<=20000;j++){
            if(i*i+j*j>1&&i*i+j*j<=20000)f[i*i+j*j]=true;
        }
    }

    int n;cin>>n;
    while(n--){
        int a,b;cin>>a>>b;
        int c=a*a+b*b;
        bool ok=true;
        for(int i=2;i<c;i++)if(f[i]&&c%i==0){
            ok&=!f[c/i];
        }
        if(ok)cout<<"P"<<endl;
        else cout<<"C"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N;
vector<int> A,B;

int main ()
{
    cin >> N;
    A.resize(N);
    B.resize(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];

    vector<pair<int,int>> At(N),Bt(N);
    REP(i,N) {
        At[i] = make_pair(A[i], i);
        Bt[i] = make_pair(B[i], i);
    }

    sort(At.begin(), At.end());
    sort(Bt.begin(), Bt.end());

    REP(i,N) {
        if (At[i].first > Bt[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }

    bool flag = false;
    for (int i = 1; i < N; i++) {
        if (At[i].first <= Bt[i - 1].first) {
            flag = true;
        }
    }

    if (flag) {
        cout << "Yes" << endl;
        return 0;
    }

    int to[100010] = {};
    REP(i,N) to[At[i].second] = Bt[i].second;

    int cur = 0;
    int cnt = 0;
    while (true) {
        cnt++;
        cur = to[cur];
        if (cur == 0) {
            break;
        }
    }

    if (cnt == N) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 2944
n,q = map(int,input().split())
s=input()
LR=[]
for i in range(q):
    l,r = map(int,input().split())
    LR.append([l,r])

c=0
p=0
C=[]
for i in range(len(s)):
    if s[i]=="A":
        p=1
    elif p==1 and s[i]=="C":
        c+=1
        p=0
    else:
        p=0
    C.append(c)

for i in range(q):
    l=LR[i][0]
    r=LR[i][1]
    ans = C[r-1]-C[l-1]
    print(ans)

Measured memory_bytes: 26620
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int read()
{
    char c=getchar();
    int d=0;
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9'){d=(d<<3)+(d<<1)+(c^48);c=getchar();}
    return d;
}

#define MAXN 50

int n;
string s;
int a[MAXN+1][27];

int main()
{
    n=read();
    for(int i=1;i<=n;i++)
    {
        getline(cin,s);
        //for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
        for(auto j:s)a[i][j-'a'+1]++;
    }
    for(int i=1;i<=26;i++)
    {
        int minn=233;
        for(int j=1;j<=n;j++)
        {
            minn=min(minn,a[j][i]);
            if(!minn)break;
        }
        for(int j=1;j<=minn;j++)putchar(i-1+'a');
    }
}

Measured memory_bytes: 256
#include <cassert>
#include <iostream>
#include <vector>

template <class T> inline void chadd(T &a, const T &b) { a += b; }

int main() {
  // Input
  int numDish;
  std::cin >> numDish;
  assert(1 <= numDish and numDish <= 300);
  std::vector<int> sushiCount(1 + numDish);
  for (int n = 1; n <= numDish; ++n) {
    std::cin >> sushiCount[n];
    assert(1 <= sushiCount[n] and sushiCount[n] <= 3);
  }

  // Initialization
  std::vector<std::vector<std::vector<double>>> dp(1 + numDish + 1);
  for (int i = 0; i <= numDish + 1; ++i) {
    dp[i].assign(1 + numDish + 1, {});
    for (int j = 0; j <= numDish + 1; ++j) {
      dp[i][j].assign(1 + numDish + 1, 0);
    }
  }

  // Initial condition
  dp[0][0][0] = 0;
  for (int i = 0; i <= numDish; ++i) {
    for (int j = 0; j <= numDish; ++j) {
      for (int k = 0; k <= numDish; ++k) {
        if (i == 0 and j == 0 and k == 0)
          continue;
        if (i + j + k > numDish)
          continue;
        dp[i][j][k] = static_cast<double>(numDish - i - j - k) / (i + j + k);
      }
    }
  }

  // DP main
  for (int k = 0; k <= numDish; ++k) {
    for (int j = 0; j <= numDish; ++j) {
      for (int i = 0; i <= numDish; ++i) {
        if (i + j + k > numDish)
          continue;
        chadd(dp[i + 1][j][k], (static_cast<double>(i + 1) / (i + j + k + 1)) *
                                   (1 + dp[i][j][k]));
        if (i >= 1)
          chadd(dp[i - 1][j + 1][k],
                (static_cast<double>(j + 1) / (i + j + k)) * (1 + dp[i][j][k]));
        if (j >= 1)
          chadd(dp[i][j - 1][k + 1],
                (static_cast<double>(k + 1) / (i + j + k)) * (1 + dp[i][j][k]));
      }
    }
  }

  // Output
  int i = 0;
  int j = 0;
  int k = 0;
  for (int n = 1; n <= numDish; ++n) {
    if (sushiCount[n] == 1)
      i += 1;
    else if (sushiCount[n] == 2)
      j += 1;
    else if (sushiCount[n] == 3)
      k += 1;
    else
      assert(false);
  }
  // std::cout << dp[i][j][k] << std::endl;
  printf("%.12f\n", dp[i][j][k]);


  return 0;
}


Measured memory_bytes: 219008
#include<iostream>
using namespace std;
#define rep(i, n) for (int i=0; i<(int) (n);i++)
using ll = long long;
using P = pair<int,int>;

void solve_A(){
   string s, t;
   cin >> s >> t;
   bool result = true;
    for (size_t i = 0; i < s.size(); i++)
    {
        if(s[i] != t[i]){
            result = false;
        }
    }
    cout << (result ? "Yes" : "No") << endl;
    
}

void solve_B(){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll rest_ka = k -a;
    ll rest_kab = k - a - b;
    ll rest_kabc = k - a - b - c;
    ll point = 0;
    if (k > a){
        point += a;
    }
    else{
        point += k;
    }
    if(rest_ka > 0){
        if(rest_kab > 0){
            point -= rest_kab;
        }
    }
    cout << point << endl;

}

void solve_C(){
    
}

void solve_D(){
    
}

void solve_E(){
    
}

void solve_F(){
    
}

int main(){
    //solve_A();
    solve_B();
    //solve_C();
    //solve_D();
    //solve_E();
    //solve_F();
    return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

//O(|V|+|E|)

template<class graph_type> class bridge_and_articulation{
public:
    const int size;
    graph_type graph;
    vector<bool> used,is_art;
    vector<int> ord,low,articulations;
    vector<pair<int,int>> bridges;

    bridge_and_articulation(const graph_type &graph):graph(graph),size(graph.size()),used(size),is_art(size),ord(size),low(size){
        int k=0;
        for(int i=0; i<size; ++i) if(!used[i]) dfs(i,-1,k);
    }

    void dfs(int v,int p,int &k){ //v???????????¨???p=-1
        used[v]=true;
        ord[v]=low[v]=k++;

        int count=0;
        for(const auto &edge:graph[v]){
            const int u=edge.to;
            if(!used[u]){
                ++count;
                dfs(u,v,k);
                low[v]=min(low[v],low[u]);

                if(ord[v]<low[u]) bridges.push_back(make_pair(min(v,u),max(v,u)));
                if(p!=-1 and ord[v]<=low[u]) is_art[v]=true;
            }else if(u!=p) low[v]=min(low[v],ord[u]);
        }

        if(p==-1 and count>1) is_art[v]=true;
        if(is_art[v]) articulations.push_back(v);
    }

    bool is_bridge(int u,int v)const{
        if(ord[u]>ord[v]) swap(u,v);
        return ord[u]<low[v];
    }

    bool is_articulation(int v)const{
        return is_art[v];
    }
};

struct edge{
    int to;
};

void solve(){
    int v,e;
    cin >> v >> e;
    vector<vector<edge>> graph(v);
    rep(i,0,e){
        int s,t;
        cin >> s >> t;
        graph[s].push_back(edge({t}));
        graph[t].push_back(edge({s}));
    }
    bridge_and_articulation<vector<vector<edge>>> ba(graph);
    vector<pair<int,int>> ans=ba.bridges;
    sort(ans.begin(),ans.end());
    for(auto &e:ans) cout << e.first << " " << e.second << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

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

int main(){
  int i,N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> num(N,0);
  long long ans=0,tmp;
  for(i=0; i<N; i++){
    cin >> A.at(i);
  }
  for(i=0; i<N; i++){
    num.at(A.at(i)-1)++;
  }
  for(i=0; i<N; i++){
    tmp = num.at(i);
    ans += tmp*(tmp-1)/2;
  }
  for(i=0; i<N; i++){
    tmp = num.at(A.at(i)-1);
  	cout << ans - tmp +1 << endl;
  }
  return 0;
}

Measured memory_bytes: 5760
import os
import os
import sys
from functools import reduce
from operator import xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
A = np.array(A, dtype=np.int64)


def dump(arr):
    for a in arr:
        print(np.binary_repr(a, 60))
    print()


# 解説AC
# 立ってるビットが奇数ならどう分けても結果は同じ
odds = reduce(xor, A)
ans = odds

# 奇数のやつは無視
A &= ~odds

# 行標準形にする
# https://qiita.com/vain0x/items/015ff6d49853e5d9d403#f---xor-sum-3
rank = 0
for d in reversed(range(60)):
    # 下からd桁目が立ってる最初のindex
    bits1 = (A >> d & 1).astype(bool)
    pos = bits1[rank:].argmax() + rank
    if not bits1[pos]:
        continue  # 全部ゼロ
    if pos < rank:
        continue  # rank より下に 1 がない。どう頑張っても変えられない。(?)

    # 基準にする行
    pivot_row = A[pos]
    # 基準以外を全部ゼロにする
    A[bits1] ^= pivot_row
    A[pos] = pivot_row
    # 基準行を一番上に持ってくる
    A[pos], A[rank] = A[rank], A[pos]
    rank += 1

ans += reduce(xor, A) * 2
print(ans)


Measured memory_bytes: 24200
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int A = reader.nextInt();
		int B = reader.nextInt();
		int C = reader.nextInt();
		int X = reader.nextInt();
		int ans = 0;
		for (int i = 0; i <= A; i++) {
			for (int j = 0; j <= B; j++) {
				for (int k = 0; k <= C; k++) {
					int tmp = i * 500 + j * 100 + k * 50;
					if (tmp == X) {
						ans++;
					}
				}
			}
		}


		System.out.print(ans);
		reader.close();
	}
}





Measured memory_bytes: 22996
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
#include<tuple>
using namespace std;

int n, l, r, mid, pos;
long long d, a, cur, decr = 0, bombs = 0;
vector< long long > limit( 2e5 + 5, 0 );
vector< pair< long long, long long > > arr( 2e5 + 5 );

int main( void )
{
	ios :: sync_with_stdio( 0 );
	cin.tie( 0 );
	
	cin >> n >> d >> a;
	for( int i = 1; i <= n; ++i )
	{
		cin >> arr[ i ].first >> arr[ i ].second;		
	}
	sort( arr.begin() + 1, arr.begin() + n + 1 );
	for( int i = 1; i <= n; ++i )
	{
		arr[ i ].second -= decr;
		if( arr[ i ].second > 0 )
		{
			cur = ( arr[ i ].second + a - 1 ) / a;
			bombs += cur;
			l = i;
			r = n;
			pos = 0;
			while( l <= r )
			{
				mid = ( l + r ) >> 1;
				if( arr[ mid ].first <= arr[ i ].first + 2 * d )
				{
					pos = max( pos, mid );
					l = mid + 1;
				}
				else
				{
					r = mid - 1;
				}
			}
			limit[ pos ] += cur * a;
			decr += cur * a;
		}
		decr -= limit[ i ];
	}
	cout << bombs << "\n";	
	return 0;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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







int main() {
    int n;
    scanf("%d", &n);
    int sum = 0, mx = 0;
    for(int i = 0; i < n; i++){
        int l;
        scanf("%d", &l);
        sum += l;
        mx = max(mx, l);
    }
    printf("%s\n", (sum > 2 * mx)? "Yes" : "No");
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/math/common_factor_rt.hpp>
// #define rep(i, n) for(int i = 0; i < (int)(n); i++)
// #define all(a) (a).begin(),(a).end()
// #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
// int gcd(int a, int b){return b ? gcd(b, a%b) : a;}

#define int long long
#define SIZE 100000

using namespace std;

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

  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int n; cin >> n;

  vector<int> a(n);
  for (auto it = a.begin(); it < a.end(); ++it) cin >> *it;

  while (a.size() != 1) {
    sort(a.begin(), a.end());
    auto it = lower_bound(a.begin(), a.end(), 1);
    a.erase(a.begin(), it);
    for (auto it = a.begin() + 1; it < a.end(); ++it) {
      *it = *it % *(a.begin());
    }
    // ostream_iterator<int> oit(cout, " ");
    // copy(a.begin(), a.end(), oit); cout << endl;
  }

  num = a.front();
  
  // array<int, SIZE> a;
  // for (auto it = a.begin(); it < a.begin() + n; ++it) cin >> *it;
  // for (auto it = a.begin(); it < a.begin() + n; ++it) num += *it;

  cout << num << endl;
  return 0;
}


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

#define ll long long

ll l, r, ans=2019;

int main() {
  cin >> l >> r;
  for (ll i = l; i <= min(r, l+2018); i++) {
    for (ll j = i+1; j <= min(r, i+2019); j++) {
      ans = min(ans, (i*j)%2019);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll N, M;
    cin >> N >> M;
    VVL G(N+1);
    rep(i, 0, M){
        ll a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }   

    ll ans = 0;
    
    rep(i, 2, N+1){

        VB ini(N+1, false);
        queue<pair<ll, vector<bool>>> que;
        ini[1] = true;
        que.push({1, ini});
        while(!que.empty()){
            auto q = que.front();
            que.pop();
            bool f = false;
            if(q.first == i){
                f = true;
                rep(j, 1, N+1){
                    if(!q.second[j]) f = false;
                }
                if(f){
                    ans++;
                    cerr << i << endl;
                    continue;
                }else{
                    continue;
                }
            }
            
            
            
            for(auto g : G[q.first]){
                if(q.second[g]) continue;
                VB tmp(q.second);
                tmp[g] = true;
                que.push({g, tmp});
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
n, k = map(int, input().split())
a = []
for i in range(k):
    d = int(input())
    aa = list(map(int, input().split()))
    a.append(aa)

a = set(sum(a, []))
cnt = 0
for i in range(n):
    if i+1 not in a:
        cnt += 1

print(cnt)


Measured memory_bytes: 67680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=2510;

vector<ll> primes;
vector<bool> is_prime(MAX,true);
int sieve(){
    is_prime[0]=is_prime[1]=0;
    for (ll i=2;i<MAX;++i) if (is_prime[i]){
        primes.emplace_back(i);
        for (ll j=i*2;j<MAX;j+=i) is_prime[j]=false;
    }
    return primes.size();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m=sieve();
    vector<ll> cubics(m);
    for (int i=0;i<m;++i) cubics[i]=primes[i]*primes[i]*primes[i];
    int N; cin >> N;
    vector<ll> s(N);
    for (int i=0;i<N;++i) cin >> s[i];
    for (int j=0;j<m;++j)
        for (int i=0;i<N;++i)
            while(s[i]%cubics[j]==0)
                s[i]/=cubics[j];
    map<ll,int> cnt;
    for (int i=0;i<N;++i) ++cnt[s[i]];
    map<ll,bool> check;
    int ans=0;
    for (auto p:cnt){
        if (p.first==1){ans+=1; continue;}
        if (check[p.first]) continue;
        ll x=p.first,y=1;
        for (int j=0;j<m;++j) if (x%primes[j]==0){
            int div=3;
            while(x%primes[j]==0){--div; x/=primes[j];}
            for (int i=0;i<div;++i) y*=primes[j];
        }
        ll z=sqrt(x);
        if (z*z==x) y*=z;
        else y*=x*x;
        ans+=max(cnt[p.first],cnt[y]);
        check[p.first]=check[y]=true;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 26112
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#define maxn 200005
using namespace std;
int size[maxn];
int n,k,l;
int fa1[maxn];
struct Edge{
		int from, to;
		Edge(int from,int to):from(from),to(to){}
		friend bool operator < (const Edge &a,const Edge &b){
				if(a.from == b.from) return a.to < b.to;
				else return a.from < b.from;
		}
};
map <Edge,int> mp;
int find1(int x){
		if(x == fa1[x]) return x;
		return fa1[x] = find1(fa1[x]);
}

int fa2[maxn];
int find2(int x){
		if(x == fa2[x]) return x;
		return fa2[x] = find2(fa2[x]);
}
int main(){
		//freopen("main.in","r",stdin);
		cin >> n >> k >> l;
		mp.clear();
		for(int i = 1; i <= n; i++) fa1[i] = i;
		for(int i = 1; i <= k; i++){
				int x,y; cin >> x >> y;
				int f1 = find1(x);
				int f2 = find1(y);
				if(f1 != f2){
						fa1[f1] = f2;
				}
		}
		for(int i = 1; i <= n; i++) {fa2[i] = i;size[i] = 1;}
		for(int i = 1; i <= l; i++){
				int x,y; cin >> x >> y;
				int f1 = find2(x);
				int f2 = find2(y);
				if(f1 != f2){
						fa2[f1] = f2;
				}
		}
		for(int i = 1; i <= n; i++){
				int x = find1(i);int y = find2(i);
				if(!mp.count(Edge(x,y)))mp[Edge(x,y)] = 1;
				else mp[Edge(x,y)]++;
		}
		for(int i = 1; i <= n; i++){
				int x = find1(i);int y = find2(i);
				cout << mp[Edge(x,y)] << " ";
		}
		cout << endl;
		return 0;

}

Measured memory_bytes: 14336
import math
import collections
import sys

#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

n=I()
if n==1:
    print("Hello World")
else:
    a=I()
    b=I()
    print(a+b)

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

#define rep(i, x, y) for(int i = (x), _ = (y); i <= _; ++ i)
#define per(i, x, y) for(int i = (x), _ = (y); i >= _; -- i)
#define dprintf(...) fprintf(stderr, __VA_ARGS__)
#define disp(x) cout << #x << "=" << x << "; "

typedef long long LL;

template<class T> void read(T& a)
{
	char c = getchar(); a = 0; T f = 1;
	for(; isdigit(c) == 0; c = getchar()) if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) a = a * 10 + c - '0';
	a *= f;
}

template <class T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0;}
template <class T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0;}

LL N, M;

int main()
{
#ifdef Leeson
	freopen("tmp.in", "r", stdin);
	freopen("tmp.out", "w", stdout);
#endif

	cin >> N >> M;
	LL ans = 0;
	if((N << 1) >= M)
		ans = M >> 1;
	else
		ans = ((N << 1) + M) >> 2;

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int H, W, M;
  cin >> H >> W >> M;
  map<pair<int,int>,int> v;
  vector<int> tate(W, 0);
  vector<int> yoko(H, 0);
  
  rep(i,M){
    int h, w;
    cin >> h >> w;
    h--;
    w--;
    tate[w]++;
    yoko[h]++;
    v[make_pair(h,w)] = 1;
  }

  vector<pair<int,int>> tates;
  rep(j,W){
    tates.emplace_back(tate[j],j);
  }
  sort(ALLOF(tates));
  reverse(ALLOF(tates));
    
  int ret = 0;
  rep(i,H){
    int sum = yoko[i];
    int mx = 0;
    rep(j,tates.size()){
      int w = tates[j].second;
      int t = v.count(make_pair(i,w));
      if(t == 1){
        mx = max(mx, tates[j].first - 1);
      }else{
        mx = max(mx, tates[j].first);
        break;
      }
    }
    ret = max(ret, sum + mx);
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 28544
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll INF = 1e+18;
const ld EPS = 1e-12L;
const ld PI = acos(-1.L);
inline ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
inline ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll a, b;
  cin >> a >> b;
  print(6-a-b);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main (void) {
  int k, x;
  cin >> k >> x;
  
  cout << x - k + 1;
  
  for (int i = x - k + 2; i < x + k; i++) {
    cout << " " << i;
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256