akhauriyash/Code-Regression huggingface dataset:
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define BigInt      __int128
#define endl        '\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        998244353
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define sim         template < class c
#define ris         return * this
#define dor         > debug & operator <<
#define eni(x)      sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {

using namespace std;

sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug 
{
	~debug() 
	{ 
		cerr<<endl; 
	}
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) 
	{
		ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) 
	{
	  	*this << "[";
	  	for (auto it = d.b; it != d.e; ++it)
	    	*this << ", " + 2 * (it == d.b) << *it;
	  	ris << "]";
	}
};
#define fuck(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define N  100005

ll int expo(ll int base,ll int exponent,ll int mod){
    ll int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,s;
		cin>>n>>s;
		ll int arr[n+1];
		for(ll int i=1;i<=n;i++)
		{
			cin>>arr[i];
		}
		ll int dp[n+1][s+1];
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		ll int inv2=expo(2,hell-2,hell);
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=0;j<=s;j++)
			{
				dp[i][j]=dp[i-1][j];
				if(j-arr[i]>=0) dp[i][j]=(dp[i][j]+(dp[i-1][j-arr[i]]*inv2)%hell)%hell;
			}
		}
		ll int ans=(dp[n][s]*expo(2,n,hell))%hell;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 73996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<int>vi;
#define pb push_back
#define sc(n) scanf("%d",&n)
#define lsc(n) scanf("%lld",&n)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define rev1(i,n) for(i=n;i>0;i--)
#define in insert
#define pr(n) printf("%d\n",n)
#define lpr(n) printf("%lld\n",n);


int main()
{
	int x,y;
	cin >> x >> y;
	int xx=x*2;
	int xxx=x*4;
	if(y>=xx && y<=xxx && y%2==0)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	return 0;
}


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

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

    int n, k;
    cin >> n >> k;

    vector<int> b(n), c(n + 1);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        a--;

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

    int r = 0;
    for (int i = n; i > 0; i--) {
        for (int j = 0; j < c[i]; j++) {
            r += i;
            if (--k <= 0) goto break2;
        }
    }
break2:

    cout << n - r << endl;

    return 0;
}

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

string s;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
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; }
ll mod= 1e9 + 7;


int main(){
  int a,b,c,d;
  cin >> a >>b >>c >>d;
  cout << min(a,b)+min(c,d) << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  int n;
  cin >> n;
  vector<pp> za(n);
  rep(i,n){
    int x,y;
    cin >> x >> y;
    za.at(i) = make_pair(x,y);
  }
  vector<vector<double>> dis(n,vector<double>(n,0.0));
  rep(i,n)rep(j,n){
    int dx = za[i].first-za[j].first;
    int dy = za[i].second - za[j].second;
    dis.at(i).at(j) = sqrt( dx*dx + dy*dy );
  }
  
  double ans = 0;
  vector<int> v(n);
  rep(i,n) v[i] = i;
  do{
    rep(i,n-1){
      ans += dis.at(v[i]).at(v[i+1]);
    }
  }while(next_permutation(v.begin(),v.end()));
  
  rep(i,n) ans /= (double)(i+1);
  
  printf("%.9f",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cstring>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
//#include <boost/multiprecision/cpp_int.hpp>

#define BIT(a) (1 << (a))
#define EPS (1e-10)

using namespace std;
//using namespace boost::multiprecision;

const long long MOD = 1000000007;
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

class Point{
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}
    
    Point operator+(Point p){return Point(x + p.x, y + p.y);}
    Point operator-(Point p){return Point(x - p.x, y - p.y);}
    Point operator*(double a){return Point(a * x, a * y);}
    Point operator/(double a){return Point(x / a, y / a);}

    bool operator < (const Point &p) const {
        return y != p.y ? y < p.y : x < p.x;
    }

    double norm(){return x * x + y * y;}
};
typedef Point Vector;
typedef vector<Vector> Polygon;

double cross(Vector a, Vector b){
    return a.x*b.y - a.y*b.x;
}

double dot(Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}

int ccw(Point p0, Point p1, Point p2){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)return COUNTER_CLOCKWISE;
    if (cross(a, b) > -EPS)return CLOCKWISE;
    if (dot(a, b) < -EPS)return ONLINE_BACK;
    if (a.norm() < b.norm())return ONLINE_FRONT;

    return ON_SEGMENT;
}

Polygon andrewScan(Polygon s){
    Polygon u, l;
    if (s.size() < 3) return s;
    sort(s.begin(), s.end());
    u.push_back(s[0]);
    u.push_back(s[1]);
    l.push_back(s[s.size()-1]);
    l.push_back(s[s.size()-2]);
    
    for (size_t i = 2; i < s.size(); i++){
        for (size_t n = u.size(); n >= 2 && ccw(u[n-2], u[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
            u.pop_back();
        }
        u.push_back(s[i]);
    }

    for (int i = (int)s.size() - 3; i >= 0; i--){
        for (size_t n = l.size(); n >= 2 && ccw(l[n-2], l[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
            l.pop_back();
        }
        l.push_back(s[i]);
    }

    reverse(l.begin(), l.end());
    for (size_t i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);

    return l;
}

long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}


int main(void){
    int a, b;
    cin >> a >> b;
    if (a <= b){
        cout << a << endl;
    }else{
        cout << a-1 << endl;
    }
    return 0;
}   



Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    println(inOutExec(null))
}

fun inOutExec(scanner: Scanner?): String {
    val (numOfPref, numOfCity) = readLine()!!.split(" ").map { it.toInt() }

    val citiesIn = mutableListOf<Pair<Int, Int>>()
    repeat(numOfCity) {
        val (pref, year) = readLine()!!.split(" ").map { it.toInt() }
        citiesIn.add(Pair(pref, year))
    }

    val cityCodeMap = citiesIn
            .asSequence()
            .groupByTo(mutableMapOf()) { it.first }
            .flatMap { entry -> entry.value
                        .asSequence()
                        .sortedBy { info -> info.second }
                        .mapIndexed { index, pair ->
                            pair to "%06d%06d".format(pair.first, index + 1) }
                    .toList()
            } // Pair<Pair<Int, Int>, String>
            .toMap()

    return citiesIn.joinToString(separator = "\n", postfix = "\n") { cityCodeMap[it]!! }
}


Measured memory_bytes: 166384
#include <iostream>
using namespace std;
int main(void){
    int n, m, i, j;
    cin >> n >> m;
    
    int A[100][100], B[100], C[100];
   
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            cin >> A[i][j];
        }
    }
    
    for(j=0; j<m; j++){
        cin >> B[j];
    }
    
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            C[i] += A[i][j] * B[j];
        }
        cout << C[i] << endl;
    }
    return 0;
}



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

int main()
{
 int a;
 int b;
 int c;
 vector<int> array;

 cin >> a >> b >> c;

 for( a; a <= b ; a++) {
   array.push_back(a);
 }

 int answer = 0;

 for( int i = 0; i < array.size(); i++) {
   if ( (c % array[i]) == 0){
     answer++;
   }
 }

 cout << answer << endl;
}

Measured memory_bytes: 1320
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1000000007;
// const int MAXN = 3e5;
const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("mxnl.in", "r", stdin);
       // freopen("mxnl.out", "w", stdout);
#endif
}

void solve(){
    int n;
    cin >> n;
    int kek = 0;
    for(int i=1; i<=n; i++){
        if(i%3!=0 && i%5!=0){
            kek+=i;
        }
    }
    cout << kek << endl;
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
/*
bool prime[10000001];
void Sieve(long int n)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    memset(prime, true, sizeof(prime));

    for (long int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (long int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}*/
int main()
{
    long long int a,b;
       cin>>a>>b;

     /*
       Sieve(10000001);
       */

       long long int x=a > b ? b : a;
        long long int y=a > b ? a : b;


          long int count=1;

          for(long int i=2;i<=sqrt(x);i++)
          {
                if(a % i==0 && b % i==0)
                  {
                        while(a % i==0)
                         a=a/i;

                         while(b % i ==0)
                           b=b/i;

                         count++;
                  }
                  else
                  {
                    while(a % i==0)
                     a=a/i;

                     while(b % i ==0)
                       b=b/i;
                  }
          }
        if(a!=1 && b!=1)
        {
           if(a % b==0 || b % a==0)
             count++;
          }
        cout<<count;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}


int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (a + b >= k) {
		cout << min(a, k) << endl;
	}
	else {
		cout << a - 1 * (min(c, k - a - b)) << endl;
	}
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<pair<int,int>> wv;
int dp[110][100010];
signed main()
{
	int n, w;
	cin >> n >> w;
	for (int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		wv.emplace_back(a,b);
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= w; j++){
			if (j >= wv[i-1].first){
				dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1].first] + wv[i-1].second);
			}else{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	cout << dp[n][w];
} 

Measured memory_bytes: 79360
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;

int memo[1024][1024];

int main() {
  for(;;) {
    int R, C;
    cin >> C >> R;
    

    string dm; getline(cin, dm);
    
    if( C == 0 && R == 0 ) break;
    C = C * 2 - 1;
    R = R * 2 - 1;
    
    vector<string> vs;
    for(int i = 0; i < R; i++) {
      string line;
      getline(cin, line);
      line += " ";      
      vs.push_back(line);
    }
    
    memset(memo, -1, sizeof(memo));
    memo[0][0] = 1;
    
    queue<int> q;
    q.push(0);
    q.push(0);
    while( !q.empty() ) {
      int x = q.front(); q.pop();
      int y = q.front(); q.pop();
      
      const int dx[] = {0, 0, 1, -1};
      const int dy[] = {1, -1, 0, 0};
      
      for(int k = 0; k < 4; k++) {
        int nx = x + dx[k];
        int ny = y + dy[k];
        
        if( 0 <= nx && nx < R && 0 <= ny && ny < C ) {
          if( vs[nx][ny] != '1' ) {
            nx += dx[k];
            ny += dy[k];
            
            if( memo[nx][ny] == -1 ) {
              memo[nx][ny] = memo[x][y] + 1;
              q.push(nx);
              q.push(ny);
            }
            
          }
        }     
      }
      
    }
    
    int res = memo[R - 1][C - 1];
    if( res == -1 ) res = 0;
    
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 5032
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define int long long
const int N=(int)1e5+5,INF=(int)1e18+7;

int n,m;
int dp[N][2];
int a[101];
int solve(int piles,int turn)
{
    
    int f=0;
    
    int &ans=dp[piles][turn];
    if(ans!=-1)return ans;
    ans=-1;
    
    for(int i=1;i<=n;i++)
    {
        if(piles-a[i]>=0){
            
            
        int t=solve(piles-a[i],!turn);
        
        if(turn==0)
        {
            if(ans==-1)ans=t;
            else
            {
                if(ans==1)ans=t;
            }
        }
        else
        {
            if(ans==-1)ans=t;
            else
            {
                if(ans==0)ans=t;
            }
        }
        
        f=1;
        }
    }
    
    if(!f)
    return !turn;
    
    
    return ans;
    
    
    
    
}


void solve()
{
    memset(dp,-1,sizeof dp);
    int k;
    cin>>n>>k;
    
    for(int i=1;i<=n;i++)cin>>a[i];
    
    
    int ans=solve(k,1);
   
    if(ans)
    {
        cout<<"First\n";
    }
    else cout<<"Second\n";
}

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
	int t=1;
	//cin>>t;
	while(t--)solve();
	    
   
}


Measured memory_bytes: 11332
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
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;
}
int main()
{
    LL n,a,b,c;
    vector<int>aa={1,3,5,7,9};
    string A="Q";
    cin >> a;
    FOR(i,1,a+1){
        REP(j,5){
          A = std::to_string(i);
        if(A.size()==aa[j]){
            b += 1;
          break;
             }
        }
    }
    cout << b;
}

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

int main(){
    long long ans=0;
    long long N;
    cin >> N;
    ans += (N*(N+1)*(N+1))/2-(N*(N+1)*(2*N+1))/6;
    long long u,v,x,y;
    long long i;
    for(i=0; i<N-1; i++){
        cin >> u >> v;
        x=min(u,v);
        y=max(u,v);
        ans -= x*(N-y+1);
    }
    cout << ans << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3704
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0514>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll a,b,c;
void solve(){
    ll N; cin >> N;
    vector<ll> flag(a+b+c,2);
    
    vector<ll> l1(N),l2(N),l3(N),l4(N);
    for(int i = 0; i < N;i++){
        cin >> l1[i] >> l2[i] >> l3[i] >> l4[i];
        l1[i]--; l2[i]--; l3[i]--;
        if(l4[i] == 1){
            flag[l1[i]] = flag[l2[i]] = flag[l3[i]] = 1;
        }
    }
    
    for(int i = 0; i < N;i++){
        if(l4[i] == 1) continue;
        if(flag[l1[i]] == 1 && flag[l2[i]] == 1) {
            flag[l3[i]] = 0;
        }
        if(flag[l1[i]] == 1 && flag[l3[i]] == 1){
            flag[l2[i]] = 0;
        }
        if(flag[l2[i]] == 1 && flag[l3[i]] == 1){
            flag[l1[i]] = 0;
        }
    }
    for(auto v:flag){
        cout << v << endl;
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> a >> b >> c,a){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll R[8],c[201][201],r,ans=inf;
bool ch[201];
void dep(ll now,ll cnt,ll sum){
		//	cout << cnt<<endl;
	if(cnt==r){
		ans=min(sum,ans);
		return ;
	}
	for(ll i=0;i<r;i++){
		ll next=R[i];
		if(ch[next]){
			continue;
		}
		ch[next]=true;
		dep(next,cnt+1,sum+c[now][next]);
		ch[next]=false;
	}
}

int main() {
	ll n,m;
	cin>>n>>m>>r;
	for(ll i=0;i<r;i++){
		ll x;
		cin>>x;
		x--;
		R[i]=x;
	}
	for(ll i=0;i<201;i++){
		for(ll j=0;j<201;j++){
			c[i][j]=inf;
		}
	}
	for(ll i=0;i<m;i++){
		ll x,y,z;
		cin>>x>>y>>z;
		x--;y--;
		c[x][y]=z;
		c[y][x]=z;
	}
	for(ll k=0;k<n;k++){
		for(ll i=0;i<n;i++){
			for(ll j=0;j<n;j++){
				c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}
	for(ll i=0;i<r;i++){
		ch[R[i]]=true;
		dep(R[i],1,0);
		ch[R[i]]=false;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 512
#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> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    if(s[0] =='7' || s[1] =='7' || s[2] =='7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 3");
            WillReturn.Add("1 2");
            WillReturn.Add("1 3");
            WillReturn.Add("2 3");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("7 7");
            WillReturn.Add("1 3");
            WillReturn.Add("2 7");
            WillReturn.Add("3 4");
            WillReturn.Add("4 5");
            WillReturn.Add("4 6");
            WillReturn.Add("5 6");
            WillReturn.Add("6 7");
            //1
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    struct JyoutaiDef
    {
        internal int CurrNode;
        internal HashSet<int> VisitedSet;
        //internal string Log;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        SplitAct(InputList[0]);
        int N = wkArr[0];

        bool[,] EdgeArr = new bool[N + 1, N + 1];

        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            EdgeArr[wkArr[0], wkArr[1]] = true;
        }

        var Stk = new Stack<JyoutaiDef>();
        JyoutaiDef WillPush;
        WillPush.CurrNode = 1;
        WillPush.VisitedSet = new HashSet<int>() { 1 };
        //WillPush.Log = "1";
        Stk.Push(WillPush);

        int AnswerCnt = 0;
        while (Stk.Count > 0) {
            JyoutaiDef Popped = Stk.Pop();

            //クリア判定
            if (Popped.VisitedSet.Count == N) {
                AnswerCnt++;
                //Console.WriteLine(Popped.Log);
                continue;
            }

            for (int I = 1; I <= N; I++) {
                //再訪不可
                if (Popped.VisitedSet.Contains(I)) continue;

                Action<int> PushSyori = (pNewNode) =>
                {
                    WillPush.CurrNode = pNewNode;
                    WillPush.VisitedSet = new HashSet<int>(Popped.VisitedSet);
                    WillPush.VisitedSet.Add(pNewNode);
                    //WillPush.Log = Popped.Log + "," + pNewNode.ToString();

                    Stk.Push(WillPush);
                };

                if (EdgeArr[Popped.CurrNode, I] || EdgeArr[I, Popped.CurrNode])
                    PushSyori(I);
            }
        }
        Console.WriteLine(AnswerCnt);
    }
}


Measured memory_bytes: 13536
N, M = map(int, input().split())

num = [-1,-1,-1]

digit_count = 1
ans = -1

for _ in range(M):
    s, c = map(int, input().split())
    if num[s - 1] != -1 and num[s - 1] != c:
        print(ans)
        exit()
    else:
        num[s - 1] = c

if N == 1:
    print(num[0] if num[0] >= 0 else 0)
    exit()
elif N >= 2 and num[0] == 0:
    print(ans)
    exit()

num[0] = max(1, num[0])
for i in range(N):
    num[i] = max(0, num[i])

if N == 2:
    ans = num[0] * 10 + num[1]
else:
    ans = num[0] * 100 + num[1] * 10 + num[2]

print(ans)


Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int n, m;
    in(n); in(m);
    vector<double> a(n);
    double sum = 0;
    rep(i, n) {
        in(a[i]);
        sum += a[i];
    }
    sort(a.begin(), a.end());
    if ((double) a[n-m] >= sum / ( 4. * (double) m)) out("Yes");
    else out("No");

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int main(){
  string s;
  cin >> s;
  bool oka = false;
  bool okb = false;
  bool okc = false;

  rep(i, 3){
    if (s[i] == 'a') oka = true;
    else if (s[i] == 'b') okb = true;
    else if (s[i] == 'c') okc = true;
  }

  if (oka && okb && okc) cout << "Yes\n";
  else cout << "No\n";
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    string a;
    cin >> a;
    set<char> s;
    for(int i = 0; i < 3; i++){
        s.insert(a[i]);
    }   
    if(s.size() == 1){
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
    
    
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int a[100001];
int main(){
    int n,t,mn=1000100010,mx=0,ai;
    cin>>n>>t;
    int sub=0;
    rep(i,n){
        cin>>ai;
        a[i]=ai;
        if(mn>ai){
            mn=ai;
            mx=ai;
        }
        mx=max(ai,mx);
        sub=max(sub,mx-mn);
    }
    int cnt=0;
    mn=1000100010;
    bool flag=false;
    rep(i,n){
        if(mn>a[i]){
            mn=a[i];
            flag=true;
        }
        if(a[i]-mn==sub&&flag){
            ++cnt;flag=false;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=b)){
		cout<<"Yes\n";
    }else{
		cout<<"No\n";
	}
	return 0;

}

Measured memory_bytes: 256
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
a_sorted = np.array(sorted(a))

a_sorted_floor = np.copy(a_sorted[:-1])
idx_floor = np.where(np.logical_and(a_sorted[-1] / 2 < a_sorted[:-1], a_sorted[:-1] < a_sorted[-1]))
a_sorted_floor[idx_floor] = a_sorted[-1] - a_sorted_floor[idx_floor]

print(a_sorted[-1], a_sorted[np.argmax(a_sorted_floor)])


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

int main() {
  int N, C, count=1;
  cin>>N;
  vector<int> d(N);
  for (int i=0; i<N; i++)
    cin>>d.at(i);
  sort(d.begin(), d.end());
  C=d.at(0);
  for (int i=0; i<N; i++){
    if (d.at(i)>C){
      count++;
      C=d.at(i);
    }
  }
  cout<<count<<endl;
}

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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ld long double
#define pb push_back
#define fe first
#define se second
#define nl "\n"
#define pp pair < ll , ll > 
#define sz(x) (ll)x.size()
#define st(x) sort(x.begin(),x.end())
#define rst(x) sort(x.rbegin(), x.rend())
#define all(x) x.begin(),x.end()
long double pi = 3.14159265358979323;
 
const double EPS = 1e-12;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
 
ll add(ll x ,ll y)
 {
     return ((x % mod) + (y % mod)) % mod;
 } 
 
 
int main()
{
    fast;
    ll h ,w;
    cin >> h >> w;
    char mat[h+1][w+1];
     ll dp[h+1][w+1] = {};
    for(int i = 0 ; i <= h ; i++ ){
        for(int j = 0 ; j <= w ; j++ ){
            if(i == 0 || j == 0){
                dp[i][j] = 0 ;
                mat[i][j] = '#';
            }
            else
            cin >> mat[i][j];
        }
    }
   
    dp[1][1] = (mat[1][1] == '.');

    for(int i = 1  ; i <= h ; i++ ){
        for(int j = 1 ;  j <= w ; j++ ){
                if(i == 1 && j == 1)continue;    
                dp[i][j] = add(dp[i-1][j] , dp[i][j-1]);
                if(mat[i][j] == '#')dp[i][j] = 0;
                //cout << dp[i][j] << " ";
        }
       // cout << "\n";
    }

    cout << dp[h][w];  





















    
    return 0;
    
}

Measured memory_bytes: 9088
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b, c, d) = get!(i32, i32, i32, i32);
    println!("{}", if a+b > c+d {
        "Left"
    } else if a+b < c+d {
        "Right"
    } else {
        "Balanced"
    });
}

Measured memory_bytes: 2080
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define MM <<" "<<
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setpercision(x)
using ll=long long;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using pl=pair<ll,ll>;
template<class T> inline bool chmin(T& a, T b){
    if(a>b){a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){
    if(a<b){a=b;return true;}return false;}
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll N;cin>>N;
    string S;
    if(N==0){cout<<0<<endl;return 0;}
    rep(i,40){
        if(N==0)break;
        else if(N%2==0){
            S='0'+S;
            N>>=1;
        }
        else if(i%2){
            S='1'+S;
            N++;
            N>>=1;
        }
        else{
            S='1'+S;
            N>>=1;
        }
    }
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

int N, M;
int C[35];

int main(void) {

    scanf("%d %d", &N, &M);

    REP(i, 0, N) {
    	int K;
    	scanf("%d", &K);
    	REP(j, 0, K) {
    		int A;
    		scanf("%d", &A);
    		C[A] += 1;
    	}
    }
    int ans = 0;

    REP(i, 1, M + 1) {
    	if ( C[i] == N ) ans++;
    }
    
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
const int N = 5e5 + 5, mod = 998244353;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
int n, m, ans, fac[N], inv[N];
int ksm(int x, int y) {
	int res = 1;
	for( ; y; x = x * x % mod, y >>= 1) {
		if(y & 1) res = res * x % mod;
	}
	return res;
}
void init(int n) {
	fac[0] = 1;
	for(int i = 1; i <= n; ++ i) fac[i] = fac[i - 1] * i % mod;
	inv[n] = ksm(fac[n], mod - 2);
	for(int i = n - 1; i >= 0; -- i) inv[i] = inv[i + 1] * (i + 1) % mod;
}
int C(int n, int m) {return n < m ? 0 : fac[n] * inv[m] % mod * inv[n - m] % mod;}
signed main() {
	n = read(); m = read();
	if(n > m) swap(n, m); init(5e5);
	for(int k = 0; k <= n; ++ k) {
		int tmp = C(n, k) % mod * C(m, k) % mod * fac[k] % mod* ksm(m + 1, n - k) % mod * ksm(n + 1, m - k) % mod;
		if(k & 1) ans = (ans - tmp + mod) % mod;
		else ans = (ans + tmp) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 8312
#include <iostream>
#include <vector>

int main()
{
    int n;
    std::cin >> n;
    
    std::vector<int> num(n);
    for(int i=0;i<n;i++)
        std::cin >> num[i];
        
    for(int i=n-1;i>0;i--)
        std::cout << num[i] << " ";
    std::cout << num[0] << std::endl;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<=(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double Pi = acos(-1);
const ll mod=1e9+7;

int main(){
    int n,m;
    cin >>n>>m;
    int p;
    string s;
    vector<int> v(n+1,1);
    int ten=0,wa=0;
    vector<int> pen(n+1,0);
    rep(i,m){
        cin >>p>>s;
        if(s=="AC"){
            ten += v[p];
            if(v[p]) wa += pen[p];
            v[p]=0;
        }else if(v[p]==1){
            pen[p]++;
        }
    }
    cout << ten << " " <<wa <<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;

set<int> smth;
ll lp[SIZE + 2], pr[SIZE + 2];

int gcd(int a, int b) {
    while (a * b != 0) {
        a %= b;
        swap(a, b);
    }
    return a + b;
}

bool flag = 0;

void fact(int a) {
    int d = 2;
    set<int> dd;
    if (a < 2) return;
    while (a > 1) {
        dd.insert(lp[a]);
        a /= lp[a];
    }

    for (auto cur : dd) {
        if (smth.find(cur) != smth.end()) flag = 1;
    }

    for (int i : dd) smth.insert(i);

}



int main()
{
    fastInp;

    ll n;
    cin >> n;
    vector<ll> vec(n);

    for (ll i = 2; i < SIZE; i++) {
        if (pr[i]) continue;

        lp[i] = i;
        for (ll j = (i * i); j < SIZE; j += i) {
            pr[j] = 1;
            lp[j] = i;
        }
    }

    for (auto &i : vec) cin >> i;

    int ans = vec[0];
    for (int i = 0; i < n; i++) {
        ans = gcd(ans, vec[i]);
        fact(vec[i]);
    }

    if (flag == 0) cout << "pairwise coprime\n";
    else if (ans == 1) cout << "setwise coprime\n";
    else cout << "not coprime\n";
    
    return 0;
}

Measured memory_bytes: 45912
#include<bits/stdc++.h>
using namespace std;
long long n,a,b,c,d;
int main()
{
	cin>>n>>a>>b>>c>>d;
	if(a>b)swap(a,b);
	if(c>d)swap(c,d);
	long long sub=b-a;
	for(long long k=0;k<n;k++)
	{
		long long l=k*c-(n-k-1)*d;
		long long r=k*d-(n-k-1)*c;
		if(sub>=l&&sub<=r)
		{
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll N, W, w[110], v[110], dp[103][100003], ans;
const ll INF = 10000000000;
int main(void){
    // Your code here!
    cin >> N >> W;
    for (ll i = 0; i < N; i++) cin >> w[i] >> v[i];
    for (ll i = 0; i <= N; i++)
    {
        for (ll j = 0; j <= 100000; j++)
        {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    for (ll i = 0; i < N; i++)
    {
        for (ll j = 0; j <= 100000; j++)
        {
            dp[i + 1][j] = dp[i][j];
            if (j < v[i]) continue;
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
        }
    }
    for (ll i = 0; i <= 100000; i++)
    {
        if (dp[N][i] <= W)
        {
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
///...................................*****.................................................///
///        Author :  MD. Rakibul Islam ( mmdrakibul2912@gmail.com )                         ///
///                  Department of Computer Science                                         ///
///                  & Engineering,                                                         ///
///                  Comilla University , Bangladesh.                                       ///
///...................................*****.................................................///
using namespace std;
int main()
{
    int n, m, a, b;
    cin>>a>>b;
    if(abs(a-b)==0)
        cout<<a+b<<endl;
    else if(abs(a-b)==1)
        cout<<a+b<<endl;
    else
        cout<<max(a,b)+((max(a,b))-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include<algorithm>
using namespace std;
 
long long D[2000001];
long long T[2000001];

long long zet(long long inp){
    if(inp>0){
        return inp;
    }else{
        return -inp;
    }
}

int main(){
    long long N,M,c=0;
    cin >> N ;
    //long long D[N];
    for(int i=0;i<N;i++){
       scanf("%lld",&D[i]);
    }
    //long long T[M];
    cin >> M;
    for(int i=0;i<M;i++){
        scanf("%lld",&T[i]);
    }
    sort(D,D+N);
    sort(T,T+M);
    long long ind=0;
    for(long long i=0;i<M;i++){
        while(ind<N){
            if(D[ind]==T[i]){
                ind++;
                c++;
                break;
            }
            ind++;
        }
        /*
        if(i==(M-1) && D[ind-1]==T[i]){
            cout << "YES" <<endl;
            return 0;
        }
        */
    }
    if(c==M){
        cout << "YES" << endl;
    }else{
        cout << "NO"<<endl;
    }

    
    return 0;
}

Measured memory_bytes: 5888
def f(n,s):
    if(n==1):
        s=s+1
        return(s*2)
    else:
        return(((f(n//2,s))+1)*2)
n=int(input())
if(n==1):
    print(1)
else:
    s=0
    g=f(n//2,s)
    print(g+1)
        


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
	int a[100] = { 0 };
	int bank;


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

	for (int i = 0; i < 10; i++) {
		for (int i = 0; i < 2; i++) {
			if (a[i] > a[i + 1]) {
				bank = a[i];
				a[i] = a[i + 1];
				a[i + 1] = bank;
			}
		}
	}

	cout << a[0] << " " << a[1] << " " << a[2] << endl;

	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	string s;
	cin >> s;
	map<ll, ll> mp;
	REP(i, s.size()) mp[s[i]]++;
	if ((mp['N'] != 0 || mp['S'] != 0) && mp['N'] * mp['S'] == 0)
	{
		cout << "No" << endl;
		return 0;
	}
	if ((mp['E'] != 0 || mp['W'] != 0) && mp['E'] * mp['W'] == 0)
	{
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	/*for(auto i:{'N','W','E','S'})
	{
		if(!mp[i])
		{

		}
	}*/
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n+2, 0);
    REP(i, n) cin >> a[i+1];
    
    int num = 0;
    REP(i, n+1){
        num += abs(a[i] - a[i+1]);
    }
    
    REP(i, n){
        cout << num - abs(a[i] - a[i+1]) - abs(a[i+1] - a[i+2]) + abs(a[i] - a[i+2]) << endl;
    }
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
    string w, t;
    int n, count;
    count = 0;
    string end = "END_OF_TEXT";
    bool flag;
    flag = true;
    cin >> w;
    while(flag && cin >> t){
        n = t.length();
        for(int i=0; i<n; ++i){
            if((int)(end[i] - t[i]) != 0){
                break;
            }
            if(i == n-1 && (int)(end[i] - t[i]) == 0){
                flag = false;
            }
        }
        if(flag && n == w.length()){
            for(int i=0; i<n; ++i){
                if((int)(w[i] - t[i]) != 0 && abs((int)(w[i] - t[i])) != abs((int)('a'-'A')) ){
                    break;
                }
                if(i == n-1 && ((int)(w[i] - t[i]) == 0 || abs((int)(w[i] - t[i])) == abs((int)('a'-'A')))){
                    count++;
                }
            }
        }
    }
    std::cout << count << endl;
    return 0;
}



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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;
const ll mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n > 0) {
        ans++;
        n /= k;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3656
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
const int N=6666666;
int n;
pair<int,int>X[N];
queue<int>q;
bool vis[N];
int ans[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	scanf("%d",&X[i].first),X[i].second=i;
	sort(X+1,X+n+1);
	for(int i=1;i<=n;++i){
		for(int j=X[i-1].first+1;j<X[i].first;++j)q.push(j);
		ans[X[i].first]=X[i].second;
		vis[X[i].first]=1;
		for(int j=1;j<X[i].second;++j){
			if(q.empty()){puts("No");return 0;}
			int u=q.front();q.pop();
			vis[u]=1,ans[u]=X[i].second;
		}
	}
	while(!q.empty())q.pop();
	X[n+1].first=n*n+1;
	for(int i=n;i;--i){
		for(int j=X[i+1].first-1;j>X[i].first;--j)if(!vis[j])q.push(j);
		for(int j=1;j<=n-X[i].second;++j){
			if(q.empty()){puts("No");return 0;}
			int u=q.front();q.pop();
			vis[u]=1,ans[u]=X[i].second;
		}
	}
	puts("Yes");
	for(int i=1;i<=n*n;++i)
	printf("%d ",ans[i]);
	return 0;
}

Measured memory_bytes: 7040