akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(N);
    INT(M);
    VEC(int,each,N);

    int total = 0;
    int meet = 0;
    
    for(int i = 0; i < N; ++i){
        total += each[i];
    }
    

    for(int i = 0; i < N; ++i){
        if(each[i] >= (total+(4*M)-1)/(4*M)){
            meet++;
        }
    }

    if(meet >= M){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

   
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define rndf(d) (ll)((double)(d) + (d >= 0 ? 0.5 : -0.5))
#define floorsqrt(x) ((ll)sqrt((double)x) + ((ll)sqrt((double)x) * (ll)sqrt((double)x) <= (ll)(x) ? 0 : -1))
#define ceilsqrt(x) ((ll)sqrt((double)x) + ((ll)x <= (ll)sqrt((double)x) * (ll)sqrt((double)x) ? 0 : 1))
#define rnddiv(a, b) ((ll)(a) / (ll)(b) + ((ll)(a) % (ll)(b) * 2 >= (ll)(b) ? 1 : 0))
#define ceildiv(a, b) ((ll)(a) / (ll)(b) + ((ll)(a) % (ll)(b) == 0 ? 0 : 1))
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)

/*******************************************************/

int main() {
	int n; cin >> n;
	vll a(n); Loop(i, n) cin >> a[i];
	vll b = a;
	sort(b.begin(), b.end());
	ll x = b[n / 2 - 1];
	ll y = b[n / 2];
	Loop(i, n) {
		if (a[i] <= x) cout << y << endl;
		else cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 5376
#include<iostream>
using namespace std;
const long long mod = 1000000007;

long long min(int x, int y){
  if (x>y){return y;}
  else {return x;}  
}

long long mul(int x, int y){
  return ( (x%mod) * (y%mod) ) % mod;  
}

long long fact(int n){
    if((n == 0) || (n == 1)) {return 1;}
	int ans = 1;
	for (int i = 1; i<n+1; i++){
 		ans = mul(ans,i);
    }
	return ans;
}

long long power(int a, int x){
    if (x == 0) { return 1; }
    else if (x == 1) {return a % mod;}
    else if (x % 2 == 0) { return mul(power(a, x/2),power(a, x/2)); }
    else {return mul( mul(power(a, (x-1)/2), power(a, (x-1)/2)), a); }  
}

int main(void){
	int X,Y,N,r;
  	cin >> X >> Y;
	if ( ((X+Y)%3 != 0) || (X>2*Y) || (Y>2*X) ) { 
     	cout << "0" << endl;
      	return 0;
    }
	else{  
  		N = (X+Y)/3;
  		r = min(X,Y) - N;
  		// N! / {r!(N-r)!} = N! * {r!(N-r)!}^(mod-2)
	  cout << mul( fact(N), power( mul( fact(r), fact(N-r) ) , mod-2 )) << endl;    	  
    }
	return 0;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double EPS = 0.0000001;
struct point{
  double x, y;
  point(){
  }
  point(double x, double y): 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 k){
    return point(x * k, y * k);
  }
  point operator /(double k){
    return point(x / k, y / k);
  }
};
double abs(point P){
  return sqrt(pow(P.x, 2) + pow(P.y, 2));
}
double dist(point P, point Q){
  return abs(Q - P);
}
point midpoint(point P, point Q){
  return (P + Q) / 2;
}
point rotate90(point P){
  return point(P.y, - P.x);
}
pair<point, point> equal_distance(point P, point Q, double d){
  point M = midpoint(P, Q);
  double d2 = sqrt(pow(d, 2) - pow(dist(P, Q) / 2, 2));
  point N = rotate90(Q - P) / dist(P, Q);
  return make_pair(M + N * d2, M - N * d2);
}
int main(){
  while (1){
    int N;
    cin >> N;
    if (N == 0){
      break;
    }
    vector<point> P(N);
    for (int i = 0; i < N; i++){
      cin >> P[i].x >> P[i].y;
    }
    vector<point> Q;
    for (int i = 0; i < N; i++){
      for (int j = i + 1; j < N; j++){
        if (dist(P[i], P[j]) <= 2){
          pair<point, point> tmp = equal_distance(P[i], P[j], 1);
          Q.push_back(tmp.first);
          Q.push_back(tmp.second);
        }
      }
    }
    int sz = Q.size();
    int ans = 1;
    for (int i = 0; i < sz; i++){
      int cnt = 0;
      for (int j = 0; j < N; j++){
        if (dist(Q[i], P[j]) <= 1 + EPS){
          cnt++;
        }
      }
      ans = max(ans, cnt);
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3668
//#include <bits/stdc++.h>
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int N, M;
  while (cin >> N >> M) {
    if (N == 0 && M == 0) break;
    int pc[1004][800] = {};
    // memset(pc, 0, sizeof(pc));
    int r;
    cin >> r;
    int t, n, m, s;
    while (r--) {
      cin >> t >> n >> m >> s;
      //  m--;
      n--;
      t -= 540;

      if (s == 1) { // login
        pc[n][t] = m;
      } else { // logout
        pc[n][t] = -m;
      }
    }
    rep(i, N) rep(j, 799) pc[i][j + 1] += pc[i][j];

    int q;
    cin >> q;
    int ts, te;
    while (q--) {
      cin >> ts >> te >> m;
      // m--;
      ts -= 540;
      te -= 540;
      int cnt = 0;
      loop(i, ts, te) {
        bool flag = false;
        rep(j, N) flag |= pc[j][i] == m;
        cnt += flag;
      }
      cout << cnt << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 9288
#include <stdio.h>;

int main (){
	int c=1,N,K;
	scanf("%d",&N);
	scanf("%d",&K);
	for (int i=0;i<N;i++){
		if (c*2<c+K){
			c=c*2;
		} 
		else {	
			c+=K;
		}
	}
	printf("%d", c);
	
	return 0;
}


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

int main()
{
    double l;
    cin >> l;
    l /= 3;
    printf("%.8lf\n", l * l * l);
}

Measured memory_bytes: 3728
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int a;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a);
		if (a % 2 == 1)
		{
			printf("first\n");
			return 0;
		}
	}
	printf("second\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int person[16] = {};

vector <pair<int, int>> claim[16];
ll n;

bool judge(){
    for(ll idx = 1;idx <= n;idx++){
        if(person[idx] == 1){
            for(auto & itr : claim[idx]){
                if(person[itr.first] != itr.second){
                    return false;
                }
            }
        }
    }
    return true;
}

int main() {
    

    ll ans = 0;
    cin >> n;
    for(ll i=1;i<=n;i++){
        ll num;
        cin >> num;
        for (ll j=0;j<num;j++){
            ll x,y;
            cin >> x >> y;
            pair <int, int> p = make_pair(x,y);
            claim[i].push_back(p);
        }
    }


    for(ll now = 0; now < pow(2,n); now++){
        ll tmp = now;
        ll idx = 1;
        while(idx <= n) {
            person[idx] = (int)(tmp % 2);
            tmp /= 2;
            idx++;
        }
        if(judge()){
            ll tmp = 0;
            for(ll idx = 1; idx <= n;idx++){
                tmp += person[idx];
            }
            if(tmp > ans){
                ans = tmp;
            }
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <string.h>
#include <vector>

using namespace std;
int main() {
    int N;
    string ans;
    cin >> N;
    vector<int> a(N);
    int sum = 0;

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

    int mini = sum;
    int pre_sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        pre_sum += a[i];
        mini = min(mini, abs(pre_sum - (sum - pre_sum)));
    }

    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<ll> cnt(3);
  rep(i, N) {
    if(S[i] == 'R')      cnt[0]++;
    else if(S[i] == 'G') cnt[1]++;
    else                 cnt[2]++;
  }
  ll ans = cnt[0] * cnt[1] * cnt[2];
  rep(i, N) {
    REP(j, i+1, N) {
      int k = 2*j-i;
      if(k<N) {
	if(S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=2*1e5+2;
int check(int val[],int m,int p)
{
	if(m==0)
	{
		if(p==2)
		{
			return val[2];
		}
		else return 0;
	}
	else if(m==1)
	{
		if(p==0)
		{
			return val[0];
		}
		else return 0;
	}
	else{
		if(p==1)
		{
			return val[1];
		}
		else return 0;
	}
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,k;
	cin>>n>>k;
	int r,s,p;
	cin>>r>>s>>p;
	int val[3]={r,s,p};
	string t;
	cin>>t;
	int ans=0;
	for(int i=0;i<k;i++)
	{
		vector<int> v;
		for(int j=i;j<n;j+=k)
		{
			// cout<<t[j]<<" ";
			int va=-1;
			if(t[j]=='r')
				va=0;
			else if(t[j]=='s')
				va=1;
			else va=2;
			// cout<<va<<" ";
			v.pb(va);
		}
		int n1=v.size();
		int dp[n1][3];
		// for(auto x:v)
		// {
		// 	cout<<x<<" ";
		// }
		// cout<<"\n";
		for(int j=0;j<3;j++)
		{
			dp[0][j]=check(val,v[0],j);
		}
		for(int j=1;j<n1;j++)
		{
			for(int j1=0;j1<3;j1++)
			{
				dp[j][j1]=check(val,v[j],j1);
				int mx=-1;
				for(int j2=0;j2<3;j2++)
				{
					if(j2==j1) continue;
					mx=max(mx,dp[j-1][j2]);
				}
				// if(mx==-1) cout<<"*";
				dp[j][j1]+=mx;
			}
		}
		int o=max({dp[n1-1][0],dp[n1-1][1],dp[n1-1][2]});
		ans+=o;
		// cout<<o<<" ";
	}
	cout<<ans;
}  
// I never lose. I either win or I learn

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll a, b, c;
    cin >> a >> b >> c;

    ll p, q, r, res = 0, m = 4e8;
    REP(i, m){
        if((a % 2) + (b % 2) + (c % 2)){
            cout << res << endl;
            return 0;
        }
        p = a / 2, q = b / 2, r = c / 2;
        a = q + r, b = r + p, c = p + q;
        res++;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
///in the name of ALLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int r=0,c=0;
    if(s[0]==s[1]&& s[1]==s[2] && s[0]=='R')cout<<3<<endl;
    else if((s[0]==s[1] && s[0]=='R')||(s[1]==s[2] && s[1]=='R'))cout<<2<<endl;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R')cout<<1<<endl;
    else cout<<0<<endl;
}


Measured memory_bytes: 3616
def resolve():
    n, p = map(int, input().split())
    a = list(map(int, input().split()))
    if len([ai for ai in a if ai % 2 == 0]) == n:
        print(2 ** n if p == 0 else 0)
        return 2 ** n if p == 0 else 0
    else:
        print(2 ** (n - 1))
        return 2 ** (n - 1)


if __name__ == "__main__":
    resolve()


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

int main() {
  ll a, b, r, x, tmp;
  cin >> a >> b;
  x = a * b;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  cout << x / b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cout << #x << ": " << (x) << endl
using namespace std;

using ull = unsigned long long;
using ll = long long;

using Int = ll;
using Double = double;

using P = pair<Int, Int>;
using V = vector<Int>;
using M = vector<V>;

const double PI  = 3.141592653589793238463;
const int MOD = 1000000007;
const Int INF = numeric_limits<Int>::max() / 3;

int sign(Int a){
    return (a > 0) - (a < 0);
}

Int solve(int n, const V& as, int s){
    Int sum = 0;
    Int ans = 0;
    for(auto a : as){
        sum += a;
        if(sign(sum) != s){
            ans += abs(sum - s);;
            sum -= sum - s;
            if(sum == 0){
                ans++;
                sum += s;
            }
        }
        s *= -1;
    }
    return ans;
}

Int solve(int n, V& as){
    return min(solve(n, as, 1), solve(n, as, -1));
}


int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(false);

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

    cout << solve(n, as) << "\n";

    return 0;
}


Measured memory_bytes: 1024
a,b= map(int, input().split())
s = input()

if ("-" in s) and s.count("-") == 1:
    s = s.split("-")
    if len(s[0]) == (a) and len(s[1]) == b:
        print("Yes")
    else:
        print("No")

else:
    print("No")

Measured memory_bytes: 9184
/****************************************************************************
Is this the real life? Is this just fantasy?
Caught in a landslide, no escape from reality
Open your eyes, look up to the skies and see
I'm just a poor boy, I need no sympathy
Because I'm easy come, easy go, little high, little low
Any way the wind blows doesn't really matter to me, to me!!!
--------------------------------------------------
CP is quite cool.It becomes cooler when you enjoy learning new things
******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define endl "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define pool(i,a,b) for(int i=a;i>=b;i--)
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(a) a.size()
#define ff first
#define ss second
#define debug(x) cout<<#x<<" = "<<x<<endl;
const int mod=1e9+7;

ll gcd(ll a,ll b)
{
  if(a==0)
    return b;
  return gcd(b%a,a);
}

void solve()
{
  int siz=1e6+7;
  vi spf(siz);
  iota(all(spf),0);

  for (int i=4; i<siz; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<siz; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<siz; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 

  int n;
  cin>>n;
  vi a(n);
  set<int> head;
  int g;
  bool flag1=1,flag2=1;
  rep(i,n)
  {
    cin>>a[i];

    if(i==0)
      g=a[i];
    else
      g=gcd(a[i],g);

    set<int> s;
    int x=a[i];
    while(x>1)
    {
      s.insert(spf[x]);
      x/=spf[x];
    }

    for(auto it:s)
    {
      if(head.find(it)!=head.end())
      {
        flag1=0;
      }
      head.insert(it);
    }
  }

  if(g!=1)
    flag2=0;

  if(flag1==1)
    cout<<"pairwise coprime"<<endl;
  else if(flag1==0 && flag2==1)
    cout<<"setwise coprime"<<endl;
  else
    cout<<"not coprime"<<endl;
} 

int main()
{

  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif

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

  int t=1;
  // cin>>t;
  while(t--)
  {
    solve();
  }

  return 0;
}


Measured memory_bytes: 14816
n=int(input())
a=[input() for _ in range(n)]
m=30
c=[[0]*m for _ in range(m)]
k=9
ary=[]
for b in a:
  b=b.split('.')
  bint,bfl=0,0
  bint=int(b[0])*10**9
  if len(b)>1:
    tmp=('1'+b[1]+'000000000000')[:10]
    bfl=int(tmp)
    bfl-=10**9
  tmp=bint+bfl
  t=tmp
  n5=0
  while t%5==0:
    t//=5
    n5+=1
  t=tmp
  n2=0
  while t%2==0:
    t//=2
    n2+=1
  n2=min(n2,k+9)
  n5=min(n5,k+9)
  c[n2][n5]+=1
  ary.append([n2,n5])
cc=[[0]*(m+1) for _ in range(m+1)]
for i in range(m):
  for j in range(m):
    cc[i+1][j+1]+=cc[i+1][j]+c[i][j]
for i in range(m):
  for j in range(m):
    cc[i+1][j+1]+=cc[i][j+1]
ans=0

for i,j in ary:
  if i>=k and j>=k:ans-=1
  tmp=cc[-1][-1]-cc[-1][2*k-j]-cc[2*k-i][-1]+cc[2*k-i][2*k-j]
  ans+=tmp
ans//=2
print(ans)
"""
c[k][k]+=7
for x in c:
  print(x)
print('======')
for x in cc:
  print(x)
"""

Measured memory_bytes: 40584
#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()

i64 g(i64 x) {
  i64 ans = 0;
  {
    i64 y = x % 4;
    if(y == 1 || y == 2) ans++;
  }
  for(int i = 1;i <= 50;i++) {
    i64 lim = (1LL << i);
    i64 boa = (1LL << (i + 1));
    i64 rem = x % boa;
    if(rem < lim) continue;
    if((rem - lim) % 2 == 0) ans += (1LL << i);
  }

  return ans;
}

i64 h(i64 x) {
  i64 y = 0;
  for(int i = 0;i <= x;i++) {
    y ^= i;
  }
  return y;
}

int main() {
  i64 A,B;
  cin >> A >> B;
  cout << (g(B) ^ g(A - 1)) << endl;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a >= 6 && a < 13) cout << b/2 << endl;
    else if(a < 6) cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979;

int main(){
    int a,b;
    double x;
    cin >> a >> b >> x;
    if(x <= a*a*b/2.0) cout << setprecision(12)<< 180*atan(a*b*b/(2.0*x))/pi << endl;
    else cout <<setprecision(12)<< 180*atan((2*a*a*b - 2*x)/(a*a*a))/pi << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(12);
  vector<char> b(12);
  for (int i=0;i<12;i++){
      a.at(i)=n%3;
      n=n/3;
  }
  for (int i=0;i<12;i++){
      if (a.at(i)==0) b.at(i)='0';
      if (a.at(i)==1) b.at(i)='+';
      if (a.at(i)==2) {a.at(i+1)++;b.at(i)='-';}
      if (a.at(i)==3) {a.at(i+1)++;b.at(i)='0';}
  }
  int t=0;
  for (int i=11;i>-1;i--){
      if (a.at(i)==0 && t==1) cout << '0';
      if (a.at(i)==1) {t=1;cout << '+';}
      if (a.at(i)==2) {t=1;cout << '-';}
      if (a.at(i)==3) cout << '0';
  }
  cout << endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,l,s,t;
    char str[2000000];
    scanf(" %s",str);
    l = strlen(str);
    t = 0;
    //printf("%lld\n",s);
    for(i = 0;i < l;i++){
        //printf("s %c",str[i]);
        s = (str[i] - 48);
        t = t + s;
    }
    //printf("%lld\n",t);
    if(t % 9 == 0){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 3944
_ = input()
input_slime_list = list(input())

remain_slime_list = []
for slime in input_slime_list:
    if len(remain_slime_list)==0:
        remain_slime_list.append(slime)
    else:
        if slime!=remain_slime_list[-1]:
            remain_slime_list.append(slime)

print(len(remain_slime_list))


Measured memory_bytes: 4652
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int a,b;
    string op;
    cin >> a >> op >> b;
    if(op == "+"){
        cout << a + b << endl;
    }else{
        cout << a - b << endl;
    }
    return 0;
}



Measured memory_bytes: 256
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def dfs(u, d=0):
        dep[u] = d
        h = 0
        for cu in chi[u]:
            h = max(h, dfs(cu, d + 1) + 1)
        hig[u] = h
        return h

    n = int(input())
    par = [-1] * n
    sib = [-1] * n
    deg = [0] * n
    dep = [-1] * n
    hig = [-1] * n
    typ = ["internal node"] * n
    chi = [[] for _ in range(n)]
    for _ in range(n):
        u, l, r = map(int, input().split())
        if l != -1:
            par[l] = u
            sib[l] = r
            deg[u] = 1
            chi[u] = [l]
        if r != -1:
            par[r] = u
            sib[r] = l
            deg[u] += 1
            chi[u] += [r]
        if deg[u] == 0:
            typ[u] = "leaf"
    root = par.index(-1)
    typ[root] = "root"
    dfs(root)
    for u in range(n):
        print("node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}".format
              (u, par[u], sib[u], deg[u], dep[u], hig[u], typ[u]))

main()



Measured memory_bytes: 5672
/* This Template is property of Pranav Khiste aka desmond_kaneki*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define vll vector<ll>
#define pb push_back
#define qll queue<ll>
#define mp make_pair
#define fst first
#define snd second
#define pll pair<ll,ll>
#define vpll vector<pll>
#define debug(x) cout<<#x<<' '<<x<<endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define mod 1000000007
#define SUP LLONG_MAX
#define INF LLONG_MIN
#define test() ll var;  cin>>var; while(var--)
#define fileio freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);  // use cin cout only!!
main()
{
    fastio;
    ll n,k;
    cin>>n>>k;
    ll ar[n];
    fi(0,n)
        cin>>ar[i];
    fi(k,n)
    {
        if(ar[i]>ar[i-k])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    
    
}


Measured memory_bytes: 5220
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    s = LS()
    t = sorted(s)
    if s[0] == s[1]:
        print("=")
    elif s[0] == t[0]:
        print("<")
    else:
        print(">")

#B
def B():
    x,y,z = LI()
    k = 0
    for i in range(1000000000):
        k += y+z
        if k+z>x:
            print(i)
            quit()

#C
def C():
    n,m = LI()
    print((100*n+1800*m)*2**m)
#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 40816
#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f, MOD = 1000000007;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*-----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  string s; cin >> s;
  vector<pair<string, string> > sec;
  for (int mask = 0; mask < (1 << n); ++mask) {
    string red = "", blue = "";
    REP(i, n) {
      if ((mask >> i) & 1) red += s[n + i];
      else blue += s[n + i];
    }
    reverse(ALL(red));
    reverse(ALL(blue));
    sec.emplace_back(blue, red);
  }
  sort(ALL(sec));
  long long ans = 0;
  for (int mask = 0; mask < (1 << n); ++mask) {
    string red = "", blue = "";
    REP(i, n) {
      if ((mask >> i) & 1) red += s[i];
      else blue += s[i];
    }
    ans += upper_bound(ALL(sec), make_pair(red, blue)) - lower_bound(ALL(sec), make_pair(red, blue));
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 30956
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

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

int f(int a) {
   int res = 0;
   for (int i = 0; 1LL<<i <= a; i++) {
      int n = 1LL<<i;
      int tmp = a / (2*n) * n;
      if (a % (2*n) >= n) {
         tmp += a % (2*n) + 1 - n;
      }
      if (tmp % 2 == 1) {
         res |= 1LL<<i;
      }
   }
   return res;
}

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

   cout << (f(A-1) ^ f(B)) << endl;

   return 0;
}


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

using namespace std;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF LLONG_MAX
#define EPS 1e-8
#define all(v) (v).begin(),(v).end()
#define sq(x) ((x)*(x))
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)


#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
typedef long double dbl;
bool codejam = 0;

const int MOD = 1000*1000*1000 + 7;
const int NMAX = 1000*1000 + 11;

int arr[NMAX];
int n,m,p,q,k,a,b,c,ans;
string s,str;
char ch;
vector<int> v;

const int step = 1e18;

void solve()
{
    cin>>n;
    int ans = 1;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    if(arr[0] == 0){
        cout<<"0";
        return;
    }
    ans = 1;
    for(int i=0;i<n;i++){
        if(arr[i] - (1.0*step/(ans)) - EPS > 0){
            // tr(step,arr[i],ans,(1.0*step/(ans)));
            cout<<"-1";
            return;
        }
        ans = ans*arr[i];
        if(ans - step > 0){
            cout<<"-1";
            return;
        }
        // tr(ans, ans-step);
    }
    cout<<ans;
}

int32_t main(){ fio;
    int t = 1;
    int cs = 1;
    while(t--){
        if(codejam){
            cout<<"Case #"<<cs<<": ";
        }
        cs++;
        solve();
        cout<<"\n";
    }
}

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

int main() {
	int n, k, ans=0;
	bool arr[101] = { 0 };
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int j = 0; j < d; j++) {
			int snuke;
			cin >> snuke;
			arr[snuke] = true;
		}
	}

	for (int i = 1; i <= n; i++) {
		if (!arr[i]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <deque>
#include <numeric>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
using namespace std;
using namespace __gnu_pbds;
void PUNKS_NOT_DEAD() {
#ifdef PUNK
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX_N = 2e2 + 47;

vector<int> g[MAX_N];

int m[MAX_N][MAX_N];

int zip(int s) {
    int res = 0;
    vector<int> k(MAX_N + 1);
    k[s] = 1;
    vector<int> edges = {s};
    while (edges.size()) {
        res++;
        vector<int> new_edges;
        for (auto x : edges) {
            for (auto y : g[x]) {
                if (!k[y]) {
                    k[y] = 1;
                    new_edges.push_back(y);
                    for (auto z : new_edges) {
                        if (m[z][y]) {
                            cout << -1;
                            exit(0);
                        }
                    }
                }
            }
        }
        edges = new_edges;
    }
    return res;
}

void PUNK_WILL_FUCK_ALL() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            char v;
            cin >> v;
            if (v == '1') {
                g[i].push_back(j);
                m[i][j] = 1;
            }
        }
    }
    int d = 0;
    for (int x = 1; x <= n; x++) {
        d = max(d, zip(x));
    }
    cout << d;
}

signed main() {
    PUNKS_NOT_DEAD();
    PUNK_WILL_FUCK_ALL();
}

Measured memory_bytes: 640
n = int(input())

dots = []
for _ in range(n):
    x, y, h = map(int, input().split())
    dots.append((x, y, h))

x_, y_, h_ = sorted(dots, key=lambda x: x[2], reverse=True)[1]

for cx in range(101):
    for cy in range(101):
        H = h_+abs(x_ - cx) + abs(y_ - cy)

        ans = []
        for x, y, h in dots:
            if max(H - abs(x-cx)-abs(y-cy), 0) == h:
                ans.append((cx, cy, H))

        if len(ans) == n:
            print(*ans[0])
            exit()

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SZ(x) ((int)((x).size()))

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

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

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

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

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

template<class TH>
void _dbg(const char* name, TH val){
    clog << name << ": " << val << endl;
}
template<class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
    while(*names != ',') clog << *names++;
    clog << ": " << curr_val << ", ";
    _dbg(names+1, vals...);
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
    #define dbg_arr(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg(...)
    #define dbg_arr(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    int X;
    cin >> X;
    for (int i = 1; ; i++) {
        if (X*i % 360 == 0) {
            cout << i << "\n";
            return 0;
        }
    }
}


Measured memory_bytes: 3652
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}
int main(){
    int n=in();
    int m=in();
    int ans=n-m-m;
    cout<<max(0,ans)<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int r; cin >> r;
    cout << fixed << setprecision(20) << 2 * r * acos(-1.0) << '\n';

}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll INF=1e15;
const int maxn=100000;
int n,m,p,tot,w[maxn];
ll dis[maxn];
int head[maxn],nxt[maxn],to[maxn];
queue<pair<int,int> > q;
bool vis[maxn];
void add(int x,int y,int z) {
	//printf("%d %d %d\n",x,y,z);
	tot++; nxt[tot]=head[x];
	head[x]=tot; to[tot]=y; w[tot]=z;
}
vector<int> g[maxn];
bool r[maxn];
void add(int x,int y) {
	g[x].push_back(y);
}
void dfs(int x) {
	if (r[x]) return;
	r[x]=1;
	for (int i=0;i<g[x].size();i++)
		dfs(g[x][i]);
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m); read(p); int x,y,z;
	for (int i=1;i<=m;i++) {
		read(x); read(y); read(z);
		add(x,y,p-z);
		add(y,x);
	}
	dfs(n);
	for (int i=1;i<=n;i++) dis[i]=INF;
	q.push(make_pair(1,0)); dis[1]=0;
	while (!q.empty()) {
		int u=q.front().first,c=q.front().second; q.pop(); vis[u]=0;
		if (c>n&&r[u]) { printf("-1\n"); return 0; }
		if (c>n) continue;
		for (int i=head[u],v;i;i=nxt[i]) {
			v=to[i];
			if (dis[v]>dis[u]+w[i]) {
				dis[v]=dis[u]+w[i];
				if (!vis[v]) q.push(make_pair(v,c+1)),vis[v]=1;
			}
		}
	}
	if (dis[n]>0) printf("0\n");
	else printf("%lld\n",-dis[n]);
	return 0;
}

Measured memory_bytes: 4480
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
#include<math.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N, Q;
string s;
char mgc[200200];
int dir[200200];

bool C1(int x){
    for(int i = 0; i < Q; i++){
        if(s[x] == mgc[i]){
            x += dir[i];
        }
    }
    return (x == 0);
}

int bs1(int lb, int ub){
    while(ub - lb > 1){
        int mid = (ub + lb) / 2;
        if(C1(mid))lb = mid;
        else ub = mid;
    }
    return lb;
}

bool C2(int x){
    for(int i = 0; i < Q; i++){
        if(s[x] == mgc[i]){
            x += dir[i];
        }
    }
    return (x == N);
}

int bs2(int lb, int ub){
    while(ub - lb > 1){
        int mid = (ub + lb) / 2;
        if(C2(mid))ub = mid;
        else lb = mid;
    }
    return lb;
}

signed main(){
    cin >> N >> Q;
    cin >> s;
    N++;
    s = ' ' + s + ' ';
    for(int i = 0; i < Q; i++){
        char a, b;
        cin >> a >> b;
        mgc[i] = a;
        if(b == 'L'){
            dir[i] = -1;
        }
        else {
            dir[i] = 1;
        }
    }
    int L = bs1(0, N);
    int R = bs2(0, N);
    cout << max(R - L, 0) << endl;

    return 0;
}

/*

*/

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

const int vmax=1000010;
const int inf=1023456789;

int N,M,S;
struct node{int to,cost;};
vector<node> graph[vmax];

typedef tuple<int,int> state;
int dist[vmax];

void dijkstra(){
	rep(i,N)dist[i]=inf;
	dist[S]=0;
	priority_queue<state,vector<state>,greater<state>> q;
	q.push(state(0,S));
	while(!q.empty()){
		int c,v;tie(c,v)=q.top();q.pop();
		for(auto &e:graph[v]){
			int nc=c+e.cost;
			int nv=e.to;
			if(dist[nv]>nc){
				dist[nv]=nc;
				q.push(state(nc,nv));
			}
		}
	}
	return;
}

int main(void){
	cin >> N >> M >> S;
	rep(i,M){
		int a,b,c;
		cin >> a >> b >> c;
		graph[a].push_back({b,c});
	}
	dijkstra();
	rep(i,N){
		if(dist[i]==inf)
			cout << "INF" << endl;
		else
			cout << dist[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 34252
import java.util.Scanner;

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

		int S;
		int W;
		Scanner scan = new Scanner(System.in);

		S = scan.nextInt();
		W = scan.nextInt();

		if(S > W){
			System.out.println("safe");
		}else if(W >= S){
			System.out.println("unsafe");
		}
	}
}

Measured memory_bytes: 35728
s = input()

g,p = 0,0
ans = 0
for i in range(len(s)):
    if s[i] == "g" and p < g:
        p += 1
        ans += 1
    elif s[i] == "g" :
        g += 1
    elif s[i] == "p" and p < g:
        p += 1
    elif s[i] == "p":
        g += 1
        ans -= 1
print(ans)


Measured memory_bytes: 39792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int n;
int x[200200], y[200200];
char u[200200];

int ans = inf;
vector<pair<int, char>> v[400400];

void init() {
  rep(i, 400400) {
    v[i].clear();
    v[i].shrink_to_fit();
  }
}

void solve1() {
  init();
  rep(i, n) if (u[i] == 'U' || u[i] == 'D') v[x[i]].push_back({y[i], u[i]});
  rep(i, 200200) {
    if (v[i].empty()) continue;
    sort(v[i].begin(), v[i].end());
    rep(j, v[i].size() - 1) {
      if (v[i][j].second == 'U' && v[i][j + 1].second == 'D') {
        chmin(ans, (v[i][j + 1].first - v[i][j].first) * 5);
      }
    }
  }
}

void solve2() {
  init();
  rep(i, n) if (u[i] == 'U' || u[i] == 'R') v[x[i] + y[i]].push_back({y[i], u[i]});
  rep(i, 400400) {
    if (v[i].empty()) continue;
    sort(v[i].begin(), v[i].end());
    rep(j, v[i].size() - 1) {
      if (v[i][j].second == 'U' && v[i][j + 1].second == 'R') {
        chmin(ans, (v[i][j + 1].first - v[i][j].first) * 10);
      }
    }
  }
}

void solve() {
  solve1();
  solve2();
}

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

  cin >> n;
  rep(i, n) cin >> x[i] >> y[i] >> u[i];
  rep(_, 4) {
    solve();
    rep(i, n) {
      int rx = x[i] - 1e5, ry = y[i] - 1e5;
      x[i] = ry + 1e5;
      y[i] = -rx + 1e5;
      if (u[i] == 'U') u[i] = 'R';
      else if (u[i] == 'L') u[i] = 'U';
      else if (u[i] == 'D') u[i] = 'L';
      else if (u[i] == 'R') u[i] = 'D';
    }
  }
  if (ans == inf) {
    cout << "SAFE\n";
    return 0;
  }
  cout << ans << '\n';

  

  




  
  return 0;
}

Measured memory_bytes: 20940
#include<stdio.h>

int main()
{
   long int arr[10001],n,i,max,min,sum=0;
   scanf("%ld",&n);

   for(i=0;i<n;i++)
    scanf("%ld", &arr[i]);

   min=arr[0];
   max=arr[0];

   for(i=0;i<n;i++)
   {
       if(arr[i]>max)
        max=arr[i];
       if(arr[i]<min)
        min=arr[i];

       sum+=arr[i];
   }
   printf("%ld %ld %ld\n",min,max,sum);
}



Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
    //freopen("3.txt","r",stdin);
	int n,m;
	scanf("%d%d",&n,&m);
	memset(a,0,sizeof(a));
	for(int i=1;i<=m;++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		a[u]++;
		a[v]++;
	}
	for(int i=2;i<=n;++i)
	{
		if(a[i]%2) 
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
    return 0;
}

Measured memory_bytes: 640