akhauriyash/Code-Regression huggingface dataset:
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }




int main() {
	fastio;

	ll a, b, c;
	cin >> a >> b >> c;
	cout << c / a * b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int main() {
  string s,t, u;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  cin >> u;
  if(u==s) a=a-1;
  if(u==t) b=b-1;
  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())

mod  = 10**9+7

ans = 1

if n == m:
    ans *= 2
    for i in range(1, n+1):
        ans *= i
        ans %= mod
    for i in range(1, m+1):
        ans *= i
        ans %= mod
elif abs(n-m) == 1:
    for i in range(1, n+1):
        ans *= i
        ans %= mod
    for i in range(1, m+1):
        ans *= i
        ans %= mod
else:
    ans = 0

print(ans)


Measured memory_bytes: 9120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		String[][] A = new String[N][N];
		String[][] B = new String[M][M];
		for (int i = 0; i < N; i++) {
			String str = sc.next();
			String[] temp = new String[N];
			for (int j = 0; j < N; j++) {
				temp[j] = String.valueOf(str.charAt(j));
			}
			A[i] = temp;
		}
		for (int i = 0; i < M; i++) {
			String str = sc.next();
			String[] temp = new String[M];
			for (int j = 0; j < M; j++) {
				temp[j] = String.valueOf(str.charAt(j));
			}
			B[i] = temp;
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (A[i][j].equals(B[0][0])) {
					int cnt = 0;
					for (int k = 0; k < M; k++) {
						for (int l = 0; l < M; l++) {
							if (i + k < N && j + l < N) {
								if (A[i + k][j + l].equals(B[k][l])) {
									cnt++;
								}
							}
						}
					}
					if (cnt == M * M) {
						System.out.println("Yes");
						return;
					}
				}

			}
		}
		System.out.println("No");

	}

}

Measured memory_bytes: 22612
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <cstring>

using namespace std;

typedef long long LL;

#define MAXN 100010

char s[MAXN];

int main()
{
    scanf("%s", s);
    int i, n = strlen(s);
    for(i = 0; i < n - 2; ++i)
        if(s[i] != s[i + 2])
            break;
    if(i >= n - 2) printf("Second\n");
    else{
        if(s[0] == s[n - 1]) --n;
        printf("%s\n", n & 1 ? "First" : "Second");
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define name(x) #x
using namespace std;


const int INF = INT_MAX-100;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

template< typename T >
using Edges =vector< edge<T> >;
template< typename T >
using WeightedGraph =vector< Edges<T> >;
using UnWeightedGraph =vector< vector<int> >;
template< typename T >
using Matrix =vector< vector<T> >;



int main() {
    // if double is required
    //cout<<fixed<<setprecision(10);

    int N;
    cin >> N;
    int K;
    cin >> K;
    
    int count = 0;
    
    for(auto i = 1; i<=N; i+=2){
        count+=1;
    }
    
    if (count >=K){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    
    return 0;
}



Measured memory_bytes: 256
w, h, x, y = list(map(int, input().split(" ")))
area = (float(w) * float(h)) / 2
c_x = float(w) / 2
c_y = float(h) / 2
result = 1 if c_x == x and c_y == y else 0
print (str(area) + " " + str(result))

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

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    
    ll N; cin >> N;
    if (N%2l == 1l) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll bunbo = 10;
    while (N/bunbo > 0) {
        ans += N/bunbo;
        bunbo *= 5;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int h, w, a, b;
    scanf("%d %d %d %d", &h, &w, &a, &b);
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if((i>=b && j<a) || (i<b && j>=a)) printf("%d", 1);
            else printf("%d", 0);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1280
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int k,a,b;
	cin >> k >> a >> b;
	if(a%k==0){
		cout << "OK" << endl;
		return 0;
	}
	a/=k; b/=k;
	if(b>a)cout << "OK" << endl;
	else cout << "NG" << endl;
}	


Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m;
	cin>>n>>m;
	ll ar[n+1];
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}
	if(n==1){
		while(m>0){
			ar[1]=ar[1]/2;
			m--;
		}
		cout<<ar[1];
	}
	else{
		priority_queue<ll> pq;
		for(i=1;i<=n;i++){
			pq.push(ar[i]);
		}

		while(m>0){
			k=pq.top();
			pq.pop();
			k=k/2;
			pq.push(k);
			m--;
		}

		ll an=0;
		while(pq.size()>0){
			an+=pq.top();
			//cout<<pq.top()<<endl;
			pq.pop();
		}
		cout<<an;
	}
	return 0;
}

Measured memory_bytes: 2168
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  vector<int> vec(n+1);
  rep(i,n-1){
    int k;
    cin>>k;
    vec[k]++;
  }
  rep(i,n){
    cout << vec[i+1] <<endl;
  }
    
  return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+9;
int n,ac,bc;
struct str{int m;string st;}a[N],b[N];
bool cmp(const str&a,const str&b){return a.m>b.m;}
string last="";
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		string s; cin>>s;
		int sum=0,mx=-1e9,mn=1e9;
		for(int j=0;j<s.size();j++){
			if(s[j]=='(') sum++;
			else sum--;
			mn=min(mn,sum);
		} sum=0;
		for(int j=s.size()-1;j>=0;j--){
			if(s[j]=='(') sum++;
			else sum--;
			mx=max(mx,sum);
		}
		if(sum>=0) a[++ac]=(str){mn,s};
		else b[++bc]=(str){mx,s};
	}
	sort(a+1,a+ac+1,cmp), sort(b+1,b+bc+1,cmp);
	for(int i=1;i<=ac;i++) last+=a[i].st;
	for(int i=1;i<=bc;i++) last+=b[i].st;
	int sum=0;
	for(int i=0;i<last.size();i++){
		if(last[i]=='(') sum++;
		else sum--;
		if(sum<0) return puts("No"),0;
	}
	if(sum==0) puts("Yes");
	else puts("No");
	return 0;
}

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

int main(){
    long long int a,b,c,d;
    cin>>a>>b>>c>>d;

    long long int max;
    max=a*c;
    if(max<a*d) max=a*d;
    if(max<b*c) max=b*c;
    if(max<b*d) max=b*d;

    cout<<max<<endl;
}

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

int main()
{
    int a, b;
    // scanf("%d %d", &a, &b);
    cin >> a >> b;
    if (a > b)
    {
        cout << "a > b" << endl;
    }
    else if (a < b)
    {
        cout << "a < b" << endl;
    }
    else
    {
        cout << "a == b" << endl;
    }

    return 0;
}


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

void Main() {
    // input
    int N, R;
    cin >> N >> R;

    // translate
    int innerRating;
    if (N >= 10) {
        innerRating = R;
    } else {
        innerRating = R + 100 * (10 - N);
    }


    // output
    cout << innerRating << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3636
n = gets.to_i
h = gets.split.map(&:to_i)

dp = [0,(h[1]-h[0]).abs]
(n-2).times do |i|
  dp[i+2] = [dp[i]+(h[i+2]-h[i]).abs, dp[i+1]+(h[i+2]-h[i+1]).abs].min
end
p dp[n-1]

Measured memory_bytes: 11396
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    char a, b;
    cin >> a >> b;
    
    cout << ((a == b) ? "H" : "D");
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
/*
 * 2350.cc: A-B Problem
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10;

/* typedef */

/* global variables */

int as[MAX_N], bs[MAX_N], cs[MAX_N + 1], brs[MAX_N + 1], tens[MAX_N + 1];
bool deps[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int a, b, k;
  cin >> a >> b >> k;

  int n = 0;
  for (; a; a /= 10)
    as[n++] = a % 10;
  //printf("n=%d\n", n);

  for (int i = 0; i < n; i++) {
    bs[i] = b % 10;
    b /= 10;
  }

  brs[0] = 0;
  tens[0] = 1;
  for (int i = 0; i < n; i++) {
    if (as[i] - brs[i] >= bs[i]) {
      cs[i] = as[i] - brs[i] - bs[i];
      brs[i + 1] = 0;
    }
    else {
      cs[i] = as[i] - brs[i] + 10 - bs[i];
      brs[i + 1] = 1;
      deps[i + 1] = (as[i] == bs[i]);
    }
    tens[i + 1] = tens[i] * 10;
  }

  //for (int i = n - 1; i >= 0; i--) printf("%d ", brs[i]); putchar('\n');
  //for (int i = n - 1; i >= 0; i--) printf("%d ", deps[i]); putchar('\n');
  //for (int i = n - 1; i >= 0; i--) printf("%d ", cs[i]); putchar('\n');

  for (int i = n - 1; i >= 0 && k > 0; i--)
    if (brs[i] && ! deps[i + 1]) {
      //printf("i=%d: %d->%d\n", i, cs[i], cs[i] + 1);
      cs[i]++, k--;
    }

  int ans = 0;
  for (int i = n - 1; i >= 0; i--)
    ans = ans * 10 + cs[i];
  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 1148
#define NDEBUG
#include <bits/stdc++.h> 

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,t,s) for(int i = (int)(t); i >= (int)(s); --i)
#define rep(i,n) repU(i,0,n - 1)
#define rep1(i,n) repU(i,1,n)
#define all(v) begin(v),end(v)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1) / (d) + 1)
#define parity(a,b) (((a)^(b)) & 1 ^ 1)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = (1 << 30) - 1;
const ll INF_64 = (1LL << 62) - 1;
const int MOD = 1e9 + 7;

int N,M,R,r[8];
ll d[210][210],ans = INF_64 * 2;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N >> M >> R;
	rep1(i,N)rep1(j,N) if(i != j) d[i][j] = INF_32 * 2; else d[i][j] = 0;
	rep(i,R) cin >> r[i];
	rep(i,M){
		int u,v,c; cin >> u >> v >> c;
		d[u][v] = d[v][u] = c;
	}
	rep1(k,N)rep1(i,N)rep1(j,N) d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
	int p[] = {0,1,2,3,4,5,6,7};
	do{
		ll tmp = 0;
		rep(i,R - 1) tmp += d[r[p[i]]][r[p[i + 1]]];
		ans = min(ans,tmp);
	}while(next_permutation(p,p + R));
	cout << ans << endl;
}






Measured memory_bytes: 640
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=924844033;





int main(){
    ll n,d1,d2;
    cin>>n>>d1>>d2;
    vector<vector<ll>> A(2*n,vector<ll>(2*n,0));
    ll k=1;
    while(d1%4==0){d1/=4; k*=2;}
    if(d1&1){
        for(int i=0;i<2*n;i++){
            for(int t=0;t<2*n;t++){
                A[i][t]=(i/k+t/k)&1;
            }
        }
    }
    else{
        for(int i=0;i<2*n;i++){
            for(int t=0;t<2*n;t++){
                A[i][t]=(i/k)&1;
            }
        }
    }
    k=1;
    while(d2%4==0){d2/=4; k*=2;}
    if(d2&1){
        for(int i=0;i<2*n;i++){
            for(int t=0;t<2*n;t++){
                A[i][t]|=((i/k+t/k)&1)*2;
            }
        }
    }
    else{
        for(int i=0;i<2*n;i++){
            for(int t=0;t<2*n;t++){
                A[i][t]|=((i/k)&1)*2;
            }
        }
    }
    vector<ll> cnt(4,0);
    for(int i=0;i<2*n;i++){
        for(int t=0;t<2*n;t++){
            cnt[A[i][t]]++;
        }
    }
    for(int j=0;j<4;j++){
        if(cnt[j]>=n*n){
            k=0;
            for(int i=0;i<2*n;i++){
                for(int t=0;t<2*n;t++){
                    if(A[i][t]==j){
                        k++;
                        cout<<i<<" "<<t<<endl;
                        if(k==n*n){return 0;}
                    }
                }
            }
        }
    }
    
    
    
    return 0;
}


Measured memory_bytes: 3840
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
struct edge { LL to, cost; };

const LL inf = 11234567890123456;
LL N, M;
std::vector<LL>dist;
std::vector<std::vector<edge>>G;

// １つでも負閉路が存在するか
bool bellman_ford(LL n, LL s)
{
	std::fill(dist.begin(), dist.end(), inf);
	dist[s] = 0;
	rep(i, n)
	{
		for (LL v = 1; v <= n; ++v)
		{
			for (auto e : G[v])
			{
				if (dist[v] != inf && dist[e.to] > dist[v] + e.cost)
				{
					dist[e.to] = dist[v] + e.cost;
					if (i == n - 1) return true;
				}
			}
		}
	}
	return false;
}

// s -> t の経路中に負閉路が存在するか
bool bellman_ford(LL n, LL s, LL t)
{
	std::fill(dist.begin(), dist.end(), inf);
	dist[s] = 0;
	rep(i, 2 * n)
	{
		for (LL v = 1; v <= n; ++v)
		{
			for (auto e : G[v])
			{
				if (dist[v] != inf && dist[e.to] > dist[v] + e.cost)
				{
					dist[e.to] = dist[v] + e.cost;
					if (i >= n - 1 && e.to == t) return true;
				}
			}
		}
	}
	return false;
}

int main()
{
	in >> N >> M;
	std::vector<LL>a(M), b(M), c(M);
	dist.resize(N + 1); G.resize(N + 1);
	rep(i, M) in >> a[i] >> b[i] >> c[i];
	rep(i, M) G[a[i]].push_back({ b[i],-c[i] });
	if (bellman_ford(N, 1, N)) out << "inf" << std::endl;
	else out << -dist[N] << std::endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		System.out.println(Math.min(A, B) + Math.min(C, D));
	}
}


Measured memory_bytes: 21716
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV



readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> BC.ByteString -> Int
solve n as = minimum eachnum where
    !unpacked = BC.unpack as
    scanner (!east, !west) 'E' =  (east +1, west) 
    scanner (!east, !west) _ = (east, west+1)
    lrsumacc :: UV.Vector (Int, Int)
    !lrsumacc = GV.fromList $ scanl' scanner (0, 0) unpacked
    rlsumacc :: UV.Vector (Int, Int)
    !rlsumacc = GV.fromList $ scanr (flip scanner) (0, 0) unpacked
    eachnum = (\i -> (snd $ lrsumacc GV.! (i - 1)) + (fst $ rlsumacc GV.! i)) <$> [1..n]

main = do
    n <- readInt
    s <- BC.getLine
    print $ solve n s


Measured memory_bytes: 79100
import math

a,b,x = map(int,input().split())

v = a*a*b

h = x / (a*a)

if 2*x <= v:
	#x = a*b*num/2
	num = (2*x) / (a*b)
	#tan(ans) = b / num
	ans = math.degrees(math.atan(b/num))
	print('{:.12g}'.format(ans))
else:
	#v-x = a*num*a/2
	num = 2*(v-x) / (a*a)
	#tan(ans) = num / a
	ans = math.degrees(math.atan(num/a))
	print('{:.12g}'.format(ans))


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>

int main(void){
    int n;
    long long m;
    std::cin >> n >> m;

    std::vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        std::cin >> a.at(i) >> b.at(i);
    }

   std::map<int, long long> mp;

   for(int i = 0; i < n; i++){
       if(mp.count(a.at(i))){
           mp[a.at(i)] += b.at(i);
       }
       else{
           mp[a.at(i)] = b.at(i);
       }
   }

   long long cost = 0;
   for(auto shop :mp){
       long long temp = std::min(m, shop.second);
       cost += shop.first * temp;
       m -= temp;
   }
   std::cout << cost << std::endl;
   return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
long n,sum=1,count;
scanf("%ld",&n);
for(count=1;count<=n;){
sum=sum*count;
sum=sum%1000000007;
count++;
}
  printf("%ld",sum);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}

// TODO: write
int main() {
  ll a,b,c;cin>>a>>b>>c;
  if(a > c || b > c){
    print("No");
    return 0;
  }
  if(a*a + b*b + c*c > 2*a*b+2*c*a+2*c*b){
    print("Yes");
  }else{
    print("No");
  }

  return 0;
}


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long k = long.Parse(Console.ReadLine());

            char prev = '%'; //%をNULLの代わりに使う
            long result = 0;

            if(s.Length == 1)
            {
                //sが1文字の場合
                Console.WriteLine(k / 2);
                return;
            }

            for(int i = 0; i < s.Length; i++)
            {
                char c = s[i];
                if(i == 0)
                {
                    prev = c;
                    continue; //最初はスキップ
                }
                if(c == prev)
                {
                    //一致した場合、文字を変更する必要がある
                    result++;
                    //文字を変更した場合、次の文字とは必ず違う文字にできるので、nullを代入
                    prev = '%';
                    continue;
                }
                prev = c;
                continue;
            }
            if(prev != s[0] || k == 1)
            {
                result = k * result;
                Console.WriteLine(result);
                return;
            }
            result++;

            long secondResult = 0;
            s = s.Substring(1);
            for (int i = 0; i < s.Length; i++)
            {
                char c = s[i];
                if (i == 0)
                {
                    prev = c;
                    continue; //最初はスキップ
                }
                if (c == prev)
                {
                    //一致した場合、文字を変更する必要がある
                    secondResult++;
                    //文字を変更した場合、次の文字とは必ず違う文字にできるので、nullを代入
                    prev = '%';
                    continue;
                }
                prev = c;
                continue;
            }

            if (prev == s[0])
            {
                //prevと一致するということは、最後の文字がまた置換されなかったということ
                //なので、残りのk回はこの結果を流用すればいい
                result = result + ((secondResult + 1) * (k - 1)) - 1;
                Console.WriteLine(result);
                return;
            }
            else
            {
                //そうでないなら、最後の一文字を置換するパターンと、そうでないパターンが、それぞれ連続で現れるということ
                if (k % 2 == 0)
                {
                    result = ((result * k) + (secondResult * k) / 2);
                    Console.WriteLine(result);
                    return;
                }
                else
                {
                    result = (((result * (k - 1)) + (secondResult * (k - 1))) / 2) + result - 1;
                    Console.WriteLine(result);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	/*ll N, K;
	cin >> N >> K;
	ll t1 = N%K;
	ll t2 = abs(t1 - K);

	ll ans = min(t1, t2);
	

	cout << ans << endl;*/
	ll H, W;
	//vector<ll> S(AMAX + 1);
	cin >> H >> W;
	ll ans = H * W;
	ll s[3];
	for (int i = 0; i < 2; i++)
	{
		for (int h = 1; h <= H; h++)
		{
			//まずは縦割り
			s[0] = h * W;
			s[1] = (H - h) * (W / 2);
			s[2] = H * W - (s[0] + s[1]);
			sort(s, s + 3);
			ans = min(ans, s[2] - s[0]);

			//次いで横割り
			s[0] = h * W;
			s[1] = ((H - h) / 2) * W;
			s[2] = H * W - (s[0] + s[1]);
			sort(s, s + 3);
			ans = min(ans, s[2] - s[0]);
			
		}
		//板チョコを90度回す。
		swap(H, W);

	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
s=[0]*n
diff=[0]*(n)
Sum=0
for i in range(n):
  Sum+=a[i]
  s[i]=Sum
#print(s)
SUM=sum(a)
for i in range(n):
  diff[i]=abs(s[i]-(SUM-s[i]))
  
#print(diff)
print(min(diff))

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

int main() {
  string id, add_id;
  //値の受け取り
  cin >> id >> add_id;
  
  //add_idの文字列の長さを取得
  int add_id_length = add_id.size();
  
  //add_idの末尾の文字を取得
  char end_char = add_id[add_id_length-1];
  
  //idに末尾追加
  id.push_back(end_char);
  
  //比較
  if(id == add_id)
  {
  	cout << "Yes" << endl;
  }
  else
  {
  	cout << "No" << endl;
  }
}

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

int main() {
    int n; cin >> n;
    map<int, int> a;
    ll sum = 0;
    rep(i, n) {
        int x;
        cin >> x;
        a[x]++;
        sum += x;
    }

    int q; cin >> q;
    rep(i, q) {
        int b, c;
        cin >> b >> c;
        a[c] += a[b];
        sum += (c - b) * a[b];
        a[b] = 0;
        cout << sum << endl; 
    }

    return 0;
}

Measured memory_bytes: 8008
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

int H, W;
char map[20][20];
int dist_value;
int dist[20][20];
struct coord  {
  int x;
  int y;
};


int drow[4]={1,-1,0,0};
int dcolumn[4]={0,0,1,-1};
std::queue<coord > queue;
coord last;


void initdist(){
  dist_value = 0;
  // queueをまず空にする
  std::queue<coord > empty;
  std::swap(queue, empty);
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      dist[i][j] = -1;
    }
  }
  return;
}

void bfs(int start_i, int start_j){
  //printf("bfs called\n");
  queue.push((coord){start_i,start_j});
  queue.push((coord){-1,-1});
  dist_value = 0;
  while (queue.size()>1){ // 番兵のみ(size=1)になったら終了
    //std::cout << "queue.size()="<<queue.size() << std::endl;
    while(queue.front().x!=-1 && queue.front().y!=-1){ // 番兵に達するまで処理を続ける
      int thisi = queue.front().x;
      int thisj = queue.front().y;
      last.x = thisi;
      last.y = thisj;
      queue.pop();
      dist[thisi][thisj]=dist_value;
      for(int k=0; k<4; k++){
        if (thisi+drow[k]>=0 && thisi+drow[k]<H && thisj+dcolumn[k]>=0 && thisj+dcolumn[k]<W){
          if (dist[thisi+drow[k]][thisj+dcolumn[k]]==-1 && map[thisi+drow[k]][thisj+dcolumn[k]]!='#'){
            queue.push((coord){thisi+drow[k], thisj+dcolumn[k]});
            dist[thisi+drow[k]][thisj+dcolumn[k]] = -2;
          }
        }
      }
    }
    //std::cout << "queue.size at L 63="<<queue.size() << std::endl;
    //先頭にたまっている番兵を全て捨てる(複数の番兵が溜まっていることがあることに注意)
    while(queue.size()>0 && queue.front().x==-1 && queue.front().y==-1){
      queue.pop();
      //std::cout << "queue.size at L 67="<<queue.size() << std::endl;
      //std::cout << "front value = " << queue.front().x << "," << queue.front().y << std::endl;
    }
    //std::cout << "queue.size at L 68="<<queue.size() << std::endl;
    queue.push((coord){-1,-1}); //末尾に番兵を追加
    dist_value++;
  }
  return;
}


int maxdist(){
  int ans = 0;
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      if (map[i][j]=='#'){
        continue;
      }
      initdist();
      bfs(i,j);
      ans = std::max(ans,dist_value-1);
    }
  }
  return ans;
}

int main(){
  scanf("%d",&H);
  scanf("%d",&W);
  std::string S;
  
  for (int i=0; i<H; i++){
    std::cin >> S;
    for (int j=0; j<W; j++){
      map[i][j] = S[j];
    }
  }
  int ans = maxdist();
  printf("%d\n",ans);

  return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;
public class Main{
    static Scanner sc = new Scanner(System.in);
    static int n, a, b, c;
    static int A,B,C;
    public static void main(String[] args){
        while(read()){

        }
    }

    static boolean read(){
        if(!sc.hasNext())return false;
        n = sc.nextInt();
        for(int i = 0; i < n; i++){
            a = sc.nextInt();
            b = sc.nextInt();
            c = sc.nextInt();
            solve();
        }
        return true;
    }

    static void solve(){
        if(a != 0 && b != 0 && c!= 0){
            A = a * a;
            B = b * b;
            C = c * c;
            if(A == B + C){
                System.out.println("YES");
            }else if(B == A + C){
                System.out.println("YES");
            }else if(C == A + B){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }

}


Measured memory_bytes: 34048
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

ll a[200000];
int main() {
	ll n, k; cin >> n >> k;
	rep(i, 0, n) cin >> a[i];
	sort(a, a + n);
	reverse(a, a + n);

	ll sum = 0;
	rep(i, k, n) sum += a[i];

	cout << sum << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define LL long long 
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
const int mod=1e9+7;
int nextt[Maxn<<1][26];
int dp[Maxn<<1];
char str[Maxn<<1];
int main()
{
	//input;output;
	while(~scanf("%s",str))
	{
		memset(dp,inf,sizeof(dp));
		memset(nextt,0,sizeof(nextt));
		int len=strlen(str);
		for(int i=0;i<26;i++)
			nextt[len][i]=len;
		dp[len+1]=0;
		for(int i=len-1;i>=0;i--)
			for(int j=0;j<26;j++)
			{
				nextt[i][j]=str[i]=='a'+j?i:nextt[i+1][j];
				dp[i]=min(dp[i],dp[nextt[i][j]+1]+1);
			}
		int pos=0;
		while(pos<len)
		{
			for(int i=0;i<26;i++)
			{
				if(dp[pos]==dp[nextt[pos][i]+1]+1)
				{
					pos=nextt[pos][i]+1;
					putchar('a'+i);
					break;
				}
			}
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Vec = vector<int>;
using Graph = vector<Vec>;
#define INF 1000000007
#define MOD 1000000007
#define SEP " "

class UnionFind
{
	vector<int> parent;

	public:

	UnionFind(int n)
	{
		parent.resize(n);
		for (int i = 0; i < n; i++)
			parent[i] = i;
	}

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

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);
		if (x == y)
			return ;
		parent[x] = y;
	}

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

int		main(void)
{
	int n, m;
	cin >> n >> m;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
		p[i]--;
	}
	UnionFind uft(n);
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		uft.unite(x, y);
	}
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		if (uft.same(i, p[i]))
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 1024
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

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


Measured memory_bytes: 256
#include <stdio.h>
typedef struct {
    int number;
    double time;
    
}sensyu;

int main(){
    sensyu fast;
    sensyu fast2;
    sensyu array[3][8];
    int i, j;
    for (i = 0; i < 3; i++) {
        for (j = 0; j < 8; j++) {
            scanf("%d %lf",&array[i][j].number, &array[i][j].time);
        }
    }
    int kumi = 0;
    int counter = 0;
    while (kumi < 3) {
        counter = 0;
        while (counter < 2) {
            for (i = counter; i < 8; i++) {
                if (i == counter) {
                    fast = array [kumi][i];
                }
                if (fast.time > array [kumi][i].time) {
                        fast = array [kumi][i];
                }
        
            
            }
            for (i = counter; i < 8; i++) {
                if (fast.time == array [kumi][i].time) {
                    array[kumi][i] = array[kumi][counter];
                    array[kumi][counter] = fast;
                    printf("%d %.2f\n",array[kumi][counter].number ,array[kumi][counter].time);
                }
            }
            counter++;
        }
        kumi++;
    }
    for (i = 0; i < 3; i++) {
        for (j = 2; j < 8; j++) {
            if (i == 0 && j == 2) {
                fast = array[i][j];
            }
            else if(fast.time > array [i][j].time){
                fast = array[i][j];
            }
        }
    }
    printf("%d %.2f\n",fast.number, fast.time);
    for (i = 0; i < 3; i++) {
        for (j = 2; j < 8; j++) {
            if (i == 0 && j == 2 && fast.number != array[i][j].number) {
                fast2 = array[i][j];
            }
            else if(fast2.time > array [i][j].time && fast.number != array[i][j].number){
                fast2 = array[i][j];
            }
        }
    }
    printf("%d %.2f\n",fast2.number, fast2.time);

            
    
    return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
	int n,m;
	string S;
	cin >> n >> m;
	if (n <= 0 && m >= 0)
		cout << "Zero" << endl;
	else if (n > 0 && m > 0)
		cout << "Positive" << endl;
	else if ((abs(n) - abs(m)) % 2 == 1)
		cout << "Positive" << endl;
	else
		cout << "Negative" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AXORCircle solver = new AXORCircle();
        solver.solve(1, in, out);
        out.close();
    }

    static class AXORCircle {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int[] a = new int[n];
            boolean f = false;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);

            if (n % 3 == 0) {
                int k = n / 3;
                if (a[0] == a[k - 1] && a[k] == a[2 * k - 1] && a[2 * k] == a[3 * k - 1] && (a[0] ^ a[k]) == a[2 * k])
                    f = true;
                if (a[k - 1] == 0 && a[k] > 0 && a[k] == a[3 * k - 1]) f = true;
            }

            if (a[n - 1] == 0) f = true;

            out.println(f ? "Yes" : "No");

        }

    }
}



Measured memory_bytes: 50580
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        int N = RInt();
        var D = new int[N][];
        for (int i = 0; i < N; i++)
        {
            D[i] = RInts();
        }

        int maxcnt = 0;
        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            if (D[i][0] == D[i][1])
            {
                cnt++;
                maxcnt = Math.Max(maxcnt,cnt);
            }
            else
            {
                cnt = 0;
            }
        }
        WriteLine(maxcnt>=3?"Yes":"No");
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    cout << S+(S.back()=='s'? "es\n":"s\n");
}

Measured memory_bytes: 3580
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int maN = 1e6+5;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    
    for(int i = 0; i< n; ++i)
    {
        cin >> a[i];
    }
    vector<ll> def(n,0);
    ll sum = 0;
    
    def[0] = 0;
    for(int i = 1; i < n; ++i)
    {
        if(a[i] < a[i-1] && def[i-1] == 0)
        {
            def[i] = a[i-1]-a[i];
            sum += def[i];
        }
        else if(def[i-1] != 0)
        {
            ll cur_he = def[i-1] + a[i-1];
            if(cur_he > a[i])
            {
                def[i] = cur_he - a[i];
                sum += def[i];
            }
        }
    }
    cout << sum;
	return 0;
}








Measured memory_bytes: 6340
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    std::string N;
    std::cin >> N;

    std::vector<int> A;
    A.push_back(0);
    for (size_t i = 0; i < N.size(); ++i) {
        int t;
        N[i] >> t;
        A.push_back(N[i] - '0');
    }

    std::reverse(std::begin(A), std::end(A));

    size_t c = N.size();
    size_t i = 0;
    for (size_t i = 0; i < c; ++i) {
        if (A[i] < 9) {
            for (int j = i+1; j < c; ++j) {
                if (A[j] != 0) {
                    A[j]--;
                    A[i] = 9;
                    for (int k = i+1; k < j; ++k) {
                        A[k] = 9;
                    }
                }
            }
        }
    }
    auto sum = std::accumulate(std::begin(A), std::end(A), 0, [](int total, int v)  {
            return total + v;
        });

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

    return 0;
}


Measured memory_bytes: 256